
function setImage( ImgD, bw, bh ){ 

	 var image = new Image(); 
	 
	 image.src = ImgD.src; 
 
	 if( image.width > 0 && image.height > 0 ) { 
	  
		  if( image.width / image.height >= bw / bh ) { 
		
			    ImgD.width=bw; 
			    ImgD.height=(image.height*bw)/image.width; 
   	
		  } 
		  else { 
 
				    ImgD.height=bh; 
				    ImgD.width=(image.width*bh)/image.height; 
		
		  } 
		    

	 }
	}
	 
