/******************************************************	Global functions*******************************************************/function roll(srcImageName, newImageSrc) {	if (document.images) { document[srcImageName].src = newImageSrc; }}function BrowserEnv() {	this.bNS4 = (document.layers) ? true : false;	this.bIE4 = (document.all) ? true : false;	this.bIE5 = (this.bIE4 && navigator.appVersion.indexOf("5.") != -1) ? true : false;	this.bIE5_5 = (this.bIE5 && navigator.appVersion.indexOf("5.5") != -1) ? true : false;	this.bWin = (navigator.appVersion.indexOf("Win") != -1) ? true : false;	this.bMac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;}var g_env = new BrowserEnv();function DynElemGet(name) {	if (g_env.bNS4) {		return DynElemFindLayer(name, document);	} else if (g_env.bIE4) {		return eval('document.all.' + name);	}	return null;}function DynElemFindLayer(name, doc) {	var i, layer;	for (i = 0; i < doc.layers.length; i++) {		layer = doc.layers[i];		if (layer.name == name) {			return layer;		}		if (layer.document.layers.length > 0) {			if ((layer = DynElemFindLayer(name, layer.document)) != null)		   		return layer;		}	}	return null;}function DynElemGetHeight(elem) {	if (g_env.bNS4) {		if (elem.document.height)	    	return elem.document.height;		else	    	return elem.clip.bottom - elem.clip.top;	} else if (g_env.bIE4) {		if (elem.style.pixelHeight)	    	return elem.style.pixelHeight;		else	    	return elem.clientHeight;	}	return -1;}function DynElemHide(elem) {	if (g_env.bNS4) {    	elem.visibility = "hide";	} else if (g_env.bIE4) {	    elem.style.visibility = "hidden";	}}function DynElemShow(elem) {	if (g_env.bNS4) {    	elem.visibility = "show";	} else if (g_env.bIE4) {    	elem.style.visibility = "visible";	}}function DynElemInherit(elem) {	if (g_env.bNS4) {		elem.visibility = "inherit";	} else if (g_env.bIE4) {	    elem.style.visibility = "inherit";	}}function DynElemMoveTo(elem, x, y) {	if (g_env.bNS4) {	    elem.moveTo(x, y);	} else if (g_env.bIE4) {	    elem.style.left = x;    	elem.style.top  = y;	}}function DynElemMoveBy(elem, dx, dy) {	if (g_env.bNS4) {    	elem.moveBy(dx, dy);	} else if (g_env.bIE4) {    	elem.style.pixelLeft += dx;	    elem.style.pixelTop  += dy;	}}function DynElemClip(elem, clipleft, cliptop, clipright, clipbottom) {	if (g_env.bNS4) {	    elem.clip.left   = clipleft;	    elem.clip.top    = cliptop;	    elem.clip.right  = clipright;	    elem.clip.bottom = clipbottom;	} else if (g_env.bIE4) {	    elem.style.clip = 'rect(' + cliptop + ' ' +  clipright + ' ' + clipbottom + ' ' + clipleft +')';	}}function DynElemSetBgColor(elem, color) {	if (g_env.bNS4) {    	elem.bgColor = color;	} else if (g_env.bIE4) {	    elem.style.backgroundColor = color;	}}/******************************************************	TopNav Objects*******************************************************/// Menu Anchor c'torfunction TopNavMenuAnchor( menu, imgSrcDflt, imgSrcRoll ) {	this.menu = menu;	this.imgDflt = new Image();		// preload images	this.imgDflt.src = imgSrcDflt;	this.imgRoll = new Image();	this.imgRoll.src = imgSrcRoll;	this.bOn = false;			// true when mouse is over}// Menu Item c'torfunction TopNavMenuItem(menu, text, href) {	// Menu Item properties	this.menu = menu;	 // parent menu	this.text = text;    // Item text	this.href = href;    // Link URL or JavaScript code}// Menu c'torfunction TopNavMenu(topnav, name, imgAnchorSrc, imgAnchorSrcRoll, x, y, menuWidth) {	// Menu properties	this.topnav		= topnav;			this.name		= name;	this.menuAnchor	= new TopNavMenuAnchor( this, topnav.graphicsRoot + imgAnchorSrc, topnav.graphicsRoot + imgAnchorSrcRoll );	this.xPos		= x;	this.yPos		= y;	this.height    	= 0;	this.width		= menuWidth;	this.items = new Array();	// child menu items		// Menu methods	this.addItem = TopNavAddMenuItem;}function TopNavAddMenuItem(text, href) {	var item = new TopNavMenuItem( this, text, href );	this.items[this.items.length] = item;	return item;}// TopNav c'torfunction TopNav () {	this.menus = new Array();	this.formElems = new Array();	// form elems to hide when menus are shown	this.bMenusCreated = false;		// dynamic menus	this.timerHide = null;			// id of timer for delayed menu hiding		this.border    = 1;	this.padding   = 4;	this.separator = 1;		this.borderColor   = "#FF9944";	this.itemFgColor   = "#F7E6B4";	this.itemBgColor   = "#1D07A3";	this.itemFgRollColor = "#1D07A3";	this.itemBgRollColor = "#F8C855";	this.itemFontFamily = "verdana";	this.itemFontSize   = "10px";			// TopNav methods		this.create      = TopNavCreate;	this.setGraphicsRoot = TopNavSetGraphicsRoot;	this.addMenu     = TopNavAddMenu;	this.getMenu     = TopNavGetMenu;	this.hideFormElem = TopNavHideFormElem;	this.onMouseOverAnchor	= onMouseOverTopNavAnchor;	this.onMouseOutAnchor	= onMouseOutTopNavAnchor;	this.deactivateMenu	= TopNavDeactivateMenu;	this.stopTimer	= TopNavStopTimer;}function TopNavSetGraphicsRoot(root) {	this.graphicsRoot = root;}function TopNavAddMenu(name, imgAnchorSrc, imgAnchorSrcRoll, x, y, menuWidth) {	var menu = null;	if (!this.bMenusCreated) {		menu = new TopNavMenu( this, name, imgAnchorSrc, imgAnchorSrcRoll, x, y, menuWidth );		this.menus[this.menus.length] = menu;	}	return menu;}function TopNavHideFormElem(elemName) {	var lyr = DynElemGet( elemName );	if ( lyr != null ) {		this.formElems[this.formElems.length] = lyr;	}}function TopNavGetMenu(menuName) {	var menu = null;    for (i = 0; i < this.menus.length; i++) {        if (this.menus[i].name == menuName ) {			menu = this.menus[i];			break;		}	}	return menu;}function TopNavCreate() {	if (g_env == null) g_env = new BrowserEnv();	if (this.bMenusCreated || (!g_env.bNS4 && !g_env.bIE4) || (g_env.bMac && g_env.bIE4 && !g_env.bIE5)) return;//	if (this.bMenusCreated || (!g_env.bNS4 && !g_env.bIE4) || (g_env.bIE4 && g_env.bMac) return;//	if (this.bMenusCreated || (!g_env.bNS4 && !g_env.bIE4)) return;	var xScr = 0;	var yScr = 0;	//if (g_env.bIE4 && !g_env.bIE5) {	//	xScr = getPageScrollX();	//	yScr = getPageScrollY();	//	window.scrollTo(document.body.scrollWidth, document.body.scrollHeight);	//}	var width;	var htmNorm, htmRoll, htmEnd;	if (g_env.bNS4) {		htmNorm = '<table border=0 cellpadding=' + this.padding		     + ' cellspacing=0 width="100%"><tr><td>'			 + '<span class="clsMenuText">';		htmRoll = '<table border=0 cellpadding=' + this.padding		     + ' cellspacing=0 width="100%"><tr><td>'			 + '<span class="clsMenuTextRoll">';		htmEnd  = '</span></td></tr></table>';	}	for (i = 0; i < this.menus.length; i++) {		var menuName = this.menus[i].name;		width = this.menus[i].width - 2 * this.border;		str = "";		for (j = 0; j < this.menus[i].items.length; j++) {			var itemText = this.menus[i].items[j].text;			if (g_env.bNS4) {				str += '<layer name="menu_' + menuName + '_' + j + '"'				    +  ' width=' + width + '>'				    +  htmNorm + itemText + htmEnd				    +  '</layer>\n'				    +  '<layer name="menu_' + menuName + '_roll_' + j + '"'				    +  ' width=' + width + '>'				    +  htmRoll +  itemText + htmEnd				    +  '</layer>\n'				    +  '<layer name="menu_' + menuName + '_event_' + j + '"'				    +  ' width=' + width + '>'				    +  '</layer>\n';			} else if (g_env.bIE4) {				htmNorm = '<span id="menu_' + menuName + '_event_' + j + '"'					 + 'style="color:' + this.itemFgColor + ';'					 + 'font-family:' + this.itemFontFamily + ';'					 + 'font-size:' + this.itemFontSize + ';'					 + 'width:' + width + ';'					 + 'padding:' + this.padding + ';'					 + 'cursor:hand">';				htmEnd  = '</span>';				str += '<div id="menu_' + menuName + '_' + j + '"'				    +  ' style="position:absolute;width:' + width + 'px;cursor:hand;marginleft:0px;margintop:0px">'				    +  htmNorm +  itemText + htmEnd				    +  '</div>\n';			}		}	// end for each menu item		if (g_env.bNS4) {			this.menus[i].baseLayer = new Layer(this.menus[i].width);			this.menus[i].baseLayer.document.open();			this.menus[i].baseLayer.document.write(str);			this.menus[i].baseLayer.document.close();		} else if (g_env.bIE4) {			str = '<div id="menu_' + menuName + '"'			    + ' style="position:absolute;left:0px; top:0px;'			    + 'width:' + this.menus[i].width + 'px;visibility:hidden;">\n'			    + str			    + '</div>\n';			document.body.insertAdjacentHTML("beforeEnd", str);			this.menus[i].baseLayer = eval('document.all.menu_' + menuName );		}		this.menus[i].baseLayer.menu = this.menus[i];	}	// end for each menu		// Restore original scroll position in bIE4.	// if (g_env.bIE4 && !g_env.bIE5) window.scrollTo(xScr, yScr);    // setup each menu.	var x, y;	for (i = 0; i < this.menus.length; i++) {		DynElemMoveTo(this.menus[i].baseLayer, this.menus[i].xPos, this.menus[i].yPos);		DynElemSetBgColor(this.menus[i].baseLayer, this.borderColor);			    // setup each menu item	    x = this.border; y = this.border;	// start position	    width = this.menus[i].width - 2 * this.border;	    for (j = 0; j < this.menus[i].items.length; j++) {			var item = this.menus[i].items[j];			item.normLayer = DynElemGet('menu_' + this.menus[i].name + '_' + j);			item.evntLayer = DynElemGet('menu_' + this.menus[i].name + '_event_' + j);			if (g_env.bNS4 ) {				item.rollLayer = DynElemGet('menu_' + this.menus[i].name + '_roll_' + j);			}						height = DynElemGetHeight(item.normLayer);			DynElemMoveTo(item.normLayer, x, y);			DynElemSetBgColor(item.normLayer, this.itemBgColor);			DynElemClip(item.normLayer, 0, 0, width, height);			DynElemInherit(item.normLayer);			if (g_env.bNS4) {							DynElemMoveTo(item.rollLayer, x, y);				DynElemSetBgColor(item.rollLayer, this.itemBgRollColor);				DynElemClip(item.rollLayer, 0, 0, width, height);				DynElemHide(item.rollLayer);			}						DynElemMoveTo(item.evntLayer, x, y);			if (g_env.bIE4) {				item.evntLayer.style.pixelWidth = width;				item.evntLayer.style.pixelHeight = height;			}			DynElemClip(item.evntLayer, 0, 0, width, height);			DynElemInherit(item.evntLayer);						// setup event handling for each menuitem			item.evntLayer.rollLayer = item.rollLayer;			item.evntLayer.normLayer = item.normLayer;			item.evntLayer.menuitem = item;			item.evntLayer.onmouseover = onMouseOverTopNavMenuItem;			item.evntLayer.onmouseout = onMouseOutTopNavMenuItem;						if (g_env.bNS4) {				item.evntLayer.document.rollLayer = item.rollLayer;				item.evntLayer.document.href = item.href;				item.evntLayer.document.menuitem = item;				item.evntLayer.document.captureEvents(Event.MOUSEUP);				item.evntLayer.document.onmouseup = onClickTopNavMenuItem;			} else if (g_env.bIE4) {				item.evntLayer.href = item.href;				item.evntLayer.onclick = onClickTopNavMenuItem;			}						y += height + this.separator;	    }	// end for each menu item		    width = this.menus[i].width;	    height = y - this.separator + this.border;	    this.menus[i].baseLayer.width = this.menus[i].width;	    this.menus[i].baseLayer.height = height;	    if (g_env.bIE4) {			this.menus[i].baseLayer.style.pixelWidth = width;			this.menus[i].baseLayer.style.pixelHeight = height;		}	    DynElemClip(this.menus[i].baseLayer, 0, 0, width, height);		this.menus[i].baseLayer.xPos = this.menus[i].xPos;		this.menus[i].baseLayer.yPos = this.menus[i].yPos;		    // setup event handling for the menu		this.menus[i].baseLayer.onmouseover = onMouseOverTopNavMenu;		this.menus[i].baseLayer.onmouseout = onMouseOutTopNavMenu;		} // end for each menu		this.bMenusCreated = true;}function onMouseOverTopNavMenu(e) {	this.menu.topnav.stopTimer();}function onMouseOutTopNavMenu(e) {	// IE gets extra mouseouts; check mouse position to make sure we	// have really left the menu.	if (g_env.bIE4) {		var mouseX = window.event.clientX + document.body.scrollLeft;		var mouseY = window.event.clientY + document.body.scrollTop;		if (mouseX >= this.xPos  &&		    mouseX <= this.xPos+this.width &&		    mouseY >= this.yPos  &&		    mouseY <= this.yPos+this.height) {			return;	// still in menu		}	}		// Otherwise, hide menu and header highlight layers.	if (!this.menu.menuAnchor.bOn) {		this.menu.topnav.deactivateMenu( this.menu );	}}function onMouseOverTopNavAnchor( menuName ) {    this.stopTimer();	if (this.bMenusCreated) {		// hide form elements that may get in the way	    for (i = 0; i < this.formElems.length; i++) {			DynElemHide( this.formElems[i] );		}	    for (i = 0; i < this.menus.length; i++) {	        if (this.menus[i].name == menuName ) {	// show active menu				roll( 'img' + this.menus[i].name, this.menus[i].menuAnchor.imgRoll.src );				DynElemShow(this.menus[i].baseLayer);				this.menus[i].menuAnchor.bOn = true;	        }	        else {		// hide others				roll( 'img' + this.menus[i].name, this.menus[i].menuAnchor.imgDflt.src );				DynElemHide(this.menus[i].baseLayer);	        }	    }	} else {	// just activate menu achor	    for (i = 0; i < this.menus.length; i++) {	        if (this.menus[i].name == menuName ) {				roll( 'img' + this.menus[i].name, this.menus[i].menuAnchor.imgRoll.src );	        }	        else {				roll( 'img' + this.menus[i].name, this.menus[i].menuAnchor.imgDflt.src );	        }	    }	}}var g_menuActive = null;function onMouseOutTopNavAnchor( menuName ) {	if (this.bMenusCreated) {		var menu = this.getMenu(menuName);		if (menu) {			menu.menuAnchor.bOn = false;			g_menuActive = menu;            this.timerHide = setTimeout('TopNavDeactivateMenu(g_menuActive)',100);	    }	}}function TopNavDeactivateMenu( menu ) {	if (menu) {		menu.topnav.stopTimer();		roll( 'img' + menu.name, menu.menuAnchor.imgDflt.src );		DynElemHide(menu.baseLayer);				// reshow form elements	    for (i = 0; i < menu.topnav.formElems.length; i++) {			DynElemShow( menu.topnav.formElems[i] );		}	}}function TopNavStopTimer() {    clearTimeout(this.timerHide);	this.timerHide = null;	g_menuActive = null;}/******************************************************	TopNav event handlers*******************************************************/function onMouseOverTopNavMenuItem() {	var topnav = this.menuitem.menu.topnav;	topnav.stopTimer();	if (g_env.bNS4 ) {		DynElemShow(this.rollLayer);	} else if (g_env.bIE4) {	    this.style.backgroundColor = topnav.itemBgRollColor;		this.style.color = topnav.itemFgRollColor;	}	window.status = this.menuitem.href;}function onMouseOutTopNavMenuItem() {	var topnav = this.menuitem.menu.topnav;	if (g_env.bNS4) {		DynElemHide(this.rollLayer);	} else if (g_env.bIE4) {	    this.style.backgroundColor = topnav.itemBgColor;		this.style.color = topnav.itemFgColor;	}}function onClickTopNavMenuItem(e) {	if (this.href == "")		return true;		// Hide the drop down menu	var topnav = this.menuitem.menu.topnav;	var menuLayer = this.menuitem.menu.baseLayer;	if (menuLayer != null) {		DynElemHide(menuLayer);	}	// restore highlited item	if (g_env.bNS4) {		DynElemHide(this.rollLayer);	} else if (g_env.bIE4) {	    this.style.backgroundColor = topnav.itemBgColor;		this.style.color = topnav.itemFgColor;	}		// If the link starts with "javascript:" execute the code. Otherwise just	// link to the URL.	if (this.href.indexOf("javascript:") == 0) {		eval(this.href);	} else {		window.location.href = this.href;	}		return true;}/******************************************************	global resize handler*******************************************************/if (g_env.bNS4) {	window.onresize = onResizeTopNav;	window.origInnerWidth = window.innerWidth;	window.origInnerHeight = window.innerHeight;}function onResizeTopNav() {    if (origInnerWidth < window.innerWidth ||        origInnerWidth > window.innerWidth ||        origInnerHeight > window.innerHeight ||        origInnerHeight < window.innerHeight )    {		window.location.reload();    }}