
function msgform(theForm)
{
	
	
	
	if (theForm.MG_name.value=="") {
    window.alert("请输入姓名!");
    theForm.MG_name.focus();
    return (false);
  }
  
  var telephone=theForm.MG_tel.value;
    for(i=0;i<telephone.length;i++)
	   {
		char=telephone.charAt(i);		
		if(!('0'<=char&&char<='9'||char=='('||char==')'||char=='*'))
		   {		
			  alert("联系电话必须是数字'");
		      theForm.MG_tel.focus();
			  return false;
		    }
	    } 
		
  
  if (theForm.MG_email.value=="") {
    window.alert("请输入E_mail!");
    theForm.MG_email.focus();
    return (false);
  }
   if(theForm.MG_email.value.length!=0)
  {
    if (theForm.MG_email.value.charAt(0)=="." ||        
         theForm.MG_email.value.charAt(0)=="@"||       
         theForm.MG_email.value.indexOf('@', 0) == -1 || 
         theForm.MG_email.value.indexOf('.', 0) == -1 || 
        theForm.MG_email.value.lastIndexOf("@")==theForm.MG_email.value.length-1 || 
         theForm.MG_email.value.lastIndexOf(".")==theForm.MG_email.value.length-1)
     {
      alert("E_mail格式不正确！");
      theForm.MG_email.focus();
      return false;
      }
   }
  
  if (theForm.MG_title.value=="") {
    window.alert("请填写留言标题!");
    theForm.MG_title.focus();
    return (false);
  }	
  

			  
  if (theForm.MG_content.value=="") {
    window.alert("请填写留言!");
    theForm.MG_content.focus();
    return (false);
  }	
  

   if (theForm.validatecode.value=="") {
    window.alert("请填写验证码!");
    theForm.validatecode.focus();
    return (false);
  }	
 
	
}

var  flag=false;  
function  DrawImage(ImgD){  
 var  image=new  Image();  
 image.src=ImgD.src;  
flag=true;  
 if(image.width>400){  
 ImgD.width=400;  
 ImgD.height=(image.height*400)/image.width;  
 }else{  
 ImgD.width=image.width;  
 ImgD.height=image.height;  
 }  
 ImgD.alt=image.width+"×"+image.height +"px";  
 }  

