var  flag=false;  
function  DrawImage(ImgD){  
     var  image=new  Image();  
     image.src=ImgD.src;  
     if(image.width>0  &&  image.height>0){  
       flag=true;  
       if(image.width/image.height>=  500/625){  
         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+" pixes"; 
         }  
       else{  
         if(image.height>625){      
         ImgD.height=625;  
         ImgD.width=(image.width*625)/image.height;            
         }else{  
         ImgD.width=image.width;      
         ImgD.height=image.height;  
         }  
         ImgD.alt=""+image.width+"×"+image.height+" pixes"; 
         }  
       }  
}    

function  DrawImages(ImgD){  
     var  image=new  Image();  
     image.src=ImgD.src;  
     if(image.width>0  &&  image.height>0){  
       flag=true;  
       if(image.width/image.height>=  120/150){  
         if(image.width>120){      
         ImgD.width=120;  
         ImgD.height=(image.height*120)/image.width;  
         }else{  
         ImgD.width=image.width;      
         ImgD.height=image.height;  
         }  
         //ImgD.alt="原稿为"+image.width+"×"+image.height+"像素"; 
         }  
       else{  
         if(image.height>150){      
         ImgD.height=150;  
         ImgD.width=(image.width*150)/image.height;            
         }else{  
         ImgD.width=image.width;      
         ImgD.height=image.height;  
         }  
         //ImgD.alt="原稿为"+image.width+"×"+image.height+"像素";
         }  
       }  
}  

			function FileChange1(Value){
			flag=false;
			document.getElementById("uploadimages1").width=120;
			document.getElementById("uploadimages1").height=150;
			document.getElementById("uploadimages1").alt="产品缩略图";
			
			document.getElementById("uploadimage1").width=500;
			document.getElementById("uploadimage1").height=625;
			document.getElementById("uploadimage1").alt="产品大图片";
			document.getElementById("uploadimage1").src=Value;
			document.getElementById("uploadimages1").src=Value;
		}
			function FileChange2(Value){
			flag=false;
			document.getElementById("uploadimages2").width=120;
			document.getElementById("uploadimages2").height=150;
			document.getElementById("uploadimages2").alt="产品缩略图";
			
			document.getElementById("uploadimage2").width=500;
			document.getElementById("uploadimage2").height=625;
			document.getElementById("uploadimage2").alt="产品大图片";
			document.getElementById("uploadimage2").src=Value;
			document.getElementById("uploadimages2").src=Value;
		}

			function FileChange3(Value){
			flag=false;
			document.getElementById("uploadimages3").width=120;
			document.getElementById("uploadimages3").height=150;
			document.getElementById("uploadimages3").alt="产品缩略图";
			
			document.getElementById("uploadimage3").width=500;
			document.getElementById("uploadimage3").height=625;
			document.getElementById("uploadimage3").alt="产品大图片";
			document.getElementById("uploadimage3").src=Value;
			document.getElementById("uploadimages3").src=Value;
		}

// 表单提交客户端检测
function doSubmit()
{
  if (document.upload.S_Name.value=="")
  {
    alert("产品中文名称不能为空！");
	document.upload.S_Name.focus();
	return false;
  }
  
  
  if (document.upload.E_Name.value=="")
  {
    alert("产品英文名称不能为空！");
	document.upload.E_Name.focus();
	return false;
  }  
  
  if (document.upload.Product_Catalogs.value=="")
  {
    alert("不能指定含有子分类的类别！");
	document.upload.Product_Catalogs.focus();
	return false;
  }   
  
   if (document.upload.Serial_Number.value=="")
  {
    alert("请填写产品的编号！");
	document.upload.Serial_Number.focus();
	return false;
  }   
    
  if (document.upload.Secrecy.checked)
  {
      if (document.upload.Validity.value=="")
       {
          alert("请设定保密产品的有效期！");
	      document.upload.Validity.focus();
	      return false;
	   }
  } 
  else
  {  
       if (document.upload.Validity.value!="")
         { alert("您已设置保密产品的有效期，但未勾选推荐选项！");
	       document.upload.Secrecy.focus();
	       return false;
		  }
  }
   
  if (document.upload.Pic_1.value==""&&document.upload.Pic_2.value==""&&document.upload.Pic_3.value=="")
  {
    alert("请选择您要上传的产品图片！");
	document.upload.Pic_1.focus();
	return false;
  }

 return true;
}
