//=============================================================================================\\
// WebMenu Genie Base classes
// (c) 2003 Webport Data
// Author: David Reymers
// Version 1.1.2
//
// License: This header block must remain intact.
// Commercial use of this script requires registration with WebPort Data.
//
// Complete documentation and support is available at http://www.webportdata.com/webmenu
//=============================================================================================\\

// Error Handler for debugging
// window.onerror = ErrorHandler;
// function ErrorHandler(msg, url, lno) {alert(msg + " : " + lno);}

// Global Constants: do not reset these
wmBROWSEROK    = true;
wmMAIN         = 1;
wmTEXT         = 0;
wmIMAGE        = 1;
wmVERT         = 0;
wmHORIZ        = 1;
wmPAUSE        = 1;
wmTIMECTR      = 0;
wmNONE         = 0;
wmFADE         = 1;
wmSCROLLDOWN   = 2;
wmSCROLLOVER   = 3;
wmOPENOUT      = 4;
wmFUZZYFADE    = 5;
wmPIXELATE     = 6;
wmSTRETCHOVER  = 7;
wmSTRETCHOUT   = 8;

// Global Variables: these may be overridden by the calling script
wmRELATIVE     = true;
wmPREFIX       = "wm";
wmFONT         = "Arial";
wmFONTSIZE     = "2";
wmTEXTCLASS    = "";
wmFONTBOLD     = false;
wmFONTALIGN    = "left";
wmFONTITALIC   = false;
wmFORECOLOR    = "black";
wmFOREOVER     = "white";
wmFOREDOWN     = "white";
wmFOREDIS      = "#808080";
wmBACKCOLOR    = "#CE007B";
wmBACKOVER     = "navy";
wmBACKDOWN     = "navy";
wmBACKDIS      = "#D4D0C8";
wmBACKIMG      = "";
wmBACKIMGOVER  = "";
wmBACKIMGDOWN  = "";
wmBACKIMGDIS   = "";
wmMENUBACK     = "white";
wmMENUBACKIMG  = "";
wmBORDCLASS    = "";
wmBORDWIDTH    = 0;
wmCHECKCOL     = false;
wmCHECK        = "";
wmCHECKOVER    = "";
wmCHECKDOWN    = "";
wmCHECKDIS     = "";
wmCHECKWIDTH   = 0;
wmCHECKHEIGHT  = 0;
wmARROWCOL     = false;
wmARROW        = "";
wmARROWOVER    = "";
wmARROWDOWN    = "";
wmARROWDIS     = "";
wmARROWWIDTH   = 0;
wmARROWHEIGHT  = 0;
wmICONCOL      = false;
wmICON         = "";
wmICONOVER     = "";
wmICONDOWN     = "";
wmICONDIS      = "";
wmICONWIDTH    = 0;
wmICONHEIGHT   = 0;
wmPICWIDTH     = 0;
wmPICHEIGHT    = 0;
wmCURSOR       = "default";
wmCLICKMAIN    = false;
wmNOITEMOVER   = false;
wmHTOPOFFSET   = 1;
wmHLEFTOFFSET  = 0;
wmVTOPOFFSET   = 7;
wmVLEFTOFFSET  = -5;
wmTRANSPARENT  = false;
wmITRANSPARENT = false;
wmMENUMARGIN   = 0;
wmDELAY        = 1000;
wmIBORDCLASS   = "";
wmIBORDWIDTH   = 0;
wmOPACITY      = 0;
wmFADESPEED    = 20;
wmTRANSITION   = 0;
wmTRANSSPEED   = .5;
wmAUTOADJUST   = true;
wmSTRETCHMAIN  = false;
wmDIVCLASS     = "";
wmHIDEONCLICK  = false;

// This script is not compatible with some older browsers which use layers
if (document.layers) wmBROWSEROK = false;

// Detect browser
var version=0, temp="";
wmNS    = (navigator.appName == "Netscape");
if (wmNS && navigator.userAgent.substring(8).indexOf("Netscape")) {
	wmMOZ = true;
}
wmOPERA = (navigator.userAgent.indexOf("Opera") != -1);
wmMOZ   = (wmNS && navigator.userAgent.indexOf("Netscape") == -1);
if (wmMOZ) wmNS = false;
wmIE55  = (!wmOPERA && navigator.appName.indexOf("Internet Explorer") != -1)
if (wmIE55) {
	if (navigator.appVersion.indexOf("MSIE") != -1)
		temp=navigator.appVersion.split("MSIE");
	version = parseFloat(temp[1]);
	wmIE55  = (version >= 5.5);
}

// Initialize screen for Netscape
// For some unknown, NS won't getElementById for the main menu if nStlye=wmIMAGE.
// This code "initializes" it first.
if (wmNS) {
	wmMnull = new wmMenu("wmMnull", wmMAIN, 0, 0);
	wmInull = wmMnull.AddItem("wmInull", "x");
	wmMnull.lVisible = false;
	wmMnull.Paint();
	wmMnull = null;
}

//===========================================================================================\\
// Menu Class
// For the Main Menu, oParent must = wmMAIN
///==========================================================================================\\
function wmMenu (cName, oParent, nLeft, nTop, nWidth, nZindex, nStyle) {

	this.lMain          = (oParent == null || oParent == wmMAIN ? true : false);

	// Parameters
	this.cName          = cName;
	this.oParent        = (this.lMain ? null : oParent);
	this.nLeft          = nLeft;
	this.nTop           = nTop;
	this.nWidth         = (nWidth ? nWidth : 0);
	this.nZindex        = (nZindex && nZindex > 0 ? nZindex : 
		(this.lMain ? 0 : oParent.oParent.nZindex + 1));
	this.nStyle         = 0; // this is set below after oParentMenu is set...

	// Internal use only
	this.cId            = wmPREFIX + cName;
	this.oScreen        = null;
	this.oParentMenu    = (this.lMain ? null : this.oParent.oParent);
	this.oActiveMenu    = null;
	this.lOnMenu        = false;
	this.lOnItem        = false;
	this.aItems         = [];
	this.lFadeOk        = false;
	this.lFirstShow     = true;
	this.cTag           = "";
	this.oWindow        = window;
	this.oPMenu         = null;
	this.lPrime         = false;
	this.nFBordTop      = 0;
	this.nFBordLeft     = 0;
	this.aSMenus        = [];
	this.aNSFrameTop    = [];
	this.aNSFrameLeft   = [];

	// Default settings: these may be overridden

	// Style
	// If passed use that, otherwise use the parent menu
	// Main uses the global default
	if (nStyle) this.nStyle = nStyle;
	else if (nStyle == 0) nStyle = 0;
	else if (this.lMain) this.nStyle = wmTEXT;
	else this.nStyle = this.oParentMenu.nStyle;

	this.nHeight        = 0;
	this.nOrient        = (this.lMain ? wmHORIZ : wmVERT);
	this.lVisible       = (this.lMain ? true : false);
	this.lClickMain     = wmCLICKMAIN;
	this.lStretchMain   = wmSTRETCHMAIN;
	this.lAutoAdjust    = (this.oParentMenu ? this.oParentMenu.lAutoAdjust   : wmAUTOADJUST);
	this.cBorderClass   = (this.oParentMenu ? this.oParentMenu.cBorderClass  : wmBORDCLASS);
	this.nBorderWidth   = (this.oParentMenu ? this.oParentMenu.nBorderWidth  : wmBORDWIDTH);
	this.cMenuBackImg   = (this.oParentMenu ? this.oParentMenu.cMenuBackImg  : wmMENUBACKIMG);
	this.cMenuBack      = (this.oParentMenu ? this.oParentMenu.cMenuBack     : wmMENUBACK);
	this.nMargin        = (this.oParentMenu ? this.oParentMenu.nMargin       : wmMENUMARGIN);
	this.nOpacity       = (this.oParentMenu ? this.oParentMenu.nOpacity      : wmOPACITY);
	this.lTransparent   = (this.oParentMenu ? this.oParentMenu.lTransparent  : wmTRANSPARENT);
	this.nTransition    = (this.oParentMenu ? this.oParentMenu.nTransition   : wmTRANSITION);
	this.nTransSpeed    = (this.oParentMenu ? this.oParentMenu.nTransSpeed   : wmTRANSSPEED);
	this.nHTopOffset    = (this.oParentMenu ? this.oParentMenu.nHTopOffset   : wmHTOPOFFSET);
	this.nHLeftOffset   = (this.oParentMenu ? this.oParentMenu.nHLeftOffset  : wmHLEFTOFFSET);
	this.nVTopOffset    = (this.oParentMenu ? this.oParentMenu.nVTopOffset   : wmVTOPOFFSET);
	this.nVLeftOffset   = (this.oParentMenu ? this.oParentMenu.nVLeftOffset  : wmVLEFTOFFSET);

	// These properties get copied to the items
	// (If IconCol and CheckCol are both true, the check column will not be displayed)
	this.cCursor        = (this.oParentMenu ? this.oParentMenu.cCursor       : wmCURSOR);
	this.cFont          = (this.oParentMenu ? this.oParentMenu.cFont         : wmFONT);
	this.cFontSize      = (this.oParentMenu ? this.oParentMenu.cFontSize     : wmFONTSIZE);
	this.cFontAlign     = (this.oParentMenu ? this.oParentMenu.cFontAlign    : wmFONTALIGN);
	this.cTextClass     = (this.oParentMenu ? this.oParentMenu.cTextClass    : wmTEXTCLASS);
	this.lFontBold      = (this.oParentMenu ? this.oParentMenu.lFontBold     : wmFONTBOLD);
	this.lFontItalic    = (this.oParentMenu ? this.oParentMenu.lFontItalic   : wmFONTITALIC);
	this.cBackColor     = (this.oParentMenu ? this.oParentMenu.cBackColor    : wmBACKCOLOR);
	this.cBackOver      = (this.oParentMenu ? this.oParentMenu.cBackOver     : wmBACKOVER);
	this.cBackDown      = (this.oParentMenu ? this.oParentMenu.cBackDown     : wmBACKDOWN);
	this.cBackDis       = (this.oParentMenu ? this.oParentMenu.cBackDis      : wmBACKDIS);
	this.cForeColor     = (this.oParentMenu ? this.oParentMenu.cForeColor    : wmFORECOLOR);
	this.cForeOver      = (this.oParentMenu ? this.oParentMenu.cForeOver     : wmFOREOVER);
	this.cForeDown      = (this.oParentMenu ? this.oParentMenu.cForeDown     : wmFOREDOWN);
	this.cForeDis       = (this.oParentMenu ? this.oParentMenu.cForeDis      : wmFOREDIS);
	this.cBackImg       = (this.oParentMenu ? this.oParentMenu.cBackImg      : wmBACKIMG);
	this.cBackImgOver   = (this.oParentMenu ? this.oParentMenu.cBackImgOver  : wmBACKIMGOVER);
	this.cBackImgDown   = (this.oParentMenu ? this.oParentMenu.cBackImgDown  : wmBACKIMGDOWN);
	this.cBackImgDis    = (this.oParentMenu ? this.oParentMenu.cBackImgDis   : wmBACKIMGDIS);
	this.cIBorderClass  = (this.oParentMenu ? this.oParentMenu.cIBorderClass : wmIBORDCLASS);
	this.nIBorderWidth  = (this.oParentMenu ? this.oParentMenu.nIBorderWidth : wmIBORDWIDTH);
	this.lArrowCol      = (this.oParentMenu ? this.oParentMenu.lArrowCol     : wmARROWCOL);
	this.lCheckCol      = (this.oParentMenu ? this.oParentMenu.lCheckCol     : wmCHECKCOL);
	this.lIconCol       = (this.oParentMenu ? this.oParentMenu.lIconCol      : wmICONCOL);
	this.nIconWidth     = (this.oParentMenu ? this.oParentMenu.nIconWidth    : wmICONWIDTH);
	this.nIconHeight    = (this.oParentMenu ? this.oParentMenu.nIconHeight   : wmICONHEIGHT);
	this.nCheckWidth    = (this.oParentMenu ? this.oParentMenu.nCheckWidth   : wmCHECKWIDTH);
	this.nCheckHeight   = (this.oParentMenu ? this.oParentMenu.nCheckHeight  : wmCHECKHEIGHT);
	this.nArrowWidth    = (this.oParentMenu ? this.oParentMenu.nArrowWidth   : wmARROWWIDTH);
	this.nArrowHeight   = (this.oParentMenu ? this.oParentMenu.nArrowHeight  : wmARROWHEIGHT);
	this.nPicWidth      = (this.oParentMenu ? this.oParentMenu.nPicWidth     : wmPICWIDTH);
	this.nPicHeight     = (this.oParentMenu ? this.oParentMenu.nPicHeight    : wmPICHEIGHT);
	this.cIcon          = (this.oParentMenu ? this.oParentMenu.cIcon         : wmICON);
	this.cIconOver      = (this.oParentMenu ? this.oParentMenu.cIconOver     : wmICONOVER);
	this.cIconDown      = (this.oParentMenu ? this.oParentMenu.cIconDown     : wmICONDOWN);
	this.cIconDis       = (this.oParentMenu ? this.oParentMenu.cIconDis      : wmICONDIS);
	this.lNoItemOver    = (this.oParentMenu ? this.oParentMenu.lNoItemOver   : wmNOITEMOVER);
	this.cCheck         = (this.oParentMenu ? this.oParentMenu.cCheck        : wmCHECK);
	this.cCheckOver     = (this.oParentMenu ? this.oParentMenu.cCheckOver    : wmCHECKOVER);
	this.cCheckDown     = (this.oParentMenu ? this.oParentMenu.cCheckDown    : wmCHECKDOWN);
	this.cCheckDis      = (this.oParentMenu ? this.oParentMenu.cCheckDis     : wmCHECKDIS);
	this.cArrow         = (this.oParentMenu ? this.oParentMenu.cArrow        : wmARROW);
	this.cArrowOver     = (this.oParentMenu ? this.oParentMenu.cArrowOver    : wmARROWOVER);
	this.cArrowDown     = (this.oParentMenu ? this.oParentMenu.cArrowDown    : wmARROWDOWN);
	this.cArrowDis      = (this.oParentMenu ? this.oParentMenu.cArrowDis     : wmARROWDIS);
	this.lItransparent  = (this.oParentMenu ? this.oParentMenu.lItransparent : wmITRANSPARENT);
	this.lDivider       = (this.oParentMenu ? this.oParentMenu.lDivider      : false);
	this.cDivClass      = (this.oParentMenu ? this.oParentMenu.cDivClass     : wmDIVCLASS);
	this.lHideOnClick   = (this.oParentMenu ? this.oParentMenu.lHideOnClick  : wmHIDEONCLICK);

	// Methods
	this.Paint          = wmMenuPaint;
	this.Show           = wmShow;
	this.Hide           = wmHide;
	this.AddItem        = wmAddItem;
	this.GetMain        = wmGetMain;
	this.SetColor       = wmMenuSetColor;
	this.MenuOff        = wmMenuOff;
	this.MouseOver      = wmMenuMouseOver;
	this.MouseOut       = wmMenuMouseOut;
	this.GetTop         = wmGetTop;
	this.GetLeft        = wmGetLeft;
	this.MenuAdjust     = wmMenuAdjust;
	this.SetTopLeft     = wmSetTopLeft;

	// Reference to the main menu
	this.oMain = this.GetMain();
}
//-------------------------------------------------------------------------------------------\\
function wmGetTop (oObject) {
	var nOffset = 0;
	var oParent = null;

	if (!oObject) oObject = this.oScreen;
	nOffset = oObject.offsetTop;
	oParent = oObject.offsetParent;
	if (oParent.tagName != "BODY") nOffset += this.GetTop(oParent);

	return nOffset;
}
//-------------------------------------------------------------------------------------------\\
function wmGetLeft (oObject) {
	var nOffset = 0;
	var oParent = null;

	if (!oObject) oObject = this.oScreen;
	nOffset = oObject.offsetLeft;
	oParent = oObject.offsetParent;
	if (oParent.tagName != "BODY") nOffset += this.GetLeft(oParent);

	return nOffset;
}
//-------------------------------------------------------------------------------------------\\
function wmAddItem (cName, cCaption, cNorm, cOver, cDown, cBackNorm, cBackOver, cBackDown) {
	var nIdx = this.aItems.length;
	this.aItems[nIdx] = new wmItem(cName, this, cCaption, cNorm, cOver, cDown, 
		cBackNorm, cBackOver, cBackDown);

	return this.aItems[nIdx];
}
//-------------------------------------------------------------------------------------------\\
function wmMenuMouseOver () {
	this.oMain.lOnItem = true;
}
//-------------------------------------------------------------------------------------------\\
function wmMenuMouseOut () {
	this.oMain.lOnItem = false;
	setTimeout(this.oMain.cName  + ".MenuOff();", wmDELAY);
}
//-------------------------------------------------------------------------------------------\\
function wmShow (lNoSecond) {

	var lnFilter  = (this.nOpacity == 0 ? 0 : 1);
	var nWidth    = 0;
	var nTop      = 0;
	var nLeft     = 0;
	var oPMenu    = null;
	var oSMenu    = null;
	var nIdx      = 0;
	var lViewable = true;

	if (this.cName == "wmMnull") return;

	// First time displaying menu, adjust it
	if (this.lFirstShow) {
		this.MenuAdjust();
		this.lFirstShow = false;
	}

	// If there are no items or if already visible, do not display
	if (!this.lVisible || this.aItems.length > 0) {

		this.SetTopLeft();

		// Pre-effect
		if (!wmOPERA && !wmMOZ) {
			if (wmNS) {
				if (this.nTransition == wmFADE && this.lFadeOk)
					this.oScreen.style.MozOpacity = "0%";
			}
			else if (!wmIE55) {
				if (this.nTransition == wmFADE && this.lFadeOk)
					this.oScreen.filters.alpha.opacity = 0;
			}
			else if (this.nTransition > wmNONE && this.oScreen.filters[lnFilter]) {
				this.oScreen.filters[lnFilter].duration = this.nTransSpeed;
				this.oScreen.filters[lnFilter].apply();
			}
		}

		// Set all item looks to "out"
		// And Set items checked visible
		for (nIdx=0; nIdx < this.aItems.length; nIdx++) {
			if (this.aItems[nIdx].lEnabled) this.aItems[nIdx].SetLook("out");
			if (this.aItems[nIdx].lCheckCol && this.aItems[nIdx].lChecked) 
				this.aItems[nIdx].oCheck.style.visibility="visible";
		}

		// Post-effect
		if (!wmOPERA && !wmMOZ) {
			if (wmNS || !wmIE55) {
				if (this.nTransition == wmFADE && this.lFadeOk) 
					wmFadeIn(this.cId, (this.nOpacity == 0 ? 100 : this.nOpacity));
			}
			else if (this.nTransition > wmNONE && this.oScreen.filters[lnFilter]) 
				this.oScreen.filters[lnFilter].Play();
		}

		// Show the same menu on all other frames
		if (!lNoSecond && !this.lMain) oPMenu = this.oMain.oPMenu;
		if (oPMenu) {
			// Activate the prime menu
			if (!this.oMain.lPrime) {
				oSMenu = eval("oPMenu.oWindow." + this.cName);
				if (oSMenu) if (!oSMenu.lVisible) oSMenu.Show(true);
			}

			// Activate all secondary menus
			for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
				oSMenu = eval("oPMenu.aSMenus[nIdx].oWindow." + this.cName)
				if (oSMenu) if (!oSMenu.lVisible) oSMenu.Show(true);

				// if nTop=0 this is the first time the current secondary menu 
				//     is run, so run Show again to calculate the top/left 
				//     after main has been set
				if (this.nTop == 0) this.Show(true);
			}
		}

		// Show this menu and set it as the active menu
		this.lVisible = true;

		// Only display the menu if it is in the viewable area
		if (wmNS || wmMOZ) {
			if ((this.nTop < 0 - this.nHeight || this.nTop - document.body.scrollTop > window.innerHeight) ||
					(this.nLeft < 0 - this.nWidth || this.nLeft - document.body.scrollLeft > window.innerWidth)) {
				lViewable = false;
			}
		}
		else {
			if ((this.nTop < 0 - this.nHeight || this.nTop - document.body.scrollTop > document.body.clientHeight) ||
					(this.nLeft < 0 - this.nWidth || this.nLeft - document.body.scrollLeft > document.body.clientWidth)) {
				lViewable = false;
			}
		}
		if (lViewable) this.oScreen.style.visibility = "visible";

		this.oMain.lOnMenu = true;
		if (this.oParent != null) this.oParentMenu.oActiveMenu = this;
	}
}
//-------------------------------------------------------------------------------------------\\
function wmSetTopLeft () {

	// Don't set top/left of the main menu
	if (this.lMain) return;

	var nWidth = 0
	var nTop   = 0
	var nLeft  = 0;
	var oPMenu = this.oMain.oPMenu;
	var oMenu  = (oPMenu ? eval("oPMenu.oWindow." + this.cName) : null);

	// If this is the prime menu or the only menu, calculate the top/left
	if (this.oMain.lPrime || !oMenu) {
		// Set the top/left of the prime menu
		if (this.oParentMenu.nOrient == wmHORIZ) {

			// Parent menu is horizontal
			this.nTop = this.oParentMenu.GetTop() + 
				this.oParentMenu.oScreen.offsetHeight + 
				this.nHTopOffset;

			// Figure out the width of all parent's items before this menu's parent
			nWidth = this.oParentMenu.GetLeft() + this.oParentMenu.nBorderWidth
			for (nIdx=0; this.oParentMenu.aItems[nIdx].cName != this.oParent.cName; nIdx++)
				nWidth += this.oParentMenu.aItems[nIdx].oScreen.offsetWidth + this.oParentMenu.nMargin;
				this.nLeft = nWidth + this.nHLeftOffset
				if (!wmNS) this.nLeft += this.oParentMenu.nMargin;
			}
		else {
			// Parent menu is vertical
			// Figure out height of all parent's items before this menu's parent
			nTop = this.oParentMenu.GetTop() + this.oParentMenu.nBorderWidth + this.oParentMenu.nMargin;
			for (nIdx=0; this.oParentMenu.aItems[nIdx].cName != this.oParent.cName; nIdx++)
				nTop += this.oParentMenu.aItems[nIdx].oScreen.offsetHeight + this.oParentMenu.nMargin;
			this.nTop = nTop + this.nVTopOffset;
			this.nLeft = this.oParentMenu.GetLeft() + 
			this.oParentMenu.oScreen.offsetWidth + 
			this.oParent.nBorderWidth * 2 + 
			this.nVLeftOffset;
				this.nLeft -= this.oParent.nBorderWidth * 2
		}

		// Adjust top if screen is too short
		if (this.nOrient == wmVERT && this.lAutoAdjust && this.oMain.oPMain) {
			if (this.nTop - document.body.scrollTop + this.nHeight > document.body.clientHeight) {
				if (this.nHeight > document.body.clientHeight) this.nTop = document.body.scrollTop;
				else this.nTop = document.body.clientHeight - this.nHeight + document.body.scrollTop;
			}
		}
	}
	else {
		// This is a secondary menu - set the top/left relative to the primary frame
		if (wmNS || wmMOZ) {
			// Netscape / Mozilla: Firgure the frame's offset
			if (this.oMain.nOrient == wmHORIZ) {
				this.nTop = -(oMenu.oWindow.innerHeight - 
					oMenu.nTop + oMenu.oWindow.document.body.scrollTop -
					this.oWindow.document.body.scrollTop);
				this.nLeft = oMenu.nLeft + this.oWindow.document.body.scrollLeft;
			}
			else {
				this.nLeft = -(oMenu.oWindow.innerWidth - 
					oMenu.nLeft + oMenu.oWindow.document.body.scrollLeft -
					this.oWindow.document.body.scrollLeft);
				this.nTop = oMenu.nTop + this.oWindow.document.body.scrollTop;
			}

			// Apply additional additional frames offset - shift up/left
			// If the frame name begins with "-", offset shifts down/right
			for (nIdx = 0; nIdx < this.oMain.aNSFrameTop.length; nIdx++) {
				nShift = 1;
				cFrame = this.oMain.aNSFrameTop[nIdx];
				if (cFrame.substr(0,1) == "-") {
					nShift = -1;
					cFrame = cFrame.substr(1);
				}
				oFrame = eval("parent.frames." + cFrame);
				if (oFrame) nTop += (oFrame.innerHeight-1) * nShift;
			}
			this.nTop -= nTop;

			for (nIdx = 0; nIdx < this.oMain.aNSFrameLeft.length; nIdx++) {
				nShift = 1;
				cFrame = this.oMain.aNSFrameLeft[nIdx];
				if (cFrame.substr(0,1) == "-") {
					nShift = -1;
					cFrame = cFrame.substr(1);
				}
				oFrame = eval("parent.frames." + cFrame);
				if (oFrame) nLeft += oFrame.innerWidth * nShift;
			}
			this.nLeft -= nLeft;

			// Account for the frame borders
			this.nTop  -= this.oMain.nFBordTop;
			this.nLeft -= this.oMain.nFBordLeft;
		}
		else {
			// IE and Opera
			// Determine the frame's offset realtive to the main menu
			this.nTop = -(window.screenTop - oMenu.oWindow.screenTop - 
				oMenu.nTop + oMenu.oWindow.document.body.scrollTop) + 
				this.oWindow.document.body.scrollTop;
			this.nLeft = -(window.screenLeft - oMenu.oWindow.screenLeft - 
				oMenu.nLeft + oMenu.oWindow.document.body.scrollLeft) + 
				this.oWindow.document.body.scrollLeft;

			// Account for the frame borders - IE, horizontal only
			if (!wmOPERA && this.oMain.nOrient == wmHORIZ) {
				this.nTop  -= (this.oMain.nFBordTop  > 0 ? 2 : 
					this.oMain.nFBordTop < 0 ? -2 : 0);
				this.nLeft -= (this.oMain.nFBordLeft > 0 ? 2 : 
					this.oMain.nFBordLeft < 0 ? -2 : 0);
			}
		}
	}
	// Set the browser object's top/left
	this.oScreen.style.top  = this.nTop;
	this.oScreen.style.left = this.nLeft;
}
//-------------------------------------------------------------------------------------------\\
function wmMenuAdjust () {

	var nIdx    = 0;
	var nHeight = 0;
	var nWidth  = 0;
	var nTop    = 0;
	var nTableWidth  = 0;
	var nHighest     = 0;
	var nWidest      = 0;
	var nTotalHeight = 0;
	var nTotalWidth  = 0;
	var nItemBorder  = 0;

	// Main Menu: Get the top / left
	if (this.lMain) {
		this.nTop  = this.GetTop();
		this.nLeft = this.GetLeft();
	}

	// Auto adjust all elements to fit: figure the highest and widest
	for (nIdx=0; nIdx < this.aItems.length; nIdx++) {
		with (this.aItems[nIdx]) {
			// Readjust the arrow table cell width
			if (oArrowCell && oArrowCell.offsetWidth != nArrowWidth)
				oArrowCell.style.width = nArrowWidth;

			nHighest = (nHighest < oScreen.offsetHeight ? oScreen.offsetHeight : nHighest);
			nWidest  = (nWidest < oScreen.offsetWidth ? oScreen.offsetWidth  : nWidest);
		}
	}

	// Set items to highest and widest
	for (nIdx=0; nIdx < this.aItems.length; nIdx++) {
		with (this.aItems[nIdx]){
			// When the menu is in a table, the offsets are zero
			if (oScreen.offsetHeight > 0)
				nHeight = oScreen.offsetHeight;
			if (oScreen.offsetWidth > 0)
				nWidth = oScreen.offsetWidth;

			if (this.nOrient == wmHORIZ) {
				oScreen.style.height = nHighest;
				nHeight = nHighest;
			}
			else {
				oScreen.style.width = nWidest;
				nWidth = nWidest;
			}

			// Set .style to equal what was just read from .offset (they should be the same, but are not)
			if (this.nOrient == wmVERT && !wmNS && !wmMOZ)
				oScreen.style.height = nHeight
			if (this.nOrient == wmHORIZ)
				oScreen.style.width = nWidth;

			nTotalWidth += oScreen.offsetWidth;
			nTotalHeight += oScreen.offsetHeight;

			if (nIdx > 0) nItemBorder += nBorderWidth * 2;
		}
	}

	nTotalWidth = nTotalWidth + (this.nMargin * this.aItems.length) + this.nMargin;
	nTotalHeight = nTotalHeight + (this.nMargin * this.aItems.length) + this.nMargin;

	// Netscape/Opera doesn't include the style class border or margin width
	if (wmNS) nTotalWidth -= nItemBorder;
	if (wmOPERA || wmNS || wmMOZ) nWidest += (this.nMargin * 2);

	// Set menu properties to highest and widest
	if (!this.lMain || !this.lStretchMain) {
		if (this.nOrient == wmHORIZ) {
			if (this.nHeight < nHighest) this.nHeight = nHighest;
			if (!this.lMain || !this.lStretchMain)
				if (this.nWidth < nTotalWidth) this.nWidth = nTotalWidth;
		}
		else {
			if (this.nWidth < nWidest) this.nWidth = nWidest;
			if (!this.lMain || !this.lStretchMain)
				if (this.nHeight < nTotalHeight) this.nHeight = nTotalHeight;
		}

		// Set menu display height/width
		if (wmNS || wmMOZ || wmOPERA) this.oScreen.style.width = this.nWidth;
		else this.nWidth = this.oScreen.offsetWidth;
		this.nHeight = this.oScreen.offsetHeight;	
	}
}
//-------------------------------------------------------------------------------------------\\
function wmHide (lNoSecond) {

	var oPMenu = null;
	var oSMenu = null;
	var nIdx = 0;

	if (!this.lMain) {

		this.oScreen.style.visibility = "hidden";
		this.lVisible = false;

		// Also hide the submenu (if it exists)
		if (this.oActiveMenu != null) this.oActiveMenu.Hide();

		this.oParentMenu.oActiveMenu = null;

		// Set item's look to "out"
		// And set checked items to hidden
		for (nIdx=0; nIdx < this.aItems.length; nIdx++) 
			if (this.aItems[nIdx].lCheckCol && this.aItems[nIdx].lChecked)
				this.aItems[nIdx].oCheck.style.visibility="hidden";

		// Set parent item's look to "out"
		this.oParent.SetLook("out");

		// If using frames, hide all other corresponding menus
		if (!lNoSecond && !this.lMain) oPMenu = this.oMain.oPMenu;
		if (oPMenu) {
			// Hide the prime menu
			if (!this.oMain.lPrime) {
				oSMenu = eval("oPMenu.oWindow." + this.cName);
				if (oSMenu) if (oSMenu.lVisible) oSMenu.Hide(true);
			}

			// Hide all secondary menus
			for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
				oSMenu = eval("oPMenu.aSMenus[nIdx].oWindow." + this.cName)
				if (oSMenu) if (oSMenu.lVisible) oSMenu.Hide(true);
			}
		}
	}
}
//-------------------------------------------------------------------------------------------\\
function wmMenuOff () {
	if (this.lMain && !this.lOnItem) {
		if (this.oActiveMenu != null) this.oActiveMenu.Hide();
		this.lOnMenu = false;
	}
}
//-------------------------------------------------------------------------------------------\\
function wmGetMain() {
	if (this.lMain) return this;
	else return this.oParentMenu.GetMain();
}
//-------------------------------------------------------------------------------------------\\
function wmMenuSetColor (cBackColor, cBackOver, cBackDown, cForeColor, cForeOver, cForeDown, lRecursive) {
	var nIdx  = 0;

	this.cBackColor = cBackColor;
	this.cBackOver  = (cBackOver ? cBackOver : cBackColor);
	this.cBackDown  = (cBackDown ? cBackDown : cBackColor);
	this.cForeColor = cForeColor;
	this.cForeOver  = (cForeOver ? cForeOver : cForeColor);
	this.cForeDown  = (cForeDown ? cForeDown : cForeColor);

	// If the screen has been painted, set the menu's items
	if (this.oScreen)
		for (nIdx=0; nIdx < this.aItems.length; nIdx++) {
			this.aItems[nIdx].SetColor(cBackColor, cBackOver, cBackDown, cForeColor, cForeOver, cForeDown, true);
			if (lRecursive && this.aItems[nIdx].oMenu)
				this.aItems[nIdx].oMenu.SetColor(cBackColor, cBackOver, cBackDown, cForeColor, cForeOver, cForeDown, true)
		}
}
//-------------------------------------------------------------------------------------------\\
function wmFadeIn (cObject, nStop) {

	var oObject = document.getElementById(cObject);

	if (wmTIMECTR > nStop) wmTIMECTR = 0;
	else {
		if (wmNS || wmMOZ) oObject.style.MozOpacity = wmTIMECTR + "%";
		else oObject.filters.alpha.opacity = wmTIMECTR;
		wmTIMECTR += wmFADESPEED;
		setTimeout("wmFadeIn('" + cObject + "'," + nStop + ");", 30);
	}
}
//-------------------------------------------------------------------------------------------\\
function wmMenuPaint (cPrimeFrame, nFBordTop, nFBordLeft, cNSFrameTop, cNSFrameLeft) {

	var nIdx         = 0;
	var nHeight      = 0;
	var nWidth       = 0;
	var nTop         = 0;
	var nTableWidth  = 0;
	var nHighest     = 0;
	var nWidest      = 0;
	var nTotalHeight = 0;
	var nTotalWidth  = 0;
	var nItemBorder  = 0;
	var cFrame       = "";

	if (!wmBROWSEROK) {
		document.write("Menu not displayed - browser upgrade required.<br>");
		return;
	}

	// Register secondary main menus with the primary menu
	if (this.lMain && cPrimeFrame) {
		this.nFBordTop  = (nFBordTop  ? nFBordTop  : 0);
		this.nFBordLeft = (nFBordLeft ? nFBordLeft : 0);

		// Find the prime menu and register this main menu with it
		this.oPMenu = eval("parent.frames." + cPrimeFrame + "." + this.cName);
		if (this.oPMenu) {
			nIdx = this.oPMenu.aSMenus.length
			this.oPMenu.aSMenus[nIdx] = this;
			this.oPMenu.lPrime = true;
			this.lSecond       = true;
			this.oPMenu.oPMenu = this.oPMenu;
		}

		// If this is a secondary frame, do not display main
		if (cPrimeFrame && this.lMain) this.lVisible = false;

		// Netscape/Moz frame offsets: build the arrays of frame names
		// Each parameter is a comma-delimited list of frame names
		// (each frame name will increase the offset for this frame's menu top/left)
		if (cNSFrameTop) {
			while (cNSFrameTop.length > 0) {
				nIdx = cNSFrameTop.indexOf(",");
				if (nIdx < 0) {
					cFrame = cNSFrameTop;
					cNSFrameTop = "";
				}
				else {
					cFrame = cNSFrameTop.substr(0, nIdx);
					cNSFrameTop = cNSFrameTop.substr(nIdx+1);
				}
				nLen = this.aNSFrameTop.length;
				this.aNSFrameTop[nLen] = cFrame;
			}
		}
		if (cNSFrameLeft) {
			while (cNSFrameLeft.length > 0) {
				nIdx = cNSFrameLeft.indexOf(",");
				if (nIdx < 0) {
					cFrame = cNSFrameLeft;
					cNSFrameLeft = "";
				}
				else {
					cFrame = cNSFrameLeft.substr(0, nIdx);
					cNSFrameLeft = cNSFrameLeft.substr(nIdx+1);
				}
				nLen = this.aNSFrameLeft.length;
				this.aNSFrameLeft[nLen] = cFrame;
			}
		}
	}

	// Set the table width: add all item widths
	if (this.nOrient == wmHORIZ) 
		for (nIdx=0; nIdx < this.aItems.length; nIdx++)
			nTableWidth += this.aItems[nIdx].nWidth;

	// Do not allow fading if opacity is not set
	if (this.nOpacity > 0) this.lFadeOk = true;

	// Paint the menu
	document.write("<div id='" + this.cId + "' align='left'" + 
		(this.nBorderWidth > 0 ? "class='" + this.cBorderClass + "' " : "") + 
		(this.lMain && wmRELATIVE ? "style='" : "style='position:absolute; ") + 
			(this.lMain && wmRELATIVE ? "top:"  + this.nTop  + "; " : "") +
			(this.lMain && wmRELATIVE ? "left:" + this.nLeft + "; " : "") +
			"visibility:" + (this.lVisible ? "visible" : "hidden") + "; " +
			(this.lTransparent ? " " : "background:" + this.cMenuBack + "; ") +
			(this.lTransparent ? " " : "background-image:" + this.cMenuBackImg + "; ") +
			(this.lMain && this.nOrient == wmHORIZ && this.lStretchMain ? "width:100%; " :
				(this.nWidth > 0 || (this.lMain && wmRELATIVE) ? "width:"  + this.nWidth  + "; " : "")) +
			(this.lMain && this.nOrient == wmVERT && this.lStretchMain ? "height:100%; " :
				(this.nHeight > 0 ? "height:" + this.nHeight + "; " : "")) +
			"z-index:" + this.nZindex + "; " +
			"cursor:"+ this.cCursor + "; " + 
			(wmOPERA ? "" : (this.nOpacity == 0 ? "" : 
				(wmNS || wmMOZ ? "-moz-opacity:" + this.nOpacity + "%" : 
				"filter:alpha(opacity=" + this.nOpacity + ")"))));

	// IE special effects
	if (!wmOPERA && !wmNS && !wmMOZ && wmIE55 && this.nTransition > wmNONE) {
		document.write((this.nOpacity != 0 ? "" : "filter:") + 
			"progid:DXImageTransform.Microsoft.");
		if (this.nTransition == wmFADE)        document.write("Fade() ");
		if (this.nTransition == wmSCROLLDOWN)  document.write("GradientWipe(wipestyle=1) ");
		if (this.nTransition == wmSCROLLOVER)  document.write("GradientWipe() ");
		if (this.nTransition == wmFUZZYFADE)   document.write("RandomDissolve() ");
		if (this.nTransition == wmOPENOUT)     document.write("Barn() ");
		if (this.nTransition == wmPIXELATE)    document.write("Pixelate(MaxSquare=5) ");
		if (this.nTransition == wmSTRETCHOVER) document.write("Stretch(stretchstyle=HIDE) ");
		if (this.nTransition == wmSTRETCHOUT)  document.write("Stretch() ");
	}

	document.write("' " + 
		"onmouseover='" + this.cName + ".MouseOver()' " + 
		"onmouseout='" + this.cName + ".MouseOut()' " + 
		"onmousemove='return false;'>");

	document.write("<table border='0' cellspacing='" + this.nMargin + "' cellpadding='0' " + 
		(nTableWidth > 0 ? "width='" + nTableWidth + "' " : " ") + 
		(this.nOrient == wmHORIZ ? "height='100%'" : "") +
		"><tr>");

	// Paint the items
	for (nIdx=0; nIdx < this.aItems.length; nIdx++) {
		document.write("<td>");
		this.aItems[nIdx].Paint();
		document.write("</td>");

		if (this.nOrient == wmVERT) {
			if (nIdx+1 < this.aItems.length) {
				document.write("</tr><tr>");
				if (this.aItems[nIdx].lDivider) {
					document.write("<td><div class='" + this.aItems[nIdx].cDivClass + "' " + 
						"width='100%' height='1'></div></td></tr><tr>")
				}
			}
			else document.write("</tr>");
		}
		else {
			if (this.aItems[nIdx].lDivider) {
				document.write("<td><div class='" + this.aItems[nIdx].cDivClass + "' " + 
					"style='height:100%'></div></td>")
			}
		}
	}

	// End Painting
	if (this.nOrient == wmHORIZ) document.write("</tr>");
	document.write("</table></div>");

	this.oScreen = document.getElementById(this.cId);

	// Paint all child menus
	for (nIdx=0; nIdx < this.aItems.length; nIdx++)
		if (this.aItems[nIdx].oMenu) this.aItems[nIdx].oMenu.Paint();

	// If main, display the menu (don't show main for frame 2)
	if (this.lMain && !cPrimeFrame) {
		this.Show();
		this.lOnMenu = false;
	}
}
//===========================================================================================\\
// Item Class
//===========================================================================================\\
function wmItem (cName, oParent, cCaption, cNorm, cOver, cDown, cBackColor, cBackOver, cBackDown) {

	// Parameters: internal use only
	this.cName        = cName;
	this.oParent      = oParent;
	this.cCaption     = (cCaption  ? cCaption  : "");

	// Internal use only
	this.cId          = wmPREFIX + cName;
	this.oScreen      = null;
	this.oIcon        = null;
	this.oCheck       = null;
	this.oArrow       = null;
	this.oText        = null;
	this.oImage       = null;
	this.oMenu        = null;
	this.lOver        = false;
	this.cLook        = "";
	this.cTag         = "";

	// Default setting: these may be overridden
	this.nWidth       = 0;
	this.nHeight      = 0;
	this.cTip         = ""
	this.cHref        = "";
	this.cTarget      = "";
	this.cCommand     = "";
	this.nStyle       = this.oParent.nStyle;
	this.cCursor      = this.oParent.cCursor;
	this.cTextClass   = this.oParent.cTextClass;
	this.cBorderClass = this.oParent.cIBorderClass;
	this.nBorderWidth = this.oParent.nIBorderWidth;
	this.lDivider     = this.oParent.lDivider;
	this.cDivClass    = this.oParent.cDivClass;
	this.lChecked     = false;
	this.lEnabled     = true;

	this.cFont        = this.oParent.cFont;		// Text properties
	this.cFontSize    = this.oParent.cFontSize;
	this.cFontAlign   = this.oParent.cFontAlign;
	this.lFontBold    = this.oParent.lFontBold;
	this.lFontItalic  = this.oParent.lFontItalic;
	this.lTransparent = this.oParent.lItransparent;
	this.cBackColor   = (cBackColor ? cBackColor : oParent.cBackColor);
	this.cBackOver    = (cBackOver  ? cBackOver  : oParent.cBackOver);
	this.cBackDown    = (cBackDown  ? cBackDown  : oParent.cBackDown);
	this.cBackDis     = this.oParent.cBackDis;
	this.cForeColor   = (cNorm ? cNorm : oParent.cForeColor);
	this.cForeOver    = (cOver ? cOver : oParent.cForeOver);
	this.cForeDown    = (cDown ? cDown : oParent.cForeDown);
	this.cForeDis     = this.oParent.cForeDis;

	this.cImage       = (cNorm ? cNorm : "");	// Picture properties
	this.cImageOver   = (cOver ? cOver : "");
	this.cImageDown   = (cDown ? cDown : "");
	this.cImageDis    = "";
	this.lIconCol     = this.oParent.lIconCol;
	this.lCheckCol    = this.oParent.lCheckCol;
	this.lArrowCol    = this.oParent.lArrowCol;
	this.cIcon        = this.oParent.cIcon;
	this.cIconOver    = this.oParent.cIconOver;
	this.cIconDown    = this.oParent.cIconDown;
	this.cIconDis     = this.oParent.cIconDis;
	this.lNoItemOver  = this.oParent.lNoItemOver;
	this.cCheck       = this.oParent.cCheck;
	this.cCheckOver   = this.oParent.cCheckOver;
	this.cCheckDown   = this.oParent.cCheckDown;
	this.cCheckDis    = this.oParent.cCheckDis;
	this.cArrow       = this.oParent.cArrow;
	this.cArrowOver   = this.oParent.cArrowOver;
	this.cArrowDown   = this.oParent.cArrowDown;
	this.cArrowDis    = this.oParent.cArrowDis;
	this.nIconWidth   = this.oParent.nIconWidth ;
	this.nIconHeight  = this.oParent.nIconHeight ;
	this.nCheckWidth  = this.oParent.nCheckWidth;
	this.nCheckHeight = this.oParent.nCheckHeight;
	this.nArrowWidth  = this.oParent.nArrowWidth;
	this.nArrowHeight = this.oParent.nArrowHeight;
	this.nPicWidth    = this.oParent.nPicWidth;
	this.nPicHeight   = this.oParent.nPicHeight;
	this.cBackImg     = this.oParent.cBackImg;
	this.cBackImgOver = this.oParent.cBackImgOver;
	this.cBackImgDown = this.oParent.cBackImgDown;
	this.cBackImgDis  = this.oParent.cBackImgDis;
	this.lHideOnClick = this.oParent.lHideOnClick;

	// Methods
	this.AddMenu      = wmAddMenu;
	this.MouseOver    = wmMouseOver;
	this.MouseDown    = wmMouseDown;
	this.MouseOut     = wmItemMouseOut;
	this.Click        = wmClick;
	this.Check        = wmCheck;
	this.UnCheck      = wmUnCheck;
	this.SetColor     = wmItemSetColor;
	this.SetIcon      = wmSetIcon;
	this.SetCheck     = wmSetCheck;
	this.SetArrow     = wmSetArrow;
	this.SetLook      = wmSetLook;
	this.Paint        = wmItemPaint;
	this.Enable       = wmEnable;
	this.Disable      = wmDisable;

	// Reference to the main menu
	this.oMain = this.oParent.oMain;
}
//-------------------------------------------------------------------------------------------\\
function wmAddMenu (cName, nWidth, nZindex, nStyle) {
	this.oMenu = new wmMenu(cName, this, 0, 0, nWidth, nZindex, nStyle);
	return this.oMenu;
}
//-------------------------------------------------------------------------------------------\\
function wmMouseOver () {

	var oPMenu = this.oParent.oMain.oPMenu;

	this.oMain.lOnItem = true;

	// If there are frames, set all opposite frame's lOnItem on also
	if (oPMenu) {
		oPMenu.lOnItem = true;
		for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
			oPMenu.aSMenus[nIdx].lOnItem = true;
		}
	}		

	if (this.lEnabled) {

		this.SetLook('over');

		// Hide active menu and show new menu	
		if (this.oMain.lOnMenu || !this.oParent.lClickMain)
		{
			if (this.oMenu != null) {
	
				if (this.oParent.oActiveMenu != null && 
						this.oMenu != this.oParent.oActiveMenu) 
					{this.oParent.oActiveMenu.Hide();}
				if (this.lEnabled && 
						(this.oParent.oActiveMenu == null || 
						this.oMenu != this.oParent.oActiveMenu))
					this.oMenu.Show();
			}
			else if (this.oParent.oActiveMenu != null) {
				this.oParent.oActiveMenu.Hide();
			}
		}
	}

	// If item is disabled, just hide the active menu
	else if (this.oParent.oActiveMenu != null && this.oMenu != this.oParent.oActiveMenu)
		this.oParent.oActiveMenu.Hide();
}
//-------------------------------------------------------------------------------------------\\
function wmMouseDown () {
	if (this.lEnabled) this.SetLook('down');
}
//-------------------------------------------------------------------------------------------\\
function wmItemMouseOut (lNoPause) {
	if (this.lEnabled) {
		if (this.oParent.oActiveMenu && 
			this.oParent.oActiveMenu == this.oMenu && 
			!this.lNoItemOver) {}
		else this.SetLook('out');
	}
	this.oMain.lOnItem = false;
	if (lNoPause) this.oMain.MenuOff();
	else setTimeout(this.oMain.cName  + ".MenuOff();", wmDELAY);
}
//-------------------------------------------------------------------------------------------\\
function wmClick () {
	var oWindow = null;

	if (this.lEnabled) {
		this.SetLook('over');
		if (this.oMenu != null) this.oMenu.Show();
		if (this.cCommand != "") eval(this.cCommand);
		if (this.cHref != "") {
			// Determine the target window (empty = default)
			if (this.cTarget == "_blank") window.open(this.cHref);
			else if (this.cTarget == "_top") top.location = this.cHref;
			else {
				if (this.cTarget == "") {
					// When using frames, default is first secondary frame
					if (this.oParent.oMain.oPMenu) 
						oWindow = this.oParent.oMain.oPMenu.oWindow;
					else oWindow = window;
				}
				else if (this.cTarget == "_self")   oWindow = window;
				else if (this.cTarget == "_parent") oWindow = parent;
				else {
					// Target is a named frame
					// If there are no quotes, assume a named frame in parent
					if (this.cTarget.indexOf("'") == -1 && this.cTarget.indexOf('"') == -1) {
						oWindow = eval("parent.frames['" + this.cTarget + "']");
					}
					if (!oWindow) oWindow = eval(this.cTarget);
				}
				if (oWindow) oWindow.location = this.cHref;
			}
		}
		// If there is no submenu or there is a command or href
		if (this.lHideOnClick && (this.oMenu == null || this.cCommand != "" || this.cHref != ""))
			this.MouseOut(true);
	}
}
//-------------------------------------------------------------------------------------------\\
function wmItemSetColor (cBackColor, cBackOver, cBackDown, cForeColor, cForeOver, cForeDown, lNoOver) {
	this.cBackColor = cBackColor;
	this.cBackOver  = (cBackOver ? cBackOver : cBackColor);
	this.cBackDown  = (cBackDown ? cBackDown : cBackColor);
	this.cForeColor = cForeColor;
	this.cForeOver  = (cForeOver ? cForeOver : cForeColor);
	this.cForeDown  = (cForeDown ? cForeDown : cForeColor);
	if (this.oScreen) this.SetLook((this.lOver ? "over" : "out"), lNoOver);
}
//-------------------------------------------------------------------------------------------\\
function wmSetIcon (cNorm, cOver, cDown, lNoOver) {
	this.cIcon = cNorm;
	this.cIconOver = (cOver ? cOver : cNorm);
	this.cIconDown = (cDown ? cDown : cNorm);
	if (this.oScreen) this.SetLook((this.lOver ? "over" : "out"), lNoOver);
}
//-------------------------------------------------------------------------------------------\\
function wmSetCheck (cNorm, cOver, cDown, lNoOver) {
	this.cCheck = cNorm;
	this.cCheckOver = (cOver ? cOver : cNorm);
	this.cCheckDown = (cDown ? cDown : cNorm);
	if (this.oScreen) this.SetLook((this.lOver ? "over" : "out"), lNoOver);
}
//-------------------------------------------------------------------------------------------\\
function wmSetArrow (cNorm, cOver, cDown, lNoOver) {
	this.cArrow = cNorm;
	this.cArrowOver = (cOver ? cOver : cNorm);
	this.cArrowDown = (cDown ? cDown : cNorm);
	if (this.oScreen) this.SetLook((this.lOver ? "over" : "out"), lNoOver);
}
//-------------------------------------------------------------------------------------------\\
function wmSetLook (cAction, lNoOver, lNoSecond) {

	var oPMenu = null;
	var oSItem = null;
	var nIdx = 0;

	if (!this.oMain.lOnMenu && !this.oMain.lOnItem) return;

	this.cLook = cAction;
	this.lOver = (cAction == "over");

	// Background
	if (!this.lTransparent) {
		if (cAction == "over") {
			if (!wmOPERA || this.oScreen.style.backgroundImage == "")
				this.oScreen.style.background = this.cBackOver;
			this.oScreen.style.backgroundImage = this.cBackImgOver;
		}
		if (cAction == "down") {
			if (!wmOPERA || this.oScreen.style.backgroundImage == "")
				this.oScreen.style.background = this.cBackDown;
			this.oScreen.style.backgroundImage = this.cBackImgDown;
		}
		if (cAction == "out")  {
			if (!wmOPERA || this.oScreen.style.backgroundImage == "")
				this.oScreen.style.background = this.cBackColor;
			this.oScreen.style.backgroundImage = this.cBackImg;
		}
	}

	// Text
	if (this.nStyle == wmTEXT) {
		if (cAction == "over") this.oText.style.color = this.cForeOver;
		if (cAction == "down") this.oText.style.color = this.cForeDown;
		if (cAction == "out")  this.oText.style.color = this.cForeColor;
	}

	// Picture
	if (this.nStyle == wmIMAGE) {
		if (cAction == "out")  this.oImage.src = this.cImage;
		if (cAction == "over") this.oImage.src = this.cImageOver;
		if (cAction == "down") this.oImage.src = this.cImageDown;
	}

	// Icon / Checkmark
	if (this.lIconCol && this.cIcon != "") {
		if (cAction == "out")  this.oIcon.src = this.cIcon;
		if (cAction == "over") this.oIcon.src = this.cIconOver;
		if (cAction == "down") this.oIcon.src = this.cIconDown;
	}
	else if (this.lCheckCol && this.cCheck != "") {
		if (cAction == "out")  this.oCheck.src = this.cCheck;
		if (cAction == "over") this.oCheck.src = this.cCheckOver;
		if (cAction == "down") this.oCheck.src = this.cCheckDown;
	}

	// Arrow
	if (this.lArrowCol && this.oMenu != null && this.cArrow != "") {
		if (cAction == "out")  this.oArrow.src = this.cArrow;
		if (cAction == "over") this.oArrow.src = this.cArrowOver;
		if (cAction == "down") this.oArrow.src = this.cArrowDown;
	}

	// Set parent item's look to "over"
	if (!lNoOver && !this.oParent.lMain && !this.oParent.oParent.lNoItemOver)
		this.oParent.oParent.SetLook("over", true);

	// If this is a frame, set the look of all other frame's items
	if (!lNoSecond) oPMenu = this.oParent.oMain.oPMenu;
	if (oPMenu) {
		// Activate the prime menu
		if (!this.oParent.oMain.lPrime) {
			oSItem = eval("oPMenu.oWindow." + this.cName);
			if (oSItem) if (oSItem.cLook != cAction) oSItem.SetLook(cAction, lNoOver, true);
		}

		// Activate all secondary menus
		for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
			oSItem = eval("oPMenu.aSMenus[nIdx].oWindow." + this.cName)
			if (oSItem) if (oSItem.cLook != cAction) oSItem.SetLook(cAction, lNoOver, true);
		}
	}
}
//-------------------------------------------------------------------------------------------\\
function wmCheck (lNoSecond) {
	var oPMenu = null;
	var oSItem = null;
	var nIdx = 0;

	if (this.lCheckCol && this.cCheck != "") this.oCheck.style.visibility="visible";
	this.lChecked = true;

	// If this is a frame, set the check-mark of all other frame's items
	if (!lNoSecond) oPMenu = this.oParent.oMain.oPMenu;
	if (oPMenu) {
		// Check the prime menu
		if (!this.oParent.oMain.lPrime) {
			oSItem = eval("oPMenu.oWindow." + this.cName);
			if (oSItem) oSItem.Check(true);
		}

		// Check all secondary menus
		for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
			oSItem = eval("oPMenu.aSMenus[nIdx].oWindow." + this.cName)
			if (oSItem) oSItem.Check(true);
		}
	}
}
//-------------------------------------------------------------------------------------------\\
function wmUnCheck (lNoSecond) {
	var oPMenu = null;
	var oSItem = null;
	var nIdx = 0;

	if (this.lCheckCol && this.cCheck != "") this.oCheck.style.visibility="hidden";
	this.lChecked = false;

	// If this is a frame, set the check-mark of all other frame's items
	if (!lNoSecond) oPMenu = this.oParent.oMain.oPMenu;
	if (oPMenu) {
		// UnCheck the prime menu
		if (!this.oParent.oMain.lPrime) {
			oSItem = eval("oPMenu.oWindow." + this.cName);
			if (oSItem) oSItem.UnCheck(true);
		}

		// UnCheck all secondary menus
		for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
			oSItem = eval("oPMenu.aSMenus[nIdx].oWindow." + this.cName)
			if (oSItem) oSItem.UnCheck(true);
		}
	}
}
//-------------------------------------------------------------------------------------------\\
function wmEnable (lNoSecond) {
	var oPMenu = null;
	var oSItem = null;
	var nIdx = 0;

	this.lEnabled = true;
	this.SetLook("out");

	// If this is a frame, set enable of all other frame's items
	if (!lNoSecond) oPMenu = this.oParent.oMain.oPMenu;
	if (oPMenu) {
		// Enable the prime menu
		if (!this.oParent.oMain.lPrime) {
			oSItem = eval("oPMenu.oWindow." + this.cName);
			if (oSItem) oSItem.Enable(true);
		}

		// Enable all secondary menus
		for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
			oSItem = eval("oPMenu.aSMenus[nIdx].oWindow." + this.cName)
			if (oSItem) oSItem.Enable(true);
		}
	}
}
//-------------------------------------------------------------------------------------------\\
function wmDisable (lNoSecond) {
	var oPMenu = null;
	var oSItem = null;
	var nIdx = 0;

	this.lEnabled = false;
	if (!this.lTransparent) this.oScreen.style.background = this.cBackDis;
	if (this.nStyle == wmTEXT) this.oText.style.color = this.cForeDis;
	if (this.nStyle == wmIMAGE && this.cImageDis != "") this.oImage.src = this.cImageDis;
	if (this.lIconCol && this.cIcon != "") this.oIcon.src = this.cIconDis;
	if (this.cBackImgDis != "") this.oScreen.style.backgroundImage = this.cBackImgDis;
	if (this.lCheckCol && this.cCheckDis != "") this.oCheck.src = this.cCheckDis;
	if (this.lArrowCol && this.oMenu != null && this.cArrowDis != "") 
		this.oArrow.src = this.cArrowDis;

	// If this is a frame, set disable of all other frame's items
	if (!lNoSecond) oPMenu = this.oParent.oMain.oPMenu;
	if (oPMenu) {
		// Disable the prime menu
		if (!this.oParent.oMain.lPrime) {
			oSItem = eval("oPMenu.oWindow." + this.cName);
			if (oSItem) oSItem.Disable(true);
		}

		// Disable all secondary menus
		for (nIdx = 0; nIdx < oPMenu.aSMenus.length; nIdx++) {
			oSItem = eval("oPMenu.aSMenus[nIdx].oWindow." + this.cName)
			if (oSItem) oSItem.Disable(true);
		}
	}
}
//-------------------------------------------------------------------------------------------\\
function wmItemPaint () {

	var nWidth     = 0
	var nMainWidth = 0;

	if (this.oParent.nOrient != wmHORIZ) this.nWidth = 0;
	if (this.oParent.nOrient == wmHORIZ) {
		if (this.nStyle == wmTEXT) nWidth = this.nWidth;
		else nWidth  = this.nPicWidth;
	}
	else if (this.oParent.cMenuBackImg == "") nWidth = this.oParent.nWidth;
	else nWidth = 1;

	// Netscape/Mozilla
	if (wmNS || wmMOZ) {
		if (this.cCursor == "hand") this.cCursor = "pointer";
		if (this.cCursor.substring(0,3) == "url") this.cCursor = "default";
	}

	nMainWidth = nWidth;

	// If Icon and Check-mark are both on, set the check-mark off
	if (this.lCheckCol && this.lIconCol) this.lCheckCol = false;

	// Figure the width of the main text / image
	if (this.lCheckCol) nMainWidth = nMainWidth - this.nCheckWidth;
	else if (this.lIconCol) nMainWidth = nMainWidth - this.nIconWidth;
	if (this.lArrowCol) nMainWidth = nMainWidth - this.nArrowWidth;

	// Netscape exceptions
	if ((wmNS || wmMOZ) && this.oParent.nOrient == wmHORIZ) {
		if (this.lIconCol || this.lCheckCol) nMainWidth = nMainWidth - 5;
		if (this.lArrowCol) nMainWidth = nMainWidth - this.nArrowWidth/2 - 3;
	}

	// Paint the item
	document.write("<div id='" + this.cId + "' " + "title='" + this.cTip + "' " + 
		"class='" + (this.nBorderWidth > 0 ? this.cBorderClass : "") + "'" + 
		"style='" + 
			(this.nWidth  > 0 ? "width:"  + nWidth + "; " : "") + 
			(this.nHeight > 0 ? "height:" + this.nHeight + "; " : "") + 
			"cursor:"+this.cCursor + "; " +
			(this.lTransparent ? "" : "background:" + this.cBackColor + "; ") +
			"background-image:" + this.cBackImg + "; " +
			"' " +
		"onmouseover='" + this.cName + ".MouseOver()'" +
		"onmousedown='" + this.cName + ".MouseDown()'" + 
		"onmouseout='"  + this.cName + ".MouseOut()'" + 
		"onclick='"     + this.cName + ".Click()'>");

	document.write("<table border='0' width='100%' height='100%'");
	if (this.nStyle == wmIMAGE) document.write("cellspacing='0' cellpadding='0' height='0'");
	document.write("><tr>");

	// Icon or Checkmark
	if (this.lIconCol) {
		document.write("<td nowrap width='" + this.nIconWidth + "'>");
		if (this.cIcon != "")
			document.write("<img id='" + this.cId + "IconPic' " + 
			"src='" + this.cIcon + "' " +
			"width='" + this.nIconWidth + "' height='" + this.nIconHeight + "'>");
		document.write("</td>");

	}
	else if (this.lCheckCol) {
		document.write("<td nowrap width='" + this.nCheckWidth + "'>");
		if (this.cCheck != "") 
			document.write("<img id='" + this.cId + "CheckPic' " + 
			"style='visibility:" + (this.lChecked && this.oParent.lVisible ? "visible" : "hidden") + "' " + 
			"src='" + this.cCheck + "' " +
			"width='" + this.nCheckWidth + "' height='" + this.nCheckHeight + "'>");
		document.write("</td>");
	}

	// Text or Picture
	nMainWidth = Math.max(nMainWidth,0);
	if (this.nStyle == wmTEXT) 
		// Text
		document.write("<td nowrap align='" + this.cFontAlign + "' " + 
			(nMainWidth == 0 ? "" : "width='" + nMainWidth + "px'") + ">" + 
			"<font face='" + this.cFont + "' size='" + this.cFontSize + "'>" + 
			"<a id='" + this.cId + "Text' style='color:" + this.cForeColor + "' " +
				"class='" + this.cTextClass + "'>" + 
				(this.lFontBold ? "<b>" : "") + 
				(this.lFontItalic ? "<i>" : "") + 
				this.cCaption + 
				(this.lFontItalic ? "</i>" : "") + 
				(this.lFontBold ? "</b>" : "") + 
			"</a></font></td>");
	else {
		// Picture
		document.write("<td>" + 
			"<img id='" + this.cId + "Image' src='" + this.cImage + "' " +
			"width='" + this.nPicWidth + "' height='" + this.nPicHeight + "'></td>");
	}

	// Arrow: if there is a sub-menu
	if (this.lArrowCol) {
		document.write("<td id='" + this.cId + "ArrowCell'><div align='right' width='" + this.nArrowWidth + "'>");
		if (this.oMenu != null && this.cArrow != "") 
			document.write("<img id='" + this.cId + "ArrowPic' src='" + 
			this.cArrow + "' " +
			"width='" + this.nArrowWidth + "' height='" + this.nArrowHeight + "'>");
		document.write("</div></td>");
	}
	document.write("</tr></table></div>");

	this.oScreen    = document.getElementById(this.cId);
	this.oIcon      = document.getElementById(this.cId + "IconPic");
	this.oCheck     = document.getElementById(this.cId + "CheckPic");
	this.oArrow     = document.getElementById(this.cId + "ArrowPic");
	this.oArrowCell = document.getElementById(this.cId + "ArrowCell");
	this.oText      = document.getElementById(this.cId + "Text");
	this.oImage     = document.getElementById(this.cId + "Image");

	if (!this.lEnabled) this.Disable();
}

