function resizeimg(img){
	reDrawImg(img,90);
}
function reDrawImg(img,w){
	if(img&&w){
		var height=img.height;
		var width=img.width;
		var hl = 0;
		var wl = 0;
		if(height>w){
			hl = parseFloat(w/height);
		}
		if(width>w){
			wl = parseFloat(w/width);
		}
		if(hl<wl){
			img.width = width*hl;
			img.height = w;
		}else{
			img.width = w;
			img.height = height*wl;
		}
	}
}
function drawImage(ImgD,FitWidth,FitHeight){	
   var image=new Image();
   image.src=ImgD.src;
    if(image.width>0 && image.height>0){
         if(image.width/image.height>= FitWidth/FitHeight){
             if(image.width>FitWidth){
                 ImgD.width=FitWidth;
                 ImgD.height=(image.height*FitWidth)/image.width;
             }else{
                 ImgD.width=image.width;
                 ImgD.height=image.height;
             }
         } else{
             if(image.height>FitHeight){
                 ImgD.height=FitHeight;
                 ImgD.width=(image.width*FitHeight)/image.height;
             }else{
                 ImgD.width=image.width;
                 ImgD.height=image.height;
             }
         }
     }
 } 
