//È¸¿ø¸ðµâ ÀÚ¹Ù½ºÅ©¸³Æ®

/**
 * ·Î±×ÀÎÆû Àü¼Û
 */
function loginExec(){
    obj = document.loginF;
    if(!check_blank('¾ÆÀÌµð',obj.id)) return false;
    if(!check_length('¾ÆÀÌµð',obj.id,2,12)) return false;
    if(!check_blank('ºñ¹Ð¹øÈ£',obj.passwd)) return false;
    if(!check_null('ºñ¹Ð¹øÈ£',obj.passwd)) return false;
    if(!check_length('ºñ¹Ð¹øÈ£',obj.passwd,4,12)) return false;
	if(ie==true){
		postForm(obj,'iezn_member::Login::loginExec',0,0,'·Î±×ÀÎÁßÀÔ´Ï´Ù');
	}else{
		postForm(obj,'iezn_member::Login::loginExec',0,1);
	}
	return false;
}

/**
 * ·Î±×¾Æ¿ô
 */
function logoutExec(){
	if(document.loginF){
		postForm(document.loginF,'iezn_member::Login::logoutExec');
	}else{
		postXml(Array(''),Array(''),'iezn_member::Login::logoutExec');
	}
	return false;
}

/**
 * ÀÚµ¿·Î±×ÀÎ Ã¼Å©ºÎºÐ
 */
function checkAutoLogin(){
    if(document.loginF.saveLogin.checked==true){
        if(confirm('ÀÚµ¿ ·Î±×ÀÎÀ» »ç¿ëÇÏ½Ã°Ú½À´Ï±î?\n\nÀÚµ¿·Î±×ÀÎ ±â´É »ç¿ë½Ã ´ÙÀ½Á¢¼ÓºÎÅÍ ·Î±×ÀÎÇÏ½Ç ÇÊ¿ä°¡ ¾ø½À´Ï´Ù.\n\n°³ÀÎ¿ë ÄÄÇ»ÅÍ°¡ ¾Æ´Ñ »ç¿ëÀÚ(°ÔÀÓ¹æ,ÇÐ±³,È¸»ç)ÀÇ °æ¿ì´Â °³ÀÎÁ¤º¸°¡ À¯ÃâµÉ ¼ö ÀÖ½À´Ï´Ù.')){
            document.loginF.saveLogin.checked=true;
            document.loginF.auto_login.value=1;
        }else{
            document.loginF.saveLogin.checked=false;
            document.loginF.auto_login.value='';
        }
    }
}

/**
 * »ç¿ëÀÚ ¸Þ´º 
 */
var userMenuShowVar = 0;
document.write("<div id=\"userMenuDiv\" style='position:absolute;display:none;height:auto;padding:0px;width:auto;background:transparent'></div>");
function userMenuShow(e,m_id){
	if(userMenuShowVar==1){
		userMenuHide();
	}
	if(typeof(g_num)=='undefined') g_num='';
	if(typeof(gs_num)=='undefined') gs_num='';
	if(typeof(num)=='undefined') num='';
	if(typeof(now)=='undefined') now='';
	xmlVal = postXml(Array('g_num','gs_num','num','m_id','now'),Array(g_num,gs_num,num,m_id,now),'iezn_member::UserMenu::userMenuShow',1);
	if(xmlVal['script']){
		eval(xmlVal['script']);//½ºÅ©¸³Æ® Ãâ·Â
	}else if(xmlVal['html']){
		obj = document.getElementById('userMenuDiv');
		obj.style.zIndex = 100;
		obj.style.display = 'inline';
		obj.style.overflow = 'visible';
		obj.innerHTML = xmlVal['html'];
		if (ie) {obj.style.pixelLeft=mouseX-40; obj.style.pixelTop=mouseY+10;}
		else if (ns) {obj.style.left=mouseX+"px"; obj.style.top=mouseY+"px";}
		userMenuShowVar = 1;

	}else{
		if(xmlVal['message']){alert(xmlVal['message']);}
	}
}


//»ç¿ëÀÚ¸Þ´º ¼û±â±â
function userMenuHide()
{
   if(userMenuShowVar == 1)
   {
      obj = document.getElementById('userMenuDiv');
      obj.style.display = 'none';
      obj.style.overflow = 'hidden';
	  obj.innerHTML = '';
      userMenuShowVar = 0;
   }
}



//ºñ¹Ð¹øÈ£ ºÐ½Ç ÆäÀÌÁö·Î ÀÌµ¿
function goto_lost_passwd(){
    location.href=http_app_path+'/index.php?g_num='+g_num+'&gs_num='+gs_num+'&now=lost_passwd';
}

// È¸¿ø°¡ÀÔÆäÀÌÁö·Î ÀÌµ¿
function goto_provision(){
    location.href=http_app_path+'/index.php?g_num='+g_num+'&gs_num='+gs_num+'&now=provision';
}

// È¸¿ø°¡ÀÔÆäÀÌÁö·Î ÀÌµ¿
function goto_friend(){
    location.href=http_app_path+'/index.php?g_num='+g_num+'&gs_num='+gs_num+'&now=friendship';
}

function goto_id_confirm(){
    location.href=http_app_path+'/index.php?g_num='+g_num+'&gs_num='+gs_num+'&now=id_confirm';
}

function goto_admin(){
	window.open(http_app_path+'/modules/iezn/admin/index.php');
}

//add Friend
function addFriend(m_id){
	if(getCookie('ld')!=1){
		alert('·Î±×ÀÎ ÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù');
	}else{
		if(typeof(m_id)=='undefined'){
			alert('È¸¿øÁ¤º¸°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù');
		}else{
			xmlVal=postXml(Array('m_id'),Array(m_id),'iezn_member::AddFriend::addFriendExec',1);
			if(xmlVal['code']==1){//ÂüÀÎ°æ¿ì
				alert(xmlVal['message']);
			}else if(xmlVal['code']==0){//°ÅÁþÀÎ°æ¿ì
				alert(xmlVal['message']);
			}
		}
	}
}

//Áßº¹Ã¼Å©
function uniqueCheck(obj,name,m_id){
    if(!check_null(name,obj)) return false;
	postXml(Array('check_value','e_name','h_name','m_id'),Array(obj.value,obj.name,name,m_id),'iezn_member::UniqueCheck::uniqueCheckExec');
}


//Áßº¹Ã¼Å©
function existCheck(obj,name){
    if(!check_null(name,obj)) return false;
	postXml(Array('check_value','e_name','h_name'),Array(obj.value,obj.name,name),'iezn_member::UniqueCheck::uniqueCheckExec');
}


//Æû¸ÞÀÏº¸³»±â
function formmailWrite(m_nick,m_email){
   value = '';
   if(m_email) value += m_emial;
   value = m_nick + ',' + m_email;
   if(ie == true){//ÀÍ½ºÀÎ°æ¿ì ¸ð´ÞÃ¢À¸·Î Ã³¸®
      showModalDialog(http_app_path+"/modules/iezn_member/formmail_write.php?value=" + value, '', "dialogWidth:438px; dialogHeight:488px;status:no;unadorned:yes;scroll:no;resizable:no;edge;sunken");
   }else{
      open_window(http_app_path+"/modules/iezn_member/formmail_write.php?value=" + value, 'formmail', 438, 488, 'no');
   }
}

//Ä³½¬»èÁ¦
function cacheEmpty(g_num){
	g_num.toString();
	postXml(Array('g_num'),Array(g_num),'iezn::CacheEmpty::cacheEmptyExec');
}



function idConfirm(){
	var obj = document.idConfirmF;
	if(!check_blank('ÀÌ¸§',obj.name)) return false;
	if(!check_length('ÀÌ¸§',obj.name,2,12)) return false;
	if(!check_null('ÀÌ¸ÞÀÏ',obj.email)) return false;
	if(!check_blank('ÀÌ¸ÞÀÏ',obj.email)) return false;
	if(!check_email('ÀÌ¸ÞÀÏ',obj.email)) return false;
	postForm(obj,'iezn_member::IdConfirm::idConfirmExec');
	return false;
}

//ÀÌ¸ÞÀÏÀÎÁõÄÚµåÀü¼Û
function emailAuthSend(obj,name,email_f,btn,ck){
	
    if(!check_null(name,email_f)) return false;
	if(!check_email(name,email_f)) return false;	
	//Áßº¹Ã¼Å© ÀÌ¸ÞÀÏ¿¡ ´ëÇÑ Àü¼ÛÀÎ°æ¿ì Áßº¹Ã¼Å©¸¦ ÇÏµµ·Ï ÇÑ´Ù
	if(ck=='unique'){
		if(getCookie("unique["+obj.name+"]")==null){
			alert('Áßº¹Ã¼Å©¸¦ ÇØÁÖ¼¼¿ä');
			return false;
		}
	}else if(ck=='exist'){
		if(getCookie("exist["+obj.name+"]")==null){
			alert('Á¸ÀçÃ¼Å©¸¦ ÇØÁÖ¼¼¿ä');
			return false;
		}
	}
	postXml(Array('email','input_field'),Array(obj.value,obj.name,name),'iezn_member::MemberJoin::emailAuthCodeSend');
}







//¿ìÆí¹øÈ£ °ü·Ã
function zipSearchCall(e,n){
	xmlVal = postXml(Array('fname'),Array(n),'iezn_member::ZipSearch::zipSearchExec',1);
	if(xmlVal['code']==0){
		alert(xmlVal['message']);
	}else{
		obj = document.getElementById('zipSearchDiv');
		obj.style.overflow = 'visible';
		obj.style.left = (ns)? e.pageX : event.x+document.body.scrollLeft
		obj.style.top = (ns)? e.pageY : event.y+document.body.scrollTop + 10;
		obj.style.display = 'inline';
		obj.innerHTML = xmlVal['html'];
		document.zipSearchF.keyword.focus();
	}
}

//¿ìÆí¹øÈ£ °ü·Ã
function zipSearchExec(n){
	obj = document.zipSearchF;
	xmlVal = postForm(obj,'iezn_member::ZipSearch::zipSearchExec',1);
	if(xmlVal['code']==0){
		alert(xmlVal['message']);
		obj.keyword.focus();
	}else{
		document.getElementById('zipSearchDiv').innerHTML = xmlVal['html'];
		if(document.zipSearchF.num){
			document.zipSearchF.num.focus();
		}else{
			document.zipSearchF.bunji.focus();
		}
	}
	return false;
}

function zipSearchEnd(fname){
	if(document.zipSearchF.bunji.value.length<1){
		alert('³ª¸ÓÁö ÁÖ¼Ò¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		document.zipSearchF.bunji.focus();
		return false;
	}
	document.getElementById(fname+'_zip1').value = document.zipSearchF.zip_1.value;
	document.getElementById(fname+'_zip2').value = document.zipSearchF.zip_2.value;
	document.getElementById(fname+'_sido').value = document.zipSearchF.sido.value;
	document.getElementById(fname+'_gugun').value = document.zipSearchF.gugun.value;
	document.getElementById(fname+'_dong').value = document.zipSearchF.dong.value;
	document.getElementById(fname+'_bunji').value = document.zipSearchF.bunji.value;
	document.getElementById(fname+'_address').value = document.zipSearchF.sido.value + " " + document.zipSearchF.gugun.value + " " + document.zipSearchF.dong.value + " "+ document.zipSearchF.bunji.value;
	document.getElementById('zipSearchDiv').innerHTML = '';
	document.getElementById('zipSearchDiv').style.border = 'none';
	document.getElementById('zipSearchDiv').style.display = 'none';
	//document.getElementById('zipSearchDiv').style.visibility = 'hide';
}

function zipSearchHide(){
	document.getElementById('zipSearchDiv').innerHTML = '';
	document.getElementById('zipSearchDiv').style.border = 'none';
	document.getElementById('zipSearchDiv').style.display = 'none';
	//document.getElementById('zipSearchDiv').style.visibility = 'hide';
}


function iconDeleteExec(key){
	if(confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){
		key = key.toString();
		postXml(Array('key'),Array(key),'iezn_member::Icon::iconDeleteExec');
	}
}

function emoDeleteExec(key){
	if(confirm('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){
		key = key.toString();
		postXml(Array('key','now'),Array(key,'emo'),'iezn_member::Icon::iconDeleteExec');
	}
}


function setMyPhotoExec(key){
	key = key.toString();
	postXml(Array('key'),Array(key),'iezn_member::Icon::setMyPhotoExec');
}


function setMyBlogExec(key){
	key = key.toString();
	postXml(Array('key'),Array(key),'iezn_member::Icon::setMyBlogExec');
}

function setMyBlogBannerExec(key){
	key = key.toString();
	postXml(Array('key'),Array(key),'iezn_member::Icon::setMyBlogbannerExec');
}

function setMyEmoExec(key){
	key = key.toString();
	postXml(Array('key'),Array(key),'iezn_member::Icon::setMyEmoExec');
}



//ºñ¹Ð¹øÈ£ ÀÎÁõÄÚµå ¹ß¼Û
function lostPasswd(){
	var obj = document.lostPasswdF;
	if(!check_null('ÀÌ¸ÞÀÏ',obj.email)) return false;
	if(!check_email('ÀÌ¸ÞÀÏ',obj.email)) return false;
	postXml(Array('email'),Array(obj.email.value),'iezn_member::LostPasswd::sendAuthCode',1);
	if(xmlVal['code']==1){
		alert(xmlVal['message']);
		obj.email_submit.disabled=true;
		obj.email.disabled=true;
		obj.auth_code.disabled=false;
		obj.auth_code_submit.disabled=false;	
		obj.auth_code.style.backgroundColor='#ffffff';
		obj.auth_code.focus();
	}else{
		alert(xmlVal['message']);
		obj.email.value='';
		obj.email.focus();
	}
}

//ÀÎÁõÄÚµå Àü¼Û¹× ºñ¹Ð¹øÈ£ Àç¼³Á¤
function lostPasswdAuthCodeCheck(){
	var obj = document.lostPasswdF;
	if(!check_null('ÀÎÁõÄÚµå',obj.auth_code)) return false;
	postForm(obj,'iezn_member::LostPasswd::lostPasswdCheck');
	return false;
}

function unregisterExec(){		
	obj = document.unregisterF;
	if(!check_null('¾ÆÀÌµð', obj.id)) return false;
	if(!check_length('¾ÆÀÌµð',obj.id,2,12)) return false;
	if(!check_null('ºñ¹Ð¹øÈ£', obj.passwd)) return false;
	if(!check_length('ºñ¹Ð¹øÈ£',obj.passwd,2,12)) return false;		
	postForm(obj,'iezn_member::Unregister::unregisterExec',0,1,'<P align="CENTER"><b>È¸¿øÁ¤º¸ »èÁ¦ÁßÀÔ´Ï´Ù</b></p>');
}


