var time = 3000;
var numofitems = 3;
var globalMenuEnable = 0;

// alert("Tools included");
function change_bereich(form)
{
	document.forms[form].elements['siteBereich'].value = "";
	document.forms[form].submit();
}

//menu constructor
function menu(allItems, thisItem, startState) 
{
  callName= "gl" + thisItem;
  divName="subglobal" + thisItem;  
  
  this.numberofmenuitems = allItems;
  this.caller = document.getElementById(callName);
  this.theDiv = document.getElementById(divName);
  this.theDiv.style.visibility = startState;
}

//menu methods
function ehandler(event,theObj)
{
	if (globalMenuEnable == 1) {
		for (var i = 1; i <= theObj.numberofmenuitems; i++) {
    		var shutDiv = eval( "menuitem" + i + ".theDiv");
			
    		shutDiv.style.visibility = "hidden";
		}
		
	    theObj.theDiv.style.visibility = "visible";
	}
}
				
function closesubnav(event){
	if (globalMenuEnable == 1) {
		if ((event.clientY < 48) || (event.clientY > 127)) {
    		for (var i=1; i<= numofitems; i++) {
      			var shutDiv = eval('menuitem' + i + '.theDiv');
				shutDiv.style.visibility = 'hidden';
		    }
  		}
	}
}

function hide(p_section) {
	var e = document.getElementById( p_section );
	var m = document.getElementById( p_section + "Mnu" );
	
	if (e != undefined ) {
		e.style.display = "none";
	}
	if ( m != undefined ) {
		m.style.fontWeight = "";
	}
}


function hide_all() {
	for ( var i in v_sections) {
		hide ( v_sections[i] );
	}
}
								
// This travels up from the given node until it finds a parent
// who has the given tag name.
function GetParentNodeWithTagName( objNode, strTagName ){
	// Lowercase the tag name for comparison.
	strTagName = strTagName.toLowerCase();
	
	// Crawl up the parent node chain. Keep crawling until we find the 
	// node with the proper tag name, we hit a null node, or we hit 
	// a non-text node that has not tag name (the document object).
	for ( 
		objNode = objNode.parentNode ; 
		(
			objNode && (			
				(objNode.tagName && (objNode.tagName.toLowerCase() != strTagName)) ||
				(!objNode.tagName && (objNode.nodeType != 3)) 
			)
		);
		objNode = objNode.parentNode
		) {
		// Nothing has to be done within in the FOR loop. We are purely
		// using the FOR loop to crawl up the DOM structure.
	}

	// Return the node. At this point, it might contains a valide
	// parent node, or it might be null.
	return( objNode );
}
		
function show(p_section) {
	var e = document.getElementById( p_section );
	var m = document.getElementById( p_section + "Mnu" );

	if ( m != undefined ) {
		var objParent = GetParentNodeWithTagName( m, 'div' );
		
		if ( objParent != null ) {
			var s = objParent.getAttribute( "id" );

			if (s != "sectionLinks") {
				show(s);
			}
		}
		m.style.fontWeight = "bold";
	}
	
	if (e != undefined ) {
		e.style.display = "";
	}
}
