<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<%link="company_info.asp"
dim cmember_cityid%>
<!--#include file="checkcmember.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.comname.value) == "")
  {
    alert("请输入公司名称!");
    theForm.comname.focus();
    return (false);
  }
  if (fnRemoveBrank(theForm.licence.value) != "")
  {
	  var objv = fnRemoveBrank(theForm.licence.value);
	  var pattern = /^[0-9]+$/;
	  flag = pattern.test(objv);
	  if(!flag)
	  {
		alert("营业执照：要求为数字!请重新输入。");
		theForm.licence.focus();
		return (false);
	   }
   }
  if (fnRemoveBrank(theForm.trade.value) == "")
  {
    alert("请选择所属行业!");
    theForm.trade.focus();
    return (false);
  }
    if (fnRemoveBrank(theForm.province.value) == "")
  {
    alert("请选择所在省份!");
    theForm.province.focus();
    return (false);
  }
   if (fnRemoveBrank(theForm.city.value) == "")
  {
    alert("请选择所在市县!");
    theForm.city.focus();
    return (false);
  }
  if (fnRemoveBrank(theForm.ecoclass.value) == "")
  {
    alert("请选择公司性质!");
    theForm.ecoclass.focus();
    return (false);
  }
  if (fnRemoveBrank(theForm.fund.value) != "")
  {
	  var objv = fnRemoveBrank(theForm.fund.value);
	  var pattern = /^[0-9]+$/;
	  flag = pattern.test(objv);
	  if(!flag)
	  {
		alert("注册资金：要求为数字!请重新输入。");
		theForm.fund.focus();
		return (false);
	   }
   }
   if (fnRemoveBrank(theForm.introduce.value) == "")
  {
    alert("请输入公司简介!");
    theForm.introduce.focus();
    return (false);
  }
  if ((theForm.introduce.value).lenB()>=8000)
  {
	 alert("公司简介太长了，要求不多于8000个字符!");
	 theForm.introduce.focus();
	 return (false);
  }
  //if (fnRemoveBrank(theForm.address.value) == "")
//  {
//	alert("请输入通信地址!");
//	theForm.address.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.contact.value) == "")
  {
    alert("请输入联系人!");
    theForm.contact.focus();
    return (false);
  }
  if (fnRemoveBrank(theForm.tel.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("电话号码：要求为数字0-9和-的组合!请重新输入。");
		theForm.tel.focus();
		return (false);
	   }
   }
  if (fnRemoveBrank(theForm.mobile.value) != "")
  {
	  var objv = fnRemoveBrank(theForm.mobile.value);
	  var pattern = /^[0-9]+$/;
	  flag = pattern.test(objv);
	  if(!flag||objv.length<11)
	  {
		alert("手机号码：要求为11位数字!请重新输入。");
		theForm.mobile.focus();
		return (false);
	   }
   }
   if (fnRemoveBrank(theForm.fax.value) != "")
  {
	  var objv = fnRemoveBrank(theForm.fax.value);
	  var pattern = /^[0-9-\s]+$/;
	  flag = pattern.test(objv);
	  if(!flag)
	  {
		alert("传真号码：要求为数字0-9和-的组合!请重新输入。");
		theForm.fax.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>
<div class="memmenul">
<div class="leftmenutit"><span>修改基本资料</span></div>
<%step=trim(request("step"))
Select Case step
	Case "SaveData"
		Call SaveData()
	Case Else
		Call ShowData()
End Select%>
<%Sub ShowData()
set rst=server.createobject("ADODB.Recordset")
sql1="select * from job_member where member_login='"&cmember_login&"'"
rst.open sql1,conn,1,1
if not rst.eof then
cmember_id=rst("member_id")
cmember_name=rst("member_name")
cmember_licence=rst("Member_licence")
cmember_trade=rst("Member_trade")
cmember_provinceid=rst("Member_provinceid")
cmember_capitalid=rst("Member_capitalid")
cmember_cityid=rst("Member_cityid")
cmember_ecoclass=rst("Member_ecoclass")
cmember_founddate=rst("Member_founddate")
cmember_fund=rst("Member_fund")
cmember_workers=rst("Member_workers")
cmember_introduce=rst("Member_introduce")
cmember_address=rst("Member_address")
cmember_post=rst("Member_post")
cmember_contact=rst("Member_contact")
cmember_tel=rst("Member_tel")
cmember_telshowflag=rst("Member_telshowflag")
cmember_mobile=rst("Member_mobile")
cmember_mobileshowflag=rst("Member_mobileshowflag")
cmember_fax=rst("Member_fax")
cmember_email=rst("Member_email")
cmember_emailshowflag=rst("Member_emailshowflag")
cmember_url=rst("Member_url")
else
response.write "<script language=javascript>alert('出错！');javascript:history.back();</script>"
response.end 
end if
rst.close
set rst=nothing
if SiteMode="1" then
	if cmember_provinceid="" or isnull(cmember_provinceid) then
	cmember_provinceid=Siteprovince
	cmember_capitalid=Sitecapital
	end if
end if%>
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="mtable" align="center">
<form name="cominfoform" action="company_info.asp?step=SaveData&id=<%=cmember_id%>" method="post" onSubmit="return Juge(this)">
  <tr>
    <td colspan="2" class="tdcolor">基本资料</td>
    </tr>
  <tr>
    <td width="100" align="right"><font color="#ff6600">＊</font>公司名称：</td>
    <td><input name="comname" id="comname" size="38" maxlength="50" value="<%=cmember_name%>" <%if cmember_name<>"" then Response.Write"readonly"%> />
      （填写后不能修改，如有变更请联系客服人员。）</td>
  </tr>
  <tr>
    <td align="right">营业执照：</td>
    <td><input maxlength="50" size="30" name="licence" value="<%=cmember_licence%>" /></td>
  </tr>
  <tr>
    <td align="right"><font color="#ff6600">＊</font>所属行业：</td>
    <td>
<select name="trade" id="select">
<option value=""></option>
<%
Set rs= Server.CreateObject("ADODB.RecordSet")
sql="select trade_id,trade_name from job_trade order by date desc"
rs.open sql,conn,1,1
do while not rs.eof
if cmember_trade=rs("trade_id") then
response.write"<OPTION value="&rs("trade_id")&" selected>"&rs("trade_name")&"</option>"
else
response.write"<OPTION value="&rs("trade_id")&">"&rs("trade_name")&"</option>"
end if
rs.movenext
loop
rs.close
%>
</select>	</td>
  </tr>
  <tr>
    <td align="right"><font color="#ff6600">＊</font>所在地区：</td>
    <td><select name="province" size="1" id="select5" onChange="changeProvince(document.cominfoform.province.options[document.cominfoform.province.selectedIndex].value)">
		<%if cmember_provinceid<>"" then%>
		<option value="<%=cmember_provinceid%>"><%=Hireworkadds(cmember_provinceid)%></option>
		<%else%>
		<option value="">选择省</option>
		<%end if%>
		</select>		
		<select name="capital" onchange="changeCity(document.cominfoform.capital.options[document.cominfoform.capital.selectedIndex].value)">
		<%if cmember_capitalid<>"" then%>
		<option value="<%=cmember_capitalid%>"><%=Hireworkadds(cmember_capitalid)%></option>
		<%else%>
		<option value="">选择市</option>
		<%end if%>
		</select>
		<select name="city">
		<%if cmember_cityid<>"" then%>
		<option value="<%=cmember_cityid%>"><%=Hireworkadds(cmember_cityid)%></option>
		<%else%>
		<option value="">选择区</option>
		<%end if%>
		</select>
	</td>
  </tr>
  <tr>
    <td align="right"><font color="#ff6600">＊</font>公司性质：</td>
    <td>
<select name="ecoclass" size="1" id="select4">
<option value=""></option>
<%
sql="select ecoclass_id,ecoclass_name from job_ecoclass"
rs.open sql,conn,1,1
do while not rs.eof
if cmember_ecoclass=rs("ecoclass_id") then
response.write"<OPTION value="&rs("ecoclass_id")&" selected>"&rs("ecoclass_name")&"</option>"
else
response.write"<OPTION value="&rs("ecoclass_id")&">"&rs("ecoclass_name")&"</option>"
end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>	</td>
  </tr>
  <tr>
    <td align="right">成立日期：</td>
    <td><input type="text" name="foundate" value="<%=cmember_founddate%>" id="foundate" size="10" maxlength="10" onClick="ShowCalendar(this.id)" readonly /></td>
  </tr>
  <tr>
    <td align="right">注册资金：</td>
    <td><input name="fund" id="fund" size="10" value="<%=cmember_fund%>" /> 万人民币</td>
  </tr>
  <tr>
    <td align="right">员工人数：</td>
    <td><input type="radio" value="少于50人" name="workers" checked />
少于<b>50</b>人
<input type="radio" value="50-200人" name="workers" <%if cmember_workers="50-200人" then response.write "checked" end if%> />
<b>50-200</b>人
<input type="radio" value="200-500人" name="workers" <%if cmember_workers="200-500人" then response.write "checked" end if%> />
<b>200-500</b>人
<input type="radio" value="500-1000人" name="workers" <%if cmember_workers="500-1000人" then response.write "checked" end if%> />
<b>500-1000</b>人
<input type="radio" value="1000人以上" name="workers" <%if cmember_workers="1000人以上" then response.write "checked" end if%> />
<b>1000</b>人以上</td>
  </tr>
  <tr>
    <td align="right"><font color="#ff6600">＊</font>公司简介：</td>
    <td><textarea name="introduce" cols="65" rows="11" class="fieldtext" id="introduce"><%=ChangeStrbox(cmember_introduce)%></textarea><br /><font color="#333333">(最大字符数5000,请尽可能详细填写资料，以确保贵公司资料顺利通过本网审核！包括：公司基本资料、产品或服务、经营业绩……)</font></td>
  </tr>
  <tr>
    <td colspan="2" class="tdcolor">联系方式</td>
    </tr>
  <tr>
    <td align="right">通讯地址：</td>
    <td><input name="address" type="text" size="38" maxlength="50" value="<%=cmember_address%>" /></td>
  </tr>
  <tr>
    <td align="right">邮&nbsp;&nbsp;&nbsp; 编：</td>
    <td><input name="post" id="post" size="6" maxlength="6" value="<%=cmember_post%>" /></td>
  </tr>
  <tr>
    <td align="right"><font color="#ff6600">＊</font>联 系 人：</td>
    <td><input name="contact" id="contact" size="28" maxlength="25" value="<%=cmember_contact%>" /> （请输入正确联系人，以方便求职者与贵公司联系。）</td>
  </tr>
  <tr>
    <td align="right"><font color="#ff6600">＊</font>联系电话：</td>
    <td><input name="tel" type="text" id="tel" size="38" maxlength="100" value="<%=cmember_tel%>" />
格式：区号-总机-分机，多部电话可用空格分隔<br />
<input id="telshowflag2" type="checkbox" value="0" name="telshowflag" <%if cmember_telshowflag=0 then response.write "checked" end if%> />
屏蔽联系电话<br />
（如果您不想在公司简介中显示联系电话，请选择此项，系统将隐藏您的联系电话）</td>
  </tr>
  <tr>
    <td align="right">手机号码：</td>
    <td><input name="mobile" type="text" id="mobile" size="38" maxlength="100" value="<%=cmember_mobile%>" />
格式：11位数字<br />
<input id="mobileshowflag" type="checkbox" value="0" name="mobileshowflag" <%if cmember_mobileshowflag=0 then response.write "checked" end if%> />
屏蔽手机号码</td>
  </tr>
  <tr>
    <td align="right">传&nbsp;&nbsp;&nbsp; 真：</td>
    <td><input name="fax" type="text" id="fax" size="38" maxlength="100" value="<%=cmember_fax%>" /></td>
  </tr>
  <tr>
    <td align="right"><font color="#ff6600">＊</font>电子邮件：</td>
    <td><input maxlength="100" size="38" name="email" value="<%=cmember_email%>" />
        <br />
        <input name="emailshowflag" type="checkbox" id="emailshowflag" value="0" <%if cmember_emailshowflag=0 then response.write "checked" end if%> />
屏蔽电子邮件<br />
（如果您不想在公司简介中显示电子邮件，请选择此项，系统将隐藏您的电子邮件）</td>
  </tr>
  <tr>
    <td align="right">公司主页：</td>
    <td><input name="url" id="url" size="38" maxlength="100" value="<%=cmember_url%>" /></td>
  </tr>
  <tr>
    <td align="right">&nbsp;</td>
    <td><input name="resetcontactinfo" type="checkbox" id="resetcontactinfo" value="1" />
同步更新所有招聘信息中的联系方式<br />
（选中此选项后,所有贵公司发布的招聘信息中的联系方式也将同时更改为此联系方式。）</td>
  </tr>
  <tr>
    <td colspan="2"> &nbsp;
      <INPUT name=Submit type=submit class="inputs" value="修 改"> 
     &nbsp;&nbsp; &nbsp;
      <INPUT name=Reset type=reset class="inputs" value="取 消"></td>
    </tr>
</form>
</table>
<%End Sub%>
</div>
<%
conn.close:set conn=nothing%>
<%Sub SaveData()
company_name=CheckStr(trim(request("comname")))
set rs=server.createobject("ADODB.Recordset")
sql="select Member_name from JOB_Member where Member_name='"&company_name&"' and Member_login<>'"&cmember_login&"'"
rs.open sql,conn,1,1
if not rs.eof then
 rs.close
 set rs=nothing
 Response.Write ("<script language=JavaScript>{alert('错误：此公司名称已有人使用，请正确填写您的公司名称！');location.href = 'javascript:history.go(-1)';}</script>")
 Response.End
end if
rs.close
company_introduce=CheckStrbox(request("introduce"))
If lenmix(company_introduce)>=8000 Then 
response.write "<script language=javascript>alert('错误：公司简介太长了，要求不多于8000个字符!！');location.href='javascript:history.back()';</script>"
response.end 
end if
company_id=clng(trim(request("id")))
if request("licence")<>"" then
company_licence=CheckStr(trim(request("licence")))
end if
company_trade=cint(trim(request("trade")))
company_provinceid=cint(trim(request("province")))
company_capitalid=cint(trim(request("capital")))
company_cityid=cint(trim(request("city")))
company_ecoclass=CheckStr(trim(request("ecoclass")))
if request("foundate")<>"" then
company_founddate=cdate(request("foundate"))
end if
if request("fund")<>"" then
company_fund=clng(trim(request("fund")))
end if
company_workers=CheckStr(trim(request("workers")))
if request("address")<>"" then
company_address=CheckStr(trim(request("address")))
end if
if request("post")<>"" then
company_post=CheckStr(trim(request("post")))
end if
company_contact=CheckStr(trim(Request("contact")))
company_tel=trim(Request("tel"))
if trim(request("telshowflag"))<>"" then
 company_telshowflag=cint(trim(request("telshowflag")))
else
 company_telshowflag=1
end if
company_mobile=trim(Request("mobile"))
if trim(request("mobileshowflag"))<>"" then
 company_mobileshowflag=cint(trim(request("mobileshowflag")))
else
 company_mobileshowflag=1
end if
if Request("fax")<>"" then
company_fax=trim(Request("fax"))
end if
company_email=CheckStr(trim(request("email")))
if trim(request("emailshowflag"))<>"" then
 company_emailshowflag=cint(trim(request("emailshowflag")))
else
 company_emailshowflag=1
end if
if request("url")<>"" then
company_url=CheckStr(trim(request("url")))
end if
if trim(request("resetcontactinfo"))<>"" then
 resetcontactinfo=cint(trim(request("resetcontactinfo")))
else
 resetcontactinfo=0
end if

'把修改后的企业资料存入用户表
sql="select * from JOB_Member where Member_login='"&cmember_login&"'"
rs.open sql,conn,1,3
Member_id=rs("Member_id")
rs("Member_name")=company_name
rs("Member_provinceid")=company_provinceid
rs("Member_capitalid")=company_capitalid
rs("Member_cityid")=company_cityid
rs("Member_licence")=company_licence
rs("Member_trade")=company_trade
rs("Member_ecoclass")=company_ecoclass
rs("Member_founddate")=company_founddate
rs("Member_fund")=company_fund
rs("Member_workers")=company_workers
rs("Member_introduce")=company_introduce
rs("Member_address")=company_address
rs("Member_post")=company_post
rs("Member_contact")=company_contact
rs("Member_tel")=company_tel
rs("Member_telshowflag")=company_telshowflag
rs("Member_mobile")=company_mobile
rs("Member_mobileshowflag")=company_mobileshowflag
rs("Member_fax")=company_fax
rs("Member_email")=company_email
rs("Member_emailshowflag")=company_emailshowflag
rs("Member_url")=company_url
rs.update
rs.close
'同步企业招聘联系方式
if resetcontactinfo=1 then
sql="select * from JOB_C_hire where hire_cmember='"&cmember_login&"'"
rs.open sql,conn,1,3
if not rs.eof then
rs("hire_address")=company_address
rs("hire_post")=company_post
rs("hire_contact")=company_contact
rs("hire_tel")=company_tel
rs("hire_telshowflag")=company_telshowflag
rs("hire_fax")=company_fax
rs("hire_email")=company_email
rs("hire_emailshowflag")=company_emailshowflag
rs.update
end if
rs.close
set rs=nothing
end if
'更新静态页面
set rsuc=conn.execute("select * from JOB_Channel where ChannelID=2")
	UseCreateHTML=rsuc("UseCreateHTML")
set rsuc=nothing
if  CreateHTML=1 and UseCreateHTML<>0 then
	Call CompanyContentHtml(Member_id) '生成企业介绍页面
	Call HireListContentHtml(Member_id) '生成企业职位列表页面
end if
Response.Cookies(FRHRCMS)("user_name")=company_name
Response.Write ("<script language=JavaScript>{alert('资料更新成功！');location.href='company_info.asp';}</script>")
response.End()
End Sub%>
<script language = "JavaScript" src="../js/GetProvince.js"></script>
<script language = "JavaScript">
function changeProvince(selvalue)
{
document.cominfoform.capital.length=0; 
document.cominfoform.city.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 changeCity(selvalue)  
{ 
	document.cominfoform.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 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.province.add(newOption4);
		}
	}
}
selectprovince();
<%if SiteMode="1" then
	if cmember_cityid="" or isnull(cmember_cityid) then
	Response.Write "changeCity("&Sitecapital&");"
	end if
end if%>
</script>