/*
* Copyright 2004 Glen Group
* $Id: functions.js,v 1.1.1.1 2005/03/09 21:31:49 bennett Exp $
*/



/*  javascript menus
*
*    Args:
*       - menuId = id of the menu element to process
*       - menuTagName = the name of the tag for menus 
*            default - 'menu'
*                
*   How to use:
*       - Call this function from a valid browser event (onMouseOver, onClick, etc).
*               Example: (<a href="#" onMouseOver="menu('menu1');">Sample Menu</a>
*
*       - the target menu, using example above, should look something like:
*               <menu id="menu1">
*                   <a href="...">Option 1</a>
*                   <a href="...">Option 2</a>
*                   <a href="...">Option 3</a>
*               </menu>
*
*   Notes:
*       - To keep menu open longer while "mousing over" options, 
*           call the current <menu> from the onMouseOver event of each option:
*
*           Example: 
*           <menu id="menu1">
*               <a href="..." onMouseOver="menu('menu1');">Option 1</a>
*               <a href="..." onMouseOver="menu('menu1');">Option 2</a>
*               <a href="..." onMouseOver="menu('menu1');">Option 3</a>
*           </menu>
*/
var timeOutId = '';

function menu(menuId,menuTagName){
    clearTimeout(timeOutId);
              
    if (!menuTagName) {menuTagName = 'menu';}
    var menuObjects = document.getElementsByTagName(menuTagName);

    for (var i=0; i < menuObjects.length; ++i) {
        var currentId = menuObjects[i].getAttribute('id');
        if (currentId == menuId) {
            menuObjects[i].style.display = 'inline';
        } else {
            menuObjects[i].style.display = 'none';
        }    
    } 
    timeOutId = setTimeout('menu()',2500);                
}


/* toggles the visibility of an object. (Used for pop notes currently.
*/
function popupData(objectId){
    var popupObject = document.getElementById(objectId);
    
    if (popupObject.style.visibility == 'hidden') {
        popupObject.style.visibility = 'visible';
    } else {
        popupObject.style.visibility = 'hidden';
    }
}

/* function to display notes
*/
function noteDisplay(noteId,displayType){
    var noteObject = document.getElementById(noteId);

    if (!displayType) {var displayType = 'block';}
    noteObject.style.display = displayType;  
}

