var BGColorDefault = '#153B63';
var BGColorHighlight = '#1B528C';
var BGColorActive = '#2269B5';

var BGColorDefaulthell = '#84BE7B';
var BGColorHighlighthell = '#33CC66';

var BGColorExt = '#B4C6D9';
var BGColorExtHigh = '#A0B7CF';

var CurMenuItemID = '';

var AlphabetImages = new Array ();

function MenuHighlight (MenuItemID, Highlight) {

	if (document.all) {
		var DocMenuItemTD = eval ('document.all.menutd' + MenuItemID);
		var DocMenuItemTDb = eval ('document.all.menutd' + MenuItemID + 'b' );
		var DocMenuItemTDc = eval ('document.all.menutd' + MenuItemID + 'c' );
		var Color = Highlight ? BGColorHighlight : BGColorDefault;
		if (MenuItemID != CurMenuItemID) DocMenuItemTD.style.backgroundColor = Color;
		if (MenuItemID != CurMenuItemID) DocMenuItemTDb.style.backgroundColor = Color;
		if (MenuItemID != CurMenuItemID) DocMenuItemTDc.style.backgroundColor = Color;
	}

} // function MenuHighlight

function ExtMenuHighlight (MenuItemID, Highlight) {

	if (document.all) {
		var DocMenuItemTD = eval ('document.all.menutd' + MenuItemID);
		var DocMenuItemTDb = eval ('document.all.menutd' + MenuItemID + 'b' );
		var Color = Highlight ? BGColorExtHigh : BGColorExt;
		if (MenuItemID != CurMenuItemID) DocMenuItemTD.style.backgroundColor = Color;
		if (MenuItemID != CurMenuItemID) DocMenuItemTDb.style.backgroundColor = Color;
	}

} // function MenuHighlight

function MenuHighlighthell (MenuItemID, Highlight) {

	if (document.all) {
		var DocMenuItemTD = eval ('document.all.menutd' + MenuItemID);
		var Color = Highlight ? BGColorHighlighthell : BGColorDefaulthell;
		if (MenuItemID != CurMenuItemID) DocMenuItemTD.style.backgroundColor = Color;
	}

} // function MenuHighlight


function PageStartup (MenuID) {

	var a = '';
	
	for (var i=65; i< 65+26; i++) {
		a = String.fromCharCode (i);
		AlphabetImages [a] = new Image;
		AlphabetImages [a].src = '../shared/letters/' + String.fromCharCode (i + 32) + '1.gif';
	}
	
	for (var i=0; i <= 9; i++) {
		AlphabetImages [String(i)] = new Image;
		AlphabetImages [String(i)].src = '../shared/letters/' + String(i) + '1.gif';
	}

	CurMenuItemID = MenuID;
  if (document.all && (navigator.userAgent.indexOf ('Opera') < 0) ) {
    var DocMenuItemTD = document.all['menutd' + MenuID];
    var DocMenuItemTDb = document.all['menutd' + MenuID + 'b'];
    var DocMenuItemTDc = document.all['menutd' + MenuID + 'c'];
    if (DocMenuItemTD != null) {
      DocMenuItemTD.style.backgroundColor = BGColorActive;
      DocMenuItemTDb.style.backgroundColor = BGColorActive;
      DocMenuItemTDc.style.backgroundColor = BGColorActive;
    }
	}

} // function PageStartup


function LetterHigh (LetterID) {

	document.images['alphabet' + LetterID].src = AlphabetImages [LetterID].src;
	
} // function LetterHigh 


function LetterLow (LetterID) {

	document.images['alphabet' + LetterID].src= '../shared/letters/' + LetterID + '0.gif';
	
} // function LetterHigh 

/* ----------------------------------------------------------------------

var whichSelected = "";

function highlightNavi(theID, which) {
	theFirst  = 'menutd' + theID;
	theSecond = theFirst + 'b';
	theThird  = theFirst + 'c';
	switch(which) {
 		case "sel":
 			document.getElementById(theFirst).style.backgroundColor=BGColorActive;
			document.getElementById(theSecond).style.backgroundColor=BGColorActive;
			document.getElementById(theThird).style.backgroundColor=BGColorActive;
 			whichSelected = theID;
 			break;
 		case "over":
 			//if((document.getElementById(theFirst).style.backgroundColor != BGColorActive) || (document.getElementById(theSecond).style.backgroundColor != BGColorActive) || (document.getElementById(theThird).style.backgroundColor != BGColorActive)) {
 				if(whichSelected != theID) {
 				//alert('item nicht selektiert');
 				document.getElementById(theFirst).style.backgroundColor=BGColorHighlight;
				document.getElementById(theSecond).style.backgroundColor=BGColorHighlight;
				document.getElementById(theThird).style.backgroundColor=BGColorHighlight;
 			} 
 			break;
 		case "out":
 			//if((document.getElementById(theFirst).style.backgroundColor != BGColorActive) || (document.getElementById(theSecond).style.backgroundColor != BGColorActive) || (document.getElementById(theThird).style.backgroundColor != BGColorActive)) {
 			if(whichSelected != theID) {
 				document.getElementById(theFirst).style.backgroundColor=BGColorDefault;
				document.getElementById(theSecond).style.backgroundColor=BGColorDefault;
				document.getElementById(theThird).style.backgroundColor=BGColorDefault;
 			}
 			break;
	}	
}

function resetNavi() {
	if(whichSelected != "") {
		theFirst  = 'menutd' + whichSelected;
		theSecond = theFirst + 'b';
		theThird  = theFirst + 'c';
		document.getElementById(theFirst).style.backgroundColor=BGColorDefault;
		document.getElementById(theSecond).style.backgroundColor=BGColorDefault;
		document.getElementById(theThird).style.backgroundColor=BGColorDefault;
	}
}

 ---------------------------------------------------------------------- */
var isActive = false;

// setzt alle Menüpunkte farblich auf Ausgangsbasis
// ctr entspricht der Gesamtzahl aller Menüpunkte
function resetNavi(ctr) {
	for(i=0; i<=ctr; i++) {
		var strCtr = '';
		if(i < 10) {
			strCtr = '0' + String(i);
		} else {
			strCtr = String(i);
		}
		theFirst  = 'menutd' + strCtr;
		theSecond = theFirst + 'b';
		theThird  = theFirst + 'c';
		document.getElementById(theFirst).style.backgroundColor=BGColorDefault;
		document.getElementById(theSecond).style.backgroundColor=BGColorDefault;
		document.getElementById(theThird).style.backgroundColor=BGColorDefault;
	}
}

// setzt den als Parameter übergebenen Menüpunkt farblich auf ausgewählt
function highlightItem(id) {
	theFirst  = 'menutd' + id;
	theSecond = theFirst + 'b';
	theThird  = theFirst + 'c';
	document.getElementById(theFirst).style.backgroundColor=BGColorActive;
	document.getElementById(theSecond).style.backgroundColor=BGColorActive;
	document.getElementById(theThird).style.backgroundColor=BGColorActive;
}

function checkIfActive(theID, which) {
	if(!isActive) {
		switch(which) {
 		case "out":
 			return MenuHighlight (theID, false);
 			break;
 		case "over":
 			return MenuHighlight (theID, true); 
 			break;
 		}
	}
}