//-------------------------------------------------
//
// Nacre Website JavaScript routines - homepage
//
// Copyright 2002 Nacre, Inc. All rights reserved.
//-------------------------------------------------

var height, width;
var origHeight, origWidth;

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinNS7 = (isMinNS4 && parseFloat(navigator.appVersion) >= 5) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
var isMac = (navigator.appVersion.indexOf("Mac") != -1 );

if (isMinNS4)
{
  origWidth = window.innerWidth;
  origHeight = window.innerHeight;
}

function getWindowSize()
{
  if (isMinNS4)
  {
    height = window.innerHeight;
    width = window.innerWidth;
  }
  else if (isMinIE4)
  {
    height = (isMac && isMinIE5) ? document.body.clientHeight - 15: document.body.clientHeight;
    width = document.body.clientWidth;
  }
  // alert("width = " + width + ", height = " + height);
}

function writeVerticalWedge()
{
  if (isMinNS4 || isMinIE4)
  {
    getWindowSize();    
    if (isMinNS4 && width < 800)
    {
      // horizontal scrollbar
      height -= 15;
    }
    if (isMinNS7)
    {
      height += 4;
    }  
    document.write('<IMG SRC="/images/spacer.gif" BORDER=0 WIDTH=1 HEIGHT="' + (height - 429) + '">');
  }
  else
  {
    document.writeln('<IMG SRC="/images/spacer.gif" BORDER=0 WIDTH=15 HEIGHT=1>');
  }
}

function writeHorizontalWedge()
{
  if (isMinNS4)
  {
    var wedge = 800; // minimum wedge for 800x600 display
    var hspace;
    width = isMinNS4 ? window.innerWidth : document.body.clientWidth;
    hspace = width;
    hspace = (hspace < 800) ? wedge : hspace;
    document.write('<IMG SRC="/images/spacer.gif" WIDTH=' + hspace + ' HEIGHT=1>');
  }
}

function writeHorizontalWedgeTop()
{
  if (isMinNS4 || isMinIE4)
  {
    var wedge = 31; // minimum wedge for 800x600 display
    var hspace;
    width = isMinNS4 ? window.innerWidth : document.body.clientWidth;
    hspace = width;
    hspace = (hspace <= 800) ? wedge : hspace - 769;
    document.write('<IMG SRC="/images/spacer.gif" WIDTH=' + hspace + ' HEIGHT=1>');
  }
}

function writeHorizontalBarShadow()
{
  if (isMinNS4 || isMinIE4)
  {
    var wedge = 1; // minimum wedge for 800x600 display
    var hspace;
    width = isMinNS4 ? window.innerWidth : document.body.clientWidth;
    hspace = width;
    hspace = (hspace <= 800) ? wedge : hspace - 800;
    document.write('<IMG SRC="/images/barshadowHm.gif" WIDTH=' + hspace + ' HEIGHT=8><BR><IMG SRC="/images/spacer.gif" WIDTH=1 HEIGHT=88>');
  }
}

function reload()
{
  if (isMinNS4 && (window.innerWidth == origWidth || window.innerHeight == origHeight))
  {
    return;
  }

  setTimeout("reloadit()", 500);
}

function reloadit()
{
    location.reload();
}

window.onresize = reload;