/**
  @check the book form
*/
function checkreson(form) {
   	if(trim(form.name.value) == '') {
	   alert('姓名不能为空');
	   form.name.focus();
	   return false
	}
   	if(trim(form.company.value) == '') {
	   alert('公司名称不能为空');
	   form.company.focus();
	   return false
	}
   	if(trim(form.tel.value) == '' || number(form.tel.value)==false) {
	   alert('联系电话不能为空或格式不对');
	   form.tel.focus();
	   return false
	}
   	if(trim(form.email.value) == '' || email(form.email.value) == false ) {
	   alert('电子邮箱为空或输入有效的E_mail无效！');
	   form.email.focus();
	   return false
	}
   	if(trim(form.model.value) == '') {
	   alert('型号不能为空');
	   form.model.focus();
	   return false
	}
   	if(trim(form.content1.value) == '' || trim(form.content1.value).length <= 10) {
	   alert('请输入问题原因,10个字符以上');
	   form.content1.focus();
	   return false
	}
	return true;
} 
/**
  @check the book form
*/
function checkbook(form) {
   	if(trim(form.name.value) == '') {
	   alert('姓名不能为空');
	   form.name.focus();
	   return false
	}
   	if(trim(form.email.value) == '' || email(form.email.value) == false ) {
	   alert('电子邮箱为空或输入有效的E_mail无效！');
	   form.email.focus();
	   return false
	}
   	if(trim(form.content.value) == '' || trim(form.content.value).length <= 10) {
	   alert('请输入10个字以上的留言内容');
	   form.content.focus();
	   return false
	}
	return true;
}
function checkbbs(form) {
   	if(trim(form.name.value) == '') {
	   alert('昵称不能为空');
	   form.name.focus();
	   return false
	}
   	if(trim(form.imgcode.value) == '') {
	   alert('验证号不能为空');
	   form.imgcode.focus();
	   return false
	}
   	if(trim(form.content.value) == '' || trim(form.content.value).length <= 10) {
	   alert('请输入10个字以上的留言内容');
	   form.content.focus();
	   return false
	}
	return true;
}
/**
  @check the search
*/
function checksearch(form) {
   	if(trim(form.pname.value) == '') {
	   alert('关键字为空');
	   form.pname.focus();
	   return false
	}
	return true;
} 
//去掉空格
function trim(s){
  return s.replace(/(\s*)/g, ""); 
}
function diplay(n){
     var p = document.getElementById('p'+n);
       // p.blur();
	     if(p.style.display=='none')
	     {
	        p.style.display='block';
	     } 
	     else if(p.style.display=='block')
	     {
	        p.style.display='none'; 
	     }
}
function show(n){
     var v = document.getElementById('v'+n);
       // p.blur();
	     if(v.style.display=='none')
	     {
	        v.style.display='block';
	     } 
	     else if(v.style.display=='block')
	     {
	        v.style.display='none'; 
	     }
}
//验证邮箱
function email(temp)
{
    var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	if(!myreg.test(temp))
	{
		return false;
	}
}
//验证电话号码或者手机
function number(temp)
{
    var myreg = /(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/;
	if(!myreg.test(temp))
	{
		return false;
	}
}
//本函数用于测试字符串sString(含双字节)的长度(非个数);
/*
function JHshStrLen(sString)
{
   var sStr,iCount,i,strTemp ;

   iCount = 0 ;
   sStr = sString.split("");
    for (i = 0 ; i < sStr.length ; i ++)
     {
         strTemp = escape(sStr[i]);
          if (strTemp.indexOf("%u",0) == -1)
          {
              iCount = iCount + 1 ;
          }
          else
          {
              iCount = iCount + 2 ;
          }
      }

      return iCount ;
}
*/