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 newWindow(url){
  objWin=window.open("","myWindow","width=640,height=480,resizable=yes,scrollbars=yes");

  objWin.document.open();
  objWin.document.write("<html><head><title>HOPハウジングオペレーション</title></head>");
  objWin.document.write("<body style='margin:0; padding:0;'>");
  objWin.document.write("<img src='"+url+"' id='myImage'>");
  objWin.document.write("</body></html>");

  timerID=setInterval('fitimg()', 100);
}