String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }

function bluring(){
	if( event.srcElement.tagName=="A" ||
		event.srcElement.tagName=="IMG") 
		document.body.focus();
}
document.onfocusin=bluring;

function makeComma(num) 
{
	num = '' + num;
	if (num.length > 3) 
	{
		var mod = num.length % 3;
		var output = (mod > 0 ? (num.substring(0,mod)) : '');
		for (i=0 ; i < Math.floor(num.length / 3); i++) 
		{
			if ((mod == 0) && (i == 0))
				output += num.substring(mod+ 3 * i, mod + 3 * i + 3);
			else
				output+= ',' + num.substring(mod + 3 * i, mod + 3 * i + 3);
		}
		return (output);
	}
	else return num;
}
function CallByte(strSource) 
{
    var tmpStr;
    var temp=0;
    var onechar;
    var tcount;
    tcount = 0;
    tmpStr = new String(strSource);
    temp = tmpStr.length;
    for (k=0;k<temp;k++)
    {
		onechar = tmpStr.charAt(k);
		if(escape(onechar) =='%0D') continue; 
		else if(escape(onechar).length > 4) tcount += 2; 
		else tcount++; 
    }
	return tcount;
}
function confirmAction(message, link_url, target)
{
	if(target) target = target+".";
	else target = "";
	if(confirm(message))
		eval(target+"location.replace('"+link_url+"');");
	else 
		return;
}
function showImage(src)
{
	var imgObj = new Image();
	imgObj.src = src;

	var wOpt = "scrollbars=no,status=no,resizable=no";
	wOpt += ",width=" + imgObj.width;
	wOpt += ",height=" + imgObj.height;

	var wBody = "";
	wBody += "<head>";
	wBody += "<title>»çÁø º¸±â</title>";
	wBody += "<script language='javascript'>";
	wBody += "function finalResize(){";
	wBody += "  var oBody=document.body;";
	wBody += "  var oImg=document.images[0];";
	wBody += "  var xdiff=oImg.width-oBody.clientWidth;";
	wBody += "  var ydiff=oImg.height-oBody.clientHeight;";
	wBody += "  window.resizeBy(xdiff,ydiff);";
	wBody += "}";
	wBody += "</"+"script>";
	wBody += "</head>";
	wBody += "<body onLoad='finalResize()' style='margin:0'>";
	wBody += "<a href='javascript:window.close()'><img src='" + src + "' border=0></a>";
	wBody += "</body>";

	winResult = window.open("about:blank", "", wOpt);
	winResult.document.open("text/html", "replace");
	winResult.document.write(wBody);
	winResult.document.close();
	winResult.focus();
}
function EmbedProcess() 
{
	document.write(document.getElementById("objectFlash").value);	    
	document.getElementById("objectFlash").id = "objectFlashOk";
}
function parseSize(val,Position)
{	
	var size = parseInt(val);
	if(size==0) return "0Bytes";
	if(size < 1024) return size + "Bytes";
	else if (size < Math.pow(1024,2)) return Round(size /  Math.pow(1024,1),Position,'F') + "KB";
	else if (size < Math.pow(1024,3)) return Round(size /  Math.pow(1024,2),Position,'F') + "MB";
	else if (size < Math.pow(1024,4)) return Round(size /  Math.pow(1024,3),Position,'F') + "GB";
	else return Round(size /  Math.pow(1024,4),Position,'F') + "TB";	
}
function Round(Num, Position , Base)
{
	if(Position == 0) return Math.round(Num); 
    else if(Position > 0)
	{
		var cipher = '1';
		for(var i=0; i < Position; i++ ) cipher = cipher + '0';
		var no = Number(cipher);
		if(Base=="F") return Math.round(Num * no) / no;
		else return Math.round(Num / no) * no;		
	 }
}
function newWindow(url, target, width, height, sbar) { 
	var top = (screen.height - height) / 2 -30;
	var left = (screen.width - width) / 2;	
    if(sbar) sbar = 'yes';
    else sbar = 'no';
    var modaless = window.open(url, target, 'width='+width+',height='+height+',top='+top+',left='+left+',scrollbars='+sbar); 
    modaless.focus();
} 
function newWindowPay(url, target, width, height, sbar) { 
	var top = (screen.height - height) / 2 -30;
	var left = (screen.width - width) / 2;	
    if(sbar) sbar = 'yes';
    else sbar = 'no';
    var modaless = window.open(url, target, 'width='+width+',height='+height+',top='+top+',left='+left+',scrollbars='+sbar); 
	if(modaless == null)
		alert("°áÁ¦Ã¢ ÆË¾÷ÀÌ Â÷´ÜµÇ¾ú½À´Ï´Ù!\r\n\r\nÁÖ¼ÒÁÙ ÇÏ´ÜÀÇ ³ë¶õ»ö ¹Ù¸¦ Å¬¸¯ÇØ¼­ ÆË¾÷À» ÇØÁ¦ÇÏ¼¼¿ä");
	else 
		modaless.focus();
}
function MM_swapImgRestore() {
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { 
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { 
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() {
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_showHideLayers() {
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}


function IsWinXPSP2()
{
	try {
		var info = window.clientInformation;
		var reg1 = /[^A-Z0-9]MSIE[ ]+6.0[^A-Z0-9]/i;
		var reg2 = /[^A-Z0-9]WINDOWS[ ]+NT[ ]+5.1[^A-Z0-9]/i;

		if ((info.appMinorVersion.replace(/\s/g,"").toUpperCase().indexOf(";SP2;") >= 0) && 
			(reg1.test(info.userAgent) == true) && (reg2.test(info.userAgent) == true))
			return true;
	}
	catch(e) {
		return false;
	}
	return false;
}

var xmlHttp = null;

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
    
function startRequest(method, url, param, callbackfunc) {
    createXMLHttpRequest();
	
    if(xmlHttp == null) {
		alert('Create Error');
		return;
	}
	
	xmlHttp.open(method, url, true);
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4) {
			if(xmlHttp.status == 200) {
				callbackfunc();
			}
		}		
	}

	if(method == "POST") {
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=EUC-KR');
		xmlHttp.send(param);
	}
	else {
	    xmlHttp.send(null);
	}
}

function showhide(what){
	if (what.style.display=='none'){
	what.style.display='';
	}
	else{
		what.style.display='none'
	}
}

// ¼¿·ºÆ® ¹Ú½º option ³Ö±â
function optionAdd(input_name, text , value)
{
	newOption = document.createElement("OPTION"); 
	newOption.text = text; 
	newOption.value = value; 
	input_name.add(newOption); 
}

// ¼¿·ºÆ® ¹Ú½º selected
function setSelect(obj,value)
{
    if(value) {
      var str = "document.all['"+obj+"'].value = '"+value+"';";
      eval(str);
	 // alert(document.all['list_count'].value);
    }
}

 // ÇÃ·¡½Ã ½ºÅ©¸³Æ® (¹è°æ Åõ¸íÇÏ°Ô ÇÏ´Â ºÎºÐ Æ÷ÇÔ)
 function flash(c,d,e) {
 var flash_tag = "";
 flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
 flash_tag +='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
 flash_tag +='WIDTH="'+c+'" HEIGHT="'+d+'" >';
 flash_tag +='<param name="movie" value="'+e+'">';
 flash_tag +='<param name="quality" value="high">';
 flash_tag +='<param name="wmode" value="transparent">';
 flash_tag +='<embed src="'+e+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
 flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+c+'" HEIGHT="'+d+'"></embed></object>'

 document.write(flash_tag);

}

function thirdparty_setup(){
	try{
		document.all.qinstaller.check();
	}catch(e){
		return;
	}
}

function init_qplus_func(){
	thirdparty_setup();
}