<?
//회원약관 동의를 하지 않았으면 약관동의 페이지로 이동시킴
if($_POST[chkAgree]!="Y"){
	echo "<script>
	document.location.href = '/member.php?goPage=Agree';
	</script>";
}
//회원약관 동의를 하지 않았으면 약관동의 페이지로 이동시킴
if($_POST[chkAgree2]!="Y"){
	echo "<script>
	document.location.href = '/member.php?goPage=Agree';
	</script>";
}
?>
<script>
jQuery(function($) {
	//아이디 중복체크
	$(".idchecker").click(function() {

		if ($.trim($("input[name=user_id]").val()) == "") {
			alert("아이디를 입력해주십시오");
			$("input[name=user_id]").val("").focus();
			return false;
		}

		var strReg = /^[A-Za-z0-9]+$/;

		if (!strReg.test($("input[name=user_id]").val().replace(/ /g, '')) ) {
			alert("영문,숫자만 등록하세요.");
			$("input[name=user_id]").focus();
			return false;
		}

		var uid = $("input[name=user_id]").val().replace(/ /g, '');
		$.ajax({
			type:"POST",
			url:"/module/member/ajax_check_id.php",
			data:"user_id="+uid,
			datatype:"json",
			success: function(msg){
				//data = JSON.parse(msg);
				if (!$("#debug").length) $("body").prepend("<div id='debug'></div>");
				//$("#debug").html(msg);
				if (msg == "1") {
					alert("사용할 수 없는 아이디입니다");
					$("input[name=user_id]").val("");
					$("input[name=dupcheck]").val("");
				} else if (msg == "0") {
					alert("사용가능한 아이디입니다");
					$("input[name=user_id]").val(uid);
					$("input[name=dupcheck]").val(uid);
				} else {
					alert("알수없는 에러입니다\n다시시도 해주십시오");
				}
			},
			error:function(msg){
				alert("error");
			}
		});
	});

	$(".findzip").click(function() {
		var form = $(this).closest("form");
		var zip1 = form.find(".zip1").attr("name");
		var zip2 = form.find(".zip2").attr("name");
		var addr = form.find(".address").attr("name");
		var addr2 = form.find(".address_ext").attr("name");
		window.open("/module/zipcode/zipcode3.php?frm="+form.attr("name")+"&zip1="+zip1+"&zip2="+zip2+"&addr="+addr+"&addr2="+addr2,"주소찾기","width=463, height=600, scrollbars=1");
	});

	$("form[name=memberForm]").submit(function() {
		var returnval = true;
		$(".required").each(function() {
			if ($.trim($(this).val()) == "") {
				alert($(this).attr("title")+" 입력은 필수입니다");
				$(this)
				.removeAttr('checked')
				.removeAttr('selected')
				.not(':button, :submit, :reset, :hidden, :radio, :checkbox')
				.val('')
				.focus();
				returnval = false;
				return false;
			}
		});
		if (returnval == false) {
			return false;
		}

		if ($(".lengthcheck").length) {
			if ($(this).val().length < $(this).attr("minlength") || $(this).val().length > $(this).attr("maxlength")) {
				alert($(this).attr("title") + " 길이를 "+$(this).attr("minlength")+"~"+$(this).attr("maxlength")+" 사이로 입력해주십시오");
				$(this).focus();
				return false;
			}
		}

		if ($("input[name=dupcheck]").val() == "") {
			alert("아이디 중복체크는 필수 입니다");
			$(".idchecker").focus();
			return false;
		}

		if ($("input[name=user_pw]").val() != $("input[name=user_pw2]").val()) {
			alert("비밀번호가 일치하지 않습니다");
			//$("input[name=user_pw]").val("");
			//$("input[name=user_pw2]").val("");
			$("input[name=user_pw2]").focus();
			return false;
		}
		if ($("input[name=user_id]").val() == $("input[name=user_pw]").val()) {
			alert("아이디와 비밀번호가 동일합니다");
			$("input[name=user_pw]").val("");
			$("input[name=user_pw]").focus();
			return false;
		}
	});
});

function setEmailDom(frm,val){
	frm.email_domain.value = val;
	if(val==""){
		frm.email_domain.focus();
	}
}
</script>

		<div class="sub-title">			
			<h2>회원가입</h2>
			<div class="path">HOME &gt; 회원전용 &gt; <strong>회원가입</strong></div>
		</div>
		<div class="real-cont">				
				
			<form name="memberForm" method="post" action="/module/member/member_evn.php" onsubmit="return checkForm(this)">
			<input type="hidden" name="evnMode" value="join">
			<input type="hidden" id="dupcheck" name="dupcheck">
			
			<div class="join-area">
				<h3>기본정보입력</h3>
				<p>허위로 작성된 가입정보일 경우 임의로 삭제처리될 수 있으니 주의해 주세요.</p>
				<div class="form">
					<table summary="개인회원 회원정보를 입력 하세요 " >
						<caption>회원정보입력 개인회원</caption>
						<colgroup>
							<col width="140" />
							<col width="*" />
						</colgroup>
						<tbody>
							<tr>
								<th scope="row"><label for="user_id">아이디</label></th>
								<td>
									<input id="user_id" name="user_id" class="input required" title="아이디" type="text" value="" style="width:200px;" title="아이디">
									<a href="javascript:check_id(document.memberForm.user_id.value);" class="btn-pack medium idchecker" title="중복확인 - 새창열림">중복확인</a>
								</td>
							</tr>								
							<tr>
								<th><label for="pwd">비밀번호</label></th>
								<td>
									<input id="pwd" name="user_pw" class="input required" title="비밀번호" type="password" value="" style="width:200px;" maxlength="16" />
									&nbsp;&nbsp;<span class="txt">영문, 숫자포함 6~15자이상 입력하세요.</span>
								</td>
							</tr>
							<tr>
								<th><label for="pwdConfirm">비밀번호 확인</label></th>
								<td><input type="password" id="user_pw2" name="user_pw2" class="input required" title="비밀번호확인" style="width:200px;" maxlength="16" /></td>
							</tr>
							<tr>
								<th><label for="user_name">이름</label></th>
								<td><input id="user_name" name="user_name" class="input required" title="이름" type="text" value="" style="width:150px;" title="이름"/></td>
							</tr>	
							<tr>
								<th><label for="sexMale">성별</label></th>
								<td>
									<input type="radio" id="sexMale" name="sex" value="M" checked /><label for="sexMale">남자</label> &nbsp;&nbsp;
									<input type="radio" id="sexFemale" name="sex" value="F" /><label for="sexFemale">여자</label>
								</td>
							</tr>
							<tr>
								<th><label for="birthYear">생년월일</label></th>
								<td>
									<input id="birthYear" name="byear" class="input" title="생년" type="text" value="" style="width:80px;" />년
									<input id="birthMonth" name="bmonth" class="input" title="월" type="text" value="" style="width:40px;" />월
									<input id="birthDay" name="bday" class="input" title="일" type="text" value="" style="width:40px;" />일
								</td>
								<!--
								<td><select name="byear">
									<option value="">=선택=</option>
									<? for($i=1930;$i<date("Y")-12;$i++) {?>
									<option value="<?=$i?>" <?=substr($_POST[birthdate],0,4)==$i?"selected":""?>><?=$i?></option>
									<?}?>
								</select>년
								<select name="bmonth">
									<option value="">=선택=</option>
									<? for($i=1;$i<13;$i++) {
											if($i<10) $i = "0".$i;
									?>
									<option value="<?=$i?>" <?=substr($_POST[birthdate],4,2)==$i?"selected":""?>><?=$i?></option>
									<?}?>
								</select>월
								<select name="bday">
									<option value="">=선택=</option>
									<? for($i=1;$i<32;$i++) {
											if($i<10) $i = "0".$i;
									?>
									<option value="<?=$i?>" <?=substr($_POST[birthdate],6,2)==$i?"selected":""?>><?=$i?></option>
									<?}?>
								</select>일
                                <!--<input type="radio" id="" name="solar" value="S" checked />양력 &nbsp;&nbsp;<input type="radio" id="" name="solar" value="L" />음력</td>-->
							</tr>
							<tr>
								<th><label for="mem_zipcode1">주소</label></th>
								<td>
									<div class="mgb5">
									<input type="text" id="postcode" name="zip" placeholder="우편번호" class="input required" style="width:100px;" maxlength="5" readonly title="우편번호">
									<a href="javascript:execDaumPostcode();" class="btn-pack medium" title="우편번호검색 - 새창열림">우편번호검색</a>
									</div>
									<div class="mgb5">
									<input type="text" name="address" id="address" placeholder="주소" class="input required" style="width:98%;" title="주소"><br />
									</div>
									<div>
									<input type="text" name="address_ext" id="address2" placeholder="상세주소" class="input required" style="width:98%;" title="상세주소">
									</div>
								</td>
							</tr>
							<tr>
								<th><label for="tel1">전화번호</label></th>
								<td>
								<input id="tel1" name="phone_1" type="text" title="전화번호 국번" maxlength="4" class="input" style="width:50px;"/> 
								 - <input id="tel2" name="phone_2" type="text" title="전화번호 앞자리" maxlength="4" class="input" style="width:50px;"/>  
								 - <input id="tel3" name="phone_3"  type="text" title="전화번호 뒷자리" maxlength="4" class="input" style="width:50px;"/>
								</td>
							</tr>
							<tr>
								<th><label for="phone1">휴대폰번호</label></th>
								<td>
								<input id="phone1" name="mobile_1" type="text" title="전화번호 국번" maxlength="4" class="input required" style="width:50px;"/> 
								 - <input id="phone2" name="mobile_2" type="text" title="전화번호 앞자리" maxlength="4" class="input required" style="width:50px;"/>  
								 - <input id="phone3" name="mobile_3"  type="text" title="전화번호 뒷자리" maxlength="4" class="input required" style="width:50px;"/>
								</td>
							</tr>
							<tr>
								<th><label for="email_id">E-mail</label></th>
								<td><input id="email_id" name="email_id" class="input required" title="전자메일아이디" type="text" value="" style="width:150px;" /> @ <input id="email_domain" name="email_domain" class="input required" title="전자메일계정" type="text" value="" style="width:150px;" />
								<select name="email_list" id="email_list" onChange="setEmailDom(this.form, this.value);" class="select" style="width:150px;">
									<option value="">직접입력</option>
									<option value="naver.com">naver.com</option>
									<option value="chol.com">chol.com</option>
									<option value="dreamwiz.com">dreamwiz.com</option>
									<option value="empal.com">empal.com</option>
									<option value="freechal.com">freechal.com</option>
									<option value="gmail.com">gmail.com</option>
									<option value="hanafos.com">hanafos.com</option>
									<option value="hanmail.net">hanmail.net</option>
									<option value="hanmir.com">hanmir.com</option>
									<option value="hitel.net">hitel.net</option>
									<option value="hotmail.com">hotmail.com</option>
									<option value="korea.com">korea.com</option>
									<option value="lycos.co.kr">lycos.co.kr</option>
									<option value="nate.com">nate.com</option>
									<option value="netian.com">netian.com</option>
									<option value="paran.com">paran.com</option>
									<option value="yahoo.com">yahoo.com</option>
									<option value="yahoo.co.kr">yahoo.co.kr</option>
								</select></td>
							</tr>
							<tr>
								<th><label for="emailYes">메일수신여부</label></th>
								<td>
									<input type="radio" id="emailYes" name="email_accept"  value="Y" checked="checked" /><label for="emailYes">메일수신을 받습니다.</label>&nbsp;&nbsp;
									<input type="radio" id="emailNo" name="email_accept" value="N" /><label for="emailNo">메일수신을 받지않습니다.</label>
								</td>
							</tr>							
						</tbody>
					</table>
				</div>
			</div>
			<div class="buttons">
				<div class="cen">
					<input type="submit" value="회원가입" class="btn-pack xlarge focus">
					<button href="javascript:history.back();" class="btn-pack xlarge">취소</button>
				</div>
			</div>
			<!-- <div class="btn_area">
				<input type="image" src="/images/member/btn_confirm.gif" alt="확인" />
				<a href="/"><img src="/images/member/btn_cancel.gif" alt="취소" /></a>
			</div> -->
			</form>

		</div>

