﻿//重设图片高宽,调用方式onload="DrawImage(this,300,400)"
function autoReject(obj, maxWidth, maxHeight){    
    var img = new Image();      
    img.src = obj.src;    
    //如果图片的长宽比大于默认大小的长宽比，则按照宽度来调整    
    if(img.width/img.height > maxWidth/maxHeight) {    
        if(img.width >=maxWidth) {    
           obj.width = maxWidth;    
        obj.height = (img.height/ img.width) * maxWidth;     
        }    
    }    
    else { 
        if(img.height>=maxHeight) {    
        obj.height = maxHeight;    
        obj.width = (img.width/ img.height) * maxHeight;     
        }    
       
    }         
    delete img;    
}
function ImageOver(Mainimage)
{

var img = document.getElementById('productpicture');
img.src=Mainimage;	
}
