function setTitles(id){
	if(id==1){
		$('yb').className="index_a over";
		$('zs').className="index_b index_c r";
		$('qt').className="index_b index_c r";
		ajax.post('/indexDownload.do?sid=1201',function(obj){$('indexdown').innerHTML=obj.responseText});
	}else if(id==2){
		$('yb').className="index_b  r";
		$('zs').className="index_a index_c over";
		$('qt').className="index_b index_c r";
		ajax.post('/indexDownload.do?sid=1202',function(obj){$('indexdown').innerHTML=obj.responseText});
	}else{
		$('yb').className="index_b  r";
		$('zs').className="index_b index_c r";
		$('qt').className="index_a index_d over";
		ajax.post('/indexDownload.do?sid=1203',function(obj){$('indexdown').innerHTML=obj.responseText});
	}
}

function setefTitle(id){
	if(id==1){
		$('jb').className="index_a over2";
		$('cn').className="index_b1 index_c r";
		$('dt').className="index_b1 index_c r";
		$('eg').style.display="";
		$('np').style.display="none";
		$('yd').style.display="none";
	}else if(id==2){
		$('jb').className="index_b2 r";
		$('cn').className="index_a index_c over2";
		$('dt').className="index_b1 index_c r";
		$('eg').style.display="none";
		$('np').style.display="";
		$('yd').style.display="none";
	}else{
		$('jb').className="index_b2 r";
		$('cn').className="index_b1 index_c r";
		$('dt').className="index_a index_d over2";
		$('eg').style.display="none";
		$('np').style.display="none";
		$('yd').style.display="";
	}
}

function setebTitle(id){
	if(id==1){
		$('zh').className="index_a over";
		$('px').className="index_b3 index_c r";
		$('hd').className="index_b3 index_c r";
		$('eb1').style.display="";
		$('ta1').style.display="none";
		$('ac1').style.display="none";
	}else if(id==2){
		$('zh').className="index_b3 r";
		$('px').className="index_a index_c over";
		$('hd').className="index_b3 index_c r";
		$('eb1').style.display="none";
		$('ta1').style.display="";
		$('ac1').style.display="none";
	}else{
		$('zh').className="index_b3 r";
		$('px').className="index_b3 index_c r";
		$('hd').className="index_a index_d over";
		$('eb1').style.display="none";
		$('ta1').style.display="none";
		$('ac1').style.display="";
	}
}

function setppTitle(id){
	if(id==1){
		$('fa').className="index_a over";
		$('lw').className="index_b4 index_c r";
		$('sl').className="index_b4 index_c r";
		$('st').style.display="";
		$('pp').style.display="none";
		$('aa').style.display="none";
	}else if(id==2){
		$('fa').className="index_b4 r";
		$('lw').className="index_a index_c over";
		$('sl').className="index_b4 index_c r";
		$('st').style.display="none";
		$('pp').style.display="";
		$('aa').style.display="none";
	}else{
		$('fa').className="index_b4 r";
		$('lw').className="index_b4 index_c r";
		$('sl').className="index_a index_d over";
		$('st').style.display="none";
		$('pp').style.display="none";
		$('aa').style.display="";
	}
}

function setleTitle(id){
	if(id==1){
		$('zcfg').className="index_a1 over";
		$('zyks').className="index_b5 index_c1 r";
		$('zcfgcon').style.display="";
		$('zykscon').style.display="none";
	}else if(id==2){
		$('zcfg').className="index_b5 r";
		$('zyks').className="index_a1 index_c1 over";
		$('zcfgcon').style.display="none";
		$('zykscon').style.display="";
	}
}
function witreCateId(cateids){
	var cname;
	var cid;
	for(var i=0;i<oenCate.length;i++){
		cname=oenCate[i][0].split(',')[1];
		cid=oenCate[i][0].split(',')[0];
		document.write('<div class="Reg_cplx_a1"><p class="Reg_concent_a7ab">');	
		document.write(cname);
		document.write('</p><p class="Reg_concent_a8a" ><input type="checkbox" id="cateid" name="cateid" value="');
		document.write(cid);
		document.write('" class="Reg_f3" /></p></div>');
	}
}

function checdregfrom(){
	var name=$('userid').value;
	var pwd=$('pwd').value;
	var pwd1=$('pwd1').value;
	var email=$('email').value;
	var companyTypeId=$('companyTypeId').value;
	var workTypeId=$('workTypeId').value;
	var rand=$('rand').value;
	var userName_pro=$('userName_pro').value;
	if(name==''){
		alert('请输入用户名');
		$('userid').focus();
		return false;
	}
	if(!name.match(/^[0-9a-zA-Z]{4,20}$/)){
		alert('请输入正确的用户名');
		$('userid').focus();
		return false;
	}
	if(userName_pro==1){
		alert('该用户名已经存在');
		$('userid').focus();
		return false;
	}
	if(pwd==''){
		alert('请输入密码');
		$('pwd').focus();
		return false;
	}
	if (!pwd.match(/^[0-9a-zA-Z]{6,20}$/)){
		alert('请输入正确的密码');
		$('pwd').focus();
		return false;
	}
	if(pwd!=pwd1){
		alert('两次输入的密码不一致');
		$('pwd1').focus();
		return false;
	}
	if(email==''){
		alert('请输入邮箱');
		$('email').focus();
		return false;
	}
	//var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;  
	var pattern =/(\S)+[@]{1}(\S)+[.]{1}(\w)+/;
　	var flag = pattern.test(email);
	if (!flag){
		alert('请输入正确的邮箱');
		$('email').focus();
		return false;
	}
	if($('mail_pro').value==1){
		alert('请输入的邮箱已经存在');
		$('email').focus();
		return false;
	}
	if(workTypeId==0){
		alert('请选择职业');
		$('workTypeId').focus();
		return false;
	}
	if(companyTypeId==0){
		alert('请选择企业属性');
		$('companyTypeId').focus();
		return false;
	}
	if(rand==''){
		alert('请输入验证码');
		$('rand').focus();
		return false;
	}
	var a = document.getElementsByName("cateid"); 
    var n = a.length;
    var k = 0;
    for (var i=0; i<n; i++){
        if(a[i].checked){
            k = 1;
        }
    }
    if(k==0){
        alert("请您感兴趣的产品");
        return false;
    }
    var uid = document.getElementsByName("uiid"); 
    n = uid.length;
    k = 0;
    for (var i=0; i<n; i++){
        if(uid[i].checked){
            k = 1;
        }
    }
    if(k==0){
        alert("请您选择从事行业");
        return false;
    }
    
    if(!$('regCond').checked==true){
		alert('请先阅读电气163服务条款');
		return false;
	}
	$('subBut').innerHTML='<a href="javascript:alert(\'正在提交，请稍等\');"><img src="images/submission.gif" border="0"/></a>';
	return true;
}

function onFocusSet(len){
	if(len==1){
			$('name_pro').innerHTML="由4-20个字母或数字组成，注册后不能修改";
	}
	if(len==2){
			$('pwd_pro').innerHTML="6-20字母数字组成（区分大小写）";
	}
	if(len==3){
			$('pwd1_pro').innerHTML="请再输入一遍上面填写的密码";
	}
	if(len==4){
			$('email_pro').innerHTML="请输入您的邮箱";
	}
}
function onBlueSet(obj,len){
	var ajax=new AJAXRequest;
	var str;
	if(len==1){
		str=obj.value;
		if (!str.match(/^[0-9a-zA-Z]{4,20}$/) || str==''){
			$('name_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">用户名错误,必须由4-20字母数字组</p>';
			return false;
		}else{
			ajax.post('/checkusername.do?username='+str+'',function(obj){
			if(obj.responseText==0){$('name_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';$('userName_pro').value=0}
			else if(obj.responseText==-99){$('name_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">用户名在禁用名单中</p>';$('userName_pro').value=1}
			else{$('name_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">用户名已经存在</p>';$('userName_pro').value=1}
			});
		}
	}
	if(len==2){
		str=obj.value;
		if (!str.match(/^[0-9a-zA-Z]{6,20}$/) || str==''){
			$('pwd_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">错误，6-20字母数字（区分大小写）</p>';
			return false;
		}else{
			$('pwd_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
		}
	}
	if(len==3){
		if(""==$('pwd1').value){
			$('pwd1_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">密码不能为空</p>';	
			return false;
		}
		if($('pwd').value!=$('pwd1').value){
			$('pwd1_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">两次输入密码不一致</p>';	
			return false;
		}else{
			$('pwd1_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
		}
	}
	if(len==4){
		str=obj.value;
		var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;  
　　　　　var flag = pattern.test(str);
		if(!flag){
			$('email_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">请正确输入您的电子邮箱</p>';	
			return false;
		}else{
			ajax.post('/checkuseremale.do?email='+str+'',function(obj){
			if(obj.responseText==0){$('email_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';$('mail_pro').value=0;}else{$('email_pro').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">邮箱已经存在</p>';$('mail_pro').value=1}
			});
		}
	}
}
function getRand(){
		$('randKey').src="/images?"+Math.random();
}

function setComreg(id){
	if(id==1){
		$('content_1').innerHTML="由4-20个字母或数字组成，注册后不能修改";
	}
	if(id==2){
		$('content_2').innerHTML="6-20字母数字组成（区分大小写）";
	}
	if(id==3){
		$('content_3').innerHTML="请再输入一遍上面填写的密码";
	}
	if(id==4){
		$('content_4').innerHTML="请填写贵公司的联系人(2～30个汉字)";
	}
	if(id==5){
		$('content_'+id).innerHTML="请正确输入您常用的电话号码";
	}
	if(id==6){
		$('content_'+id).innerHTML="请正确输入您常用的电话传真";
	}
	if(id==7){
		$('content_'+id).innerHTML="请输入您常用的电子邮箱";
	}
}

function checkComreg(obj,len){
var ajax=new AJAXRequest;
	if(len==1){
			str=obj.value;
			if (!str.match(/^[0-9a-zA-Z]{4,20}$/) || str==''){
				$('content_1').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">用户名错误,必须由4-20字母数字组成</p>';
				return false;
			}else{
				ajax.post('/checkcomName.do?username='+str+'',function(obj){
				if(obj.responseText==0){$('content_1').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';$('userName_pro').value=0}
				else if(obj.responseText==0){$('content_1').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">用户名在禁用名单中</p>';$('userName_pro').value=1}
				else{$('content_1').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">用户名已经存在</p>';$('userName_pro').value=1}
				});
			}
	}
	if(len==2){
		str=obj.value;
		if (!str.match(/^[0-9a-zA-Z]{6,20}$/) || str==''){
			$('content_2').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">错误，6-20字母数字（区分大小写）</p>';
			return false;
		}else{
			$('content_2').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
		}
	}
	if(len==3){
		if(""==obj.value){
			$('content_3').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">密码不能为空</p>';	
			return false;
		}
		if($('userPwd').value!=obj.value){
			$('content_3').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">两次输入密码不一致</p>';	
			return false;
		}else{
			$('content_3').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
		}
	}
	if(len==4){
		if(obj.value.match(/^[0-9a-zA-Z]{0,20}$/) || ""==obj.value){
			$('content_4').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">请输入正确的联系姓名</p>';	
			return false;
		}else{
			$('content_4').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
		}
	}
	if(len==5){
		var str="";
		if(!$('phone_c').value.match(/^[0-9]{3,4}$/)){
			str=str+"地区区号不正确。";
		}
		if($('phone').value==''){
			str=str+"电话错误。";
		}
		if(str!=''){
			$('content_5').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">'+str+'</p>';
		}else{
			$('content_5').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
		}
	}
	if(len==6){
		var str="";
		if(!$('fax_c').value.match(/^[0-9]{3,4}$/)){
			str=str+"地区区号不正确。";
		}
		if($('fax').value==''){
			str=str+"传真输入错误。";
		}
		if(str!=''){
			$('content_6').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">'+str+'</p>';
		}else{
			$('content_6').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
		}
	}
	if(len==7){
		str=obj.value;
		var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;  
　　　　　var flag = pattern.test(str);
		if(!flag){
			$('content_7').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">请正确输入您的电子邮箱</p>';	
			return false;
		}else{
			ajax.post('/checkcomemale.do?email='+str+'',function(obj){
			if(obj.responseText==0){$('content_7').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';$('mail_pro').value=0;}else{$('content_7').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">邮箱已经存在</p>';$('mail_pro').value=1}
			});
		}
	}
	if(len==8){
		var userMobile=obj.value;
		var reg0 = /^13\d{3,9}$/;
	    var reg1 = /^15\d{3,9}$/;
	    var reg2 = /^18\d{3,9}$/;
	    var my = false;
	    if (reg0.test(userMobile))my=true;
	    if (reg1.test(userMobile))my=true;
	    if (reg2.test(userMobile))my=true;
	    if (userMobile.length!=11) my=false;
	    if (!my){
	         $('content_8').innerHTML='<p class="Reg_concent_a5"><img src="images/Reg_icon.gif" width="22" height="22" /></p><p class="Reg_concent_a6">请正确输入您的手机号</p>';	
	    }else{
	    	 $('content_8').innerHTML='<p class="Reg_concent_a5"><img src="images/r_ok.gif" width="22" height="22" /></p>';
	    }
	}
}
function setRegComBrand(str){
	var zm=new Array();
	zm[0]="A";zm[1]="B";zm[2]="C";zm[3]="D";zm[4]="E";
	zm[5]="F";zm[6]="G";zm[7]="H";zm[8]="I";zm[9]="J";
	zm[10]="K";zm[11]="L";zm[12]="M";zm[13]="N";zm[14]="O";zm[15]="P";
	zm[16]="Q";zm[17]="R";zm[18]="S";zm[19]="T";zm[20]="U";zm[21]="V";
	zm[22]="W";zm[23]="X";zm[24]="Y";zm[25]="Z";
	for(var i=0;i<zm.length;i++){
		if(zm[i]==str){
			$('link'+i).style.color='red';
			$('brand'+i).style.display='';
		}else{
			$('brand'+i).style.display='none';
			$('link'+i).style.color='';
		}
	}
}

function checkregForm(){
	var userName=$('userId').value;
	var userName_pro=$('userName_pro').value;
	var pwd=$('userPwd').value;
	var pwd1=$('pwd1').value;
	var linkman=$('linkman').value;
	var mail=$('mail').value;
	var moblie=$('moblie').value;
	var merchantsName=$('merchantsName').value;
	var address=$('address').value;
	var operation=$('operation').value;
	var rand=$('rand').value;
	if (!userName.match(/^[0-9a-zA-Z]{4,20}$/) || userName==''){
		alert('请输入正确的会员登录名');
		$('userId').focus();
		return false;
	}
	if(userName_pro==1){
		alert('该用户名已经存在');
		$('userid').focus();
		return false;
	}
	if (!pwd.match(/^[0-9a-zA-Z]{6,20}$/)){
		alert('请输入正确的密码');
		$('userPwd').focus();
		return false;
	}
	if(pwd!=pwd1){
		alert('两次输入的密码不一致');
		$('pwd1').focus();
		return false;
	}
	if(linkman.match(/^[0-9a-zA-Z]{0,20}$/) || ""==linkman){
		alert('请输入正确的联系人姓名');
		$('linkman').focus();
		return false;
	}
	if(!$('phone_c').value.match(/^[0-9]{3,4}$/)){
		alert('地区区号不正确。');
		$('phone_c').focus();
		return false;
	}
	if($('phone').value==''){
		alert('电话错误。');
		$('phone').focus();
		return false;
	}
	if(!$('fax_c').value.match(/^[0-9]{3,4}$/)){
		alert('地区区号不正确。');
		$('fax_c').focus();
		return false;
	}
	if($('fax').value==''){
		alert('电话错误。');
		$('fax').focus();
		return false;
	}
	var pattern =/(\S)+[@]{1}(\S)+[.]{1}(\w)+/;
　	var flag = pattern.test(mail);
	if (!flag){
		alert('请输入正确的邮箱');
		$('mail').focus();
		return false;
	}
	var reg0 = /^13\d{3,9}$/;
	var reg1 = /^15\d{3,9}$/;
	var reg2 = /^18\d{3,9}$/;
	var my = false;
	if (reg0.test(moblie))my=true;
	if (reg1.test(moblie))my=true;
	if (reg2.test(moblie))my=true;
	if (moblie.length!=11) my=false;
    if (!my){
    	alert('请输入正确的手机号码');
		$('moblie').focus();
		return false;
    }
	var a = document.getElementsByName("typeIds"); 
    var n = a.length;
    var k = 0;
    for (var i=0; i<n; i++){
        if(a[i].checked){
            k = 1;
        }
    }
    if(k==0){
        alert("请选择公司类型");
        return false;
    }
    if(merchantsName==''){
    	alert('请输入公司名称');
    	$('merchantsName').focus();
    	return false;
    }
    if(address==''){
    	alert('请输入公司地址');
    	$('address').focus();
    	return false;
    }
    if(operation==''){
    	alert('请输入主营业务');
    	$('operation').focus();
    	return false;
    }
    var cateid = document.getElementsByName("cateid"); 
    n = cateid.length;
    k = 0;
    for (var i=0; i<n; i++){
        if(cateid[i].checked){
            k = 1;
        }
    }
    if(k==0){
        alert("请选择经营产品类型");
        return false;
    }
    if(rand==''){
    	alert('请输入验证码');
    	$('rand').focus();
    	return false;
    }
    if(!$('regCond').checked==true){
		alert('请先阅读电气163服务条款');
		return false;
	}
	$('subBut').innerHTML='<a href="javascript:alert(\'正在提交，请稍等\');"><img src="images/reg/submission2.gif" border="0"/></a>';
	return true;
}
