// ********************************************
// Farbaustausch für Subnavigation
// ********************************************


var BGColorDefault = new Array();
var BGColorHighlight = new Array();
var BGColorActive = new Array();
var CurMenuItemID = new Array();


// Hauptnavigation links
BGColorDefault [0] = '#153B63';
BGColorHighlight [0] = '#1B528C';
BGColorActive [0] = '#2269B5';
CurMenuItemID [0] = '';

// Unterkategorie-Navigation rechts
BGColorDefault [1]= '#B4C6D9';
BGColorHighlight [1] = '#A0B7CF';
BGColorActive [1]= '#8CA8C5';
CurMenuItemID [1] = '';

// Produkt-Navigation rechts
BGColorDefault [2]= '#B4C6D9';
BGColorHighlight [2] = '#A0B7CF';
BGColorActive [2]= '#8CA8C5';
CurMenuItemID [2] = '';

// Produkdaten-Kategorie-Navigation mitte
BGColorDefault [3] = '#FFFFFF';
BGColorHighlight [3] = '#A0B7CF';
BGColorActive [3] = '#DFE9F4';
CurMenuItemID [3] = '';

// Suchfenstertyp
var SIMPLE_SEARCH = 0;
var EXTENDED_SEARCH = 1;

document.write ('<style type="text/css">.script { display: block; }</style>');


function MenuHighlight (MenuItemID, Highlight, MenuID) { // Farbaustausch Mouseover

	if (document.all) {
		var DocMenuItemTD = eval ('document.all.menu' + MenuID + 'td' + MenuItemID);
		var DocMenuItemTDp = eval ('document.all.menu' + MenuID + 'td' + MenuItemID + 'p' );
		var Color = Highlight ? BGColorHighlight [MenuID] : BGColorDefault [MenuID];
		if (MenuItemID != CurMenuItemID [MenuID]) {
		  DocMenuItemTD.style.backgroundColor = Color;
		  DocMenuItemTDp.style.backgroundColor = Color;
		}
	}

} // function MenuHighlight


function PageStartup (MenuItemID, MenuID) {


  CurMenuItemID [MenuID] = MenuItemID;
  if (document.all && (navigator.userAgent.indexOf ('Opera') < 0) ) {
    var DocMenuItemTd = document.all['menu' + MenuID + 'td' + MenuItemID];
    var DocMenuItemTdP = document.all['menu' + MenuID + 'td' + MenuItemID + 'p'];
  } else if (document.getElementById) {
    var DocMenuItemTd = document.getElementById('menu' + MenuID + 'td' + MenuItemID);
    var DocMenuItemTdP = document.getElementById('menu' + MenuID + 'td' + MenuItemID + 'p');
  }
  if (DocMenuItemTd != null) {
    DocMenuItemTd.style.backgroundColor = BGColorActive [MenuID];
    DocMenuItemTdP.style.backgroundColor = BGColorActive [MenuID];
  }

} // function PageStartup


/* -----------------------------------

   Funktionen für Such-Formular

----------------------------------- */

function submitForm (iType) {
  
  var iWidth  = (iType == SIMPLE_SEARCH) ? 438 : 462;
  var iHeight = (iType == SIMPLE_SEARCH) ? 410 : 410;
    
  searchWin = openWindow (globalNeutralRoot + '/program/blank.htm', iWidth, iHeight, 20, 20, 'searchwin', wReturnWinHandle, wScrollBars + wResizable + wMenuBar + wLocationBar + wStatusBar);
  document.forms.searchform.submit ();
  searchWin.focus();
  return true;

} // function submitForm

/* -----------------------------------

   Allgemeine Funktionen

----------------------------------- */

var wScrollBars = 1;
var wResizable = 2;
var wLocationBar = 4;
var wMenuBar = 8;
var wStatusBar = 16;
var wDependent = 32;
var wReturnWinHandle = 64;

function openWindow (winUrl, winWidth, winHeight, winX, winY, winName, winPropsEnable, winPropsDisable) {

  winScrollBars = (winPropsEnable & wScrollBars) ? 'scrollbars=yes,' : ( (winPropsDisable & wScrollBars ) ? 'scrollbars=no,' : '' );
  winResizable = (winPropsEnable & wResizable) ? 'resizable=yes,' : ( (winPropsDisable & wResizable ) ? 'resizable=no,' : '' );
  winLocationBar = (winPropsEnable & wLocationBar) ? 'location=yes,' : ( (winPropsDisable & wLocationBar ) ? 'location=no,' : '' );
  winMenuBar = (winPropsEnable & wMenuBar) ? 'menubar=yes,' : ( (winPropsDisable & wMenuBar ) ? 'menubar=no,' : '' );
  winStatusBar = (winPropsEnable & wStatusBar) ? 'status=yes,' : ( (winPropsDisable & wStatusBar ) ? 'status=no,' : '' );
  winDependent = (winPropsEnable & wDependent) ? 'dependent=yes,' : ( (winPropsDisable & wDependent ) ? 'dependent=no,' : '' );

  newWin = window.open (winUrl, winName, 'left=' + winX + ',top=' + winY + ',innerWidth=' + winWidth + ',width=' + winWidth + ',innerHeight=' + winHeight + ',height=' + winHeight + ',' + winScrollBars + winResizable + winLocationBar + winMenuBar + winStatusBar + winDependent);

  return (winPropsEnable & wReturnWinHandle) ? newWin : false;

} // function openWindow


function goToPage (targetUrl, targetWindow, keepCurWindow, keepFocus) {

  if (!targetWindow.closed) {
    targetWindow.location.href = targetUrl;
  }
  if (!keepCurWindow) window.parent.close();
  if (keepFocus) window.focus; else targetWindow.focus();
  return (targetWindow.closed) ? true : false;

} // function goToPage


function printWindow () {

  if (window.print) window.print();

} // function printWindow


function OpenWindow (URL, Width, Height, Left, Top, Name, Resizable, ScrollBars, MenuBar, ToolBar, LocationBar, BookmarkBar, StatusBar, Dependent, HotKeys) {

	// Vorsicht bei NN: Wird die MenuBar angezeigt, wird ab Breiten kleiner 303 die Fensterhöhe vom NN falsch berechnet.

	// Testen, ob Positions- und Größen-Parameter angegeben und nicht zu groß sind
	if ( (Top == null) || isNaN (Top) ) Top = 20;
	if ( (Left == null) || isNaN (Left) ) Left = 20;
	if ( (Height == null) || isNaN (Height) || (Height + Top > screen.availHeight - 10) ) Height = screen.availHeight - 10 - Top;
	if ( (Width == null) || isNaN (Width) || (Width + Left > screen.availWidth - 10) ) Width = screen.availWidth - 10 - Left;
	Name = (Name == null) ? '' : Name; // Name = Leerstring, wenn kein Name angegeben ist
	// Testen, ob alle Parameter vorhanden sind, sonst Default-Werte vergeben

	Resizable = ((Resizable == null) || (Resizable == true)) ? 'yes' : 'no';
	ScrollBars = ((ScrollBars == null) || (ScrollBars == true)) ? 'yes' : 'no';
	MenuBar = ((MenuBar == null) || (MenuBar == false)) ? 'no' : 'yes';
	ToolBar = ((ToolBar == null) || (ToolBar == false)) ? 'no' : 'yes';
	LocationBar = ((LocationBar == null) || (LocationBar == false)) ? 'no' : 'yes';
	BookmarkBar = ((BookmarkBar == null) || (BookmarkBar == false)) ? 'no' : 'yes';
	StatusBar = ((StatusBar == null) || (StatusBar == true)) ? 'yes' : 'no';
	Dependent = ((Dependent == null) || (Dependent == true)) ? 'yes' : 'no';
	HotKeys = ((HotKeys == null) || (HotKeys == true)) ? 'yes' : 'no';

	// Für IE Fenstergrößen extra berechnen, da IE "innerWidth" und "InnerHeight" nicht beachtet.
	if (document.all) {
		Height += 31; // 31 Pixel höher für Fensterrahmen und Titelleiste des Fensters
		Width = Width + 12; // 12 Pixel breiter für den Fensterrahmen
		Height = (Resizable == 'no') ? Height - 2 : Height; // Der Fensterrahmen von Nicht-"Resizable"-Fenstern ist 2 Pixel schmaler.
		Width = (Resizable == 'no') ? Width - 2 : Width; // dto.
		Width = (ScrollBars == 'yes') ? Width + 16 : Width;
		Height = (MenuBar == 'yes') ? Height + 29 : Height;
		Height = (ToolBar == 'yes') ? Height + 47 : Height;
		Height = (LocationBar == 'yes') ? Height + 29 : Height; 
		var BarCompensation = (MenuBar == 'yes') ? 1 : 0; // je "Bar"-Paar werden wiederum 5 Pixel eingespart
		BarCompensation = (ToolBar == 'yes') ? BarCompensation + 1 : BarCompensation;
		BarCompensation = (LocationBar == 'yes') ? BarCompensation + 1 : BarCompensation;
		BarCompensation = (BarCompensation < 1) ? 1 : BarCompensation;
		Height -= ( (BarCompensation - 1) * 5);
		Height = (StatusBar == 'yes') ? Height + 20 : Height;
		// Fenster wieder verkleinern, falls es jetzt wieder zu groß ist
		if (!Width || isNaN (Width) || (Width > screen.availWidth - 10)) Width = screen.availWidth - 10;
		if (!Height || isNaN (Height) || (Height > screen.availHeight - 10)) Height = screen.availHeight - 10;
	}
	
	// Fenster mit den gegebenen Parametern öffnen
	NewWindow = window.open(URL, Name, 'screenX=' + Left + ',screenY=' + Top 
	+ ',height=' + Height + ',width=' + Width + ',innerHeight=' + Height + ',innerWidth=' + Width
	+ ',resizable=' + Resizable + ',scrollbars=' + ScrollBars + ',menubar=' + MenuBar 
	+ ',toolbar=' + ToolBar + ',location=' + LocationBar + ',directories=' + BookmarkBar 
	+ ',status=' + StatusBar + ',dependent=' + Dependent);

	if (navigator.appVersion.indexOf ('MSIE 5.0')) NewWindow.focus (); // IE 5.0 bricht hier sonst ab

	URL += ''; // IE versteht die URL nur so als String ...

	// Für IE muss extra positioniert. Der Fenster-Zugriff wird aber verweigert, wenn eine 
	// komplette HTTP-Adresse aufgerufen wird ...

	if (!NewWindow.innerWidth && (URL.indexOf ('http://') < 0)) {
		NewWindow.moveTo (Left, Top);
	}

	NewWindow.focus (); // Fenster ganz nach vorn stellen, also Focus auf das Fenster

	return false; // damit der HREF-Link nicht ausgeführt wird
	
} // function OpenWindow
