/* ======================================

   Farben für die einzelnen Menüs

====================================== */
// function tMenu (menuName, bgColorDefault, bgColorHighlight, bgColorActive, ...)
var menu = new Array ();
menu[0] = new tMenu ('navi', '#153B63', '#1B528C', '#2269B5');
menu[1] = new tMenu ('navigreen', '#00664A', '#008F68', '#00CF88');
menu[2] = new tMenu ('navigreen02', '#00826C', '#12A592', '#23C8B8');
menu[3] = new tMenu ('navicontent', '#1B528C', '#2269B5', '#2269B5');
menu[4] = new tMenu ('navicontentgreen', '#E9F5EE', '#A7DCBC', '#A7DCBC');
menu[5] = new tMenu ('navicontentgreen02', '#DEF3EF', '#83D0B8', '#83D0B8');
menu[6] = new tMenu ('navilist', '#FFFFFF', '#DFE9F4', '#DFE9F4');
menu[7] = new tMenu ('navilistgreen', '#FFFFFF', '#E9F5EE', '#E9F5EE');
menu[8] = new tMenu ('navilistgreen02', '#FFFFFF', '#DEF3EF', '#DEF3EF');
menu[9] = new tMenu ('navirechts', '#DFE9F4', '#B4C6D9', '#B4C6D9');
menu[10] = new tMenu ('navirechtsgreen', '#E9F5EE', '#A7DCBC', '#A7DCBC');
menu[11] = new tMenu ('navirechtsgreen02', '#DEF3EF', '#83D0B8', '#83D0B8');
menu[12] = new tMenu ('additionalnavi', '#B4C6D9', '#A0B7CF', '#8CA8C5');




/* ======================================

   Menü-Funktionen

====================================== */

// Highlight or un-highlight menu items
function MenuHighlight (MenuItemID, Highlight, menuId) {

  if (debug && !Highlight) window.status = 'Menüpunkt-ID: ' + MenuItemID + ', Menü-ID: ' + menuId;
  menuId = (menuId == null) ? 0 : menuId;
  if (Highlight == 2) {
    menu[menuId].curItemName = MenuItemID;
  }

  var tdIterator = 0;
  var DocMenuItemTD = '';
  var Color = Highlight ? menu[menuId].bgColorHighlight : menu[menuId].bgColorDefault;
  Color = (Highlight == 2) ? menu[menuId].bgColorActive : Color; // Highlight Page Menu Item
  
  // Highlight all TDs which build the menu item
	if (document.all) {
	  while ( (DocMenuItemTD = eval ('document.all.td' + MenuItemID + 't' + tdIterator) ) && ( (MenuItemID != menu[menuId].curItemName) || (Highlight == 2) ) ) {

 		  DocMenuItemTD.style.backgroundColor = Color;
  		tdIterator++;
		} 
	} else if (document.body) {
	  DocMenuItemTD = document.getElementsByTagName ('td')['td' + MenuItemID + 't' + tdIterator];
	  while ( DocMenuItemTD && ( (MenuItemID != menu[menuId].curItemName) || (Highlight == 2) ) ) {
  	  DocMenuItemTD.style.backgroundColor = Color;
  		tdIterator++;
  		DocMenuItemTD = document.getElementsByTagName ('td')['td' + MenuItemID + 't' + tdIterator] 
		} 
	}

} // function MenuHighlight


function PageStartup () {

	// Select whether position properties need to be set as numbers or e. g. '12px'
	if (document.body) {
		document.getElementsByTagName ('body')[0].style.left = 0;
		px = (String(document.getElementsByTagName ('body')[0].style.left).indexOf ('p') == -1) ? '' : 'px';
	} else {
		px = 0;
	}
	
  // Highlight current page menu item(s)
  var menuItemId, menuId;
  for (var i=0; i < PageStartup.arguments.length; i=i+2) {
    menuItemId = PageStartup.arguments[i];
    menuId = (PageStartup.arguments[i+1] != null) ? PageStartup.arguments[i+1] : 0;
    MenuHighlight (menuItemId, 2, menuId);
    menu[menuId].pageItemName = menuItemId;
    // open all menu items above menuItemId
    itemNameArray = menuItemId.split('cm');
    var predecItemName = 'dv';
    for (var l = 1; l < itemNameArray.length; l++) {
      predecItemName += 'cm' + itemNameArray[l];
      if (l > 1) clickItem (getItemById (predecItemName), menuId, true);
    }
  }	

} // function PageStartup




/* ======================================

   Constants, global variables, type constructors

====================================== */


// "Konstanten" zur Browser-Kompatibilität
var px = '';
var visible = (document.layers) ? 'show' : 'visible';
var hidden = (document.layers) ? 'hide' : 'hidden';

function tMenu (menuName, bgColorDefault, bgColorHighlight, bgColorActive, left, top, isPopUp, opensOnMouseOver, opensOnlyOneItem) {
	
	this.name = menuName;
	this.bgColorDefault = bgColorDefault;
	this.bgColorHighlight = bgColorHighlight;
	this.bgColorActive = bgColorActive;
	this.left = left;
	this.top = top;
	this.isPopUp = isPopUp;
	this.opensOnMouseOver = opensOnMouseOver;
	this.opensOnlyOneItem = opensOnlyOneItem;

	this.curItemName = '';
	this.pageItemName = '';
	this.isCurItemOpen = false;
	this.MouseOutTimeout = 0;
	// this.item = new Array();
	
} // function tMenu 


/* ======================================

   Debug stuff

====================================== */

var debug = false;


function dm (message) {
  
  if ( debug && (document.forms.debug) ) alert (message); // document.forms.debug.elements.dta.value += message + '\n';
  
} // function dm 



/* ======================================

   Open external product special windows

====================================== */


function open540421 (url) {
// Verwendet bei: Productspecials (GW)
	params = "width=540,height=421,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}

function open720583 (url) {
// Verwendet bei: Productspecials (GW) 
	params = "width=720,height=539,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}

function open520340 (url) {
// Verwendet bei: Productspecials (GW) 
	params = "width=520,height=340,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}

function open468500 (url) {
// Verwendet bei: Händlersuche, Newsletter
	params = "width=468,height=500,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}

function open565504 (url) {
// Verwendet bei: BSS Händlersuche
	params = "width=565,height=504,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}


function open550310 (url) {
// Verwendet bei: Messekalender (GW) 
	params = "width=550,height=310,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}

function open400550 (url) {
// Verwendet bei: Bildschirmhintergruende 
	params = "width=400,height=550,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}

function open344305 (url) {
// Verwendet bei: news008.htm (GW) 
	params = "width=344,height=305,resizable=0,status=0,scrollbars=0,toolbar=0,location=0,directories=0,menubar=0";
	var newwin = window.open(url, "special", params);
	newwin.focus();
	if (newwin) return false;
}

function open600640 (url) {
// Verwendet bei: Anfahrtskizze
	params = "width=600,height=640,resizable=0,status=0,scrollbars=no,toolbar=0,location=0,directories=0,menubar=0,top=0,left=0";
	var newwin = window.open(url, "special", params);
	if (newwin) return false;
}

function open720502 (url) {
// Verwendet bei: Produktspecials BLAU im extra Fenster
	params = "width=684,height=502,resizable=0,status=0,scrollbars=no,toolbar=0,location=0,directories=0,menubar=0,top=0,left=0";
	var newwin = window.open(url, "special", params);
	if (newwin) return false;
}
