function PageLoad()
{
	var button = document.getElementById(section);
	if (button)
	{
		button.className = "currentPage";
		button.href = "#";
	}

	var subbutton = document.getElementById(subpage);
	if (subbutton)
	{
		subbutton.className = "currentSubPage";
		subbutton.href = "#";
	}
		
	if (subnav)
		displayDiv(subnav, true);
}

function showDiv(divName, show)
{
	document.getElementById(divName).style.visibility = (show) ? 'visible' : 'hidden';
}

function displayDiv(divName, show)
{
	document.getElementById(divName).style.display = (show) ? 'block' : 'none';
}

function trim(s)
{
	return s.replace(/^\s+|\s+$/g, '');
}

function doLogon()
{
	var logon = trim(document.getElementById("logon").value);

    // Please keep list in the array below sorted alphabetically.
	var clients = new Array(
            "Amari",
            "Austin",
            "Corporate",
            "ChinoHills",
            "DowntownLA",
            "GrandRapids",
            "Manhattan",
            "Mothercorp",
            "Revitaliz",
            "SantaMonica",
            "Template",
            "Training");
	
	for (i = 0; i < clients.length; i++)
	{
		if (logon.toLowerCase() == clients[i].toLowerCase())
		{
			document.location.href = "http://www.acaramedspa.com/" + clients[i];
			return;
		}
	}
	
	document.getElementById("logonerror").innerHTML = "Incorrect logon.";					
}

// Return the value of a variable in the URL.
// For example, www.test.com?in=ABC&out=DEF, ask for 'in' and get back 'ABC'.
// If not found, an empty string is returned.
function getURLVariable(variable)
{
    var query = window.location.search.substring(1);
    var vars = query.split("&");
              
    for (var i=0; i < vars.length; i++)
    {
        var pair = vars[i].split("=");
        if (pair[0] == variable)
            return pair[1];
    }
    
    return "";
}