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 fnSubMenu(iObj)
{
	var oDiv = document.getElementById("SubMenu" + iObj) ;
	oDiv.style.visibility = "visible" ;
}

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 fnHideMenu(iMenu)
{
	var oMenu = document.getElementById('SubMenu' + iMenu) ;
	if (oMenu)
		oMenu.style.visibility = 'hidden' ;
}

function fnHideMenus(iMenu)
{
	if (iMenu != 1) fnHideMenu(1) ;
	if (iMenu != 2) fnHideMenu(2) ;
	if (iMenu != 3) fnHideMenu(3) ;
	if (iMenu != 24) fnHideMenu(24) ;
}

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 fnConfirmDelete(ID)
{
	if (confirm ("Are you sure you want to permanently delete this item?"))
		location.href = "EditProduct.asp?Cmd=5&amp;ID=" + ID ;
}

function $(obj)
{
	return document.getElementById(obj) ;
}

