var curSubMenu = 0 ;
var bIE4 = false ;

function fnBrowserCheck()
{
	var agent = navigator.userAgent.toUpperCase();
	if (agent.indexOf("MSIE") != -1)
	{
		if (parseInt(navigator.appVersion) >= 4)
			bIE4 = true ;
	}
}

function fnErrorMsg(sMsg, sUrl, sLine)
{
	window.alert("Error:" + sMsg + "\nFile: "  + sUrl + "\nLine: " + sLine)
}

window.onerror = fnErrorMsg ;


function fnResize(oObj)
{
/*	window.status = oObj.clientHeight ; */
}

function fnShowSubMenu(iObj)
{
	fnHideSubMenu() ;
	if (iObj != 0)
	{
		curSubMenu = iObj ;
		var oDiv = document.getElementById("subMenu" + iObj) ;
		var oMenu = document.getElementById("iMenu" + iObj) ;
		var oBaseMenu = document.getElementById("BaseMenu") ;

		oMenu.style.borderTopColor = "#FF0000" ;
		oMenu.style.borderRightColor = "#800000" ;
		oMenu.style.borderBottomColor = "#800000" ;
		oDiv.style.top = oMenu.offsetTop  + oBaseMenu.offsetTop + 2;
		oDiv.style.left = oMenu.offsetLeft + oMenu.offsetWidth  + oBaseMenu.offsetLeft + 2;
		oDiv.style.visibility = "visible" ;
	}
}

function fnHideSubMenu()
{
	if (curSubMenu != 0)
	{
		var oDiv = document.getElementById("subMenu" + curSubMenu) ;
		var oMenu = document.getElementById("iMenu" + curSubMenu) ;

		oMenu.style.borderRightColor = "Red" ;
		oMenu.style.borderBottomColor = "Red" ;
		oMenu.style.borderTopColor = "#800000" ;
		oDiv.style.visibility = "hidden" ;
		curSubMenu = 0 ;
	}


}

function fnSendMail(n,p)
{
	var l ;
	l = p.length ;
	location.href = "Mailto:" + n + "@" + p.slice(2,l-4) ;
}

function fnShow(Target, Prompt)
{
	var oTarget = document.getElementById(Target) ;
	var oPrompt = document.getElementById(Prompt) ;
	if (oTarget.style.display == "none")
	{
		oTarget.style.display = "inline"
		oPrompt.style.display = "none"
	}
	else
	{
		oTarget.style.display = "none"
		oPrompt.style.display = "inline"
	}
}

function fnCalcEaster(bCheck)
{
	var oYear = document.getElementById("EasterYear") ;
	var oOutput = document.getElementById("strEaster") ;

	var B, D, E, Y, Q ;
	Y = Math.floor(oYear.value) ;
	if (isNaN(Y) || Y < 1900 || Y > 2099)
	{
		if (bCheck)
			oOutput.innerHTML = "<span style='color:red;'>Sorry, can't compute.<br>Year must be between 1900 and 2099</span>" ;
		else
			oOutput.innerHTML = "&nbsp;" ;
		return ;
	}
	B = 225 - 11 * (Y % 19) ;
	D = ((B-21) % 30) + 21 ;
	if (D > 48) D = D -1 ;
	E = (Y + Math.floor(Y/4) + D + 1) % 7  ;
	Q = D + 7 - E ;
	if (Q <= 31)
		oOutput.innerHTML = Q + " March " + Y ;
	else
		oOutput.innerHTML = (Q - 31) + " April " + Y ;
}

function fnEasterChange(oYear)
{
	if (event.keyCode == 38 || event.keyCode == 40)
	{
		var Y = Math.floor(oYear.value) ;
		if (isNaN(Y))
		{
			var d = new Date() ;
			Y = d.getFullYear() ;
		}
		if (event.keyCode == 38)
			Y++ ;
		else
			Y-- ;
		oYear.value = Y ;
	}
}

function fnMoreServices()
{
	var oDiv = document.getElementById("MoreServices") ;
	oDiv.style.display = "block" ;
	oDiv = document.getElementById("MoreServicesPrompt") ;
	oDiv.style.display = "none" ;
}