//信息反馈
function checkinfo(){
  
	if(form1.truename.value==""){
	    alert("请输入您的姓名!");
	    form1.truename.focus();
	    form1.truename.style.backgroundColor = "#fffff0";
	    return false;   
	}   
	if (form1.Email.value != ""){
			if (form1.Email.value.indexOf('@') == -1 || form1.Email.value.indexOf('.') == -1) {
					alert("对不起，您的EMAIL地址写错了。");
					form1.Email.focus();
					form1.Email.style.backgroundColor = "#fffff0";
					return false;
			}
	}
	if (form1.Content.value.length < 1){
			alert('请写上反馈内容。');
			form1.Content.focus();
			form1.Content.style.backgroundColor = "#fffff0";
			return false;
	}
	if (form1.Content.value.length > 1000){
			alert('反馈内容的字数请控制在1000字以内。');
			form1.Content.focus();
			form1.Content.style.backgroundColor = "#fffff0";
			return false;
	}

}

//搜索
function schform_onsubmit() {
		if (schform.keyword.value.length < 1){
				alert("请您输入关键字。");
				schform.keyword.focus();
				schform.keyword.style.backgroundColor = "#fffff0";
				return false;
		}
		return true;
}

//邮件
function IsEmail(str){
  var nLen;
  var nCnt1, nCnt2;
  nCnt1=0;
  nCnt2=0;
  nLen = str.length;
  for(var i=0; i<nLen; i++){
      if(str.charAt(i)==' '){
          return false;}
      if(str.charAt(i)=='\'' || str.charAt(i)=='\"'){
          return false;}
      if(str.charAt(i)=='<' || str.charAt(i)=='>' ){
          return false;}
      if(str.charAt(i)=='@'){
          nCnt1++;}
      if(str.charAt(i)=='.'){
          nCnt2++;}
  }
  if( nCnt1!=1 || nCnt2<1){
      return false;
  }
  else
      return true;
}

//应聘
function checkjob(){

 if(document.form1.title.value=="")
   {alert("请填写应聘职位。");
   document.form1.title.focus();
   form1.title.style.backgroundColor = "#fffff0";
     return false;
    }
	if(document.form1.xinjinyaoqiu.value=="")
   {alert("请填写薪金要求。");
   document.form1.xinjinyaoqiu.focus();
   form1.xinjinyaoqiu.style.backgroundColor = "#fffff0";
     return false;
    }
	if(document.form1.zhenshiname.value=="")
   {alert("请填写真实姓名。");
   document.form1.zhenshiname.focus();
   form1.zhenshiname.style.backgroundColor = "#fffff0";
     return false;
    }

	if(document.form1.mingz.value=="")
   {alert("请填写民族。");
   document.form1.mingz.focus();
   form1.mingz.style.backgroundColor = "#fffff0";
     return false;
    }
	if(document.form1.marry.value=="")
   {alert("请填写婚姻状况。");
   document.form1.marry.focus();
   form1.marry.style.backgroundColor = "#fffff0";
     return false;
    }
	
	if(document.form1.hukou.value=="")
   {alert("请填写户口所在地。");
   document.form1.hukou.focus();
   form1.hukou.style.backgroundColor = "#fffff0";
     return false;
    }
	if(document.form1.address.value=="")
   {alert("请填写现居住地。");
   document.form1.address.focus();
   form1.address.style.backgroundColor = "#fffff0";
     return false;
    }
	if(document.form1.xueli.value=="")
   {alert("请填写最高学历。");
   document.form1.xueli.focus();
   form1.xueli.style.backgroundColor = "#fffff0";
     return false;
    }
	if(document.form1.biyexuexiao.value=="")
   {alert("请填写毕业学校。");
   document.form1.biyexuexiao.focus();
   form1.biyexuexiao.style.backgroundColor = "#fffff0";
     return false;
    }
	if(document.form1.FLlevel.value=="")
   {alert("请填写外语水平。");
   document.form1.FLlevel.focus();
   form1.FLlevel.style.backgroundColor = "#fffff0";
     return false;
	 }
	 if(document.form1.computerlevel.value=="")
   {alert("请填写计算机能力。");
   document.form1.computerlevel.focus();
   form1.computerlevel.style.backgroundColor = "#fffff0";
     return false;
	 }		 

}

//用户登陆
function loginCheck()
{
		if (document.loginForm.loginName.value.length<1)
		{
				alert("请输入您的用户名。");
				document.loginForm.loginName.focus();
				loginForm.loginName.style.backgroundColor = "#fffff0";
				return false;
		}
		if (document.loginForm.loginPwd.value.length<1)
		{
				alert("请输入您的密码。");
				document.loginForm.loginPwd.focus();
				loginForm.loginPwd.style.backgroundColor = "#fffff0";
				return false;
		}
		return true;
}

//用户退出
function xlog()
{
		var url = location.href;
		location.href = "loginout.asp?url=" + url;
}

//新用户注册
function formPost() { //v2.0

		if (document.form1.username.value==""){
				alert("用户名不能为空!");
				document.form1.username.focus();
				form1.username.style.backgroundColor = "#fffff0";
				return false;
		}
		if (document.form1.pwd1.value == "")
		{
				alert("密码不能为空!");
				document.form1.pwd1.focus();
				form1.pwd1.style.backgroundColor = "#fffff0";
				return false;
		}
		if (document.form1.pwd1.value != document.form1.pwd2.value)
		{
				alert("两次密码输入不同!");
				document.form1.pwd2.focus();
				form1.pwd2.style.backgroundColor = "#fffff0";
				return false;
		}
		if (document.form1.realname.value == "")
		{
				alert("真实姓名不能为空!");
				document.form1.realname.focus();
				form1.realname.style.backgroundColor = "#fffff0";
				return false;
		}
		if (document.form1.tel.value!="")
		{
				if (isNaN(document.form1.tel.value)){
						alert("电话号码必须为数字。");
						document.form1.tel.focus();
						form1.tel.style.backgroundColor = "#fffff0";
						return false;
				}
		}
		if (document.form1.addr.value == "")
		{
				alert("请填写您的真实地址。");
				form1.addr.focus();
				form1.addr.style.backgroundColor = "#fffff0";
				return false;
		}
		if (document.form1.email.value!="")
		{
			if ((document.form1.email.value.indexOf("@") == -1) || (document.form1.email.value.indexOf(".") == -1)){
					alert("不正确的EMAIL地址.应该包含 @ . 等字符.");
					document.form1.email.focus();
					form1.email.style.backgroundColor = "#fffff0";
					return false;
			}
		}

}

//用户名是否被占用
function NameCheck()
{
		if (document.form1.username.value == "")
		{
				alert("用户名不能为空!");
				document.form1.username.focus();
				form1.username.style.backgroundColor = "#fffff0";
				return false;
		}
		document.NameCheck.hidden_name.value = document.form1.username.value;
		//alert(document.NameCheck.hidden_name.value);
		document.NameCheck.submit();
}

function checkform2(){
  if(document.gb.subject.value==""){
      alert("请输入留言主题!");
      gb.subject.focus();
      return false;
  }
  
  if(document.gb.g_name.value==""){
      alert("请输入您的姓名!");
      gb.g_name.focus();
      return false;   
  }   
  if(document.gb.tel.value==""){
      alert("请输入电话号码!");
      gb.tel.focus();
      return false;		
  }    
  if (document.gb.content.value==""){
      alert("请输入留言内容!");
      gb.content.focus();
      return false;
      }
  else
      return true;
}

//订单
function orderIt(id,cateName)
{
	window.open('orders.asp?Id='+id+'&cateName='+cateName,'','width=700,height=400');
}


//在线投票
function winOpen(){
	window.open ('voteCheck.asp','','width=350,height=380,top=0,left=0,resizable=yes');
}

function f(){
	
	var req = new ActiveXObject("Microsoft.XMLHTTP");
	req.open("GET","voteSave.asp?itemId="+itemId.value,true);
	//alert(itemId.value);
	req.onreadystatechange = function(){
			if (req.readyState == 4) {
					if (req.status == 200) {
						var reqVal = req.responseXML.documentElement.tagName;
						if (reqVal =='ok'){
								window.open ('voteCheck.asp','','width=350,height=380,top=0,left=0');
								strHtml = "&nbsp;<br><font color=red>投票成功,感谢您的参与。</font>";
								strHtml = strHtml+"<input type=button name=resear_Check value=' 查看 ' class=input_jump4 onclick='winOpen();'>";

						}
						else {
								strHtml = "&nbsp;<br><font color=red>对不起,您还没有选择。</font>";
								strHtml = strHtml+"&nbsp;<br><input type=button name=resear_back value=' 返回 ' class=input_jump4 onclick='location.reload()'>";									
						}
								document.getElementById("voteTab").innerHTML = strHtml;						
					}
			}
	}
	req.send(null);
	
}

//订单
function checkform(){
  if (document.gb.product.value=="")
  {
	  gb.product.style.backgroundColor = "#fffff0";
      alert("请填写订购产品的名称。");
      gb.product.focus();
      return false;
  }

  if(document.gb.user.value==""){
	  gb.user.style.backgroundColor = "#fffff0";
      alert("请填写联系人姓名。");
      gb.user.focus();
      return false;
  }
  
  if(document.gb.qiye.value==""){
	  gb.qiye.style.backgroundColor = "#fffff0";
      alert("请填写公司名称。");
      gb.qiye.focus();
      return false;   
  }   
  if(document.gb.tel.value==""){
	  gb.tel.style.backgroundColor = "#fffff0";
      alert("请填写电话号码。");
      gb.tel.focus();
      return false;   
  }   
      if (IsEmail(gb.email.value)==false){
          gb.email.style.backgroundColor = "#fffff0";
		  alert("请输入正确的邮件地址。");
          gb.email.focus();
          return false;
  }
  
  if (document.gb.memo.value==""){
      gb.memo.style.backgroundColor = "#fffff0";
	  alert("请填写你的订单内容。");
      gb.memo.focus();
      return false;
      }
  else
      return true;
}

//友情链接
function MM_jumpMenu(targ,selObj,restore)
{
  var strUrl = selObj.options[selObj.selectedIndex].value;
  window.open(strUrl,'link');
  if (restore) selObj.selectedIndex=0;
}