var is = new Is();
/* Browser check */
function Is() {
	var agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
	this.ns2 = (this.ns && (this.major == 2));
	this.ns3 = (this.ns && (this.major == 3));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns5 = (this.ns && (this.major > 4));
	this.ns6 = (this.ns && (agent.indexOf('netscape6')!=-1) );
	this.ns7 = (this.ns && (agent.indexOf('netscape/7')!=-1) );
	this.ns7pr = (this.ns && (agent.indexOf('netscape/7.0b1')!=-1) );
	this.ns71 = (this.ns && (agent.indexOf('netscape/7.1')!=-1) );
	this.ns72 = (this.ns && (agent.indexOf('netscape/7.2')!=-1) );
	this.ie = (agent.indexOf("msie") != -1);
	this.ie3 = (this.ie && (this.major == 2));
	this.ie4 = (this.ie && (this.major >= 4));
	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
	this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1));
	this.op3 = (agent.indexOf("opera") != -1);
	this.pc  = (agent.indexOf("win") != -1);
	this.mac = (agent.indexOf("mac")!=-1); // Mac detect
	this.client = ( (navigator.userAgent.indexOf('AOL')!=-1) || (navigator.userAgent.indexOf('CS 2000')!=-1) )? 1 : 0;
	this.moz = ( this.ns && (agent.indexOf("netscape/") == -1) );
	if (this.moz) this.ns = 0;
}

function GetXMLHttp() {
	var xmlhttp = null;
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}else {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
}
	
function bluring(event) { 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
} 

String.prototype.trim=function()
{
	var str=this.replace(/(\s+$)/g,"");
	str=str.replace(/(^\s*)/g,"");
	str=str.replace("¡¡","");
	return str;
}

function FieldValidationHelper(obj, msg) {
	if(obj.value.trim() == "") {
		alert(msg);
		obj.focus();
		return false;
	}	
	return true;
}

function chkEmail(email){
    if(email.indexOf ('@', 0) == -1 || email.indexOf ('.', 0) == -1){
        alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ È®ÀÎÇØÁÖ¼¼¿ä");
        return false;
    }else {
	    return true;
    }
}

function chkEmailDomain(domain) {
	var IsKoreanDomain = false;
	try {
		for (i=0;i<domain.length;i++) {
			if ( (domain.charCodeAt(i)<0)||(domain.charCodeAt(i)>127) ) {
				IsKoreanDomain = true;
			}
		}
	}catch(e) {}

    if(!IsKoreanDomain) {
		if(domain.indexOf('.', 0) == -1) {
	        alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ È®ÀÎÇØ ÁÖ¼¼¿ä");
		    return false;
		}else {
		    return true;
		}
	}else {
		return true;
	}
}

function OnlyNumber(event) 
{
	
	if (event.which && (event.which<48 || event.which>57) && event.which != 8) 
	{
		event.preventDefault();		
	}else if(event.keyCode && (event.keyCode<48 || event.keyCode>57) && event.keyCode != 8) {
		event.returnValue=false;
	}
}

//¼ýÀÚÀÔ·Â¹Ú½ºÀÇ ÄÄ¸¶¸¦ Âï¾îÁÖ´Â ½ºÅ©¸³Æ® function
function CommaFormat(thisone)
{ 
    var tempnum = "";
    if(thisone.value.split(",").length ==1)
    {
        tempnum=thisone.value;
    }
    else
    {
        for(i = 0; i < thisone.value.split(",").length ; i++)
        {
            tempnum = tempnum + thisone.value.split(",")[i]
				}
    }
    
    var str   = "";  
    var count = 0;
    
    for (i = tempnum.length; i > 0; i--)
    { 
        if(tempnum.charCodeAt(i) == 46)
        {
            var tempnum2 = "";
            
            if(str.split(".").length == 1)
            {
                str = str;
            }
            else
            {
                for(k = 0; k < str.split(",").length; k++)
                {
                    tempnum2 = tempnum2 +  str.split(",")[k]
                }
                
                str = tempnum2;
                count = 0;
            }
        }
        if(count == 3)
        {     
           if (tempnum.substring(i,i-1) != '-')
           {
            str = "," + str;
           }
           count = 0;
		}
        str   = tempnum.substring(i,i-1) +str;
        count = count + 1 ;
    }
    thisone.value = str;
}

function allblur() { 
	for (i = 0; i < document.links.length; i++) 
		document.links[i].onfocus = document.links[i].blur; 
} 

function SetTarget(target, offset) { 
	if(offset >= 0) {
		for (i = offset; i < document.links.length; i++) 
			document.links[i].target = target;
	}else {
		for (i = 0; i < document.links.length + offset; i++) 
			document.links[i].target = target;
	}	
} 

function ShowPopWindow(url, name, width, height, scroll) {
	var pw = (screen.width - width) / 2; 
	var ph = (screen.height - height) / 2; 
		
	var hwnd = window.open(url, name, "toolbar=no,location=no,status=no,manubar=no,scrollbars=" + scroll + ",resizable=no,width=" + width + ",height=" + height + ",top=" + ph + ",left=" + pw + ",status=0");
	try { hwnd.focus(); }catch(e){ }
}

function bt(id,after) {
	eval(id+'.filters.blendTrans.stop();');
	eval(id+'.filters.blendTrans.Apply();');
	eval(id+'.src="'+after+'";');
	eval(id+'.filters.blendTrans.Play();');
}

function chkSpecialCharacter(str) {
	return str.match(/[^(0-9a-zA-Z°¡-ÆR\s)]/);
}

function chkIDValid(str) {
	if( str.substring(0,1).match(/[^(a-zA-Z)]/) || 
	str.match(/[^(0-9a-zA-Z)]/) || 
	str.length < 4 || 
	str.length > 14 ) {
	
		alert("¾ÆÀÌµðÀÇ Ã¹¹øÂ° ¹®ÀÚ´Â ¹Ýµå½Ã ¿µ¹®ÀÌ¾î¾ß ÇÏ¸ç,\n\n´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÔ, ÃÖ¼Ò 4ÀÚ ÀÌ»ó~ÃÖ´ë14ÀÚ±îÁö");
		return true;
	}else {
		return false;
	}
}
function chkIDValid2(str) {
	if( str.substring(0,1).match(/[^(a-zA-Z)]/) || 
	str.match(/[^(0-9a-zA-Z)]/) || 
	str.length < 4 || 
	str.length > 16 ) {
	
		alert("¾ÆÀÌµð Çü½ÄÀÌ ¿ÇÁö ¾Ê½À´Ï´Ù.");
		return true;
	}else {
		return false;
	}
}
/*
function chkIDValid3(str) {
	if( str.match(/[^(0-9a-zA-Z°¡-ÆR_)]/) || 
	str.length < 4 || 
	str.length > 16 ) {
		alert("Ä³¸¯ÅÍ ¾ÆÀÌµð Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
		return true;
	}else {
		return false;
	}
}
*/
function containsChars(input,chars) {
    for (var inx = 0; inx < input.length; inx++) {
       if (chars.indexOf(input.charAt(inx)) != -1 || input.indexOf(' ') != -1)
           return true;
    }
    return false;
}


/*
function chkIDValid3(str){ //¹ÙÀÌÆ® Á¦ÇÑ ¼ýÀÚ¸¦ ¸Å°³º¯¼ö·Î ¹ÞÀ½
  
  
	var oIDMatch = new RegExp(/^[A-Z0-9¤¡-ÆR]/g);
	var isHan = new RegExp(/[\u4E00-\u9FFF]/g);
	v=str; //ÀÔ·Â°ª
	re0=/[a-z]|[0-9]/gi; //¿µ¼ýÀÚ ÆÐÅÏ
	
	re1=/[¤¡-ÆR]/g; //ÇÑ±ÛÆÐÅÏ
	v0=v.match(re0); //¸ÅÄ¡È®ÀÎ
	v1=v.match(re1); //¸ÅÄ¡È®ÀÎ
	var notvalid = containsChars(v ,"~!@#$%^&*()_-=+`<>:;'?/");
	if(v0!=null)v0=v0.length; //¹ÙÀÌÆ® ±¸ÇÔ
	if(v1!=null)v1=v1.length; //¹ÙÀÌÆ® ±¸ÇÔ
	tot=v0+(v1*2); //ÇÕÀ» ±¸ÇÔ
	if(tot<=16 && tot >= 4 && oIDMatch.test(str) && !notvalid)
	{ 
		if(isHan.test(str))
		{
			alert('Ä³¸¯ÅÍ ¾ÆÀÌµð Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
			return true;
		}
		return false;
	} else 
	{ //ÇÑ°è¸¦ ÃÊ°úÇÏ¸é °æ°í¹® Ãâ·Â
		alert('Ä³¸¯ÅÍ ¾ÆÀÌµð Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
		return true;
	}	
	
 }
 */
 
 function chkIDValid3(str)
 { //¹ÙÀÌÆ® Á¦ÇÑ ¼ýÀÚ¸¦ ¸Å°³º¯¼ö·Î ¹ÞÀ½
  
	var oIDMatch = new RegExp(/[^A-Za-z0-9¤¡-ÆR]/g);
	var isHan = new RegExp(/[\u4E00-\u9FFF]/g);
	v=str; //ÀÔ·Â°ª
	re0=/[a-z]|[0-9]/gi; //¿µ¼ýÀÚ ÆÐÅÏ

	re1=/[¤¡-ÆR]/g; //ÇÑ±ÛÆÐÅÏ
	v0=v.match(re0); //¸ÅÄ¡È®ÀÎ
	v1=v.match(re1); //¸ÅÄ¡È®ÀÎ

	if(v0!=null)v0=v0.length; //¹ÙÀÌÆ® ±¸ÇÔ
	if(v1!=null)v1=v1.length; //¹ÙÀÌÆ® ±¸ÇÔ
	tot=v0+(v1*2); //ÇÕÀ» ±¸ÇÔ

	if(oIDMatch.test(str))
	{
		alert('Ä³¸¯ÅÍ ¾ÆÀÌµð Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
		return true;
	} 
	else 
	{ //ÇÑ°è¸¦ ÃÊ°úÇÏ¸é °æ°í¹® Ãâ·Â
		if(tot<=16 && tot >= 4)
		{
			if(isHan.test(str))
			{
				alert('Ä³¸¯ÅÍ ¾ÆÀÌµð Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
				return true;
			}
		}
		else
		{
			alert('Ä³¸¯ÅÍ ¾ÆÀÌµð Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
			return true;
		}
	}	
}
 
 
 function ReturnLength(str){ //¹ÙÀÌÆ® Á¦ÇÑ ¼ýÀÚ¸¦ ¸Å°³º¯¼ö·Î ¹ÞÀ½
  
  
	v=str; //ÀÔ·Â°ª
	re0=/[a-z]|[0-9]/gi; //¿µ¼ýÀÚ ÆÐÅÏ
	re1=/[¤¡-ÆR]/g; //ÇÑ±ÛÆÐÅÏ
	//re2=/[$\\@\\\#%\^\&amp;\*\(\)\[\]\+\_\{\}\`\~\=\|]/g;
	v0=v.match(re0); //¸ÅÄ¡È®ÀÎ
	v1=v.match(re1); //¸ÅÄ¡È®ÀÎ
	//v2=v.march(re2);
	
	if(v0!=null)v0=v0.length; else v0 = 0; //¹ÙÀÌÆ® ±¸ÇÔ
	if(v1!=null)v1=v1.length; else v1 = 0; //¹ÙÀÌÆ® ±¸ÇÔ
	
	
	if((v0+v1)  >= 16 )
	{
		alert(str.length);
		event.keyCode = null;
		return false;
	}
 }
 
 


function IsKorean(str) {
	if((/[^(°¡-ÆR)]/).test(str)) {
		return false;
	}
	return true;
}

function chkPwdValid(field)
{
	//var reg = /[^0-9a-zA-Z]/g;
//	var reg2 = /[A-Z]/g;
//	var reg2 = /[0-9]/g;
//	var reg3 = /[_]/g;
	
	
	//return ( (reg1.test(str) || reg2.test(str)) && reg3.test(str) );
	/*
	alert(str.match(reg));
	if( str.match(reg) || str.length < 8 || str.length > 16 ) {
	
	
		alert("ºñ¹Ð¹øÈ£´Â ¿µ¹®ÀÚ¿Í ¼ýÀÚ·Î ÀÌ·ç¾î Á®¾ß ÇÏ¸ç, ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÕ´Ï´Ù.\n\nÃÖ¼Ò 8ÀÚ ÀÌ»ó~ ÃÖ´ë 16ÀÚ±îÁö");
		return true;
	}else {
		return false;
	}*/
	//return PWDMatch2(str);
	
	var chk;
	
	var strLength = field.length
	var isSet1 = false;
	var isSet2 = false;
	if(strLength < 6 || strLength > 16)
	{
		alert("ºñ¹Ð¹øÈ£´Â ¿µ¹®ÀÚ¿Í ¼ýÀÚ·Î ÀÌ·ç¾î Á®¾ß ÇÏ¸ç, ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÕ´Ï´Ù.\n\nÃÖ¼Ò 8ÀÚ ÀÌ»ó~ ÃÖ´ë 16ÀÚ±îÁö");	
	}
	for(i = 0 ; i < strLength ; i++){
		chk = field.charCodeAt(i)
		if((chk >= 97 && chk <= 122) || (chk >= 65 && chk <= 90))
		{	
			isSet2  = true;			
		}
		else if(chk >= 48 && chk <= 57)
		{
			isSet1  = true;
		}		
		else {
			alert("ºñ¹Ð¹øÈ£´Â ¿µ¹®ÀÚ¿Í ¼ýÀÚ·Î ÀÌ·ç¾î Á®¾ß ÇÏ¸ç, ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÕ´Ï´Ù.\n\nÃÖ¼Ò 8ÀÚ ÀÌ»ó~ ÃÖ´ë 16ÀÚ±îÁö");
			return false;
		}
	}
	if(isSet1  == false)
	{
		alert("ºñ¹Ð¹øÈ£¿¡´Â ¹Ýµå½Ã ¼ýÀÚ°¡ Æ÷ÇÔµÇ¾î¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	else if(isSet2  == false)
	{
		alert("ºñ¹Ð¹øÈ£¿¡´Â ¹Ýµå½Ã ¿µ¹®ÀÚ°¡ Æ÷ÇÔµÇ¾î¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	else
	{		
		return true;
	}
	
}



function SSN_chk(jumin) // ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
{
	var jumin;
	var check=0;
	
	var IDtot = 0;
	var IDAdd = "234567892345";
	for(i=0;i<12;i++)
	IDtot=IDtot+parseInt(jumin.substring(i,i+1))*parseInt(IDAdd.substring(i,i+1));
	
	IDtot = 11 - (IDtot%11);
	if(IDtot == 10) IDtot=0;
	else if(IDtot == 11) IDtot=1;
	
	check = parseInt(jumin.substring(2,4));
	check2 = parseInt(jumin.substring(4,6));
	
	if(check<0 || check>12 || check2<0 || check2>31) {
		return false;
	}

	if(parseInt(jumin.substring(12,13)) != IDtot) {
		return false;
	}
		
	return true;
}


function BizNo_chk(vencod) {
	var sum = 0;
	var getlist =new Array(10);
	var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
	for(var i=0; i<10; i++) { getlist[i] = vencod.substring(i, i+1); }
	for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
	sum = sum + parseInt((getlist[8]*5)/10);
	sidliy = sum % 10;
	sidchk = 0;
	if(sidliy != 0) { sidchk = 10 - sidliy; }
	else { sidchk = 0; }
	if(sidchk != getlist[9]) { return false; }
	return true;
}


function MM_swapImgRestore() { //v3.0
  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() { //v3.0
  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) { //v4.01
  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() { //v3.0
  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];}
}


// PopWindow2
function ShowPopWindow2(url, width, height, scroll) {
	//SetStopMainMovie();
	if(is.ie && !is.op3) {
		document.body.detachEvent("onclick", HidePopLayer);
			
		var pw = (window.screenLeft); 
		var ph = (window.screenTop); 
		var heightOffset = (document.body.scrollTop + 20);
		var widthOffset = (document.body.scrollLeft + 20);
		
		document.getElementById("frmContent").src = url;
		document.getElementById("divPopWindow").style.display = "";
		document.getElementById("divPopWindow").style.left = (document.body.clientWidth / 2) - (width / 2) + widthOffset;
		document.getElementById("divPopWindow").style.top = (document.body.clientHeight / 2) - (height / 2) + heightOffset;
		
		document.getElementById("frmContent").width = width;
		document.getElementById("frmContent").height = height;
		document.getElementById("frmContent").style.scrolling = scroll;
	}else {
		ShowPopWindow(url, "PopWindow", width, height, "no");
	}
	
	setTimeout("SetFocusFrame();", 200);
}

function SetStopMainMovie() {
	try {
		if(document.getElementById("MainMovie").IsPlaying()) {	
			document.getElementById("MainMovie").GotoFrame(document.getElementById("MainMovie").TotalFrames - 2);
			document.getElementById("MainMovie").Play();
			bIsEnd = true;
		}
	}catch(e) { }
}

function HidePopLayer() {
	if(is.ie && !is.op3) {
		if(document.getElementById('divPopWindow').style.display == '') {
			document.getElementById('frmContent').src = "about:blank";
			document.getElementById('divPopWindow').style.display = "none";
			document.body.detachEvent("onclick", HidePopLayer);	
		}
	}else {
		window.self.close();
	}
}

function SetFocusFrame() {
	try {
		if(document.getElementById('frmContent').readyState != "complete") {
			setTimeout("SetFocusFrame();", 200);
		}else {
			document.body.attachEvent("onclick", HidePopLayer);
			document.getElementById('frmContent').focus();
		}
	}catch(e) { }
}

function resizeImg(obj, width, height) {
	
	var thumb = new Image;
	thumb.src = obj.src;
	var w = thumb.width;
	var h = thumb.height;
	
	var bModify = false;
	if(w == 0 || h == 0) {
		obj.width = width;
	}else {
		if( width != -1 && w > width) {
			obj.width = width;
			bModify = true;
		}
		if( height != -1 && h > height) {
			obj.height = height;
			bModify = true;
		}
		//if(bModify) setTimeout("resizeImg('" + obj + "','" + width + "','" + height + "');", 200);
	}
}

function GetSafeUrl(url) {
	if((url.length > 6 && url.substr(0,7) != "http://") &&
	(url.length > 7 && url.substr(0,8) != "https://")) {
		return "http://" + url;
	}else {
		return url;
	}
}

// Floater
function heartBeat() {
	if(is.ie) { 
		diffY = document.body.scrollTop; 
		diffX = 0; 
	}else {
		diffY = self.pageYOffset; 
		diffX = self.pageXOffset; 
	}
	
	if(diffY != lastScrollY) {
		percent = .1 * (diffY - lastScrollY);
		if(percent > 0) percent = Math.ceil(percent);
		else percent = Math.floor(percent);
		
		if(is.ie) document.getElementById('floater').style.pixelTop += percent;
		else document.getElementById('floater').style.top += percent; 
		lastScrollY = lastScrollY + percent;
	}
	
	if(diffX != lastScrollX) {
		percent = .1 * (diffX - lastScrollX);
	
		if(percent > 0) percent = Math.ceil(percent);
		else percent = Math.floor(percent);
		
		if(is.ie) document.getElementById('floater').style.pixelLeft += percent;
		else document.getElementById('floater').style.top += percent;
		lastScrollY = lastScrollY + percent;
	} 
} 

// Show Gallery
function PopGallery(Type, No) {
	if(Type == 1) {
		ShowPopWindow("./Default.aspx?wbs=6.3.2&No=" + No, "PopGallery", 750, 630, 'no');
	}else {
		alert("µî·ÏµÈ ÀÌ¹ÌÁö°¡ ¾ø½À´Ï´Ù.");
		return false;   
    }
}

//¡Ú¡Ú¡Ú¡Ú¡Ú¡Ú °Ô½ÃÆÇ ¸¶¿ì½º bgcolor º¯°æ ¡Ú¡Ú¡Ú¡Ú¡Ú¡Ú//
function ChangeOverBgColor(sID, sCategory)
{			
	if( sCategory != null )
	{
		sCategory = sCategory.toLowerCase();
		if( sCategory == "hack" )
		{
			sID.style.backgroundColor = "#10050A";							
		}
		else if( sCategory == "ir" )
		{
			sID.style.backgroundColor = "#fff8f1";
		}
		else if( sCategory == "recruit" )
		{
			sID.style.backgroundColor = "#f6feed";					
		}
		else if( sCategory == "press" )
		{
			sID.style.backgroundColor = "#e1fbfe";				
		}	
		else if( sCategory == "ceo" )
		{
			sID.style.backgroundColor = "#E9EBFE";				
		}	
		else
		{
			sID.style.backgroundColor = "#eeeeee";					
		}
	}
}

function ChangeOutBgColor(sID)
{			
	sID.style.backgroundColor = "#000000";																	
}

//¿À·ÎÁö ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÑ ... 
function OnlyNumericCheck(thisone)
{ 
    var tempnum=thisone.value;
    for (i = 0; i <= tempnum.length; i++)
    { 
        if(tempnum.charCodeAt(i) < 48 || tempnum.charCodeAt(i) > 57)
        {
            thisone.value = tempnum.substring(0,i);
            break ;
        }
    }
}


function NumberToPrice(num) 
{
	var str = num.toString();
	var Re = /[^0-9]/g;
	var ReN = /(-?[0-9]+)([0-9]{3})/;
	str = str.replace(Re,'');              
	while (ReN.test(str)) { 
		str = str.replace(ReN, "$1,$2"); 
	}
	return str;
}

function PriceToNumber(tmpStr)
{
	var str = tmpStr.replace(/,/g,"");
	return str;
}

function checkdigit( checkval ) 
{
     var idx;
     var val = new String( checkval );
     var len = val.length;
     for( idx=0; idx< len; idx++ ) {
         if( val.charAt(idx)!= '0' &&
             val.charAt(idx)!= '1' &&
             val.charAt(idx)!= '2' &&
             val.charAt(idx)!= '3' &&
             val.charAt(idx)!= '4' &&
             val.charAt(idx)!= '5' &&
             val.charAt(idx)!= '6' &&
             val.charAt(idx)!= '7' &&
             val.charAt(idx)!= '8' &&
             val.charAt(idx)!= '9' ) {
             return false;
         }
     }
     return true;
 }
 
 
 function ReturnServer(value)
	{	
		switch(value)
		{
			case '1':
				return '¸ÓÅ¥¸®';
			case '2':
				return 'ºñ³Ê½º';
			case '3':
				return '¸¶¸£½º';
			case '4':
				return 'ÁêÇÇÅÍ';
			case '5':
				return '»õÅÏ';
			case '6':
				return '³ÜÆª';
			case '7':
				return 'ÇÃ·çÅä';
			case '8':
				return '·¹¿À';
			case '9':				
				return '½Ã¸®¿ì½º';
			case '10':				
				return 'µå¶óÄÚ';
			default:
				return 'Unknown';
		}
	}

function SetCookie( name, value, expiredays )
{
   var todayDate = new Date();
   todayDate.setDate( todayDate.getDate() + expiredays );   
   document.cookie = name + '=' + escape( value ) + '; path=/; expires=' + todayDate.toGMTString() + ';domain=cabal.co.kr;';
}
function GetCookie( name ){
   var nameOfCookie = name + "=";
   var x = 0;
   while ( x <= document.cookie.length )
   {
      var y = (x+nameOfCookie.length);
      if ( document.cookie.substring( x, y ) == nameOfCookie ) 
      {
         if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
            endOfCookie = document.cookie.length;
         return unescape( document.cookie.substring( y, endOfCookie ) );
      }
      x = document.cookie.indexOf( " ", x ) + 1;
      if ( x == 0 )
         break;
   }
   return "";
}



function StringLength(asValue)
{
	var byteLength = 0;
	var	lsEsc = "%B2%B3%B4%B7%A8%AD%B1%D7%F7%B0%A7%B8%A1%BF%A4%B6%AE%C6%D0%AA%3F%3F%D8%BA%DE%BD%BC%BE%E6%F0%F8%DF%FE%B9";
	
	for (var i = 0; i < asValue.length; i++)
	{
		var oneChar = escape(asValue.charAt(i));
		
		if (oneChar.length == 1 )
		{
			byteLength ++;
		}
		else if (oneChar.indexOf("%u") != -1)
		{
			byteLength += 2;
		}
		else if (oneChar.indexOf("%") != -1)
		{
			if(lsEsc.indexOf(oneChar) != -1)
			{
				byteLength += 2;
			}
			else
			{
				byteLength += oneChar.length / 3;
			}
		}
	}
	
	return byteLength;
}


