function mem_id(tmp_txt){
	//ÅØ½ºÆ® ¹Ú½ºÀÇ °ø¹éÀ» Ã³À½ ºÎÅÍ ³¡±îÁö ¾ø¾ÖÁÖ°í 
	tmp_txt.value = tmp_txt.value.replace(/ /g, "");
	
	//¼ýÀÚ ¿µ´ë,¼Ò¸¸ 6~15ÀÚ »çÀÌ·Î ÀÔ·ÂÀÔÁ¤ ÇÏ±â . -1ÀÌ¸é Á¶°Ç ¾Æ´Ô 
	if(tmp_txt.value.length > 0 && tmp_txt.value.search(/^\w{6,15}$/)==-1 ){
		if (tmp_txt.value.length < 6 || tmp_txt.value.length > 15){
			alert("¾ÆÀÌµð´Â 6ÀÚ¸® ÀÌ»ó 15ÀÚ¸® ÀÌÇÏÀÇ ¿µ¹®,¼ýÀÚ Á¶ÇÕ ¹®ÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù.");
		} else {
			alert("Æ¯¼ö¹®ÀÚ³ª ÇÑ±ÛÀº »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
		}
		tmp_txt.value = "";
		tmp_txt.focus();
	}
}
/* ÇÃ·¡½¬ ·Îµù */
function includeSWF(width, height, url, fvalues, idname){
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ");
	document.write("		codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' ");

	if(idname != ""){
		document.write("		id='"+idname+"' ");
	}

	document.write("		width='"+width+"' height='"+height+"' align='middle'>");


	document.write("	<param name='allowScriptAccess' value='always' /> ");
	document.write("	<param name='movie'				value='"+url+"' /> ");
	document.write("	<param name='quality'			value='high' /> ");
	document.write("	<param name='wmode'				value='transparent'> ");
	document.write("	<param name='flashVars'			value='"+fvalues+"'/> ");  
	document.write("	<embed src='"+url+"' quality='high' width='"+width+"' height='"+height+"' align='middle' wmode='transparent'");

	if(idname != ""){
		document.write("			id					='"+idname+"' ");
	}


	document.write("		allowScriptAccess='always' swfLiveConnect=true type='application/x-shockwave-flash' ");
	document.write("		pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}

function JsSubmit(page) {
	Frm.page.value = page;
	Frm.submit();
}
function JsSubmit2(page) {
	frmtopsearch.top_page.value = page;
	frmtopsearch.submit();
}
function JsSubmit3(page) {
	Frm.code.value = "";
	Frm.page.value = page;
	Frm.submit();
}

function GoURL(url) {
	location.href = url;
}

function down_popup(file){	
	w = window.open("", "DownMonitor", "height=445,width=445, status=no,toolbar=no,menubar=no,location=no,top=" + (screen.height-400)/2 + ",left=" + (screen.width-620)/2);
	document.frmDown.target = "DownMonitor"
	document.frmDown.file.value = file;
	document.frmDown.action = "/com/DownMonitor.asp";
	document.frmDown.submit(); 
}
function LoginInputReset(o,n) {
	if ( n == 0 ) {
		o.user_id.style.backgroundImage = '';
	} else {
		o.user_pw.style.backgroundImage = '';
	}
}
function BlogInputReset(o,n) {
	if ( n == 1 ) {
		o.cmmtname.style.backgroundImage = '';
	} else if ( n == 2 ) {
		o.cmmtpw.style.backgroundImage = '';
	} else if ( n == 3 ) {
		o.cmmthttp.style.backgroundImage = '';
	}
}



//Ä«Æä ¹Ù·Î°¡±â ·¹ÀÌ¾î
var clickMenuAreaCheck = false;
function showMenuLayer(curObj, pos) {
  clickAreaCheck = true;
  var str = "<div class='nTopLayer'><div style='text-align:left;padding-left:8px;' class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:window.location='http://www.gamefos.co.kr/';>°ÔÀÓÆ÷½ºÈ¨</a></div>";
  str += "<div style='text-align:left;padding-left:8px;' class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:window.location='http://www.gamefos.co.kr/download/';>°ÔÀÓ´Ù¿î·Îµå</a></div>";
  str += "<div style='text-align:left;padding-left:8px;' class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:window.location='http://www.gamefos.co.kr/movie/';>µ¿¿µ»ó</a></div>";
  str += "<div style='text-align:left;padding-left:8px;' class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:window.location='http://www.gamefos.co.kr/guide/';>°ø·«Áý</a></div>";
  str += "<div style='text-align:left;padding-left:8px;' class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:window.location='http://www.gamefos.co.kr/community/';>Ä¿¹Â´ÏÆ¼</a></div></div>";
  setLayersPosition(curObj, str, "nameLayer", pos);
}

//´Ð³×ÀÓ Å¬¸¯½Ã ¾×¼Ç Start
clickAreaCheck = false;
function showNameLayer_ea(curObj, link1, pos) {
  clickAreaCheck = true; 
  var str = "<div class='nTopLayer' style='background:#fff;'><div class='nLayer' onMouseOver=this.style.backgroundColor='#F6FFED' onMouseOut=this.style.backgroundColor='#ffffff'><a href='#' onclick=\"javascript:window.open('http://ea.gamefos.co.kr/MWCS/mypage_memo_reply.asp?sndrID="+link1+"','¸Þ¸ð´äÀå','height=430,width=480,status=no,toolbar=no,titlebar=no,menubar=no,location=no,scrollbars=auto');\"><img src='/images/ea/iconMemo.gif' align='absmiddle' /> <b>ÂÊÁöº¸³»±â</b> &nbsp;</a></div>";
  str += "<div class='nLayer' onMouseOver=this.style.backgroundColor='#F6FFED' onMouseOut=this.style.backgroundColor='#ffffff'><a href='#' onclick=\"javascript:window.open('http://ea.gamefos.co.kr/MWCS/mypage_chatting.asp?friend_id="+link1+"','´ëÈ­½ÅÃ»','height=300,width=600,status=no,toolbar=no,titlebar=no,menubar=no,location=no,scrollbars=auto');\"><img src='/images/ea/iconMember.gif' align='absmiddle' /> <b>1:1 ´ëÈ­</b></a></div>";
  str += "<div class='nLayer' onMouseOver=this.style.backgroundColor='#F6FFED' onMouseOut=this.style.backgroundColor='#ffffff'><a href='#' onclick=\"javascript:window.open('http://www.gamefos.co.kr/mypage/friend_pro.asp?backURL=close&mode=friend&friendid="+link1+"','Ä£±¸Ãß°¡','height=400,width=250,left=400,top=400,status=no,toolbar=no,titlebar=no,menubar=no,location=no,scrollbars=auto');\"><img src='/images/ea/iconMember.gif' align='absmiddle' /> <b>Ä£±¸Ãß°¡</b></a></div>";
  //str += "<div class='nLayer' onMouseOver=this.style.backgroundColor='#F6FFED' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:view_gamerid('"+link1+"');>°ÔÀÌ¸ÓIDº¸±â</a></div></div>";
  setLayersPosition(curObj, str, "nameLayer", pos);
}
function showNameLayer(curObj, link1, pos) {
  clickAreaCheck = true;
  var str = "<div class='nTopLayer'><div class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:send_memo('"+link1+"');>ÂÊÁöº¸³»±â</a></div>";
  str += "<div class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:view_gamerinfo('"+link1+"');>È°µ¿Á¤º¸º¸±â</a></div>";
  str += "<div class='nLayer' onMouseOver=this.style.backgroundColor='#FFEBD8' onMouseOut=this.style.backgroundColor='#ffffff'><a href=javascript:view_gamerid('"+link1+"');>°ÔÀÌ¸ÓIDº¸±â</a></div></div>";
  setLayersPosition(curObj, str, "nameLayer", pos);
}
function setLayersPosition(curObj, str , layername, pos) {
  var name = layername;
  if (!document.getElementById(name)) {
	var cElement = document.createElement("DIV");
	cElement.id = name;
	cElement.style.position = 'absolute';
	cElement.style.zIndex = 50;
	document.body.appendChild(cElement);
  }
  document.getElementById(name).style.top = getAbsoluteTop(curObj) + curObj.offsetHeight + 2 + "px";
  if(pos == "r")
   document.getElementById(name).style.left = getAbsoluteLeft(curObj) + "px";
  else if(pos == "s")
   document.getElementById(name).style.left = getAbsoluteLeft(curObj)-44 + "px";
  else if(pos == "p")
   document.getElementById(name).style.left = getAbsoluteLeft(curObj) + "px";
  else
   document.getElementById(name).style.left = getAbsoluteLeft(curObj)+17 + "px";
  
  document.getElementById(name).innerHTML = str;
  divDisplay(name, 'block');
}
function divDisplay(objId, act) {		
  if (document.getElementById(objId)) {
	document.getElementById(objId).style.display = act;
  }
}
document.onclick = function() {
  if (!clickAreaCheck) {
	if(document.getElementById("nameLayer")) {
	  divDisplay ("nameLayer", 'none');
	}
  } else clickAreaCheck = false;
}
function getAbsoluteTop(oNode){
  var oCurrentNode=oNode;
  var iTop=0;
  while(oCurrentNode.tagName!="BODY"){
	if(oCurrentNode.tagName=="HTML")break;
	iTop+=oCurrentNode.offsetTop;
	oCurrentNode=oCurrentNode.offsetParent;
  }
  return iTop;
}
function getAbsoluteLeft(oNode){
  var oCurrentNode=oNode;
  var iLeft=0;
  while(oCurrentNode.tagName!="BODY"){
	if(oCurrentNode.tagName=="HTML")break;
	iLeft+=oCurrentNode.offsetLeft;
	oCurrentNode=oCurrentNode.offsetParent;
  }
  return iLeft;
}

function send_memo(v){
	var return_url = "/com/memo_send.asp?code="+v; 
	window.open(return_url,"¸Þ¸ðº¸³»±â","height=430,width=480,status=no,toolbar=no,titlebar=no,menubar=no,location=no,scrollbars=auto");
}
function view_gamerinfo(v){
	var return_url = "/com/gamer_info.asp?code="+v; 
	window.open(return_url,"È°µ¿Á¤º¸º¸±â","height=600,width=500,status=no,toolbar=no,titlebar=no,menubar=no,location=no,scrollbars=yes");
}

function discount_coupon(){
	var return_url = "/com/discount_coupon.asp";
	var winX = 0;
	var winY = 0;

	winX = (screen.availWidth - 480) * 0.5;
	winY = (screen.availHeight - 200) * 0.5;
	window.open(return_url, "ÇÒÀÎÄíÆùµî·Ï", "toolbar=no, location=no, menubar=no, scrollbars=no, resizable=no, width=480, height=200, copyhistory=no, left=" + winX + ", top=" + winY);
}

function view_gamerid(v){
	var return_url = "/com/gamerid_info.asp?code="+v; 
	window.open(return_url,"°ÔÀÌ¸ÓIDº¸±â","height=430,width=480,status=no,toolbar=no,titlebar=no,menubar=no,location=no,scrollbars=auto");
}
//´Ð³×ÀÓ Å¬¸¯½Ã ¾×¼Ç End

function recommend_all(idx,val)
{
	if (document.Frm.recommand_chk.value == 'N'){
	    var pageUrl = "/com/recommend_pro.asp";
	
	    var objXmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	    objXmlhttp.Open("POST", pageUrl, true);
	    objXmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=euc-kr");
	    objXmlhttp.onreadystatechange = function() {CallBack(objXmlhttp)};
	    objXmlhttp.send("mode="+val+"&idx="+idx+"")
	
	    return objXmlhttp;
	} else {
		alert('ÀÌ¹Ì ÃßÃµÇÏ¼Ì½À´Ï´Ù.');
		return;
	}
}

function CallBack(objXmlhttp)
{
    if(objXmlhttp == null || objXmlhttp.readyState != 4) return;
    if(objXmlhttp.responseText.length == 0) return;

	if(objXmlhttp.responseText == 'Y') {
		alert('ÃßÃµ ÇÑÇ¥ ÁÖ¼Ì½À´Ï´Ù.');
		document.Frm.recommand_chk.value = 'Y';
		return;
	}
}

function comumunitySearch()
{
	window.open('/com/com06p1.asp','communitysearch', 'width=420, height=200,left=400,top=400, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=yes, copyhistory=no')
}

function divImgSearchTag(width){ 

    var childObj=document.all;

    for(i=0; i < childObj.length; i++) 
    { 
        if (childObj[i].tagName == "IMG") 
        { 
            if(childObj[i].width>width){
            	childObj[i].height=(childObj[i].height*width)/childObj[i].width;
            	childObj[i].width=width;
            }
        } 
    } 
} 
// Æ¯¼ö¹®ÀÚ Ã¼Å©
function NonCharSearch(id_text)
{
		//var nonchar = '~`!@#$%^&*()-_=+\|<>?,./;:"';
		var nonchar = '`@#$%&\|<>;"\'';

		var i ; 
		for ( i=0; i < id_text.length; i++ )  {
			if( nonchar.indexOf(id_text.substring(i,i+1)) > 0) {
				break ; 
			}
		}
		if ( i != id_text.length ) {
			return false ; 
		}
		else{
			return true ;
		} 

		return false;
}
//¹®ÀÚ¿­ °³¼ö
function LengthCheck(data) {

		var count = 0;
		for ( var i=0; i < data.length; i++ ) {
			if( data.charCodeAt(i) < 127 )
				count++;
			else
				count = count + 2;
		}
		
		return count;
}

function eaKeyView( key_code, p_code) {
	var winX = 0;
	var winY = 0;

	winX = (screen.availWidth - 300) * 0.5;
	winY = (screen.availHeight - 140) * 0.5;
	var win = window.open("/mypage/mypage_key.asp?key_code="+key_code+"&p_code="+p_code, "ea_key_view", "toolbar=no, location=no, menubar=no, scrollbars=no, resizable=no, width=300, height=140, copyhistory=no, left=" + winX + ", top=" + winY);
}
