// JScript File

/******** MENUS *********/
    /*  to add a menu scriptwise... increase the elements in both arrays by 1 
        and add an element to the ID array containing the name of 
        the dropdown (actList is automatically initialized) 
    */
    
    var IDList = new Array(6);
    var actList = new Array(6);
    
    
    IDList[0] = "Solutions";
    IDList[1] = "Products";
    IDList[2] = "Services";
    IDList[3] = "About";
    IDList[4] = "Software";
    IDList[5] = "MediaSolutions";
    
/* The amount of time(msecs) it takes once a menu is deactivated for it to close */
    var COOLDOWN = 300;
 
     /* only one menu should be open at a time */
    var openedMenu = "none";

function init_menu()
{
    for ( var x = 0; x < IDList.length; x ++ ) {    
        var obj = document.getElementById(IDList[x]);
        obj.style.display="none";
        
        
        // set persistent activation for subnav elements
	/*
        var aTags = obj.getElementsByTagName ( "A" );
        for ( var c = 0; c < aTags.length; c ++ ) {
            //alert ("Adding behavior: " + aTags[c].innerHTML );
            aTags[c].onmouseover = "reactivate('" + IDList[x] + "')";
            aTags[c].onmouseout = "deactivate('" + IDList[x] + "')";
        
        }
	*/
         
    }   
 
     
    
    
    
  
    for (var x = 0; x < actList.length; x ++ ){
        actList[x] = false;
    }
}

    function getMenu ( whichMenu ) {
    /* requests that any opened menu be closed before opening a new one*/

        if (openedMenu != whichMenu) {
            if (openedMenu != "none") {
               closeMenu ( openedMenu );

            }
            
            
            document.getElementById(whichMenu + "Header").className = "link_On"; 
            //new Effect.BlindDown( whichMenu, {duration:.1} );
            document.getElementById ( whichMenu ).style.display = "block";
           
       }
       
       openedMenu = whichMenu;  
       reactivate( whichMenu ); 
        
    }
    
    function reactivate ( whichMenu ) {
        
        for ( var x = 0; x < IDList.length; x ++ ) {
            
            if ( IDList[x] == whichMenu ) {
                actList[x] = true;
                break;
            }
    
        }
        
        
    }   
    
    
    function deactivate ( whichMenu ) {
    /* informs the computer that the user may be done with the element */
        
       
        
        for ( var x = 0; x < IDList.length; x ++ ) {
            
            if ( IDList[x] == whichMenu ) {
                actList[x] = false;
                setTimeout ("considerClosing(openedMenu)", COOLDOWN);
                break;
            }
        }
    }
    
    function considerClosing ( whichMenu ) {
        
        
    
        for ( var x = 0; x < IDList.length; x ++ ) {
            
            if ( IDList[x] == whichMenu ) {
                if ( actList[x] == false ) {
                    closeMenu (whichMenu);
                    break;
                }
            }
    
        }
        
        
    }
     
    function closeMenu ( whichMenu ) {
    /* performs operations to close a menu */
    
        //var menuObj = document.getElementById(whichMenu);
        //menuObj.style.display = "none";
        
        
        // Edit head element's style
        document.getElementById( whichMenu + "Header" ).className = "link_Off";
        
        // Close the menu
            //new Effect.BlindUp( whichMenu, {duration:.2} );
        document.getElementById ( whichMenu ).style.display = "none";
        
        if ( openedMenu == whichMenu ) openedMenu = "none";
    }
    

