
var currentMenu="headerNone";
var currentLink="linkNone";
var defaultMenu="None";

function MouseOverMenu( menuName, linkName )
{
	if( currentMenu != "") {
		changeDisplay( currentMenu, 'none' );
	}
	changeDisplay( menuName, 'block' );
	/* test code */
	if( menuName != currentMenu ) {
		var theElement = document.getElementById( currentLink );
		if( theElement ) {		
			if( currentMenu != 'header' + defaultMenu ) {
				theElement.style.color = "#000000";
				theElement.style.borderTop = "thin solid white";
				theElement.style.borderLeft = "thin solid white";
				theElement.style.borderRight = "thin solid white";
				theElement.style.borderBottom = "thin solid white";
				theElement.style.backgroundColor = "rgb(255, 255, 255)";
			}
			
			if( menuName != 'header' + defaultMenu ) {
				theElement = document.getElementById( linkName );
				if( theElement ) { 
					/* theElement.style.color = "#0000cc";
					theElement.style.borderTop = "thin dotted blue";
					theElement.style.borderLeft = "thin dotted blue";
					theElement.style.borderRight = "thin dotted blue"; */
					theElement.style.borderBottom = "thin solid darkgray";
					theElement.style.borderRight = "thin solid darkgray";
					theElement.style.borderTop = "thin solid rgb(212, 212, 212)";
					theElement.style.borderLeft = "thin solid rgb(212, 212, 212)";
					theElement.style.backgroundColor = "rgb(240, 240, 240)";
					//theElement.style.backgroundColor = "lightgray";
					//theElement.style.borderBottom = "thin dotted blue";
					theElement = document.getElementById( 'link' + defaultMenu );
					if( theElement ) { 
						//theElement.style.color = "#FF3333";
						theElement.style.color = "rgb( 240, 0, 0 )";
						theElement.style.borderBottom = "none";
						theElement.style.borderRight = "none";
						theElement.style.borderTop = "none";
						theElement.style.borderLeft = "none";
						theElement.style.backgroundColor = "rgb(255, 255, 255)";
					}
				}
			} else {
				theElement = document.getElementById( 'link' + defaultMenu );
				if( theElement ) { // Netscape does not support style.color  (check on this later!)
					//theElement.style.color = "#FF3333";
					theElement.style.color = "rgb( 240, 0, 0 )";
					theElement.style.borderBottom = "thin solid rgb(175, 175, 175)";
					theElement.style.borderRight = "thin solid rgb(175, 175, 175)";
					theElement.style.borderTop = "thin solid rgb(212, 212, 212)";
					theElement.style.borderLeft = "thin solid rgb(212, 212, 212)";
					theElement.style.backgroundColor = "rgb(240, 240, 240)";
				}
			}
		}
	}
	/* end test code */
	currentMenu = menuName;
	currentLink = linkName;
}

function MouseOutMenu( )
{
	if( currentMenu != "") {
		MouseOverMenu( 'header' + defaultMenu, 'link' + defaultMenu );
	}
}

function getStyle( elementId )
{
    if( document.getElementById ) {
        //DOM
        var theElement = document.getElementById( elementId );
    } else {
        if( document.all ) {
            //Proprietary DOM
            var theElement = document.all[ elementId ];
        } else {
            //Create an object to prevent errors further on
            var theElement = new Object();
        }
    }
    if( !theElement ) {
        /* The page has not loaded or the browser claims to support
        document.getElementById or document.all but cannot actually
        use either */
        return;
    }
    //Reference the style ...
    if( theElement.style ) { 
		theElement = theElement.style; 
		return theElement;
	}
	if( typeof( theElement.display ) == 'undefined' && !( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) {
	  //The browser does not allow us to change the display style
	  //Alert something sensible (not what I have here ...)
	  window.alert( 'Your browser does not support this' );
	  return;
	}
}

function changeDisplay( elementId, setTo ) {
	var theElement = getStyle( elementId );
	
	if( theElement ) {
		//Change the display style
		theElement.display = setTo;
	}
}

function setDefaultMenu( menuName, pageName )
{
	defaultMenu = menuName;
	MouseOverMenu( 'header' + menuName, 'link' + menuName );
	var theElement = document.getElementById( 'link' + menuName );
	if( theElement ) { // Netscape does not support style.color  (check on this later!)
		//theElement.style.color = "#FF3333";
		theElement.style.color = "rgb( 240, 0, 0 )";
		theElement.style.borderBottom = "thin solid rgb(175, 175, 175)";
		theElement.style.borderRight = "thin solid rgb(175, 175, 175)";
		theElement.style.borderTop = "thin solid rgb(212, 212, 212)";
		theElement.style.borderLeft = "thin solid rgb(212, 212, 212)";
		theElement.style.backgroundColor = "rgb(240, 240, 240)";
	}
	if( pageName != "" && document.getElementById( 'img' + menuName + pageName ) ) {
		document.images[ 'img' + menuName + pageName ].src = "/images/bullet_square_on.gif";
	}
}

function switchDisplay( displayItem )
{
	var theElement = getStyle( displayItem );
	
	if( theElement ) {
		if( theElement.display == "none" ) {
			theElement.display = "block";
		} else {
			theElement.display = "none";
		}
	}
}
