﻿function formatMoney(target)
{
	var strValue;
	
	if(isMoney(target.value))
	{
		strValue = stripCurrencySymbol(target.value);
		if(strValue.indexOf('.') == -1) strValue = strValue + ".00"	// add a .00 if there is currently no decimal
		else strValue = strValue.substring(0, strValue.indexOf('.') + 3); // chop off anything after two decimal places
		if(strValue.indexOf('.') + 2 == strValue.length) strValue = strValue + "0"; // add a final zero if needed
		if(strValue.indexOf('.') + 1 == strValue.length) strValue = strValue + "00"; // add a final zero if needed
	}
	else strValue = ""
	target.value = strValue;
}

function formatPercentage(target)
{
	var strValue;
	
	if(isPercentage(target.value))
	{
		strValue = stripCurrencySymbol(target.value);
		if(strValue.indexOf('.') == -1) strValue = strValue + ".00"	// add a .00 if there is currently no decimal
		else strValue = strValue.substring(0, strValue.indexOf('.') + 3); // chop off anything after two decimal places
		if(strValue.indexOf('.') + 2 == strValue.length) strValue = strValue + "0"; // add a final zero if needed
		if(strValue.indexOf('.') + 1 == strValue.length) strValue = strValue + "00"; // add a final zero if needed
	}
	else strValue = ""
	target.value = strValue;
}

function returnObjById(id)
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}
function enableMenu()
{
    var nav = returnObjById('nav');
    for (h = 0; h < nav.childNodes.length; h++)
    {
        if (nav.childNodes[h].nodeName == "UL")
        {
            navRoot = nav.childNodes[h];
            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/i, "");
                    }
                }
            }
        }
    }
}

function loader()
{
    enableMenu();
}
window.onload=loader;