var MDate = new Date();
                                   
                                                                                
function jumpPage(FormIndex,MenuIndex) {
    if (bannerForm && bannerForm == 1)
    {
        FormIndex += 1 
    }   
    SelectedIndex=document.forms[FormIndex].elements[MenuIndex].selectedIndex;                    
    URL=document.forms[FormIndex].elements[MenuIndex].options[SelectedIndex].value; 
    NewURL = "";    
    // Strip any special characters like CRs and LFs out of the URL.                                                      
    for (var j = 0; j < URL.length; j++)                                    
    {                                                                             
        if (URL.substring(j,j+1) > " ")                                      
            NewURL += URL.substring(j,j+1);                                
    }                                                                             
    location = NewURL;
}
function ScrollDiv(ControlName, amount) {

    var Control = document.getElementById(ControlName);
    if (Control.pageYOffset) {
        alert('PageYOffset=' + Control.pageYOffset)
        Control.pageYOffset = Control.PageYOffset + amount;
        alert('PageYOffset=' + Control.pageYOffset)
    }
    else {
        Control.scrollTop = Control.scrollTop + amount;
    }
}

function ToggleNav(ControlName, prefix, parentName) {
    // get all the controls of type DIV of the parent or if no parent is
    // specified, get all the controls of type DIV in the document.
    if (parentName) {
        var parentControl = document.getElementById(parentName);
        var divs = parentControl.getElementsByTagName("div");
    }
    else {
        var divs = document.getElementsByTagName("div");
    }
    var Control = document.getElementById(ControlName);
    // close the ones that have the prefix
    for (var n = 0; n < divs.length; ++n) {
        if (divs[n].id.indexOf(prefix, 0) >= 0 && divs[n] != Control) {
            if (divs[n].style.display == 'block') {
                divs[n].style.display = 'none';
            }
        }
    }

    // toggle the given div and its associated scroll div, if there is one.
    var ScrollDiv = Control.id + '_scroll';
    if (Control.style.display == 'none') {
        Control.style.display = 'block';
        if (document.getElementById(ScrollDiv))
            document.getElementById(ScrollDiv).style.display = 'block';
    }
    else {
        Control.style.display = 'none';
        if (document.getElementById(ScrollDiv))
            document.getElementById(ScrollDiv).style.display = 'none';
    }
}
                                                                
function ToggleDiv( DivID, ToggleImg )
{
  if( document.getElementById( "div"+DivID ) )
  {
	if( document.getElementById( "div"+DivID ).style.display == 'none' )
	{
		document.getElementById( "div"+DivID ).style.display = 'block';
		if( ToggleImg )
			document.getElementById( "img"+DivID ).src = '/framework/image/epas/bulletopen2.gif';		
	}
	else
	{
		document.getElementById( "div"+DivID ).style.display = 'none';
		if( ToggleImg )
			document.getElementById( "img"+DivID ).src = '/framework/image/epas/bulletclose2.gif';
	}
  }
}

                                                                
function ToggleDivPrefix(Prefix, DivID, ToggleImg, StateControlID )
{
    if (document.getElementById("div" + Prefix + DivID))
  {
      if (document.getElementById("div" + Prefix + DivID).style.display == 'none')
	{
	    document.getElementById("div" + Prefix + DivID).style.display = 'block';
		if( ToggleImg )
		    document.getElementById("img" + Prefix + DivID).src = '/framework/image/epas/bulletopen2.gif';
        document.getElementById(StateControlID).value = document.getElementById(StateControlID).value + Prefix + DivID + ',o;';
        document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, Prefix + DivID + ',c;', '');
    }
	else
	{
	    document.getElementById("div" + Prefix + DivID).style.display = 'none';
		if( ToggleImg )
		    document.getElementById("img" + Prefix + DivID).src = '/framework/image/epas/bulletclose2.gif';
		document.getElementById(StateControlID).value = document.getElementById(StateControlID).value + Prefix + DivID + ',c;';
		document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, Prefix + DivID + ',o;', '');
    }
  }
}

/* Toggle the Div and maintain its state in the given control */
function ToggleDivNew( DivID, StateControlID )
{
	if( document.getElementById( "div"+DivID ).style.display == 'none' )
	{
		document.getElementById( "div"+DivID ).style.display = 'block';
		document.getElementById( "img"+DivID ).src = '/framework/image/epas/bulletopen2.gif';		
		document.getElementById(StateControlID).value = document.getElementById(StateControlID).value + DivID  + ',o;';
		document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, DivID + ',c;', '');
    }
	else
	{
		document.getElementById( "div"+DivID ).style.display = 'none';
		document.getElementById( "img"+DivID ).src = '/framework/image/epas/bulletclose2.gif';
		document.getElementById(StateControlID).value = document.getElementById(StateControlID).value + DivID + ',c;';
		document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, DivID + ',o;', '');
    }
}

function CollapseAll()
{
	var i;
	var Divs = document.getElementsByTagName("div");
	var Images = document.getElementsByTagName("img");
	for (i=0; i < Divs.length; ++i)
	{
		if (Divs[i].id.substring(0,3) == "div")
		{
			Divs[i].style.display = 'none';
		}
	}
	for (i=0; i < Images.length; ++i)
	{
		if (Images[i].id.substring(0,3) == "img")
		{
			Images[i].src = '/framework/image/epas/bulletclose2.gif';
		}
	}
}

function ExpandAll()
{
	var i;
	var Divs = document.getElementsByTagName("div");
	var Images = document.getElementsByTagName("img");
	for (i=0; i < Divs.length; ++i)
	{
		if (Divs[i].id.substring(0,3) == "div")
		{
			Divs[i].style.display = 'block';
		}
	}
	for (i=0; i < Images.length; ++i)
	{
		if (Images[i].id.substring(0,3) == "img")
		{
			Images[i].src = '/framework/image/epas/bulletopen2.gif';
		}
	}
}

function ExpandAllDivs(Prefix,Expand,StateControlID)
{
	var i;
	var DivID = "div" + Prefix;
	var ImgID = "img" + Prefix;
	var Divs = document.getElementsByTagName("div");
	var Images = document.getElementsByTagName("img");
	for (i=0; i < Divs.length; ++i)
	{
		if (Divs[i].id.substring(0,DivID.length) == DivID)
		{
		    if (Expand == 'true')
		    {
			    Divs[i].style.display = 'block';
			    document.getElementById(StateControlID).value = document.getElementById(StateControlID).value + Prefix + Divs[i].id.substring(DivID.length) + ',o;';
			    document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, Prefix + Divs[i].id.substring(DivID.length) + ',c;', '');
		    }
			else
			{
			    Divs[i].style.display = 'none';
			    document.getElementById(StateControlID).value = document.getElementById(StateControlID).value + Prefix + Divs[i].id.substring(DivID.length) + ',c;';
			    document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, Prefix + Divs[i].id.substring(DivID.length) + ',o;', '');
			}
		}
	}
	for (i=0; i < Images.length; ++i)
	{
		if (Images[i].id.substring(0,ImgID.length) == ImgID)
		{
		    if (Expand == 'true')
		    {
			Images[i].src = '/framework/image/epas/bulletopen2.gif';
			}
			else
			{
			Images[i].src = '/framework/image/epas/bulletclose2.gif';
			}
		}
	}
}


function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function

function InitializeDivState(controlID)
{	
	var temp;
	//split values of the parameters into an array	
	temp = document.getElementById(controlID).value;
	var divIds = new Array();
	var divActions = new Array();
	if( temp != '' )
		divIds = temp.split(';');
	
	for(var i=0; i<divIds.length; i++ ) {
		if( divIds[i] != '')
		{
		   divActions = divIds[i].split(',');
		   if (divActions.length == 1) 
		   {
		       if (document.getElementById("div" + divIds[i])) 
		       {
		           document.getElementById("div" + divIds[i]).style.display = 'block';
		           document.getElementById("img" + divIds[i]).src = '/framework/image/epas/bulletopen2.gif';
		       }
		   }
		   else {
		       if (document.getElementById("div" + divActions[0])) 
		       {
		           if (divActions[1] == 'o') {
		               document.getElementById("div" + divActions[0]).style.display = 'block';
		               document.getElementById("img" + divActions[0]).src = '/framework/image/epas/bulletopen2.gif';
		           }
		           else {
		               document.getElementById("div" + divActions[0]).style.display = 'none';
		               document.getElementById("img" + divActions[0]).src = '/framework/image/epas/bulletclose2.gif';
		           }		               
		       }		   
		   }
		}	
	}
}
 
function InitializeDivStatePrefix(Prefix,controlID)
{	
	var temp;
	//split values of the parameters into an array	
	temp = document.getElementById(controlID).value;
	var divIds = new Array();
	var divActions = new Array();
	if (temp != '')
		divIds = temp.split(';');
	
	for(var i=0; i<divIds.length; i++ )
	{
		if( divIds[i] != '')
		{
		   divActions = divIds[i].split(',');
		   if (divActions.length == 1) {
		       if (document.getElementById(Prefix + "div" + divIds[i])) {
		           document.getElementById(Prefix + "div" + divIds[i]).style.display = 'block';
		           document.getElementById(Prefix + "img" + divIds[i]).src = '/framework/image/epas/bulletopen2.gif';
		       }
		   }
		   else {
		       if (document.getElementById(Prefix + "div" + divActions[0])) {
		           if (divActions[1] == 'o') {
		               document.getElementById(Prefix + "div" + divActions[0]).style.display = 'block';
		               document.getElementById(Prefix + "img" + divActions[0]).src = '/framework/image/epas/bulletopen2.gif';
		           }
		           else {
		               document.getElementById(Prefix + "div" + divActions[0]).style.display = 'none';
		               document.getElementById(Prefix + "img" + divActions[0]).src = '/framework/image/epas/bulletclose2.gif';
		           }
		       }
		   }		
		}	
	}
}

function SaveTab(TabID, StateControlID)
{
	var stateValue;
	var startIndex;
	var endIndex;
	var selectedIndex;
	// .Net does not render Mozilla FireFox the same way as IE so the 
	// control does not exist.
	if (document.getElementById('__' + TabID + '_State__'))
	{
		selectedIndex = document.getElementById('__' + TabID + '_State__').value;
		stateValue = document.getElementById(StateControlID).value;
		startIndex = stateValue.indexOf(TabID);
		if (startIndex != -1)
		{
			endIndex = stateValue.indexOf(',',startIndex);
			stateValue = stateValue.substring(0,startIndex) + stateValue.substring(endIndex+1);
		}
		document.getElementById(StateControlID).value = stateValue + TabID  + '|' + selectedIndex + ',';
	}
}

function InitializeTabState(controlID)
{
	var temp;
	//split values of the parameters into an array	
	temp = document.getElementById(controlID).value;
	var tabIds = new Array();
	var tabData = new Array();
	
	if( temp != '' )
		tabIds = temp.split(',');
	
	for(var i=0; i<tabIds.length; i++ )
	{
		if( tabIds[i] != '')
		{
			tabData = tabIds[i].split('|');
			if (document.getElementById(tabData[0]))
				document.getElementById(tabData[0]).selectedIndex = tabData[1];
		}	
	}
}

function SetFormRadio(form,index)                                         
{                                                                
        form.SCOPE[index].checked = true;           
}
                                                                
function OpenNewWindow (filename,windowName,controlString) 
{
	var newWin;
	newWin = window.open
	(filename, windowName, controlString);
	newWin.focus();
}

/* This function makes a div scrollable with android and iphone */

function isTouchDevice() {
    /* Added Android 3.0 honeycomb detection because touchscroll.js breaks
    the built in div scrolling of android 3.0 mobile safari browser */
    if ((navigator.userAgent.match(/android 3/i)) ||
		(navigator.userAgent.match(/honeycomb/i)))
        return false;
    try {
        document.createEvent("TouchEvent");
        return true;
    } catch (e) {
        return false;
    }
}

function touchScroll(id) {
    if (isTouchDevice()) { //if touch events exist...
        var el = document.getElementById(id);
        var scrollStartPosY = 0;
        var scrollStartPosX = 0;

        document.getElementById(id).addEventListener("touchstart", function (event) {
            scrollStartPosY = this.scrollTop + event.touches[0].pageY;
            scrollStartPosX = this.scrollLeft + event.touches[0].pageX;
            //event.preventDefault(); // Keep this remarked so you can click on buttons and links in the div
        }, false);

        document.getElementById(id).addEventListener("touchmove", function (event) {
            // These if statements allow the full page to scroll (not just the div) if they are
            // at the top of the div scroll or the bottom of the div scroll
            // The -5 and +5 below are in case they are trying to scroll the page sideways
            // but their finger moves a few pixels down or up.  The event.preventDefault() function
            // will not be called in that case so that the whole page can scroll.
            if ((this.scrollTop < this.scrollHeight - this.offsetHeight &&
				this.scrollTop + event.touches[0].pageY < scrollStartPosY - 5) ||
				(this.scrollTop != 0 && this.scrollTop + event.touches[0].pageY > scrollStartPosY + 5))
                event.preventDefault();
            if ((this.scrollLeft < this.scrollWidth - this.offsetWidth &&
				this.scrollLeft + event.touches[0].pageX < scrollStartPosX - 5) ||
				(this.scrollLeft != 0 && this.scrollLeft + event.touches[0].pageX > scrollStartPosX + 5))
                event.preventDefault();
            this.scrollTop = scrollStartPosY - event.touches[0].pageY;
            this.scrollLeft = scrollStartPosX - event.touches[0].pageX;
        }, false);
    }
}
/**
 * resize.js 0.3 970811
 * by gary smith
 * js component for "reloading page onResize"
 */
/* if(!window.saveInnerWidth){
  window.onresize = resize;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}
function resize(){
if (saveInnerWidth < window.innerWidth || 
    saveInnerWidth > window.innerWidth || 
    saveInnerHeight > window.innerHeight || 
    saveInnerHeight < window.innerHeight ){
  window.history.go(0);
}} */
/**
 * Menu 990702
 * by gary smith, July 1997
 * Copyright (c) 1997-1999 Netscape Communications Corp.
 *
 * Netscape grants you a royalty free license to use or modify this
 * software provided that this copyright notice appears on all copies.
 * This software is provided "AS IS," without a warranty of any kind.
 */
var lastMenu;
var menuWidth = 202;
var menuOffset = 0;
var backcolor = "#ff6309";
var mouseovercolor = "#fe4110";
var ulstyle = "navigation-menu";
var navstyle = "inner-navigation";
var subnavstyle = "subnavmenu";  /* No longer used */
var subnavlinkstyle = "subnavlinkmenu";  /* No longer used */
var arrowsource = "/framework/image/epas/NAV-TRIANGLE-LTGRAY.GIF";
function Menu(name,label){
lastMenu = this;
this.objectName = name;
this.items = new Array();
this.actions = new Array();
this.newWindow = new Array();
this.addMenuItem = addMenuItem;
this.writeMenus = writeMenus;
this.showMenu = showMenu;
this.childMenus = new Array();
this.hideChildMenu = hideChildMenu;
this.hideMenu = hideMenu;
this.mouseTracker = mouseTracker;
this.setMouseTracker = setMouseTracker;

if (!window.menus) window.menus = new Array();
this.label = label || "menuLabel" + window.menus.length;
window.menus[this.label] = this;
window.menus[window.menus.length] = this;
if (!window.activeMenus) window.activeMenus = new Array();
if (!window.menuContainers) window.menuContainers = new Array();
}

function addMenuItem(label,theUrl,newWindow) {
if (document.all)
{
  var url = '<A HREF="' + theUrl + '" ';
  if (newWindow) url += ' TARGET=_blank';
  this.actions[this.actions.length] = url;
}
else
{
  this.actions[this.actions.length] = theUrl;
  this.newWindow[this.newWindow.length] = newWindow;
}
this.items[this.items.length] = label;
}

function writeMenus(){
var spanCreated = false;
if (document.all){
  if (!document.all["menuContainer"]) document.writeln('<SPAN ID="menuContainer"></SPAN>');
  container = document.all["menuContainer"];
}
else
{
  if (!spanCreated) 
  {
    container = document.createElement('SPAN');
    container.id = "menuContainer";
    container.document = document;
    spanCreated = true;
  }
}


container.isContainer = "menuContainer" + menuContainers.length;
menuContainers[menuContainers.length] = container;
container.menus = new Array();
// 3BEG code - reverse order so submenus are defined before use
var j=window.menus.length-1;
for(var i=0;i<window.menus.length;i++){ 
  container.menus[i]=window.menus[j];
  j--;
}
// for (var i=0; i<window.menus.length; i++) 
//   container.menus[i] = window.menus[i];
// end 3BEG code
window.menus.length = 0;
var countMenus = 0;
var countItems = 0;
var top = 0;
var content = '';
for (var i=0; i<container.menus.length; i++, countMenus++){
  var menu = container.menus[i];
  menu.id ="menuLayer"+ countMenus;
  if (document.all){
    content +=
      '<DIV ID="' + menu.id +'" STYLE="position:absolute;left:0;top:0;display:none;margin-left:0;width=' + (menuWidth-2) + 'px">\n' +
      '<div id="' + navstyle + '">\n' + 
      '<UL class="' + ulstyle + '">'
 }
 else
 {
	var div1 = container.appendChild(document.createElement('div'));
	div1.id = menu.id;
	div1.style.position = "absolute";
	div1.style.left = 0;
	div1.style.top = 0;
	div1.style.display = "none";
	div1.style.marginLeft = 0;
	div1.style.width = (menuWidth - 2) + "px";
	var div2 = div1.appendChild(document.createElement('div'));
	div2.id = navstyle;
	var ul = div2.appendChild(document.createElement('ul'));
	ul.setAttribute("class",ulstyle);
 }
  var x=i;
  for (var i=0; i<menu.items.length; i++) {
    var item = menu.items[i];
    var childMenu = false;	
    if (item.label) {
      var objectName = item.objectName
      item = item.label;
      childMenu = true;
    }
    if (document.all){
      var dText = '<li ID="menuItemText' + countItems + '">' + menu.actions[i];
      dText += ' onMouseOver="';
      if (childMenu)
        dText += 'showMenu(' + objectName + ',0,0,true,' + menu.objectName + ');" >'; 
      else
        dText += 'hideChildMenu(' + menu.id + ');">';
      dText += item;
      if (childMenu)
        content += (dText + '&nbsp;&nbsp;<IMG SRC="' + arrowsource + '" ID="childMenu' + 
                   countItems + '" HEIGHT=7px WIDTH=4px Border=0 align=center hspace=0 vpace=0></A></li>\n');
      else
        content += ( dText + '</A>');
    }  
    else {
    	var li = ul.appendChild(document.createElement('li'));
	li.id = "menuItemText" + countItems;
	var a = li.appendChild(document.createElement('a'));
	a.href = menu.actions[i];
	a.innerHTML = item;
        if (childMenu)
        	dText = 'showMenu(' + objectName + ',0,0,true,' + menu.objectName + ');'; 
        else
        	dText = 'hideChildMenu(' + menu.id + ');';
	if (childMenu)
        	a.innerHTML += '&nbsp;&nbsp;<IMG SRC="' + arrowsource + '" ID="childMenu' + 
                          countItems + '" HEIGHT=7px WIDTH=4px Border=0 align=center hspace=0 vpace=0>'
	a.setAttribute("onmouseover",dText);
    }
    countItems++;
  }
  if (document.all) content += '</UL></DIV></DIV>\n';
  i=x;
}
if (!container) return;
if (document.all)
{
  // alert(content);
  if (container.innerHTML){
    container.innerHTML=content;
  }
  else {
    container.document.open("text/html");
    container.document.writeln(content);
    container.document.close();
  }
}
else
{
  // alert(container.innerHTML);
  document.body.appendChild(container);
}
/*
if (document.all){
  var menuCount = 0;
  for (var x=0; x<container.menus.length; x++) {
    var menu = container.document.all("menuLayer" + x);
    container.menus[x].menuLayer = menu;
    container.menus[x].menuLayer.Menu = container.menus[x];
    container.menus[x].menuLayer.Menu.container = menu;
    for (var i=0; i<container.menus[x].items.length; i++){
      var l = container.document.all["menuItemText" + menuCount];
      l.Menu = container.menus[x];
      var childItem = container.document.all["childMenu" + menuCount];
      if (childItem) {
        l.childMenu = container.menus[x].items[i].menuLayer;
        l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
      }
      menuCount++;
    }
   container.menus[x].menuLayer.style.pixelHeight = container.menus[x].items.length * 16 + 2;
  }
}
else
{
*/
  var menuCount = 0;
  for (var x=0; x<container.menus.length; x++) {
    var menu = document.getElementById("menuLayer" + x);
    container.menus[x].menuLayer = menu;
    container.menus[x].menuLayer.Menu = container.menus[x];
    container.menus[x].menuLayer.Menu.container = menu;
    for (var i=0; i<container.menus[x].items.length; i++){
      var l = document.getElementById("menuItemText" + menuCount);
      l.Menu = container.menus[x];
      var childItem = document.getElementById("childMenu" + menuCount);
      if (childItem) {
        l.childMenu = container.menus[x].items[i].menuLayer;
        l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
      }
      menuCount++;
    }
   container.menus[x].menuLayer.style.pixelHeight = container.menus[x].items.length * 16 + 2;
  }
/*
}
*/
window.wroteMenu = true;
this.setMouseTracker();

}


function showMenu(menu, x, y, child,parent) {
    var topValue;
    var leftValue;
  if (!window.wroteMenu) 
  {
    if (!document.getElementById)  alert("No menu written"); 
    return; 
  }
  if (window.ActiveMenu == menu) return true;
  var l = menu || menu.layer;
  if (!child) hideActiveMenus(l);
  else
  { 
    if (parent.activeMenu)
    {
      var l2 = parent.activeMenu;
      document.getElementById(l2.id).style.display = 'none';
    }
  }
  window.ActiveMenu = l;
  if (child) 
  {
    document.getElementById(l.id).style.zIndex = document.getElementById(parent.id).style.zIndex + 1;
    if (document.all)
        leftValue = parseInt(document.getElementById(parent.id).style.left) + menuWidth - 2;
    else
        leftValue = parseInt(document.getElementById(parent.id).style.left) + menuWidth - 1;
    document.getElementById(l.id).style.left = leftValue + "px";
    parent.activeMenu = menu.layer || menu;
  }
  else
  {
    leftValue = (x || (window.pageX + document.body.scrollLeft));
    if (!document.all)
        leftValue = leftValue + 6;
    document.getElementById(l.id).style.left = leftValue + "px";
  }
  if (document.all)
  {
    if (child) 
      topValue =  window.pageY  + document.body.scrollTop;
    else
      topValue =  window.pageY  + document.body.scrollTop + menuOffset;
    topValue = topValue - 12;
    document.getElementById(l.id).style.top = topValue + "px";
  }
  else
  {
    if (child) 
      topValue =  window.pageY;
    else
      topValue =  window.pageY + menuOffset;
    topValue = topValue - 12;
    if (!document.getElementById(l.id).style.top || parseInt(document.getElementById(l.id).style.top) == 0 || 
        topValue < parseInt(document.getElementById(l.id).style.top)) 
    {
        document.getElementById(l.id).style.top = topValue + "px";
    }
  }

  document.getElementById(l.id).style.display = "block";
  if (menu)window.activeMenus[window.activeMenus.length] = l;
}

function hideMenu(e){
if (window.ActiveMenu == e) return true;
var l = e || window.ActiveMenu;
if (!l) return true;
if (l.menuLayer) l = l.menuLayer;
var a = window.ActiveMenuItem;
document.saveMousemove = document.onmousemove;
document.onmousemove = mouseTracker;
hideActiveMenus(l);
window.ActiveMenu = null;
return true;
}

function hideChildMenu(menuLayer) {
var l = menuLayer;
/*
if (document.all)
{
 for (var i=0; i < l.Menu.childMenus.length; i++) {
    l.Menu.childMenus[i].style.display = "none";
    l.Menu.childMenus[i].Menu.hideChildMenu(l.Menu.childMenus[i]);
  }
  if (l.childMenu) {
      l.childMenu.style.zIndex = l.Menu.menuLayer.style.zIndex +1;
      l.childMenu.style.pixelTop = l.style.pixelTop + l.Menu.menuLayer.style.pixelTop;
      if (l.childMenu.style.pixelLeft + l.childMenu.style.pixelWidth > document.width)
        l.childMenu.style.pixelLeft = l.childMenu.style.pixelWidth + l.Menu.menuLayer.style.pixelTop + 15;
      else if (l.Menu.childMenuDirection == "left"){
      }
      else
        l.childMenu.style.pixelLeft = l.Menu.menuLayer.style.pixelWidth + l.Menu.menuLayer.style.pixelLeft -5;
      l.childMenu.style.display = "none";
      if (!l.childMenu.disableHide) 
        window.activeMenus[window.activeMenus.length] = l.childMenu;
  }
}
else
{
*/
 for (var i=0; i < l.Menu.childMenus.length; i++) {
    document.getElementById(l.Menu.childMenus[i].id).style.display = "none";
    l.Menu.childMenus[i].Menu.hideChildMenu(l.Menu.childMenus[i]);
  }
  if (l.childMenu) {
      document.getElementById(l.childMenu.id).style.zIndex = document.getElementById(l.Menu.menuLayer.id).style.zIndex +1;
      document.getElementById(l.childMenu.id).pixelTop = document.getElementById(l.id).style.pixelTop + document.getElementById(l.Menu.menuLayer.id).style.pixelTop;
      if ( document.getElementById(l.childMenu.id).style.pixelLeft +  document.getElementById(l.childMenu.id).style.pixelWidth > document.width)
         document.getElementById(l.childMenu.id).style.pixelLeft =  document.getElementById(l.childMenu.id).style.pixelWidth + document.getElementById(l.Menu.menuLayer.id).style.pixelTop + 15;
      else if (l.Menu.childMenuDirection == "left"){
      }
      else
       document.getElementById(l.childMenu.id).style.pixelLeft = document.getElementById(l.Menu.menuLayer.id).style.pixelWidth + document.getElementById(l.Menu.menuLayer.id).style.pixelLeft -5;
      document.getElementById(l.childMenu.id).style.display = "none";
      if (!l.childMenu.disableHide) 
        window.activeMenus[window.activeMenus.length] = l.childMenu;
  }
  window.ActiveMenu = l;
/*
}
*/
}

function hideActiveMenus(l) {
if (!window.activeMenus) return;
for (var i=0; i < window.activeMenus.length; i++) {
  if (!activeMenus[i]) return;
  if (activeMenus[i].display == "block" && activeMenus[i].Menu) {
    activeMenus[i].style.display = "none";
//    activeMenus[i].Menu.container.style.display = "none";
//    activeMenus[i].Menu.container.clip.left = 0;
  }
  else {
    document.getElementById(activeMenus[i].id).style.display = "none";
  }
}
document.onmousemove = mouseTracker;
window.activeMenus.length = 0;
}

function mouseTracker(e) {
e = e || event || window.Event || window.event;
if (e) {
  window.pageX = e.pageX || e.clientX;
  window.pageY = e.pageY || e.clientY;
}}

function setMouseTracker() {
if (document.captureEvents) document.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
document.onmousemove = this.mouseTracker;
document.onmouseup = this.hideMenu;
}



