
// Purpose: Combined javascript and image-map for managing channel-navigation bar
//
// Note   : Use rollover navigation bar for IE5.5 and up.  
//          IE5.0 does not handle the combination of 'visibility' and 
//          'filters' (for partial transparency of drop-downs) well, so
//          IE5.0 excluded from dynamic rollovers.  
// Note   : Netscape, due to low usage by Forbes users, is also excluded
//          from dynamic rollovers.
// Note   : Channel pages are redirected by the server.  Section pages,
//          when rollover is active on the browser, are not redirected
//          by the server, but instead maintained within dynamic.  This
//          done to reduce operations redirect maintainance work.

   // Handle override of rollover
   if ( (skipNavRollover != null) && (skipNavRollover != "")) {
      skipNavRollover = 1; // true if skipNavRollover is set to anything
   } else {
      skipNavRollover = 0; // false  
   }

   // Determine Browser Version
   // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
   var agt = navigator.userAgent.toLowerCase();
   var ver = parseInt(navigator.appVersion);

   var is_ie      = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
   var is_ie3     = (is_ie && (ver < 4));
   var is_ie4     = (is_ie && (ver == 4) && (agt.indexOf("msie 4")!=-1) );
   var is_ie4up   = (is_ie && (ver >= 4));
   var is_ie5     = (is_ie && (ver == 4) && (agt.indexOf("msie 5.0")!=-1) );
   var is_ie5_1   = (is_ie && (ver == 4) && (agt.indexOf("msie 5.1") !=-1)); //mac only
   var is_ie5_5   = (is_ie && (ver == 4) && (agt.indexOf("msie 5.5") !=-1));
   var is_ie5up   = (is_ie && !is_ie3 && !is_ie4);
   var is_ie5_1up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
   var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_1);
   var is_ie6     = (is_ie && (ver == 4) && (agt.indexOf("msie 6.")!=-1) );
   var is_ie6up   = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
   var is_mac     = agt.indexOf("mac");
   if (is_mac >= 0) { is_mac=1; } else { is_mac=0; }

   // Define which browser gets dynamic vs. static navBar
   //  * note: path information is defined in dynamo's config via ScriptsPaths.properties
 
  if ( doDynamicRollover() ) {
     document.write ("<link rel=\"stylesheet\" type=\"text/css\" href=\""+dynamicStyleSheetPath+"\">");
     thisSrc = dynamicPath;   // default: "/scripts/dynamic.js"
   } else {
     thisSrc = staticPath;   // default: "/scripts/static.js"
   }

   document.write("<script language=\"JavaScript\" type=\"text/javascript\" src=\"" + thisSrc + "\"><\/script>");


   // CLIENT-SIDE IMAGE MAP

   document.write('<map name="nav">');

   if ( doDynamicRollover() ) {

      document.write('<area shape="rect" coords="10,4,66,24" href="\/" onMouseOver = "rollOver(\'Investment Newsletters,Polls & Discussions,Premium Tools,Special Reports,Video & Audio,Watchlist\',\'home\',13);" onMouseOut = "imageOut(\'home\');" >');
      document.write('<area shape="rect" coords="69,4,144,24" href="\/business\/" onMouseOver = "rollOver(\'Commerce,Energy,HealthCare,Manufacturing,Services,Technology\',\'business\',67);" onMouseOut = "imageOut(\'business\');" >');
      document.write('<area shape="rect" coords="147,4,249,24" href="\/technology\/" onMouseOver = "rollOver(\'E-Business,Enterprise Tech,Future Tech,Networks,Personal Tech,Sciences and Medicine\',\'technology\',149);" onMouseOut = "imageOut(\'technology\');" >');
      document.write('<area shape="rect" coords="251,4,329,24" href="\/markets\/" onMouseOver = "rollOver(\'Bonds,Commodities,Currencies,Economy,Emerging Markets,Equities\',\'markets\',254);" onMouseOut = "imageOut(\'markets\');" >');
      document.write('<area shape="rect" coords="331,4,391,24" href="\/work\/" onMouseOver = "rollOver(\'Careers,Compensation,Entrepreneurs,Management\',\'work\',333);" onMouseOut = "imageOut(\'work\');" >');

      var   thisTrick = '<area shape="rect" coords="391,4,442,24" href="\/lists\/" onMouseOver = "rollOver(';
      thisTrick = thisTrick + '\'';
      thisTrick = thisTrick + 'Forbes 500s,500 Largest Privates,World';
      thisTrick = thisTrick + '\\';
      thisTrick = thisTrick + '\'';
      thisTrick = thisTrick + 's Richest People,400 Richest Americans,100 Top Celebrities,All Forbes Lists\',\'lists\',392);" onMouseOut = "imageOut(\'lists\');" >';
      document.write(thisTrick);

      document.write('<area shape="rect" coords="449,4,586,24" href="\/finance\/" onMouseOver = "rollOver(\'Estate Planning,Funds,Philanthropy,Retirement,Strategies,Taxes\',\'personalFinance\',446);" onMouseOut = "imageOut(\'personalFinance\');" >');

 document.write('<area shape="rect" coords="590,4,673,24" href="\/lifestyle\/" onMouseOver = "rollOver(\'Health,Real Estate,Travel,Vehicles,Wine and Food,More Lifestyle\',\'lifestyle\',588);" onMouseOut = "imageOut(\'lifestyle\');" >');

      document.write('<area shape="rect" coords="683,4,706,24" href="\/portfolio\/" title="Portfolio Tracker" onMouseOver="setUpRollOut(thisX,divYNav);">');
      document.write('<area shape="rect" coords="714,4,734,24" href="\/peopletracker\/" title="People Tracker" onMouseOver="setUpRollOut(thisX,divYNav);">');
      document.write('<area shape="rect" coords="737,4,757,24" href="\/premium\/" title="Premium Services" onMouseOver="setUpRollOut(thisX,divYNav);">');


   } else {  // All other browsers

      document.write('<area shape="rect" coords="10,4,66,24" href="\/" title="Home">');
      document.write('<area shape="rect" coords="69,4,144,24" href="\/business\/" title="Commerce,Energy,HealthCare,Manufacturing,Services,Technology">');
      document.write('<area shape="rect" coords="147,4,249,24" href="\/technology\/" title="E-Business,Enterprise Tech,Future Tech,Networks,Personal Tech,Sciences and Medicine">');
      document.write('<area shape="rect" coords="331,4,391,24" href="\/work\/" title="Careers, Compensation, Entrepreneurs, Management">');
      document.write('<area shape="rect" coords="391,4,442,24" href="\/lists\/" title="Forbes 500s,500 Largest Privates,Worlds Richest People,400 Richest Americans,100 Top Celebrities,All Forbes Lists">');
      document.write('<area shape="rect" coords="251,4,329,24" href="\/markets\/" title="Bonds,Commodities,Currencies,Economy,Emerging Markets,Equities">');
      document.write('<area shape="rect" coords="449,4,586,24" href="\/finance\/" title="Estate Planning, Funds, Philanthropy, Retirement, Strategies, Taxes">');
     document.write('<area shape="rect" coords="590,4,673,24" href="\/lifestyle\/" title="Health,Real Estate,Travel,Vehicles,Wine and Food,More Lifestyle">');
      document.write('<area shape="rect" coords="683,4,706,24" href="\/portfolio\/" title="Portfolio Tracker">');
      document.write('<area shape="rect" coords="714,4,734,24" href="\/peopletracker\/" title="People Tracker">');
      document.write('<area shape="rect" coords="737,4,757,24" href="\/premium\/" title="Premium Services">');
   }


   document.write('<\/map>');
   document.write('<div onclick="javascript:rollOut();">'); // make dropdown invisible upon mouse click


//-----------
// Functions
//-----------

  function doDynamicRollover() {
     if (is_ie5_5up && !skipNavRollover && !is_mac) {
       return 1;
     } else {
       return 0; 
     }
  }











