// JavaScript Document
/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/
var menuLayers = {
  timer: null,
  activeMenuID: null,
  offX: 1,   // horizontal offset 
  offY: 1,   // vertical offset 
  show: function(id, e) {
    var mnu = document.getElementById? document.getElementById(id): null;
    if (!mnu) return;
    this.activeMenuID = id;
    if ( mnu.onmouseout == null ) mnu.onmouseout = this.mouseoutCheck;
    if ( mnu.onmouseover == null ) mnu.onmouseover = this.clearTimer;
    viewport.getAll();
    this.position(mnu,e);
  }, 
  hide: function() {
    this.clearTimer();
    if (this.activeMenuID && document.getElementById) 
      this.timer = setTimeout("document.getElementById('"+menuLayers.activeMenuID+"').style.visibility = 'hidden'", 100);
  },
  position: function(mnu, e) {
    var x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
    var y = e.pageY? e.pageY: e.clientY + viewport.scrollY;
    
    if ( x + mnu.offsetWidth + this.offX > viewport.width + viewport.scrollX )
      x = x - mnu.offsetWidth - this.offX;
    else x = x + this.offX;
    if ( y + mnu.offsetHeight + this.offY > viewport.height + viewport.scrollY )
      y = ( y - mnu.offsetHeight - this.offY > viewport.scrollY )? y - mnu.offsetHeight - this.offY : viewport.height + viewport.scrollY - mnu.offsetHeight;
    else y = y + this.offY;
    
    mnu.style.left = x + "px"; mnu.style.top = y + "px";
    this.timer = setTimeout("document.getElementById('" + menuLayers.activeMenuID + "').style.visibility = 'visible'", 100);
  },
  mouseoutCheck: function(e) {
    e = e? e: window.event;
    var mnu = document.getElementById(menuLayers.activeMenuID);
    var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
    if ( mnu != toEl && !menuLayers.contained(toEl, mnu) ) menuLayers.hide();
  },
  contained: function(oNode, oCont) {
    if (!oNode) return; 
    while ( oNode = oNode.parentNode ) 
      if ( oNode == oCont ) return true;
    return false;
  },
  clearTimer: function() {
if (menuLayers.timer) clearTimeout(menuLayers.timer);
  }
}


function displayWindow(theURL,winName,width,height,features) { //v3.1
// Made by Eddie Traversa modified from Macromedia Code
// http://nirvana.media3.net/
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + newfeatures + '');
    newWindow.focus();
}
/*if (document.getElementById) window.onload=initGlideLayers;

function initGlideLayers() {
  var glideLyrs = new Array();
  
  // Set up your layers here
  // arguments: id, amount to be visible (left), top, width, height
  // duration of glide onscroll, accel (-1 to 1, -1 decelerates)
  //glideLyrs[0] = new Glider('glideDiv0', 70, 50, 400, 45, 3000, -1);
  glideLyrs[0] = new Glider('glideDiv1', 30, 110, 478, 40, 2000, -1);
  //glideLyrs[1] = new Glider('glideDiv2', 50, 230, 400, 27, 1000, -1);
  //glideLyrs[0] = new Glider('glideDiv3', 30, 18, 220, 30, 500, -1);
  //glideLyrs[2] = new Glider('glideDiv4', 35, 278, 620, 80, 3500, -1);
  for (var i=0; i<glideLyrs.length; i++) {
		// hold amount to be left visible 
		glideLyrs[i].xOff = glideLyrs[i].x;
		if ( !glideLyrs[i].y ) 
			if ( glideLyrs[i-1] ) glideLyrs[i].y = glideLyrs[i-1].y + glideLyrs[i-1].h + 0;	
		glideLyrs[i].shiftTo( -(glideLyrs[i].w - glideLyrs[i].xOff), glideLyrs[i].y );
		glideLyrs[i].show();
  }
}
function slideIntoView(id) {
  var glideLyr = dynObj.getInstance(id);
  glideLyr.slideTo(2, null, 1150, -.8);
}
function slideOutOfView(id,e) {
  var glideLyr = dynObj.getInstance(id);
	e = (e)? e: window.event;
  var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
  if ( toEl != glideLyr.el && !contained(toEl, glideLyr.el) ) 
	  glideLyr.slideTo( -(glideLyr.w - glideLyr.xOff), null, 700, -.8);
}
function contained(oNode, oCont) {
  if (!oNode) return;
  while ( oNode.parentNode ) {
    oNode = oNode.parentNode;
    if ( oNode == oCont ) return true;
  }
  return false;
}
*/
