var flag=false; 
var sdwidth=110;//max width
var sdheight=110;//max height
function DrawImage(ImgD){ 

var image=new Image(); 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
flag=true; 
if(image.width/image.height>= sdwidth/sdheight){ 
if(image.width>sdwidth){ 
ImgD.width=sdwidth; 
ImgD.height=(image.height*sdwidth)/image.width; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
ImgD.alt=image.width+"x"+image.height; 
} 
else{ 
if(image.height>sdheight){ 
ImgD.height=sdheight; 
ImgD.width=(image.width*sdheight)/image.height; 
}else{ 
ImgD.width=image.width; 
ImgD.height=image.height; 
} 
ImgD.alt=image.width+"x"+image.height; 
} 
} 
}