// JavaScript Document

               // ................................................. //
               //                                //
               // author:ted o'hara                                 //
               // module: DSI                                       //
               // purpose: utility scripts for DSI site             //                       
               // Created: 03/11/2003                               //
               // Copyright (C) 2003 bxTechnologies, Inc.           //
               // ................................................. //
               
var strStayOn = "home";               
var numMenus = 6;               
var navarray0 = [];
var navarray1 = ["mi11|about_remarks_from_president.html","mi12|construct.html","mi13|construct.html","mi14|construct.html","mi15|construct.html","mi16|#"];
var navarray2 = ["mi17|business_overview.html","mi18|business_traditional_power_business.html","mi19|business_alternative_energy.html","mi20|business_climate_solutions.html","mi22|business_global_engineering_and_construction_office.html"];
var navarray3 = ["mi24|investor_generalinvestor.html","mi25|#","mi26|construct.html"];
var navarray4 = ["mi27|newsroom_presentations_web_casts.html","mi28|construct.html","mi29|construct.html","mi30|construct.html","mi31|construct.html","mi33|#"];
var navarray5 = ["mi34|careers_culture.html","mi35|construct.html","mi36|construct.html"];

var textoncolor  = "#FFFFFF";
var textoffcolor = "#00415F";
var bgoncolor    = "#72949C";
var bgoffcolor   = "#F0E2BF";
var imgnames     = ['global','about','business','investor','news','career']
var menuTimeOut  = 0

   
//-----------------------------------------------------------------------
 // *********************** I M P O R T A N T ***************************
 // The following lines of code create cross browser (ie4 to NS)
 // DHTML layer manuipulation and control and should always be
 // included as the first [head][script language..] variable declarations
 // G.Harstad 2000
 // added  partial NS6 compatibilty T. O'Hara 2/2001
 //-----------------------------------------------------------------------
    //Detect browser type (4+ required)
    var ie4 = document.all;
    var ns = document.layers;
    var gh_dom = document.getElementById;
    
   //BEGIN CROSS BROWSER DOM VARIABLE CREATION
   var doc =  gh_dom ? "document.getElementById('" :ie4 ? "document.all." : "document."
   var sty = gh_dom ? "').style" : ie4 ? ".style" : ""
   var vis = ".visibility="
   var bgcol = ie4 ? ".backgroundColor" : ".backgroundColor"
   //(not correct yet) var fgcol = ie4 ? ".Color" : ".Color"
   
   //Used for getting width & height of a layer
   var getwidth  = gh_dom? ".width" :ie4 ? ".pixelWidth"  : ".clip.width"
   var getheight = gh_dom? ".height" :ie4 ? ".pixelHeight" : ".clip.height"
   
   //used for the differences in showing and hiding a layer
   var show = (ie4||gh_dom) ? "'visible'" : "'show'"
   var hide = (ie4||gh_dom) ? "'hidden'"  : "'hide'"
//END CROSS BROWSER DOM VARIABLE CREATION
 
 
  
 //--------------------------------------------------------
 // FUNCTION: togglelayer(lyrname, togval)
 // DESCRIPTION: Toggles a layer's visibility
 // REQUIRES: layers name [string] and 0 or 1 [off or on]  
 // AUTHOR: G.Harstad 2000  
 //--------------------------------------------------------
   function togglelayer(lyrname, togval)
   {   
   //alert("togglelayer");
       var togval2 = (togval == 0) ? hide : show
	   eval(doc+lyrname+sty+'.zIndex=9999');
       eval(doc+lyrname+sty+vis+togval2)
   }
     
     

//"Ordinary" rollover functions
    function imgOn (imgName)
       {
         if (document.images)
         {
           document [imgName].src = eval (imgName + "on.src");
         }
       }
       
       // image off function
       function imgOff(imgName)
       {
         
         if (document.images)
         {
           document [imgName].src = eval (imgName + "off.src");
         }
       }  

    function menuOn(menunum)
       {
        for(var z=0; z<numMenus;z++)
          {
            if (z!=menunum)
            hidemenu(z)
          }
        clearTimeout(menuTimeOut);  
        thisImage = imgnames[menunum]
        thisMenu  = "mn" +thisImage
        imgOn(thisImage)
        if (!document.layers) togglelayer(thisMenu,1)
       
       }
    
    function menuOff(menunum)
      {

        menuTimeOut = setTimeout("hidemenu('" + menunum + "')",700);
      }
    
    
    function hidemenu(menunum)
      {        
	
        thisImage = imgnames[menunum];
	//alert(strStayOn!=thisImage);
        thisMenu  = "mn" +thisImage;
	if (strStayOn!=thisImage) imgOff(thisImage);
        if (!document.layers) togglelayer(thisMenu,0);
      }
      
    function colorChange(divobj,fgcolor,bgcolor)
      {
        if (document.all||document.getElementById)
          {
            divobj.style.backgroundColor=bgcolor
          }
        if (document.getElementById)
          {
            divobj.firstChild.style.color=fgcolor
          }
      
      }
      
    function itemOn()
      {
        colorChange(this,textoncolor,bgoncolor)
        clearTimeout(menuTimeOut);
      }
      
    function itemOff()
      {
        
        colorChange(this,textoffcolor,bgoffcolor)
        menuTimeOut = setTimeout("hidemenu('" + this.parentmenu + "')",450)
      }
      
      
    function attachEvents()
      {
        for(var i=0;i<numMenus;i++)
          {
            var arrayToUse= eval("navarray"+i)
            for (var j=0; j<arrayToUse.length;j++)
              {
                valpair = arrayToUse[j].split("|")
                thisID   = valpair[0]
                thishref = valpair[1]
                 if (document.getElementById)
                    {         
                       thisElement = document.getElementById(thisID)
                    }
                 else if (document.all)
                    {
                       thisElement = document.all[thisID]
                    }
                  
                if ((document.getElementById) || (document.all))
                 {
                  //alert (thisElement.id)
                  thisElement.onmouseover = itemOn
                  thisElement.onmouseout  = itemOff
                  thisElement.newlocation = thishref
                  thisElement.parentmenu  = i
                  thisElement.onclick     = function() {window.location = this.newlocation}
                  //alert(thisElement.onclick)
                 }
                
              }
          }
      }
attachEvents();
