var right="<img src='../template/default/images/note_ok.gif'>";
var error="<img src='../template/default/images/note_error.gif'>";
var errorold="<img src='template/default/images/note_error.gif'>";
var rightold="<img src='template/default/images/note_ok.gif'>";
var okok="";
var okokok=rightold+"<font color=green > 符合要求!</font>";
var ok=right+"<font color=green > 符合要求!</font>";
var shopcomment_error_name=error+"<font color=\"red\">对不起,请填写您的用户名！</font>";
var shopcomment_error_pwd=error+"<font color=\"red\">对不起,请填写您的密码！</font>";
var shopcomment_error_code=error+"<font color=\"red\">对不起,请填写验证码！</font>";
var shopcomment_error_chrmark=error+"<font color=\"red\">对不起,请填写内容！</font>";
var shopcomment_error_chrmark1=error+"<font color=\"red\">对不起,内容仅限300汉字！</font>";
var user_length_error=error+"<font color=\"red\"> 用户名长度错误,3-24字符内！</font>";
var user_regist_ok=right+"<font color=\"green\">恭喜您，该用户名还未被注册，您可以使用这个用户名！</font>";
var user_regist_error=error+"<font color=\"red\"> 该用户名已经被注册，请选用其他用户名。</font>";
var waite_chk="检测中，请稍等...";
var pwd_nothing_error=error+"<font color=red > 请输入密码!</font>";
var pwd_length_error=error+"<font color=red > 密码不合法!最少6位(英文字母、数字)，区分大小写</font>";
var pwd_insert_align=error+"<font color=red > 请再一次输入遍您上面输入的密码</font>";
var pwd_same_error=error+"<font color=red > 两次密码不符，请重新输入</font>";
var email_nothing_error=error+"<font color=red > 请输入您的电子邮件地址</font>";
var email_error_error=error+"<font color=red > 电子邮件地址不符合规则!</font>";
var email_regist_error=error+'<font color=red > 该电子邮件地址已被注册!</font>';
var code_length_error=error+"<font color=red > 请正确输入验证码</font>";
var chrqq_nothing_error=error+"<font color=red > 请正确输入您的QQ号码</font>";
var chkanswer_nothing_error=error+"<font color=red > 请正确输入验证问题答案</font>";
var chkchrtruename_nothing_error=error+"<font color=red > 请正确输入您的企业名称</font>";
var chkqiyedizhi_nothing_error=error+"<font color=red > 请正确输入您的经营办公地址</font>";
var chkfaren_nothing_error=error+"<font color=red > 请正确输入法人代表名称</font>";
var chkchrtel_nothing_error=error+"<font color=red > 请正确输入您的企业联系电话</font>";
var mysq_error_chraddress=error+"<font color=red > 请正确输入面试地点</font>";
var pass=/^[^#&/*<>'", \\\r\t\n]{6,16}$/;
function setmsg(obj,id){
	document.getElementById(obj).innerHTML = eval(id);
}
function doc(ob)
{
	var value=document.getElementById(ob).value;
	value=value.replace(/(^\s)|(\s$)/g,'');
	return value;
}
function getObj(ob)
{
	var obj=document.getElementById(ob);
	return obj;
}

//用于处理注册用户
function checkregister(){
	if(document.form1.checkxieyi){
		if(!document.form1.checkxieyi.checked){
			alert("请先阅读接受会员注册协议!");
			document.form1.checkxieyi.focus();
			return false;
		}
	}
	trimspace(document.form1.chrname);
	if(document.form1.chrname.value==""){
		setmsg('check','user_length_error');
		document.form1.chrname.focus();
		return false;
	}
	checkpwd();
	trimspace(document.form1.chrpwd);
	if(document.form1.chrpwd.value==""){
		setmsg('chkpwd','pwd_length_error');
		return false;
	}
	trimspace(document.form1.chrpwd_1);
	if(document.form1.chrpwd_1.value==""){
		setmsg('rchkpwd','pwd_insert_align');
		return false;
	}
	if(document.form1.chrpwd_1.value!=document.form1.chrpwd.value){
		setmsg('rchkpwd','pwd_same_error');
		return false;
	}
	trimspace(document.form1.chremail);
	if(document.form1.chremail.value==""){
	   	setmsg('chkemail','email_nothing_error')
		return false;
	}
	if(!isRightEmail(document.form1.chremail.value)){
	   	setmsg('chkemail','email_regist_error')
		return false;
	}
	trimspace(document.form1.chrqq);
	   var strEmail=document.form1.chrqq.value;	   
	   if(strEmail==""){
	   	setmsg('chkqq','chrqq_nothing_error')
		return false;
	   }else{	   	
	   	 setmsg('chkqq','okok');
	   }
	 if(document.form1.styleid.value=="2"){
			trimspace(document.form1.chrtruename);
			var strEmail=document.form1.chrtruename.value;	   
			if(strEmail=="" ){
			   setmsg('chkchrtruename','chkchrtruename_nothing_error')
			   return false;
			}else{	   	
			   setmsg('chkchrtruename','ok');
			 }
			trimspace(document.form1.qiyedizhi);
			var strEmail=document.form1.qiyedizhi.value;	   
			if(strEmail=="" ){
			   setmsg('chkqiyedizhi','chkqiyedizhi_nothing_error')
			   return false;
			}else{	   	
			   setmsg('chkqiyedizhi','ok');
			 }
			trimspace(document.form1.faren);
			var strEmail=document.form1.faren.value;	   
			if(strEmail.length<1 ){
			   setmsg('chkfaren','chkfaren_nothing_error')
			   return false;
			}else{	   	
			   setmsg('chkfaren','ok');
			 }
			trimspace(document.form1.chrtel);
			var strEmail=document.form1.chrtel.value;	   
			if(strEmail.length<7 ){
			   setmsg('chkchrtel','chkchrtel_nothing_error')
			   return false;
			}else{	   	
			   setmsg('chkchrtel','ok');
			 }
	}
	trimspace(document.form1.code);
	if(document.form1.code.value.length!=5){
	   	setmsg('chkcode','code_length_error')
		return false;
	}
	var detailsid="",answer="";
	if(document.form1.detailsid)
	{
		detailsid = document.form1.detailsid.value;
		answer = document.form1.answer.value;
	}
	var chrtruename="",qiyedizhi="",faren="",chrtel="";
	if(document.form1.styleid.value=="2")
	{
		chrtruename = document.form1.chrtruename.value;
		qiyedizhi = document.form1.qiyedizhi.value;
		faren = document.form1.faren.value;
		chrtel = document.form1.chrtel.value;
	}
	addregister(document.form1.chrname.value,document.form1.chrpwd.value,document.form1.chrpwd_1.value,document.form1.chremail.value,document.form1.code.value,document.form1.chrqq.value,detailsid,answer,chrtruename,qiyedizhi,faren,chrtel,document.form1.styleid.value);
	return false;
}
function addregister(chrname,chrpwd,chrpwd_1,chremail,code,chrqq,detailsid,answer,chrtruename,qiyedizhi,faren,chrtel,styleid)
{
      	var url="../request.aspx?action=register&chrname="+escape(chrname);
		url =url+"&chrpwd="+escape(chrpwd)+"&chrpwd_1="+escape(chrpwd_1)+"&chremail="+escape(chremail)+"&code="+escape(code)+"&chrqq="+escape(chrqq)+"&detailsid="+escape(detailsid)+"&answer="+escape(answer)+"&chrtruename="+escape(chrtruename)+"&qiyedizhi="+escape(qiyedizhi)+"&faren="+escape(faren)+"&chrtel="+escape(chrtel)+"&styleid="+escape(styleid);
		var  Digital=new  Date();
		Digital=Digital+40000;
		url=url+"&k="+Digital;
		xmlHttp=GetXmlHttpObject(requestaddregister)
		xmlHttp.open("get", url , true)
		xmlHttp.send(null)
}

function requestaddregister()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
			if(xmlHttp.responseText!=1)
			{
				alert(xmlHttp.responseText);	
			}
			else{
				var   f=document.createElement("IFRAME")   
				f.height=0;   
				f.width=0   
				f.src="../other.aspx?action=login"  
				document.body.appendChild(f) ;
				setTimeout("registeroutput()",2500);
			}
		}
	}
}
function registeroutput(){
	alert("恭喜您,注册成功并登陆成功!");	
	var tt = getCookie("floatregister");
	var nextcookiest= getCookie("nextcookie");
	delCookie("nextcookie");
	if(tt){
		parent.LoginHide();
		if(nextcookiest.indexOf("2,")!=-1){
			nextcookiest = nextcookiest.replace("2,","");
			parent.showwybaoming(nextcookiest);
		}
		else if(nextcookiest.indexOf("1,")!=-1){
			nextcookiest = nextcookiest.replace("1,","");
			parent.showorder(nextcookiest);
		}
	}
	else{
		var sss=getCookie("registergoto");
		if(sss)
		{
			window.location.href=sss;
		}
		else{
			window.location.href="../";
		}
	}	
}
function checkfloatregister(){
	trimspace($$("chrname"));
	if($$("chrname").value==""){
		alert("对不起,用户名长度错误,3-24字符内！");
		$$("chrname").focus();
		return false;
	}
	trimspace($$("chrpwd"));
	if($$("chrpwd").value.length<6){
		alert("对不起,密码不合法!最少6位(英文字母、数字)，区分大小写!");
		$$("chrpwd").focus();
		return false;
	}
	trimspace($$("chrpwd_1"));
	if($$("chrpwd_1").value==""){
		alert("对不起,请输入确认密码!");
		$$("chrpwd_1").focus();
		return false;
	}
	if($$("chrpwd_1").value!=$$("chrpwd").value){
		alert("对不起,两次输入的密码不一致!");
		$$("chrpwd_1").focus();
		return false;
	}
	trimspace($$("chremail"));
	if($$("chremail").value==""){
	   	alert("对不起,请输入电子邮件!");
		$$("chremail").focus();
		return false;
	}
	if(!isRightEmail($$("chremail").value)){
	   	alert("对不起,请正确输入电子邮件!");
		$$("chremail").focus();
		return false;
	}
	trimspace($$("chrqq"));
	   var strEmail=doc('chrqq');	   
	   if(strEmail==""){
	   	alert("对不起,请输入联系QQ!");
		$$("chrqq").focus();
		return false;
	   }
	 if(document.form1.styleid[1].checked){
			trimspace($$("chrtruename"));
			var strEmail=doc('chrtruename');	   
			if(strEmail=="" ){
				alert("对不起,请正确输入企业名称!");
				$$("chrtruename").focus();
			   return false;
			}
			trimspace($$("qiyedizhi"));
			var strEmail=doc('qiyedizhi');	   
			if(strEmail=="" ){
				alert("对不起,请正确输入企业地址!");
				$$("qiyedizhi").focus();
			   return false;
			}
			trimspace($$("faren"));
			var strEmail=doc('faren');	   
			if(strEmail.length<3 ){
				alert("对不起,请正确输入法人代表!");
				$$("faren").focus();
			   return false;
			}
			trimspace($$("chrtel"));
			var strEmail=doc('chrtel');	   
			if(strEmail.length<7 ){
				alert("对不起,请正确输入联系电话!");
				$$("chrtel").focus();
			   return false;
			}
	}
	var chrtruename="",qiyedizhi="",faren="",chrtel="",styleid="1";
	if(document.form1.styleid[1].checked)
	{
		styleid="2"
		chrtruename = $$("chrtruename").value;
		qiyedizhi = $$("qiyedizhi").value;
		faren = $$("faren").value;
		chrtel = $$("chrtel").value;
	}
	delCookie("floatregister");
	setCookie("floatregister","1");
	addregister($$("chrname").value,$$("chrpwd").value,$$("chrpwd_1").value,$$("chremail").value,"",$$("chrqq").value,"agan","",chrtruename,qiyedizhi,faren,chrtel,styleid);
	return false;

}

