<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<%link="person_info.asp"
dim pmember_hukoucityid,pmember_cityid%>
<!--#include file="checkpmember.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改个人资料--<%=SiteTitle%></title>
<script type="text/javascript" src="../Js/Calendar.js"></script>
<script language="JavaScript">
<!--
//功能：去掉字符串前后空格
//返回值：去掉空格后的字符串
function fnRemoveBrank(strSource)
{
 return strSource.replace(/^\s*/,'').replace(/\s*$/,'');
}
function String.prototype.lenB()
{
return this.replace(/[^\x00-\xff]/g,"**").length;
}
function Juge(theForm)
{
  if (fnRemoveBrank(theForm.name.value) == "")
  {
    alert("请输入姓名!");
    theForm.name.focus();
    return (false);
  }
  today=new Date();
 // birthb=new Date(theForm.birth.value);
   var birtha=theForm.birth.value; 
   var birthb=birtha.split("-");
   
  if (fnRemoveBrank(theForm.birth.value) == "")
  {
    alert("请输入出日期!");
    theForm.birth.focus();
    return (false);
  }else
  if (today.getYear()-12<=birthb[0])
  {
   alert("出生日期"+birtha+"至今必须大于12年!");
    theForm.birth.focus();
    return (false);
	}
//  if (fnRemoveBrank(theForm.idcard.value) == "")
//  {
//    alert("请输入证件编号!");
//    theForm.idcard.focus();
//    return (false);
//  }
   if (fnRemoveBrank(theForm.province.value) == "")
  {
    alert("请选择所在省份!");
    theForm.province.focus();
    return (false);
  }
   if (fnRemoveBrank(theForm.edu.value) == "")
  {
    alert("请选择最高学历!");
    theForm.edu.focus();
    return (false);
  }
//     if (fnRemoveBrank(theForm.school.value) == "")
//  {
//    alert("请填写毕业学校!");
//    theForm.school.focus();
//    return (false);
//  }
  if (fnRemoveBrank(theForm.tel.value) == ""&&fnRemoveBrank(theForm.mobile.value) == "")
  {
    alert("请输入联系电话或手机号码，必须填写一项!");
    theForm.tel.focus();
    return (false);
  }
  if (fnRemoveBrank(theForm.tel.value) != "")
  {
	  var objv = fnRemoveBrank(theForm.tel.value);
	  var pattern = /^[0-9\s+.-]+$/;
	  flag = pattern.test(objv);
	  if(!flag)
	  {
		alert("联系电话：格式不正确!请重新输入。");
		theForm.tel.focus();
		return (false);
	   }
  }
  if (fnRemoveBrank(theForm.post.value) != "")
  {
	  var objv = fnRemoveBrank(theForm.post.value);
	  var pattern = /^[0-9]+$/;
	  flag = pattern.test(objv);
	  if(!flag)
	  {
		alert("邮政编码：要求为数字!请重新输入。");
		theForm.post.focus();
		return (false);
	   }
   }
  if (fnRemoveBrank(theForm.url.value) != "")
  {
	  if(theForm.url.value.indexOf("http://")==-1)
	  {
		alert("个人主页：必须包括“http://”，请完整填写。");
		theForm.url.focus();
		return (false);
	   }
   }
//  var objv = fnRemoveBrank(theForm.email.value);
//  var pattern = /^([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)*@([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)+$/;
//  flag = pattern.test(objv);
//  if(!flag)
//  {
//    alert("电子邮件：格式不正确！请重新输入。");
//	theForm.email.focus();
//	return (false); 
//  }  
 }
-->
</script>

<link href="../member/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/input.js"></script>
</head>
<body>
<%step=trim(request("step"))
Select Case step
	Case "SaveData"
		Call SaveData()
	Case Else
		Call ShowData()
End Select%>
</div>
<%
conn.close:set conn=nothing%>
<%Sub ShowData()
set rst=server.createobject("ADODB.Recordset")
sql1="select * from job_member where member_login='"&pmember_login&"' and member_typeid=1"
rst.open sql1,conn,1,1
if not rst.eof then
pmember_id=rst("member_id")
pmember_name=rst("member_name")
pmember_sex=rst("Member_sex")
pmember_birth=rst("Member_birth")
pmember_cardtype=rst("Member_cardtype")
pmember_idcard=rst("Member_idcard")
pmember_marriage=rst("Member_marriage")
pmember_polity=rst("Member_polity")
pmember_hukouprovinceid=rst("Member_hukouprovinceid")
pmember_hukoucapitalid=rst("Member_hukoucapitalid")
pmember_hukoucityid=rst("Member_hukoucityid")
pmember_provinceid=rst("Member_provinceid")
pmember_capitalid=rst("Member_capitalid")
pmember_cityid=rst("Member_cityid")
pmember_edu=rst("Member_edu")
pmember_tel=rst("Member_tel")
pmember_mobile=rst("Member_mobile")
pmember_chat=rst("Member_chat")
pmember_email=rst("Member_email")
pmember_url=rst("Member_url")
pmember_address=rst("Member_address")
pmember_post=rst("Member_post")
else
response.write "<script language=javascript>alert('出错！');javascript:history.back();</script>"
response.end 
end if
rst.close
set rst=nothing
%>
<div class="memmenul">
<div class="leftmenutit"><span>修改基本资料</span></div>
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="mtable" align="center">
<form name="modicompany" action="person_info.asp?step=SaveData&id=<%=pmember_id%>" method="post" onSubmit="return Juge(this)">
  <tr>
    <td colspan="2" class="mtitle">基本信息</td>
    </tr>
  <tr>
    <td width="12%" align="right">姓&nbsp;&nbsp;&nbsp; 名：</td>
    <td width="88%"><input name=name id="name" maxLength=25 value="<%=pmember_name%>">
      <font color="#ff7800">*</font>请填写您的真实姓名</td>
  </tr>
  <tr>
    <td align="right">性&nbsp;&nbsp;&nbsp; 别：</td>
    <td><input type=radio value=1 name=sex checked="checked">男<INPUT type=radio value=2 name=sex <%if pmember_sex=2 then response.write "checked" end if%>>女 <font color="#ff7800">*</font></td>
  </tr>
  <tr>
    <td align="right">出生日期：</td>
    <td><input type="text" name="birth" value="<%=pmember_birth%>" id="birth" size="10" maxlength="10" onClick="ShowCalendar(this.id)" readonly /> 
    <font color="#ff7800">*</font>请选择您的出生日期</td>
  </tr>
  <tr>
    <td align="right">证件类型：</td>
    <td>
<SELECT name=cardtype size=1 id="cardtype">
<OPTION value=0 <%if pmember_cardtype=0 then response.write "select" end if%>>身份证</OPTION>
<OPTION value=1 <%if pmember_cardtype=1 then response.write "select" end if%>>驾证</OPTION>
<OPTION value=2 <%if pmember_cardtype=2 then response.write "select" end if%>>军官证</OPTION>
<OPTION value=3 <%if pmember_cardtype=3 then response.write "select" end if%>>护照</OPTION>
<OPTION value=4 <%if pmember_cardtype=4 then response.write "select" end if%>>其它</OPTION>
</SELECT> 
	<tr><td align="right">证件编号：</td>
	<td><INPUT name=idcard id="idcard" maxLength=20 value="<%=pmember_idcard%>"></td>
  </tr>
  <tr>
    <td align="right">婚姻状况：</td>
    <td>
<select name="marriage" id="marriage">
<option value="">请选择</option>
<%set rs=server.createobject("ADODB.Recordset")
sql="select * from job_marriage"
rs.open sql,conn,1,1
do while not rs.eof
if pmember_marriage=rs("marriage_id") then
response.write"<OPTION value="&rs("marriage_id")&" selected>"&rs("marriage_name")&"</option>"
else
response.write"<OPTION value="&rs("marriage_id")&">"&rs("marriage_name")&"</option>"
end if
rs.movenext
loop
rs.close
%>
</select>	</td>
  </tr>
  <tr>
    <td align="right">政治面貌：</td>
    <td>
<select name="polity" id="polity">
<option value="">请选择</option>
<%
sql="select * from job_polity"
rs.open sql,conn,1,1
do while not rs.eof
if pmember_polity=rs("polity_id") then
response.write"<OPTION value="&rs("polity_id")&" selected>"&rs("polity_name")&"</option>"
else
response.write"<OPTION value="&rs("polity_id")&">"&rs("polity_name")&"</option>"
end if
rs.movenext
loop
rs.close
%></select>	</td>
  </tr>
  <tr>
    <td align="right">户口所在地：</td>
    <td>
		<select name="hukouprovince" size="1" id="select5" onChange="changeProvince(document.modicompany.hukouprovince.options[document.modicompany.hukouprovince.selectedIndex].value)">
		<%if pmember_hukouprovinceid<>"" then%>
		<option value="<%=pmember_hukouprovinceid%>"><%=Hireworkadds(pmember_hukouprovinceid)%></option>
		<%else%>
		<option value="">选择省</option>
		<%end if%>
		</select>		
		<select name="hukoucapital" onchange="changeCity(document.modicompany.hukoucapital.options[document.modicompany.hukoucapital.selectedIndex].value)">
		<%if pmember_hukoucapitalid<>"" then%>
		<option value="<%=pmember_hukoucapitalid%>"><%=Hireworkadds(pmember_hukoucapitalid)%></option>
		<%else%>
		<option value="">选择市</option>
		<%end if%>
		</select>
		<select name="hukoucity">
		<%if pmember_hukoucityid<>"" then%>
		<option value="<%=pmember_hukoucityid%>"><%=Hireworkadds(pmember_hukoucityid)%></option>
		<%else%>
		<option value="">选择区</option>
		<%end if%>
		</select>
	</td>
  </tr>
  <tr>
    <td align="right">现所在地：</td>
    <td>
		<select name="province" size="1" id="select5" onChange="changeProvinces(document.modicompany.province.options[document.modicompany.province.selectedIndex].value)">
		<%if pmember_provinceid<>"" then%>
		<option value="<%=pmember_provinceid%>"><%=Hireworkadds(pmember_provinceid)%></option>
		<%else%>
		<option value="">选择省</option>
		<%end if%>
		</select>		
		<select name="capital" onchange="changeCitys(document.modicompany.capital.options[document.modicompany.capital.selectedIndex].value)">
		<%if pmember_capitalid<>"" then%>
		<option value="<%=pmember_capitalid%>"><%=Hireworkadds(pmember_capitalid)%></option>
		<%else%>
		<option value="">选择市</option>
		<%end if%>
		</select>
		<select name="city">
		<%if pmember_cityid<>"" then%>
		<option value="<%=pmember_cityid%>"><%=Hireworkadds(pmember_cityid)%></option>
		<%else%>
		<option value="">选择区</option>
		<%end if%>
		</select>
	</td>
  </tr>
  <tr>
    <td align="right">最高学历：</td>
    <td>
<select name="edu">
<option value="" selected>请选择学历...</option>
<%
sql="select edu_id,edu_name from job_edu order by edu_id desc"
rs.open sql,conn,1,1
do while not rs.eof
if pmember_edu=rs("edu_id") then
response.write"<OPTION value="&rs("edu_id")&" selected>"&rs("edu_name")&"</option>"
else
response.write"<OPTION value="&rs("edu_id")&">"&rs("edu_name")&"</option>"
end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>
<font color="#ff7800">*</font> </td>
  </tr>
  <tr>
    <td colspan="2" class="mtitle">联系方式</td>
    </tr>
  <tr>
    <td align="right">电子邮件：</td>
    <td><%=pmember_email%><font color="#ff7800">*</font></td>
  </tr>
  <tr>
    <td align="right">电话号码：</td>
    <td><input name=tel id="tel" value="<%=pmember_tel%>" size="40" maxlength=100>
      <font color="#ff7800">*</font>联系电话或手机号码必填一项</td>
  </tr>
  <tr>
    <td align="right">手机号码：</td>
    <td><input name=mobile id="mobile" value="<%=pmember_mobile%>" size="40" maxlength=100>
    填写手机号码，随时随地接收面试通知！</td>
  </tr>
  <tr>
    <td align="right">聊天号码：</td>
    <td><input name=chat id="chat" maxlength=100 value="<%=pmember_chat%>">(QQ:123456;ICQ:345678;MSN:user@yjys.net)</td>
  </tr>
  <tr>
    <td align="right">个人主页：</td>
    <td><input name=url id="url" size="40" maxlength=100 value="<%=pmember_url%>"></td>
  </tr>
  <tr>
    <td align="right">通讯地址：</td>
    <td><input name=address size="40" maxlength=50 value="<%=pmember_address%>"></td>
  </tr>
  <tr>
    <td align="right">邮政编码：</td>
    <td><input name=post id="post" size=6 maxlength=6 value="<%=pmember_post%>"></td>
  </tr>
  <tr>
    <td colspan="2"> &nbsp;
       <INPUT name=Submit type=submit class="inputs" value="修 改">
      &nbsp;&nbsp;&nbsp;&nbsp; <INPUT name=Reset type=reset class="inputs" value="取 消"></td>
    </tr>
  </form>
</table>
</div>
<%End Sub%>
<%Sub SaveData()
pmember_name=CheckStr(trim(request("name")))
if pmember_name="" then
 Response.Write ("<script language=JavaScript>{alert('错误：姓名不能为空!');location.href = 'javascript:history.go(-1)';}</script>")
 Response.End
end if
'pmember_appraise=CheckStrbox(request("appraise"))
'If lenmix(pmember_appraise)>=2000 Then 
'response.write "<script language=javascript>alert('错误：自我评价太长了，要求不多于2000个字符!！');location.href='javascript:history.back()';<//script>"
'response.end 
'end if
pmember_id=trim(request("id"))
pmember_sex=trim(request("sex"))
pmember_birth=cdate(trim(request("birth")))
if pmember_birth="" then
Response.Write ("<script language=JavaScript>{alert('错误：出生日期不能为空!');location.href = 'javascript:history.go(-1)';}</script>")
Response.End
end if

pmember_cardtype=trim(request("cardtype"))
pmember_idcard=CheckStr(trim(request("idcard")))
'if pmember_idcard="" then
' Response.Write ("<script language=JavaScript>{alert('错误：证件号码不能为空!');location.href = 'javascript:history.go(-1)';}<//script>")
' Response.End
'end if
'if trim(request("nation"))<>"" then
' pmember_nation=trim(request("nation"))
'end if
if trim(request("polity"))<>"" then
 pmember_polity=trim(request("polity"))
end if
if trim(request("marriage"))<>"" then
 pmember_marriage=trim(request("marriage"))
end if
'if trim(request("height"))<>"" then
' pmember_height=trim(request("height"))
'end if
'if trim(request("weight"))<>"" then
' pmember_weight=trim(request("weight"))
'end if
if trim(request("hukouprovince"))<>"" then
 pmember_hukouprovinceid=cint(trim(request("hukouprovince")))
end if
if trim(request("hukoucapital"))<>"" then
 pmember_hukoucapitalid=trim(request("hukoucapital"))
end if
if trim(request("hukoucity"))<>"" then
 pmember_hukoucityid=trim(request("hukoucity"))
end if
pmember_provinceid=trim(request("province"))
pmember_capitalid=trim(request("capital"))
pmember_cityid=trim(request("city"))
If pmember_provinceid="" Or pmember_capitalid="" Or pmember_cityid="" Then
	Response.Write ("<script>alert('错误：所在地不能为空!');history.go(-1);</script>")
	Response.End
End If
pmember_edu=trim(request("edu"))
pmember_school=CheckStr(trim(request("school")))
pmember_tel=trim(request("tel"))
pmember_mobile=CheckStr(trim(request("mobile")))
If pmember_tel="" and pmember_mobile="" Then
	Response.Write ("<script>alert('错误：联系电话或者手机号码必须填写一项!');history.go(-1);</script>")
	Response.End
End If
pmember_chat=CheckStr(trim(request("chat")))
'pmember_email=CheckStr(trim(request("email")))
'If pmember_email="" Then
'	Response.Write ("<script>alert('错误：电子邮件不能为空!');history.go(-1);<//script>")
'	Response.End
'End If
pmember_url=CheckStr(trim(request("url")))
pmember_address=CheckStr(trim(request("address")))
pmember_post=CheckStr(trim(request("post")))
'pmember_sumup=CheckStr(trim(request("sumup")))
'把修改后基本资料存入pmember表
sql="select * from job_member where member_id="&pmember_id&""
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
if not rs.eof then
rs("Member_name")=pmember_name
rs("Member_sex")=pmember_sex
rs("Member_birth")=pmember_birth
rs("Member_cardtype")=pmember_cardtype
rs("Member_idcard")=pmember_idcard
'rs("Member_nation")=pmember_nation
rs("Member_marriage")=pmember_marriage
rs("Member_polity")=pmember_polity
rs("Member_hukouprovinceid")=pmember_hukouprovinceid
rs("Member_hukoucapitalid")=pmember_hukoucapitalid
rs("Member_hukoucityid")=pmember_hukoucityid
rs("Member_provinceid")=pmember_provinceid
rs("Member_capitalid")=pmember_capitalid
rs("Member_cityid")=pmember_cityid
rs("Member_edu")=pmember_edu
'rs("Member_school")=pmember_school
rs("Member_tel")=pmember_tel
rs("Member_mobile")=pmember_mobile
rs("Member_chat")=pmember_chat
'rs("Member_email")=pmember_email
rs("Member_url")=pmember_url
rs("Member_address")=pmember_address
rs("Member_post")=pmember_post
'rs("Member_sumup")=pmember_sumup
'rs("Member_appraise")=pmember_appraise 
rs.update
end if
rs.close
Response.Cookies(FRHRCMS)("user_name")=pmember_name
sqlrm="select * from JOB_P_resume where resume_pmember='"&Request.Cookies(FRHRCMS)("user_login")&"'"
rs.open sqlrm,conn,1,1
if (rs.bof and rs.eof) then
response.write("<script language=JavaScript>{alert('恭喜您，修改资料完成,请填写第一份简历！');location.href = 'person_addresume.asp?action=Addnew';}</script>")
else
	if isnull(rs("resume_name")) then
	response.write("<script language=JavaScript>{alert('恭喜您，修改资料完成,现在就完善第一份简历！');location.href = 'person_addresume.asp?rid="&rs("resume_id")&"';}</script>")
	else
	response.write("<script language=JavaScript>{alert('恭喜您，修改资料完成！');location.href = '../member/main.asp';}</script>")
	end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
End Sub%>
<script language = "JavaScript" src="../js/GetProvince.js"></script>
<script language = "JavaScript">
function changeProvince(selvalue)
{
document.modicompany.hukoucapital.length=0; 
document.modicompany.hukoucity.length=0;
var selvalue=selvalue;	  
var j,d,mm;
d=0;
for(j=0;j<provincearray.length;j++) 
	{
		if(provincearray[j][1]==selvalue) 
		{
			if (d==0)
			{
			mm=provincearray[j][2];
			}
		var newOption2=new Option(provincearray[j][0],provincearray[j][2]);
		document.all.hukoucapital.add(newOption2);
		d=d+1;	
		}		
		if(provincearray[j][1]==mm) 
		{		
			var newOption3=new Option(provincearray[j][0],provincearray[j][2]);
			document.all.hukoucity.add(newOption3);
		}			
	}
}
function changeCity(selvalue)  
{ 
	document.modicompany.hukoucity.length=0;  
	var selvalue=selvalue;
	var j;
	for(j=0;j<provincearray.length;j++) 
	{
		if(provincearray[j][1]==selvalue) 
		{
			var newOption4=new Option(provincearray[j][0],provincearray[j][2]);
			document.all.hukoucity.add(newOption4);
		}
	}
}
function selectprovince() 
{ 
	var j;
	for(j=0;j<provincearray.length;j++) 
	{
		if(provincearray[j][1]==0) 
		{
			var newOption4=new Option(provincearray[j][0],provincearray[j][2]);
			document.all.hukouprovince.add(newOption4);
		}
	}
}


function changeProvinces(selvalue)
{
document.modicompany.city.length=0; 
document.modicompany.capital.length=0;
var selvalue=selvalue;	  
var j,d,mm;
d=0;
for(j=0;j<provincearray.length;j++) 
	{
		if(provincearray[j][1]==selvalue) 
		{
			if (d==0)
			{
			mm=provincearray[j][2];
			}
		var newOption2=new Option(provincearray[j][0],provincearray[j][2]);
		document.all.capital.add(newOption2);
		d=d+1;	
		}		
		if(provincearray[j][1]==mm) 
		{		
			var newOption3=new Option(provincearray[j][0],provincearray[j][2]);
			document.all.city.add(newOption3);
		}			
	}
}
function changeCitys(selvalue)  
{ 
	document.modicompany.city.length=0;  
	var selvalue=selvalue;
	var j;
	for(j=0;j<provincearray.length;j++) 
	{
		if(provincearray[j][1]==selvalue) 
		{
			var newOption4=new Option(provincearray[j][0],provincearray[j][2]);
			document.all.city.add(newOption4);
		}
	}
}

function selectprovinces() 
{ 
var j;
	for(j=0;j<provincearray.length;j++) 
	{
		if(provincearray[j][1]==0) 
		{
			var newOption4=new Option(provincearray[j][0],provincearray[j][2]);
			document.all.province.add(newOption4);
		}
	}
}
selectprovince();
selectprovinces();
</script>