var MDate = new Date();
// // live popup code                                                           
/* This code is Copyright (c) 1996-1997 Athenia Associates. All rights          
* reserved. To receive the right to license this code for use on your site      
* the original code must be copied from webreference.com. License is            
* granted to user to reuse this code on their own web site if and only if       
* this entire copyright notice is included. Code written by Andy King of        
* webreference.com. See http://webreference.com/dev/menus */                    
                                                                                
// 3-11-97 one menu only code extracted                                         
                                                                                
function jumpPage(formnum,menunum) {                                            
  i=document.forms[formnum].elements[menunum].selectedIndex;                    
  var loc_value2 = "";                                                          
  var loc_value=document.forms[formnum].elements[menunum].options[i].value;     
  for (var j = 0; j < loc_value.length; j++)                                    
  {                                                                             
     if (loc_value.substring(j,j+1) > " ")                                      
       loc_value2 += loc_value.substring(j,j+1);                                
  }                                                                             
  location = loc_value2;                                                        
}                                                                               

                                                                
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( Prefix+"div"+DivID ) )
  {
	if( document.getElementById( Prefix+"div"+DivID ).style.display == 'none' )
	{
		document.getElementById( Prefix+"div"+DivID ).style.display = 'block';
		if( ToggleImg )
			document.getElementById( Prefix+"img"+DivID ).src = '/framework/image/epas/bulletopen2.gif';		
		document.getElementById(StateControlID).value = document.getElementById(StateControlID).value + DivID  + ';';
	}
	else
	{
		document.getElementById( Prefix+"div"+DivID ).style.display = 'none';
		if( ToggleImg )
			document.getElementById( Prefix+"img"+DivID ).src = '/framework/image/epas/bulletclose2.gif';
		document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, DivID + ';', '');
	}
  }
}

/* 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  + ';';
	}
	else
	{
		document.getElementById( "div"+DivID ).style.display = 'none';
		document.getElementById( "img"+DivID ).src = '/framework/image/epas/bulletclose2.gif';
		document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, DivID + ';', '');
	}
}

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 = Prefix+"div";
	var ImgID = Prefix+"img";
	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 + Divs[i].id.substring(DivID.length)  + ';';
			}
			else
			{
			    Divs[i].style.display = 'none';
		        document.getElementById(StateControlID).value = replaceSubstring(document.getElementById(StateControlID).value, Divs[i].id.substring(DivID.length) + ';', '');
			}
		}
	}
	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();
	if( temp != '' )
		divIds = temp.split(';');
	
	for(var i=0; i<divIds.length; i++ )
	{
		if( divIds[i] != '')
		{
		   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';
		   }	
		}	
	}
}
 
function InitializeDivStatePrefix(Prefix,controlID)
{	
	var temp;
	//split values of the parameters into an array	
	temp = document.getElementById(controlID).value;
	var divIds = new Array();
	if( temp != '' )
		divIds = temp.split(';');
	
	for(var i=0; i<divIds.length; i++ )
	{
		if( divIds[i] != '')
		{
		   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';
		   }		
		}	
	}
}

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();
}
/**
 * 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) + '">\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;
	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=7 WIDTH=4 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=7 WIDTH=4 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;
  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)
      document.getElementById(l.id).style.left = parseInt(document.getElementById(parent.id).style.left) + menuWidth -2;
    else
      document.getElementById(l.id).style.left = parseInt(document.getElementById(parent.id).style.left) + menuWidth -1;
    parent.activeMenu =  menu.layer || menu;
  }
  else
  {
    document.getElementById(l.id).style.left =  x || (window.pageX + document.body.scrollLeft);
    if (!document.all)
      document.getElementById(l.id).style.left = parseInt(document.getElementById(l.id).style.left) + 6;
  }
  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;
  }
  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;
    }
  }

  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 || 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;
}


