


var  flag=false;  
function  DrawImage(ImgD){  
 var  image=new  Image();  
 image.src=ImgD.src;  
flag=true;  
 if(image.width>500){  
 ImgD.width=500;  
 ImgD.height=(image.height*500)/image.width;  
 }else{  
 ImgD.width=image.width;  
 ImgD.height=image.height;  
 }  
 ImgD.alt=image.width+"×"+image.height +"px";  
 }  
 
 <!--  
var  flag=false;  
function  DrawImage2(ImgD){  
 var  image=new  Image();  
 image.src=ImgD.src;  
 if(image.width>0  &&  image.height>0){  
flag=true;  
if(image.width/image.height>=  300/300){  
 if(image.width>300){  
 ImgD.width=300;  
 ImgD.height=(image.height*300)/image.width;  
 }else{  
 ImgD.width=image.width;  
 ImgD.height=image.height;  
 }  
 ImgD.alt=image.width+"×"+image.height +"px";  
 }  
else{  
 if(image.height>300){  
 ImgD.height=300;  
 ImgD.width=(image.width*300)/image.height; 
 }else{  
 ImgD.width=image.width;  
 ImgD.height=image.height;  
 }  
 ImgD.alt=image.width+"×"+image.height+"px";  
 }  
}  
} 
//-->

	function getObject(objectId) {
			if(document.getElementById && document.getElementById(objectId)) {
			return document.getElementById(objectId);
			} 
			  else if (document.all && document.all(objectId)) {
			      return document.all(objectId);
			} 
			  else if (document.layers && document.layers[objectId]) {
			return document.layers[objectId];
			} 
			  else {
			return false;
		    }
			
			}
	
		function showmenu(n,num){
	      for(var i=1;i<=num;i++)
		      {
		         if (i==n){
				      getObject('tb'+i).style.display='';
					    }
				
				 else 
				       {
				getObject('tb'+i).style.display='none';
				        }
				}
         }
			
		
		function showmenu2(i){
	    
		   getObject('tb'+i).style.display='none';
		  
            }
	
		
	
 function tsform(theForm)
{
	
/*if (theForm.zbbh.value=="") {
    window.alert("请输入质保书编号!");
    theForm.zbbh.focus();
    return (false);
  }
  
  
  if (theForm.clmc.value=="") {
    window.alert("请输入产品名称!");
    theForm.clmc.focus();
    return (false);
  }*/
  
  if (theForm.clxh.value=="") {
    window.alert("请输入车辆型号称!");
    theForm.clxh.focus();
    return (false);
  }
  
    if (theForm.cxcx.value=="") {
    window.alert("请输入车型!");
    theForm.cxcx.focus();
    return (false);
  }
  if (theForm.clnf.value=="") {
    window.alert("请输入年份!");
    theForm.clnf.focus();
    return (false);
  }
  
  if (theForm.username.value=="") {
    window.alert("请输入车主姓名!");
    theForm.username.focus();
    return (false);
  }
   if (theForm.tel.value=="") {
    window.alert("请输入电话!");
    theForm.tel.focus();
    return (false);
  }
  
  if (theForm.card.value=="") {
    window.alert("请输入购买身份!");
    theForm.card.focus();
    return (false);
  }
  
  if (theForm.adr.value=="") {
    window.alert("请输入地址!");
    theForm.adr.focus();
    return (false);
  }
  
  if (theForm.email.value=="") {
    window.alert("请输入E_mail!");
    theForm.email.focus();
    return (false);
  }
   if(theForm.email.value.length!=0)
  {
    if (theForm.email.value.charAt(0)=="." ||        
         theForm.email.value.charAt(0)=="@"||       
         theForm.email.value.indexOf('@', 0) == -1 || 
         theForm.email.value.indexOf('.', 0) == -1 || 
        theForm.email.value.lastIndexOf("@")==theForm.email.value.length-1 || 
         theForm.email.value.lastIndexOf(".")==theForm.email.value.length-1)
     {
      alert("E_mail格式不正确！");
      theForm.email.focus();
      return false;
      }
   }
   
 
  
  
   
   if (theForm.gmrq.value=="") {
    window.alert("请输入购买日期!");
    theForm.gmrq.focus();
    return (false);
  }
   if (theForm.validatecode.value=="") {
    window.alert("请输入验证码!");
    theForm.validatecode.focus();
    return (false);
  }
  
}

 

