

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>= 150/150){ 
   if(image.width>150){
    ImgD.width=150; 
    ImgD.height=(image.height*150)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   //ImgD.alt="More Info..."; 
  } 
  else{ 
   if(image.height>150){
    ImgD.height=150; 
    ImgD.width=(image.width*150)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   //ImgD.alt="More Info..."; 
  } 
 }
}

function resizeimg2(ImgD,iwidth,iheight){ 
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= iwidth/iheight){ 
   if(image.width>iwidth){
    ImgD.width=iwidth; 
    ImgD.height=(image.height*iwidth)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   //ImgD.alt="More Info..."; 
  } 
  else{ 
   if(image.height>iheight){
    ImgD.height=iheight; 
    ImgD.width=(image.width*iheight)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   //ImgD.alt="More Info..."; 
  } 
 }
}

function resizeimg(ImgD,iwidth,iheight) {
	
	var o_w = ImgD.width ;
	var o_h = ImgD.height ;
	
	if  ( o_w > iwidth ){
		ImgD.width = iwidth ;
		ImgD.height = o_h * ( iwidth / o_w ) ;
		ImgD.style.width = iwidth + "px";
		ImgD.style.height = o_h * ( iwidth / o_w ) + "px";
	}
 
	var o_w2 = ImgD.width ; 
	var o_h2 = ImgD.height ; 
 
		
	if  ( o_h2 > iheight ){
		ImgD.height = iheight ;
		ImgD.width = o_w2 * ( iheight / o_h2 ) ;
		ImgD.style.height = iheight + "px";
		ImgD.style.width = o_w2 * ( iheight / o_h2 ) + "px";
	}
	 
	 
//     if(image.width>0 && image.height>0){
//        if(image.width/image.height>= iwidth/iheight){
//           if(image.width>iwidth){
//               ImgD.width=iwidth;
//               ImgD.height=(image.height*iwidth)/image.width;
//           }else{
//                  ImgD.width=image.width;
//                  ImgD.height=image.height;
//                }
//               //ImgD.alt=image.width+""+image.height;
//        }
//        else{
//                if(image.height>iheight){
//                       ImgD.height=iheight;
//                       ImgD.width=(image.width*iheight)/image.height;
//                }else{
//                        ImgD.width=image.width;
//                        ImgD.height=image.height;
//                     }
//                //ImgD.alt=image.width+""+image.height;
//            }
//		//ImgD.style.cursor= "pointer";  
//    }
}
 
 
function resizepaintingimg(ImgD) {
	 resizeimg(ImgD,150,150);
}

function resizeartistimg(ImgD) {
	 resizeimg(ImgD,150,150);
}

function resizemuseumimg(ImgD) {
	 resizeimg(ImgD,150,150);
}

function resizeartstyleimg(ImgD) {
	 resizeimg(ImgD,150,150);
}

function resizegoodsimg(ImgD) {
	 resizeimg(ImgD,350,450);
}

function oilproductonload(){
	resizegoodsimg(document.getElementById("goodsimg"));
}
