var flag=false; 
function DrawImage(ImgD,imax){ 
if(imax<0){
	imax=1;
}
var image=new Image(); 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= 170/160){ 
   if(image.width>170){
    ImgD.width=Math.floor(170*imax); 
    ImgD.height=Math.floor((image.height*160)/image.width*imax); 
   }else{ 
    ImgD.width=Math.floor(image.width*imax);
    ImgD.height=Math.floor(image.height*imax); 
   } 
   ImgD.alt="点击查看大图";
  } 
  else{ 
   if(image.height>160){
    ImgD.height=160*imax; 
    ImgD.width=(image.width*170)/image.height*imax; 
   }else{ 
    ImgD.width=Math.floor(image.width*imax);
    ImgD.height=Math.floor(image.height*imax); 
   } 
   ImgD.alt="点击查看大图"; 
  } 
}
}



////////////////////////////////////////////图片放大//////////////////////////
function show(img,maxi){
       var width=parseInt(img.width*maxi);    <!-- 图片放大倍数-->
	   var height = parseInt(img.height*maxi); <!-- 图片放大倍数-->
	   var src = img.src;
   	   var str = "<img src="+src+" width="+width+" height="+height+"  onmousewheel='return bbimg(this)' style='cursor:move;' alt='滚动将放大或缩小，双击将关闭' />";
	   document.getElementById("img").innerHTML = str;
	   document.getElementById("img").style.display="";
	   if(document.getElementById("pro")!=null){
		   document.getElementById("pro").style.display="none";   
		}
	   img.style.display="none";
	}
   function dis(div){//隐藏层显示图片
   		div.style.display="none";
		document.getElementById("msg").style.display="";
		if(document.getElementById("pro")!=null){
		   document.getElementById("pro").style.display="";   
		}
   }
   function change(img,msg){//更换图片
      document.getElementById(msg).src = img.src;
   }
///////////////////////以上三个方法配合使用/////////////////////////

////////////////////////图片随滚轮变大变小/////////////////////////
function bbimg(o){
	var zoom=parseInt(o.style.zoom,10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
	return false;
}

function maxImg(img){
	img.width=parseInt(img.width*1.5);
        img.height=parseInt(img.height*1.5);
}

function minImg(img){
	img.width=parseInt(img.width*0.5);
        img.height=parseInt(img.height*0.5)
}


