/* layers.js
 * Author: Devin Teske <devinteske@hotmail.com>
 * Date: October 2nd, 2002
 */

// this file requires constants.js, please include it *before* hand
// for details on including it, please read the comments in constants.js

/* ------------------------------------------------------------------- */

/* define constants that can be used by all functions */

// is_ie is defined in constants.js (which should be included *first*
is_ie ? visp = ".style" : visp = "";
is_ie ? prnt = "window." : prnt = "document.";

/* ------------------------------------------------------------------- */

/* Layer visibility functions */

/* SwitchLayer:
 * makes a layer visible and the previous layer called, invisible
 * takes one parameter: a layer name. should be specified as the id
 * attribute of the layer
 */

var preLayer = "";
if (is_ie) var undefined = "";

function SwitchLayer() {
  var a = SwitchLayer.arguments;
  a.length > 0 ? theLayer = a[0] : theLayer = "";
  if ( preLayer != "" )
    eval(prnt+preLayer+visp+".visibility='hidden'");
  if ( theLayer != "" )
    eval(prnt+theLayer+visp+".visibility='visible'");
  preLayer = theLayer;
}

/* setLayerClose
 * close the layer after a period of time
 */

var closeLayerTimer = 0;

function setLayerClose() {
  if (!closeLayerTimer)
    closeLayerTimer = setTimeout("SwitchLayer()", objectTimeout);
}

/* clearLayerClose
 * cancel the scheduled closing of the layer
 */

function clearLayerClose() {
  if (closeLayerTimer) {
    clearTimeout(closeLayerTimer);
    closeLayerTimer = 0
  }
}

/* ------------------------------------------------------------------- */

//fixes NS resize bug - do not REMOVE or it will break in netcape browsers
if (is_nav) {
  origWidth = innerWidth;
  origHeight = innerHeight;
}

function reDo() {
  if (innerWidth == origWidth && innerHeight == origHeight) return;
  origWidth = innerWidth;
  origHeight = innerHeight;

  var w = window;
  while (w != w.parent) w = w.parent
  w.location.reload();
}

if (is_nav) onresize = reDo;

/* ------------------------------------------------------------------- */
