
	/* Initialize global vars that will be used to control displayed icon. */
	var aMenuIcon = null;
	var aSubmenuIcon = null;
	var aFootermenuIcon = null;
	
	var aMenuOn = {
		'amm0': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c1.jpg) no-repeat 0px 0px',
		'amm1': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c2.jpg) no-repeat 0px 0px',
		'amm2': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c3.jpg) no-repeat 0px 0px',
		'amm3': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c4.jpg) no-repeat 0px 0px',
		'amm4': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c5.jpg) no-repeat 0px 0px',
		'amm5': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c6.jpg) no-repeat 0px 0px',
		'amm6': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c7.jpg) no-repeat 0px 0px',
		'amm7': 'url(/resources/menus/main/Nav-MAIN-BUTTONS-CLICKED-MyHaven_r1_c8.jpg) no-repeat 0px 0px'
	};
	var aSubmenuOn = {
		'amm5a': 'url(/resources/menus/submenu/nav-prodir-sub-buttons-on-myhaven_r1_c2.jpg) no-repeat 0px 0px',
		'amm5b': 'url(/resources/menus/submenu/nav-prodir-sub-buttons-on-myhaven_r1_c3.jpg) no-repeat 0px 0px',
		'amm6a': 'url(/resources/menus/submenu/nav-about-sub-buttons-on-myhaven_r1_c2.jpg) no-repeat 0px 0px',
		'amm6b': 'url(/resources/menus/submenu/nav-about-sub-buttons-on-myhaven_r1_c3.jpg) no-repeat 0px 0px',
		'amm6c': 'url(/resources/menus/submenu/nav-about-sub-buttons-on-myhaven_r1_c4.jpg) no-repeat 0px 0px'
	};
	var aFootermenuIconOn = {
		'asm0': 'url(/resources/menus/subfooter/footernav-on_r1_c1.jpg) no-repeat 0px 0px',
		'asm1': 'url(/resources/menus/subfooter/footernav-on_r1_c2.jpg) no-repeat 0px 0px',
		'asm2': 'url(/resources/menus/subfooter/footernav-on_r1_c3.jpg) no-repeat 0px 0px',
		'asm3': 'url(/resources/menus/subfooter/footernav-on_r1_c4.jpg) no-repeat 0px 0px',
		'asm4': 'url(/resources/menus/subfooter/footernav-on_r1_c5.jpg) no-repeat 0px 0px',
		'asm5': 'url(/resources/menus/subfooter/footernav-on_r1_c6.jpg) no-repeat 0px 0px',
		'asm6': 'url(/resources/menus/subfooter/footernav-on_r1_c7.jpg) no-repeat 0px 0px'
	};

	/* 
		Function getBrowser.  This is required to detmine the offset required for positioning the submenus.
		So far:
			Internet Explorer: 0
			Firefox: -45
	*/
	function getOffset() {
		var agt=navigator.userAgent.toLowerCase();
		if (agt.indexOf("opera") != -1) return 0; // 'Opera';
		if (agt.indexOf("staroffice") != -1) return 0; //'Star Office';
		if (agt.indexOf("webtv") != -1) return 0; //'WebTV';
		if (agt.indexOf("beonex") != -1) return 0; //'Beonex';
		if (agt.indexOf("chimera") != -1) return 0; //'Chimera';
		if (agt.indexOf("netpositive") != -1) return 0; //'NetPositive';
		if (agt.indexOf("phoenix") != -1) return 0; // 'Phoenix';
		if (agt.indexOf("firefox") != -1) return -45; // 'Firefox';
		if (agt.indexOf("safari") != -1) return -45; // 'Safari';
		if (agt.indexOf("skipstone") != -1) return 0; // 'SkipStone';
		if (agt.indexOf("msie") != -1) return 0; //'Internet Explorer';
		if (agt.indexOf("netscape") != -1) return 0; //'Netscape';
		if (agt.indexOf("mozilla/5.0") != -1) return 0; // 'Mozilla';
		return 0; // Unknown browser ... take a chance.
	}
	
	/* 
		Capture the window resize to allow the sub menus to be possitioned appropriately. 
	*/
	function setResizeValues() {
		var w = getWidth();
		var pd = document.getElementById('pd');
		if (w <= 900) {
			pd.style.marginLeft = (540 + getOffset()).toString() + "px";
		} else {
			var nw = Math.round(((w - 900) / 2) + 540) + getOffset();
			pd.style.marginLeft = nw.toString() + "px";
		}
		var au = document.getElementById('au');
		if (w <= 900) {
			au.style.marginLeft = (500 + getOffset()).toString() + "px";
		} else {
			var nw = Math.round(((w - 900) / 2) + 500) + getOffset();
			au.style.marginLeft = nw.toString() + "px";
		}
		//alert(w + " " + au.style.marginLeft + " " + pd.style.marginLeft);
	}
	
	/* Get the actual displayed width of the screen.  This will be useful in presenting the submenus. */
	function getWidth() {
        var x = 0;
        if (self.innerHeight) {
                x = self.innerWidth;
        } else if (document.documentElement && document.documentElement.clientHeight) {
                x = document.documentElement.clientWidth;
        } else if (document.body) {
                x = document.body.clientWidth;
        }
        return x;
	}
	
	/*
		window.onresize event function.  Used to reset the sub menu locations.
	*/
	window.onresize = function() {
		setResizeValues();
	}

	/*
		window.onload function.  Automatically executes when browser finishes opening the page.
	*/
	window.onload = function() {
		// re-set the initial values for the sub-menus.  This may require an offset depending on the browser, so pay attention.
		setResizeValues();
		
		// set the appropriate images for the menu choices.  This is setting the link images to clicked/on for the:
		//	main menu, sub menu, and footer menu.
		if (aMenuIcon != null) {
			document.getElementById(aMenuIcon).style.background = eval("aMenuOn." + aMenuIcon);
		}
		if (aSubmenuIcon != null) {
			document.getElementById(aSubmenuIcon).style.background = eval("aSubmenuOn." + aSubmenuIcon);
		}
		if (aFootermenuIcon != null) {
			document.getElementById(aFootermenuIcon).style.background = eval("aFootermenuIconOn." + aFootermenuIcon);
		}
	}
