var js_img = 'http://img.candybar.co.kr/img';

// ¸Þ´ºÅ¬¸¯½Ã
function menu_click(link_go,link_to,link_mode){
	if(link_go != null) link_go = '/?GO='+link_go;
	if(link_to != null) link_to = '&TO='+link_to;
	if(link_mode == 0){
		location.href= 'http://'+ document.location.hostname + link_go + link_to;
	}else{
		
	}
}

// ·Î±×ÀÎ + ·Î±×¾Æ¿ô
function login(key){
	if (! key) {
		// ·Î±×ÀÎ½Ã
		var path = document.frm_login;
		if (path.id.value.length < 3) {
			candy_alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.id.focus();
			return;
		}
		if (path.pw.value.length < 3) {
			candy_alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.pw.focus();
			return;
		}
/* ssl */
		if(path.ssl.checked==true){
			path.action = "https://"+document.location.hostname+"/FRM/home/login/";
			path.target = "_top";
		}else{
			path.action = "/FRM/home/login/";
		}


		path.submit();
	} else {
		// ·Î±×¾Æ¿ô½Ã 
		if (candy_confirm('·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?',js_subGO)) {
			if(key == 1){
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout';
			}else{
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout&URLS='+key;
			}
		}
	}
}

// ·Î±×ÀÎ + ·Î±×¾Æ¿ô
function login_new(key){
	if (! key) {
		// ·Î±×ÀÎ½Ã
		var path = document.frm_login;
		if (path.id.value.length < 3) {
			candy_alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.id.focus();
			return;
		}
		if (path.pw.value.length < 3) {
			candy_alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.pw.focus();
			return;
		}
/* ssl */
		if(path.ssl.checked==true){
			path.action = "https://"+document.location.hostname+"/FRM/home/login/index_new.php";
			path.target = "_top";
		}else{
			path.action = "/FRM/home/login/index_new.php";
		}


		path.submit();
	} else {
		// ·Î±×¾Æ¿ô½Ã 
		if (candy_confirm('·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?',js_subGO)) {
			if(key == 1){
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout';
			}else{
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout&URLS='+key;
			}
		}
	}
}

// ·Î±×ÀÎ + ·Î±×¾Æ¿ô
function login_layer(key){
	if (! key) {
		// ·Î±×ÀÎ½Ã
		var path = document.frm_login;
		if (path.id.value.length < 3) {
			candy_alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.id.focus();
			return;
		}
		if (path.pw.value.length < 3) {
			candy_alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.pw.focus();
			return;
		}
/* ssl */
		if(path.ssl.checked==true){
			path.action = "https://"+document.location.hostname+"/FRM/home/login/index_layer.php";
			path.target = "_top";
		}else{
			path.action = "/FRM/home/login/index_layer.php";
		}


		path.submit();
	} else {
		// ·Î±×¾Æ¿ô½Ã 
		if (candy_confirm('·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?',js_subGO)) {
			if(key == 1){
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout';
			}else{
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout&URLS='+key;
			}
		}
	}
}

// ·Î±×ÀÎ + ·Î±×¾Æ¿ô
function login_layer_ham(key){
	if (! key) {
		// ·Î±×ÀÎ½Ã
		var path = document.frm_login;
		if (path.id.value.length < 3) {
			candy_alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.id.focus();
			return;
		}
		if (path.pw.value.length < 3) {
			candy_alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.pw.focus();
			return;
		}
/* ssl */
		if(path.ssl.checked==true){
			path.action = "https://"+document.location.hostname+"/FRM/home/login/index_layer_ham.php";
			path.target = "_top";
		}else{
			path.action = "/FRM/home/login/index_layer_ham.php";
		}


		path.submit();
	} else {
		// ·Î±×¾Æ¿ô½Ã 
		if (candy_confirm('·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?',js_subGO)) {
			if(key == 1){
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout';
			}else{
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout&URLS='+key;
			}
		}
	}
}

function logining(tmplogin,tmpkey){
	if(tmplogin == 19){
			eval("top.location.href = 'http://'+document.location.hostname+'/?GO=home|login&TO="+js_TO+"&URLS="+js_GO+"&LIMIT_AGE=19'");
	}else{
		if(tmpkey == 'header' || candy_confirm('·Î±×ÀÎÈÄ »ç¿ëÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.<br>·Î±×ÀÎÀ» ÇÏ½Ã°Ú½À´Ï±î?',js_subGO)){
				eval("top.location.href = 'http://'+document.location.hostname+'/?GO=home|login&TO="+js_TO+"&URLS="+js_GO+"'");
		}
	}
}

// ·Î±×ÀÎ + ·Î±×¾Æ¿ô
function login_layer_chc(key){
	if (! key) {
		// ·Î±×ÀÎ½Ã
		var path = document.frm_login;
		if (path.id.value.length < 3) {
			candy_alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.id.focus();
			return;
		}
		if (path.pw.value.length < 3) {
			candy_alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.',js_subGO);
			path.pw.focus();
			return;
		}
/* ssl */
		if(path.ssl.checked==true){
			path.action = "https://"+document.location.hostname+"/FRM/home/login/index_layer_ham.php";
			path.target = "_top";
		}else{
			path.action = "/FRM/home/login/index_layer_chc.php";
		}


		path.submit();
	} else {
		// ·Î±×¾Æ¿ô½Ã 
		if (candy_confirm('·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?',js_subGO)) {
			if(key == 1){
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout';
			}else{
				ifrm_login.location.href='http://'+document.location.hostname+'/FRM/home/login/?mode=logout&URLS='+key;
			}
		}
	}
}

function logining(tmplogin,tmpkey){
	if(tmplogin == 19){
			eval("top.location.href = 'http://'+document.location.hostname+'/?GO=home|login&TO="+js_TO+"&URLS="+js_GO+"&LIMIT_AGE=19'");
	}else{
		if(tmpkey == 'header' || candy_confirm('·Î±×ÀÎÈÄ »ç¿ëÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.<br>·Î±×ÀÎÀ» ÇÏ½Ã°Ú½À´Ï±î?',js_subGO)){
				eval("top.location.href = 'http://'+document.location.hostname+'/?GO=home|login&TO="+js_TO+"&URLS="+js_GO+"'");
		}
	}
}

// ·¹ÀÌ¾î ÆË¾÷ Å×ÀÌºí Å×µÎ¸®¿ë
function kookie_roundTable(objID) {
	var obj = document.getElementById(objID);
	var Parent, objTmp, Table, TBody, TR, TD;
	var bdcolor, bgcolor, Space;
	var trIDX, tdIDX, MAX;
	var styleWidth, styleHeight;

	// get parent node
	Parent = obj.parentNode;
	objTmp = document.createElement('SPAN');
	Parent.insertBefore(objTmp, obj);
	Parent.removeChild(obj);

	// get attribute
	bdcolor = obj.getAttribute('rborder');
	bgcolor = obj.getAttribute('rbgcolor');
	radius = parseInt(obj.getAttribute('radius'));
	if (radius == null || radius < 1) radius = 1;
	else if (radius > 6) radius = 6;

	MAX = radius * 2 + 1;
	
	/*
			create table {{
	*/
	Table = document.createElement('TABLE');
	TBody = document.createElement('TBODY');

	Table.cellSpacing = 0;
	Table.cellPadding = 0;

	for (trIDX=0; trIDX < MAX; trIDX++) {
		TR = document.createElement('TR');
		Space = Math.abs(trIDX - parseInt(radius));
		for (tdIDX=0; tdIDX < MAX; tdIDX++) {
			TD = document.createElement('TD');
			
			styleWidth = '1px'; styleHeight = '1px';
			if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
			else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
			else if (radius > 2) {
					if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
					if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
			}

			if (styleWidth != null) TD.style.width = styleWidth;
			if (styleHeight != null) TD.style.height = styleHeight;

			if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
			else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;
			
			if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
			TR.appendChild(TD);
		}
		TBody.appendChild(TR);
	}

	/*
			}}
	*/

	Table.appendChild(TBody);
	
	// insert table and remove original table
	Parent.insertBefore(Table, objTmp);
}

// ¸ð´ÞÃ¢ ¶ç¿ì±â À§ÇÑ ±âÃÊ ÇÔ¼ö
function fnSetValues(){
   var iHeight=212;
   var sFeatures="dialogHeight: " + iHeight + "px;";
   return sFeatures;
}

// popup ¸ð´ÞÃ¢ 
function candy_popup_gstmission(link,width,height,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	var sFeatures=fnSetValues();
	if (time==null) {time="NOLIMIT";}
	
	var position = sFeatures +'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+height+'px; help:no; resizable:no; status:no; scroll=no;';
	retVal = window.showModalDialog('/POP/common/alert/'+link+'&time='+time, window, position);

	if(retVal == "mission") {
		location.href='/?GO=game|gst&TO=luckmission&ctmc=050100';
	} else if(retVal == "ranking") {
		location.href='/?GO=game|gst&TO=ranking|r1&ctmc=060200';
	} else if(retVal == "cookie_mission") {
		notice_setCookie('GSTLuckEventLayer2','done',1);
		location.href='/?GO=game|gst&TO=luckmission&ctmc=050100';
	} else if(retVal == "cookie_ranking") {
		notice_setCookie('GSTLuckEventLayer2','done',1);
		location.href='/?GO=game|gst&TO=ranking|r1&ctmc=060200';
	} else if(retVal == "cookie_close") {
		notice_setCookie('GSTLuckEventLayer2','done',1);
	}
}

function candy_alert2(candy_msg,subGO,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	var sFeatures=fnSetValues();
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='410';Height='275';break;}
	}		
	
	var position = sFeatures +'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	return window.showModalDialog('/POP/common/alert/alert_'+subGO+gnb_id+'.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg, window, position);
}


// alert ¸ð´ÞÃ¢ 
function candy_alert(candy_msg,subGO,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	var sFeatures=fnSetValues();
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='390';Height='246';break;}
	}		
	
	var position = sFeatures +'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	return window.showModalDialog('/POP/common/alert/alert_'+subGO+gnb_id+'.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg, window, position);
}

// alert ¸ð´ÞÃ¢ 
function candy_alert_2011(candy_title,candy_msg,subGO,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	var sFeatures=fnSetValues();
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		case 'deactivate' : { width='355';Height='320';break;}
		default: { width='355';Height='220';break;}
	}		
	
	var position = sFeatures +'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	return window.showModalDialog('/POP/common/alert/alert_gst_2011.php?GO='+subGO+'&time='+time+'&candy_title='+candy_title+'&candy_msg='+candy_msg, window, position);
}

// alert ¸ð´ÞÃ¢ 
function candy_alert_gostarterror_2011(candy_title,candy_msg,subGO,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	var sFeatures=fnSetValues();
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='355';Height='220';break;}
	}		
	
	var position = sFeatures +'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	retVal = window.showModalDialog('/POP/common/alert/alert_gstGoStartError_2011.php?GO='+subGO+'&time='+time+'&candy_title='+candy_title+'&candy_msg='+candy_msg, window, position);

	if(retVal == "refill") {
		any_open('/POP/game/gostop_refill_2011.php?GO=game&game=gst&modal=y', '470', '600','no','refill');
	} else if(retVal == "shop") {
		location.href='/?GO=game|gst&TO=gstshop&ctmc=030100';
	}
}

// alert ¸ð´ÞÃ¢ 
function candy_alert_bad(candy_msg,subGO,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	var sFeatures=fnSetValues();
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='390';Height='266';break;}
	}		
	
	var position = sFeatures +'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	return window.showModalDialog('/POP/common/alert/alert_'+subGO+gnb_id+'.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg, window, position);
}

// alert ¸ð´ÞÃ¢ - ¸í¶û¸Â°í Ã¤³Î ¿À·ù¿ë
function candy_alert_refill(candy_msg,subGO,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	var sFeatures=fnSetValues();
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='390';Height='216';break;}
	}		
	
	var position = sFeatures +'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	
	retVal = window.showModalDialog('/POP/common/alert/alert_'+subGO+gnb_id+'.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg, window, position);

	if(retVal == "refillok") {
		any_open('/POP/game/gostop_refill_2011.php?GO=game&game=gst&modal=y', '470', '600','no','refill');
	}
}

// alert ¸ð´ÞÃ¢ - ¸í¶û¸Â°í ÀÌº¥Æ®
function candy_alert_gstevent(candy_msg,subGO,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='717';Height='800';break;}
	}		
	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=yes;';
	return window.showModalDialog('/POP/common/alert/alert_gstEvent.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg, window, position);
}

// alert ¸ð´ÞÃ¢ - ¸í¶û¸Â°í 3ÃµÁ¡ ´Þ¼º ÀÌº¥Æ® 
// 2010.11.08 KJH
function candy_alert_gstevent3000(candy_msg,subGO,dataadd,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='420';Height='260';break;}
	}		
	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:yes; status:no; scroll=no;';

	retVal = window.showModalDialog('/POP/common/alert/alert_gstEvent3000.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg+dataadd, window, position);

	if(retVal == "go3000") {
		location.href='/?GO=home|gstevent';
	}
}

// alert ¸ð´ÞÃ¢ - ¸í¶û¸Â°í 3ÃµÁ¡ ´Þ¼º ÀÌº¥Æ® °á°ú ¾Ë¸²¿ë 
// 2010.12.14 KJH
function candy_alert_gstevent3000Result(candy_msg,subGO,dataadd,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='420';Height='290';break;}
	}		
	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:yes; status:no; scroll=no;';

	return window.showModalDialog('/POP/common/alert/alert_gstEvent3000Result.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg+dataadd, window, position);
}

// alert ¸ð´ÞÃ¢ - ¸í¶û¸Â°í Çà¿îÁ¸ ÀÌº¥Æ® °á°ú ¾Ë¸²¿ë 
// 2010.12.14 KJH
function candy_alert_gstLuckEventResult(candy_msg,subGO,filename,dataadd,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='420';Height='290';break;}
	}		
	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:yes; status:no; scroll=no;';

	return window.showModalDialog('/POP/common/alert/'+filename+'?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg+dataadd, window, position);
}

// alert ¸ð´ÞÃ¢ - ¸í¶û¸Â°í Çà¿îÁ¸ 1¿ù ÀÌº¥Æ®
// 2010.12.17 KJH
function candy_alert_gstEventMission(candy_msg,subGO,dataadd,gnb_id,time){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	if (time==null) {time="NOLIMIT";}
	switch(subGO){
		default: { width='420';Height='260';break;}
	}		
	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:yes; status:no; scroll=no;';

	return window.showModalDialog('/POP/common/alert/alert_gstEventMission.php?GO='+subGO+'&time='+time+'&candy_msg='+candy_msg+dataadd, window, position);
}

// confirm ¸ð´ÞÃ¢
function candy_confirm(candy_msg,subGO,gnb_id){
	if (subGO==null || subGO=="gstcert" ||  subGO=="home|gamestarterror" ||  subGO=="home|gstilikeclick" ||  subGO=="home|gstevent" ||  subGO=="home|pwchange" || subGO=="home|nickchange") { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='390';Height='216';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	return window.showModalDialog('/POP/common/alert/confirm_'+subGO+gnb_id+'.php?GO='+subGO+'&candy_msg='+escape(candy_msg), window, position);
}

// confirm ¸ð´ÞÃ¢
function candy_confirm_2011(candy_title,candy_msg,subGO,gnb_id){
	if (subGO==null || subGO=="gstcert" ||  subGO=="home|gamestarterror" ||  subGO=="home|gstilikeclick" ||  subGO=="home|gstevent" ||  subGO=="home|pwchange" || subGO=="home|nickchange") { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: { width='355';Height='220';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';
	return window.showModalDialog('/POP/common/alert/confirm_gst_2011.php?GO='+subGO+'&candy_title='+candy_title+'&candy_msg='+candy_msg, window, position);
}

// alert ¸ð´ÞÃ¢ - °ü¸®ÀÚ Áö±Þ ¾ÆÀÌÅÛ ¾Ë¸²¿ë
// 2010.12.14 KJH
function candy_confirm_adminGiftItem(dataadd,gnb_id){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	if (gnb_id==null) { gnb_id=""; }
	
	width='439';
	Height='382';
	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:yes; status:no; scroll=no;';

	retVal = window.showModalDialog('/POP/common/alert/confirm_adminGiftItem.php?GO=home'+dataadd, window, position);

	if(retVal) FooterLocationHref(retVal);
}

// alert ¸ð´ÞÃ¢ - °ü¸®ÀÚ Áö±Þ ¹Ù/¸Ó´Ï ¾Ë¸²¿ë
// 2011.12.26 KJH
function candy_confirm_adminGiftMoney(dataadd,gnb_id){ // subGO = subGO[0] , gnb_id = integer default '', time close()
	if (gnb_id==null) { gnb_id=""; }
	
	width='450';
	Height='350';
	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:yes; status:no; scroll=no;';

	retVal = window.showModalDialog('/POP/common/alert/confirm_adminGiftMoney.php?GO=home'+dataadd, window, position);

	if(retVal) FooterLocationHref(retVal);
}

// confirm ¸ð´ÞÃ¢
function candy_confirm_displaybox(candy_msg,subGO,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='390';Height='216';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	retVal = window.showModalDialog('/POP/common/alert/confirm_displaybox.php?GO='+subGO+'&candy_msg='+escape(candy_msg), window, position);

	if(retVal == "gowitem") {
		//opener.location.href='/?GO=mypage|item&TO=witem';
		opener.displaybox_locationHref();
		self.close();
	} else self.close();
}

// confirm ¸ð´ÞÃ¢
function candy_confirm_nickchangebuy(candy_msg,subGO,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='390';Height='216';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	retVal = window.showModalDialog('/POP/common/alert/confirm_displaybox.php?GO='+subGO+'&candy_msg='+escape(candy_msg), window, position);

	if(retVal == "gowitem") {
		opener.displaybox_locationHref();
		self.close();
	} else {
		opener.nickchangebuy_reload();
		self.close();
	}
}

// confirm ¸ð´ÞÃ¢
function candy_confirm_nickchange(candy_msg,subGO,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='390';Height='216';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	retVal = window.showModalDialog('/POP/common/alert/confirm_nickchange.php?GO='+subGO+'&candy_msg='+escape(candy_msg), window, position);

	if(retVal == "gowitem") {
		nickchange_locationHref();
	}
}

// confirm ¸ð´ÞÃ¢ À¥¾ÆÀÌÅÛ ±¸¸Å¿ë
function candy_confirm_witembuy(candy_msg,subGO,witemid,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='390';Height='216';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	if(window.showModalDialog('/POP/common/alert/confirm_mypage.php?GO='+subGO+'&candy_msg='+escape(candy_msg), window, position)) {
		any_open('/POP/shop/web_item.php?GO=home&TO='+witemid+'|1&mode=buy&target=mypage','460','500','no','webitem');
	}
}

// ¸í¶û¸Â°í Ã³À½ Á¢¼Ó½Ã º»ÀÎÀÎÁõ ÇÏÁö ¾Ê´Â °æ¿ì
function candy_confirm_nocert(candy_msg,subGO,tag,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='390';Height='216';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	if(window.showModalDialog('/POP/common/alert/confirm_cert.php?GO='+subGO+'&candy_msg='+escape(candy_msg)+'&tag='+tag, window, position)) {
		if(tag != '') {
			notice_setCookie(tag,'done',1);
			opl.layerClose(tag);
		}
		nocert_submit('0');
	}
}

// ¸í¶û¸Â°í Ã³À½ Á¢¼Ó½Ã º»ÀÎÀÎÁõ ÇÏÁö ¾Ê´Â °æ¿ì
function candy_confirm_nocert_2011(candy_msg,subGO,tag,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='390';Height='216';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	if(window.showModalDialog('/POP/common/alert/confirm_cert.php?GO='+subGO+'&candy_msg='+escape(candy_msg), window, position)) {
		nocert_submit('0');
	}
}

// ¸í¶û¸Â°í °í½ºÅé¾ÆÀÌÅÛ ±¸¸Å&¼±¹° È®ÀÎ
function candy_confirm_buyandgiftcheck(candy_msg,subGO,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='350';Height='210';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	return window.showModalDialog('/POP/common/alert/confirm_BuyAndGiftCheck_2011.php?GO='+subGO+'&candy_msg='+candy_msg, window, position);
}

// ¸í¶û¸Â°í °í½ºÅé¾ÆÀÌÅÛ ±¸¸Å&¼±¹° ¿Ï·á
function candy_confirm_buytok(candy_msg,subGO,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='350';Height='210';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	return window.showModalDialog('/POP/common/alert/confirm_BuyOk_2011.php?GO='+subGO+'&candy_msg='+candy_msg, window, position);
}

// ¸í¶û¸Â°í º¹ºÒº¹¾ÆÀÌÅÛ ±¸¸Å&¼±¹° ¿Ï·á
function candy_confirm_buyGiftOkBBB(candy_title,candy_msg,subGO,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: {width='350';Height='210';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	return window.showModalDialog('/POP/common/alert/confirm_BBBBuyGiftOk_2011.php?GO='+subGO+'&candy_title='+candy_title+'&candy_msg='+candy_msg, window, position);
}

// ¸í¶û¸Â°í º¹ºÒº¹¾ÆÀÌÅÛ º¸À¯ È®ÀÎ
function candy_confirm_bbbitem_check(candy_msg,subGO,fi_id,fi_shop,gnb_id){
	if (subGO==null) { subGO='home'; }
	if (gnb_id==null) { gnb_id=""; }
	switch(subGO){
		default: { width='355';Height='220';break;}
	}	
	var position = 'unadorned:yes; dialogWidth:'+width+'px; dialogHeight:'+Height+'px; help:no; resizable:no; status:no; scroll=no;';

	if(window.showModalDialog('/POP/common/alert/confirm_BBBUseCheck_2011.php?GO='+subGO+'&candy_msg='+candy_msg, window, position)) {
		any_open('/POP/shop/item_purchase_2011.php?GO=shop&TO=5|'+fi_shop+'&ETC='+fi_id+'@|FI_BUY|0|@@','460','500','no','webitem');
	}
}

// Å°ÀÔ·Â°ªÀÌ enter °ªÀÎÁö È®ÀÎ.- run¼öÇà.
function enter(key, run){
	if(event.keyCode == 13){
		eval(run);
	}
}

// ÆË¾÷À©µµ¿ì¿ÀÇÂ
function any_open(href, width, height, scroll, name, resize, status, posx, posy){ // score = yes or no = default no; // resize µ¿ÀÏ
	var position='';
	if(posx==null) posx = ((screen.width-width)/2-1).round;
	if(posy==null) posy = ((screen.height-height)/2-1).round;
	
	if(scroll == null){ scroll = 'no'; }
	if(resize == null){ resize = 'no'; }
	if(status == null){ status = 'no'; }
	
	var position = 'width='+width+',height='+height+',scrollbars='+scroll+',status='+status+',resizable='+resize+',top='+posy+',left='+posx;

	if(name == null){
		//win_name = Math.random().toString().substr(3, 5);
		win_name = '_blank';
	}else{
		win_name = name;
	}

	var openWindow=window.open(href, win_name, position);

	//try{
		openWindow.focus();
	//}catch(e){}
}

// ÆË¾÷À©µµ¿ì¿ÀÇÂ ÀÓ½Ã...
function any_open1(){ // score = yes or no = default no; // resize µ¿ÀÏ
    	var posx=0;
    	var posy=0;
    	var position='';
		var name = 'event_pop';
    	posx = ((screen.width-width)/2-1).round;
    	posy = ((screen.height-height)/2-1).round;
		
		if(scroll == null){ scroll = 'no'; }
		if(resize == null){ resize = 'no'; }
		if(status == null){ status = 'no'; }
		
    	var position = 'width=623, height=700,scrollbars=no';

		if(name == null){
			//win_name = Math.random().toString().substr(3, 5);
			win_name = '_blank';
		}else{
			win_name = name;
		}
	var openWindow=window.open('/POP/home/event/index.php?no=64', win_name, position);
//	try{
//		openWindow.focus();
//	}catch(e){}
}

// ÆË¾÷À©µµ¿ì¿ÀÇÂ ÀÓ½Ã...
function any_open2(){ // score = yes or no = default no; // resize µ¿ÀÏ
    	var posx=0;
    	var posy=0;
    	var position='';
		var name = 'event_pop';
    	posx = ((screen.width-width)/2-1).round;
    	posy = ((screen.height-height)/2-1).round;
		
		if(scroll == null){ scroll = 'no'; }
		if(resize == null){ resize = 'no'; }
		if(status == null){ status = 'no'; }
		
    	var position = 'width=628, height=697,scrollbars=no';

		if(name == null){
			//win_name = Math.random().toString().substr(3, 5);
			win_name = '_blank';
		}else{
			win_name = name;
		}
	var openWindow=window.open('/POP/home/event/index.php?no=62', win_name, position);
//	try{
//		openWindow.focus();
//	}catch(e){}
}

// ÆË¾÷À©µµ¿ì¿ÀÇÂ ÀÓ½Ã...
function any_open3(){ // score = yes or no = default no; // resize µ¿ÀÏ
    	var posx=0;
    	var posy=0;
    	var position='';
		var name = 'event_pop';
    	posx = ((screen.width-width)/2-1).round;
    	posy = ((screen.height-height)/2-1).round;
		
		if(scroll == null){ scroll = 'no'; }
		if(resize == null){ resize = 'no'; }
		if(status == null){ status = 'no'; }
		
    	var position = 'width=618, height=695,scrollbars=no';

		if(name == null){
			//win_name = Math.random().toString().substr(3, 5);
			win_name = '_blank';
		}else{
			win_name = name;
		}
	var openWindow=window.open('/POP/home/event/index.php?no=61', win_name, position);
//	try{
//		openWindow.focus();
//	}catch(e){}
}

function opp_sex_see_show(img_dir, activate){

	if(activate==null){activate=0;}

	var obj_frm = document.frames['avatar'];
	var this_avt_sex = obj_frm.NowSex;

	var opposite_sex_arr = new Array;
	     opposite_sex_arr["m"] = "f";
	     opposite_sex_arr["f"] = "m";

	opposite_sex = opposite_sex_arr[this_avt_sex];

	opp_ico_str_change_show(img_dir, this_avt_sex, opposite_sex)

	//obj_frm.AvtSexChange(opposite_sex);
// not used
	if(activate){
		try{
		    var obj_it_frm = document.frames['item_list'];
		    if(!obj_it_frm){return;}

		}catch(e){return;}

		var js_subTO = obj_it_frm.js_TO.split('|');
		var completeTO = js_subTO[0]+'|'+js_subTO[1]+'|'+js_subTO[2]+'|'+opposite_sex_arr[js_subTO[3]];
		obj_it_frm.location.href='/FRM/shop/list_cordinate.php?GO='+obj_it_frm.js_GO+'&TO='+completeTO;
	}
}



function opp_sex_see(img_dir, activate){

	if(activate==null){activate=0;}

	var obj_frm = document.frames['avatar'];
	var this_avt_sex = obj_frm.NowSex;

	var opposite_sex_arr = new Array;
	     opposite_sex_arr["m"] = "f";
	     opposite_sex_arr["f"] = "m";

	opposite_sex = opposite_sex_arr[this_avt_sex];

	opp_ico_str_change(img_dir, this_avt_sex, opposite_sex)

	obj_frm.AvtSexChange(opposite_sex);

	if(activate){
		try{
		    var obj_it_frm = document.frames['item_list'];
		    if(!obj_it_frm){return;}

		}catch(e){return;}

		var js_subTO = obj_it_frm.js_TO.split('|');
		var completeTO = js_subTO[0]+'|'+js_subTO[1]+'|'+js_subTO[2]+'|'+opposite_sex_arr[js_subTO[3]];
		obj_it_frm.location.href='/FRM/shop/list_cordinate.php?GO='+obj_it_frm.js_GO+'&TO='+completeTO;
	}
}


// Renewal ÀÌÈÄ È¨¿¡¸¸ Àû¿ëµÇ´Â ÇÔ¼ö 
function opp_sex_see2(img_dir, activate){

	if(activate==null){activate=0;}

	var obj_frm = document.frames['avatar'];
	var this_avt_sex = obj_frm.NowSex;

	var opposite_sex_arr = new Array;
	     opposite_sex_arr["f"] = "m";
	     opposite_sex_arr["m"] = "f";
	
	opposite_sex = opposite_sex_arr[this_avt_sex];

	

	obj_frm.AvtSexChange(opposite_sex);
	opp_ico_str_change2(img_dir, this_avt_sex, opposite_sex);

	if(activate){
		try{
		    var obj_it_frm = document.frames['item_list'];
		    if(!obj_it_frm){return;}

		}catch(e){return;}

		var js_subTO = obj_it_frm.js_TO.split('|');
		var completeTO = js_subTO[0]+'|'+js_subTO[1]+'|'+js_subTO[2]+'|'+opposite_sex_arr[js_subTO[3]];
		obj_it_frm.location.href='/FRM/shop/list_cordinate.php?GO='+obj_it_frm.js_GO+'&TO='+completeTO;
	}
}

function opp_ico_str_change_show(img_dir, this_avt_sex, opposite_sex){

	     var obj_ico = document.all.avt_small;
	     var opposite_img = img_dir+"/shop/showcase/btn_"+this_avt_sex+".gif";
		 //alert(opposite_img);
	     obj_ico.src = opposite_img;
}


function opp_ico_str_change2(img_dir, this_avt_sex, opposite_sex){

	     var obj_ico = document.all.avt_small;
	     var opposite_img = img_dir+"/btn/btn_avata_"+this_avt_sex+".gif";
		 //alert(opposite_img);
	     obj_ico.src = opposite_img;
}

// Renewal ÀÌÈÄ È¨¿¡¸¸ Àû¿ëµÇ´Â ÇÔ¼ö 


function opp_ico_str_change(img_dir, this_avt_sex, opposite_sex){
	try{
	     var obj_ico = document.all.avt_small;
	     var obj_txt = document.all.avt_small_txt;
	     var opposite_txt = new Array;
if(js_lang == "en"){
	          opposite_txt["m"] = 'female';
	          opposite_txt["f"] = 'male';
	        }else{
	          opposite_txt["m"] = '¿©ÀÚ';
	          opposite_txt["f"] = '³²ÀÚ';
	    }
	     var opposite_ico = img_dir+"/common/ico/ico_"+this_avt_sex+".gif";

	     obj_ico.src = opposite_ico;
	     obj_txt.innerHTML = opposite_txt[opposite_sex];
	}catch(e){return;}
}

function parent_go(target, parent_yn){

        if(parent_yn == "y"){

                parent.window.location.href = target;

        }else if(parent_yn == "yy"){

                parent.parent.window.location.href = target;

        }else{

                window.location.href = target;
        }
}

function getCookie(strName){
        var strArg = new String(strName + "=");
        var nArgLen, nCookieLen, nEnd;
        var i = 0, j;

        nArgLen    = strArg.length;
        nCookieLen = document.cookie.length;

        if(nCookieLen > 0) {
                while(i < nCookieLen) {
                        j = i + nArgLen;
                        if(document.cookie.substring(i, j) == strArg) {
                                nEnd = document.cookie.indexOf (";", j);
                                if(nEnd == -1) nEnd = document.cookie.length;
                                return unescape(document.cookie.substring(j, nEnd));
                        }
                        i = document.cookie.indexOf(" ", i) + 1;
                        if (i == 0) break;
                }
        }
        return("");
}

function miniprofileView(mid,tab){ // Å×½ºÆ®Áß
	if(getCookie("setN")){
	//	var target="miniprofile_"+mid;
		if (tab) {tab="|"+tab;}else{tab ='';}
		var url = "/POP/miniprofile/?GO=miniprofile|"+mid+tab;
	//	if(window.taget){
	//		target.location.href=url;
	//	}else{
		any_open(url, "890", "561", "0");
	//	}
	}else{
		logining();
	}
}




function alpha_curtain(html,width,height,color,opacity)
{
	if (!color) color="white";
	if (!opacity) opacity=70;
	var dummy=document.createElement("DIV");
	dummy.id="loadingBar_div";
	dummy.style.position="absolute";
	dummy.style.top=0;
	dummy.style.left=0;
	dummy.style.visibility="visible";
	dummy.style.width=document.body.clientWidth;
	dummy.style.height=document.body.clientHeight;
	dummy.style.backgroundColor=color;
	dummy.style.filter="alpha(opacity='"+opacity+"')";
	document.body.appendChild(dummy);
	dummy=document.createElement("DIV");
	dummy.id="loadingBar_img";
	dummy.style.position="absolute";
	dummy.style.top=(document.body.clientHeight-height)/2;
	dummy.style.left=(document.body.clientWidth-width)/2;
	dummy.style.width=parseInt(width);
	dummy.style.height=parseInt(height);
	dummy.innerHTML=html;
	dummy.style.visibility="visible";
	document.body.appendChild(dummy);
}

function remove_curtain(arg)
{
	var curtain_div_cnt = arg.document.all["loadingBar_div"];
//	var curtain_img_cnt = arg.document.all["loadingBar_img"];

try{
	if(curtain_div_cnt.length>=0){
		for (i=0; i < curtain_div_cnt.length; i++){
			arg.document.all["loadingBar_div"][i].style.visibility="hidden";
			arg.document.all["loadingBar_img"][i].style.visibility="hidden";
			}
	}else{
			arg.document.all["loadingBar_div"].style.visibility="hidden";
			arg.document.all["loadingBar_img"].style.visibility="hidden";
	}
}catch(e){}

////	arg.document.all.loadingBar_div.style.visibility="hidden";
////	arg.document.all.loadingBar_img.style.visibility="hidden";

//	arg.document.all.loadingBar_div.removeNode(true);
//	arg.document.all.loadingBar_img.removeNode(true);
}


function isBrowser() {   
	// convert all characters to lowercase to simplify testing 
    var agt=navigator.userAgent.toLowerCase(); 

    // *** BROWSER VERSION *** 
    // Note: On IE5, these return 4, so use is.ie5up to detect IE5. 
    this.major = parseInt(navigator.appVersion); 
    this.minor = parseFloat(navigator.appVersion); 

    this.nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
                && (agt.indexOf('webtv')==-1)); 
    this.nav2 = (this.nav && (this.major == 2)); 
    this.nav3 = (this.nav && (this.major == 3)); 
    this.nav4 = (this.nav && (this.major == 4)); 
    this.nav4up = (this.nav && (this.major >= 4)); 
    this.navonly      = (this.nav && ((agt.indexOf(";nav") != -1) || 
                          (agt.indexOf("; nav") != -1)) ); 
    this.nav5 = (this.nav && (this.major == 5)); 
    this.nav5up = (this.nav && (this.major >= 5)); 

    this.ie   = (agt.indexOf("msie") != -1); 
    this.ie3  = (this.ie && (this.major < 4)); 
    this.ie4  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")==-1) ); 
    this.ie4up  = (this.ie  && (this.major >= 4)); 
    this.ie5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) ); 
    this.ie5up  = (this.ie  && !this.ie3 && !this.ie4); 
}

function mobile_photo(srcfile,m_id,b_id,star,u_id,usernick,usersex)
{
	if(m_id){
	var cpflag=((cpflag)?cpflag:"CB");
	var star=((star)?"2":"1");
	var srcfile=((srcfile)?srcfile:"http://img.candybar.co.kr/img/shop/common/no_img.jpg");
	var return_url=((return_url)?"":"http://sync.candybar.co.kr/FRM/shop/mobile/callbackMobile.php");
	var b_id=((b_id>0)? b_id:"");
//	var href = "http://wtop1.phopho.co.kr/webphophocam/index.htm?cpflag=" + cpflag 
//	var href = "http://210.109.151.80/webphophocam_candybar/index.htm?cpflag=" + cpflag 
	var href = "http://wtop1.phopho.co.kr/webphophocam_candybar/index.htm?cpflag=" + cpflag 
			 + "&star="+star
			 + "&srcfile="+srcfile
			 + "&m_id="+m_id
			 + "&b_id="+b_id
			 + "&u_info="+u_id+"|"+usernick+"|"+usersex
			 + "&return_url="+return_url;
	any_open(href, '740', '628', 'no', 'webphophocam', 'no');
	}else{
	logining();
	}
}


function mobile_avatar()
{
	alert("¸ð¹ÙÀÏ ¾Æ¹ÙÅ¸ Àü¼ÛÃ¢ ÁØºñÁß");
}


function xmaspopup(){
	any_open('/POP/event/xmas2004/quiz.html', 628,700, 'no', 'xmasp','','yes');
}

//
var h1 = 32; 
var h2 = 251;
var avt_sdiv = 2500000;
var IMG = "http://img.candybar.co.kr/img";

function AVT_Svr(m_id)
{
	var server_no = Math.floor(m_id/avt_sdiv);
	var url = "http://avt"+server_no+".candybar.co.kr";
	return url;
}

function AVT_Dir(m_id)
{
        var d1 = m_id % h1;
        var d2 = Math.floor(m_id / h1) % h2;
        var d3 = Math.floor( Math.floor(m_id / h1) / h2);
        var directory = AVT_Svr(m_id)+"/"+d1+"/"+d2+"/"+d3;

        return directory;
}

function AVT_Img(col,m_id,u_sex,online,error,buddy,from){
	if(u_sex=="") u_sex="f";
	if(online=="") online="0";
	if(error=="") error="1";
	if(buddy=="") buddy="1";
	if(from=="") from ="";
	var onClick_tag = (getCookie("setN") && buddy=="1")? "style=\"cursor:pointer\" align=\"absmiddle\" onclick=\"buddy_menu_onshow('"+m_id+"','')\"":"";

	switch( col ){
	
		case "l_a": // 150x290
			var alter_la = IMG+"/avatar/member_join_avt/l_"+u_sex+".gif";
			var col = "l_avatar"; 

			var avatar_img = "<div style=\"position:relative;visibility:visible;left:0px;top:0px;width:150;height:290;zindex:10;\"><img src=\""+AVT_Dir(m_id)+"/"+m_id+"c00.gif\" onError=\"this.src='"+alter_la+"';la_id3.src='"+alter_la+"';\">"
			+"<div style=\"position:absolute;visibility:visible;left:0px;top:0px;zindex:1;\"><img src=\""+AVT_Dir(m_id)+"/"+m_id+"f00.gif\" onError=\"this.src='"+alter_la+"';la_id3.src='"+alter_la+"';\"></div>"
			+"<div style=\"position:absolute;visibility:visible;left:0px;top:0px;zindex:2;\"><img src=\""+AVT_Dir(m_id)+"/"+m_id+"c01.gif\" onError=\"this.src='"+alter_la+"';la_id3.src='"+alter_la+"';\" id=\"la_id3\"></div>"
			+"<div style=\"position:absolute;visibility:visible;left:0px;top:0px;zindex:3;\"><img src=\""+IMG+"/avatar/trans.gif\" width=\"150\" height=\"290\" "+ onClick_tag+"></div></div>";
			break;
			
		case "f_a": // 90x90
			var alter_fa = IMG+"/avatar/member_join_avt/f_"+u_sex+".gif";
//			var ERROR = (error==1 || !m_id)?"onError=\"this.src='"+alter_fa+"'\"":"";
			var ERROR = "onError=\"this.src='"+alter_sa+"'\"";
			if(from=="mchat") ERROR = "onError=\"setTimeout('UserLayerMake('+IdUser+','+Htmlpos+');',0);\">";
			var avatar_img = "<div style=\"position:relative;visibility:visible;left:0px;top:0px;width:90;height:90;zindex:10;\"><img src=\""
			+AVT_Dir(m_id)+"/"+m_id+"b00.gif\" hspace=\"3\""
			+ERROR+"><div style=\"position:absolute;visibility:visible;left:0px;top:0px;zindex:1;\">"
			+"<img src=\""+IMG+"/avatar/trans.gif\" width=\"90\" height=\"90\""
			+ onClick_tag 
			+"></div></div>";
			break;

		case "s_a": // 30x30
			var alter_sa = IMG+"/avatar/member_join_avt/s_"+u_sex+".gif";
			var isonline = (online=="0")?"style='filter:gray()'":"";
//			var ERROR = (error==1 || !m_id)?"onError=\"this.src='"+alter_sa+"'\"":"";
			var ERROR = "onError=\"this.src='"+alter_sa+"'\"";
			var avatar_img = "<div style=\"position:relative;visibility:visible;left:0px;top:0px;width:30;height:30;zindex:10;\"><img src=\""
			+AVT_Dir(m_id)+"/"+m_id+"i00.gif\" hspace=\"3\""
			+ERROR 
			+ " id=\"MEMBER_SEARCH_"+m_id+"\""
			+isonline 
			+"><div style=\"position:absolute;visibility:visible;left:0px;top:0px;zindex:3;\">"
			+"<img src=\""+IMG+"/avatar/trans.gif\" width=\"30\" height=\"30\""
			+onClick_tag
			+"></div></div>";
			break;

	}
	return avatar_img;
	
	
}

function SelectAll(target)
{
  var   i, form = document.forms[target];
  if( !form ) return;
  for( i = 0; i < form.length; i++ )
  {
    if( form[i].type != "checkbox" ) continue;
    form[i].checked = !form[i].checked;
  }
}
// IE7.0 patch temporary
	function mEmGET(arrayKey, arrayValue, Value) {
		count = arrayKey.length;
		for(i=0;i<count;i++) {
			if(arrayKey[i].toLowerCase()==Value) {
				return arrayValue[i];
				break;
			}
		}
	}
// flash & game ActiveX


	function mEmbed() {
		var key = new Array();
		var value = new Array();
		error_check=0;
		var flashon = 0;
		for(i=0;i<mEmbed.arguments.length;i++) {
			data = mEmbed.arguments[i].split('@');
			key[i] = data[0];
			value[i] = data[1];
		}

		contents = '';
		srcdata = mEmGET(key,value,'src');
		if(/\.(...)$/.test(srcdata)) {
			flashon = 1;
		}

		classid = mEmGET(key,value,'classid');
		codebase = mEmGET(key,value,'codebase');
		version = mEmGET(key,value,'version');
		flashvars = mEmGET(key,value,'flashvars');
		if(flashon==1) {
			classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab';
			version = '8,0,0,0';
		}
		if(classid && codebase) {
			contents += '<object';
			if(classid) {
				contents += ' classid="' + classid + '"';
			}
			if(codebase) {
				contents += ' codebase="' + codebase + ((version)?"#version="+version:"") + '"';
			}
			if(flashvars) {
				contents += ' flashvars="' + flashvars + '"';
			}
			count = key.length;
			for(i=0;i<count;i++) {
				if(value[i]!='') {
					if(!key[i].match(new RegExp("src|classid|codebase|version|flashvars", "gi"))){
						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] + '" />';
                                                contents += '<param name="wmode" value="transparent" />';
                                                contents += '<param name="quality" value="high" />';
                                                contents += '<param name="play" value="true" />';
                                                contents += '<param name="loop" value="true" />';
                                                contents += '<param name="menu" value="false" />';
                                                contents += '<param name="allowScriptAccess" value="always" />';

					} else if(!key[i].match(new RegExp("src|classid|codebase|version|width|height|id|onreadystatechange|style", "gi"))){
						contents += '<param name="' + key[i] + '" value="' + value[i] + '" />';
					}
				}
			}
		}
		contents += '<embed';

                if(codebase) {
               		contents += ' codebase="' + codebase + ((version)?"#version="+version:"") + '"';
                }	
		for(i=0;i<count;i++) {
			if(value[i]!='') {
				if(!key[i].match(new RegExp("codebase|version|style|flashvars", "gi"))){
					contents += ' ' + key[i] + '="' + value[i] + '"';
				}
			}
		}
		contents += ' allowScriptAccess="always">';
		contents += '</embed>';
		if(classid && codebase) {
			contents += '</object>';
		}
//alert(contents);
		document.write(contents);
	}

	function mEmbed_Launcher() {
		var key = new Array();
		var value = new Array();
		error_check=0;
		var flashon = 0;
		
		for(i=0;i<mEmbed.arguments.length;i++) {
			data = mEmbed.arguments[i].split('@');
			key[i] = data[0];
			value[i] = data[1];
		}
		
		classid = mEmGET(key,value,'classid');
		codebase = mEmGET(key,value,'codebase');
		version = mEmGET(key,value,'version');
		
		if(classid && codebase) {
			contents += '<object';
			
			if(classid) {
				contents += ' classid="' + classid + '"';
			}
			
			if(codebase) {
				contents += ' codebase="' + codebase + ((version)?"#version="+version:"") + '"';
			}
			
			count = key.length;
			
			for(i=0;i<count;i++) {
				if(value[i]!='') {
					if(!key[i].match(new RegExp("src|classid|codebase|version|flashvars", "gi"))){
						contents += ' ' + key[i] + '="' + value[i] + '"';
					}
				}
		   }

		   contents += '>';
		}

		if(classid && codebase) {
		    contents += '</object>';
		}

		document.write(contents);
	}


// charge menu charge.js
/*
var charge_menu_show=false;
document.write("<div id='chargeDiv' style='z-index:10000;position:absolute;width:110px;border:0px solid #0395E1;visibility:hidden;display:none'>"
+"<table width='110' border='0' cellspacing='0' cellpadding='0' bgcolor='#E3C226'>"
+"  <tr><td colspan='6' height='1'></td></tr>"
+"  <tr style='cursor:pointer' height='20'><td width='1' ></td><td width='3' bgcolor='#f1f1f1'></td><td width='50' height='0' bgcolor='#ffffff' class='fcsub' onmouseover=\"this.style.backgroundColor='#F1F1F1'\" onmouseout=\"this.style.backgroundColor='#FFFFFF'\"><img src='"+js_img+"/common/head/bar_01off.gif' align='absmiddle' onmouseover=\"this.src='"+js_img+"/common/head/bar_01on.gif'\" onmouseout=\"this.src='"+js_img+"/common/head/bar_01off.gif'\"></td><td width='3' bgcolor='#f1f1f1'></td><td width='50' height='0' bgcolor='#ffffff' class='fcsub' onmouseover=\"this.style.backgroundColor='#F1F1F1'\" onmouseout=\"this.style.backgroundColor='#FFFFFF'\"><img src='"+js_img+"/common/head/bar_02off.gif' align='absmiddle'  onmouseover=\"this.src='"+js_img+"/common/head/bar_02on.gif'\" onmouseout=\"this.src='"+js_img+"/common/head/bar_02off.gif'\"></td><td width='1' bgcolor='#E3C226'></td></tr>"
+"  <tr><td colspan='6' height='1'></td></tr>"
+"</table></div>");
function charge_menu_onshow()
{

			if (document.all["chargeDiv"]) {
				var tempmenuDiv;
				if (!document.all["chargeDiv"].length) tempmenuDiv=document.all["chargeDiv"];
				else tempmenuDiv=document.all["chargeDiv"][0];
			}
	
	var openertype = 1;

	if (!document.all["chargeDiv"]) return;
	var menuDiv;
	if (!document.all["chargeDiv"].length) menuDiv=document.all["chargeDiv"];
	else menuDiv=document.all["chargeDiv"][0];
	charge_menu_show=true;

	menuDiv.all(0).rows(1).cells(2).onclick=
		new Function("gopage('home|charge');charge_menu_hide();");
	menuDiv.all(0).rows(1).cells(4).onclick=
		new Function("gopage('home|charge|free');charge_menu_hide();");
		
	menuDiv.style.top=event.clientY+document.body.scrollTop-3+"px";
	menuDiv.style.left=event.clientX+document.body.scrollLeft+10;
	menuDiv.style.visibility="visible";
	menuDiv.style.display="";
	if ((parseInt(menuDiv.style.top) + menuDiv.offsetHeight) > (document.body.clientHeight+document.body.scrollTop))
		menuDiv.style.top=parseInt(menuDiv.style.top)-(menuDiv.offsetHeight-6);
	if ((parseInt(menuDiv.style.left) + menuDiv.offsetWidth) > (document.body.clientWidth+document.body.scrollLeft))
		menuDiv.style.left=parseInt(menuDiv.style.left)-(menuDiv.offsetWidth+20);
	menuDiv.onmouseout=new Function("charge_menu_show=false;");
	menuDiv.onmouseover=new Function("charge_menu_show=true;");
	document.onclick=charge_menu_hide_check;
	document.body.onresize=charge_menu_hide;
}
function charge_menu_hide()
{
	if (!document.all["chargeDiv"]) return;
	var menuDiv;
	if (!document.all["chargeDiv"].length) menuDiv=document.all["chargeDiv"];
	else menuDiv=document.all["chargeDiv"][0];
	menuDiv.style.visibility="hidden";
	menuDiv.style.display="none";
}
function charge_menu_hide_check()
{
	if (!charge_menu_show) charge_menu_hide();
}

function gopage(arg)
{
	top.location.href='/?GO='+arg;
}
*/



function adClick_sky_right(URL,adclick){
	top.location.href=URL + ((adclick)?"&adclick="+adclick:"");
	
}
function adClick_ctv(URL,adclick){
	top.location.href=URL + ((adclick)?"&adclick="+adclick:"");
	
}

function adClick_login(URL,adclick){
	top.location.href=URL + ((adclick)?"&adclick="+adclick:"");
	
}
///////////////////// BLINK ///////////////////

    ie = (document.all)? true:false
    function doBlink() {
    var blink = document.all.tags("BLINK")
    for (var i=0; i < blink.length; i++)
        blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
    }
    function startBlink() {  // Make sure it is IE4
    if (ie)
        setInterval("doBlink()",500)
    }
    if (ie) window.onload = startBlink;

// base64_decode
    String.prototype.decode_base64=function(){
         if((this.length % 4) == 0){
             if(typeof(atob) != "undefined"){//try using mozillas builtin codec
                 return atob(this);
             }else{
                 var nBits;
                 //create a result buffer, this is much faster than having strings concatinated.
                 var sDecoded = new Array(this.length /4);
                 var base64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
                 for(var i=0; i < this.length; i+=4){
                     nBits = (base64.indexOf(this.charAt(i))   & 0xff) << 18 |
                                (base64.indexOf(this.charAt(i+1)) & 0xff) << 12 |
                                (base64.indexOf(this.charAt(i+2)) & 0xff) <<  6 |
                                base64.indexOf(this.charAt(i+3)) & 0xff;
                    sDecoded[i] = String.fromCharCode((nBits & 0xff0000) >> 16, (nBits & 0xff00) >> 8, nBits & 0xff);
                }
                sDecoded[sDecoded.length-1] = sDecoded[sDecoded.length-1].substring(0, 3 - ((this.charCodeAt(i - 2) == 61) ? 2 : (this.charCodeAt(i - 1) == 61 ? 1 : 0)));
                return sDecoded.join("");
             }
         }else{
             throw new Exception(thisMod, "String length must be divisible by 4.");
         }
    }


function input_chk_byte(input_name,input_max,input_chk) { 
	  var ls_str    = input_name.value; // ÀÌº¥Æ®°¡ ÀÏ¾î³­ ÄÁÆ®·ÑÀÇ value °ª 
	  var li_str_len = ls_str.length;  // ÀüÃ¼±æÀÌ 

	  // º¯¼öÃÊ±âÈ­ 
	  var li_max      = input_max * 2; // Á¦ÇÑÇÒ ±ÛÀÚ¼ö Å©±â 
	  var i          = 0;  // for¹®¿¡ »ç¿ë 
	  var li_byte    = 0;  // ÇÑ±ÛÀÏ°æ¿ì´Â 2 ±×¹Ü¿¡´Â 1À» ´õÇÔ 
	  var li_len      = 0;  // substringÇÏ±â À§ÇØ¼­ »ç¿ë 
	  var ls_one_char = ""; // ÇÑ±ÛÀÚ¾¿ °Ë»çÇÑ´Ù 
	  var ls_str2    = ""; // ±ÛÀÚ¼ö¸¦ ÃÊ°úÇÏ¸é Á¦ÇÑÇÒ¼ö ±ÛÀÚÀü±îÁö¸¸ º¸¿©ÁØ´Ù. 

	  for(i=0; i< li_str_len; i++) { 
		  // ÇÑ±ÛÀÚÃßÃâ 
		  ls_one_char = ls_str.charAt(i); 

		  // ÇÑ±ÛÀÌ¸é 2¸¦ ´õÇÑ´Ù. 
		  if (escape(ls_one_char).length > 4) 
		  { 
			li_byte = li_byte+2; 
		  } 
		  // ±×¿ÜÀÇ °æ¿ì´Â 1À» ´õÇÑ´Ù. 
		  else 
		  { 
			li_byte++; 
		  } 

		  // ÀüÃ¼ Å©±â°¡ li_max¸¦ ³ÑÁö¾ÊÀ¸¸é 
		  if(li_byte <= li_max) 
		  { 
			li_len = i + 1; 
		  } 
	  } 
	  
 	  // ÀüÃ¼±æÀÌ¸¦ ÃÊ°úÇÏ¸é li_byte 
	  if(input_chk == 'y') document.getElementById('view_writelength').innerHTML = li_byte+"/"+input_max; 

	  if(li_byte > li_max) { 
		  //input_name.value=li_byte; 
		  alert( "ÇÑ±Û ±âÁØ " + input_max + "±ÛÀÚ¸¦ ÃÊ°ú ÀÔ·ÂÇÒ¼ö ¾ø½À´Ï´Ù. \n ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù. "); 
		  ls_str2 = ls_str.substr(0, li_len); 
		  input_name.value = ls_str2; 
	  } 
	  input_name.focus();  
} 

function input_not_enterKey() { 
  if(event.keyCode == 13) 
      event.returnValue=false; 
} 

function number_format(number, decimals, dec_point, thousands_sep) { 
    number = (number+'').replace(',', '').replace(' ', ''); 
    var n = !isFinite(+number) ? 0 : +number;
    var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals);
    var sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep;
    var dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '';
    
    var toFixedFix = function (n, prec) { 
        var k = Math.pow(10, prec); 
        return '' + Math.round(n * k) / k;        }; 

    s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); 
    
    if (s[0].length > 3) s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);

    if ((s[1] || '').length < prec) { 
        s[1] = s[1] || ''; 
        s[1] += new Array(prec - s[1].length + 1).join('0'); 
    }    
    
    return s.join(dec); 
} 

