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 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 fnSetValues(){
   var iHeight=212;
   var sFeatures="dialogHeight: " + iHeight + "px;";
   return sFeatures;
}

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='216';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);
}

// confirm ¸ð´ÞÃ¢
function candy_confirm(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;';
	return window.showModalDialog('/POP/common/alert/confirm_'+subGO+gnb_id+'.php?GO='+subGO+'&candy_msg='+escape(candy_msg), window, position);
}

// Å°ÀÔ·Â°ªÀÌ 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:hand\" 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);
	}


// 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:hand' 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.");
         }
    }


