<?php

	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
	include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';

	$mp = "22";	//set top nav

?>
<? include("../inc/inc_top.php") ?>
<? include("../inc/inc_header.php") ?>

<?
	$cd_user = $_REQUEST["cd_user"];

	$sql ="SELECT
				*
				FROM sa_master
				WHERE cd_user='$cd_user' AND ds_delind='N'";

	$mode = "Add";

	$col=mysql_fetch_array(mysql_query($sql));
	if (!empty($col['cd_user'])){
		$cd_user = $col['cd_user'];
		$cd_userid = $col['cd_userid'];
		$nm_email = $col['nm_email'];
		$nm_pass = $col['nm_pass'];
		$nm_join = $col['nm_join'];
		$ds_type = $col['ds_type'];
		$ds_level = $col['ds_level'];
		$nm_birth = $col['nm_birth'];
		$nm_name = $col['nm_name'];
		$nm_company = $col['nm_company'];
		$nm_hp = $col['nm_hp'];
		$nm_hp_01 = $col['nm_hp_01'];
		$nm_hp_02 = $col['nm_hp_02'];
		$nm_hp_03 = $col['nm_hp_03'];
		$nm_tel = $col['nm_tel'];
		$nm_tel_01 = $col['nm_tel_01'];
		$nm_tel_02 = $col['nm_tel_02'];
		$nm_tel_03 = $col['nm_tel_03'];
		$nm_fax = $col['nm_fax'];
		$nm_fax_01 = $col['nm_fax_01'];
		$nm_fax_02 = $col['nm_fax_02'];
		$nm_fax_03 = $col['nm_fax_03'];
		$nm_zip = $col['nm_zip'];
		$nm_addr = $col['nm_addr'];
		$nm_addr_sub = $col['nm_addr_sub'];
		$ds_company_bp = $col['ds_company_bp'];
		$ds_branch = $col['ds_branch'];
		$ds_area = $col['ds_area'];
		$ds_area_sub = $col['ds_area_sub'];
		$nm_etc_01 = $col['nm_etc_01'];
		$nm_etc_02 = $col['nm_etc_02'];
		$nm_etc_03 = $col['nm_etc_03'];
		$nm_etc_04 = $col['nm_etc_04'];
		$nm_etc_05 = $col['nm_etc_05'];
		$ds_agree1 = $col['ds_agree1'];
		$ds_agree2 = $col['ds_agree2'];
		$ds_agree3 = $col['ds_agree3'];
		$ds_agree4 = $col['ds_agree4'];
		$ds_agree5 = $col['ds_agree5'];
		$ds_status = $col['ds_status'];
		$ds_status_agree = $col['ds_status_agree'];
		$dt_insert = $col['dt_insert'];
		$nm_insert = $col['nm_insert'];
		$dt_update = $col['dt_update'];
		$nm_update = $col['nm_update'];
		$dt_delind = $col['dt_delind'];
		$nm_delind = $col['nm_delind'];
		$ds_delind = $col['ds_delind'];
/*
		$arr_nm_info1 = explode("-",$nm_info1);
		if(count($arr_nm_info1) == 3){
			$nm_info11 = $arr_nm_info1[0];
			$nm_info12 = $arr_nm_info1[1];
			$nm_info13 = $arr_nm_info1[2];
		}else{
			$nm_info11 = "";
			$nm_info12 = "";
			$nm_info13 = "";
		}

		$arr_nm_info3 = explode("@",$nm_info3);
		if(count($arr_nm_info3) == 2){
			$nm_info31 = $arr_nm_info3[0];
			$nm_info32 = $arr_nm_info3[1];
		}else{
			$nm_info31 = "";
			$nm_info32 = "";
		}
		$nm_info3 = $col[nm_info3];
*/
		$mode = "Update";


		list($nm_hp1, $nm_hp2, $nm_hp3) = explode("-", $col['nm_hp']);
		list($nm_email1, $nm_email2) = explode("@", $col['nm_email']);
	}else{
		$ds_level = "1";
	}

	$totalrows = @mysql_result(mysql_query("select count(*) from admin_info WHERE ds_delind='N'"),0,0);
?>

<section id="contents">
	<h2>SA회원 관리</h2>

<? include("../inc/inc_header_sa.php") ?>

<?
// 	$cd_user = $_REQUEST["cd_user"];
//
// 	$sql ="SELECT
// 				*
// 				FROM member_master
// 				WHERE cd_user='$cd_user' AND ds_delind='N'";
//
// 	$mode = "Add";
//
// 	$col=mysql_fetch_array(mysql_query($sql));
// 	if (!empty($col[cd_user])){
// 		$cd_user = $col[cd_user];
// 		$cd_userid = $col[cd_userid];
// 		$nm_email = $col[nm_email];
// 		$nm_pass = $col[nm_pass];
// 		$nm_join = $col[nm_join];
// 		$ds_type = $col[ds_type];
// 		$ds_level = $col[ds_level];
// 		$nm_birth = $col[nm_birth];
// 		$nm_name = $col[nm_name];
// 		$nm_company = $col[nm_company];
// 		$nm_hp = $col[nm_hp];
// 		$nm_hp_01 = $col[nm_hp_01];
// 		$nm_hp_02 = $col[nm_hp_02];
// 		$nm_hp_03 = $col[nm_hp_03];
// 		$nm_tel = $col[nm_tel];
// 		$nm_tel_01 = $col[nm_tel_01];
// 		$nm_tel_02 = $col[nm_tel_02];
// 		$nm_tel_03 = $col[nm_tel_03];
// 		$nm_fax = $col[nm_fax];
// 		$nm_fax_01 = $col[nm_fax_01];
// 		$nm_fax_02 = $col[nm_fax_02];
// 		$nm_fax_03 = $col[nm_fax_03];
// 		$nm_zip = $col[nm_zip];
// 		$nm_addr = $col[nm_addr];
// 		$nm_addr_sub = $col[nm_addr_sub];
// 		$ds_company_bp = $col[ds_company_bp];
// 		$ds_branch = $col[ds_branch];
// 		$ds_area = $col[ds_area];
// 		$ds_area_sub = $col[ds_area_sub];
// 		$nm_etc_01 = $col[nm_etc_01];
// 		$nm_etc_02 = $col[nm_etc_02];
// 		$nm_etc_03 = $col[nm_etc_03];
// 		$nm_etc_04 = $col[nm_etc_04];
// 		$nm_etc_05 = $col[nm_etc_05];
// 		$ds_agree1 = $col[ds_agree1];
// 		$ds_agree2 = $col[ds_agree2];
// 		$ds_agree3 = $col[ds_agree3];
// 		$ds_agree4 = $col[ds_agree4];
// 		$ds_agree5 = $col[ds_agree5];
// 		$ds_status = $col[ds_status];
// 		$ds_status_agree = $col[ds_status_agree];
// 		$dt_insert = $col[dt_insert];
// 		$nm_insert = $col[nm_insert];
// 		$dt_update = $col[dt_update];
// 		$nm_update = $col[nm_update];
// 		$dt_delind = $col[dt_delind];
// 		$nm_delind = $col[nm_delind];
// 		$ds_delind = $col[ds_delind];
// /*
// 		$arr_nm_info1 = explode("-",$nm_info1);
// 		if(count($arr_nm_info1) == 3){
// 			$nm_info11 = $arr_nm_info1[0];
// 			$nm_info12 = $arr_nm_info1[1];
// 			$nm_info13 = $arr_nm_info1[2];
// 		}else{
// 			$nm_info11 = "";
// 			$nm_info12 = "";
// 			$nm_info13 = "";
// 		}
//
// 		$arr_nm_info3 = explode("@",$nm_info3);
// 		if(count($arr_nm_info3) == 2){
// 			$nm_info31 = $arr_nm_info3[0];
// 			$nm_info32 = $arr_nm_info3[1];
// 		}else{
// 			$nm_info31 = "";
// 			$nm_info32 = "";
// 		}
// 		$nm_info3 = $col[nm_info3];
// */
// 		$mode = "Update";
// 	}else{
// 		$ds_level = "1";
// 	}

?>

	<h3><em>▶</em> SA회원정보</h3>
	<div class="tbl_wrap">
	<form id="frmMember" name="frmMember" method="post" action="sa_proc.php" enctype="multipart/form-data">
	<input type="hidden" name="validate" id="validate" value=""/>
	<input type="hidden" name="ds_type" id="ds_type" value="A0"/>
	<input type="hidden" name="ds_level" id="ds_level" value="<?=$ds_level?>"/>
	<input type="hidden" name="cd_user" id="cd_user" value="<?=$cd_user?>"/>
	<input type="hidden" name="mode" id="mode" value="<?=$mode?>"/>
	<!--input type="hidden" name="PageNo" id="PageNo" value="<?=$PageNo?>"/-->
<? if ($mode == "Add"){ ?>
	<input type="hidden" name="idchkresult" id="idchkresult" value="N"/>
	<input type="hidden" name="ds_agree1" id="ds_agree1" value="Y"/>
	<input type="hidden" name="ds_agree2" id="ds_agree2" value="Y"/>
	<input type="hidden" name="ds_agree3" id="ds_agree3" value="Y"/>
	<input type="hidden" name="ds_agree4" id="ds_agree4" value="Y"/>
<? }else{ ?>
	<input type="hidden" name="idchkresult" id="idchkresult" value="Y"/>
<? } ?>
	<input type="hidden" name="nm_email" id="nm_email" value="<?=$nm_email?>"/>
	<input type="hidden" name="nm_hp" id="nm_hp" value="<?=$nm_hp?>"/>
		<table class="tbl_list2">
			<colgroup>
				<col width="13%">
				<col width="*">
			</colgroup>
		<? if ($mode == "Add"){ ?>
			<tr>
				<th>아이디</th>
				<td>
					<input type="text" class="inp_txt" style="width:330px;" name="nm_email1" id="nm_email1"> @
					<input type="text" class="inp_txt" style="margin-right:5px;width:25%;" name="nm_email2" id="nm_email2">
					<span class="select" style="width:200px;">
						<select name="nm_email3" id="nm_email3" onChange="sel_1(this.value)">
							<option value="" selected>직접입력</option>
							<option value="daum.net">daum.net</option>
							<option value="gmail.com">gmail.com</option>
							<option value="hanmail.net">hanmail.net</option>
							<option value="nate.com">nate.com</option>
							<option value="hotmail.com">hotmail.com</option>
							<option value="naver.com">naver.com</option>
							<option value="chollian.net">chollian.net</option>
							<option value="dreamwiz.com">dreamwiz.com</option>
							<option value="empal.com">empal.com</option>
							<option value="freechal.com">freechal.com</option>
							<option value="hanafos.com">hanafos.com</option>
							<option value="kebi.com">kebi.com</option>
							<option value="korea.com">korea.com</option>
							<option value="lycos.co.kr">lycos.co.kr</option>
							<option value="netian.com">netian.com</option>
							<option value="netsgo.com">netsgo.com</option>
							<option value="unitel.co.kr">unitel.co.kr</option>
							<option value="yahoo.co.kr">yahoo.co.kr</option>
						</select>
					</span>
					<input type="button" class="td_btn ty2" id="btn_idchk" title="아이디 확인" value="확인">
				</td>
			</tr>
			<tr>
				<th>비밀번호</th>
				<td><input type="password" class="inp_txt" style="width:330px;" name="nm_pass" id="nm_pass" maxlength="20"> <span class="td_txt">8자~15자 영문, 숫자, 특수문자 조합</span></td>
			</tr>
			<tr>
				<th>비밀번호 확인</th>
				<td><input type="password" class="inp_txt" style="width:330px;" name="nm_pass2" id="nm_pass2" maxlength="20"> <span class="td_txt">8자~15자 영문, 숫자, 특수문자 조합</span></td>
			</tr>
		<? }else{ ?>
			<tr>
				<th>아이디</th>
				<td>
					<?=$cd_userid?>
				</td>
			</tr>
			<tr>
				<th>변경 비밀번호</th>
				<td><input type="password" class="inp_txt" style="width:330px;" name="nm_pass" id="nm_pass" maxlength="20"> <span class="td_txt">8자~15자 영문, 숫자, 특수문자 조합</span></td>
			</tr>
			<!-- <tr>
				<th>비밀번호 확인</th>
				<td><input type="password" class="inp_txt" style="width:330px;" name="nm_pass2" id="nm_pass2" maxlength="20"> <span class="td_txt">8자~15자 영문, 숫자, 특수문자 조합</span></td>
			</tr> -->
		<? } ?>
			<tr>
				<th>이름</th>
				<td><input type="text" class="inp_txt" style="width:330px;" name="nm_name" id="nm_name" maxlength="20" value="<?=$nm_name?>"></td>
			</tr>
			<tr>
				<th>휴대번호</th>
				<td>
					<span class="select2" style="margin-right:5px;width:120px;" id="sel_nm_hp1">
						<select id='nm_hp1' name='nm_hp1'></select>
					</span>
					<input type="text" class="inp_txt" style="width:120px;" name="nm_hp2" id="nm_hp2" value="<?=$nm_hp2?>" maxlength="4"> -
					<input type="text" class="inp_txt" style="width:120px;" name="nm_hp3" id="nm_hp3" value="<?=$nm_hp3?>" maxlength="4">

					<!-- <input type="text" class="inp_txt" style="width:330px;" name="nm_hp" id="nm_hp" maxlength="20" value="<?=$nm_hp?>"> </td> -->
				</td>
			</tr>
			<tr>
				<th>이메일</th>
				<td>
					<input type="text" class="inp_txt" style="width:330px;" name="nm_email1" id="nm_email1" value="<?=$nm_email1?>"> @
					<input type="text" class="inp_txt" style="margin-right:5px;width:25%;" name="nm_email2" id="nm_email2" value="<?=$nm_email2?>">
					<span class="select" style="width:200px;">
						<select name="nm_email3" id="nm_email3" onChange="sel_1(this.value)"></select>
					</span>
				</td>
			</tr>

            <tr>
				<th>관계사</th>
				<td>
					<span class="select2" style="margin-right:5px;width:12%;">
						<select name="ds_company_bp" id="ds_company_bp" style="width:100px;" onchange="ds_company_bp_chg(this.value)"></select>
					</span>
				</td>
			</tr>
            <tr>
				<th>지점</th>
				<td>
					<span class="select2" style="margin-right:5px;width:12%;">
						<select name="ds_branch" id="ds_branch" style="width:100px;"></select>
					</span>
				</td>
			</tr>
            <!--tr>
				<th>관계사</th>
				<td>
					<span class="select2" style="margin-right:5px;width:12%;">
						<select name="ds_company_bp" id="ds_company_bp"<? if ($mode == "Update"){ ?> readonly<? } ?>></select>
					</span>
				</td>
			</tr>
            <tr>
				<th>지점</th>
				<td>
					<span class="select2" style="margin-right:5px;width:12%;">
						<select name="ds_branch" id="ds_branch"<? if ($mode == "Update"){ ?> readonly<? } ?>></select>
					</span>
				</td>
			</tr-->
			<tr>
				<th>승인상태</th>
				<td colspan="3">
					<div class="radio_chk">
						<span class="check_wrap"><input type="radio" name="ds_status" id="radio1" value="Z0"<?if($ds_status=="Z0"){?> checked="checked"<?}?>><i></i><label for="radio1">승인</label></span>
						<span class="check_wrap"><input type="radio" name="ds_status" id="radio2" value="A0"<?if($ds_status!="Z0"){?> checked="checked"<?}?>><i></i><label for="radio2">미승인</label></span>
					</div>
				</td>
			</tr>
		</table>
	</form>
	</div>

	<!--h3><em>▶</em> 개인정보 수집이용 선택동의 내역</h3>
	<div class="tbl_wrap">
		<table class="tbl_list2">
			<colgroup>
				<col width="17%">
				<col width="*">
			</colgroup>
			<tr>
				<th>개인정보 수집이용</th>
				<td class="pd">
					<textarea cols="70" rows="10" style="height:175px;"></textarea>
					<p class="agree_chk"><span class="check_wrap"><input type="checkbox" id="agree1"><i></i><label for="agree1">동의</label></span></p>
				</td>
			</tr>
			<tr>
				<th>개인정보 취급위탁</th>
				<td class="pd">
					<textarea cols="70" rows="10" style="height:175px;"></textarea>
					<p class="agree_chk"><span class="check_wrap"><input type="checkbox" id="agree2"><i></i><label for="agree2">동의</label></span></p>
				</td>
			</tr>
			<tr>
				<th>개인정보 3자 제공</th>
				<td class="pd">
					<textarea cols="70" rows="10" style="height:175px;"></textarea>
					<p class="agree_chk"><span class="check_wrap"><input type="checkbox" id="agree3"><i></i><label for="agree3">동의</label></span></p>
				</td>
			</tr>
		</table>
	</div-->

	<div class="btn_right">
		<a href="#" class="rnd_btn ty2 red" id="btn_delete">삭제</a>
		<a href="<?=ADMIN_PATH?>member/sa.php?PageNo=<?=$PageNo?>" class="rnd_btn ty2 gray">목록</a>
		<a href="#" class="rnd_btn ty2 black" id="btn_write">저장</a>

	</div>

</section>

<form id="frmMemberDelete" name="frmMemberDelete" method="post" action="sa_proc.php" enctype="multipart/form-data">
<input type="hidden" name="cd_user" value="<?=$cd_user?>"/>
<input type="hidden" name="mode" value="Delete"/>
</form>

<script laguage="javascript" type="text/javascript">
	function go_list() {
		link("<?=ADMIN_PATH?>/member/sa.php");
	}
	function ds_company_bp_chg(val) {
		if($.trim(val) == "") {
			val = "-1";
		}
		setCodeSelectJqTransForm("listcode","ds_branch", "sa_master","ds_branch","","선택하세요",val);
	}
    $(document).ready(function() {

        // setCodeSelectJqTransForm("listcode","ds_area", "member_master","ds_area","<?=$ds_area?>","선택하세요","");
//$('select').jqTransSelectRefresh();
//		$("#sel_ds_area div.jq_sel span").html($("#sel_ds_area option:selected").text());	//select box 대신 보이는 span 에 select value의 텍스트를 setting

		setCodeSelectJqTransForm("listPhone","nm_hp1","","","<?=$nm_hp1?>","선택","");
		setCodeSelectJqTransForm("listEmail","nm_email3","","","","직접입력","");

		setCodeSelectJqTransForm("listcode","ds_company_bp", "sa_master","ds_company_bp","<?=$ds_company_bp?>","선택하세요","");
		setCodeSelectJqTransForm("listcode","ds_branch", "sa_master","ds_branch","<?=$ds_branch?>","선택하세요","<?=$ds_company_bp?>");

<? if (!empty($ds_branch)){ ?>
		// setCodeSelectJqTransForm("listcode","ds_branch", "member_master","ds_branch","<?=$ds_branch?>","선택하세요","<?=$ds_company_bp?>");
<? } ?>

		// $("#ds_company_bp").change(function(){
		// 	setCodeSelectJqTransForm("listcode","ds_branch", "member_master","ds_branch","<?=$ds_branch?>","선택하세요",$(this).val());
		// });


        // $("#cd_userid").bind("keyup",function(){
        //     $("#idchkresult").val("N");
        // });
		//
        // $("#nm_email3").on("change", function(){
        //     if($(this).val() == ""){
        //         $("#nm_email2").show();
        //     }else{
        //         $("#nm_email2").hide();
        //     }
        // });

        // $("#btn_idchk").bind("click",function(){
		//
		// 	if($("#nm_email1").val() == ""){
		// 		alert("이메일을 입력하세요.");
		// 		$("#nm_email1").focus();
		// 		return false;
		// 	}
		//
		// 	if($("#nm_email3").val() == ""){
		// 		if($("#nm_email2").val() == ""){
		// 			alert("이메일을 입력하세요.");
		// 			$("#nm_email2").focus();
		// 			return false;
		// 		}
		// 		$("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email2").val());
		// 	}else{
		// 		$("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email3").val());
		// 	}
		//
        //     $.post("member_proc.php", { mode: "IdChk", nm_email: $("#nm_email").val()},function(data) {
        //          if(data=="Y"){
        //              if(confirm("이용가능합니다. 아이디를 사용하시겠습니까?")){
        //                  $("#cd_userid").attr("readonly",true).css("background","#d2d3d5");
        //                  $("#idchkresult").val("Y");
        //                  return;
        //              }
        //          }else{
        //              alert("사용불가능한 아이디 입니다.");
        //              $("#idchkresult").val("N");
        //              return;
        //          }
        //     });
        //     return false;
		//
        // });

		$("#btn_delete").bind("click",function(){
			var custom_opts = {
				title : '',
				btn_close_show : false,
			}

			custom_opts.title = '회원을 삭제하시겠습니까?';
			custom_modal_confirm(custom_opts, function(confirm) {
			   if(confirm) {
				   $("#btn_delete").hide();
				   var data = $("#frmMemberDelete").serialize();
				   $.ajax({
					   url : 'sa_proc.php',
					   type: 'POST',
					   dataType : 'json',
					   data: data,
					   success: function(res) {
						   custom_modal_confirm_close();

						   $("#btn_delete").show();

						   //세션 종료시 로그인 페이지로 이동
						   if(res.CODE != "0000") {
							   custom_opts.title = res.MSG;

							   if(res.CODE == "4444") {
								   window.location.href = res.DATAS.URL;
							   }
							   custom_modal_alert(custom_opts);
							   return false;
						   }

						   custom_opts.title = '회원정보를 삭제 했습니다.';
						   custom_opts.event_esc_key = false;

						   custom_modal_alert(custom_opts, function() {
							   go_list();
						   });
					   },
					   error:function(request,status,error){
						   $("#btn_delete").show();

						   custom_modal_confirm_close();

						   alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
					   }
				   });

			   }else {
				   $("#btn_delete").show();
				   return false;
			   }
		   });

			// if(confirm("삭제하시겠습니까?")){
			//     $("#mode").val("Delete");
			//     $("#frmMember").submit();
			// }
		});

        $("#agree_all").bind("click",function(){
            agreeChkAll();
        });

        $("#agree_all").bind("keyup",function(){
            agreeChkAll();
        });

        $("#btn_write").bind("click",function(){
			var custom_opts = {
				title : '',
				btn_close_show : false,
			}
		<? if ($mode == "Add"){ ?>
            var fieldlist = [["nm_email1","아이디"],["nm_email2","아이디"],["nm_pass","비밀번호"],["nm_pass2","비밀번호"],["nm_name","이름"],["nm_hp","휴대번호"]]
			//,["ds_area","지역"]
		<? }else{ ?>
            var fieldlist = [["nm_name","이름"],["nm_hp1","휴대번호"],["nm_hp2","휴대번호"],["nm_hp3","휴대번호"],["nm_email1","이메일"],["nm_email2","이메일"]]
			// ,["ds_area","지역"]
		<? } ?>

            if (!fnCheckForm(fieldlist)){
                return false;
            }else{

                /*아이디 관련 처리*/

				var idReg1 = /[a-z]/g;
				var idReg2 = /[0-9]/g;
/*
				if( !(idReg1.test( $("#cd_userid").val() )) || !(idReg2.test( $("#cd_userid").val() )) ) {
					alert("아이디는 영문/숫자 조합으로 이루어져야 합니다.");
					$("#cd_userid").focus();
					return false;
				}
				var idReg = /^[a-z]+[a-z0-9]{5,19}$/g;
				if( !idReg.test( $("#cd_userid").val() ) ) {
					alert("아이디는 영문자로 시작하는 6~20자 영문자 또는 숫자이어야 합니다.");
                    $("#cd_userid").focus();
                    return false;
				}

				if(!fnCheckAlphaNumber($("#cd_userid").val())){
                    alert('아이디는 영문/숫자 조합으로 이루어져야 합니다.');
                    return false;
                }
                if($("#cd_userid").val().length <6){
                    alert("6글자 이상 아이디를 입력하세요");
                    $("#cd_userid").focus();
                    return false;
                }
*/
				// if($("#idchkresult").val() != "Y"){
				// 	alert("아이디 중복확인을 해 주세요.");
				// 	$("#idchkresult").focus();
				// 	return false;
				// }

		<? if ($mode == "Add"){ ?>
				/*패스워드 처리*/
	// 			if($("#nm_pass").val().length == 0 || $("#nm_pass2").val().length == 0){
	// 				alert("패스워드를 입력하세요");
	// 				$("#nm_pass").focus();
	// 				return false;
	// 			}
 //
 //               if($("#nm_pass").val().length > 0){
 //                    if($("#nm_email1").val()==$("#nm_pass").val()){
 //                        alert("아이디와 변경할 패스워드를 다르게입력하세요");
 //                        $("#nm_pass").focus();
 //                        return false;
 //                    }
 //                    if($("#nm_pass").val()!=$("#nm_pass2").val()){
 //                        alert("입력하신 변경할 패스워드가 일치하지 않습니다.");
 //                        $("#nm_pass").focus();
 //                        return false;
 //                    }
 //                    if(!isStrongValidFormPassword($("#nm_pass").val())){
 // //                       alert('변경할 패스워드는 영문/숫자 조합으로 이루어져야 합니다.');
 //                        return false
 //                    }
 //                    if($("#nm_pass").val().length <6){
 //                        alert("6글자 이상 변경할 패스워드를 입력하세요");
 //                        $("#nm_pass").focus();
 //                        return false;
 //                    }
 //                }
		<? }else{ ?>
               if($("#nm_pass").val().length > 0){
				   if(!fnCheckAlphaNumber($("#nm_pass").val())){
		   				custom_opts.title = '변경할 패스워드는 영문/숫자 조합으로 이루어져야 합니다.';

		   				custom_modal_alert(custom_opts);
		   				return false;
		   			}
		   			if($("#nm_pass").val().length <8){
		   				custom_opts.title = '8글자 이상 변경할 패스워드를 입력하세요.';

		   				custom_modal_alert(custom_opts);
		   				return false;
		   			}

                }
		<? } ?>

                // if(!ChkNum($("#nm_hp").val())){
                //     alert("휴대폰 번호는 숫자만 입력하세요.");
                //     $("#nm_hp").focus();
                //     return false;
                // }

/*
                if($("#nm_hp_01").val() == ""){
                    alert("휴대폰 번호를 입력하세요.");
                    $("#nm_hp_01").focus();
                    return false;
                }

                if($("#nm_hp_02").val() == ""){
                    alert("휴대폰 번호를 입력하세요.");
                    $("#nm_hp_02").focus();
                    return false;
                }

                if($("#nm_hp_03").val() == ""){
                    alert("휴대폰 번호를 입력하세요.");
                    $("#nm_hp_03").focus();
                    return false;
                }

                $("#nm_hp").val($("#nm_hp_01").val()+"-"+$("#nm_hp_02").val()+"-"+$("#nm_hp_03").val());

                if($("#nm_email1").val() == ""){
                    alert("이메일을 입력하세요.");
                    $("#nm_email1").focus();
                    return false;
                }

                if($("#nm_email3").val() == ""){
                    if($("#nm_email2").val() == ""){
                        alert("이메일을 입력하세요.");
                        $("#nm_email2").focus();
                        return false;
                    }
                    $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email2").val());
                }else{
                    $("#nm_email").val($("#nm_email1").val()+"@"+$("#nm_email3").val());
                }
*/
				var nm_hp = $("#nm_hp1").val()+"-"+$("#nm_hp2").val()+"-"+$("#nm_hp3").val();
				var nm_email = $("#nm_email1").val()+"@"+$("#nm_email2").val();

				$("#nm_hp").val(nm_hp);
                $("#nm_email").val(nm_email);

/*
                if($("#nm_addr").val() == ""){
                    alert("주소를 입력하세요.");
                    $("#nm_addr").focus();
                    return false;
                }

                if($("#nm_addr_sub").val() == ""){
                    alert("주소를 입력하세요.");
                    $("#nm_addr_sub").focus();
                    return false;
                }

				if(!document.getElementById("ds_agree1").checked){
					alert('[필수] 회원 이용약관에 동의해 주세요.');
                    $("#ds_agree1").focus();
					return false;
				}

				if(!document.getElementById("ds_agree2").checked){
					alert('[필수] 개인정보 수집이용 에 동의해 주세요.');
                    $("#ds_agree2").focus();
					return false;
				}
 */


				 custom_opts.title = '정보를 수정하시겠습니까?';
				 custom_modal_confirm(custom_opts, function(confirm) {
				 	if(confirm) {
				 		$("#btn_write").hide();
				 		var data = $("#frmMember").serialize();
				 		$.ajax({
				 			url : 'sa_proc.php',
				 			type: 'POST',
				 			dataType : 'json',
				 			data: data,
				 			success: function(res) {
				 				custom_modal_confirm_close();

				 				$("#btn_write").show();

				 				//세션 종료시 로그인 페이지로 이동
				 				if(res.CODE != "0000") {
				 					custom_opts.title = res.MSG;

				 					if(res.CODE == "4444") {
				 						window.location.href = res.DATAS.URL;
				 					}
				 					custom_modal_alert(custom_opts);
				 					return false;
				 				}

				 				custom_opts.title = '정보 수정이 완료되었습니다.';
				 				custom_opts.event_esc_key = false;

				 				custom_modal_alert(custom_opts, function() {
				 					reload();
				 				});
				 			},
				 			error:function(request,status,error){
				 				$("#btn_write").show();

				 				custom_modal_confirm_close();

				 				alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
				 			}
				 		});

				 	}else {
				 		$("#btn_write").show();
				 		return false;
				 	}
				});
				// var c=confirm("정보를 등록하시겠습니까?");
                // if(c){
                //     $("#btn_write").hide();
                //     $("#frmMember").submit();
                // }else{
                //     $("#btn_write").show();
                //     return false;
                // }
            }
        });
    });
/*
    function agreeChkAll(){
        if(document.getElementById("agree_all").checked){
            document.getElementById("ds_agree1").checked = true;
            document.getElementById("ds_agree2").checked = true;
            document.getElementById("ds_agree3").checked = true;
            document.getElementById("ds_agree4").checked = true;
        }else{
            document.getElementById("ds_agree1").checked = false;
            document.getElementById("ds_agree2").checked = false;
            document.getElementById("ds_agree3").checked = false;
            document.getElementById("ds_agree4").checked = false;
        }
    }
*/
</script>
<script language="javascript">
<!--

function sel_1(sltObj)
{
    document.getElementById("nm_email2").value = sltObj;
	if (sltObj == "")
	{
		document.getElementById("nm_email2").readOnly = false;
	}else{
		document.getElementById("nm_email2").readOnly = true;
	}

}
//-->
</script>

<? include("../inc/inc_footer.php") ?>
<? include("../inc/inc_bottom.php") ?>
<?
mysql_close($connect);
?>
