/*
    Page Name : Member Join Validate Script
    Language : Javascript
    First Update :
    Last Update : 2008. 04. 03(by ynmoon)
*/

// Validate Social Number / ID / Email
memberRF=function(objName)
{
	this.objName=objName;		// »ý¼ºµÈ °´Ã¼ ¸í(this)
	this.httpRequest = null;	// httpRequest°´Ã¼
	this.joinForm="";       // È¸¿ø°¡ÀÔ Æû °´Ã¼
    this.ssnParam="";      // ÁÖ¹Î¹øÈ£ Ã¼Å©ÈÄ µ¿ÀÛ
	
	// httpRequest °´Ã¼ »ý¼º ÇÔ¼ö
	memberRF.prototype.getXMLHttpRequest=function()
	{
		if (window.ActiveXObject) {
			try {
				return new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try {
					return new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e1) { return null; }
			}
		} else if (window.XMLHttpRequest) {
			return new XMLHttpRequest();
		} else {
			return null;
		}
	}	//	end getXMLHttpRequest function
	
	// httpRequest send ÇÔ¼ö
	memberRF.prototype.sendRequest=function(url,params,callback,method)
	{
		this.callback=callback;

		this.httpRequest=this.getXMLHttpRequest();
		var httpMethod=method ? method : 'GET';
		if (httpMethod!='GET' && httpMethod!='POST') {
			httpMethod='GET';
		}
		var httpParams=(params==null || params=='')?null:params;
		var httpUrl=url;
		if (httpMethod=='GET' && httpParams!=null) {
			httpUrl=httpUrl+"?"+httpParams;
		}
		this.httpRequest.open(httpMethod,httpUrl,true);
		this.httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		var request = this;
		this.httpRequest.onreadystatechange=function()
		{
			request.onStateChange.call(request);
		}
		this.httpRequest.send(httpMethod=='POST'?httpParams:null);	
	}	// end sendRequest function

	// httpRequest return ÇÔ¼ö
	memberRF.prototype.onStateChange=function()
	{
		this.callback(this.httpRequest);
	}	// end onStateChange end

	// ÁÖ¹Îµî·Ï¹øÈ£ Áßº¹ Ã¼Å©
	memberRF.prototype.ssnOverrapCheck=function(param)
	{
		var joinForm=this.joinForm;
		
		this.ssnParam=param;
			
		params="ssn="+encodeURIComponent(joinForm.ssn1.value+"-"+joinForm.ssn2.value);
		params += "&code="+encodeURIComponent('ssnCheck');
		
		this.sendRequest("/union/ajax/member.html",params,this.ssnOverrapResponse,"POST");
	}	// end ssnOverrapCheck function


	// ÁÖ¹Îµî·Ï¹øÈ£ Áßº¹ Ã¼Å© °á°ú°ª
	memberRF.prototype.ssnOverrapResponse=function()
	{
		if (this.httpRequest.readyState==4) {
			if (this.httpRequest.status==200) {
				var joinForm=this.joinForm;
				var docXML_FD=this.httpRequest.responseXML;
				var code=docXML_FD.getElementsByTagName("code").item(0).firstChild.nodeValue;			// Áßº¹¿©ºÎ
				message=docXML_FD.getElementsByTagName("message").item(0).firstChild.nodeValue; 	// ¸®ÅÏ¸Þ½ÃÁö

				if (code=='true') {
    				joinForm.ssnCheck.value="Y";
    				if (this.ssnParam=="normal") {			
					    joinForm.id.focus();
				    }
				} else {
    				joinForm.ssnCheck.value="N";
					joinForm.ssn1.value="";
					joinForm.ssn2.value="";
					joinForm.ssn1.focus();
					alert(message);
				}
			}
		}
	}	// end ssnOverrapResponse function


	// ¾ÆÀÌµð Áßº¹Ã¼Å©(±âÁ¸ ¹öÆ° Å¬¸¯)
	memberRF.prototype.idOverrapCheck=function()
	{
		var joinForm=this.joinForm;
		
		if (joinForm.id.value == "") {	// ¾ÆÀÌµð ¹ÌÀÔ·Â½Ã
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			joinForm.id.focus();		
		} else {
			params="id="+encodeURIComponent(joinForm.id.value);
			params+="&code="+encodeURIComponent('idCheck');
			this.sendRequest("/union/ajax/member.html",params,this.idOverrapResponse,"POST");
		}
	}	// end idOverrapCheck function
	
	// ¾ÆÀÌµð Áßº¹Ã¼Å© °á°ú°ª
	memberRF.prototype.idOverrapResponse=function()
	{
		if (this.httpRequest.readyState==4) {
			if (this.httpRequest.status==200) {
				var joinForm=this.joinForm;
				var docXML_FD=this.httpRequest.responseXML;
				var code=docXML_FD.getElementsByTagName("code").item(0).firstChild.nodeValue;			// Áßº¹¿©ºÎ
				var message=docXML_FD.getElementsByTagName("message").item(0).firstChild.nodeValue;	// ¸®ÅÏ¸Þ½ÃÁö

				if (code=='true') {
					joinForm.idCheck.value="Y";
					joinForm.e_head.focus();
				}else{
					joinForm.idCheck.value="N";
					joinForm.id.value="";
					joinForm.id.focus();
				}
				alert(message);
			}
		}
	}	// end idOverrapResponse function


	// ÀÌ¸ÞÀÏ Ã¼Å©
	memberRF.prototype.emailOverrapCheck=function(chk)
	{
		var joinForm=this.joinForm;
		
		if (joinForm.e_head.value=="") {	// ÀÌ¸ÞÀÏ ¹ÌÀÔ·Â½Ã
			alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
			joinForm.e_head.focus();
		} else if (joinForm.e_domain.value=="") {
			if (document.getElementById("MBFSelect").style.display!="none") {
			    alert("µµ¸ÞÀÎÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
    			document.getElementById("MBFSelect").focus();
		    } else {
			    alert("µµ¸ÞÀÎÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			    joinForm.e_domain.focus();
		    }
		} else {			
			params="email="+encodeURIComponent(joinForm.e_head.value + '@' + joinForm.e_domain.value);
			params+="&code="+encodeURIComponent('emailCheck');
			this.sendRequest("/union/ajax/member.html",params,this.emailOverrapResponse,"POST");	
		}
	}	// end idOverrapCheck function


	// ÀÌ¸ÞÀÏ Ã¼Å© °á°ú°ª
	memberRF.prototype.emailOverrapResponse=function()
	{
		if (this.httpRequest.readyState==4) {
			if (this.httpRequest.status==200) {
				var joinForm=this.joinForm;
				var docXML_FD=this.httpRequest.responseXML;
				var code=docXML_FD.getElementsByTagName("code").item(0).firstChild.nodeValue;			// Áßº¹¿©ºÎ
				var message=docXML_FD.getElementsByTagName("message").item(0).firstChild.nodeValue;	// ¸®ÅÏ¸Þ½ÃÁö

				if (code=='true') {
					joinForm.emailCheck.value="Y";
					joinForm.passwd.focus();
				} else {
    				joinForm.e_head.value="";    				
    				joinForm.e_head.focus();
					joinForm.emailCheck.value="N";
				}
				alert(message);
			}
		}
	}	// end idOverrapResponse function
}	//	end memberRF Class

// Number Check
function isNum(num) {
	if (/^[0-9]{1,}$/.test(num)) {
    	return true;
	}
	
	return false;
}

// Focus Next Element
function focusNext(obj)
{
    var theForm=obj;
    
    if (theForm.ssn1.value.length>=6) {
	    if (!isNum(theForm.ssn1.value)) {
			alert("ÁÖ¹Îµî·Ï¹øÈ£´Â ¼ýÀÚ·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			theForm.ssn1.value="";
			theForm.ssn1.focus();
			return;
		}
		theForm.ssn2.focus();
		return;
	}
}

// Foreign Registration Number Validation
function checkForeign(num)
{
    var sum=0;
    var odd=0;
    
    buf=new Array(13);
    for (i=0;i<13;i++) {
        buf[i] = parseInt(num.charAt(i));
    }

    odd=buf[7]*10+buf[8];
    
    if (odd%2!=0) {
      return false;
    }

    if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) {
      return false;
    }
     
    multipliers=[2,3,4,5,6,7,8,9,2,3,4,5];
    for(i=0,sum=0;i<12;i++) {
        sum+=(buf[i]*=multipliers[i]);
    }

    sum=11-(sum%11);
    
    if (sum>=10) {
        sum-=10;
    }

    sum+=2;

    if (sum>=10) {
        sum-=10;
    }

    if (sum!= buf[12]) {
        return false;
    } else {
        return true;
    }
}

// Input Email Direct
function inputDirect(obj1,obj2,param)
{
    var d_box=document.getElementById(obj1);
    
    if (param=="input") {
        d_box.value="";
        document.getElementById("MBFSelect").style.display="none";
        changeLayer(obj1,obj2);
        d_box.focus();
    } else {
        d_box.value=param;
    }
}

// input Living Area
function inputArea(obj1,obj2,obj3,param)
{
    var live=document.getElementsByName(obj3);
        
    if (param=="in") {
        live[0].checked=true;
        live[1].checked=false;
        document.getElementById("MBFOCountry").style.display="none";
    } else {
        live[0].checked=false;
        live[1].checked=true;
        document.getElementById("MBFOCountry").style.display="block";
    }
    
    changeLayer(obj1,obj2);
}

// Change Select Layer
function changeLayer(obj1,obj2)
{
    var showLayer=document.getElementById(obj1);
    var hideLayer=document.getElementById(obj2);
    
    hideLayer.style.display="none";
    showLayer.style.display="block";
}

// Input Hidden Value
function inputHidden(obj,param)
{
    var hd_form=document.getElementById(obj);
    hd_form.value=param;
}

// Korean Name Validation
function checkKorean(param)
{ 
    if (param.length<1 || param.length>6) { 
        return false; 
    } 
    
    for(var i=0;i<param.length;i++) { 
        var chr=param.substr(i,1); 
        chr=escape(chr); 
        
        if (chr.charAt(1)=="u") { 
            chr=chr.substr(2,(chr.length-1)); 
            if ((chr<"AC00") || (chr>"D7A3")) {
                return false; 
            }
        } else {
            return false; 
        }
    } 
    
    return true; 
}

// Social Number Validation
function checkSocial(obj,param1,param2)
{
    var theForm=obj;
    var ssn1=param1;
    var ssn2=param2;

    var chk=0;
    var mm=ssn1.substring(2,4);
    var dd=ssn1.substring(4,6);
    var sex=ssn2.substring(0,1);
    
    if((ssn1.length!=6) || (mm<1||mm>12||dd<1)) {
    	return false;
    }
    if (!isNum(ssn1)) {
    	return false;
    }
    if ((sex !=1 && sex !=2 && sex !=3 && sex !=4) || (ssn2.length!=7)) {
    	return false;
    }
    if (!isNum(ssn2)) {
        return false;
    }
    for (var i=0;i<=5;i++) {
    	chk=chk+((i%8+2)*parseInt(ssn1.substring(i,i+1)))
	}
	for(var i=6;i<=11;i++) {
		chk=chk+((i%8+2)*parseInt(ssn2.substring(i-6,i-5)))
	}
	chk=11-(chk%11)
	chk=chk%10;
	if (chk!=ssn2.substring(6,7)) {
		return false;
	}
	
	return true;
}

// Email Address Validation
function checkEmail(param)
{
    var e_check=/^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
    
    if (!e_check.test(param)) {
        return false;
    } else {
        return true;
    }
}
 
// Close Window Function
function closeWindow()
{
    top.window.opener=top;
    top.window.open('','_parent', '');
    top.window.close();   
}

// Move Login Area
function moveLogin()
{
    opener.top.location.href="/member/";
    closeWindow(); 
}

// Move CS Center
function moveCscenter()
{
    opener.top.location.href="/cscenter/cs_quest/";
    closeWindow(); 
}

// Window Resize
function resizeWindow(w,h)
{
    var agent=navigator.userAgent.toLowerCase();
    var isIE=((agent.indexOf("msie")!=-1) && (agent.indexOf("opera")==-1));
    var isOP=((agent.indexOf("msie")==-1) && (agent.indexOf("opera")!=-1));
    var isIE7=agent.match(/msie 7/);
    var isIE8=agent.match(/msie 8/);
    var isFF3=agent.indexOf("firefox/3")>0;
    var isXP=agent.indexOf("nt 5.1")>0;
    var isVISTA=agent.indexOf("nt 6.")>0;
    var isChrome=agent.indexOf("chrome")>0;
    
    if (isIE8 || isFF3) {
        if (isVISTA) {      
            var _width=parseInt(parseInt(w)+10);
            var _height=parseInt(parseInt(h)+65);
        } else {
            var _width=parseInt(parseInt(w)+10);
            var _height=parseInt(parseInt(h)+80);
        }
    } else if (isIE7 || isChrome) {
        if (isVISTA) {      
            var _width=parseInt(parseInt(w)+10);
            var _height=parseInt(parseInt(h)+55);
        } else {
            var _width=parseInt(parseInt(w)+10);
            var _height=parseInt(parseInt(h)+70);
        }
    } else if (isIE) {
        var _width=parseInt(parseInt(w)+10);
        if (isXP) {
            var _height=parseInt(parseInt(h)+58);
        } else {        
            var _height=parseInt(parseInt(h)+49);
        }
    } else if (isOP) {
        var _width=parseInt(parseInt(w)+10);
        var _height=parseInt(parseInt(h)+43);
    } else {
        var _width=parseInt(parseInt(w)+10);
        var _height=parseInt(parseInt(h)+50);
    }
    
    window.resizeTo(_width,_height);
}


// Join Member Validatioin
function joinCheck(obj,param)
{
    var theForm=obj;
    
    var ssn1=theForm.ssn1.value;
    var ssn2=theForm.ssn2.value;
    
    if (!theForm.name.value) {
        alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        theForm.name.focus();
        return false;
    }
    if (param=="normal") {
        if (!checkKorean(theForm.name.value)) {
            alert("ÀÌ¸§Àº ÇÑ±Û·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
            theForm.name.focus();
            return false;
        }
    	if (!ssn1) {
    		alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    		theForm.ssn1.focus();
    		return false;
    	}
    	if (!ssn2) {
    		alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    		theForm.ssn2.focus();
    		return false;
    	}
    	if (!checkSocial(theForm,ssn1,ssn2)) {
            alert("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù");
    		theForm.ssn1.focus();
    		return false;
    	}        	
        if (theForm.ssnCheck.value!="Y") {
            alert("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù");
    		theForm.ssn1.focus();
    		return false;
    	}
	}
    if (!(/^[_a-z\d]{4,12}$/i.test(theForm.id.value))) {
        alert("¾ÆÀÌµð´Â ¿µ¹® ¶Ç´Â ¼ýÀÚÁ¶ÇÕÀ¸·Î 4-12ÀÚ±îÁö ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        theForm.id.focus();
        return false;
    }
    if (theForm.idCheck.value!="Y") {
        alert("¾ÆÀÌµð Áßº¹Ã¼Å©¸¦ ÇØÁÖ¼¼¿ä");
        theForm.id.focus();
        return false;
    }
    if (!theForm.e_head.value) {
        alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        theForm.e_head.focus();
        return false;
    }
    if (!theForm.e_domain.value) {
       if (document.getElementById("MBFSelect").style.display!="none") {
            alert("µµ¸ÞÀÎÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä");
    		document.getElementById("MBFSelect").focus();
	    } else {
            alert("µµ¸ÞÀÎÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		    theForm.e_domain.focus();
	    }
        
        return false;
    }
    
    var email=theForm.e_head.value+"@"+theForm.e_domain.value;
    
    if (!checkEmail(email)) {
        alert("¿Ã¹Ù¸¦ Çü½ÄÀÇ ¸ÞÀÏÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù");
        theForm.e_head.focus();
        return false;
    }
    if (theForm.emailCheck.value!="Y") {
        alert("ÀÌ¸ÞÀÏ Áßº¹Ã¼Å©¸¦ ÇØÁÖ¼¼¿ä");
        theForm.e_head.focus();
        return false;
    }
	if (!theForm.passwd.value) {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		theForm.passwd.focus();
		return false;
	}
	if (!theForm.passwd2.value) {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		theForm.passwd2.focus();
		return false;
	}
	if (theForm.passwd.value!=theForm.passwd2.value) {
		alert("ºñ¹Ð¹øÈ£°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù");
		theForm.passwd.focus();
		return false;
	}
	if (theForm.passwd.value.length<4 || theForm.passwd.value.length>12) {
    	alert("ºñ¹Ð¹øÈ£´Â 4-12ÀÚ±îÁö ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		theForm.passwd.focus();
		return false;
	}
	if (param=="normal") {
    	if (!theForm.hp1.value || theForm.hp1.value.length<2) {
        	alert("ÀüÈ­¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        	theForm.hp1.focus();
        	return false;
    	}
    	if (!theForm.hp2.value || theForm.hp2.value.length<3) {
        	alert("ÀüÈ­¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        	theForm.hp2.focus();
        	return false;
    	}
    	if (!theForm.hp3.value || theForm.hp3.value.length<4) {
        	alert("ÀüÈ­¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        	theForm.hp3.focus();
        	return false;
    	}
	}
	if (param=="over") {
    	if (theForm.live[0].checked==true) {
           	var f_num=theForm.ssn1.value+theForm.ssn2.value;
           	
		    if (!checkForeign(f_num)) {
    		    alert("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù");
    		    theForm.ssn1.focus();
    		    return false;
		    }
	    } else {
    	    if (!theForm.country.value) {
        	    alert("±¹ÀûÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä");
        	    document.getElementById("MBFOCountry").focus();
        	    return false;
    	    }
	    }    	
	}
	if (!theForm.inform.checked) {
    	alert("°³ÀÎÁ¤º¸ Á¦°ø¿¡ µ¿ÀÇÇÏ½ÃÁö ¾Ê¾Ò½À´Ï´Ù.");
    	theForm.inform.focus();
    	return false;
	}
	
	return true;
}

// Id Search Check(Normal)
function searchIdCheck(obj,param)
{
    var theForm=obj;
    
    if (!theForm.name.value) {
        alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        theForm.name.focus();
        return false;
    }
    if (param=="normal") {
        var ssn1=theForm.ssn1.value;
        var ssn2=theForm.ssn2.value;
        
    	if (!ssn1) {
    		alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    		theForm.ssn1.focus();
    		return false;
    	}
    	if (!ssn2) {
    		alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    		theForm.ssn2.focus();
    		return false;
    	}
    	if (!checkSocial(theForm,ssn1,ssn2)) {
            alert("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù");
    		theForm.ssn1.focus();
    		return false;
    	}
	} else {
    	if (!theForm.e_head.value) {
            alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
            theForm.e_head.focus();
            return false;
        }
        if (!theForm.e_domain.value) {
            alert("µµ¸ÞÀÎÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
            theForm.e_domain.focus();
            return false;
        }
        
        var email=theForm.e_head.value+"@"+theForm.e_domain.value;
        
        if (!checkEmail(email)) {
            alert("¿Ã¹Ù¸¥ Çü½ÄÀÇ ¸ÞÀÏÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù");
            theForm.e_head.focus();
            return false;
        }
	}
	
	return true;
}

// Pwd Search Check(Normal)
function searchPwdCheck(obj,param)
{
    var theForm=obj;
    
    if (!(/^[_a-z\d]{4,12}$/i.test(theForm.id.value))) {
        alert("¾ÆÀÌµð´Â ¿µ¹® ¶Ç´Â ¼ýÀÚÁ¶ÇÕÀ¸·Î 4-12ÀÚ±îÁö ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        theForm.id.focus();
        return false;
    }
    if (param=="normal") {
        if (!theForm.name.value) {
            alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
            theForm.name.focus();
            return false;
        }
        
        var ssn1=theForm.ssn1.value;
        var ssn2=theForm.ssn2.value;
        
    	if (!ssn1) {
    		alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    		theForm.ssn1.focus();
    		return false;
    	}
    	if (!ssn2) {
    		alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
    		theForm.ssn2.focus();
    		return false;
    	}
    	if (!checkSocial(theForm,ssn1,ssn2)) {
            alert("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù");
    		theForm.ssn1.focus();
    		return false;
    	}
	} else {
    	if (!theForm.e_head.value) {
            alert("ÀÌ¸ÞÀÏÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
            theForm.e_head.focus();
            return false;
        }
        if (!theForm.e_domain.value) {
            alert("µµ¸ÞÀÎÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
            theForm.e_domain.focus();
            return false;
        }
        
        var email=theForm.e_head.value+"@"+theForm.e_domain.value;
        
        if (!checkEmail(email)) {
            alert("¿Ã¹Ù¸¦ Çü½ÄÀÇ ¸ÞÀÏÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù");
            theForm.e_head.focus();
            return false;
        }
	}
	
	return true;
}

// SMS Confirm Time Check
function showTime(obj,param) 
{
    var p=document.getElementById(obj);
    var m=p.min.value;
    var s=p.sec.value;
    
    s=1*s-1;
    
    if (s<(0*1)) {
        m=m*1-1;
        s=59*1;
    }
    if (s<10) {
        s="0"+s;
    }
    var _time=document.getElementById(param);
    _time.innerHTML=m+":"+s+"&nbsp;";
    
    p.min.value=m;
    p.sec.value=s;

    if (s==0 && m==0) {
        alert("½Ã°£ÃÊ°ú·Î ÀÎÁõÀÌ Ãë¼Ò µË´Ï´Ù.");
        closeWindow()
    } else {
        setTimeout("showTime('"+obj+"','"+param+"')",1000);
    }
}

// SMS Confirm Validation
function cellStep1Check(obj)
{
    var theForm=obj;
    
    if (!theForm.c_num.value) {
        alert("ÀÎÁõ¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        theForm.c_num.focus();
        return false;
    }
    /*
    if (!theForm.c_num.value.length<6) {
        alert("ÀÎÁõ¹øÈ£´Â 6ÀÚ¸®·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
        theForm.c_num.focus();
        return false;
    }
    */
    
    return true;
}

// Change Password Validation
function cellStep2Check(obj)
{
    var theForm=obj;
    
	if (!theForm.passwd.value) {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		theForm.passwd.focus();
		return false;
	}
	if (!theForm.passwd2.value) {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		theForm.passwd2.focus();
		return false;
	}
	if (theForm.passwd.value!=theForm.passwd2.value) {
		alert("ºñ¹Ð¹øÈ£°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù");
		theForm.passwd.focus();
		return false;
	}
	if (theForm.passwd.value.length<4 || theForm.passwd.value.length>12) {
    	alert("ºñ¹Ð¹øÈ£´Â 4-12ÀÚ±îÁö ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		theForm.passwd.focus();
		return false;
	}
	
	return true;
}