// JavaScript Document
// The Glid In Menu JavaScript 
function initGlideLyr() {
  // exclude op < 7 (???)
  var i, el, ua = navigator.userAgent;
  if ( (i = ua.indexOf("Opera")) != -1 ) { if ( parseFloat(ua.substr(i+6,4)) < 7 ) return; }

  var glideLyrs = new Array();
	// arguments: id, amount to be visible (left offset calculated), top
	// set width in style sheet (width and height are null here)
  // duration of glide onscroll, accel (-1 to 1, -1 decelerates)
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		 var ieversion=new Number(RegExp.$1); // capture x.x portion and store as a number
		 if (ieversion>=8){
		/*	document.write("You're using IE8 or above");*/
		 }else if (ieversion>=7){
			glideLyrs[0] = new Glider('glideDiv0',-26,150,null,null,1000, -1);
		 }else if (ieversion>=6){
			glideLyrs[0] = new Glider('glideDiv0',24,150,null,null,1000, -1);
		 }else if (ieversion>=5){
		/*	document.write("You're using IE5.x");*/
		 }
	}else{
	 glideLyrs[0] = new Glider('glideDiv0',-26,150,null,null,1000, -1);
	}

  for (i=0; glideLyrs[i]; i++) {
		// hold amount to be left visible
		glideLyrs[i].xOff = glideLyrs[i].x;
		if ( !glideLyrs[i].y ) // position based on previous glideLyrs height and position
			if ( glideLyrs[i-1] ) glideLyrs[i].y = glideLyrs[i-1].y + glideLyrs[i-1].h + 2;
		glideLyrs[i].shiftTo( -(glideLyrs[i].w - glideLyrs[i].xOff), glideLyrs[i].y );
		glideLyrs[i].show();
    el = dynObj.getElemRef( glideLyrs[i].id );
    if (el) {
      el.onmouseover = slideIntoView;
      el.onmouseout = slideOutOfView;
    }
  }

}

function slideIntoView() {
  var glideLyr = dynObj.getInstance(this.id);
  glideLyr.slideTo(0, null, 150, -.8);
}

function slideOutOfView(e) {
  var glideLyr = dynObj.getInstance(this.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, 300, -.8);
}

// returns true if oNode is contained by oCont (container)
function contained(oNode, oCont) {
  if (!oNode) return; // in case alt-tab away while hovering (prevent error)
  while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
  return false;
}
//##############################################################################
// Code for pop out menu for IE 6
//##############################################################################
/*	sfHover = function() {
	var sfEls = document.getElementById("menu5").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);*/
// For TabsJ ####################################################################
/*	sfHoverJ = function() {
	var sfEls = document.getElementById("tabsJ").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhoverJ";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhoverJ\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHoverJ);*/

