/*******************************************************************************
FILE NAME    :navhighlighter.js
DEPENDENCIES :global.js
********************************************************************************
____________________________ API DOCUMENTATION BEGIN ___________________________
````````````````````````````````````````````````````````````````````````````````
Highlights global links, cbDiv in masthead, masthead links, and footer.

````````````````````````````````````````````````````````````````````````````````
_____________________________ API DOCUMENTATION END ____________________________
*******************************************************************************/

//------------------------------------------------------------------------------
// TOP NAV AND FOOTER CSS BEGIN
//------------------------------------------------------------------------------

//set constants
CURRENTHIGHLIGHT_TOPNAV = null; //top navigation
CURRENTHIGHLIGHT_FOOTER = null; //footer navigation

//FUNCTION-- swap class
function swapClass(theId, theClass) {
 var objId = document.getElementById(theId);
 objId.className = theClass;
}

//FUNCTION-- sets link highlight state 
function stickyLink(theObj, theClass, currentObj) {
 var currentHighlight = currentObj;
 if(currentObj != theObj)
 {
  theObj.className = theClass;
  currentObj = theObj;
 }
}

//------------------------------------------------------------------------------
// TOP NAV AND FOOTER CSS END
//------------------------------------------------------------------------------

if(homePage) 
{
 swapClass("cbDiv", "cbColor01");
 //swapClass('membLk', 'noLinkImg'); //set cursor to default when on home page
 stickyLink(document.getElementById('g_05'), 'gSelected', CURRENTHIGHLIGHT_TOPNAV);
}
else if(theURL.indexOf("about/")>0)
{
 swapClass("cbDiv", "cbColor01");
 setRollover("nav01", "../images/masthd/", "nav01b.gif");
 stickyLink(document.getElementById('g_10'), 'gSelected', CURRENTHIGHLIGHT_TOPNAV);
}
else if(theURL.indexOf("order/")>0)
{
 swapClass("cbDiv", "cbColor01");
 setRollover("nav04", "../images/masthd/", "nav04b.gif");
 stickyLink(document.getElementById('g_15'), 'gSelected', CURRENTHIGHLIGHT_TOPNAV);
}
else if(theURL.indexOf("contact/")>0)
{
 swapClass("cbDiv", "cbColor01");
 setRollover("nav05", "../images/masthd/", "nav05b.gif");
 stickyLink(document.getElementById('g_20'), 'gSelected', CURRENTHIGHLIGHT_TOPNAV);
}
else if(theURL.indexOf("sitemap/")>0)
{
 swapClass("cbDiv", "cbColor01");
 stickyLink(document.getElementById('g_25'), 'gSelected', CURRENTHIGHLIGHT_TOPNAV);
}
else if(theURL.indexOf("privacy/")>0)
{
 swapClass("cbDiv", "cbColor01");
 stickyLink(document.getElementById('g_30'), 'gSelected', CURRENTHIGHLIGHT_TOPNAV);
}
else if(theURL.indexOf("products/")>0)
{
 swapClass("cbDiv", "cbColor02");
 setRollover("nav02", "../images/masthd/", "nav02b.gif");
 
 if(theURL.indexOf("index.htm")>0) {stickyLink(document.getElementById('ft_05'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("440cstainless.htm")>0) {stickyLink(document.getElementById('ft_10'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("52100chrome.htm")>0) {stickyLink(document.getElementById('ft_15'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("302stainless.htm")>0) {stickyLink(document.getElementById('ft_20'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("316stainless.htm")>0) {stickyLink(document.getElementById('ft_25'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("tungstencarbide.htm")>0) {stickyLink(document.getElementById('ft_35'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("cda260brass.htm")>0) {stickyLink(document.getElementById('ft_30'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("othermaterials.htm")>0) {stickyLink(document.getElementById('ft_40'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
}

else if(theURL.indexOf("properties/")>0)
{
 swapClass("cbDiv", "cbColor03");
 setRollover("nav03", "../images/masthd/", "nav03b.gif");

 if(theURL.indexOf("index.htm")>0) {stickyLink(document.getElementById('ft_45'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("nembsizes.htm")>0) {stickyLink(document.getElementById('ft_50'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("gradestolerances.htm")>0) {stickyLink(document.getElementById('ft_55'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
 else if(theURL.indexOf("ambadefinitions.htm")>0) {stickyLink(document.getElementById('ft_60'), 'ftSelected', CURRENTHIGHLIGHT_FOOTER);}
}

//---END
