// JavaScript Document
function DrawImage(ImgD,width,height){ 
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>width || image.height>height)
    {
        imageRate1=parseInt(image.width)/width;
        imageRate2=parseInt(image.height)/height;
        if(imageRate2>imageRate1)
            ImgD.height = image.height/imageRate2;
        else
            ImgD.width = image.width/imageRate1;
    }

}