	var query_str = '';
	var focus_page = '';
	var xmlHttp=null;
	
	var focus_popup = null; 
	var bdown = false;
	var focus_mid = null;
	var focus_sid = null;
	var focus_tid = null;
	var x, y; 
	function createXMLHttpRequest() { //아자스 객체 생성
    	if (window.ActiveXObject) {
       		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	    }else if (window.XMLHttpRequest) {
	        xmlHttp = new XMLHttpRequest();
    	}
	}
/*********************************************************************
* 실명인증 확인
*********************************************************************/
function JSNameCheckAction()
{
	theForm = document.MainForm;
	if (!inputCheck("MainForm", "name", "이름", "", "", "", "", "")) { return; }
	if(!CheckHangul(theForm.name))
	{
		return;
	}
	if (!inputCheck("MainForm", "jumin1", "주민등록번호", "", "", "", "", "")) { return;  }
	if (!inputCheck("MainForm", "jumin2", "주민등록번호", "", "", "", "", "")) { return; }
	if(!CheckResidentID("MainForm","jumin1","jumin2"))
	{
		return;
	}
	
	//document.MainForm.action = "mem_reg_chk.php";alert('aa');
	fml = document.MainForm;
    fml.target = "HiddenFrame";
    fml.action = "mem_reg_chk.php";
    fml.submit();	
	return;
}

/*********************************************************************
* 정보동의 확인
*********************************************************************/
function JSArgeeAction()
{
	theForm = document.MainForm;
	if(theForm.argee1.checked==false) { 
			alert("이용약관에 동의하셔야만 가입이 가능합니다."); 
			theForm.argee1.focus();
			return false;
	}
	if(theForm.argee2.checked==false) { 
			alert("개인정보 보호정책에 동의하셔야만 가입이 가능합니다."); 
			theForm.argee2.focus();
			return false;
	}
}


/*********************************************************************
* 회원가입 확인
*********************************************************************/
function JSjoinAction(type){
	theForm = document.MainForm;


//	if (!inputCheck("MainForm", "name", "이름", "", "", "", "", "")) { return false; }

	if (!inputCheck("MainForm", "name", "이름", "", "", "", "", "")) { return false; }
	if(type=="1"){  //국내
		if (!inputCheck("MainForm", "jumin1", "주민번호 앞자리", "", "", "", "", "")) { return false; }
		if (!inputCheck("MainForm", "jumin2", "주민번호 뒷자리", "", "", "", "", "")) { return false; }
	}
	if (theForm.name_chk.value!="yes"){alert('실명인증을 하셔야 합니다.'); return false;}
	if (!inputCheck("MainForm", "user_id", "회원아이디", "", "", "", "", "")) { return false; }
	if(!TypeCheck(theForm.user_id.value, ALPHA+NUM)){ alert('회원아이디는 영문,숫자만 입력가능합니다.'); theForm.user_id.value="";return false;}
	if(!CheckLen1(theForm.user_id,4,12)){alert('회원아이디는 4자이상 12자 이하여야 합니다.'); theForm.user_id.value="";return false;}
	if(theForm.idChk.value!="1"){alert('아이디 중복 검사를 하셔야 합니다.'); return false;}

	if(!inputCheck("MainForm", "p_key", "비밀번호", "", "", "", "", "")) { return false; }
	if(!TypeCheck(theForm.p_key.value, ALPHA+NUM)){ alert('비밀번호는 영문,숫자만 입력가능합니다.');theForm.p_key.focus();return false;        }
	if(!CheckLen1(theForm.p_key,6,10)){alert('비밀번호는 6자이상 10자 이하여야 합니다.'); theForm.p_key.focus();return false;}
	if((theForm.p_key.value) != (theForm.re_key.value)){ alert('비밀번호가 일치하지 않습니다. ');theForm.p_key.focus(); return false; }
	
	if (!inputCheck("MainForm", "nick_nm", "닉네임", "", "", "", "", "")) { return false; }
	if(theForm.nickChk.value!="1"){alert('닉네임 중복 검사를 하셔야 합니다.'); return false;}
	if(!CheckLen1(theForm.nick_nm,2,12)){alert('닉네임은 2자이상 12자 이하여야 합니다.'); theForm.nick_nm.value="";return false;}


	if (!inputCheck("MainForm", "email1", "이메일", "", "", "", "", "")) { return false; }
	if (!inputCheck("MainForm", "email2", "이메일", "", "", "", "", "")) { return false; }	
	if (is_Email(theForm.email1.value+"@"+theForm.email2.value) == false) { alert("이메일을 올바로 입력하십시오"); theForm.email1.focus(); return ;}
	
	if(theForm.emailChk.value!="1"){alert('이메일 중복 검사를 하셔야 합니다.'); return false;}

	if(type=="1"){  //국내
		if(theForm.mobile_chk.value){
			if(theForm.mobile_chk.value!=theForm.mnum.value){
				theForm.mnum.value='';
				alert('인증번호를 확인해 주세요.');			
				theForm.mnum.focus();
				return;
			}
		}
	}

	if(theForm.argee1.checked==false) { 
			alert("이용약관에 동의하셔야만 가입이 가능합니다."); 
			theForm.argee1.focus();
			return false;
	}
	if(theForm.argee2.checked==false) { 
			alert("개인정보 보호정책에 동의하셔야만 가입이 가능합니다."); 
			theForm.argee2.focus();
			return false;
	}

/*
	if(type=='1') { 
		if (!inputCheck("MainForm", "mobile1", "휴대폰", "", "", "", "", "")) { return false; }
		if (!inputCheck("MainForm", "mobile2", "휴대폰", "", "", "", "", "")) { return false; }
		if (!inputCheck("MainForm", "mobile3", "휴대폰", "", "", "", "", "")) { return false; }
	}
*/
//	if(!checkboxCheck("interest[]","관심분야")) { return false;}	

	//if(TrimString(theForm.recom_id.value)){
	//		if(theForm.recomChk.value!="1"){alert('추천인 확인을 하셔야 합니다.'); return false;}
	//}

	theForm.uemail.value = theForm.email1.value+"@"+theForm.email2.value;
	theForm.target="";
	theForm.action="mem_join_ok.php";
//	theForm.submit();
}

function JSjoinAction_New(type){ //by kkwon 2010-03-10 가입폼 변경
	theForm = document.MainForm;

	if (!inputCheck("MainForm", "user_id", "회원아이디", "", "", "", "", "")) { return false; }
	if(!TypeCheck(theForm.user_id.value, ALPHA+NUM)){ alert('회원아이디는 영문,숫자만 입력가능합니다.'); theForm.user_id.value="";return false;}
	if(!CheckLen1(theForm.user_id,4,12)){alert('회원아이디는 4자이상 12자 이하여야 합니다.'); theForm.user_id.value="";return false;}
	if(theForm.idChk.value!="1"){alert('아이디 중복 검사를 하셔야 합니다.'); return false;}

	if(!inputCheck("MainForm", "p_key", "비밀번호", "", "", "", "", "")) { return false; }
	if(!TypeCheck(theForm.p_key.value, ALPHA+NUM)){ alert('비밀번호는 영문,숫자만 입력가능합니다.');theForm.p_key.focus();return false;        }
	if(!CheckLen1(theForm.p_key,6,10)){alert('비밀번호는 6자이상 10자 이하여야 합니다.'); theForm.p_key.focus();return false;}
	if((theForm.p_key.value) != (theForm.re_key.value)){ alert('비밀번호가 일치하지 않습니다. ');theForm.p_key.focus(); return false; }
	
	if (!inputCheck("MainForm", "nick_nm", "닉네임", "", "", "", "", "")) { return false; }
	if(theForm.nickChk.value!="1"){alert('닉네임 중복 검사를 하셔야 합니다.'); return false;}
	if(!CheckLen1(theForm.nick_nm,2,12)){alert('닉네임은 2자이상 12자 이하여야 합니다.'); theForm.nick_nm.value="";return false;}


	if (!inputCheck("MainForm", "email1", "이메일", "", "", "", "", "")) { return false; }
	if (!inputCheck("MainForm", "email2", "이메일", "", "", "", "", "")) { return false; }	
	if (is_Email(theForm.email1.value+"@"+theForm.email2.value) == false) { alert("이메일을 올바로 입력하십시오"); theForm.email1.focus(); return ;}
	
	if(theForm.emailChk.value!="1"){alert('이메일 중복 검사를 하셔야 합니다.'); return false;}

	if(theForm.argee1.checked==false) { 
			alert("이용약관에 동의하셔야만 가입이 가능합니다."); 
			theForm.argee1.focus();
			return false;
	}
	if(theForm.argee2.checked==false) { 
			alert("개인정보 보호정책에 동의하셔야만 가입이 가능합니다."); 
			theForm.argee2.focus();
			return false;
	}

	theForm.uemail.value = theForm.email1.value+"@"+theForm.email2.value;
	theForm.target="";
	theForm.action="mem_join_ok_New.php";
}

/*********************************************************************
* 휴대폰 인증
*********************************************************************/
function JSMobileAction()
{
	theForm = document.MainForm;
	if(!theForm.vendor.value){
		alert("통신사를 선택하세요");
		theForm.vendor.focus();
		return;
	}
	if(!theForm.mobile1.value){
		alert("휴대폰을 입력하세요!");
		theForm.mobile1.focus();
		return;
	}
	if(!theForm.mobile2.value){
		alert("휴대폰을 입력하세요!");
		theForm.mobile2.focus();
		return;
	}
	if(!theForm.mobile3.value){
		alert("휴대폰을 입력하세요!");
		theForm.mobile3.focus();
		return;
	}
	
	fm2 = document.MainForm;
    fm2.target = "HiddenFrame";
    fm2.action = "mem_mobile_chk.php";
    fm2.submit();	
	return;
}

/*********************************************************************
* EMAIL SELECT박스
*********************************************************************/

function email_change(){
	 if(document.MainForm.email.options[document.MainForm.email.selectedIndex].value == '00'){
//	  document.MainForm.email2.disabled = true;
	  document.MainForm.email2.value = "";
	 }
	 if(document.MainForm.email.options[document.MainForm.email.selectedIndex].value == '99'){
//	  document.MainForm.email2.disabled = false;
	  document.MainForm.email2.value = "";
	  document.MainForm.email2.focus();
	 } else{
//	  document.MainForm.email2.disabled = true;
	  document.MainForm.email2.value = document.MainForm.email.options[document.MainForm.email.selectedIndex].value;
	 }
}

/*********************************************************************
* 아이디 중복확인
*********************************************************************/

function id_chk(a, b, c)
{
	var form = eval("document."+a+"."+b);

	var LEN = str_length(form);
		
		if ((LEN > 12) || (LEN < 4)) {
			alert('4~12자 사이의 영문/숫자 조합으로 입력하세요.');form.focus();
		}	
		else {
			if(!TypeCheck(form.value, ALPHA+NUM)){ alert('회원아이디는 영문,숫자만 입력가능합니다.');form.focus();}
			else if (!TypeCheck(form.value.substr(0, 1), ALPHA))	{alert('회원아이디 첫글자는 영문이어야 합니다.');form.focus();}
			else {
			
			eval("document."+a+".idChk.value='1'");  // 아이디 중복확인 추가
			Userid = form.value;

			document.getElementById('HiddenFrame').src='mem_id_chk.php?Userid='+Userid; 

			var Obj = document.getElementById(c); 
			if (Obj.style.display == "none") { 
				Obj.style.display = ""; 
			} 
			
		}
	}
}

/*********************************************************************
* 닉네임 중복 확인
*********************************************************************/

function nick_chk(a, b,c)
{
	    var form = eval("document."+a+"."+b);	
		var f = eval("document." + a);
		if(!TrimString(form.value))	{
			alert('닉네임을 입력하세요'); 
			form.focus();
			return false;
		} else {
			//길이체크
			var t;
			var msglen;
			msglen=0;
			l=form.value.length;
			for(k=0;k<l;k++){
				t=form.value.charAt(k);
				if(escape(t).length>4) msglen+=2;
				else msglen++;
			}

			if (msglen < 4||msglen > 12){
				alert('닉네임은 한글 2자~6자 / 영문 4자~12자 입니다.');
				return false;
			}

			eval("document."+a+".nickChk.value='1'");  // 닉네임 중복 확인 추가
//			nick_nm = f.nick_nm.value;
			nick_nm = form.value;
		}
		
		url = "mem_nick_chk.php";
		query_str = "nick=" + nick_nm + "&mode=get";
		createXMLHttpRequest();	
		xmlHttp.open("POST", url, true);
	    xmlHttp.onreadystatechange = handleGetModelList;
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send(query_str);


		var Obj = document.getElementById(c); 
		if (Obj.style.display == "none") { 
			Obj.style.display = ""; 
		} 
}


	function handleGetModelList() {			//출력할 위치 지정(div name)
   		if(xmlHttp.readyState == 4) {
        	if(xmlHttp.status == 200) {
            	document.getElementById("ajax_view").innerHTML = xmlHttp.responseText;

				test = document.getElementById("nick_result");
				res = document.getElementById("nm_result");
				chk = document.getElementById("chk_result");
				document.getElementById('result_nick').innerHTML = test.name;
				document.getElementById('nick_nm').value = res.name;
				document.getElementById('nickChk').value = chk.name;
        	}
    	}
	}

/*********************************************************************
* 이메일 중복확인
*********************************************************************/

function email_chk(a, b)
{
    theForm = document.MainForm;

	if (!inputCheck("MainForm", "email1", "이메일", "", "", "", "", "")) { return false; }
	if (!inputCheck("MainForm", "email2", "이메일", "", "", "", "", "")) { return false; }	
	if (is_Email(theForm.email1.value+"@"+theForm.email2.value) == false) { alert("이메일을 올바로 입력하십시오"); theForm.email1.focus(); return false;}

			
	eval("document."+a+".emailChk.value='1'");  // 아이디 중복확인 추가
	email = theForm.email1.value+"@"+theForm.email2.value;

	document.getElementById('HiddenFrame').src='mem_email_chk.php?uemail='+email; 

	var Obj = document.getElementById(b); 
	if (Obj.style.display == "none") { 
		Obj.style.display = ""; 
	} 
	
}

/*********************************************************************
*추천인 검증
*********************************************************************/
function vote_to_chk(a, b, c) {
	var form = eval("document."+a+"."+b);
	vote_id = form.value;

	if(!TrimString(form.value)){ alert('추천인아이디를 입력하세요'); form.focus()}
	else {
			if(!TypeCheck(form.value, ALPHA+NUM)){ alert('추천인아이디는 영문,숫자만 입력가능합니다.');form.focus();}
			else if (!TypeCheck(form.value.substr(0, 1), ALPHA))	{alert('추천인아이디는 첫글자는 영문이어야 합니다.');form.focus();}
			else {

				eval("document."+a+".vote_to").value=vote_id;  // 추천인아이디 중복 확인 추가

	//	document.location.href='vote_to_chk.php?vote_id='+vote_id;
		document.getElementById('HiddenFrame').src='vote_to_chk.php?vote_id='+vote_id;
			var Obj = document.getElementById(c); 
			if (Obj.style.display == "none") { 
				Obj.style.display = ""; 
			} 
		}
	}
}

/*********************************************************************
* 로그인 확인
*********************************************************************/

function JSLoginAction(str)
{
  //by kkwon 2009.08.02 p2p 어플 로그인시 체크 시작
  if(str=="app"||str!="old" && str){
	  //alert(str);
		if(pmOBJ_CHK()){
			//alert('설치');
		}else{
			alert('ActiveX 설치가 필요합니다');
			document.location.reload(); //2010-01-25
			return false;
		}
	}
	//by kkwon 2009.08.02 p2p 어플 로그인시 체크 끝

  f=document.MainForm;
  
  if(!TrimString(f.userId.value)){ alert('아이디를 입력하세요'); f.userId.focus();return false;}
 // if(!TypeCheck(f.userId.value, ALPHA+NUM)){ alert('아이디는 영문,숫자 조합만 입력가능합니다.'); f.userId.focus();return false;}
  if(!TrimString(f.userPass.value)){ alert('패스워드를 입력하세요'); f.userPass.focus();return false;}
 // if(!TypeCheck(f.userPass.value, ALPHA+NUM)){ alert('패스워드는 영문,숫자 조합만 입력가능합니다.'); f.userPass.focus();return false;}
  return true;
}


/*********************************************************************
* 아이디 찾기 확인
*********************************************************************/
function JSIdFindAction2()
{
	theForm = document.MainForm;
	if(theForm.level[0].checked==false && theForm.level[1].checked==false) { 
			alert("회원 구분을 선택해 주세요"); 
			theForm.level[0].focus();
			return false;
	}

	if (!inputCheck("MainForm", "email1", "이메일", "", "", "", "", "")) { return false; }
	if (!inputCheck("MainForm", "email2", "이메일", "", "", "", "", "")) { return false; }	
	if (is_Email(theForm.email1.value+"@"+theForm.email2.value) == false) { alert("이메일을 올바로 입력하십시오"); theForm.email1.focus(); return false;}
}




/*********************************************************************
*아이디 찾기 확인
*********************************************************************/
function JSIdFindAction()
{
	theForm = document.MainForm;
	if(theForm.level[0].checked==false && theForm.level[1].checked==false) { 
			alert("회원 구분을 선택해 주세요"); 
			theForm.level[0].focus();
			return false;
	}

	if(theForm.level[0].checked==true) { 
		if (!inputCheck("MainForm", "name", "이름", "", "", "", "", "")) { return false; }
		if(!CheckHangul(theForm.name))
		{
			return false;
		}
		if (!inputCheck("MainForm", "jumin1", "주민등록번호", "", "", "", "", "")) { return false; }
		if (!inputCheck("MainForm", "jumin2", "주민등록번호", "", "", "", "", "")) { return false; }
		if(!CheckResidentID("MainForm","jumin1","jumin2"))
		{
			return false;
		}
	} else if(theForm.level[1].checked==true){
		if (!inputCheck("MainForm", "name2", "이름", "", "", "", "", "")) { return false; }
		if (!inputCheck("MainForm", "email1", "이메일", "", "", "", "", "")) { return false; }
		if (!inputCheck("MainForm", "email2", "이메일", "", "", "", "", "")) { return false; }	
		if (is_Email(theForm.email1.value+"@"+theForm.email2.value) == false) { alert("이메일을 올바로 입력하십시오"); theForm.email1.focus(); return false;}

	
	}
	document.MainForm.submit();
}


/*********************************************************************
* 비밀번호 찾기 확인
*********************************************************************/
function JSPwFindAction()
{
	theForm = document.MainForm;
	if(theForm.level[0].checked==false && theForm.level[1].checked==false) { 
			alert("회원 구분을 선택해 주세요"); 
			theForm.level[0].focus();
			return false;
	}
	
	if (!inputCheck("MainForm", "user_id", "회원아이디", "", "", "", "", "")) { return false; }
	//if(!TypeCheck(theForm.user_id.value, ALPHA+NUM)){ alert('회원아이디는 영문,숫자만 입력가능합니다.'); theForm.user_id.value="";return false;} by kkwon 2009.08.20
	//if(!CheckLen1(theForm.user_id,4,15)){alert('회원아이디는 6자이상 15자이하이야 합니다.'); theForm.user_id.value="";return false;}
	if (!inputCheck("MainForm", "email1", "이메일", "", "", "", "", "")) { return false; }
	if (!inputCheck("MainForm", "email2", "이메일", "", "", "", "", "")) { return false; }	
	if (is_Email(theForm.email1.value+"@"+theForm.email2.value) == false) { alert("이메일을 올바로 입력하십시오"); theForm.email1.focus(); return false;}
}




/*********************************************************************
* 마이페이지 캐시내역 조회
*********************************************************************/

var Stemp=1;

    function SChangeLayer(n) {
    var sLIobj = document.getElementById("cashSearch").getElementsByTagName("div");
    for(var i = 1; i <= sLIobj.length ; i++) {
      simg = document.getElementById('view'+i);     
    }
  }

  function SClickLayer(n){
  var sLIobj = document.getElementById("cashSearch").getElementsByTagName("div");
    for(var i = 1; i <= sLIobj.length ; i++) {
      sobj = document.getElementById('date'+i);
      if ( n == i ) {
        Stemp = n;
        sobj.style.display = "none";      
      } else {
        sobj.style.display = "block";
      }
    }
  }
  

