var flag=false; 
function s_pic(ImgD,size)
{
 var img_width=size;
 var img_height=size;
 var image=new Image(); 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0)
 { 
  flag=true; 
  if(image.width/image.height>= img_width/img_height)
  { 
    if(image.width>img_width)
	  { 
      ImgD.width=img_width; 
      ImgD.height=(image.height*img_width)/image.width; 
      }
	 else
	  { 
      ImgD.width=image.width; 
      ImgD.height=image.height; 
      } 
  } 
  else
 { 
     if(image.height>img_height)
	   { 
        ImgD.height=img_height; 
        ImgD.width=(image.width*img_height)/image.height; 
       }
	   else
	   { 
		ImgD.width=image.width; 
		ImgD.height=image.height; 
		} 
  } 
 } 
}