function resizeimg(ImgD,iwidth,iheight) {
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>image.height){
		ImgD.width=iwidth;
		ImgD.height=(image.height*iwidth)/image.width;
		if(ImgD.height>iheight){
			ImgD.width=(iwidth*iheight)/ImgD.height;
			ImgD.height=iheight;
		}
	}else{
		ImgD.height=iheight;
		ImgD.width=(image.width*iheight)/image.height;
		if(ImgD.width>iwidth){
			ImgD.height=(iheight*iwidth)/ImgD.width;
			ImgD.width=iwidth;
		}
	}
}
