
// This code (C) 2001-2002 by Joost Nieuwenhuijse - joost@newhouse.nl
// feel free to copy, modify and use, but please include this copyright
// message



// Determine browser.
var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.")) >= 0 ? 1 : 0;

function getScreenWidth()
{
  var w=800;

  if( parseInt ( navigator.appVersion ) >= 4 )
  {
    if(screen)
    {
      if(screen.width)
      {
        w=screen.width;
      }
    }
  }
  return w;
}

function getScreenHeight()
{
  var w=600;

  if( parseInt ( navigator.appVersion ) >= 4 )
  {
    if(screen)
    {
      if(screen.height)
      {
        w=screen.height;
      }
    }
  }
  return w;
}

var popupwin=null;

function popupBorderless(url,width,height,name)
{
  if((!popupwin) || (popupwin.closed))
  {
    popupwin = window.open("",name,'fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1');
    self.focus();
    popupwin.resizeTo(width,height);
    popupwin.moveTo((getScreenWidth()-width)/2,(getScreenHeight()-height)/2);
  }
  popupwin.location=url;
  popupwin.focus();
  return popupwin;
}
function getWindowWidth() {

  if (isMinNS4)
    return(window.innerWidth);
  if (isMinIE4)
    return(document.body.clientWidth);
//    return(document.body.offsetWidth);
  return(-1);
}

function getWindowHeight() {

  if (isMinNS4)
    return(window.innerHeight);
  if (isMinIE4)
    return(document.body.clientHeight);
//    return(document.body.offsetHeight);
  return(-1);
}

// This function will open the panorama viewer window
// Supply two arguments, the category and the panorama number to open
// e.g. startPano(0,2) will open the third panorama in the first group
// If the viewer is already open, the existing window will be re-used
function startPano(cat,pano)
{
  // here, 500 and 440 are the initial width and height of the viewer window
  popupBorderless("/panoramas/pano.html?cat="+cat+"&pano="+pano,500,440,"viewerwindow");
}function documentWrite(str){document.write(str)}