// JavaScript Document
function setPicRange(obj,picW,picH){
 if(obj.width>picW || obj.height>picH ){
  if(obj.width/obj.height>picW/picH  )
   obj.width=picW;
  else 
   obj.height=picH;
 }
}
