var MenuHighlightedKeyword = "Highlighted";
var RightPanelImagePopupTag;
var RightPanelImagePopupDefaultImageURL;
var GlobalBrowserVariablesSet;
var Opera;
var Opera6;
var Opera7;
var InternetExplorer;
var InternetExplorer6;
var NetscapeNavigator4;
var NetscapeNavigator6;
var W3CCompliant;
var DocumentBody;
var PixelSuffix;

//
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("Navigation0");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;


//
function SetGlobalBrowserVariables ()
{
	try
	{
		if (typeof(GlobalBrowserVariablesSet) == "undefined")
		{
			GlobalBrowserVariablesSet = true;
			Opera = !!(window.opera && document.getElementById);
			Opera6 = Opera && !document.defaultView;
			Opera7 = Opera && !Opera6;
			InternetExplorer = navigator.userAgent.toLowerCase().indexOf("msie") != -1 && document.all && ((document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body? document.body : null) && !Opera;
			InternetExplorer6 = InternetExplorer && parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+5)) >= 5.5;
			NetscapeNavigator4 = (document.layers && typeof document.classes != "undefined");
			NetscapeNavigator6 = (!Opera && document.defaultView && typeof document.defaultView.getComputedStyle != "undefined");
			W3CCompliant = !InternetExplorer && !NetscapeNavigator6 && !Opera && document.getElementById;
			DocumentBody = (((document.compatMode) && (document.compatMode != "BackCompat")) ? document.documentElement : ((document.body) ? document.body : null));
			PixelSuffix = (Opera6 || NetscapeNavigator4) ? "" : "px";
		}
	}
	catch (ExceptionObject)
	{
	}
}

function GetElement (Id)
{
	if (NetscapeNavigator4)
	{
		return((document.layers[Id] || null));
	}
	else
	{
		if (InternetExplorer)
		{
			return((document.all[Id] || null));
		}
		else
		{
			return((document.getElementById(Id) || null));
		}
	}
}

function ParseInteger (StringValue)
{
	var IntegerValue;
	IntegerValue = parseInt(StringValue);
	if (isNaN(IntegerValue))
	{
		return(0);
	}
	else
	{
		return(IntegerValue);
	}
}

function GetWidth (Tag)
{
	return(ParseInteger(NetscapeNavigator4 ? Tag.clip.width : (Tag.style.pixelWidth || Tag.offsetWidth)));
}

function GetHeight (Tag)
{
	return(ParseInteger(NetscapeNavigator4 ? Tag.clip.height : (Tag.style.pixelHeight || Tag.offsetHeight)));
}

//
function Popup (URL, Width, Height, Scrollable, Resizable)
{
	try
	{
		var Popup;
		if ((typeof(Width) == "number") && (typeof(Height) == "number"))
		{
			Popup = window.open(URL, "Popup", "width = " + Width + ", height = " + Height + ", top = " + ((screen.height - Height) / 2) + ", left = " + ((screen.width - Width) / 2) + ", resizable = " + (Resizable ? "yes" : "no") + ", scrollbars = " + (Scrollable ? "yes" : "no") + ", status = no");
		}
		else
		{
			Popup = window.open(URL, "Popup");
		}
		Popup.window.focus();
	}
	catch (ExceptionObject)
	{
		alert("Your browser/toolbar/antivirus application appears to be blocking popups on this page.\n\nPlease enable popups and refresh this page to continue.");
	}
}

//

function ShowMenu (MenuNodeTag)
{
	try
	{
		if (InternetExplorer)
		{
			if (MenuNodeTag.MenuChildNodeGroupTag)
			{
				MenuNodeTag.MenuChildNodeGroupTag.style.display = "block";
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

function HideMenu (MenuNodeTag)
{
	try
	{
		if (InternetExplorer)
		{
			if (MenuNodeTag.MenuChildNodeGroupTag)
			{
				MenuNodeTag.MenuChildNodeGroupTag.style.display = "none";
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

function InitializeMenu (MenuRootNodeGroupTagId)
{
	try
	{
		SetGlobalBrowserVariables();
		var MenuRootNodeGroupTag = document.getElementById(MenuRootNodeGroupTagId);
		if (InternetExplorer)
		{
			if (document.getElementById(MenuRootNodeGroupTagId))
			{
				var MenuNodeTag = MenuRootNodeGroupTag.getElementsByTagName("LI");
				for (var i = 0; i < MenuNodeTag.length; i++)
				{
					var MenuChildNodeGroupTag = MenuNodeTag[i].getElementsByTagName("UL");
					if (MenuChildNodeGroupTag.length > 0)
					{
						MenuNodeTag[i].MenuChildNodeGroupTag = MenuChildNodeGroupTag[0];
					}
					//MenuNodeTag[i].onmouseover = new Function("ShowMenu(this);");
					//MenuNodeTag[i].onmouseout = new Function("HideMenu(this);");
				}
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

//
function AssignClassNameSuffix (Tag, ClassNameSuffix)
{
	try
	{
		if (typeof(Tag.className) == "undefined")
		{
			Tag.className = ClassNameSuffix;
		}
		else
		{
			Tag.className = Tag.className + " " + ClassNameSuffix;
		}
	}
	catch (ExceptionObject)
	{
	}
}

function AssignCSSSelectors ()
{
	try
	{
		SetGlobalBrowserVariables();
		if (InternetExplorer)
		{
			var ListTag = document.getElementsByTagName("UL");
			var ListFirstChildTag = null;
			var ListLastChildTag = null;
			var ListItemTag = null;
			for (var i = 0; i < ListTag.length; i++)
			{
				ListFirstChildTag = null;
				ListLastChildTag = null;
				if (ListTag[i].hasChildNodes)
				{
					ListItemTag = ListTag[i].childNodes;
					for (var j = 0; j < ListItemTag.length; j++)
					{
						if (ListItemTag[j].tagName.toLowerCase() == "li")
						{
							if (ListFirstChildTag == null)
							{
								ListFirstChildTag = ListItemTag[j];
							}
							ListLastChildTag = ListItemTag[j];
						}
					}
				}
				if (ListFirstChildTag != null)
				{
					AssignClassNameSuffix(ListFirstChildTag, "FirstChild");
					if (ListFirstChildTag != ListLastChildTag)
					{
						AssignClassNameSuffix(ListLastChildTag, "LastChild");
					}
				}
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

//
function Rollover(ListItemObject,Position)
{
	try
	{
		var MenuChildImageTag = ListItemObject.getElementsByTagName("IMG");
		if (MenuChildImageTag.length > 0)
		{
			if (MenuChildImageTag[0].src.substr(MenuChildImageTag[0].src.length-15,15) != "Highlighted.gif")
			{
 				var RolloverImage = MenuChildImageTag[0].src.replace(".gif" , "Highlighted.gif")
 				MenuChildImageTag[0].src = RolloverImage;
 				ListItemObject.className = "Highlighted";
	 			if (Position == "First")
				{
					ListItemObject.className = "HighlightFirstChild";
 				}
 				if (Position == "Last")
 				{
 					ListItemObject.className = "HighlightLastChild";
 				}
 			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

function Rollout(ListItemObject,Position)
{
	try
	{                   
		var MenuChildImageTag = ListItemObject.getElementsByTagName("IMG");
		if (MenuChildImageTag.length > 0)
		{
			if (MenuChildImageTag[0].src.substr(MenuChildImageTag[0].src.length-15,15) == "Highlighted.gif")
			{
				var RolloutImage = MenuChildImageTag[0].src.replace("Highlighted.gif" , ".gif")
				MenuChildImageTag[0].src = RolloutImage;
				ListItemObject.className = "";
				if (Position == "First")
				{
					ListItemObject.className = "FirstChild";
				}
				if (Position == "Last")
 				{
					ListItemObject.className = "LastChild";
				}
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

function RolloverEffect (MenuRootNodeGroupTagId)
{
	try
	{
		SetGlobalBrowserVariables();
		var Position;
		if (document.getElementById(MenuRootNodeGroupTagId))
		{
			var MenuRootNodeGroupTag = document.getElementById(MenuRootNodeGroupTagId);
			for (var i = 0; i < MenuRootNodeGroupTag.childNodes.length; i++)
			{
				if (i==0)
				{
					Position = "First";
				}
				
				if (i == MenuRootNodeGroupTag.childNodes.length-1)
				{
					Position = "Last";
				}
				
				if (MenuRootNodeGroupTag.childNodes[i].className != 'Highlighted')
				{
					MenuRootNodeGroupTag.childNodes[i].onmouseover = new Function("Rollover(this,'" + Position + "');ShowMenu(this);");
					MenuRootNodeGroupTag.childNodes[i].onmouseout = new Function("Rollout(this,'" + Position + "');HideMenu(this);");
				}
				else
				{
					MenuRootNodeGroupTag.childNodes[i].onmouseover = new Function("ShowMenu(this);");
					MenuRootNodeGroupTag.childNodes[i].onmouseout = new Function("HideMenu(this);");
				}
				Position = "";  
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

//
function SetNavigationItemHighlighted (MenuRootNodeGroupTagId,ListItem)
{
	try
	{
		SetGlobalBrowserVariables();
		if (document.getElementById(MenuRootNodeGroupTagId))
		{
			var MenuRootNodeGroupTag = document.getElementById(MenuRootNodeGroupTagId);
			var MenuNodeTag = MenuRootNodeGroupTag.getElementsByTagName("LI");
			for (var i = 0; i < MenuNodeTag.length; i++)
			{
				if (i == ListItem+1)
				{
					alert(MenuNodeTag[i]);
					MenuNodeTag[i].className="Highlighted";
				}
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

//
function ToggleVisibility (TagId)
{
	try
	{
		var Tag = document.getElementById(TagId);
		if (Tag.style.display == "none")
		{
			Tag.style.display = "block";
		}
		else
		{
			Tag.style.display = "none";
		}
	}
	catch (ExceptionObject)
	{
	}
}

function ToggleParentTag (Tag, ClassName)
{
	try
	{
		var ParentTag = document.getElementById(Tag).parentElement;
		if (ParentTag.className == "")
		{
			ParentTag.className = ClassName;
		}
		else
		{
			ParentTag.className = "";
		}
	}
	catch (ExceptionObject)
	{
	}
}

//
function AppendOnClickFunction (AnchorTag, Commands)
{
	try
	{
		if (typeof(AnchorTag.onclick) == "function")
		{
			AnchorTag.OnClickFunction = AnchorTag.onclick;
			AnchorTag.onclick = new Function("event", ("this.OnClickFunction();" + Commands));
		}
		else
		{
			AnchorTag.onclick = new Function(Commands);
		}
	}
	catch (ExceptionObject)
	{
	}
}

function AssignLinks ()
{
	try
	{
		var LinkTag = document.getElementsByTagName("A");
		for (var i = 0; i < LinkTag.length; i++)
		{
			if (LinkTag[i].href.indexOf("#") == (LinkTag[i].href.length - 1))
			{
				AppendOnClickFunction(LinkTag[i], "return(false);");
			}
			else if ((typeof(LinkTag[i].rel) != "undefined") && (LinkTag[i].rel.toLowerCase() == "external"))
			{
				AppendOnClickFunction(LinkTag[i], "Popup(this.href);return(false);");
			}
		}
	}
	catch (ExceptionObject)
	{
		alert(ExceptionObject.description);
	}
}


//
function HighlightNavigation (TagId)
{
	try
	{
		SetGlobalBrowserVariables();
		var RootNodeGroupTag = document.getElementById(TagId);
		var NodeTag = RootNodeGroupTag.getElementsByTagName("LI");
		for (i = 0; i < NodeTag.length; i++)
		{
			if (NodeTag[i].getElementsByTagName("UL").length > 0)
			{
				if (NodeTag[i].className == "Highlighted")
				{
					NodeTag[i].className = "HighlightedDropdown"
				}
			}
		}
	}
	catch (ExceptionObject)
	{
		//alert(ExceptionObject.description);
	}
}	