//信息反馈
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 fucCheckNUM(NUM)
{
 var i,j,strTemp;
 strTemp="0123456789.";
 if ( NUM.length== 0)
  return 0
 for (i=0;i<NUM.length;i++)
 {
  j=strTemp.indexOf(NUM.charAt(i)); 
  if (j==-1)
  {
  //说明有字符不是数字
   return 0;
  }
 }
 //说明是数字
 return 1;
}

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 (fucCheckNUM(document.form1.WorkYears.value)==0)
	{
		alert("工作年限应该为数字。")
		document.form1.WorkYears.focus();
		return false;
	}
	 if(document.form1.computerlevel.value=="")
   {alert("请填写计算机能力!!");
   document.form1.computerlevel.focus();
   form1.computerlevel.style.backgroundColor = "#fffff0";
     return false;
	 }	
	 	
 var reg=/^\d{10,12}$/;
;
 if(reg.test(form1.tel.value)==false)
 {
   alert("请输入正确的手机号码或小灵通号码");
   form1.tel.focus();
   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 SetHomePage(obj)
{
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage('www.chameleon.com');
}

//友情链接
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  //eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  var strUrl = selObj.options[selObj.selectedIndex].value
  window.open(strUrl,'link')
  if (restore) selObj.selectedIndex=0;
}

//Vote
function winOpen(){
	window.open ('voteCheck.asp','','width=400,height=360,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=400,height=360,top=0,left=0,resizable=yes');
								strHtml = "&nbsp;<br><font color=red>投票成功,感谢您的参与。</font>";
								strHtml = strHtml+"&nbsp;<br><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);
	
}
