//global vars begin
var SB_NAV_STATE_SET = 0;
var SB_CURRENT_FLOAT = null;
var SB_CURRENT_ROLLOVER = "";
var SB_CURRENT_SECTION_ROLLOVER = null;
var SB_CURRENT_EXPAND_NAV  = null;
var SB_BROWSER = sb_getBrowserType();
var SB_FLOAT_TIMEOUT;
//global vars end


//alert(navigator.userAgent); 

//prototypes begin
sb_nodeObject.prototype.sb_add = function(sb_sectionObject) 
{
  this.nodeCollection[this.nodeCounter] = sb_sectionObject;
  this.nodeCounter ++;
}
//prototypes end



/*
------------------------------------------
Function name  -  sb_getBrowserType
Description - queries the user's SB_BROWSER and sets properties in an object 
        for a specific type of SB_BROWSER look at the objects properties
------------------------------------------  
*/
function sb_getBrowserType()
{
  var myAgent = navigator.userAgent;
  var isMac = myAgent.toString().toUpperCase().indexOf("MAC") != -1;
  var isNS = myAgent.toString().toUpperCase().indexOf("MOZILLA") != -1;
  var isNS7 = myAgent.toString().toUpperCase().indexOf("NETSCAPE/7") != -1;
  var isFF = myAgent.toString().toUpperCase().indexOf("FIREFOX") != -1;
  this.ie = document.all ? 1 : 0;
  this.ns4 = document.layers ? 1 : 0;
  this.dom = document.getElementById ? 1 : 0;
  this.iemac = ((ie) && (isMac)) ? 1 : 0;
  this.ns7 = ((!ie) && (isNS7)) ? 1 : 0;
  this.ns = ((!ie) && (isNS) && (!isNS7) && (!isFF)) ? 1 : 0;
  this.ff = ((!ie) && (isNS) && (!isNS7) && (isFF)) ? 1 : 0;
  return this;
}

/*------------------------------------------
Function name  -  sb_getNavRef
Description - looks up a div or layer in the document and returns a reference to it
------------------------------------------*/
function sb_getNavRef(nav)
{
  var navRef;
  if (SB_BROWSER.dom) return document.getElementById(nav);
  if (SB_BROWSER.ns4) {
    navRef = eval(document.layers[nav]);
    return navRef;
  }
} 

/*
------------------------------------------
Function name  - sb_sectionObject
Description - used to create section objects and set its properties 
        this allows a section to live in a directory that is named something different from the section name
------------------------------------------  
*/
function sb_sectionObject(sectionName, sectionDiv)
{
  this.sectionName = sectionName;
  this.sectionDiv = sectionDiv;
  return this;
}

/*
------------------------------------------
Function name  - sb_nodeObject
Description - used to create a collection of nodes
------------------------------------------  
*/
function sb_nodeObject()
{
  this.nodeCollection = new Array();
  this.nodeCounter = 0;
  return this;
}

/*------------------------------------------
Function name  -  sb_currentFloat
Description - used to store properties of the current floater
------------------------------------------*/
function sb_currentFloat(navName) { this.navName = navName; }

/*------------------------------------------
Function name  -  sb_currentExpandNav
Description - used to store properties of the current floater
------------------------------------------*/
function sb_currentExpandNav(sourceNav,navName)
{
  this.sourceNav = sourceNav;
  this.navName = navName;
}

/*------------------------------------------
Function name  -  sb_currentRollOver
Description - used to store properties of the current rollover
------------------------------------------*/
function sb_currentRollOver(navName) {  this.navName = navName; }


/*------------------------------------------
Function name  -  sb_currentSectionRollOver
Description - used to store properties of the current rollover
------------------------------------------*/
function sb_currentSectionRollOver(navName) { this.navName = navName; }

/*------------------------------------------
Function name  -  sb_rollOverObject
Description - used to store the properties of a rollover object
        the properties include the owner of this object, the on state and the off state
------------------------------------------  */
function sb_rollOverObject(onClass,offClass)
{
  this.onClass = onClass;
  this.offClass = offClass;
  return this;
}

/*------------------------------------------
Function name  -  sb_navRollOver
Description - used to handle the on and off state of nav items
        there is no on or off state switch the swtiching is done by querying the rollOver object
------------------------------------------*/
function sb_navRollOver(nav)
{
  if (! SB_BROWSER.dom) return;
  if (SB_FLOAT_TIMEOUT) window.clearTimeout(SB_FLOAT_TIMEOUT);    
  //sb_floatShow();
  var navRef = null;
  navRef = sb_getNavRef(nav);
  if (! navRef) return;
  if((SB_CURRENT_SECTION_ROLLOVER) && (SB_CURRENT_SECTION_ROLLOVER.navName.toString() == nav)) return;  
  //if (SB_CURRENT_EXPAND_NAV) sb_rollOverClear(SB_CURRENT_EXPAND_NAV.sourceNav);   

  var rollObject = new Array();
  rollObject[0] =  new sb_rollOverObject("navtopon","navtopoff");
  rollObject[1] =  new sb_rollOverObject("navsubon","navsuboff");

  //window.status = "navRef.parentNode.parentNode.parentNode.nodeName " + navRef.parentNode.parentNode.parentNode.parentNode.className;
  
  var objChildNodes = navRef.childNodes;
  for (c=0;c<rollObject.length;c++)
  {
    var thisObj = rollObject[c];
    for (thisKey in thisObj)
    {
      if ((SB_BROWSER.dom) && (thisObj["offClass"] == navRef.className) && (navRef.parentNode.parentNode.parentNode.parentNode.parentNode.className != "navfloat")) 
      {
        navRef.className = thisObj["onClass"];
        if ((navRef.parentNode) && (navRef.parentNode.nodeName.toUpperCase() == "TD")) navRef.parentNode.className = thisObj["onClass"];        
        if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = thisObj["onClass"];
        for (c=0; c<objChildNodes.length; c++)
        {
          var tn = objChildNodes[c];
          if (tn.nodeType == "3") continue;
          tn.className = thisObj["onClass"];
        }
        
        return;
      } // end if
      if ((SB_BROWSER.dom) && (thisObj["onClass"] == navRef.className) && (navRef.parentNode.parentNode.parentNode.parentNode.parentNode.className != "navfloat")) 
      {
        navRef.className = thisObj["offClass"];
        if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = thisObj["offClass"];
        for (c=0; c<objChildNodes.length; c++)
        {
          var tn = objChildNodes[c];
          if (tn.nodeType == "3") continue;
          tn.className = thisObj["offClass"];
        }
        return;
      } // end if

    } // end for
    
    if ((SB_BROWSER.dom) && (navRef.parentNode.parentNode.parentNode.parentNode.parentNode.className == "navfloat") && ((navRef.className == "navsuboff") || (navRef.className == "") )) 
    {
      navRef.className = "navsubon";
      if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = "navsubon";
      for (c=0; c<objChildNodes.length; c++)
      {
        var tn = objChildNodes[c];
        if (tn.nodeType == "3") continue;
        tn.className = "navsubon";
      }
      
      return;
    }  // end if
  
  
    if ((SB_BROWSER.dom) && (navRef.parentNode.parentNode.parentNode.parentNode.parentNode.className == "navfloat") && (thisObj["onClass"] == navRef.className)) 
    {
      navRef.className = "navsuboff";
      if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = "navsuboff";
      for (c=0; c<objChildNodes.length; c++)
      {
        var tn = objChildNodes[c];
        if (tn.nodeType == "3") continue;
        tn.className = "navsuboff";
      }
      return;
    }  // end if

    if ((SB_BROWSER.dom) && (navRef.parentNode.parentNode.parentNode.parentNode.parentNode.className == "navexpand") && ((navRef.className == "navexpandoff") || (navRef.className == "") )) 
    {
      if (SB_CURRENT_FLOAT) 
      {
      if (SB_FLOAT_TIMEOUT) window.clearTimeout(SB_FLOAT_TIMEOUT);    
      sb_hideCurrentFloat();
      //sb_rollOverClear(SB_CURRENT_FLOAT.navName)
      sb_rollOverClear();
      }
      navRef.className = "navexpandon";
      if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = "navexpandon";
      for (c=0; c<objChildNodes.length; c++)
      {
        var tn = objChildNodes[c];
        if (tn.nodeType == "3") continue;
        tn.className = "navexpandon";
      }
      
      return;
    }  // end if
  
  
    if ((SB_BROWSER.dom) && (navRef.parentNode.parentNode.parentNode.parentNode.parentNode.className == "navexpand") && (navRef.className == "navexpandon")) 
    {
      navRef.className = "navexpandoff";
      if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = "navexpandoff";
      for (c=0; c<objChildNodes.length; c++)
      {
        var tn = objChildNodes[c];
        if (tn.nodeType == "3") continue;
        tn.className = "navexpandoff";
      }
      return;
    } // end if
  } // end for
}

/*------------------------------------------
Function name  -  sb_rollOverClear
Description - used to clear a specific rollover
------------------------------------------*/
function sb_rollOverClear(sourceNav)
{
  if (! SB_BROWSER.dom) return;
  //if (SB_CURRENT_EXPAND_NAV && SB_CURRENT_ROLLOVER) alert("SB_CURRENT_ROLLOVER.navName " + SB_CURRENT_ROLLOVER.navName + "\n" + "SB_CURRENT_EXPAND_NAV.navName " + SB_CURRENT_EXPAND_NAV.navName);
  //sb_floatShow();
  //if (SB_FLOAT_TIMEOUT) window.clearTimeout(SB_FLOAT_TIMEOUT);    
  if (! SB_CURRENT_ROLLOVER.navName) return;
  if ((SB_CURRENT_EXPAND_NAV) && (SB_CURRENT_ROLLOVER.navName ==  SB_CURRENT_EXPAND_NAV.navName)) return;
  var navRef = null;
  arguments.length ==0 ?  navRef = sb_getNavRef(SB_CURRENT_ROLLOVER.navName) :  navRef = sb_getNavRef(sourceNav); 
  if (! navRef) return;
  var rollObject = new Array();
  rollObject[0] =  new sb_rollOverObject("navtopon","navtopoff");
  rollObject[1] =  new sb_rollOverObject("navsubon","navsuboff");
  var objChildNodes = navRef.childNodes;
  for (c=0;c<rollObject.length;c++)
  {
    var thisObj = rollObject[c];
    for (thisKey in thisObj)
    {
      if ((SB_BROWSER.dom) && (thisObj["onClass"] == navRef.className)) 
      {
        navRef.className = thisObj["offClass"];
         if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = thisObj["offClass"];
        for (c=0; c<objChildNodes.length; c++)
        {
          var tn = objChildNodes[c];
          if (tn.nodeType == "3") continue;         
          tn.className = thisObj["offClass"];
        }
        return;

      }
    }
  }
}



/*------------------------------------------
Function name  -  sb_sectionClear
Description - used to clear a specific section
------------------------------------------*/
function sb_sectionClear(sourceNav)
{
  if (! SB_BROWSER.dom) return;
  //if (SB_CURRENT_EXPAND_NAV && SB_CURRENT_ROLLOVER) alert("SB_CURRENT_ROLLOVER.navName " + SB_CURRENT_ROLLOVER.navName + "\n" + "SB_CURRENT_EXPAND_NAV.navName " + SB_CURRENT_EXPAND_NAV.navName);
  if (! SB_CURRENT_SECTION_ROLLOVER.navName) return;
  var navRef = null;
  arguments.length ==0 ?  navRef = sb_getNavRef(SB_CURRENT_SECTION_ROLLOVER.navName) :  navRef = sb_getNavRef(sourceNav); 
  if (! navRef) return;
  var rollObject = new Array();
  rollObject[0] =  new sb_rollOverObject("navtopon","navtopoff");
  rollObject[1] =  new sb_rollOverObject("navsubon","navsuboff");
  var objChildNodes = navRef.childNodes;
  for (c=0;c<rollObject.length;c++)
  {
    var thisObj = rollObject[c];
    for (thisKey in thisObj)
    {
      if ((SB_BROWSER.dom) && (thisObj["onClass"] == navRef.className)) 
      {
        navRef.className = thisObj["offClass"];
         if ((navRef.parentNode.parentNode) && (navRef.parentNode.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.parentNode.className = thisObj["offClass"];
        for (c=0; c<objChildNodes.length; c++)
        {
          var tn = objChildNodes[c];
          if (tn.nodeType == "3") continue;         
          tn.className = thisObj["offClass"];
        }
        return;

      }
    }
  }
}

/*------------------------------------------
Function name  -  sb_sectionHighLight
Description - used to highlight a section
------------------------------------------*/
function sb_sectionHighLight(nav)
{
  if (! SB_BROWSER.dom) return;
  var navRef = null;
  navRef = sb_getNavRef(nav);
  if (! navRef) return;

  var rollObject = new Array();
  rollObject[0] =  new sb_rollOverObject("navsubsectionon","navsuboff");
  rollObject[1] =  new sb_rollOverObject("navtopsectionon","navtopoff");

  //alert(navRef.className);
  var objChildNodes = navRef.childNodes;
  for (c=0;c<rollObject.length;c++)
  {
    var thisObj = rollObject[c];
    for (thisKey in thisObj)
    {
      if ((SB_BROWSER.dom) && (thisObj["offClass"] == navRef.className) || (navRef.className == "")) 
      {
        navRef.className = thisObj["onClass"];
        //alert(navRef.parentNode.previousSibling.innerHTML + "\n" + navRef.parentNode.previousSibling.className);
        if ((navRef.parentNode) && (navRef.parentNode.nodeName.toUpperCase() == "TD")) navRef.parentNode.className = thisObj["onClass"];        
        if ((navRef.parentNode.previousSibling.parentNode) && (navRef.parentNode.previousSibling.parentNode.nodeName.toUpperCase() == "TR")) navRef.parentNode.previousSibling.parentNode.className = thisObj["onClass"];
        if (navRef.parentNode.previousSibling) navRef.parentNode.previousSibling.className = thisObj["onClass"];
        for (c=0; c<objChildNodes.length; c++)
        {
          var tn = objChildNodes[c];
          if (tn.nodeType == "3") continue;
          tn.className = thisObj["onClass"];
        }
        
        return;
      }
    }
  }
}
  
/*------------------------------------------
Function name  - sb_hideCurrentFloat
Description - used to hide the current nav
------------------------------------------  */
function sb_hideCurrentFloat() 
{ 
  if (! SB_BROWSER.dom) return;
  var navRef = null;
  var sourceNavRef = null;
  if ((SB_CURRENT_EXPAND_NAV) && (SB_CURRENT_FLOAT) && (SB_CURRENT_FLOAT.navName ==  SB_CURRENT_EXPAND_NAV.navName)) return;  
  if (SB_CURRENT_FLOAT) 
  {
    navRef = sb_getNavRef(SB_CURRENT_FLOAT.navName);
    if (! navRef) return;
    SB_BROWSER.dom ? navRef.style.visibility = "hidden" : navRef.visibility = "hide";
    //sb_floatClear(SB_CURRENT_FLOAT.navName);
  }
}

/*------------------------------------------
Function name  - sb_floatHide
Description - used to hide a float
------------------------------------------  */
function sb_floatHide(waitTime) 
{ 
  if (! SB_BROWSER.dom) return;
  var wt;
  if (arguments.length > 1) return;
  if (! waitTime) {
    wt = 1500; 
  } else {
    wt = waitTime;
  }
  if (window.setTimeout) {
    if (SB_FLOAT_TIMEOUT) window.clearTimeout(SB_FLOAT_TIMEOUT);
    SB_FLOAT_TIMEOUT = window.setTimeout('sb_hideCurrentFloat() ; sb_rollOverClear(SB_CURRENT_ROLLOVER.navName)',wt);
  } else {
    sb_hideCurrentFloat()
  }
}

/*------------------------------------------
Function name  - sb_floatShow
Description - used to keep a float afloat
------------------------------------------  */
function sb_floatShow() 
{ 
  if (! SB_BROWSER.dom) return;
  if (arguments.length > 0) return; 
  if ((window.clearTimeOut) && (SB_FLOAT_TIMEOUT)) window.clearTimeout(SB_FLOAT_TIMEOUT); 
} 
/*------------------------------------------
Function name  - sb_floatClear
Description - used to clear the bgcolor of the float
------------------------------------------  */
function sb_floatClear(destNav)
{
  if (! SB_BROWSER.dom) return;
  if (arguments.length > 1) return;
  var destNavRef = null;
  if (destNav != "") destNavRef = sb_getNavRef(destNav);
  if (! destNavRef) return;
  return;
}

/*------------------------------------------
Function name  - sb_navFloat
Description - used to float a div
------------------------------------------  */
function sb_navFloat(sourceNav,destNav) 
{ 
  if (! SB_BROWSER.dom) return;
  if (arguments.length == 0) return;
  var sourceNavRef = null; 
  var destNavRef = null;
  if (sourceNav != "") sourceNavRef = sb_getNavRef(sourceNav);
  if (destNav != "") destNavRef = sb_getNavRef(destNav);
  if (! sourceNavRef) return;
  if (arguments.length == 1)
  {
    if (SB_CURRENT_FLOAT) sb_hideCurrentFloat();
    sb_rollOverClear();
    sb_navRollOver(sourceNav);
    return;
  } else {
    if(((SB_CURRENT_SECTION_ROLLOVER) && (SB_CURRENT_SECTION_ROLLOVER.navName.toString() != sourceNav)) || (!SB_CURRENT_SECTION_ROLLOVER)) 
    {
      sb_rollOverClear();
      sb_navRollOver(sourceNav);
      SB_CURRENT_ROLLOVER = new sb_currentRollOver(sourceNav);
    }
  }
  if (SB_CURRENT_ROLLOVER.navName) sb_rollOverClear();
  sb_navRollOver(sourceNav);
  if (SB_CURRENT_FLOAT) sb_hideCurrentFloat();
  
  if(destNav != "") SB_CURRENT_FLOAT = new sb_currentFloat(destNav);
  if ((sourceNavRef) && (destNavRef))
  {
    if ((SB_CURRENT_EXPAND_NAV) && (SB_CURRENT_EXPAND_NAV.navName == destNav)) return; 
    destNavRef.style.left = "154px";
    
    if ((SB_BROWSER.ie) && (!SB_BROWSER.iemac))
    {
      destNavRef.style.top = destNavRef.style.top = (sourceNavRef.offsetParent.offsetTop);
      destNavRef.style.zIndex = 999;
    }
    else if (SB_BROWSER.ns7)
    {
      destNavRef.style.top = (sourceNavRef.offsetParent.offsetTop + sourceNavRef.offsetParent.offsetHeight + 50);
      destNavRef.style.zIndex = 999;    
    }
    else if(SB_BROWSER.ff)
    {
      destNavRef.style.top = (destNavRef.style.top - sourceNavRef.offsetParent.offsetHeight);
      destNavRef.style.zIndex = 999;
    }
    else if(SB_BROWSER.ns)
    {
      destNavRef.style.top = ((sourceNavRef.parentNode.parentNode.offsetTop) - 1);
      destNavRef.style.zIndex = 999;
    }
    else if (SB_BROWSER.iemac)
    {
      destNavRef.style.zIndex = 999;
      return;
    }
    
    
    destNavRef.style.visibility = "visible";
    destNavRef.parentNode.className = "navfloat";
    destNavRef.className = "navfloat";
  }
}

/*------------------------------------------
Function name  - sb_navExpand
Description - forwards to a url
------------------------------------------  */
function sb_navExpand(destUrl) 
{ 
  document.location = destUrl;
  return;
}

/*------------------------------------------
Function name  - sb_navExpandItem
Description - used to expand a nav item
------------------------------------------  */
function sb_navExpandItem(sourceNav,destNav,destUrl)
{
  if (! SB_BROWSER.dom) return;
  var navRef = null;
  navRef = sb_getNavRef(destNav);
  if (! navRef) return;

  //navRef = document.getElementById(destNav);
  if ((SB_CURRENT_EXPAND_NAV)) sb_navCollapse(destNav);
  if((sourceNav != "") && (destNav != "")) SB_CURRENT_EXPAND_NAV = new sb_currentExpandNav(sourceNav,destNav);
  navRef.parentNode.className = "navexpand";    
  navRef.className = "navexpand";   
  navRef.style.visibility = "visible";
  navRef.style.position = "static";
  //printObject(navRef.style);
  return;
}

/*------------------------------------------
Function name  - sb_navCollapse
Description - used to collapse a nav item
------------------------------------------  */
function sb_navCollapse(destNav) 
{ 
  if (! SB_BROWSER.dom) return;
  var navRef = null;  
  if ((SB_CURRENT_EXPAND_NAV) && (SB_CURRENT_EXPAND_NAV.navName !=  ""))
  {
    //navRef = document.getElementById(SB_CURRENT_EXPAND_NAV.navName);
    navRef = sb_getNavRef(SB_CURRENT_EXPAND_NAV.navName);
    if (! navRef) return;   
    //if (SB_BROWSER.dom) navRef.className = "navcollapse";
    SB_BROWSER.dom ? navRef.style.visibility = "hidden" : navRef.visibility = "hide";
    SB_BROWSER.dom ? navRef.style.position = "absolute" : navRef.position = "absolute";
  }
}

/*
------------------------------------------
Function name  - sb_navHighlight
Description - used to highlight a specific nav
------------------------------------------  
*/
function sb_navHighlight(sourceNav)
{
  if (!SB_BROWSER.dom) return;
  if ((! sourceNav) || (sourceNav == "")) return;
  
  var sourceNavRef = null;
  var destNavRef = null;
  var clickedNav = null;
  var destNav;
  
  sourceNavRef= sb_getNavRef(sourceNav);
  if (! sourceNavRef) return; 
  
  //alert("sourceNavRef " + sourceNavRef + "\n" + "sourceNav" + "\n" + sourceNav);
  //this block figures out what the parent section div is for a clicked div
  //once it gets the name it will get a reference to it and highlight it  
  var sn = new String(sourceNav);
  var tm = sn.match(/_/gi);
  if ((tm) && (tm.length == 1))
  {
    destNav = sourceNav + "_0";
  } else if ((tm) && (tm.length > 1)) {
    clickedNav = sourceNav;
    sourceNav = sn.match(/([a-zA-Z]+_\d+)/gi);
    destNav = sn.match(/([a-zA-Z]+_\d+_\d+)/gi);
  }
  
  destNavRef = sb_getNavRef(destNav);
  
  //alert("tm.length " + tm.length + "\n clickedNav " + clickedNav + "\n sourceNavRef " + sourceNavRef + "\n" + "sourceNav" + sourceNav + "\n destNavRef " + destNavRef + "\n" + "destNav" + destNav);  
  if (destNavRef)
  {
    SB_CURRENT_EXPAND_NAV = new sb_currentExpandNav(sourceNav,destNav);
    sb_navExpandItem(sourceNav,destNav);
    if (clickedNav && sourceNav) 
    {
      if (SB_CURRENT_SECTION_ROLLOVER) sb_sectionClear(SB_CURRENT_SECTION_ROLLOVER.navName);
      //sb_navRollOver(clickedNav);
      sb_sectionHighLight(clickedNav);      
      SB_CURRENT_SECTION_ROLLOVER = new sb_currentSectionRollOver(clickedNav);    
      return;       
    }
    
    if (sourceNav && !clickedNav)
    {
      //sb_sectionHighLight(sourceNav);
      sb_navRollOver(sourceNav);    
      SB_CURRENT_SECTION_ROLLOVER = new sb_currentSectionRollOver(sourceNav);               
      return;
    } 
    
  } else {
    sb_navRollOver(sourceNav);
    SB_CURRENT_SECTION_ROLLOVER = new sb_currentSectionRollOver(sourceNav);             
    return;
  } 


  
//this block highlights both the selected section and the clicked item
/*
  if (destNavRef)
  {
    SB_CURRENT_EXPAND_NAV = new sb_currentExpandNav(sourceNav,destNav);
    sb_navExpandItem(sourceNav,destNav);
    if (clickedNav) {
      sb_navRollOver(clickedNav);
      SB_CURRENT_SECTION_ROLLOVER = new sb_currentSectionRollOver(clickedNav);    
      return;       
    } else {
      sb_navRollOver(sourceNav);    
      SB_CURRENT_SECTION_ROLLOVER = new sb_currentSectionRollOver(sourceNav);               
      return;
    }
  } else {
    sb_navRollOver(sourceNav);
    SB_CURRENT_SECTION_ROLLOVER = new sb_currentSectionRollOver(sourceNav);             
    return;
  } 
*/
}


/*
------------------------------------------
Function name  - sb_setNavState
Description - used to set the initial nav of the application, this is implemented as a singleton
        the global variable SB_NAV_STATE_SET is used to identify if the function has been called
        This can only be called once per page
------------------------------------------  
*/
function sb_setNavState()
{
  if (! SB_BROWSER.dom) return;
  if (SB_NAV_STATE_SET) return;
  SB_NAV_STATE_SET = 1;
  var currentPage = new String(document.location);
  var sectionMappings = getSectionMappings();
  var pageMappings = getPageMappings();

  var sectionName = sb_getCurrentDir();
  for (c=0;c<sectionMappings.nodeCollection.length;c++)
  {
    if (sectionMappings.nodeCollection[c].sectionName == sectionName) 
    {
        sb_navHighlight(sectionMappings.nodeCollection[c].sectionDiv);
        break;
        return;
    }
  }
  
  for (c=0;c<pageMappings.nodeCollection.length;c++)
  {
    var pageName = new String(pageMappings.nodeCollection[c].sectionName);
    //alert(pageMappings.nodeCollection[c].sectionName + "\n" + currentPage + "\n" + currentPage.indexOf(pageName));    
    if (currentPage.indexOf(pageName) != -1)
    {
        sb_navHighlight(pageMappings.nodeCollection[c].sectionDiv);
        break;
        return;
    }
  }
}

/*------------------------------------------
Function name  - sb_getCurrentPage
Description - used to return the current page
------------------------------------------*/
function sb_getCurrentPage()
{
  if (! SB_BROWSER.dom) return;
  var serverURL = new String(document.location);
  //var serverURL = new String("http://merck-dev/dir1/dir2/dir3/alpha_index.html");
  //var pathMatches = serverURL.match(/\/[a-zA-Z0-9_.]+/gi);
  //var pathMatches = serverURL.match(/\/\/.+/gi);
  //var pathMatches = serverURL.match(/\/\/[a-zA-Z0-9_.]+/gi);  
  var pathMatches  = serverURL.match(/\/\/([a-zA-Z0-9\W][^\/]+)\/([a-zA-Z0-9\W][^\/].+)/gi);
  var currentDir = "";
  window.status = "currentDir " + pathMatches + "length " + pathMatches.length;
  //alert("serverURL " + serverURL + "\n currentDir " + currentDir  + "\n pathMatches " + pathMatches + "\n pathMatches.length  " + pathMatches.length );
  return currentDir;
}


/*------------------------------------------
Function name  - sb_getCurrentDir
Description - used to return the current directory
------------------------------------------*/
function sb_getCurrentDir()
{
  if (! SB_BROWSER.dom) return;
  var serverURL = new String(document.location);
  //var serverURL = new String("http://merck-dev/dir1/dir2/dir3/alpha_index.html");
  var pathMatches = serverURL.match(/\/[a-zA-Z0-9_]+/gi);
  var currentDir = "";
  if (pathMatches.length >  3) 
  {
    var offset = (pathMatches.length -2);
    currentDir = new String(pathMatches[offset]);
    currentDir = currentDir.substr(1,currentDir.length);
  } else {
    currentDir = "home";
  }
  //alert("serverURL " + serverURL + "\n currentDir " + currentDir  + "\n pathMatches " + pathMatches + "\n pathMatches.length  " + pathMatches.length );
  return currentDir;
}

/*
------------------------------------------
Function name  - sb_getSelectedNode
Description - used to return the currently selected node from the URL
------------------------------------------  
*/
function sb_getSelectedNode()
{
  if (! SB_BROWSER.dom) return;
  var serverURL = new String(document.location);
  var selectedNode = new String(serverURL.match(/\?SN=\w+/gi));
  if ((selectedNode) &&  (selectedNode != ""))
  {
    selectedNode =  selectedNode.substr(4,selectedNode.length);
  } 
  return selectedNode;
}