// begin newnav.js 

// begin what was 'navigation.js' 

var bMenuOn = false;
var strMenuOn = "";
function Load() {
	MM_preloadImages(g_strPopMenuGraphicsDir + 'nav-plan-on.gif',g_strPopMenuGraphicsDir + 'nav-plan-off.gif',g_strPopMenuGraphicsDir + 'nav-your_org-on.gif',g_strPopMenuGraphicsDir + 'nav-your_org-off.gif',
	g_strPopMenuGraphicsDir + 'nav-fash-on.gif',g_strPopMenuGraphicsDir + 'nav-fash-off.gif',g_strPopMenuGraphicsDir + 'nav-jewel-on.gif',g_strPopMenuGraphicsDir + 'nav-jewel-off.gif',g_strPopMenuGraphicsDir + 'nav-registry-on.gif',g_strPopMenuGraphicsDir + 'nav-registry-off.gif',g_strPopMenuGraphicsDir + 'nav-wedshop-on.gif',g_strPopMenuGraphicsDir + 'nav-wedshop-off.gif',g_strPopMenuGraphicsDir + 'nav-honeymoon-on.gif',g_strPopMenuGraphicsDir + 'nav-honeymoon-off.gif',g_strPopMenuGraphicsDir + 'nav-locser-on.gif',g_strPopMenuGraphicsDir + 'nav-locser-off.gif');

	if (navigator.appName == 'Netscape') {
		window.captureEvents(Event.MOUSEMOVE);
		window.onMouseMove = mousemoveNavHandler;
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
	x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; 
	if(d.images){ 
		if(!d.MM_p) 
			d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
	    for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
	}
}

function MM_findObj(n, d) { //v3.0
	var p,i,x;  
	if(!d)
		d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=MM_findObj(n,d.layers[i].document); 
	return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x; 
			if(!x.oSrc) 
				x.oSrc=x.src; 
			x.src=a[i+2];
		}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
	if ((obj=MM_findObj(args[i]))!=null) { 
		v=args[i+2];
	    if (obj.style) { 
			obj=obj.style; 
			v=(v=='show')?'visible':(v='hide')?'hidden':v; 
		}
	    obj.visibility=v; 
		if (v == 'visible' || v == 'show') {
			bMenuOn = true;
			strMenuOn = args[i];
		}
	}
}

function mousemoveNavHandler(evnt) {
	var i, l, r, t, b, x, y, obj;
	if (bMenuOn) {
		if ((obj=MM_findObj(strMenuOn))!=null) { 
		    if (obj.style) { 
				obj=obj.style;
			}
			l=parseInt(obj.left); 
			r=parseInt(obj.clip.right);
			t=parseInt(obj.top);
			b=parseInt(obj.clip.bottom);
			x = evnt.x;
			y = evnt.y;
//		alert("x=" + x + " y=" + y + " l=" + l + " r=" + r + " t=" + t + " b=" + b);
			if (x < 0 || x > r || y > b) {
//		alert("x=" + x + " y=" + y + " l=" + l + " r=" + r + " t=" + t + " b=" + b);
				MM_showHideLayers(strMenuOn,'','hide',strMenuOn + 'off','','show');
					bMenuOn = false;
					strMenuOn = "";
				}
		}
	}
	return true;
}	

function mousemoveHandler() {
	var i, l, w, t, h, x, y, obj;
	if (bMenuOn) {
		if ((obj=MM_findObj(strMenuOn))!=null) { 
		    if (obj.style) { 
				obj=obj.style;
			}
			l=parseInt(obj.left); 
			w=parseInt(obj.width);
			t=parseInt(obj.top);
			h=parseInt(obj.height);
			x = window.event.x;
			y = window.event.y;
//		alert("x=" + x + " y=" + y + " l=" + l + " w=" + w + " t=" + t + " h=" + h);
			if (x < l || x > (l + w) || y > (t + h)) {
				MM_showHideLayers(strMenuOn,'','hide',strMenuOn + 'off','','show');
					bMenuOn = false;
					strMenuOn = "";
				}
		}
	}
}	


function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

//-- end 'navigation.js'

//-- begin what was 'popmenu.js' 
//============================================================================
// Constants = Values that are dependent on other settings
var POPSUBMENU_GRAPHIC_HEIGHT = 7;
var POPSUBMENU_GRAPHIC_WIDTH = 7;
var POPSUBMENU_GRAPHIC_MARGIN = 10;
var POPMENU_ZINDEX_DEFAULT = 30;

//============================================================================
// Constants = Values that are independent of other settings
var POPMENU_ID = "PopMenu";
var POPMENUITEM_ID = "MenuItem";
var POPMENU_SUBIMG_ID = "SubImg";
var POPMENU_NSFRAME_ID = "NSFrame";
var POPSUBMENU_OVERLAP = 5;
var POPSUBMENU_DROP = 5;
var TEST_POPMENUITEM_ID = "PopMenuTest";
var TRUE = 0;
var FALSE = 1;

//============================================================================
// Global variables and their defaults
var g_PopBgColor = "#FAFBED";
var g_PopSelBgColor = "#EEEEFF";
var g_PopBorderSize = 0;
// var g_strPopMenuGraphicsDir = "/secure/images/wc/newnav/";  // In NavBarCode_New, conditional (secure/not)
var g_PopActionDestSelf = false;

//============================================================================
// Functions to be called during the program

/*----------------------------------------------------------------------------
Description: Set the directory to get graphics from
Parameters : a_strGraphicsDir inputs the directory to get graphics from
----------------------------------------------------------------------------*/
function initPopMenuGraphics( a_strGraphicsDir )
{
	g_strPopMenuGraphicsDir = a_strGraphicsDir;
}

/*----------------------------------------------------------------------------
Description: Creates a pop up menu 
Parameters : a_strTitle inputs the name of the menu
Returns	   : A pop menu object
Comments   : The title appears in any parent popup menus
----------------------------------------------------------------------------*/
function createPopMenu( a_strTitle )
{
	// Setup the menu container
	if( !this.PopMenuContainer )
		this.PopMenuContainer = new Array();
		
	// Create a new menu and return it
	this.PopMenuContainer[ this.PopMenuContainer.length ] = new createPopMenuObject( a_strTitle, this.PopMenuContainer.length );
	return this.PopMenuContainer[ this.PopMenuContainer.length - 1 ];
}

/*----------------------------------------------------------------------------
Description: Creates the popup menu object to be used
Parameters : a_strText inputs the text for this container
			 a_nIndex inputs this objects place in the menu list
----------------------------------------------------------------------------*/
function createPopMenuObject( a_strText, a_nIndex )
{
	this.popMenuItems = new Array();		// Array of menu items
	this.Text = a_strText;					// Text to display
	this.Action = "";						// Action to take when this item is clicked on
	this.addPopMenuItem = addPopMenuItem;   // Add a menuitem to this object function
	this.parent = "";						// Track who the parent is
	this.closeWindow = TRUE;				// The closing of the window can be halted once started
	this.Index = a_nIndex;					// Menu number
	this.width = 0;							// The width of the container
	this.setPopMenuWidth = setPopMenuWidth;	// Function to change the width
}

/*----------------------------------------------------------------------------
Description: Adds a menu item to a pop up menu list
Parameters : a_strText inputs the menu title or a submenu object
			 a_strAction inputs the action to take when this menu item is clicked
Comments  : Action is programmed as a website
----------------------------------------------------------------------------*/
function addPopMenuItem( a_strText, a_strAction )
{
	// Check if it is a submenu
	if( a_strText.popMenuItems )
	{
		// Menuitem is a submenu
		this.popMenuItems[ this.popMenuItems.length ] = a_strText;
		a_strText.Action = addQS(a_strAction);
		a_strText.parent = this;
	}
	else
		this.popMenuItems[ this.popMenuItems.length ] = new createPopMenuItemObject( a_strText, addQS(a_strAction), this );
}

/*----------------------------------------------------------------------------
Description: Creates an object for a menu item
Parameters : a_strText inputs the title of the menu item
			 a_strAction inputs the action for the menu item to take when clicked
			 a_popMenuParent inputs the container of this menu item
----------------------------------------------------------------------------*/
function createPopMenuItemObject( a_strText, a_strAction, a_popMenuParent )
{
	this.Text = a_strText;				// Text to display
	this.Action = a_strAction;			// Action to take when this item is clicked on
	this.parent = a_popMenuParent;		// Parent of this menu item
}

/*----------------------------------------------------------------------------
Description: Performs step to create and setup the pop up menus
Parameters : a_BgColor inputs the background color
			 a_SelBgColor inputs the select color when mouse is over a menu item
			 a_nBorderSize inputs the size of the container border
Comments   : Colors had to be passed because of NS quirk
----------------------------------------------------------------------------*/
function initPopMenu( a_BgColor, a_SelBgColor, a_nBorderSize )
{
	// Setup globals
	g_PopBgColor = a_BgColor;
	g_PopSelBgColor = a_SelBgColor;
	g_PopBorderSize = a_nBorderSize;

	// Create and position menus
	writePopMenuHTML();
	posPopMenuItems();
}

/*----------------------------------------------------------------------------
Description: Puts together the html to create the popup menus
Comments   : Outputs HTML to the main window
----------------------------------------------------------------------------*/
function writePopMenuHTML()
{
	// Because some values are readonly once set we need to compute values now and 
	// set them in the html.  We create a temp popmenu which is used to get style
	// values for computations. Align graphic right to use up entire space
	var strOutput = '<DIV ID="' + TEST_POPMENUITEM_ID + '" CLASS="PopMenuItemStyle">';
	strOutput += '<IMG SRC="' + g_strPopMenuGraphicsDir + 'clear.gif" WIDTH=' + POPSUBMENU_GRAPHIC_WIDTH + ' HEIGHT=' + POPSUBMENU_GRAPHIC_HEIGHT + ' BORDER=0 ALT="" ALIGN="RIGHT" VALIGN="MIDDLE"><font color="#FFFFFF">test</font></DIV>';
	document.write( strOutput );
	
	// Hide the test
	if( document.all )
		this[ TEST_POPMENUITEM_ID ].style.visibility = "hidden";
	else
		document[ TEST_POPMENUITEM_ID ].visibility = "hidden";
		
	// Create the pop menus in the list
	strOutput = "";
	for( var nIndex = 0; nIndex < this.PopMenuContainer.length; nIndex++ )
	{
		// Get the menu to be created
		var menuCurrent = this.PopMenuContainer[ nIndex ];
		
		// Create the menu container
		strOutput += '<div align="left" class="PopMenuContainerStyle" id="' + POPMENU_ID + nIndex + '">';
		
		// Loop through the menu items
		for( var nItemIndex = 0; nItemIndex < menuCurrent.popMenuItems.length; nItemIndex++ )
		{
			// Base for each submenu; added empty gif for NS to fill in the whole area
			strOutput += '<DIV ID="' + POPMENU_ID + nIndex + POPMENUITEM_ID + nItemIndex + '" CLASS="PopMenuItemStyle">';
			strOutput += '<IMG SRC="' + g_strPopMenuGraphicsDir + 'clear.gif" WIDTH=' + POPSUBMENU_GRAPHIC_WIDTH + ' HEIGHT=' + POPSUBMENU_GRAPHIC_HEIGHT + ' BORDER=0 ALT="" ALIGN="RIGHT">';
			strOutput += '&nbsp;&nbsp;' + menuCurrent.popMenuItems[ nItemIndex ].Text + '</DIV>';
			
			// Add graphic
			if( menuCurrent.popMenuItems[ nItemIndex ].popMenuItems )
				strOutput += '<DIV ID="' + POPMENU_ID + nIndex + POPMENU_SUBIMG_ID + nItemIndex + '" CLASS="PopMenuGraphicStyle"><IMG SRC="' + g_strPopMenuGraphicsDir + 'SubMenu.gif" WIDTH=' + POPSUBMENU_GRAPHIC_WIDTH + ' HEIGHT=' + POPSUBMENU_GRAPHIC_HEIGHT + ' BORDER=0 ALT=""></DIV>';
		} 
				
		// End menu container
		strOutput += "</DIV>";
	} 

	// Output the menu
	document.write( strOutput );
}

/*----------------------------------------------------------------------------
Description: Positions the menu elements on the screen
----------------------------------------------------------------------------*/
function posPopMenuItems()
{
	// Find out height of menu items
	var nHeight;
	var nWidth = 0;
	if( document.all )
	{
		nHeight = this[ TEST_POPMENUITEM_ID ].offsetHeight;
		nWidth = this[ TEST_POPMENUITEM_ID ].offsetWidth;	 
	}
	else
	{
		nHeight = document[ TEST_POPMENUITEM_ID ].clip.height;
		nWidth = document[ TEST_POPMENUITEM_ID ].clip.width;
	}
		
	// Go through menus and pos menu items
	for( var nIndex = 0; nIndex < this.PopMenuContainer.length; nIndex++ )
	{
		// Get the menu 
		var menuCurrent = this.PopMenuContainer[ nIndex ];
		var menuDiv;
		if( document.all )
			var menuDiv =  this[ POPMENU_ID + nIndex ].style;
		else
			var menuDiv = document[ POPMENU_ID + nIndex ];
			
		// Hook the container into the menu
		menuDiv.popMenuInfo = menuCurrent;
		
		// Container values
		var nItemWidth = nWidth;
		if( menuCurrent.width != 0 )
			nItemWidth = menuCurrent.width;
		
		var nContHeight = nHeight * menuCurrent.popMenuItems.length + ( g_PopBorderSize * 2 );
		var nContWidth = nItemWidth + ( g_PopBorderSize * 2 );
		
		menuDiv.height = nContHeight;
		menuDiv.width = nContWidth;
		// NS requires a second container separate from the first for back table to exist
		if( !document.all )
		{
			// HTML is written here so calculations can be done to set frame to correct size
			var nFrameHeight = (nHeight * menuCurrent.popMenuItems.length) - 6; // NS Magic number 
			var nFrameWidth = nItemWidth - 6;									// NS Magic number 

			// Write out the background frame; frame needs table since NS only shows area that is used
			document.write( '<DIV ID="' + POPMENU_NSFRAME_ID + nIndex + '" CLASS="PopMenuContainerStyle"><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=' + nFrameWidth + '><TR><TD HEIGHT=' + nFrameHeight + '></TD></TR></TABLE></DIV>' );

			// Set the frame values
			document[ POPMENU_NSFRAME_ID + nIndex ].height = nContHeight;
			document[ POPMENU_NSFRAME_ID + nIndex ].width = nContWidth;
			document[ POPMENU_NSFRAME_ID + nIndex ].clip.height = nHeight * menuCurrent.popMenuItems.length + ( g_PopBorderSize * 2 );	// Add one for NS		
		
			// Different setting for NS menu div
			menuDiv.clip.height = nHeight * menuCurrent.popMenuItems.length + ( g_PopBorderSize * 2 ) + 1;  								// Add one for NS
		}

		// Loop through the menu items
		for( var nItemIndex = 0; nItemIndex < menuCurrent.popMenuItems.length; nItemIndex++ )
		{
			// Set the menu item values 
			var menuItemDiv;
			if( document.all )
			{
				menuItemDiv = this[ POPMENU_ID + nIndex + POPMENUITEM_ID + nItemIndex ];
				menuItemDiv.style.backgroundColor = g_PopBgColor;
				menuItemDiv.style.top = nHeight * nItemIndex;
				menuItemDiv.style.width = nItemWidth;
				menuItemDiv.style.cursor = "hand";
			}
			else
			{
				menuItemDiv = document[ POPMENU_ID + nIndex ].document[ POPMENU_ID + nIndex + POPMENUITEM_ID + nItemIndex ];
				menuItemDiv.top = nHeight * nItemIndex;
				menuItemDiv.bgColor = g_PopBgColor;
				menuItemDiv.clip.width = nItemWidth;
				// menuItemDiv.cursor = "hand";	 (don't work)
				
				// NS requires a capture of the event to work
				menuItemDiv.captureEvents( Event.MOUSEUP );
			}

			// Setup event handlers
			menuItemDiv.onmouseover = popMenuItemMouseOver;
			menuItemDiv.onmouseout = popMenuItemMouseOut;
			menuItemDiv.onmouseup = popMenuItemMouseUp;
			
			// Hook the menu information into the div
			menuItemDiv.popMenuInfo = menuCurrent.popMenuItems[ nItemIndex ];
			menuItemDiv.ItemIndex = nItemIndex;
			
			// Position submenu graphic
			if( menuCurrent.popMenuItems[ nItemIndex ].popMenuItems )
			{
				// Get submenu div
				var divSubMenuGraphic;
				if( document.all )
				{
					divSubMenuGraphic = this[ POPMENU_ID + nIndex + POPMENU_SUBIMG_ID + nItemIndex ].style;
					this[ POPMENU_ID + nIndex + POPMENU_SUBIMG_ID + nItemIndex ].onmouseover = popMenuItemMouseOver;
					this[ POPMENU_ID + nIndex + POPMENU_SUBIMG_ID + nItemIndex ].onmouseout = popMenuItemMouseOut;
					this[ POPMENU_ID + nIndex + POPMENU_SUBIMG_ID + nItemIndex ].popMenuInfo = menuCurrent.popMenuItems[ nItemIndex ];
					this[ POPMENU_ID + nIndex + POPMENU_SUBIMG_ID + nItemIndex ].ItemIndex = nItemIndex;
				}
				else
				{
					divSubMenuGraphic = menuDiv.document[ POPMENU_ID + nIndex + POPMENU_SUBIMG_ID + nItemIndex ];
					divSubMenuGraphic.onmouseover = popMenuItemMouseOver;
					divSubMenuGraphic.onmouseout = popMenuItemMouseOut;
					divSubMenuGraphic.popMenuInfo = menuCurrent.popMenuItems[ nItemIndex ];
					divSubMenuGraphic.ItemIndex = nItemIndex;
				}
				
				// Setup graphic on the div
				divSubMenuGraphic.height = POPSUBMENU_GRAPHIC_HEIGHT;
				divSubMenuGraphic.clip.height = POPSUBMENU_GRAPHIC_HEIGHT;
				divSubMenuGraphic.width = POPSUBMENU_GRAPHIC_WIDTH;
				divSubMenuGraphic.visibility = "inherit";
				divSubMenuGraphic.zIndex = 40;
								
				// The div that holds the graphic has a margin
				divSubMenuGraphic.top = (nHeight * nItemIndex) + 1 + ((nHeight - POPSUBMENU_GRAPHIC_HEIGHT) / 2);
				divSubMenuGraphic.left = nItemWidth - POPSUBMENU_GRAPHIC_WIDTH - POPSUBMENU_GRAPHIC_MARGIN + 1;
			}
		}
	} 
}

/*----------------------------------------------------------------------------
Description: Handle a mouse over on a menu item
Comments   : Changes bgcolor of menu item and shows sub menu
----------------------------------------------------------------------------*/
function popMenuItemMouseOver()
{
	// Set this window not to close
	this.popMenuInfo.parent.closeWindow = FALSE;
	
	// Check if there is a parent; the menuitem has a parent which is the container, we want the containers parent
	if( this.popMenuInfo.parent.parent.popMenuItems )
		this.popMenuInfo.parent.parent.closeWindow = FALSE;

	// Change color and get information for the submenu routine
	// Todo: Calculate offsets
	var nTop;
	var nLeft;
	var nZIndex;
	if( document.all )
	{
		var divText = window[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENUITEM_ID + this.ItemIndex ];
		divText.style.backgroundColor = g_PopSelBgColor;
		nTop = divText.offsetParent.offsetTop + divText.offsetTop + POPSUBMENU_DROP;
		nLeft = divText.offsetParent.offsetLeft + divText.offsetWidth - POPSUBMENU_OVERLAP;
		
		nZIndex = window[ POPMENU_ID + this.popMenuInfo.parent.Index ].style.zIndex;
	}
	else
	{
		var divText = window.document[ POPMENU_ID + this.popMenuInfo.parent.Index ].document[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENUITEM_ID + this.ItemIndex ];
		divText.document.bgColor = g_PopSelBgColor;
		nLeft = divText.pageX + divText.clip.width - POPSUBMENU_OVERLAP;
		nTop = divText.pageY + POPSUBMENU_DROP;
		
		nZIndex = window.document[ POPMENU_ID + this.popMenuInfo.parent.Index ].zIndex;
	}

	// Check if it is a submenu
	if( this.popMenuInfo.popMenuItems )
	{
		showPopMenu( this.popMenuInfo, nLeft, nTop, nZIndex );

		this.popMenuInfo.closeWindow = FALSE;
		if( document.all )
			window[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENU_SUBIMG_ID + this.ItemIndex ].style.backgroundColor = g_PopSelBgColor;
		else
			window.document[ POPMENU_ID + this.popMenuInfo.parent.Index ].document[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENU_SUBIMG_ID + this.ItemIndex ].bgColor = g_PopSelBgColor;		
	}
}

/*----------------------------------------------------------------------------
Description: Show the pop menu referenced at the specified location
Parameters : a_popMenu inputs the popmenu object to show
			 a_nXPos inputs the x location to place the window
			 a_nYPos inputs the y location to place the window
			 a_nZIndex inputs the zIndex of the parent menu
----------------------------------------------------------------------------*/
function showPopMenu( a_popMenu, a_nXPos, a_nYPos, a_nZIndex )
{
	// Set this window not to close
	if (a_popMenu) { //test for defined arg added by dsaia on 12/26 to allow parents w/o children
		a_popMenu.closeWindow = FALSE;
		
		// for some reason the zIndex setting is getting lost; third OR case added by dsaia, 12/22/00
		if( a_nZIndex == 0 || a_nZIndex == null || a_nZIndex == undefined ) {
			a_nZIndex = POPMENU_ZINDEX_DEFAULT;
		}
		// Get the menu object
		var divMenu;
		var divNSFrame;
		
// 		if ( (a_popMenu.Index != 6) && (Side != "Guest")  ) { // don't try to show submenu if it's the childless, last one - dsaia, 12/26, or if it's Guest side = dsaia, 02/12/01
// tje suppress drop drow menus if there aren't any menus to show -- added so framed nav bar would work correctly
		if (a_popMenu.popMenuItems.length > 0	) {
		 		if( document.all )
				{
						divMenu = this[ POPMENU_ID + a_popMenu.Index ].style;
						divMenu.top = a_nYPos;
						divMenu.left = a_nXPos;
				}
				else
				{
					// Add bordersize since frame is not on this div
					divMenu = document[ POPMENU_ID + a_popMenu.Index ];
					divMenu.top = a_nYPos + g_PopBorderSize;
					divMenu.left = a_nXPos + g_PopBorderSize;
			
					// This div has frame
					divNSFrame = document[ POPMENU_NSFRAME_ID + a_popMenu.Index ];
					divNSFrame.top = a_nYPos;
					divNSFrame.left = a_nXPos;
					divNSFrame.zIndex = a_nZIndex + 1;
					divNSFrame.visibility = "visible";
				}
						
				// Display the div and put it on top
				divMenu.zIndex = a_nZIndex + 1;	
				divMenu.visibility = "visible";
		} // end test for childless one	
	} // end test for defined arg	
}

/*----------------------------------------------------------------------------
Description: Hide the pop menu
Parameters : a_popMenu inputs the popMenu object to hide or the index of the menu
----------------------------------------------------------------------------*/
function hidePopMenu( a_popMenu )
{
	var divMenu;
	var divNSFrame;
	
	// Check what type of value was passed, object or index
	if( a_popMenu.popMenuItems )
	{
		// Get the menu object
		if( document.all )
			divMenu = this[ POPMENU_ID + a_popMenu.Index ].style;
		else
		{
			divMenu = document[ POPMENU_ID + a_popMenu.Index ];
			divNSFrame = document[ POPMENU_NSFRAME_ID + a_popMenu.Index ];
		}
	}
	else // index was passed
	{
		// Get the menu object
		if( document.all )
			divMenu = this[ POPMENU_ID + a_popMenu ].style;
		else
		{
			divMenu = document[ POPMENU_ID + a_popMenu ];
			divNSFrame = document[ POPMENU_NSFRAME_ID + a_popMenu ];
		}	
	}
	
	// Check whether this window should close
	if (divMenu) { // test for existence of divMenu obj - added by dsaia on 12/26
		if( divMenu.popMenuInfo.closeWindow == TRUE )
		{
			// Close window
			divMenu.visibility = "hidden";
		
			if( !document.all )
				divNSFrame.visibility = "hidden";
					
			// Close the parent window
			if( divMenu.popMenuInfo.parent.popMenuItems )
			{
				hidePopMenu( divMenu.popMenuInfo.parent );
			}
			else
			{
				hidePopMenuCallBack( divMenu.popMenuInfo );
			}
		}
	} // end test for existence of divMenu
}

/*----------------------------------------------------------------------------
Description: Handles mouse up on a menu item event
Comments   : Displays the website of the menuitem action
----------------------------------------------------------------------------*/
function popMenuItemMouseUp()
{
	// Check for an action and perform
	if( this.popMenuInfo.Action != "" )
		if( g_PopActionDestSelf == true )
			window.open( this.popMenuInfo.Action, "_top" );
		else
			window.open( this.popMenuInfo.Action, "_blank" );
}

/*----------------------------------------------------------------------------
Description: Sets the width of this particular pop menu
Parameters : a_nMenuWidth inputs the width to set the menu
Comments   : You can only set the width lower not higher
----------------------------------------------------------------------------*/
function setPopMenuWidth( a_nMenuWidth )
{
	this.width = a_nMenuWidth;
}

/*----------------------------------------------------------------------------
Description: Sets the pop action destination to self window or new window
Parameters : a_fSameWindow inputs to put html in current window or another window
Commments  : True is same window; false is a new window
----------------------------------------------------------------------------*/
function setPopActionDestSelf( a_fSameWindow )
{
	g_PopActionDestSelf = a_fSameWindow;
}

/*----------------------------------------------------------------------------
Description: Handles mouse out on a menu item events
Comments   : Changes bgcolor of menu item back, closes submenu
----------------------------------------------------------------------------*/
function popMenuItemMouseOut()
{
	// Change color
	if( document.all )
		window[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENUITEM_ID + this.ItemIndex ].style.backgroundColor = g_PopBgColor;
	else
	{
		window.document[ POPMENU_ID + this.popMenuInfo.parent.Index ].document[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENUITEM_ID + this.ItemIndex ].bgColor = g_PopBgColor;
	}

	// Check if there is a parent; the menuitem has a parent which is the container, we want the containers parent
	if( this.popMenuInfo.parent.parent.popMenuItems )
		this.popMenuInfo.parent.parent.closeWindow = TRUE;
		
	// Check if it is a submenu
	if( this.popMenuInfo.popMenuItems )
	{
		if( document.all )
			window[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENU_SUBIMG_ID + this.ItemIndex ].style.backgroundColor = g_PopBgColor;
		else
			window.document[ POPMENU_ID + this.popMenuInfo.parent.Index ].document[ POPMENU_ID + this.popMenuInfo.parent.Index + POPMENU_SUBIMG_ID + this.ItemIndex ].bgColor = g_PopBgColor;		

		this.popMenuInfo.closeWindow = TRUE;
		setTimeout( "hidePopMenu( " + this.popMenuInfo.Index + " );", 100 );
	}
	else
		// Close this menu item only if no child, child will attempt to close parent
		setTimeout( "hidePopMenu( '" + this.popMenuInfo.parent.Index + "' );", 100 );
		
	// Close this menu item
	this.popMenuInfo.parent.closeWindow = TRUE;
}

// -- end 'popmenu.js' 


// -- begin what was 'pulldownmenu.js' 



//============================================================================
// Constants = Values that are dependent on other settings
var TRUE = 0;
var FALSE = 1;

var MENUBAR_ID = "MENUBAR";
var MENUBARITEM_ID = "MENUBARITEM";
var MENUBAR_GRAPHIC = "MENUBARGRAPHIC";

//============================================================================
// Global variables and their defaults
var g_strMenuBarGraphicsDir = "";
var g_fPageLoad = TRUE;

//============================================================================
// Functions to be called during the program

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
window.onresize = reloadPage;
//window.onload = loadPage; Commented out because it conflicts with other js in some pages

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function reloadPage()
{
	// Only in NS
	if( !document.all  )
	{
		// Only in version 4.1 and less; dont reload after a load
		if( (g_fPageLoad == FALSE) && ( (parseFloat( navigator.appVersion )) < 4.1 ) )
			location.reload();
		if( (parseFloat( navigator.appVersion ) >= 4.1) )
			location.reload();
		
		// Reset flag
		g_fPageLoad = FALSE;
	}
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function loadPage()
{
	// Needed for 4.1 and less browsers to stop reload after load but permit load after reload
	g_fPageLoad = TRUE;
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function createMenuBar()
{
	// Setup the menu container
	if( !this.MenuBarContainer )
		this.MenuBarContainer = new createMenuBarObject();
	return this.MenuBarContainer;
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function initMenuBarGraphics( a_strMenuBarGraphicsDir )
{
	g_strMenuBarGraphicsDir = a_strGraphicsDir;
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function createMenuBarObject()
{
	this.menuBarItems = new Array();		// List of menu bar items
	this.addMenuBarItem = addMenuBarItem;   // Add a menuitem to this object function	
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function createMenuBarItem( a_strText, a_strAction )
{
	this.PopMenu;							 // Pop menu associated with this menubar
	this.Text = a_strText;					 // Text for this menu item
	this.Action = a_strAction;
	this.ImageOn = new Image();				 // Image when item is active
	this.ImageOff = new Image();			 // Image when item is inactive
	this.ItemImage = null;					
	this.ItemIndex = 0;
	
	this.setImageOn = setImageOn;			 // Function to turn on image
	this.setImageOff = setImageOff;			 // Function to turn off image
	this.setPopMenu = setPopMenu;			 // Function to set the associated pop up menu
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function addMenuBarItem( a_strText, a_strAction )
{
	this.menuBarItems[ this.menuBarItems.length ] = new createMenuBarItem( a_strText, a_strAction );
	return this.menuBarItems[ this.menuBarItems.length - 1];
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function setImageOn( a_strGraphicSrc )
{
   this.ImageOn.src = a_strGraphicSrc;
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function setImageOff( a_strGraphicSrc )
{
	this.ImageOff.src = a_strGraphicSrc;
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function setPopMenu( a_PopMenu )
{
	if (a_PopMenu) { // test for undefined added by dsaia on 12/26 to allow parents w/o children
	this.PopMenu = a_PopMenu;
	}
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function initStaticMenuBar()
{
    	writeMenuBarHTML();
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function initMenuBar()
{
	writeMenuBarHTML();
	posMenuBarItems();
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function writeMenuBarHTML()
{
	// Create the menu bars in the list
	var strOutput = "";

	// Get the menu to be created
	var menuBarCurrent = this.MenuBarContainer;
		
	// Loop through the menu items
	for( var nItemIndex = 0; nItemIndex < menuBarCurrent.menuBarItems.length; nItemIndex++ )
	{
		// Get the menubar item being worked on
		var menuBarItem = menuBarCurrent.menuBarItems[ nItemIndex ];
			
		// Check if an image or label is used
		strOutput += '<A TARGET="_top" HREF="' + menuBarItem.Action + '" onMouseOver="menuBarItemMouseOver( window.MenuBarContainer.menuBarItems[' + nItemIndex + '] )" onMouseOut="menuBarItemMouseOut( window.MenuBarContainer.menuBarItems[' + nItemIndex + '] )"><IMG NAME="' + MENUBAR_GRAPHIC + nItemIndex + '" ALT="" BORDER="0" SRC="' + menuBarItem.ImageOff.src + '"></A>';
	}
				
	// Output the menubar
	document.write( strOutput );
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function posMenuBarItems()
{
	// Get the menu 
	var menuBarCurrent = this.MenuBarContainer;

	// Loop through the menu items
	for( var nItemIndex = 0; nItemIndex < menuBarCurrent.menuBarItems.length; nItemIndex++ )
	{
		// Get the menu item
		var menuBarImg;
		if( document.all )
			menuBarImg = this.document.images[ MENUBAR_GRAPHIC + nItemIndex ];
		else
			menuBarImg = document.images[ MENUBAR_GRAPHIC + nItemIndex ];
			
		// Hook into the menu system
		menuBarCurrent.menuBarItems[ nItemIndex ].ItemImage = menuBarImg;
		menuBarCurrent.menuBarItems[ nItemIndex ].ItemIndex = nItemIndex;
	}
}


/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function menuBarItemMouseOver( a_MenuItem )
{
	a_MenuItem.ItemImage.src = a_MenuItem.ImageOn.src;
	if( document.all )
	{
		var nLeft = 0;
		var nTop = 0;
		var fParentExists = true;
		var CurrentObject = a_MenuItem.ItemImage;
		while( fParentExists )
		{
			nLeft += CurrentObject.offsetLeft;
			nTop += CurrentObject.offsetTop;
			if( CurrentObject.offsetParent.tagName != "BODY" )
				CurrentObject = CurrentObject.offsetParent;
			else
				fParentExists = false;
		}
		showPopMenu( a_MenuItem.PopMenu, nLeft, nTop + a_MenuItem.ItemImage.height );
	}
	else
		showPopMenu( a_MenuItem.PopMenu, a_MenuItem.ItemImage.x, a_MenuItem.ItemImage.y + a_MenuItem.ItemImage.height );
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function menuBarItemMouseOut( a_MenuItem )
{
	if (a_MenuItem)
	a_MenuItem.PopMenu.closeWindow = TRUE;	
	setTimeout( 'deactivateImage( window.MenuBarContainer.menuBarItems[' + a_MenuItem.ItemIndex + '] )', 50 );
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function deactivateImage( a_MenuItem )
{
	if( a_MenuItem.PopMenu.closeWindow == TRUE )
	{
		a_MenuItem.ItemImage.src = a_MenuItem.ImageOff.src;
		hidePopMenu( a_MenuItem.PopMenu );
	}
}

/*----------------------------------------------------------------------------
----------------------------------------------------------------------------*/
function hidePopMenuCallBack( a_popMenu )
{
	// Loop through the menu items
	for( var nItemIndex = 0; nItemIndex < this.MenuBarContainer.menuBarItems.length; nItemIndex++ )
	{
		// Hook into the menu system
		if( this.MenuBarContainer.menuBarItems[ nItemIndex ].PopMenu.Text == a_popMenu.Text )
			this.MenuBarContainer.menuBarItems[ nItemIndex ].ItemImage.src = this.MenuBarContainer.menuBarItems[ nItemIndex ].ImageOff.src;
	}
}

// -- end 'pulldownmenu.js'

// -- end newnav.js --

