window.onload = initMenu;

var nbsp = "\u00a0";

function initMenu()
{
	var ids = new Array("nav");
	
	for(var i = 0; i < ids.length; i++)
	{
		var sfEls = document.getElementById(ids[i]).getElementsByTagName("LI");
		for (var i = 0; i < sfEls.length; i++) {
			sfEls[i].onmouseover = function() {
				if(!this.oldClassName)
					this.oldClassName = this.className.replace(new RegExp("\\bsfhover\\b"), "");
				this.className += " sfhover";
			}
			sfEls[i].onmouseout = function() {
				this.className = this.oldClassName;
			}
				
			var sfEls2 = sfEls[i].getElementsByTagName("A");
			for (var j = 0; j < sfEls2.length; j++)
			{
				sfEls2[j].onclick = function() {
					if(this.href.substr(this.href.length-1) == "#")
						return false;
					else
						this.parentNode.parentNode.parentNode.className = this.parentNode.parentNode.parentNode.oldClassName;
					if(this.className == "subnewwindow")
					{
						window.open(this.href);
						return false;
					}
				}
			}
		}
	}
}

function escapeHtml(unsafe)
{
	return unsafe
		.replace(/&/g, "&amp;")
		.replace(/</g, "&lt;")
		.replace(/>/g, "&gt;")
		.replace(/"/g, "&quot;")
		.replace(/'/g, "&#039;")
		.replace(/\n/g, "<br />");
}

function newXmlHttpRequest()
{
	var xmlHttpRequest;
	if(window.XMLHttpRequest)
	{
		xmlHttpRequest = new XMLHttpRequest();
	}
	else
	{
		try
		{
			xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(ee)
			{
				return null;
			}
		}
	}
	return xmlHttpRequest;
}

