// $Id: $&nbsp;
// javascript for Matrix-at-Burwood.com

function newWindow(url,width,height) {
  flags = "width=" + width + ",height=" + height + ",resizable=no,scrollbars=no,menubar=no,toolbar=no,status=no,location=no,alwaysraised=yes";
  window.open(url, "mywindow", flags);
}

function viewOverview(img)
{    
  wd = 865; 
  ht = 720;
  var args= "height=" + ht;
  args += ",width=" + wd;
  args += ",left=10,top=10,resizable=1,scrollbars=1";
  var text = "<html><head><title>Matrix At Burwood - Overview</title>";
  text += "<script language=\"javascript\" src=\"/matrix.js\" type=\"text/javascript\"></script>";
  text += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso8859-1\" />";
  text += "</head><body><center><h1 style='font-family: verdana, arial, helvetica, sans-serif;'>Proposed Development Overview</h1>";
  text += "<map name=\"OVERVIEW\">";
  text += "<area href=\"/images/l_p1-2007.jpg\" shape=\"rect\" coords=\"750, 0, 830, 125\" onClick=\"viewPic('/images/l_p1-2007.jpg'); return false;\">";
  text += "<area href=\"/images/l_p2-courtyard.jpg\" shape=\"rect\" coords=\"525, 150, 600, 225\" onClick=\"viewPic('/images/l_p2-courtyard.jpg'); return false;\">";
  text += "<area href=\"/images/l_p3-studiooffices.jpg\" shape=\"rect\" coords=\"300, 275, 375, 350\" onClick=\"viewPic('/images/l_p3-studiooffices.jpg'); return false;\">";
  text += "</map><img src=\"/images/l_overview.jpg\" width=\"839\" height=\"584\" border=\"0\" usemap=\"#OVERVIEW\" />";
  text += "<p style='font-family: verdana, arial, helvetica, sans-serif;'><a href='javascript:window.close()'>Close</a>&nbsp;&nbsp; <a href='javascript:printWindow()'>Print This Page</a></p></center></body></html>";

  preview = window.open("", "_blank", args);
  var tmp = preview.document;
  tmp.write(text);
  tmp.close();
}

function viewPic(img)
{    
    picfile = new Image(); 
    picfile.src =(img); 
    fileCheck(img); 
}

function fileCheck(img)
{    
    if( (picfile.width!=0) && (picfile.height!=0) )
    { 
        makeWindow(img); 
    }
    else 
    {
        funzione="fileCheck('"+img+"')"; 
        intervallo=setTimeout(funzione,8); 
    }
}

function makeWindow(img) {    
  wd = picfile.width + 40; 
  ht = picfile.height + 85;
  var args= "height=" + ht;
  args += ",width=" + wd;
  if (window.screen) { 
    var avht = screen.availHeight - 30; 
    var avwd = screen.availWidth - 10;
    var xcen = (avwd - wd) / 2; 
    var ycen = (avht - ht) / 2;
    args += ",left=" + xcen + ",screenX=" + xcen;
    args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=1,scrollbars=1";    
  }
  // return window.open(img, 'View', args); 
  var text = "<html><head>";
  text += "<script language='javascript' src='/matrix.js'></script>";
  text += "<title>Preview</title></head><body bgcolor='white'><center><img border='1' src='" + img + "'>";
  text += "<p style='font-family: verdana, arial, helvetica, sans-serif;'><a href='javascript:window.close()'>Close</a>&nbsp;&nbsp; <a href='javascript:printWindow()'>Print This Page</a></p></center></body></html>";

  preview = window.open("", "_blank", args);
  preview.document.open();
  preview.document.write(text);
  preview.document.close();
}

/*
 * Quick preview
 *
 * Call with <img src='thumb.jpg' onClick="Preview('big.jpg')">
 *

var isNav4, isIE4;
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
isNav4 = (navigator.appName == "Netscape") ? 1 : 0;
isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
}

function fitWindowSize() {
  if (isNav4) {
  window.innerWidth = document.layers[0].document.images[0].width;
  window.innerHeight = document.layers[0].document.images[0].height;
  }
  if (! isNav4) {
    window.resizeTo(800, 600);
    width = (800 - (document.body.clientWidth -  document.images[0].width)) + 25;
    height = (600 - (document.body.clientHeight -  document.images[0].height)) + 55;
    window.resizeTo(width, height);
  }
}
 
function Preview(URL) {
windowprops = "left=0,top=20";

text = "<html><head>";
text += "<script language='javascript' src='/matrix.js'></script>";
text += "<title>Preview</title></head><body bgcolor='white' onLoad='fitWindowSize()'><center><img border='1' src='" + URL + "'>";
text += "<p><a href='javascript:window.close()'>Close</a>&nbsp;&nbsp; <a href='javascript:printWindow()'>Print This Page</a></p></center></body></html>";

preview = window.open("", "preview", windowprops);
preview.document.open();
preview.document.write(text);
preview.document.close();
}

 */
 
function Overview() {
windowprops = "left=0,top=20,scrollbars=yes,resizable=yes";

preview = window.open("", "overview", windowprops);
preview.document.open();
preview.document.write(text);
preview.document.close();
}

function printWindow(){
browserVersion = parseInt(navigator.appVersion)
if (browserVersion >= 4) window.print()
}
