//////// INTERNAL FUNCTIONS ////////

timerArray = new Array(false, false, false, false, false, false, false, false, false, false);
closeTimerArray = new Array();

// ds: hideLayer ( 'layerName' )
//     internal functon to hide a layer
function hideLayer(layerName) {
	timerArray[getNr(layerName)] = true;
	closeTimerArray[getNr(layerName)] = setTimeout( 'setLayer ("' + layerName + '", getChildId("' + layerName + '"), "display", "none" );timer=false;', 50 );
}

// ds: showLayer ( 'layerName' )
//     internal function to show a layer
function showLayer(layerName) {
	if (timerArray[getNr(layerName)]) {
		clearTimeout(closeTimerArray[getNr(layerName)]);
		timerArray[getNr(layerName)] = false;
	}
	setLayer (layerName, getChildId(layerName), "display", "block");
}

// ds: setLayer ( 'layerName', childId, 'layerType', 'newStyle' )
//     internal function to change the value of a style attribute
//     of a layer within a layer
function setLayer(layerName, childId, layerType, newStyle) {
	if (timerArray[getNr(layerName)]) {
		clearTimeout(closeTimerArray[getNr(layerName)]);
		timerArray[getNr(layerName)] = false;
	}
 	document.getElementById(layerName).childNodes[childId].style[layerType] = newStyle;
}

// ds: getChildId ( 'layerName' )
//     internal function to get the childId of a layer within a
//     layer
function getChildId(layerName) {
	var path = document.getElementById(layerName);
	var childId = 666;
	
	for (var i=0; i<path.childNodes.length; i++) {
		if (path.childNodes[i].nodeName == "DIV") {
			childId = i;
		}
	}
	return childId;
}

// ds: getNr ( 'layerName' )
//     internal function to get the nr of the submenu
function getNr(layerName) {
	return layerName.charAt(3);
}