function getDealerTD(show) 
{
	var current = isCurrent(show + ".jsp");
	var width = 100 / elements;
	//alert(show + ", " + current);
	document.write("<td width=" + width + "% onMouseOut=\"this.className='" + (current ? "dealerLoginOn" : "dealerLoginOff") + "'\" onMouseOver=\"this.className='dealerLoginOn'\" class=\"" + (current ? "dealerLoginOn" : "dealerLoginOff") + "\">" +
						"<a href=\"" + getDealerLink(show, "elite") + ".jsp\">" + noSpace(show) + "</a>" + 
				   "</td>"
					);
}

function getTD(show, area) 
{
	var current = isCurrent(show + ".html");
	var width = 100 / elements;
	document.write("<td width=" + width + "% " + 
						"onMouseOut=\"this.className='" + getStyleMouseOut(area, current) + "'\" " + 
						"onMouseOver=\"this.className='" + getStyleMouseOver(area, current) + "'\" " + 
						"class=\"" + getStyleSelected(area, current) + "\">" +
							"<a class='" + area + "" + getLinkClass(current) + "' href=\"" + getLink(show, area) + ".html\">" + 
								noSpace(show) + 
							"</a>" + 
				   "</td>"
					);
}

function getLinkClass(selected)
{
	if (selected)
	{
		return "NavLinkOn";
	}
	else return "NavLink";
}
function getStyleSelected(area, selected)
{
	if (selected)
		return area + "NavSelected"
	else
		return area + "NavOff"
}
function getStyleMouseOver(area, current)
{
	if (current)
		return area + "NavSelected"
	else return area + "NavOn"
}
function getStyleMouseOut(area, selected)
{
	if (selected)
		return area + "NavSelected"
	else return area + "NavOff";
}

function getLink(show, area)
{
	return (isLoggedIn() || isInFAQ() ? "../" : "" ) + "../" + area + "/" + toLink(show);
}

function getDealerLink(show, area)
{
	return toLink(show);
}

function isLoggedIn()
{
	var URL = self.location + "";
	return (URL.toLowerCase().indexOf("loggedin") != -1);
}
function isInFAQ()
{
	var URL = self.location + "";
	return (URL.toLowerCase().indexOf("faq/") != -1);
}

function isTemplate()
{
	var URL = self.location + "";
	return (URL.toLowerCase().indexOf("template") != -1);
}
function toLink(show)
{
	var result = "";
	for (var i = 0; i < show.length; i++)
	{
		current = show.charAt(i);
		if (current != " ")
		{
			result += current.toLowerCase();
		}
	}
	return result;
}
function noSpace(show)
{
	var result = "";
	for (var i = 0; i < show.length; i++)
	{
		current = show.charAt(i);
		if (current == " ")
		{
			result += "&nbsp;";
		}
		else result += current;
	}
	return result; 
}

function isCurrent(show)
{	
//	alert ((highlight + ".html") + "\n" + show)
	if (highlight != null && (highlight + ".html").toLowerCase() == show.toLowerCase())
	return true;
	
	var URL = self.location + "";
	URL = URL.substring(URL.lastIndexOf("/") + 1);
	//alert (URL + ", " + toLink(show));
	return toLink(show) == URL;
}