<!--
// 회원가입 로그인 등
register = function(){
	this.docXML;				// XML데이터 return 값
	this.callback = null;		// XML결과 return함수
	this.httpRequest = null;	// httpRequest객체
	this.form = document.registerForm;	// 가입폼

	// httpRequest 객체 생성 함수
	register.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 함수
	register.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 함수
	register.prototype.onStateChange = function() {
		this.callback(this.httpRequest);
	}	// end onStateChange end


	// 아이디 중복 체크
	register.prototype.idCheck = function() {
		params  = "id="+encodeURIComponent(this.form.id.value);
		params += "&code="+encodeURIComponent("idCheck");

		this.sendRequest("/core/xml/register.xml.html", params, this.idResult, "POST");
	}	// end idCheck end


	// 아이디 체크 결과
	register.prototype.idResult = function() {
		if(this.httpRequest.readyState == 4){
			if(this.httpRequest.status == 200){

				this.docXML = this.httpRequest.responseXML;
				code = this.docXML.getElementsByTagName("code").item(0).firstChild.nodeValue;	// 결과코드
				message = this.docXML.getElementsByTagName("message").item(0).firstChild.nodeValue;	// 리턴메시지

				// 결과 실행
				switch (code){
					case 'ErrorMsg':						
						alert(message);
						this.form.id.value = "";
						this.form.id_check.value = "N";	
						this.form.id.focus();
						break;

					case 'sendID':
						alert(message);
						this.form.id_check.value = "Y";	
						this.form.password.focus();
						break;

					default:
						alert("결과코드 없음");
						break;
				}
			}
		}
	}	// end idResult end

	
	// 이메일 도메인 선택시 직접, 또는 선택 입력 체크
	register.prototype.emailDomainSelect = function() {
		if(this.form.emailSel.value == "input"){
			this.form.emailList.disabled = false;
			this.form.emailList.value = "";
			this.form.emailList.focus();
		}else{
			this.form.emailList.disabled = true;
			this.form.emailList.value = this.form.emailSel.value;
		}
	}	// end emailDomainSelect function


	// 정상 주민등록번호 유무 체크
	register.prototype.juminCheck = function(it) {
		IDtot = 0;
		IDAdd="234567892345";

		if(it=="2011051644181"){
		}else{

			for(i=0;i<12;i++){
				IDtot=IDtot+parseInt(it.substring(i,i+1))*parseInt(IDAdd.substring(i,i+1));
			}
			IDtot=11-(IDtot%11);
			if(IDtot==10){
				IDtot=0;
			}
			else if(IDtot==11){
				IDtot=1;
			}
			if(parseInt(it.substring(12,13))!=IDtot)
			return true;
		}
	}	// end juminCheck function


	// 아이디찾기 체크
	register.prototype.idSearchCheck = function() {
		var idno = this.form.idno1.value + this.form.idno2.value;

		if(trim(this.form.name.value) == ""){
			alert("이름을 입력하세요");
			this.form.name.focus();
			return false;
		}

		if(this.juminCheck(idno)){
			window.alert("\n잘못된 주민등록번호 입니다. 다시 입력하세요");
			this.form.idno1.value="";
			this.form.idno2.value="";
			this.form.idno1.focus();
			return false;
		}

		this.form.action = "../member/id_search_check.php";

		return true;
	}	// end idSearchCheck function


	// 비밀번호찾기 체크
	register.prototype.pwSearchCheck = function() {
		var idno = this.form.idno1.value + this.form.idno2.value;

		if(trim(this.form.id.value) == ""){
			alert("아이디를 입력하세요");
			this.form.id.focus();
			return false;
		}


		

		if(trim(this.form.name.value) == ""){
			alert("이름을 입력하세요");
			this.form.name.focus();
			return false;
		}

		if(this.juminCheck(idno)){
			window.alert("\n잘못된 주민등록번호 입니다. 다시 입력하세요");
			this.form.idno1.value="";
			this.form.idno2.value="";
			this.form.idno1.focus();
			return false;
		}

		// 이메일 체크
		if(!emailCheck(this.form.email.value)){
			alert("\n잘못된 이메일 주소입니다.");
			this.form.email.focus();
			return false;
		}

		this.form.action = "../member/pw_search_check.php";

		return true;
	}	// end pwSearchCheck function


	// 회원가입여부체크
	register.prototype.overlapCheck = function() {
		var idno = this.form.idno1.value + this.form.idno2.value;

		

		if(trim(this.form.name.value) == ""){
			alert("이름을 입력하세요");
			this.form.name.focus();
			return false;
		}

		if(this.juminCheck(idno)){
			window.alert("\n잘못된 주민등록번호 입니다. 다시 입력하세요");
			this.form.idno1.value="";
			this.form.idno2.value="";
			this.form.idno1.focus();
			return false;
		}

		this.form.action = "../member/register_check.php";

		return true;
	}	// end overlapCheck function


	// 약관동의 체크
	register.prototype.agreeCheck = function() {
		if(this.form.agree1.checked == false){
			alert("회원가입 약관에 동의 하셔야 회원 가입이 가능합니다.");
			this.form.agree1.focus();
			return false;
		}
		if(this.form.agree2.checked == false){
			alert("개인정보보호정책에 동의 하셔야 회원 가입이 가능합니다.");
			this.form.agree2.focus();
			return false;
		}
		this.form.action = "../member/register_overlap.html";

		return true;
	}	// end agreeCheck function


	// 우편번호 찾기
	register.prototype.zipCode = function(postType) {
		window.open('../member/post_search.html?postType='+postType,'','width=620, height=300, toolbar=no, resizeable=no, scrolling=no, scrollbars=no, top=200, left=200');
	}	// end zipCode function	


	// 그룹변경
	register.prototype.groupChange = function(obj) {
		if(obj.value == "1" || obj.value == "2" || obj.value == "10"){
			document.getElementById("companyInfo").style.display = "block";
		}else{
			document.getElementById("companyInfo").style.display = "none";
		}
	}	// end groupChange function	


	// 가입주소 동일 체크
	register.prototype.sameAddr = function(obj) {
		if(obj.checked == true){
			this.form.comPostno1.value = this.form.postno1.value;
			this.form.comPostno2.value = this.form.postno2.value;
			this.form.comAddr1.value = this.form.addr1.value;
			this.form.comAddr2.value = this.form.addr2.value;
		}else{
			this.form.comPostno1.value = "";
			this.form.comPostno2.value = "";
			this.form.comAddr1.value = "";
			this.form.comAddr2.value = "";
		}
	}	// end sameAddr function	


	// 일반회원가입 체크
	register.prototype.valueCheck = function(){
		var idno = this.form.idno1.value + this.form.idno2.value;
		var email = this.form.emailHead.value + "@" + this.form.emailList.value;
		this.form.emailFoot.value = this.form.emailList.value;

		// 아이디 체크
		if(this.form.id_check.value != 'Y'){
			alert("\n아이디 중복체크를 하세요");
			this.form.id.focus();
			return false;
		}

		// 비밀번호
		if(this.form.password.value.length < 4 || this.form.password.value.length > 12){
			alert("\n패스워드는 최소 4자 이상이고 12자 이하입니다.");
			this.form.password.focus();
			return false;
		}
		if(this.form.password.value != this.form.password2.value){
			alert("\n비밀번호 재입력이 틀립니다.");
			this.form.password.focus();
			return false;
		}

		// 이름
		if(trim(this.form.name.value) == ""){
			alert("\n이름을 입력하세요");
			document.location.href="/";
			return false;	
		}

		// 주민등록번호
		if(this.juminCheck(idno)){
			alert("\n잘못된 주민등록번호 입니다.");
			document.location.href="/";
			return false;
		}

		// 이메일 체크
		if(this.form.emailHead.value == ""){
			alert("\n이메일을 입력하세요.");
			this.form.emailHead.focus();
			return false;
		}

		// 이메일 체크
		if(!emailCheck(email)){
			alert("\n잘못된 이메일 주소입니다.");
			this.form.emailHead.focus();
			return false;
		}

		// 주소체크
		if(this.form.addr1.value == ""){
			alert("\n주소찾기를 클릭하여 주소를 입력하세요.");
			return false;
		}
		if(trim(this.form.addr2.value) == ""){
			alert("\n나머지 주소를 입력하세요.");
			this.form.addr2.focus();
			return false;
		}

		// 휴대전화 체크
		if(this.form.hphone1.value.length < 2 || this.form.hphone2.value.length < 3 || this.form.hphone3.value.length != 4){
			alert("\휴대전화 번호를 입력하세요");
			this.form.hphone1.focus();	
			return false;
		}

		// 연락처 체크
		if(this.form.phone1.value.length < 2 || this.form.phone2.value.length < 3 || this.form.phone3.value.length != 4){
			alert("\연락처를 입력하세요");
			this.form.phone1.focus();	
			return false;
		}

		// 직업 체크
		if(this.form.groupCode.value == "Null"){
			alert("\n직업을 선택하세요.");
			this.form.groupCode.focus();
			return false;
		}

		// 학원장 선택시 세부사항 등록
		if(this.form.groupCode.value == "1" || this.form.groupCode.value == "2"){

			// 학원명 체크
			if(trim(this.form.comName.value) == ""){
				alert("\n학원/업체명을 입력하세요.");
				this.form.comName.focus();
				return false;
			}

			// 사업자번호 체크
			if(this.form.comNumber1.value.length < 3 || this.form.comNumber2.value.length < 2 || this.form.comNumber3.value.length != 5){
				alert("\사업자번호를 입력하세요");
				this.form.comNumber1.focus();	
				return false;
			}
			
			// 대표자명을 입력하세요
			if(trim(this.form.comCeo.value) == ""){
				alert("\n대표자명을 입력하세요.");
				this.form.comCeo.focus();
				return false;
			}

			// 주소체크
			if(this.form.comAddr1.value == ""){
				alert("\n주소찾기를 클릭하여 주소를 입력하세요.");
				return false;
			}
			if(trim(this.form.comAddr2.value) == ""){
				alert("\n나머지 주소를 입력하세요.");
				this.form.comAddr2.focus();
				return false;
			}

			// 업태 체크
			if(trim(this.form.comType1.value) == ""){
				alert("\n업태를 입력하세요.");
				this.form.comType1.focus();
				return false;
			}

			// 종목 체크
			if(trim(this.form.comType2.value) == ""){
				alert("\n종목을 입력하세요.");
				this.form.comType2.focus();
				return false;
			}
		}

		this.form.action = "../member/register_ok.php";
		this.form.submit();

	}	// end valueCheck function


	// 회원정보 수정 체크
	register.prototype.modifyCheck = function(){
		var email = this.form.emailHead.value + "@" + this.form.emailList.value;
		this.form.emailFoot.value = this.form.emailList.value;

		

		// 비밀번호
		if(this.form.password.value.length){
			if(this.form.password.value.length < 4 || this.form.password.value.length > 12){
				alert("\n비밀번호는 최소 4자 이상이고 12자 이하입니다.\n\n비밀번호를 변경하지 않을경우 입력하지 마세요");
				this.form.password.focus();
				return false;
			}
			if(this.form.password.value != this.form.password2.value){
				alert("\n비밀번호 재입력이 틀립니다.");
				this.form.password.focus();
				return false;
			}
		}
		

		// 이메일 체크
		if(this.form.emailHead.value == ""){
			alert("\n이메일을 입력하세요.");
			this.form.emailHead.focus();
			return false;
		}

		// 이메일 체크
		if(!emailCheck(email)){
			alert("\n잘못된 이메일 주소입니다.");
			this.form.emailHead.focus();
			return false;
		}

		// 주소체크
		if(this.form.addr1.value == ""){
			alert("\n주소찾기를 클릭하여 주소를 입력하세요.");
			return false;
		}
		if(trim(this.form.addr2.value) == ""){
			alert("\n나머지 주소를 입력하세요.");
			this.form.addr2.focus();
			return false;
		}

		// 휴대전화 체크
		if(this.form.hphone1.value.length < 2 || this.form.hphone2.value.length < 3 || this.form.hphone3.value.length != 4){
			alert("\휴대전화 번호를 입력하세요");
			this.form.hphone1.focus();	
			return false;
		}

		// 연락처 체크
		if(this.form.phone1.value.length < 2 || this.form.phone2.value.length < 3 || this.form.phone3.value.length != 4){
			alert("\연락처를 입력하세요");
			this.form.phone1.focus();	
			return false;
		}

		// 직업 체크
		if(this.form.groupCode.value == "Null"){
			alert("\n직업을 선택하세요.");
			this.form.groupCode.focus();
			return false;
		}

		// 학원장 선택시 세부사항 등록
		if(this.form.groupCode.value == "1" || this.form.groupCode.value == "2"){

			// 학원명 체크
			if(trim(this.form.comName.value) == ""){
				alert("\n학원/업체명을 입력하세요.");
				this.form.comName.focus();
				return false;
			}

			// 사업자번호 체크
			if(this.form.comNumber1.value.length < 3 || this.form.comNumber2.value.length < 2 || this.form.comNumber3.value.length != 5){
				alert("\사업자번호를 입력하세요");
				this.form.comNumber1.focus();	
				return false;
			}
			
			// 대표자명을 입력하세요
			if(trim(this.form.comCeo.value) == ""){
				alert("\n대표자명을 입력하세요.");
				this.form.comCeo.focus();
				return false;
			}

			// 주소체크
			if(this.form.comAddr1.value == ""){
				alert("\n주소찾기를 클릭하여 주소를 입력하세요.");
				return false;
			}
			if(trim(this.form.comAddr2.value) == ""){
				alert("\n나머지 주소를 입력하세요.");
				this.form.comAddr2.focus();
				return false;
			}

			// 업태 체크
			if(trim(this.form.comType1.value) == ""){
				alert("\n업태를 입력하세요.");
				this.form.comType1.focus();
				return false;
			}

			// 종목 체크
			if(trim(this.form.comType2.value) == ""){
				alert("\n종목을 입력하세요.");
				this.form.comType2.focus();
				return false;
			}
		}

		this.form.action = "../mypage/mypage9_ok.php";
		this.form.submit();

	}	// end valueCheck function


	// 세금계산서 관련
	register.prototype.taxCheck = function(){
		

		// 학원명 체크
		if(trim(this.form.comName.value) == ""){
			alert("\n회사명을 입력하세요.");
			this.form.comName.focus();
			return false;
		}

		// 사업자번호 체크
		if(this.form.comNumber1.value.length < 3 || this.form.comNumber2.value.length < 2 || this.form.comNumber3.value.length != 5){
			alert("\사업자번호를 입력하세요");
			this.form.comNumber1.focus();	
			return false;
		}
		
		// 대표자명을 입력하세요
		if(trim(this.form.comCeo.value) == ""){
			alert("\n대표자명을 입력하세요.");
			this.form.comCeo.focus();
			return false;
		}

		// 주소체크
		if(this.form.comAddr1.value == ""){
			alert("\n주소찾기를 클릭하여 주소를 입력하세요.");
			return false;
		}
		if(trim(this.form.comAddr2.value) == ""){
			alert("\n나머지 주소를 입력하세요.");
			this.form.comAddr2.focus();
			return false;
		}

		// 업태 체크
		if(trim(this.form.comType1.value) == ""){
			alert("\n업태를 입력하세요.");
			this.form.comType1.focus();
			return false;
		}

		// 종목 체크
		if(trim(this.form.comType2.value) == ""){
			alert("\n종목을 입력하세요.");
			this.form.comType2.focus();
			return false;
		}

		this.form.action = "../mypage/popup_account_ok.php";
		this.form.submit();

	}	// end taxCheck function

}	//	end register Class

register = new register();

//-->
