	function $ ( pElementID ) {
		return document.getElementById(pElementID);
	}


  function checkName(cName){
	    //var sName = document.myform.name.value;
		var reg = /^[\a-zA-Z\u4E00-\u9FA5]+$/;
		if ( !reg.test(document.myform.name.value) ) {
			document.myform.name.value="";
			return false;
		}
		if ( document.myform.name.value.length<= 2) {
			document.myform.name.value="";	
			return false;
		}
		return true;
   }
   function checkEmail(cEmail){
	    if
		(!cEmail.value.match(/^\w+((-{1,2}\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-{1,2})[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)){
		document.myform.email.value="";
        return false;			
       }
	   return true;
   }
   function checkPhone(cPhone){
	   var sPhone = document.myform.phone.value ;
       if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(sPhone)))
	   { 
		  document.myform.phone.value="";
          return false; 
       }
	   return true;
   }  
   function checkTitle(cTitle){
	   if( document.myform.subt.value< 5){
		   document.myform.subt.value = "";
		   return false;
	     }
		   return true;
	}
	
	
	
	 var code ; //在全局 定义验证码
     function createCode()
     { 
       code = "";
       var codeLength = 4;//验证码的长度
       var checkCode = document.getElementById("checkCode");
       var selectChar = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');//所有候选组成验证码的字符，当然也可以用中文的
        
       for(var i=0;i<codeLength;i++)
       {     
        
       var charIndex = Math.floor(Math.random()*36);
       code +=selectChar[charIndex];
       
       
       }
//       alert(code);
       if(checkCode)
       {
         checkCode.className="code";
         checkCode.value = code;
       }
       
     }
     
    function validate (){
       var inputCode = document.getElementById("captcha").value;
       if(inputCode.length <=0)
       {
		   return false;
       }
       else if(inputCode != code )
       {
		  document.myform.captcha.value = "";
          createCode();//刷新验证码
		  return false;
       }       
	   return true;
     }   
function foucsForm(){	
   var mName = document.myform.name.value;
   var mEmail = document.myform.email.value;
   var mPhone = document.myform.phone.value;
   var mCaptcha = document.myform.captcha.value;
   if( mName == "姓名*" || mName.length<= 2){
	  alert("姓名不正确！！请重新填写！");
	  document.myform.name.focus();
	  return false;
	  }
   if( mEmail == "邮箱*" || mEmail == ""){
	  alert("邮箱不正确！！请重新填写！");
	  document.myform.email.focus();
	  return false;
	 }
   if( mPhone == "手机*" || mPhone == ""){
	  alert("手机号码不正确！！请重新填写！");
	  document.myform.phone.focus();
	  return false;
	}
   if( mCaptcha != code || mCaptcha == ""){
	  alert("请输入正确的验证码！！");
	  document.myform.captcha.focus();
	  return false;
   }
   return true;
}



function foucForm(){	
   var mName = document.myform.name.value;
   var mEmail = document.myform.email.value;
   var mPhone = document.myform.phone.value;
   var mSubt = document.myform.subt.value;
   var mMessage = document.myform.message.value;
   var mCaptcha = document.myform.captcha.value;
   if( mName == "姓名*" || mName.length<= 2){
	  alert("姓名不正确！！请重新填写！");
	  document.myform.name.focus();
	  return false;
	  }
   if( mEmail == "邮箱*" || mEmail == ""){
	  alert("邮箱不正确！！请重新填写！");
	  document.myform.email.focus();
	  return false;
	 }
   if( mPhone == "手机*" || mPhone == ""){
	  alert("手机号码不正确！！请重新填写！");
	  document.myform.phone.focus();
	  return false;
	}
   if( mSubt == "标题*" || mSubt == ""){
	  alert("请填写标题！！");
	  document.myform.subt.focus();
	  return false;
	}
   if( mMessage == ""){
	  alert("请输入详细内容！！");
	  document.myform.message.focus();
	  return false;
   }
   if( mCaptcha != code || mCaptcha == ""){
	   alert("请输入正确的验证码！！");
	  document.myform.captcha.focus();
	   return false;
   }
   return true;
}
