var objWin;
var timerID;

function fitimg() {
  myImage = objWin.document.getElementById('myImage');

  if (myImage.complete==undefined || myImage.complete) {  
    clearInterval(timerID); 
 
    w=myImage.width;
    h=myImage.height; 
 
    ua=navigator.userAgent;
   
    if(ua.indexOf("Firefox",0)>=0) {
      objWin.innerWidth=w;
      objWin.innerHeight=h;
    } else if(ua.indexOf("MSIE",0)>=0) {
      objWin.resizeTo(w,h);
      objWin.resizeBy(w-objWin.document.body.clientWidth,
              h-objWin.document.body.clientHeight-16);
    } 

    objWin.document.close();
  }
}

function popup(url){
  
 if ( objWin ) {
      objWin.close();
 }

  objWin=window.open("","myWindow","width=300,height=300");

  objWin.document.open();
  objWin.document.write("<html><head><title>Nagasaki Bio Park Zoo Animals<\/title><\/head>");
  objWin.document.write("<body style='margin:0px;padding:0px;background-color:#eee'>");
  objWin.document.write("<img src='"+url+"' id='myImage'>");
  objWin.document.write("<\/body><\/html>");

  timerID=setInterval('fitimg()', 500);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

