// JScript ÎÄ¼þ

 var flag=false;
function scalePhoto(ImgD,imgwidth,imgheight){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= imgwidth/imgheight){
if(image.width>imgwidth){ 
ImgD.width=imgwidth;
ImgD.height=(image.height*imgwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
else{
if(image.height>imgheight){ 
ImgD.height=imgheight;
ImgD.width=(image.width*imgheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
}
} 



