var nWidth="", nHeight="";
function init_picGallery() {
  nWidth=300;
  nHeight=300;
  if(window.document.main_pic)
  	show(window.document.main_pic);
}
function show(obj,w,h)
{
  var w=nWidth;
  var h=nHeight;
  if(w=="") w = 250;
  if(h=="") h = 250;
  Download(obj);
  var pic = "";
  if(window.document.main_pic) pic = window.document.main_pic;
  else pic=obj;
  pic.src = obj.src;
  pic.width = obj.width;
  pic.height = obj.height;
  setImageSize(pic,w,h);
}
function Download(img) {
 if (img.complete) { return true; }
 else setTimeout("Download()", 1000);
}
function setImageSize(pic,w,h)
{
  if(pic.width >w){
    var per = ((pic.width-w)/pic.width)*100;
    var per2= (per/100)*pic.height;
    pic.width = w;
    pic.height = pic.height -per2;
  }
  if(pic.height >h){
    var per = ((pic.height-h)/pic.height)*100;
    var per2= (per/100)*pic.width;
    pic.height = h;
    pic.width = pic.width -per2;
  }
}
