// 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; } }