//Lexus javascript menu v1.1
//Specific version for lexus v7 sites only.

// Mark Saunders: this version has been updated to ensure that 
// car sub-chapters (e.g. RX300/RX400 and IS200/IS250) are dynamic 
// from attribute hassubchapters=Y;

var theTree, allText='',sitePath='',NSfirst=0,showroomtxt,showroom;
var pageName, pageRefer, xrepainted=false,countryselector='',countryDisplayed=false,onHomePage=false,navwidth=138,tmc='';

var strHREF

strHREF = location.href;
if (strHREF.substring(strHREF.length-1,strHREF.length) == "/")
{
	strHREF = location.href + "index.asp";
}

// GUI
var menuGUI=new Array()
var modelmenuGUI=new Array()

function get_rsb_menu(prefix)
{
	var i, j, o, oo, pp, navclass, url;
	o = jsRSBMenu;

	for (i=0; i<o.length; i++)
	{
		oo=o[i].split('|');

		if (oo[4] == "ROOT")
		{
			url = oo[1].split("?");
			popup = "";

			if (oo[2] !== "0")
			{
				popup = ' target="_new"';
			}

			if (strHREF.indexOf(url[0].replace("index.asp",""))<0){navclass = "";}else{navclass = "activenav";}
			if (oo[1].indexOf("http://")<0) ds('<a href="/' + prefix + "/" + oo[1] + '" class="' + navclass + '"' + popup + '>' + oo[0] + '</a><br>');
			else ds('<a href="' + oo[1] + '" class="' + navclass + '"' + popup + '>' + oo[0] + '</a><br>');

			counter = 0;

			if (strHREF.indexOf(url[0].replace("index.asp",""))!=-1)
			{
				for (j=0; j<o.length; j++)
				{
					pp=o[j].split('|');
					popup = "";

					if (pp[2] !== "0")
					{
						popup = ' target="_new"';
					}

					if (pp[4] == oo[3])
					{
						counter = counter + 1;
						if (counter == 1){ds('<p class="subnav">');}

						if (strHREF.indexOf(pp[1].replace("index.asp",""))<0){navclass = "";}else{navclass = "activenav";}
						if (pp[1].indexOf("http://")<0) ds('<a href="/' + prefix + "/" + pp[1] + '" class="' + navclass + '"' + popup + '>' + pp[0] + '</a><br>');
						else ds('<a href="' + pp[1] + '" class="' + navclass + '"' + popup + '>' + pp[0] + '</a><br>');
					}
				}
				if (counter == 0){}else{ds('</p>');}
			}
		}
	}
}

function dealer_format(str)
{
	var strFormat;
	strFormat = str;

//	strFormat = strFormat.replace("lexus_cars", "lexus_cars_dealer");
//	strFormat = strFormat.replace("financial_services", "financial_services_dealer");

	return(strFormat);
}

function get_section(strNode, strQuery, method)
{
	// We take the variable (strNode) and we loop through the menu array for the correct node.

	var v, o, i, j, k, m, strReplace, navclass, subnavclass, pclass, carMenu, subcarMenu, mainMenu, counter, strQuerystring, bypassMenu, bypassArray, strCheck, strCheck2;

	bypassMenu = 0;

	// these two id's rep hanley and grimsby
	bypassArray = "C79132A0-E5AE-4168-A253-F98BD18D8396|C79132A0%2DE5AE%2D4168%2DA253%2DF98BD18D8396|FFD7FC44%2D6F90%2D4CC9%2D8F9D%2DC936475E4CFD|FFD7FC44-6F90-4CC9-8F9D-C936475E4CFD";

	oo = bypassArray.split('|');
	for (i=0; i<oo.length; i++)
	{
		if (strHREF.indexOf(oo[i]) !=-1)
		{
			bypassMenu = 1;
		}
	}

	if (bypassMenu == 0)
	{
	if (checkJsMenu())
	{
		v = "";
		o=jsMenu;

		// This is where we setup the additional code to go into the URL for RSB

		// TOP NAV

		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|')

// If the updated values passed in are not there then it will refer back to the old method of finding the node (via the name instead of URL)

			if (method == "1")
			{
				strCheck = oo[5].toLowerCase();
				strCheck2 = "/" + strNode.toLowerCase() + "/index.asp";
			}
			else
			{
				strCheck = oo[4].toLowerCase();
				strCheck2 = strNode.toLowerCase();
			}

	  		if (strCheck == strCheck2)
			{
				if (oo[5].indexOf('javascript')!=-1 || oo[5].indexOf('#top')!=-1) {thepath=oo[5];}else{thepath=sitePath+oo[5];
				if (strHREF.indexOf(dealer_format(oo[5].replace("index.asp","")))<0){navclass=""}else{navclass="activenav"}

				if (oo[5].indexOf("?")!=-1)
				{
					strQuerystring = "&" + strQuery;
				}
				else
				{
					strQuerystring = "?" + strQuery;
				}

				thepath = dealer_format(thepath);

				// ###################
				// START OF LINK CODE
				// ###################

				if (oo[0]=="0")
				{
					v+='<p class="nav" align="left" ><a href="'+thepath+strQuerystring+'" class="' + navclass + '" >'+oo[4]+'</a></p>'
				}

				// ###################
				// END OF LINK CODE
				// ###################

				// ###################
				// START OF CHILD LINKS CODE (Showroom)
				// ###################

				if (oo[10].indexOf("showroom=Y")!=-1)
				{
					// ###################
					// Horizontal links for showroom cars
					// ###################

					carMenu = "";
					hasSubChapters = 0;

					v+='<p class="nav" align="left">'
					for (j=0; j<o.length; j++)
					{
						pp=o[j].split('|')

						if (pp[5].indexOf("?")!=-1)
						{
							strQuerystring = "&" + strQuery;
						}
						else
						{
							strQuerystring = "?" + strQuery;
						}

						if (pp[5].indexOf('javascript')!=-1 || pp[5].indexOf('#top')!=-1) {thepath=pp[5];}else{thepath=sitePath+pp[5]};
						if (strHREF.indexOf(dealer_format(pp[5].replace("index.asp","")))<0){navclass=""}else{navclass="activenav"}

						thepath = dealer_format(thepath);

						if (pp[3]==0)
						{
							v+='<a href="'+thepath+strQuerystring+'" class="' + navclass + '">'+pp[4]+'</a>&nbsp;&nbsp;'

							if (strHREF.indexOf(dealer_format(pp[5].replace("index.asp","")))!=-1)
							{
								carMenu = pp[2];

								if ((pp[10].toLowerCase().indexOf('hassubchapters=y') !== -1) || (pp[4] == 'RX'))
								{
									hasSubChapters = 1;
								}
							}
						}
					}
					v+='</p>'

					// ###################
					// Child showroom models
					// ###################

					subcarMenu = "";
					counter = 0;

					v+='<p class="subnav" align="left">'
					for (j=0; j<o.length; j++)
					{
						pp=o[j].split('|')

						if (pp[5].indexOf("?")!=-1)
						{
							strQuerystring = "&" + strQuery;
						}
						else
						{
							strQuerystring = "?" + strQuery;
						}

						if (pp[5].indexOf('javascript')!=-1 || pp[5].indexOf('#top')!=-1) {thepath=pp[5];}else{thepath=sitePath+pp[5]};
						if (strHREF.indexOf(dealer_format(pp[5].replace("index.asp","")))<0){navclass=""}else{navclass="activenav"}

						thepath = dealer_format(thepath);

						if (pp[3] == carMenu && pp[0] == "2" && hasSubChapters)
						{
							counter = counter + 1;

							v+='<p class="nav" align="left">'
							v+='<a href="'+thepath+strQuerystring+'" class="' + navclass + '" >'+pp[4]+'</a><br />'
							v+='</p>'

							if (strHREF.indexOf(dealer_format(pp[5].replace("index.asp","")))!=-1)
							{
								subcarMenu = parseInt(pp[2]);
							}
							else
							{
								subcarMenu = "";
							}

							// ###################
							// Child links for sub models
							// ###################

							if (subcarMenu !== "")
							{
								v+='<p class="subnav" align="left">'
								for (k=0; k<o.length; k++)
								{
									qq=o[k].split('|')

									if (qq[5].indexOf("?")!=-1)
									{
										strQuerystring = "&" + strQuery;
									}
									else
									{
										strQuerystring = "?" + strQuery;
									}

									if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
									if (strHREF.indexOf(dealer_format(qq[5]))<0){subnavclass=""}else{subnavclass="activesubnav"}

									thepath = dealer_format(thepath);

									if (parseInt(qq[3])==subcarMenu)
									{
										v+='<a href="'+thepath+strQuerystring+'"'
										if (qq[10].indexOf("techexplorer=Y")!=-1)
										{
											v+=' onClick="pop(this.href); return(false)"'
										}
										v+=' class="' + subnavclass + '" >'+qq[4]+'</a><br />'
									}
								}
								v+='</p>'
							}

							// ###################
							// End of child links for sub models
							// ###################
						}
					}
					v+='</p>'

					// ###################
					// Child links for cars if no sub models
					// ###################

					if (counter == 0)
					{
						v+='<p class="subnav" align="left">'
						for (k=0; k<o.length; k++)
						{
							qq=o[k].split('|')

							if (qq[5].indexOf("?")!=-1)
							{
								strQuerystring = "&" + strQuery;
							}
							else
							{
								strQuerystring = "?" + strQuery;
							}

							m = qq[5].split('/');
							strReplace = m[m.length-1]
							if (strReplace == "")
							{
								strReplace = "index.asp";
							}
							if (qq[4] == "Gallery")
							{
								strReplace = m[m.length-2] + "/" + strReplace;
							}

							if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
							if (strHREF.indexOf(dealer_format(qq[5].replace(strReplace,"")))<0){subnavclass=""}else{subnavclass="activesubnav"}

							thepath = dealer_format(thepath);

							if (qq[3]==carMenu)
							{
								v+='<a href="'+thepath+strQuerystring+'" class="' + subnavclass + '"'
								
								if (qq[10].indexOf("techexplorer")!=-1)
								//if (qq[4] == "Technology Explorer")
								{
									v+="onClick=\"window.open(this.href,'technology_explorer','width=776,height=555,scroll=0'); return(false)\"";
								}
								v+='>'+qq[4]+'</a><br />'
							}
						}
						v+='</p>'
					}

					// ###################
					// END OF CHILD LINKS CODE (Showroom)
					// ###################
				}

				if (oo[3]=="ROOT" && oo[10].indexOf("showroom=Y")<0)
				{
					// ###################
					// START OF CHILD LINKS CODE (Main menu)

					// ###################

					if (strHREF.indexOf(dealer_format(oo[5].replace("index.asp","")))!=-1)
					{
						mainMenu = parseInt(oo[2]);
					}
					else
					{
						mainMenu = "";
					}

					if (mainMenu !== "")
					{
						v+='<p class="subnav" align="left">'
						for (k=0; k<o.length; k++)
						{
							qq=o[k].split('|')

							if (qq[5].indexOf("?")!=-1)
							{
								strQuerystring = "&" + strQuery;
							}
							else
							{
								strQuerystring = "?" + strQuery;
							}

							if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
							if (strHREF.indexOf(dealer_format(qq[5].replace("index.asp","")))<0){subnavclass=""}else{subnavclass="activesubnav"}

							thepath = dealer_format(thepath);

							if (qq[3]==mainMenu && qq[10].indexOf("subshowroom=Y")<0)
							{
								v+='<a href="'+thepath+strQuerystring+'" class="' + subnavclass + '" >'+qq[4]+'</a><br />'
							}
						}
						v+='</p>'
					}

					// ###################
					// END OF CHILD LINKS CODE (Main menu)
					// ###################
				}
			}
		}
	}

	//v+='</table>';
	ds(v);
	}
	}
}

function showRSBSubnav(theInactiveIcon, theActiveIcon, strQuery)
{
	var v, o, i, j, k, m, tiggerA, triggerB, varHREF, strReplace, subfod, navclass, subnavclass, pclass, carMenu, subcarMenu, attributes, mainMenu, counter, theIcon, parentID, parentID2, parentLevel, childID, objID, objState, spareID, theIcon, parentName, parentName2, archiveArray;
	v = "";
	o=jsMenu;
	navclass = "";

	if (checkJsMenu())
	{
		if (strHREF.indexOf("dealers/")<0)
		{

		o=jsMenu;
		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|');
			if (strHREF.indexOf(dealer_format(oo[5]))!=-1)
			{
				parentID = oo[3];
				parentIDbackup = oo[2];
			}
		}

		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|');
			if (parseInt(oo[3]) == parentIDbackup)
			{
				parentID = parentIDbackup;
			}
		}

		v+='<TABLE width="100%" cellpadding="0" cellspacing="0" border="0" class="infobox">';

		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|');

			if (oo[5].indexOf("?")!=-1)
			{
				strQuerystring = "&" + strQuery;
			}
			else
			{
				strQuerystring = "?" + strQuery;
			}

			if (parseInt(oo[3]) == parentID)
			{
				if (strHREF.indexOf(dealer_format(oo[5].replace("index.asp","")))<0){subnavclass="subnav";theIcon=theInactiveIcon}else{subnavclass="activesubnav";theIcon=theActiveIcon}
				v+='<TR>';
				v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"><img src="' + theIcon +'" alt="" /></TD>';
				v+='<TD valign="top" style="padding: 2px" class="rightnav"><a href="' + dealer_format(oo[5]) + strQuerystring + '"'
				if (oo[11] == "1")
				{
					v+=' target="_blank"';
				}
				v+=' class="' + subnavclass + '">' + oo[4] + '</a></TD>';
				v+='</TR>';
			}
		}
		v+='</TABLE>';

		v+='<TABLE cellpadding="0" cellspacing="0" border="0">';
		v+='<TR><TD height="9"></TD></TR>';
		v+='</TABLE>';

		ds(v);

		}
	}
}

function showRSBMedianav(theInactiveIcon, theActiveIcon, strQuery)
{
	var v, o, i, j, k, m, strReplace, subfod, navclass, subnavclass, pclass, carMenu, subcarMenu, mainMenu, counter, theIcon, parentID, parentLevel, childID, objID, objState, theIcon;
	v = "";
	o=jsMenu;
	navclass = "";

	if (checkJsMenu())
	{
		// This is the start of the function.
		function showMediaSubnav(parentID)
		{
			var counter = 0;
			for (i=0; i<o.length; i++)
			{
				oo=o[i].split('|');
				if (parseInt(oo[2]) == parentID && counter == 0)
				{
					parentID = oo[3];
					counter = 1;
				}
			}

			v+='<TABLE width="141" cellpadding="0" cellspacing="0" border="0" class="infobox">';
			for (i=0; i<o.length; i++)
			{
				oo=o[i].split('|');
				if (parseInt(oo[3]) == parentID)
				{
					m = oo[5].split('/');
					strReplace = m[m.length-1]
					if (strReplace == "")
					{
						strReplace = "index.asp";
					}

					if (strHREF.indexOf(oo[5].replace(strReplace,""))<0)
					{
						theIcon = theInactiveIcon;
						navclass = "";
						objState = "subnav_hidden";
					}
					else
					{
						theIcon = theActiveIcon;
						navclass = "activenav";
						objState = "";
					}

					v+='<TR>';
					v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"><img src="' + theIcon +'" alt="" /></TD>';
					v+='<TD valign="top" style="padding: 2px" class="rightnav"><a href="javascript:simpletoggle(\'submenu' + oo[2] + '\')" class="' + navclass + '"'
					if (oo[11] == "1")
					{
						v+=' target="_blank"';
					}
					v+='>' + oo[4] + '</a></TD>';
					v+='</TR>';

					// This code below writes out the sub-links for each menu item.

					counter = 0

					for (j=0; j<o.length;j++)
					{
						pp=o[j].split('|');

						if (parseInt(oo[2]) == parseInt(pp[3]))
						{
							if (counter == 0)
							{
								v+='<TR>';
								v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"></TD>';
								v+='<TD valign="top" style="padding: 2px" class="rightnav">';
								v+='<TABLE cellpadding="0" cellspacing="0" border="0" class="' + objState + '" id="submenu' + oo[2] + '"><TR><TD>';
							}

							if (strHREF.indexOf(pp[5].replace("index.asp",""))<0){subnavclass="subnav";}else{subnavclass="activesubnav"}

							if (pp[5].indexOf("?")!=-1)
							{
								strQuerystring = "&" + strQuery;
							}
							else
							{
								strQuerystring = "?" + strQuery;
							}

							v+='<a href="' + pp[5] +strQuerystring+ '" class="' + subnavclass + '"'

							if (pp[11] == "1")
							{
								v+=' target="_blank"';

							}
							v+='>' + pp[4] + '</a><br />';
							counter = 1;
						}
					}

					if (counter > 0)
					{
						v+='</TD></TR></TABLE>';
						v+='</TD>';

						v+='</TR>';
					}
				}
			}

			v+='</TABLE>';
		}
		// The bracket above is the closing tag of the function.

		// ###################
		// This checks what page we're on in the array
		// ###################

		counter = -1

		o=jsMenu;
		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|');

			if (strHREF.indexOf(oo[5])!=-1)
			{
				if (parseInt(oo[0]) >= counter)
				{
					parentID = oo[3];
					parentLevel = oo[0];
					counter = oo[0];
				}
			}
		}

		showMediaSubnav(parentID);

		// ###################
		// End of page check
		// ###################
	}

	ds(v);
}

function setVisibility(id, value)
{
	var obj;
	if (document.getElementById && (obj = document.getElementById(id)) && obj.style)
	{
		obj.style.visibility = value;
		if (value == "visible")
		{
			obj.style.position = "relative";
		}
		else
		{
			obj.style.position = "absolute";
		}
	}
}

function toggle(theID, theArray, theCounter)
{
	var aaa, obj, archiveArray, iiiii;

	aaa = "";
	aaaa = theArray.split("|");

	for (iiiii=0; iiiii<theCounter; iiiii++)
	{
		if (aaa == "")
		{
			aaa = aaaa[iiiii];
		}
		else
		{
			aaa = aaa + ", " + aaaa[iiiii];
		}
	}

	archiveArray = aaa.split(", ");

	for (iiiii=0; iiiii<theCounter; iiiii++)
	{
		if (document.getElementById && (obj = document.getElementById("submenu" + archiveArray[iiiii])) && obj.style)
		{
//			alert(theID + ": " + parseInt(theID) + "\n" + archiveArray[iiiii] + ": " + parseInt(archiveArray[iiiii]));

			if (parseInt(theID) == parseInt(archiveArray[iiiii]))
			{
				if (obj.style.visibility == "visible")
				{
					hide("submenu" + archiveArray[iiiii]);
				}
				else
				{
					show("submenu" + archiveArray[iiiii]);
				}
			}
			else
			{
				hide("submenu" + archiveArray[iiiii]);
			}
		}
	}
}

function simpletoggle(id)
{
	var obj;
	if (document.getElementById && (obj = document.getElementById(id)) && obj.style)
	{
		if (obj.style.visibility == "")
		{
			show(id);
		}
		else
		{
			if (obj.style.visibility == "visible")
			{
				hide(id);
			}
			else
			{
				show(id);
			}
		}
	}
}

function show(id)
{
	setVisibility(id, "visible");
}

function hide(id)
{

	setVisibility(id, "hidden");
}

// Global GUI veariables not loaded in Netscape 4.  Requires initMenu.
function initValues() {

	if (checkJsMenu())
	{
	pageRefer='';
	xrepainted=false
	countryselector=gss(menuAttributes, 'countryselector=',';;;');
	showroom=gss(menuAttributes, 'showroom=',';;;');
	tmc=gss(menuAttributes, 'tmc=',';;;');

	countryDisplayed=onHomePage;
	if (countryselector=='N') countryselector='';
	if (showroom=='N') showroom='';
	if (tmc=='N') tmc='';
	}

}

	pageName=getPath(location.href)

	if(pageName.indexOf('?') > 0) {
		pageName = pageName.substr(0,pageName.indexOf('?'));
	}
	if(pageName.indexOf('.')==-1) pageName+='index.asp'


function initMenu(){
menuGUI=new Array(
'',
'::<tr><td height="16" id="x$DIV"><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>::<tr><td height="16" class="navtoolsselected" id="x$DIV"><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>$CHILDREN:: :: ::',
'::<tr><td height="16" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="10"><img src="/images/spacer.gif" width="10" height="1" alt="" border="0" /></td><td width="120" height="16" ><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>::<tr><td height="16" class="navtoolsselected" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="10"><img src="/images/spacer.gif" width="10" height="1" alt="" border="0" /></td><td width="120" height="16"><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>$CHILDREN:: :: ::',
'::<tr><td height="16" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="20"><img src="/images/spacer.gif" width="20" height="1" alt="" border="0" /></td><td width="120" height="16" ><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>::<tr><td height="16" class="navtoolsselected" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="20"><img src="/images/spacer.gif" width="20" height="1" alt="" border="0" /></td><td width="120" height="16"><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>$CHILDREN:: :: ::')

modelmenuGUI=new Array(
'', '',
'::<tr><td height="16" class="navtools" id="x$DIV"><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>::<tr><td height="16" class="navtoolsselected" id="x$DIV">$LABEL</td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>$CHILDREN:: ::<tr><td height="17" id="x$DIV">&nbsp;</td></tr>::',
'::<tr><td height="16" class="navtools" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="10"><img src="/images/spacer.gif" width="10" height="1" alt="" border="0" /></td><td width="120" height="16"><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>::<tr><td height="16" class="navtoolsselected" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="10"><img src="/images/spacer.gif" width="10" height="1" alt="" border="0" /></td><td width="120" height="16" >$LABEL</td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>$CHILDREN:: :: ::',
'::<tr><td height="16" class="navtools" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="20"><img src="/images/spacer.gif" width="20" height="1" alt="" border="0" /></td><td width="120" height="16"><a href="$LINK" $TARGET  onmouseover="ShowBar(\'x$DIV\');" onmouseout="HideBar(\'x$DIV\');">$LABEL</a></td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>::<tr><td height="16" class="navtoolsselected" id="x$DIV"><table border="0" cellspacing="0" cellpadding="0" width="138"><tr><td width="20"><img src="/images/spacer.gif" width="20" height="1" alt="" border="0" /></td><td width="120" height="16">$LABEL</td></tr></table></td></tr><tr><td height="1" class="navline"><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td></tr>$CHILDREN:: :: ::')

}



function doResize(evnt){location.reload(true)}

function TreeItem(a) {this.attributes=a;this.children=new Array()}

function Tree(a) {
	if (pageName==null) initValues()
	var o,i,v,par,id,vc,ac,tmp,ss, s1,parentPage,vv
	this.items=new Array(); this.activeCandidates=new Array(); this.getTree=_getTree; this.refer=null
		o=this.items; ac=this.activeCandidates
	o['ROOT']=new TreeItem('ROOT', '')
	s1=pageName.split('.');ss=s1[0].split('_');--ss.length;parentPage=ss.join('_')+'.'+s1[1]
	for (i=0; i<a.length; i++) {
		v=a[i].split('|');id=v[2];par=v[3];vc=this.items[par].children
		vc[vc.length]=id;this.items[id]=new TreeItem(v)
		vv=v[5]
		mypageName=pageName;
		vv=(rs(vv,' ',''))
		if (vv.toLowerCase()==mypageName) ac[ac.length]=id
		if (pageRefer!='' && vv==pageRefer) this.refer=id
		if (vv==parentPage) this.parentPageItem=id
	}
	this.activeItem=getActiveItem(this)
	if (this.activeItem==null) {
		if (this.parentPageItem==null) return
		this.activeItem=this.parentPageItem
	}
	vc=o[this.activeItem];i=0
	while (vc && i<20) {
		id=vc.attributes[2];par=vc.attributes[3];vc.active=true;i++
		if (par>'') {
			vc=o[par]
			if (vc!=null) vc.activeItem=id
		}
		else vc=null
	}
}

function _getTree(start, count, gui, par, curItem, curLevel) {
	var o, tmp, v, lo, parent, expandAll, active, v1, tmp1
	o=this.items[curItem?curItem:'ROOT']
	start=(start==null)?0:start
	count=(count==null)?99:count
	curLevel=curLevel?curLevel:0
	par=par?par:''
	expandAll=(par.indexOf('expand=all')>-1)?true:false
	active=(typeof o.activeItem=='undefined')?false:true
	if (start>0) return (active==false)?'':this.getTree(start-1, count, gui, par, o.activeItem, curLevel+1)
	gui=gui?gui:new Array('<ul>::<li><a href="javascript:testNav(\'$LINK\')">$LABEL</a></li>$CHILDREN::<li><b><a href="javascript:testNav(\'$LINK\')">$LABEL</a></b></li>$CHILDREN::</ul>')
	//gui=new Array('<ul>::<li><a href="javascript:testNav(\'$LINK\')">$LABEL</a></li>$CHILDREN::<li><b><a href="javascript:testNav(\'$LINK\')">$LABEL</a></b></li>$CHILDREN::</ul>')
	lo=((curLevel<gui.length)?gui[curLevel]:gui[gui.length-1]).split('::')
	if (o.attributes[8]=='1' && expandAll==false && active==false) return ''
	if (o.activeItem && this.items[o.activeItem].attributes[7]=='1' && par.indexOf('expand=all')==-1){

		tmp=lo[0]
		v=this.items[o.activeItem]
		tmp1=''
		if (v.attributes[9]!='1') tmp1=getItemHTML(v,gui,curLevel,this)
		if (v.children.length>0 && count>0 && needsChildren(par, o, v)) tmp1=rs(tmp1, '$CHILDREN', this.getTree(start, count-1, gui, par, o.activeItem, curLevel+1))
		else tmp1=rs(tmp1, '$CHILDREN', '')
		for (var j=0; j<v.children.length; j++)	{
			v1=this.items[v.children[j]]
			if (v1.attributes[9]=='1') tmp1+=getItemHTML(v1, gui, curLevel,this)
		}
		tmp+=tmp1
		if (tmp==lo[0]) return ''
		else return tmp+lo[3]
	}
	tmp=lo[0]
	for (var i=0; i<o.children.length; i++) {

		v=this.items[o.children[i]]
		if (v.attributes[9]!='1') tmp1=getItemHTML(v,gui,curLevel,this)
		else tmp1=''
		if (v.children.length>0 && count>0 && needsChildren(par, o, v)) tmp1=rs(tmp1, '$CHILDREN', this.getTree(start, count-1, gui, par, o.children[i], curLevel+1))
		else tmp1=rs(tmp1, '$CHILDREN', '')
		tmp+=tmp1
		for (var j=0; j<v.children.length; j++)	{
			v1=this.items[v.children[j]]
			if (v1.attributes[9]=='1') tmp1+=getItemHTML(v1, gui, curLevel,this)
		}
	}
	if (tmp==lo[0]) return ''
	else return tmp+lo[3]
}

function getActiveItem(a) {
	var ac=a.activeCandidates,o=a.items,vc,i,ax, tp

	if (ac.length==2 && pageName.indexOf('kce')==-1) return ac[1]
	if (ac.length==1) return ac[0]
	if (ac.length==0 && a.refer!=null) return a.refer
	if (a.refer==null) return ac[0]
	vc=o[a.refer];i=0

	while (vc && i<20) {
		id=vc.attributes[2];par=vc.attributes[3];vc.active=true;i++
		if (par>'') {
			vc=o[par]
			if (vc!=null) vc.activeItem=id;
		}
		else vc=null
	}



	ax=a.getTree(null,null,new Array('::$LINK||$ID\n::$LINK||$ID\n$CHILDREN::'))
	vc=o[a.refer];i=0
	while (vc && i<20) {
		id=vc.attributes[2];par=vc.attributes[3];vc.active=false;i++
		if (par>'') {
			vc=o[par]
			if (vc!=null) vc.activeItem=null
		}
		else vc=null
	}
	var ax1=(ax.indexOf(sitePath+pageName+"||"))?ax.substr(ax.lastIndexOf(sitePath+pageName+"||")):ax
	tp=gss(ax1, sitePath+pageName+'||', '\n')
	return (tp=='')?a.refer:tp
}

function needsChildren(def, parent, o) {
	if (def.indexOf('expand=all')>-1) return true
	if (parent.activeItem && parent.activeItem==o.attributes[2]) return true
	return false
}

function getItemHTML(o, gui, curLevel, a, b) {
	var tmp='', lo=((curLevel<gui.length)?gui[curLevel]:gui[gui.length-1]).split('::'), loi
	if (o.active) {
		if (o.activeItem && a.items[o.activeItem].attributes[9]=='1') loi=lo[1]
		else loi=lo[2]
	}
	else loi=lo[1]
	if (o.attributes[4]=='') return ''
	if (o.attributes[5]=='' && lo.length>3) loi=lo[4]
	return replaceValues(loi, o, b,curLevel)
}

function replaceValues(a, b, c,d) {
	var v=a, lnk=b.attributes[5], trg=b.attributes[6]
	ll=b.attributes[4]
	v=rs(v, "$LABEL", ll)
	rExp = /\'/gi;
	ll = ll.replace(rExp, "")
	v=rs(v, "$DIV", ll)


	newlnk=((lnk.indexOf('http://')==0 || lnk.toLowerCase().indexOf('javascript')==0)?'':sitePath)+lnk
	opt=b.attributes[10]
	if (opt.indexOf("popup=")==0)
	{
		newlnk=lnk;
		G_day = new Date();
 		G_seed = G_day.getTime();
 		iRand = parseInt(((G_seed - (parseInt(G_seed/1000,10) * 1000))/10)/100*100000 + 1,10);
		max=(opt.indexOf(";;;")>0)?opt.indexOf(";;;"):opt.length;
		opt=opt.substr(6,max-6)
		var o=opt.split(',');
		w=(o[0]!=null)?o[0]:200;
		h=(o[1]!=null)?o[1]:200;
		n=(o[2]!=null)?o[2]:iRand;
		s=(o[3]!=null)?o[3]:'yes';
 		winleft = (screen.width - w) / 2;
 		winUp = (screen.height - h) / 2;
		t=(o[4]!=null)?o[4]:winUp;
		l=(o[5]!=null)?o[5]:winleft;
		newlnk="javascript:window.open(\'"+newlnk+"\',\'"+n+"\',\'scrollbars="+s+",width="+w+",height="+h+",left="+l+",top="+t+"\');void null;";

	}
	v=rs(v, "$LINK", newlnk)
	v=rs(v, "$TARGET", (trg=='')?'':' target="'+trg+'"')
	v=rs(v, "$ID", b.attributes[2])

	if (opt.indexOf("visible=N")!=-1) v='';
	return v
}

function getPath(a) {if (sitePath!='/') {return grs((a+'').toLowerCase(), sitePath)} else {return grs((a+'').toLowerCase(), location.host+sitePath)}}
function lds(a) {allText+=a+'\n'}
function ds(a) {document.writeln(a)}
function rs(a, b, c) {return (a!=null && a!="")?a.split(b).join(c):''}
function grs(a,b) {var o=a.split(b);if(o.length>1) return o[1]; else return ''}


function gss(a,b,c) {var o=a.split(b);if (o.length>1) return (o[1]+c).split(c)[0];else return ''}


function showBottomnav()
{
	if (checkJsMenu())
	{
		// BOTTOM NAV

		var v, o, i, j, k, navclass, subnavclass, pclass, carMenu, subcarMenu, mainMenu, counter, showLink;
		v = "";
		var showLink = 1;
		counter = 0;

		o=jsMenu;
		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|')
			if (oo[0]=='0' && oo[10].indexOf("bottomnav=Y")!=-1)
			{
				showLink = 1;
				counter = counter + 1;

				if (oo[5].indexOf('javascript')!=-1 || oo[5].indexOf('#top')!=-1) {thepath=oo[5];}else{thepath=sitePath+oo[5]};
				if (strHREF.indexOf(oo[5].replace("index.asp",""))<0){navclass=""}else{navclass="activenav"}

				pclass="bottomnav";

				k = strHREF.split('/');
				j = k[0] + "/" + k[1] + "/" + k[2];
				k = strHREF.replace(j, "");

				if (counter == 1)
				{
					if (((strHREF == j) || (strHREF == (j + "/")) || (strHREF == (j + "/index.asp"))) && ((oo[5] == "/") || (oo[5] == "/index.asp")))
					{
						showLink = 0;
					}
					if ((oo[5] == "/") || (oo[5] == "/index.asp"))
					{
						navclass = "";
					}
				}

				// ###################
				// START OF LINK CODE
				// ###################

				if (showLink == 1)
				{
					v+='<p class="' + pclass + '"><a href="'+thepath+'" class="' + navclass + '"'
					if (oo[11] == "1")
					{
						v+=' target="_blank"';
					}
					v+='>'+oo[4]+'</a></p>'
				}

				// ###################
				// END OF LINK CODE
				// ###################

				// ###################
				// START OF CHILD LINKS CODE (Bottom menu) 17/03/2005 - James Ward
				// ###################

				if (strHREF.indexOf(oo[5].replace("index.asp",""))!=-1)
				{
					mainMenu = "";
					for (k=0; k<o.length; k++)
					{
						qq=o[k].split('|')
						if (qq[3]==parseInt(oo[2]) && qq[10].indexOf("subshowroom=Y")<0)
						{
							mainMenu = parseInt(oo[2]);
						}
					}
				}
				else
				{
					mainMenu = "";
				}

				if (mainMenu !== "")
				{
					v+='<p class="subnav" align="left" style="margin-top: 2px">'
					for (k=0; k<o.length; k++)
					{
						qq=o[k].split('|')
						if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
						if (strHREF.indexOf(qq[5].replace("index.asp",""))<0){subnavclass=""}else{subnavclass="activesubnav"}


						if (qq[3]==mainMenu && qq[10].indexOf("subshowroom=Y")<0)
						{
							v+='<a href="'+thepath+'" class="' + subnavclass + '"'
							if (qq[11] == "1")
							{
								v+=' target="_blank"';
							}
							v+='>'+qq[4]+'</a><br />'
						}
					}
					v+='</p>'
				}

				// ###################
				// END OF CHILD LINKS CODE (Bottom menu)
				// ###################
			}
		}
	}
	ds(v);
}

function showTopnav()
{
	if (checkJsMenu())
	{
		var v, o, i, j, k, m, strReplace, navclass, subnavclass, pclass, carMenu, subcarMenu, mainMenu, counter;
		v = "";
		o=jsMenu;

		// TOP NAV

		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|')

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

			if (oo[10].toLowerCase().indexOf("visible=n")==-1)
			{

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	  		if (oo[0]=='0' && oo[10].indexOf("bottomnav=Y")==-1  && oo[10].indexOf("insitemap=N")==-1 && oo[10].indexOf("toolsnav=Y")==-1 && oo[10].indexOf("modelnav=Y")==-1 || oo[10].toLowerCase().indexOf("showroom")!=-1)
			//if (oo[0]=='0' && oo[10].indexOf("showroom=Y")!=-1)
			{
				if (oo[5].indexOf('javascript')!=-1 || oo[5].indexOf('#top')!=-1) {thepath=oo[5];}else{thepath=sitePath+oo[5];
				if (strHREF.indexOf(oo[5].replace("index.asp",""))<0){navclass=""}else{navclass="activenav"}

				// ###################
				// START OF LINK CODE
				// ###################

				if (oo[0]=="0")
				{
					v+='<p class="nav" align="left" ><a href="'+thepath+'" class="' + navclass + '"'
					if (oo[11] == "1")
					{
						v+=' target="_blank"';
					}
					v+='>'+oo[4]+'</a></p>'
				}

				// ###################
				// END OF LINK CODE
				// ###################

				// ###################
				// START OF CHILD LINKS CODE (Showroom)
				// ###################

				if (oo[10].indexOf("showroom=Y")!=-1)
				{
					// ###################
					// Horizontal links for showroom cars
					// ###################

					carMenu = "";
					hasSubChapters = 0;

					v+='<p class="nav" align="left">'
					for (j=0; j<o.length; j++)
					{
						pp=o[j].split('|')
						if (pp[5].indexOf('javascript')!=-1 || pp[5].indexOf('#top')!=-1) {thepath=pp[5];}else{thepath=sitePath+pp[5]};
						if (strHREF.indexOf(pp[5].replace("index.asp",""))<0){navclass=""}else{navclass="activenav"}

						if (pp[3]==0)
						{
							v+='<a href="'+thepath+'" class="' + navclass + '"'
							if (pp[11] == "1")
							{
								v+=' target="_blank"';
							}
							v+='>'+pp[4]+'</a>&nbsp;&nbsp;'

							if (strHREF.indexOf(pp[5].replace("index.asp",""))!=-1)
							{
								carMenu = pp[2];

								if ((pp[10].toLowerCase().indexOf('hassubchapters=y') !== -1) || (pp[4] == 'RX'))
								{
									hasSubChapters = 1;
								}
							}
						}
					}
					v+='</p>'

					// ###################
					// Child showroom models
					// ###################

					subcarMenu = "";
					counter = 0;

					v+='<p class="subnav" align="left">'
					for (j=0; j<o.length; j++)
					{
						pp=o[j].split('|')
						if (pp[5].indexOf('javascript')!=-1 || pp[5].indexOf('#top')!=-1) {thepath=pp[5];}else{thepath=sitePath+pp[5]};
						if (strHREF.indexOf(pp[5].replace("index.asp",""))<0){navclass=""}else{navclass="activenav"}

						if ((hasSubChapters == 1) && (pp[3] == carMenu))
						{
							counter = counter + 1;

							v+='<p class="nav" align="left">'
							v+='<a href="'+thepath+'" class="' + navclass + '"'
							if (pp[11] == "1")
							{
								v+=' target="_blank"';
							}
							v+='>'+pp[4]+'</a><br />'
							v+='</p>'

							if (strHREF.indexOf(pp[5].replace("index.asp",""))!=-1)
							{
								subcarMenu = parseInt(pp[2]);
							}
							else
							{
								subcarMenu = "";
							}

							// ###################
							// Child links for sub models
							// ###################

							if (subcarMenu !== "")
							{
								v+='<p class="subnav" align="left">'

								for (k=0; k<o.length; k++)
								{
									qq=o[k].split('|')

									m = qq[5].split('/');
									strReplace = m[m.length-1]
									if (strReplace == "")
									{
										strReplace = "index.asp";
									}
//									if (qq[4] == "Gallery")
//									{
//										strReplace = m[m.length-2] + "/" + strReplace;
//									}

									if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
									if (strHREF.indexOf(qq[5].replace(strReplace,""))<0){subnavclass=""}else{subnavclass="activesubnav"}

									if (qq[3]==subcarMenu)
									{
										v+='<a href="'+thepath+'" class="' + subnavclass + '"'
										if (qq[10].indexOf("techexplorer=Y")!=-1)
										{
											v+=' onClick="pop(this.href); return(false)"'
										}
										if (qq[11] == "1")
										{
											v+=' target="_blank"';
										}
										v+='>'+qq[4]+'</a><br />'
									}
								}
								v+='</p>'
							}

							// ###################
							// End of child links for sub models
							// ###################
						}
					}
					v+='</p>'

					// ###################
					// Child links for cars if no sub models
					// ###################

					if (counter == 0)
					{
						v+='<p class="subnav" align="left">'
						for (k=0; k<o.length; k++)
						{
							qq=o[k].split('|')

							m = qq[5].split('/');
							strReplace = m[m.length-1]
							if (strReplace == "")
							{
								strReplace = "index.asp";
							}
//							if (qq[4] == "Gallery")
//							{
//								strReplace = m[m.length-2] + "/" + strReplace;
//							}

							if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
							if (strHREF.indexOf(qq[5].replace(strReplace,""))<0){subnavclass=""}else{subnavclass="activesubnav"}

							if (qq[3]==carMenu)
							{
								v+='<a href="'+thepath+'" class="' + subnavclass + '"'
								if (qq[10].indexOf("techexplorer")!=-1)
								{
									v+=' onClick="pop(this.href); return(false)"'
								}
								if (qq[11] == "1")
								{
									v+=' target="_blank"';
								}
								v+='>'+qq[4]+'</a><br />'
							}
						}
						v+='</p>'
					}

					// ###################
					// END OF CHILD LINKS CODE (Showroom)
					// ###################
				}

				if (oo[3]=="ROOT" && oo[10].indexOf("showroom=Y")<0)
				{
					// ###################
					// START OF CHILD LINKS CODE (Main menu)
					// ###################

					if (strHREF.indexOf(oo[5].replace("index.asp",""))!=-1)
					{
						mainMenu = parseInt(oo[2]);
					}
					else
					{
						mainMenu = "";
					}

					if (mainMenu !== "")
					{
						v+='<p class="subnav" align="left">'
						for (k=0; k<o.length; k++)
						{
							qq=o[k].split('|')
							if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
							if (strHREF.indexOf(qq[5].replace("index.asp",""))<0){subnavclass=""}else{subnavclass="activesubnav"}

							if (qq[3]==mainMenu && qq[10].indexOf("subshowroom=Y")<0 && qq[10].indexOf("hidefrommenu=Y")<0)
							{
								v+='<a href="'+thepath+'" class="' + subnavclass + '"'
								if (qq[11] == "1")
								{
									v+=' target="_blank"';
								}
								v+='>'+qq[4]+'</a><br />'
							}
						}
						v+='</p>'
					}

					// ###################
					// END OF CHILD LINKS CODE (Main menu)
					// ###################
				}
			}
		}

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
			}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

	}

	//v+='</table>';
	ds(v);
	}
}

function showModelnav()
{

	if (checkJsMenu())
	{
	var v, o, i,mw;
	mw=90;
	tmc=gss(menuAttributes, 'tmc=',';;;');
	if (tmc!='') mw=50;
	//pageName=getPath(location.href)

	v='<table border="0" cellspacing="0" cellpadding="0" width="610" class="modelbar">'
	v+='<tr>'
	v+='<th width="16" height="1"><img src="/images/spacer.gif" width="16" height="1" alt="" border="0" /></th>'
	v+='<th width="30"><img src="/images/spacer.gif" width="30" height="1" alt="" border="0" /></th>'
	v+='<th width="'+mw+'"><img src="/images/spacer.gif" width="'+mw+'" height="1" alt="" border="0" /></th>'
	v+='<th width="30"><img src="/images/spacer.gif" width="30" height="1" alt="" border="0" /></th>'
	v+='<th width="'+mw+'"><img src="/images/spacer.gif" width="'+mw+'" height="1" alt="" border="0" /></th>'
	v+='<th width="30"><img src="/images/spacer.gif" width="30" height="1" alt="" border="0" /></th>'
	v+='<th width="'+mw+'"><img src="/images/spacer.gif" width="'+mw+'" height="1" alt="" border="0" /></th>'
	v+='<th width="30"><img src="/images/spacer.gif" width="30" height="1" alt="" border="0" /></th>'
	v+='<th width="'+mw+'"><img src="/images/spacer.gif" width="'+mw+'" height="1" alt="" border="0" /></th>'
	v+='<th width="30"><img src="/images/spacer.gif" width="30" height="1" alt="" border="0" /></th>'

	if (tmc!='')
	{
		v+='<th width="'+mw+'"><img src="/images/spacer.gif" width="'+mw+'" height="1" alt="" border="0" /></th>'
		v+='<th width="30"><img src="/images/spacer.gif" width="30" height="1" alt="" border="0" /></th>'
		v+='<th width="'+mw+'"><img src="/images/spacer.gif" width="'+mw+'" height="1" alt="" border="0" /></th>'
		v+='<th width="30"><img src="/images/spacer.gif" width="30" height="1" alt="" border="0" /></th>'

	}
	if (tmc!='')
	{v+='<th width="34"><img src="/images/spacer.gif" width="34" height="1" alt="" border="0" /></th>'}
	else
	{v+='<th width="84"><img src="/images/spacer.gif" width="84" height="1" alt="" border="0" /></th>'}
	v+='</tr>'

	v+='<tr>'
	v+='<td height="16"><img src="/images/spacer.gif" width="1" height="16" alt="" border="0" /></td>'

	o=jsMenu;
	for (i=0; i<o.length; i++) {
		oo=o[i].split('|')
		if (oo[0]=='1' && oo[10].indexOf("modelnav=Y")!=-1)
		{
		 fold=pageName.substr(0,pageName.indexOf('/'))
		 if ('/'+fold+'/index.asp'==sitePath+oo[5])
		 {v+='<td class="navmodels">'+oo[4]+'</td>'}
		 else

		 {v+='<td class="navmodels"><a href="'+sitePath+oo[5]+'" onfocus="this.blur();" id="N'+i+'">'+oo[4]+'</a></td>';}
		v+='<td><img src="/images/spacer.gif" width="1" height="1" alt="" border="0" /></td>'
		}
	}
	v+='</tr></table>';
	onHomePage=(pageName=='' || pageName=='index.asp')?true:false;
	if (onHomePage)
	{
			mw=110;
			mh=50;
			if (tmc!='') {mw=77;mh=35;}
			navwidth=149;
			v+='<table border="0" cellspacing="0" cellpadding="0" class="modelbar" width="100%">'
			v+='	<tr>'

			for (i=0; i<o.length; i++) {
				oo=o[i].split('|')
				if (oo[0]=='1' && oo[10].indexOf("modelnav=Y")!=-1)
				{
					fold=oo[5].substr(0,oo[5].indexOf('/'))
					v+='<td width="10" height="'+mh+'"><img src="/images/spacer.gif" width="10" height="1" alt="" border="0" /></td>'
					v+='<td width="'+mw+'"><a href="'+sitePath+oo[5]+'" onmouseover="ModelOver(\'N'+i+'\');" onmouseout="ModelOut(\'N'+i+'\');" onfocus="this.blur();"><img src="'+oo[13]+'" width="'+mw+'" height="'+mh+'" alt="" border="0" /></a></td>'

				}
			}

			v+='	</tr>'
			v+='</table>'

	}
	ds(v);

	}
}

function showToolsnav()
{
	var v, o, i, j, k, navclass, subnavclass, pclass, carMenu, subcarMenu, mainMenu, counter, showLink;
	v = "";

	if (checkJsMenu())
	{
		// TOOLS  NAV

		var counter = 0;
		var showLink = 1;
		var hidLink = 0;

		o=jsMenu;
		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|')
			if (oo[0]=='0' && oo[10].indexOf("toolsnav=Y")!=-1)
			{
				showLink = 1;
				counter = counter + 1;

				if (oo[5].indexOf('javascript')!=-1 || oo[5].indexOf('#top')!=-1) {thepath=oo[5];}else{thepath=sitePath+oo[5]};
				if (strHREF.indexOf(oo[5].replace("index.asp",""))<0){navclass=""}else{navclass="activenav"}

				pclass="midnav";

				k = strHREF.split('/');
				j = k[0] + "/" + k[1] + "/" + k[2];
				k = strHREF.replace(j, "");

				if (counter == 1)
				{
					if (((strHREF == j) || (strHREF == (j + "/")) || (strHREF == (j + "/index.asp"))) && ((oo[5] == "/") || (oo[5] == "/index.asp")))
					{
						showLink = 0;
					}
					if ((oo[5] == "/") || (oo[5] == "/index.asp"))
					{
						navclass = "";
					}
				}

				// ###################
				// START OF LINK CODE
				// ###################

				if (showLink == 1)
				{
					v+='<p class="' + pclass + '"><a href="'+thepath+'" class="' + navclass + '"'
					if (oo[11] == "1")
					{
						v+=' target="_blank"';
					}
					v+='>'+oo[4]+'</a></p>'

				}

				// ###################
				// END OF LINK CODE
				// ###################

				// ###################
				// START OF CHILD LINKS CODE (Tools menu) 17/03/2005 - James Ward
				// ###################


				if (strHREF.indexOf(oo[5].replace("index.asp",""))!=-1 && counter > 0)
				{
					mainMenu = "";
					for (k=0; k<o.length; k++)
					{
						qq=o[k].split('|')
						if (qq[3]==parseInt(oo[2]) && qq[10].indexOf("subshowroom=Y")<0)
						{
							mainMenu = parseInt(oo[2]);
						}
					}
				}
				else
				{
					mainMenu = "";
				}

				if (mainMenu !== "")
				{
					v+='<p class="subnav" align="left" style="margin-top: 2px">'
					for (k=0; k<o.length; k++)
					{
						qq=o[k].split('|')
						if (qq[5].indexOf('javascript')!=-1 || qq[5].indexOf('#top')!=-1) {thepath=qq[5];}else{thepath=sitePath+qq[5]};
						if (strHREF.indexOf(qq[5].replace("index.asp",""))<0){subnavclass=""}else{subnavclass="activesubnav"}

						if (qq[3]==mainMenu && qq[10].indexOf("subshowroom=Y")<0)
						{
							v+='<a href="'+thepath+'" class="' + subnavclass + '"'
							if (qq[11] == "1")
							{
								v+=' target="_blank"';
							}
							v+='>'+qq[4]+'</a><br />'
						}
					}
					v+='</p>'
				}

				// ###################
				// END OF CHILD LINKS CODE (Tools menu)
				// ###################
			}
		}
	}

	ds(v);
}

function showGlobalnav(mapDepth)
{
	if (checkJsMenu())
	{
		var v, o, i, k, depth;

		// This is determine how deep the site map goes.
		if (parseInt(mapDepth))
		{
			depth = mapDepth

			if (mapDepth !== 0)
			{
				depth = depth - 1;
			}
		}
		else
		{
			depth = 3;
		}

		v = "";
		o=jsMenu;
		counter = 0;

		k = strHREF.split("/");
		sitePath = k[0] + "//" + k[2];
		pageName = k[k.length - 1];

		function write_globalnav_children(parentID, parentName, parentURL, nodeLevel, attributes, thePopup)
		{
			var iii, oooo, insert, paddingLevel;

			paddingLevel = nodeLevel * 5
			if (nodeLevel == 1)
			{
				paddingLevel = 0;
			}

			if (nodeLevel == 0)
			{
				if (attributes.indexOf("hidefrommenu=Y") < 0 && attributes.indexOf("visible=N") < 0)
				{
					ds('<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom: 9px">');
					ds('<tr><td height="1" bgcolor="#CECECE"></td></tr>');
					ds('<tr><td height="5"></td></tr>');
					ds('<tr><td><a href="' + parentURL + '"');
					if (thePopup == "1")
					{
						ds(' target="_new"');
					}
					ds('>' + parentName + '</a></td></tr>');
					ds('</table>');
				}
			}
			else
			{
				if (attributes.indexOf("hidefrommenu=Y") < 0 && attributes.indexOf("visible=N") < 0)
				{
					ds('<p style="padding-left: ' + (paddingLevel) + 'px; margin: 0px"><a href="' + parentURL + '"');
					if (attributes.indexOf("techexplorer=Y")!=-1)
					{
						ds(' onClick="pop(this.href); return(false)"');
					}
					if (thePopup == "1")
					{
						ds(' target="_new"');
					}
					ds('>' + parentName + '</a></p>');
				}
			}

			if (nodeLevel < depth)
			{
				for (iii=0; iii<o.length; iii++)
				{
					oooo=o[iii].split("|");
					if (oooo[3] == parentID)
					{
						write_globalnav_children(oooo[2], oooo[4], oooo[5], nodeLevel + 1, oooo[10], oooo[11]);
					}
				}
			}
		}

		function write_globalnav_structure(parentID)
		{
			ds('<table width="450" cellpadding="0" cellspacing="0" border="0">');

			for (j=0; j<o.length; j++)
			{
				pp=o[j].split("|");
				if (pp[3] == parentID && pp[10].indexOf("bottomnav=Y")==-1 && pp[10].indexOf("toolsnav=Y")==-1 && pp[10].indexOf("visible=N")==-1)
				{
					// Start a loop to write all the 2nd level links

					if (pp[10].indexOf("showroom=Y")!=-1)
					{
						ds('<tr><td colspan="5" height="1" bgcolor="#CECECE"></td></tr>');
						ds('<tr><td colspan="6" valign="top"><p style="margin-top: 5px; margin-bottom: 12px"><a href="' + pp[5] + '">' + pp[4] + '</a></p></td></tr>');

						for (i=0; i<o.length; i++)
						{
							oo=o[i].split("|");


							if (oo[3] == pp[2])
							{
								if (oo[4] == "RX")
								{
									counter2 = 0;

									for (ii=0; ii<o.length; ii++)
									{
										counter2 = 1;
										ooo=o[ii].split("|");
										if (ooo[3] == oo[2])
										{
											counter = counter + 1;
											if (counter == 1){ds('<tr>');}

											ds('<td width="141" valign="top">');
											write_globalnav_children(ooo[2], ooo[4], ooo[5], 0, ooo[10], ooo[11]);
											ds('</td><td width="9"></td>');

											if (counter == 3)
											{
												ds('</tr><tr><td height="10"></td></tr>');
												counter = 0;
											}
										}
									}
								}
								else
								{
									counter = counter + 1;
									if (counter == 1){ds('<tr>');}

									ds('<td width="141" valign="top">');
									write_globalnav_children(oo[2], oo[4], oo[5], 0, oo[10], oo[11]);
									ds('</td><td width="9"></td>');

									if (counter == 3)
									{
										ds('</tr><tr><td height="10"></td></tr>');
										counter = 0;
									}
								}
							}
						}
					}
					else
					{
						counter = counter + 1;
						if (counter == 1){ds('<tr>');}

						ds('<td width="141" valign="top">');
						write_globalnav_children(pp[2], pp[4], pp[5], 0, pp[10], pp[11]);
						ds('</td><td width="9"></td>');

						if (counter == 3)
						{
							ds('</tr><tr><td height="10"></td></tr>');
							counter = 0;
						}
					}
				}
			}

			ds('</table>');
		}

		write_globalnav_structure("ROOT");
	}
}

function showSubnav(theInactiveIcon, theActiveIcon, translation)
{
	var v, o, i, j, k, m, tiggerA, triggerB, varHREF, strReplace, subfod, navclass, subnavclass, pclass, carMenu, subcarMenu, attributes, mainMenu, counter, theIcon, parentID, parentID2, parentLevel, childID, objID, objState, spareID, theIcon, parentName, parentName2, archiveArray, aa, counterZ;
	v = "";
	triggerA = 0;
	o=jsMenu;
	navclass = "";

	if (checkJsMenu())
	{
		// This is the start of the function.
		function showSubSubnav(parentID, parentName, spareID, attributes)
		{
			parentName2 = parentName;

			function checkParent(theParentID, theCounter, spareID, attributes)
			{
				if (theCounter == "0" && attributes.indexOf("showfourthlevel=Y")<0 && attributes.indexOf("showthirdlevelnav=Y")<0)
				{
					for (i=0; i<o.length; i++)
					{
						oo=o[i].split('|');
						if (oo[3] == spareID)
						{ 
							return(oo[3]);
						}
					}
				}

				if (attributes.indexOf("showthirdlevelnav=Y")!=-1)
				{
					for (i=0; i<o.length; i++)
					{
						oo=o[i].split('|');
						if (oo[2] == theParentID)
						{
							varHREF = oo[5]
							triggerA = 1;
							return(oo[3]);
						}
					}
				}

				for (i=0; i<o.length; i++)
				{
					oo=o[i].split('|');
					if (oo[3] == theParentID)
					{
						return(oo[3]);
					}
				}

				for (i=0; i<o.length; i++)
				{
					oo=o[i].split('|');
					if (parseInt(oo[2]) == theParentID)
					{
						return(checkParent(oo[3], theCounter + 1));
					}
				}
				return(false);
			}

			parentID2 = checkParent(parentID, 0, spareID, attributes);

			v+='<TABLE width="100%" cellpadding="0" cellspacing="0" border="0" class="infobox">';

			for (i=0; i<o.length; i++)
			{
				oo=o[i].split('|');
				if (parseInt(oo[3]) == parentID2)
				{
					m = oo[5].split('/');
					strReplace = m[m.length-1]
					if (strReplace == "")
					{
						strReplace = "index.asp";
					}

					triggerB = strHREF.indexOf(oo[5]);

					if (triggerA == 1 && varHREF.indexOf(oo[5])!=-1)
					{
						triggerB = strHREF.indexOf(oo[5].replace(strReplace,""));
						triggerA = 0;
					}

					if (triggerB<0)
					{
						theIcon = theInactiveIcon;
						subnavclass = "subnav";

						v+='<TR>';
						v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"><img src="' + theInactiveIcon +'" alt="" /></TD>';
						v+='<TD valign="top" style="padding: 2px" class="rightnav"><a href="' + oo[5] + '"'
						if (oo[11] == "1")
						{
							v+=' target="_blank"';
						}
						v+='>' + oo[4] + '</a></TD>';
						v+='</TR>';
					}
					else
					{
						theIcon = theActiveIcon;
						subnavclass = "activesubnav";

						v+='<TR>';
						v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"><img src="' + theActiveIcon +'" alt="" /></TD>';
						v+='<TD valign="top" style="padding: 2px" class="rightnav">'
						if (triggerA == 1)
						{
							v+='<a href="' + oo[5] + '" class="activenav"'
							if (oo[11] == "1")
							{
								v+=' target="_blank"';
							}
							v+='>';
						}
						v+=oo[4];
						if (triggerA == 1)
						{
							v+='</a>';
						}
						v+='</TD>';
						v+='</TR>';

						if (oo[10].indexOf("showfourthlevel=Y")!=-1)
						{
							for (j=0; j<o.length;j++)
							{
								pp=o[j].split('|');

								if (parseInt(oo[2]) == parseInt(pp[3]))
								{
									if (counter == 0)
									{
										v+='<TR>';
										v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"></TD>';
										v+='<TD valign="top" style="padding: 2px" class="rightnav">';
										v+='<TABLE width="100%" cellpadding="0" cellspacing="0" border="0" class="' + objState + '" id="submenu' + oo[2] + '">';
									}

									if (strHREF.indexOf(pp[5].replace("index.asp",""))<0){subnavclass="subnav";theIcon=theInactiveIcon}else{subnavclass="activesubnav";theIcon=theActiveIcon}

									v+='<TR>';
									v+='<TD width="1%" valign="top" style="padding: 2px; padding-top: 4px"><img src="' + theIcon +'" alt="" /></TD>';
									v+='<TD valign="top" style="padding: 0px" class="rightnav"><a href="' + pp[5] + '" class="' + subnavclass + '"'
									if (pp[11] == "1")
									{
										v+=' target="_blank"';
									}
									v+='>' + pp[4] + '</a></TD>';
									v+='</TR>';

									counter = 1;
								}
							}
						}
					}
				}
			}

			v+='</TABLE>';

			v+='<TABLE cellpadding="0" cellspacing="0" border="0">';
			v+='<TR><TD height="9"></TD></TR>';
			v+='</TABLE>';
		}
		// The bracket above is the closing tag of the function.

		// ###################
		// This checks what page we're on in the array
		// ###################

		counter = 1
		attributes = ""

		k = strHREF.split("/");

		o=jsMenu;
		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|');
			if (strHREF.indexOf(oo[5].replace("index.asp",""))!=-1)
			{
				parentID = oo[3];
				spareID = oo[2];
				parentLevel = oo[0];
				parentName = oo[4];
				attributes = oo[10];
			}
		}


		showSubSubnav(parentID, parentName, spareID, attributes);

		ds(v);

		// ###################
		// End of page check
		// ###################
	}
}

function showMedianav(theInactiveIcon, theActiveIcon)
{
	var v, o, i, j, k, m, strReplace, subfod, navclass, subnavclass, pclass, carMenu, subcarMenu, mainMenu, counter, theIcon, parentID, parentLevel, childID, objID, objState, theIcon;
	v = "";
	o=jsMenu;
	navclass = "";

	if (checkJsMenu())
	{
		// This is the start of the function.
		function showMediaSubnav(parentID)
		{

			var counter = 0;
			for (i=0; i<o.length; i++)
			{
				oo=o[i].split('|');
				if (parseInt(oo[2]) == parentID && counter == 0)
				{
					parentID = oo[3];
					counter = 1;
				}

			}

			v+='<TABLE width="141" cellpadding="0" cellspacing="0" border="0" class="infobox">';
			for (i=0; i<o.length; i++)
			{
				oo=o[i].split('|');
				if (parseInt(oo[3]) == parentID)
				{
					m = oo[5].split('/');
					strReplace = m[m.length-1]
					if (strReplace == "")
					{
						strReplace = "index.asp";
					}

					if (strHREF.indexOf(oo[5].replace(strReplace,""))<0)
					{
						theIcon = theInactiveIcon;
						navclass = "";
						objState = "subnav_hidden";
					}
					else
					{
						theIcon = theActiveIcon;
						navclass = "activenav";
						objState = "";
					}

					v+='<TR>';
					v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"><img src="' + theIcon +'" alt="" /></TD>';
					v+='<TD valign="top" style="padding: 2px" class="rightnav"><a href="javascript:simpletoggle(\'submenu' + oo[2] + '\')" class="' + navclass + '"'
					if (oo[11] == "1")
					{
						v+=' target="_blank"';
					}
					v+='>' + oo[4] + '</a></TD>';
					v+='</TR>';

					// This code below writes out the sub-links for each menu item.

					counter = 0

					for (j=0; j<o.length;j++)
					{
						pp=o[j].split('|');

						if (parseInt(oo[2]) == parseInt(pp[3]))
						{
							if (counter == 0)
							{
								v+='<TR>';
								v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"></TD>';
								v+='<TD valign="top" style="padding: 2px" class="rightnav">';
								v+='<TABLE cellpadding="0" cellspacing="0" border="0" class="' + objState + '" id="submenu' + oo[2] + '"><TR><TD>';
							}

							if (strHREF.indexOf(pp[5].replace("index.asp",""))<0){subnavclass="subnav";}else{subnavclass="activesubnav"}

							v+='<a href="' + pp[5] + '" class="' + subnavclass + '"'
							if (pp[11] == "1")
							{
								v+=' target="_blank"';

							}
							v+='>' + pp[4] + '</a><br />';
							counter = 1;
						}
					}

					if (counter > 0)
					{
						v+='</TD></TR></TABLE>';
						v+='</TD>';
						v+='</TR>';
					}
				}
			}

			v+='</TABLE>';
		}
		// The bracket above is the closing tag of the function.

		// ###################
		// This checks what page we're on in the array
		// ###################

		counter = -1

		o=jsMenu;
		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|');

			if (strHREF.indexOf(oo[5])!=-1)
			{
				if (parseInt(oo[0]) >= counter)
				{
					parentID = oo[3];
					parentLevel = oo[0];
					counter = oo[0];
				}
			}
		}

		showMediaSubnav(parentID);

		// ###################
		// End of page check
		// ###################
	}

	ds(v);
}

function showArchivenav(theInactiveIcon, theActiveIcon, translation, translation2)
{
	var v, o, i, j, k, m, strReplace, subfod, navclass, subnavclass, pclass, carMenu, subcarMenu, mainMenu, counter, theIcon, parentID, parentID2, parentLevel, childID, objID, objState, theIcon, parentName, parentName2, archiveArray, aa, counterZ, theTranslation, theTranslation2;
	v = "";
	o=jsMenu;
	navclass = "";

	theTranslation = translation;
	if (theTranslation.length == 0)
	{
		theTranslation = "Archive";
	}

	theTranslation2 = translation2;
	if (theTranslation2.length == 0)
	{
		theTranslation2 = "ARCHIVE";
	}

	if (checkJsMenu())
	{
		// This is the start of the function.
		function showArchiveSubnav(parentID, parentName)
		{
			parentName2 = parentName;

			function checkParent(theParentID)
			{
				for (i=0; i<o.length; i++)
				{
					oo=o[i].split('|');
					if ((oo[3] == theParentID && oo[4] == theTranslation) || (oo[2] == theParentID && oo[4] == theTranslation))
					{
						return(oo[2]);
					}
				}

				for (i=0; i<o.length; i++)
				{
					oo=o[i].split('|');
					if (parseInt(oo[2]) == theParentID)
					{
						if (oo[4] == theTranslation)
						{
							return(oo[2]);
						}
						else
						{
							return(checkParent(oo[3]));
						}
					}
				}
				return(false);
			}

			parentID2 = checkParent(parentID);

			aa = "";
			archiveArray = "";
			counterZ = 1;

			for (i=0; i<o.length; i++)
			{
				oo=o[i].split('|');
				if (parseInt(oo[3]) == parentID2)
				{
					aa = aa + "|" + oo[2];
					counterZ = counterZ + 1;
				}
			}

			if (counterZ !== 1)
			{
				v+='<TABLE width="150" cellpadding="0" cellspacing="0" border="0" class="infobox">';
				v+='<TR>';
				v+='<TD colspan="2" valign="top" style="padding: 3px"><p class="small">' + theTranslation2 + '</p></TD>';
				v+='</TR>';
			}

			for (i=0; i<o.length; i++)
			{
				oo=o[i].split('|');
				if (parseInt(oo[3]) == parentID2)
				{

					m = oo[5].split('/');
					strReplace = m[m.length-1]
					if (strReplace == "")
					{
						strReplace = "index.asp";
					}

					if (strHREF.indexOf(oo[5].replace(strReplace,""))<0)
					{
						theIcon = theInactiveIcon;
						navclass = "";
						objState = "subnav_hidden";
					}
					else
					{
						theIcon = theActiveIcon;
						navclass = "activenav";
						objState = "";
					}

					v+='<TR>';
					v+='<TD width="1%" valign="top" style="padding: 2px; padding-top: 4px"><img src="' + theIcon +'" alt="" /></TD>';
					v+='<TD valign="top" style="padding: 0px" class="rightnav"><a href="#" class="' + navclass + '" onClick="toggle(' + oo[2] + ', \'' + aa + '\', ' + counterZ + '); return(false)">' + oo[4].replace("[sup]","<sup>").replace("[/sup]","</sup>") + '</a></TD>';
					v+='</TR>';

					// This code below writes out the sub-links for each menu item.

					counter = 0

					for (j=0; j<o.length;j++)
					{
						pp=o[j].split('|');

						if (parseInt(oo[2]) == parseInt(pp[3]))
						{
							if (counter == 0)
							{
								v+='<TR>';
								v+='<TD width="1%" valign="top" style="padding: 3px; padding-top: 4px"></TD>';
								v+='<TD valign="top" style="padding: 2px" class="rightnav">';
								v+='<TABLE width="100%" cellpadding="0" cellspacing="0" border="0" class="' + objState + '" id="submenu' + oo[2] + '">';
							}

							if (strHREF.indexOf(pp[5])<0){subnavclass="subnav";theIcon = theInactiveIcon}else{subnavclass="activesubnav";theIcon = theActiveIcon}

							v+='<TR>';
							v+='<TD width="1%" valign="top" style="padding: 2px; padding-top: 4px"><img src="' + theIcon +'" alt="" /></TD>';
							v+='<TD valign="top" style="padding: 0px" class="rightnav"><a href="' + pp[5] + '" class="' + subnavclass + '"'
							if (pp[11] == "1")
							{
								v+=' target="_blank"';
							}
							v+='>' + pp[4].replace("[sup]","<sup>").replace("[/sup]","</sup>") + '</a></TD>';
							v+='</TR>';

							counter = 1;
						}
					}


					if (counter > 0)
					{
						v+='</TABLE>';
						v+='</TD>';
						v+='</TR>';
					}
				}
			}
			v+='</TABLE>';
		}
		// The bracket above is the closing tag of the function.

		// ###################
		// This checks what page we're on in the array
		// ###################

		counter = 1

		k = strHREF.split("/");

		o=jsMenu;
		for (i=0; i<o.length; i++)
		{
			oo=o[i].split('|');

			if (strHREF.replace(k[k.length-1],"index.asp").indexOf(oo[5])!=-1)
			{
				if (parseInt(oo[0]) >= counter)
				{
					parentID = oo[2];
					parentLevel = oo[0];
					parentName = oo[4];
					counter = oo[0];
				}
			}
		}

		showArchiveSubnav(parentID, parentName);

		ds(v);

		// ###################
		// End of page check
		// ###################
	}
}

function getActivePages(a) {
	var vc,par,tmp='|',i,o
	if (a==null) return ''
	if (a.activeItem==null) return ''
	o=a.items;vc=o[a.activeItem];i=0
	while (vc && i<20) {
		tmp+=vc.attributes[5]+'|';par=vc.attributes[3];i++
		if (par>'') vc=o[par]; else vc=null
	}
	return tmp
}

function pop(sLink)
{
	openpopup(sLink,790,555);
}
function openpopup(sLink,iWidth,iHeight,left,name)
{
 if (left==null) left=0;
 G_day = new Date();
 G_seed = G_day.getTime();
 iRand = parseInt(((G_seed - (parseInt(G_seed/1000,10) * 1000))/10)/100*100000 + 1,10);
 if (name!=null) iRand=name;
 winleft = ((screen.width - iWidth) / 2)-left;
 winUp = (screen.height - iHeight) / 2;

 window.open(sLink,"tech_explorer",'resizable=no,scrollbars=no,width='+iWidth+',height='+iHeight+',left='+winleft+',top='+winUp);
}

function openpopup2(sLink,iWidth,iHeight,left,name)
{
 if (left==null) left=0;
 G_day = new Date();
 G_seed = G_day.getTime();
 iRand = parseInt(((G_seed - (parseInt(G_seed/1000,10) * 1000))/10)/100*100000 + 1,10);
 if (name!=null) iRand=name;
 winleft = ((screen.width - iWidth) / 2)-left;
//  winUp = (screen.height - iHeight) / 2;
 winUp = 10;

 window.open(sLink,"spec_equip",'resizable=yes,scrollbars=yes,width='+iWidth+',height='+iHeight+',left='+winleft+',top='+winUp);
}

function openpop_resize(strLink, intWidth, intHeight, blnScrollbars, strName)
{
	blnScrollbars = blnScrollbars.toString().replace(0, "no");
	blnScrollbars = blnScrollbars.toString().replace(1, "yes");

	var intScreenWidth = screen.availWidth - 0;
	var intScreenHeight = screen.availHeight - 0;

	var intLeft = parseInt((intScreenWidth - intWidth) / 2);
	var intTop = parseInt((intScreenHeight - intHeight) / 2);

	if (intLeft < 0)
	{
		intWidth = intScreenWidth - 10;
		intLeft = 0;
		blnScrollbars = "yes";
	}

	if (intTop < 0)
	{
		intHeight = intScreenHeight - 30;
		intTop = 0;
		blnScrollbars = "yes";
	}

	window.open(strLink, strName,'resizable=no,scrollbars=' + blnScrollbars + ',width=' + intWidth + ',height=' + intHeight + ',left=' + intLeft + ',top=' + intTop);
}

function closeWindow()
{
	window.close();
}

function bookmarkPage() {
if (document.all) {window.external.AddFavorite(document.location.href,document.title);}
else {alert('Sorry, this feature is only supported in Internet Explorer')}
}

function printPage() {
if (document.all) {window.print();}
else {alert('Sorry, this feature is only supported in Internet Explorer')}
}

//if explorer (4.x)
if (document.all) {
	layerRef='document.all'
	styleRef='.style.'
}

//else if netscape (4.x)
else if (document.layers) {
	layerRef='document.layers'
	styleRef='.'
}

function showthumb(theLayer){
    var tmpDiv = document.tmpDiv.tmpDiv.value;
	if(document.getElementById)	  //gecko(NN6) + IE 5+
	{
		if (tmpDiv != "0")
		{
			var obj = document.getElementById(tmpDiv);
	        obj.style.visibility = "hidden"
		}
        var obj = document.getElementById(theLayer);
        obj.style.visibility = "visible"
	}
	else
	{


	if (tmpDiv != "0")
		{
		    eval(layerRef+'[tmpDiv]'+styleRef+'visibility="hidden"')
		}
	eval(layerRef+'[theLayer]'+styleRef+'visibility="visible"')
	eval(layerRef+'[theLayer]'+styleRef+'top="102"')
	}
	document.tmpDiv.tmpDiv.value = theLayer;

}
function switchlang(url) {
     var lpageName
     lpageName = location.href

     if(lpageName.indexOf('?') > 0) {
          lpageName = lpageName.substr(0,lpageName.indexOf('?'));
     }

  popupWin01 = window.open(url+'?pagename='+lpageName, "_new", 'width=400,height=300')
}
function ModelOver( strElement )
{
	if( ! document.layers )
	{
		var obj;
		if( document.all )
		{
			obj = document.all[strElement].style;
		}
		else
		{
			obj = document.getElementById( strElement );
			if( obj.style ) obj = obj.style;
		}
		obj.color = "#000000";
	}
}

function ModelOut( strElement)
{
	if( ! document.layers )
	{
		var obj;
		if( document.all )
		{
			obj = document.all[strElement].style;
		}
		else
		{
			obj = document.getElementById( strElement );
			if( obj.style ) obj = obj.style;
		}
		obj.color = "#938f66";
	}
}

function ShowBar( strElement )
{
	if( ! document.layers )
	{
		var obj;
		if( document.all )
		{
			obj = document.all[strElement].style;
			o=document.all[strElement]
		}
		else
		{
			obj = document.getElementById( strElement );
			if( obj.style ) obj = obj.style;
		}
		obj.backgroundColor = "#f6d3ab";
	}
}

function HideBar( strElement )
{
	if( ! document.layers )
	{
		var obj;
		if( document.all )
		{
			obj = document.all[strElement].style;
		}
		else
		{
			obj = document.getElementById( strElement );
			if( obj.style ) obj = obj.style;
		}
		obj.backgroundColor = "#ffffff";
	}
}
function checkJsMenu()
{
	if (window.jsMenu) return (true)
	else
	{
		ds('Menu not published');
	}
}

