var navHTML = "";

function whichMenu()
{
	if (is_ie) return "menulink"; 
	if (is_nav6up) return "menulink2"; 
	if (is_nav4up) return "menulink3"; 
	return "";
}
function makeColor(x,color)
{
	x.bgColor=color;
}
function startLayer(x,outColor,overColor)
{
	if (is_nav4up) out('<ilayer><layer width="'+x+'" onMouseOut="makeColor(this,\''+outColor+'\');" onMouseOver="makeColor(this,\''+overColor+'\');">');
}
function endLayer()
{
	if (is_nav4up) out('</layer></ilayer>');
}
function createLink(text,url,protocol,server,classVal)
{
	out('<a target="_top" href="'+protocol+'://'+server+url+'" class="'+classVal+'">'+text+'</a>');
}
function startNav(width,bgcolor,border,cellspacing,cellpadding)
{
	if (width==null) width="";
	if (bgcolor==null) bgcolor="#FFFFFF";
	if (border==null) border=0;
	if (cellspacing==null) cellspacing=0;
	if (cellpadding==null) cellpadding=0;
	out('<table width="'+width+'" border="'+border+'" cellspacing="'+cellspacing+'" cellpadding="'+cellpadding+'" bgcolor="#'+bgcolor+'">');
	out('<tr>');
}
function makeDivider(classVal, bgcolor)
{
	if (classVal==null) classVal="topNavPipe";
	if (bgcolor==null) bgcolor="#000000";
	out('<td width="1" class="'+classVal+'" bgcolor="#'+bgcolor+'">|</td>');
}
function startCell(width,bgcolor,overColor)
{
	if (width==null) width="";
	if (bgcolor==null) bgcolor="000000";
	if (overColor==null) overColor="EE7B12";
	out('<td width="'+width+'" bgcolor="#'+bgcolor+'" align="center">');
	startLayer(width,bgcolor,overColor);
}
function startCellNoLayer(width,bgcolor)
{
	if (width==null) width="";
	if (bgcolor==null) bgcolor="000000";
	out('<td width="'+width+'" bgcolor="#'+bgcolor+'" align="center">');
}
function endCell()
{
	endLayer();
	out('</td>');
}
function endNav()
{
	out('</tr></table>');
}
function out(text)
{
	navHTML=navHTML+text;
}
function buildGlobalTopNav(serverName, isLoggedIn, isPreview, width)
{
	if (serverName==null) return;
	if (isLoggedIn==null) isLoggedIn=false;
	if (isPreview==null) isPreview=true;
	navHTML = "";
	if (width==null) width=760;
	classVal= (is_ie)?"topNavIE":((is_nav6up)?"topNavNS6up":((is_nav4up)?"topNavNS4up":""));
	startNav(width,"000000");
	startCell(300,"000000"); out('<img src="/images/logos/questiaLogo300x30.gif" width="300" height="30">'); endCell();
	startCellNoLayer("50%","000000"); out('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'); endCell();
	startCell(50,"000000"); createLink("HOME","/", "http", serverName,classVal); endCell();
	if (!isLoggedIn || (isLoggedIn && isPreview)) { makeDivider(); startCell(80,"000000"); createLink("SUBSCRIBE","/subscribe", "http", serverName,classVal); endCell(); }
	if (isLoggedIn && !isPreview) { makeDivider(); startCell(80,"000000"); createLink("MY&nbsp;ACCOUNT","/SelfCareMediator.qst?action=displaySelfCare", "https", serverName,classVal); endCell(); }
	if (!isLoggedIn || (isLoggedIn && isPreview)) { makeDivider(); startCell(100,"#000000"); createLink("ABOUT&nbsp;QUESTIA","/aboutQuestia/about.html", "http", serverName,classVal); endCell(); }
	makeDivider(); startCell(30,"000000"); createLink("FAQ","/aboutQuestia/faqLibrary.html", "http", serverName,classVal); endCell();
	if (!isLoggedIn || (isLoggedIn && isPreview)) { makeDivider(); startCell(50,"000000"); createLink("CONTACT&nbsp;US","/support/CustomerSupport.jsp", "http", serverName,classVal); endCell() ; }
	if (isLoggedIn && !isPreview) { makeDivider(); startCell(100,"000000"); createLink("CUSTOMER&nbsp;SUPPORT","/support/CustomerSupport.jsp", "http", serverName,classVal); endCell(); }
	if (!isLoggedIn) { makeDivider(); startCell(60,"000000"); createLink("LOGIN","/LoginMediator.qst?action=displayLoginForm", "https", serverName,classVal); endCell() };
	if (isLoggedIn) { makeDivider(); startCell(60,"000000"); createLink("LOG&nbsp;OUT","/LoginMediator.qst?action=displayLoginForm", "https", serverName,classVal); endCell() };
	endNav();
	document.write(navHTML);
}
function buildAboutQuestiaSubTopNav(serverName, isLoggedIn, isPreview)
{
	if (serverName==null) return;
	if (isLoggedIn==null) isLoggedIn=false;
	if (isPreview==null) isPreview=true;
	navHTML = "";
	classVal= (is_ie)?"aboutSubNavIE":((is_nav6up)?"aboutSubNavNS6up":((is_nav4up)?"aboutSubNavNS4up":""));
	startNav(760,"CCCCCC");
	startCellNoLayer(450,"CCCCCC"); out("&nbsp;"); endCell();
	startCell(30,"999999","467B93"); createLink("WHAT&nbsp;WE&nbsp;DO","/aboutQuestia/about.html", "http", serverName,classVal); endCell();
	makeDivider("aboutSubNavPipe","999999"); startCell(30,"999999","467B93"); createLink("QUESTIA&nbsp;IN&nbsp;THE&nbsp;NEWS","/aboutQuestia/aboutNews.html", "http", serverName,classVal); endCell();
	makeDivider("aboutSubNavPipe","999999"); startCell(30,"999999","467B93"); createLink("JOBS&nbsp;AT&nbsp;QUESTIA","/aboutQuestia/aboutJobs.html", "http", serverName,classVal); endCell();
	startCellNoLayer(250,"CCCCCC"); out("&nbsp;"); endCell();
	endNav();
	document.write(navHTML);
}


