document.domain = 'manhwa.co.kr';

function open_win(url,win_x,win_y,scroll,win_name)
{        
   var src_x = screen.width;
   var src_y = screen.height;

	tmp_MSIE = window.navigator.userAgent.indexOf("MSIE");
	if(tmp_MSIE && window.navigator.userAgent.indexOf("SV1") > tmp_MSIE){   
	win_y = win_y + 40;
	}

   var x= (src_x - win_x)/2; 
   var y= (src_y - win_y)/2;

   if(!win_name)
       var win_name = 'window';

   winopen = window.open(url,win_name,'left='+ x +',top='+ y +',width='+ win_x +', height=' + win_y + ', menubar=no, scrollbars=' + scroll +', staus=no, resizable=yes, titlebar=no, toolbar=no, hotkey=0,closeable=o');  

//winopen = window.open(url,win_name,'');  

}

function move_center(win_x,win_y)
{        
    var src_x = screen.width;
    var src_y = screen.height;

	win_y = win_y + 40;

    var x= (src_x - win_x)/2; 
    var y= (src_y - win_y)/2;
    moveTo(x,y);
    window.resizeTo(win_x,win_y);
}


function setComma(str) 
{ 
	if(!str) str = 0;

    str = ''+str+''; 
    var retValue = ''; 
    for(i=0; i<str.length; i++) 
    { 
        if (i > 0 && (i%3)==0)
            retValue = str.charAt(str.length - i -1) + ',' + retValue; 
        else
            retValue = str.charAt(str.length - i -1) + retValue; 
     } 
     return retValue; 
} 

function LTrim(str)
{
 var whitespace = new String(" \t\n\r");

 var s = new String(str);

 if (whitespace.indexOf(s.charAt(0)) != -1) {

            var j=0, i = s.length;

            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;

            s = s.substring(j, i);
        }

        return s;
}

function RTrim(str)
{
        var whitespace = new String(" \t\n\r");

        var s = new String(str);

        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {

            var i = s.length - 1;       // Get length of string

            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                i--;

            s = s.substring(0, i+1);
        }

        return s;
}


function Trim(str)
{
    return RTrim(LTrim(str));
}

/// ÇÃ·¡½¬ ÆÐÄ¡ ///////////////////////////////////

	function GET(arrayKey, arrayValue, Value) {
		count = arrayKey.length;
		for(i=0;i<count;i++) {
			if(arrayKey[i]==Value) {
				return arrayValue[i];
				break;
			}
		}
	}

	function mEmbed() {
		var key = new Array();
		var value = new Array();
		error_check=0;
		for(i=0;i<mEmbed.arguments.length;i++) {
			data = mEmbed.arguments[i].split('=');
			key[i] = data[0];
			value[i] = data[1];
		}

		contents = '';
		srcdata = GET(key,value,'src');
		if(/\.(...)$/.test(srcdata)) {
			flashon = 1;
		}

		classid = GET(key,value,'classid');
		codebase = GET(key,value,'codebase');
		if(flashon==1) {
			classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0';
		}
		if(classid && codebase) {
			contents += '<object';
			if(classid) {
				contents += ' classid="' + classid + '"';
			}
			if(codebase) {
				contents += ' codebase="' + codebase + '"';
			}
			count = key.length;
			for(i=0;i<count;i++) {
				if(value[i]!='') {
					if(key[i]!='src') {
						contents += ' ' + key[i] + '="' + value[i] + '"';
					}
				}
			}
			contents += '>';
			for(i=0;i<count;i++) {
				if(value[i]!='') {
					if(flashon==1 && key[i]=='src') {
						contents += '<param name="movie" value="' + value[i] + '" />';
					} else {
						contents += '<param name="' + key[i] + '" value="' + value[i] + '" />';
					}
				}
			}
		}
		contents += '<embed';
		for(i=0;i<count;i++) {
			if(value[i]!='') {
				contents += ' ' + key[i] + '="' + value[i] + '"';
			}
		}
		contents += '>';
		contents += '</embed>';
		if(classid && codebase) {
			contents += '</object>';
		}
		document.write(contents);
	}

/// ÇÃ·¡½¬ ÆÐÄ¡ ³¡ ///////////////////////////////


function AddZzim(no,use_db)
{
		manhwa_hidden.location = 'http://login.manhwa.co.kr/info2/zzim/add_zzim.php?no='+no+'&use_db='+use_db;
}