// JavaScript Document
function imgClip(img,w,h) 
{ 
  var ratio=img.width/img.height; 
  if(ratio<(w/h)) 
  { 
    img.width=w; 
    img.height=Math.round(w/ratio); 
    img.style.marginTop=(h-img.height)/2+"px"; 
  }else{ 
    img.height=h; 
    img.width=Math.round(w*ratio); 
    img.style.marginLeft=(w-img.width)/2+"px";    
  }    
} 

