//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Funktionen für das Menü
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var undefined;
var istbild=0;
var warbild=0;
var uistbild=0;
var uwarbild=0;
var zistbild=0;
var zwarbild=0;


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Allgemeine Funktionen
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// onMouseover Funktion Hauptmenü
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var menu=new Array;
var menu2=new Array;

for (var i=1;i<6;i++){  
  continue;
  menu[i] = new Image();
  menu2[i] = new Image();
  menu[i].src="/kiosk/grafik/menue_"+i+".gif";
  menu2[i].src="/kiosk/grafik/menue_"+i+"_.gif";
}

function over(x){
  document.images["men"+x].src=menu2[x].src;
}

function out(x){
  warbild=istbild;
  if (warbild != x){
    document.images["men"+x].src=menu[x].src;
  }
}

function fix(x){
  warbild=istbild;

  if (warbild != 0){
    document.images["men"+warbild].src=menu[warbild].src;
  }
  if (x != 0){
    document.images["men"+x].src=menu2[x].src;
  }
  istbild=x;
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// onMouseover Funktion Untermenü
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var umenu=new Array;
var umenu2=new Array;

for (var i=1;i<21;i++){
  continue;
  umenu[i] = new Image();
  umenu2[i] = new Image();
  umenu[i].src="/kiosk/grafik/umenue_"+i+".gif";
  umenu2[i].src="/kiosk/grafik/umenue_"+i+"_.gif";
}

function u_over(x){
  document.images["umen"+x].src=umenu2[x].src;
}

function u_out(x){
  uwarbild=uistbild;
  if (uwarbild != x){
    document.images["umen"+x].src=umenu[x].src;
  }
}

function u_fix(x){
  uwarbild=uistbild;

  if (uwarbild != 0){
    document.images["umen"+uwarbild].src=umenu[uwarbild].src;
  }
  if (x != 0){
    document.images["umen"+x].src=umenu2[x].src;
  }
  uistbild=x;
}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// onMouseover Funktion Zusatzmenü
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var zmenu=new Array;
var zmenu2=new Array;

for (var i=1;i<5;i++){
  continue;
  zmenu[i] = new Image();
  zmenu2[i] = new Image();
  zmenu[i].src="/kiosk/grafik/zmenue_"+i+".gif";
  zmenu2[i].src="/kiosk/grafik/zmenue_"+i+"_.gif";
}

function z_over(x){
  document.images["zmen"+x].src=zmenu2[x].src;
}

function z_out(x){
  zwarbild=zistbild;
  if (zwarbild != x){
    document.images["zmen"+x].src=zmenu[x].src;
  }
}

function z_fix(x){
  zwarbild=zistbild;

  if (zwarbild != 0){
    document.images["zmen"+zwarbild].src=zmenu[zwarbild].src;
  }
  if (x != 0){
    document.images["zmen"+x].src=zmenu2[x].src;
  }
  zistbild=x;
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Funktion zum dynamischen Setzen eines layer-Ausdrucks
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++

function ausdruckSetzen()
{

  var idname = ausdruckSetzen.arguments[0];

  if (document.getElementById(idname))
  {
    return document.getElementById(idname);
  }
  else
  {
    //alert('Es gibt keinen Layer mit der id \'' + idname + '\'');
    return undefined;
  }

}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Untermenü ein-/ausblenden
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++

var waruntermen = 0;
var istuntermen = 0;

function untermenue(name,x)
{

  waruntermen = istuntermen;

  if (waruntermen != 0)
  {
    var id = String(name + waruntermen);
    var ausdruck = ausdruckSetzen(id);

    if (ausdruck != undefined)
    {
      ausdruck.style.display = 'none';
    }
  }

  if (x != 0)
  {
    if (x != waruntermen)
    {
      var id = String(name + x);
      var ausdruck = ausdruckSetzen(id);

      if (ausdruck != undefined)
      {
        ausdruck.style.display = 'block';
      }
    }
  }
  else
  {
    for (var i=1; i<6; i++)
    {
      var id = String(name + i);
      var ausdruck = ausdruckSetzen(id);

      if (ausdruck != undefined)
      {
        ausdruck.style.display = 'none';
      }
    }
  }

  if (waruntermen == x)
  {
    istuntermen = 0;
  }
  else
  {
    istuntermen = x;
  }

}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// PopUp-Funktion
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var popupSettings = {};

popupSettings['default'] = '';

popupSettings['Anfahrt'] = 'width=508,height=561,scrollbars=yes';
popupSettings['Aktuelles'] = 'width=508,height=561';
popupSettings['Popup'] = 'width=508,height=561,scrollbars=yes';
popupSettings['Bildergalerie'] = 'width=508,height=561';
popupSettings['Telefon'] = 'width=508,height=561';
popupSettings['Video'] = 'width=508,height=561';

function openPopup(url,windowName,settingsID) {

  var settings;
  var newWindow;

  if (popupSettings[settingsID]) {
    settings = popupSettings[settingsID];
  } else {
    settings = popupSettings['default'];
  }

  newWindow = window.open(url,windowName,settings);
  newWindow.focus();

}


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Funktion zum Bildertausch
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

var zaehler = 1;

function tausche_bilder() {

	var richtung = tausche_bilder.arguments[0];
	var bildid = tausche_bilder.arguments[1];
	var pfadname = tausche_bilder.arguments[2];
	var maximum = tausche_bilder.arguments[3];
	var pfad = new String();

	if (richtung == 'vor') {

		zaehler += 1;

	} else {

		zaehler -= 1;

	}

	if (zaehler == 0) {

		zaehler = maximum;

	}

	if (zaehler > maximum) {

		zaehler = 1;

	}

	pfad = String(pfadname + zaehler + '.jpg');

	document.images[bildid].src = pfad;

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// BLUR Funktion
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function unsetFocusBorder() {
 var arr = document.getElementsByTagName('a');
 if (arr){
   for (var i=0; i<arr.length; i++) {
     arr[i].onfocus = arr[i].blur;
   }
 }
} 

//==================================================================================
//==================================================================================
//
// Navigation-Tool
// OO-PROGRAMMIERUNG
// AUTOR: DF
// © rdts AG
// ERSTELLT: 01.07.2005
//
// Menus für IE- und GECKO-Browser
//
//==================================================================================
//==================================================================================

var undefined;

// ################################################################################
// #############################################################|  Navigation   |##
// ################################################################################

// ============================================================
// Klasse Navigation
// ============================================================
//
// Konstruktor:
// ------------
//   + Navigation()
//
// Eigenschaften:
// --------------
//   + _id : id (readonly)
//   + _navigationStructure : Object (readonly)
//   + _registerStructureItem : NavigationItem (readonly)
//   + _direction : str (readonly) (horizontal, vertical)
//   + _dependVertical : str (readonly) (top, middle, bottom)
//   + _dependHorizontal : str (readonly) (right, left)
//   + _highlightActiveRoot : str (readonly) (no, yes)
//   + _highlightActiveClassPostfix : str (readonly)
//   + _rootLeft : number (readonly)
//   + _rootTop : number (readonly)
//   + _differenceVertical : number (readonly)
//   + _differenceHorizontal : number (readonly)
//   + _chacheRoot = '';
//   + _chacheRootHTMLString = undefined;
//   + _containerIDPrefix : str (readonly)
//   + _menuInUse : boolean (readonly)
//   + _itemIDPrefix : str (readonly)
//   + _activeMenu: Object (readonly)
//   + _timeout : str (readonly)
//   + _delay : number (readonly)
//   + _getNavigationStructureHTMLRoot

//
// Methoden:
// ---------
//   + _setID(str) : void
//   + _setNavigationStructure(obj) : void
//   + _setRegisterStructureItem(obj:NavigationItem) : void
//   + setDirection(str) : void
//   + setDependVertical(str) : void
//   + setDependHorizontal(str) : void
//   + setDifferenceVertical(n) : void
//   + setDifferenceHorizontal(n) : void
//

// ------------------------------------------------------------
// Konstruktor
// ------------------------------------------------------------

function Navigation(id) {
  if (arguments.length>1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  // Attribute
  this._id = undefined;
  this._setID(id);
  this._navigationAllowedStatus = undefined;
  this._direction = 'horizontal';
  this._dependVertical = 'top';
  this._dependHorizontal = 'right';
  this._highlightActiveRoot = 'no';
  this._highlightActiveClassPostfix = undefined;
  this._rootLeft = 0;
  this._rootTop = 0;
  this._differenceVertical = 0;
  this._differenceHorizontal = 0;
  this._navigationStructure = {};
  this._registerStructureItem = {};
  this._chacheRoot = '';
  this._chacheRootHTMLString = undefined;
  this._activeMenu = {};
  this._menuInUse = false;
  this._containerIDPrefix = this.id() + '_Nav';
  this._itemIDPrefix = this.id() + '_Item';
  this._timeout = undefined;
  this._delay = undefined;
  this._getNavigationStructureHTMLRoot = true;
  
  this.setDelay(1000);
}

// toString()
Navigation.prototype.toString = function() {
  return "\n[Navigation - id: " + this + "]\n";
}

// ------------------------------------------------------------
// Zugriffsmethoden
// ------------------------------------------------------------

// -------
// _id
// -------
Navigation.prototype.id = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._id = str;
  }
  return this._id;
}

// -------
// navigationStructure
// -------
Navigation.prototype.navigationStructure = function(obj) {
  if (arguments.length) {
    if (typeof obj != "object") {
      focus();
      throw new Error("Argument ist nicht vom Typ Object!");
    }
    this._navigationStructure = obj;
  }
  return this._navigationStructure;
}

// -------
// navigationStructure
// -------
Navigation.prototype.registerStructureItem = function(obj) {
  if (arguments.length) {
    if (typeof obj != "object") {
      focus();
      throw new Error("Argument ist nicht vom Typ Object!");
    }
    this._registerStructureItem = obj;
  }
  return this._registerStructureItem;
}

// -------
// _direction
// -------
Navigation.prototype._direction = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._direction = str;
  return this._direction;
}

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// -------
// _setID
// -------
Navigation.prototype._setID = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.id(str);
}

// -------
// _setRegisterStructureItem
// -------
Navigation.prototype._setRegisterStructureItem = function(obj) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof obj != "object") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.registerStructureItem(obj);
}

// -------
// _setRootPosition
// -------
Navigation.prototype._setRootPosition = function() {
  var id = this._containerIDPrefix + 'root';
  if (document.getElementById(id)){
    var elem = document.getElementById(id);
    if (elem.offsetParent){
      elem = elem.offsetParent;
    }
    this._rootLeft = elem.offsetLeft;
    this._rootTop = elem.offsetTop;
  }
}

// -------
// _getNavigationStructureHTML
// -------
Navigation.prototype._getNavigationStructureHTML = function(structure, html, id, loopPosition) {
  var containerClassName = '';
  var first = undefined;
  if (loopPosition == 1){
    first = true;
  }
  var containerStyle = 'display: none;';
  if (this._getNavigationStructureHTMLRoot){
    containerStyle = 'display: block;';    
  }
  if (NavigationItem.hasInstance(id) && NavigationItem.getInstance(id).style()){
    containerStyle += NavigationItem.getInstance(id).style();
  }
  if (NavigationItem.hasInstance(id) && NavigationItem.getInstance(id).className()){
    containerClassName = 'class="'+ NavigationItem.getInstance(id).className() +'"';
  }
  this._getNavigationStructureHTMLRoot = false;
  if (this._direction == 'vertical'){
    if (loopPosition > 1 &&  loopPosition <= 2){
      html += '<div id="'+ id +'"  '+ containerClassName +' style="'+ containerStyle +' position: absolute;">';
    } else  if (loopPosition > 2){
      html += '<div id="'+ id +'"  '+ containerClassName +' style="'+ containerStyle +' position: static;">';
    } else {
      html += '<div id="'+ id +'" '+ containerClassName +' style="'+ containerStyle +' position: absolute;">';
    }
    for (var i in structure){
      var id = this._containerIDPrefix + i;
      var cssStyle = '';
      var cssClassName = '';
      var href = 'href="javascript:void(0);"';
      var target = '';
      var onclick = '';
      var label = this.registerStructureItem()[id].label();
      var title = '';
      //title += 'title="Menupunkt: '+ label +'"';
      if (this.registerStructureItem()[id].style()){
        cssStyle = 'style="' + this.registerStructureItem()[id].style() + '" ';
      }
      if (this.registerStructureItem()[id].className()){
        cssClassName = 'class="' + this.registerStructureItem()[id].className() + '" ';
      }
      if (this.registerStructureItem()[id].href()){
        href = 'href="' + this.registerStructureItem()[id].href() + '" ';
      }
      if (this.registerStructureItem()[id].target()){
        target = 'target="' + this.registerStructureItem()[id].target() + '" ';
      }
      if (this.registerStructureItem()[id].onclick()){
        onclick = 'onclick="' + this.registerStructureItem()[id].onclick();
      } else {
        //onclick = 'onclick="Navigation.getInstance(\''+ this.id() +'\').displaySubmenu(\''+ this.registerStructureItem()[id].id() +'\');"';
      }
      if (this.registerStructureItem()[id].title()){
        title = 'title="' + this.registerStructureItem()[id].title() + '" ';
      }
      if (first){
        html += '<div id="'+ this._itemIDPrefix + this.registerStructureItem()[id].id() +'" style="position: static; float: left;">\n';
      } else {
        html += '<div id="'+ this._itemIDPrefix + this.registerStructureItem()[id].id() +'" style="position: static;">\n';
      }
      if (this._dependVertical == 'top'){
        if (typeof structure[i] == 'object'){
          html += this._getNavigationStructureHTML(structure[i], '', id, loopPosition+1);
        } 
      }
      if (this.registerStructureItem()[id].type() == 0){
        if (this.registerStructureItem()[id].subClassName()){
          cssClassName = 'class="' + this.registerStructureItem()[id].subClassName() + '" ';
        }
        if (this.registerStructureItem()[id].subStyle()){
          cssStyle = 'style="' + this.registerStructureItem()[id].subStyle() + ' display: block;" ';
        }
        if (first){
          html += '<a id="button_'+ this.registerStructureItem()[id].id() +'" '+ href +' '+ cssStyle +' '+ cssClassName +' '+ target +' '+ onclick +' onmouseout="Navigation.getInstance(\''+ this.id() +'\').collapseMenu();" onmouseover="Navigation.getInstance(\''+ this.id() +'\').displaySubmenu(\''+ this.registerStructureItem()[id].id() +'\');" '+ title +'>' + label +'</a>\n';
        } else {
          html += '<a id="button_'+ this.registerStructureItem()[id].id() +'" '+ cssStyle +' '+ cssClassName +' '+ target +' '+ onclick +' onmouseout="Navigation.getInstance(\''+ this.id() +'\').collapseMenu();" '+ title +'>' + label +'</a>\n';
        }
      } else {
        html += '<a id="button_'+ this.registerStructureItem()[id].id() +'" '+ href +' '+ cssStyle +' '+ cssClassName +' '+ target +' '+ onclick +' onmouseout="Navigation.getInstance(\''+ this.id() +'\').collapseMenu();" onmouseover="Navigation.getInstance(\''+ this.id() +'\').displaySubmenu(\''+ this.registerStructureItem()[id].id() +'\');" '+ title +'>' + label +'</a>\n';
      }
      if (this._dependVertical != 'top'){
        if (typeof structure[i] == 'object'){
          html += this._getNavigationStructureHTML(structure[i], '', id, loopPosition+1);
        } 
      } 
      html += '</div>\n'; 
    }
    html += '</div>';
  } else {
    html += '<div id="'+ id +'"  '+ containerClassName +' style="'+ containerStyle +' position: absolute;">\n';
    for (var i in structure){
      var id = this._containerIDPrefix + i;
      var cssStyle = '';
      var cssClassName = '';
      var href = 'href="javascript:void(0);"';
      var target = '';
      var onclick = '';
      //var onclick = this._chacheRoot +'Navigation.getInstance(\''+ this.id() +'\').displaySubmenu(\''+ this.registerStructureItem()[id].id() +'\'); ';
      var label = this.registerStructureItem()[id].label();
      var title = '';
      //title += 'title="Menupunkt: '+ label +'"';
      if (this.registerStructureItem()[id].style()){
        cssStyle = 'style="' + this.registerStructureItem()[id].style() + '" ';
      }
      if (this.registerStructureItem()[id].className()){
        cssClassName = 'class="' + this.registerStructureItem()[id].className() + '" ';
      }
      if (this.registerStructureItem()[id].href()){
        href = 'href="' + this.registerStructureItem()[id].href() + '" ';
      }
      if (this.registerStructureItem()[id].target()){
        target = 'target="' + this.registerStructureItem()[id].target() + '" ';
      }
      if (this.registerStructureItem()[id].onclick()){
        onclick += this.registerStructureItem()[id].onclick() + ' ';
      }
      if (this.registerStructureItem()[id].title()){
        title = 'title="' + this.registerStructureItem()[id].title() + '" ';
      }
      if (first){
        html += '<div id="'+ this._itemIDPrefix + this.registerStructureItem()[id].id() +'" style="float: left;">\n';
      } else {
        html += '<div id="'+ this._itemIDPrefix + this.registerStructureItem()[id].id() +'" style="">\n';
      }
      //html += '<div id="'+ this._itemIDPrefix + this.registerStructureItem()[id].id() +'" style="position: static; border:">\n';
      if (this.registerStructureItem()[id].type() == 0){
        if (this.registerStructureItem()[id].subClassName()){
          cssClassName = 'class="' + this.registerStructureItem()[id].subClassName() + '" ';
        }
        if (this.registerStructureItem()[id].subStyle()){
          cssStyle = 'style="display: block; ' + this.registerStructureItem()[id].subStyle() + '" ';
        }
        html += '<a id="button_'+ this.registerStructureItem()[id].id() +'" '+ href +' '+ cssStyle +' '+ cssClassName +' '+ target +' '+ onclick +' onmouseout="'+ this._chacheRoot +'Navigation.getInstance(\''+ this.id() +'\').collapseMenu();" onmouseover="'+ this._chacheRoot +'Navigation.getInstance(\''+ this.id() +'\').displaySubmenu(\''+ this.registerStructureItem()[id].id() +'\');" '+ title +'>' + label +'</a>\n';
        //html += '<a id="button_'+ this.registerStructureItem()[id].id() +'" '+ href +' '+ cssStyle +' '+ cssClassName +' '+ target +' onclick="'+ onclick +'" onmouseout="'+ this._chacheRoot +'Navigation.getInstance(\''+ this.id() +'\').collapseMenu();" '+ title +'>' + label +'</a>\n';
      } else {
        html += '<a id="button_'+ this.registerStructureItem()[id].id() +'" '+ href +' '+ cssStyle +' '+ cssClassName +' '+ target +' '+ onclick +' onmouseout="'+ this._chacheRoot +'Navigation.getInstance(\''+ this.id() +'\').collapseMenu();" onmouseover="'+ this._chacheRoot +'Navigation.getInstance(\''+ this.id() +'\').displaySubmenu(\''+ this.registerStructureItem()[id].id() +'\');" '+ title +'>' + label +'</a>\n';
        //html += '<a id="button_'+ this.registerStructureItem()[id].id() +'" '+ href +' '+ cssStyle +' '+ cssClassName +' '+ target +'  onclick="'+ onclick +'" onmouseout="'+ this._chacheRoot +'Navigation.getInstance(\''+ this.id() +'\').collapseMenu();" '+ title +'>' + label +'</a>\n';
      }
      html += '</div>\n';
    } 
    if (first){
      html += '<div class="float-aufheben"><br /></div>\n';
    }
    html += '</div>\n';
    loopPosition++;
    for (var i in structure){
      var id = this._containerIDPrefix + '' + i;
      if (typeof structure[i] == 'object'){
        html += this._getNavigationStructureHTML(structure[i], '', id, loopPosition);
      } 
    }
  }
  return html;
}

// -------
// _setHighlightedItems
// -------
Navigation.prototype._setHighlightedItems = function(id) {
  var items = [];
  var activeItem = NavigationItem.getInstance(id);
  items.push(activeItem);
  for (var i=0; i<items.length; i++){
    var elem = document.getElementById('button_' + items[i].id());
    if (elem){
      var className = items[i].subClassName() + this._highlightActiveClassPostfix;
      elem.className = className;
    }  
  }
}

// -------
// _setOffHighlightedItems
// -------
Navigation.prototype._setOffHighlightedItems = function(id) {
  var items = [];
  var activeItem = NavigationItem.getInstance(id);
  items.push(activeItem);
  for (var i=0; i<items.length; i++){
    var elem = document.getElementById('button_' + items[i].id());
    if (elem){
      var className = items[i].subClassName();
      elem.className = className;
    }  
  }
}


// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// -------
// setDirection
// -------
Navigation.prototype.setDirection = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._direction = str;
}

// -------
// setChacheRoot
// -------
Navigation.prototype.setChacheRoot = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._chacheRoot = str;
}

// -------
// setChacheRootHTMLString
// -------
Navigation.prototype.setChacheRootHTMLString = function(obj) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof obj != "object") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._chacheRootHTMLString = obj;
}

// -------
// getNavigationAllowedStatus
// -------
Navigation.prototype.getNavigationAllowedStatus = function() {
  if (document.getElementById){
    this._navigationAllowedStatus = true;
  }
  return this._navigationAllowedStatus;
}

// -------
// setDelay
// -------
Navigation.prototype.setDelay = function(n) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (!NavigationTools.checkNumber(n)) {
    focus();
    throw new Error("Argument ist nicht vom Typ Number!");
  }
  if (document.all){
    if (n < 1200){
      n = n + (n/5);
    }
  }
  this._delay = n;
}

// -------
// setHighlightActiveRoot
// -------
Navigation.prototype.setHighlightActiveRoot = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._highlightActiveRoot = str;
}

// -------
// setHighlightActiveRoot
// -------
Navigation.prototype.setHighlightActiveClassPostfix = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._highlightActiveClassPostfix = str;
}

// -------
// setDependHorizontal
// -------
Navigation.prototype.setDependHorizontal = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._dependHorizontal = str;
}

// -------
// setDependVertical
// -------
Navigation.prototype.setDependVertical = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this._dependVertical = str;
}

// -------
// setDifferenceVertical
// -------
Navigation.prototype.setDifferenceVertical = function(n) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (!NavigationTools.checkNumber(n)) {
    focus();
    throw new Error("Argument ist nicht vom Typ Number!");
  }
  this._differenceVertical = n;
}

// -------
// setDifferenceHorizontal
// -------
Navigation.prototype.setDifferenceHorizontal = function(n) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (!NavigationTools.checkNumber(n)) {
    focus();
    throw new Error("Argument ist nicht vom Typ Number!");
  }
  this._differenceHorizontal = n;
}

// -------
// setNavigationStructure
// -------
Navigation.prototype.setNavigationStructure = function(obj) {
  if(!this.getNavigationAllowedStatus()){
    return;
  }
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof obj != "object") {
    focus();
    throw new Error("Argument ist nicht vom Typ HMTL-Object!");
  }
  var structure = {};
  structure = Navigation._getNavigationStructureByNode(obj, structure, '', 0, this._containerIDPrefix);
  this.navigationStructure(structure);
  this._setRegisterStructureItem(NavigationItem._registerInstance);
  //alert(Navigation._getNavigationStructuretoString(this.navigationStructure(), '', 0));
}

// -------
// drawNavigationStructure
// -------
Navigation.prototype.drawNavigationStructure = function(html) {
  if(!this.getNavigationAllowedStatus()){
    return;
  }
  if(!document.getElementById(this.id())){
    return;
  }
  var html = '';
  html += this._getNavigationStructureHTML(Navigation._getFirstItem(this.navigationStructure()), '', this._containerIDPrefix + 'root', 1);
  //alert(html);
  /*
  var win = window.open('','test');
  var doc = win.document;
  doc.open();
  doc.write(html);
  doc.close();
  */
  document.getElementById(this.id()).innerHTML = html;
  this._setRootPosition();
}

// -------
// hideVisitedNavigation
// -------
Navigation.prototype.hideVisitedNavigation = function(id) {
  var item = NavigationItem.getInstance(id);
  for (var i in this._activeMenu){
    var rootPos = i.split(this._containerIDPrefix)[1];
    if (item.rootObj()[rootPos] == undefined){
      if (this._activeMenu[i]['elem']){
        this._activeMenu[i]['elem'].style.display = 'none';
        this._setOffHighlightedItems(this._activeMenu[i]['item'].id());
      }
      delete this._activeMenu[i];
    }
  }
}

// -------
// showActiveNavigation
// -------
Navigation.prototype.showActiveNavigation = function(id) {
  var elem = document.getElementById(id);
  if (elem){
    this.setElementPosition(id);
    if (elem.style.display == 'block'){
      elem.display = 'none';
    } else {
      elem.style.display = 'block';
    } 
    if (this._highlightActiveRoot == 'yes'){
      if (this._highlightActiveClassPostfix){
        this._setHighlightedItems(id);
      }
    }
  }
}

// -------
// setElementPosition
// -------
Navigation.prototype.setElementPosition = function(id) {
  var item = NavigationItem.getInstance(id);
  var rootPos = id.split(this._containerIDPrefix)[1];
  var activeItem = NavigationItem.createInstance(this._itemIDPrefix +''+ id, '');
  // vertical
  if (this._direction == 'vertical'){
    if (document.getElementById(id)){
      if (this._dependHorizontal=='left'){
        document.getElementById(id).style.marginRight =  this._differenceHorizontal + 'px';
      } else {
        document.getElementById(id).style.marginLeft =  this._differenceHorizontal + 'px';
      }
      document.getElementById(id).style.marginTop = this._differenceVertical + 'px';
    }
  // horizontal
  } else {  
    var _top;
    var _left;
    if (item.rootObj()[rootPos]){
      var idxR = parseFloat(item.rootObj()[rootPos] -1);
      if (item.rootArr()[idxR]){
        var rootItem = NavigationItem.getInstance(this._containerIDPrefix +''+ item.rootArr()[idxR]);
        if (this._dependHorizontal == 'left'){
          if (rootItem.properties().getLeft() != undefined){
            _left = parseFloat(rootItem.properties().getLeft() - item.properties().getWidth());
          } else {
            if (document.getElementById(this._itemIDPrefix +''+ id)){
            _left = parseFloat(activeItem.properties().getLeft() - item.properties().getWidth());
            }
          }
        } else {
          if (rootItem.properties().getRight() != undefined){
            _left = rootItem.properties().getRight();
          } else {
            if (document.getElementById(this._itemIDPrefix +''+ id)){
            _left = activeItem.properties().getRight();
            }
          }
        }
        if (this._dependVertical=='middle'){
          if (document.getElementById(this._itemIDPrefix +''+ id)){
            _top = parseFloat(activeItem.properties().getTop() + parseFloat(activeItem.properties().getHeight() / 2));
          }
        } else if (this._dependVertical=='bottom'){
          if (document.getElementById(this._itemIDPrefix +''+ id)){
            _top = activeItem.properties().getBottom();
          } 
        } else {
          if (document.getElementById(this._itemIDPrefix +''+ id)){
            _top = activeItem.properties().getTop();
          } 
        }
      }
    }
    if (document.getElementById(id)){
      if (_top != undefined){
        if (idxR > 0){
          document.getElementById(id).style.top = parseFloat(parseFloat(_top + this._differenceVertical) - this._rootTop) + 'px';
        } else {
          document.getElementById(id).style.top = parseFloat(parseFloat(_top + 35) - this._rootTop) + 'px';
        }  
      }
      if (navigator.userAgent.match(/Opera/)){
        document.getElementById(id).style.position = 'absolute';
      }
      if (_left != undefined){   
        if (idxR > 0){  
          document.getElementById(id).style.left = parseFloat(parseFloat(_left + this._differenceHorizontal) - this._rootLeft) + 'px';
        } else {  
          if (document.all) {  
            document.getElementById(id).style.left = parseFloat(parseFloat((_left - activeItem.properties().getWidth())+ this._differenceHorizontal) - this._rootLeft) + 'px';
          } else {
            document.getElementById(id).style.left = parseFloat(parseFloat(_left - activeItem.properties().getWidth()) - this._rootLeft) + 'px';
          }
        }
      }
      if (navigator.userAgent.match(/Opera/)){
        document.getElementById(id).style.position = 'absolute';
      }
    }
  }
}

// -------
// displaySubmenu
// -------
Navigation.prototype.displaySubmenu = function(id) {
  this._menuInUse = true;
  var item = NavigationItem.getInstance(id);
  var elem = undefined;
  if (document.getElementById(id)){
    elem = document.getElementById(id);
  }
  this.hideVisitedNavigation(id);
  this.showActiveNavigation(id);
  if (this._direction == 'vertical'){
    if (this._activeMenu[id] || item.type() == 1){
      this._menuInUse = false;
      this.hideAll();
      return;
    }
  }
  this._activeMenu[id] = {};
  if (document.getElementById(id)){
    this._activeMenu[id]['elem'] = document.getElementById(id);
  }
  this._activeMenu[id]['item'] = item;
}

// -------
// collapseMenu
// -------
Navigation.prototype.collapseMenu = function() {
  this._menuInUse = false;
  if (this._timeout){
    window.clearTimeout(this._timeout);
  }
  var funcStr = 'Navigation.getInstance(\''+ this.id() +'\').hideAll()';
  this._timeout = window.setTimeout(funcStr, this._delay);
}

// -------
// hideAll
// -------
Navigation.prototype.hideAll = function() {
  if (this._timeout){
    window.clearTimeout(this._timeout);
  }
  if (!this._menuInUse){
    for (var i in this._activeMenu){
      if (this._activeMenu[i]['elem']){
        this._activeMenu[i]['elem'].style.display = 'none';
        this._setOffHighlightedItems(this._activeMenu[i]['item'].id());
      }
      delete this._activeMenu[i];
    }
  }
}

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

Navigation._defaultID = [];

Navigation._registerInstance = {};

Navigation._getNavigationStructureHTMLRoot = true;

Navigation._attributesToIE = {};
Navigation._attributesToIE['src'] = 'src';
Navigation._attributesToIE['style'] = 'style';
Navigation._attributesToIE['align'] = 'align';
Navigation._attributesToIE['title'] = 'title';
Navigation._attributesToIE['alt'] = 'alt';
Navigation._attributesToIE['valign'] = 'valign';
Navigation._attributesToIE['vspace'] = 'vspace';
Navigation._attributesToIE['hspace'] = 'hspace';
Navigation._attributesToIE['class'] = 'className';
Navigation._attributesToIE['border'] = 'border';
Navigation._attributesToIE['cellspacing'] = 'cellspacing';
Navigation._attributesToIE['cellpadding'] = 'cellpadding';
Navigation._attributesToIE['data'] = 'data';
Navigation._attributesToIE['marginwidth'] = 'marginwidth';
Navigation._attributesToIE['marginheight'] = 'marginheight';
Navigation._attributesToIE['margintop'] = 'margintop';
Navigation._attributesToIE['marginleft'] = 'marginleft';
Navigation._attributesToIE['frameborder'] = 'frameborder';
Navigation._attributesToIE['dataformatas'] = 'dataformatas';
Navigation._attributesToIE['type'] = 'type';
Navigation._attributesToIE['width'] = 'width';
Navigation._attributesToIE['height'] = 'height';
Navigation._attributesToIE['onmouseover'] = 'onMouseover';
Navigation._attributesToIE['onmouseout'] = 'onMouseout';
Navigation._attributesToIE['onclick'] = 'onClick';
Navigation._attributesToIE['onfocus'] = 'onFocus';
Navigation._attributesToIE['onblur'] = 'onBlur';
Navigation._attributesToIE['onload'] = 'onLoad';
Navigation._attributesToIE['onchange'] = 'onChange';
Navigation._attributesToIE['onsubmit'] = 'onSubmit';
Navigation._attributesToIE['name'] = 'name';
Navigation._attributesToIE['value'] = 'value';
Navigation._attributesToIE['id'] = 'id';
Navigation._attributesToIE['href'] = 'href';
Navigation._attributesToIE['target'] = 'target';


Navigation._attributesIE = {};
Navigation._attributesIE['src'] = 'src';
Navigation._attributesIE['style'] = 'style';
Navigation._attributesIE['align'] = 'align';
Navigation._attributesIE['title'] = 'title';
Navigation._attributesIE['alt'] = 'alt';
Navigation._attributesIE['valign'] = 'valign';
Navigation._attributesIE['vspace'] = 'vspace';
Navigation._attributesIE['hspace'] = 'hspace';
Navigation._attributesIE['className'] = 'class';
Navigation._attributesIE['border'] = 'border';
Navigation._attributesIE['cellspacing'] = 'cellspacing';
Navigation._attributesIE['cellpadding'] = 'cellpadding';
Navigation._attributesIE['data'] = 'data';
Navigation._attributesIE['marginwidth'] = 'marginwidth';
Navigation._attributesIE['marginheight'] = 'marginheight';
Navigation._attributesIE['margintop'] = 'margintop';
Navigation._attributesIE['marginleft'] = 'marginleft';
Navigation._attributesIE['frameborder'] = 'frameborder';
Navigation._attributesIE['dataformatas'] = 'dataformatas';
Navigation._attributesIE['type'] = 'type';
Navigation._attributesIE['width'] = 'width';
Navigation._attributesIE['height'] = 'height';
Navigation._attributesIE['onMouseover'] = 'onmouseover';
Navigation._attributesIE['onMouseout'] = 'onmouseout';
Navigation._attributesIE['onClick'] = 'onclick';
Navigation._attributesIE['onFocus'] = 'onfocus';
Navigation._attributesIE['onBlur'] = 'onblur';
Navigation._attributesIE['onLoad'] = 'onload';
Navigation._attributesIE['onChange'] = 'onchange';
Navigation._attributesIE['onSubmit'] = 'onsubmit';
Navigation._attributesIE['name'] = 'name';
Navigation._attributesIE['value'] = 'value';
Navigation._attributesIE['id'] = 'id';
Navigation._attributesIE['href'] = 'href';
Navigation._attributesIE['target'] = 'target';

// Aus Performance-Gründen werden nicht zu erwartende Attributes abgeschaltet  
Navigation._styleAttributesIE = {};
Navigation._styleAttributesIE['width'] = 'width';
Navigation._styleAttributesIE['height'] = 'height';
Navigation._styleAttributesIE['top'] = 'top';
Navigation._styleAttributesIE['left'] = 'left';
//Navigation._styleAttributesIE['right'] = 'right';
//Navigation._styleAttributesIE['bottom'] = 'bottom';
Navigation._styleAttributesIE['display'] = 'display';
Navigation._styleAttributesIE['position'] = 'position';
//Navigation._styleAttributesIE['clear'] = 'clear';
//Navigation._styleAttributesIE['styleFloat'] = 'float';
//Navigation._styleAttributesIE['lineHeight'] = 'line-height';
//Navigation._styleAttributesIE['verticalAlign'] = 'vertical-align';
Navigation._styleAttributesIE['textAlign'] = 'text-align';
Navigation._styleAttributesIE['textDecoration'] = 'text-decoration';
//Navigation._styleAttributesIE['textTransform'] = 'text-transform';
//Navigation._styleAttributesIE['whiteSpace'] = 'white-space';
Navigation._styleAttributesIE['padding'] = 'padding';
Navigation._styleAttributesIE['paddingTop'] = 'padding-top';
Navigation._styleAttributesIE['paddingRight'] = 'padding-right';
Navigation._styleAttributesIE['paddingBottom'] = 'padding-bottom';
Navigation._styleAttributesIE['paddingLeft'] = 'padding-left';
Navigation._styleAttributesIE['margin'] = 'margin';
Navigation._styleAttributesIE['marginTop'] = 'margin-top';
Navigation._styleAttributesIE['marginRight'] = 'margin-right';
Navigation._styleAttributesIE['marginBottom'] = 'margin-bottom';
Navigation._styleAttributesIE['marginLeft'] = 'margin-left';
Navigation._styleAttributesIE['border'] = 'border';
Navigation._styleAttributesIE['borderLeft'] = 'border-left';
Navigation._styleAttributesIE['borderRight'] = 'border-right';
Navigation._styleAttributesIE['borderTop'] = 'border-top';
Navigation._styleAttributesIE['borderBottom'] = 'border-bottom';
Navigation._styleAttributesIE['borderColor'] = 'border-color';
Navigation._styleAttributesIE['borderStyle'] = 'border-style';
Navigation._styleAttributesIE['borderWidth'] = 'border-width';
Navigation._styleAttributesIE['borderCollapse'] = 'border-collapse';
Navigation._styleAttributesIE['fontSize'] = 'font-size';
Navigation._styleAttributesIE['fontWeight'] = 'font-weight';
Navigation._styleAttributesIE['fontStyle'] = 'font-style';
Navigation._styleAttributesIE['fontFace'] = 'font-face';
Navigation._styleAttributesIE['color'] = 'color';
Navigation._styleAttributesIE['backgroundColor'] = 'background-color';
Navigation._styleAttributesIE['backgroundImage'] = 'background-image';
Navigation._styleAttributesIE['backgroundPosition'] = 'background-position';
Navigation._styleAttributesIE['backgroundRepeat'] = 'background-repeat';
//Navigation._styleAttributesIE['listStyle'] = 'list-style';
//Navigation._styleAttributesIE['listStyleType'] = 'list-style-type';
//Navigation._styleAttributesIE['listStyleImage'] = 'list-style-image';
//Navigation._styleAttributesIE['listStylePosition'] = 'list-style-position';
//Navigation._styleAttributesIE['tableLayout'] = 'table-layout';
//Navigation._styleAttributesIE['visibility'] = 'visibility';
Navigation._styleAttributesIE['zIndex'] = 'z-index'; 

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------
// -------
// _getNavigationStructureByNode
// -------
Navigation._getNavigationStructureByNode = function(node, structure, path, countx, containerPrefix) {
  if (arguments.length!=5) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (!node){
    return structure;
  }
  var arr = structure;
  for (var i=0; i<node.childNodes.length; i++){
    var child = node.childNodes[i];
    if (child.nodeType == 1){
      if (child.nodeName.toLowerCase() == 'a'){
        if (path.length){
          path += '-';
        }
        arr[path +''+ countx] = 1;
        var item = NavigationItem.createInstance(containerPrefix + path +''+ countx);
        item.setType('1');
        item.setRoot(path +''+ countx);
        if (Navigation.hasAttributes(child, 'class')){
          item.setClassName(Navigation.getAttributesFromElement(child, 'class'));
        }
        if (Navigation.hasAttributes(child, 'style')){
          item.setStyle(Navigation.getAttributesFromElement(child, 'style'));
        }
        if (Navigation.hasAttributes(child, 'href')){
          item.setHref(Navigation.getAttributesFromElement(child, 'href'));
        }
        if (Navigation.hasAttributes(child, 'target')){
          item.setTarget(Navigation.getAttributesFromElement(child, 'target'));
        }
        if (Navigation.hasAttributes(child, 'onclick')){
          item.setOnClick(Navigation.getAttributesFromElement(child, 'onclick'));
        }
        if (Navigation.hasAttributes(child, 'title')){
          item.setTitle(Navigation.getAttributesFromElement(child, 'title'));
        }
        var label = Navigation.getTextNodeValue(child);
        item.setLabel(label);
      }
      if (child.nodeName.toLowerCase() == 'li'){
        countx++;
      }
      if (child.nodeName.toLowerCase() == 'ul'){
        path += countx;
        countx = 0;
        structure[path] = {};
        arr = structure[path];
        var item = NavigationItem.createInstance(containerPrefix + path);
        item.setType('0');
        item.setRoot(path);
        if (Navigation.hasAttributes(child, 'class')){
          item.setClassName(Navigation.getAttributesFromElement(child, 'class'));
        }
        if (Navigation.hasAttributes(child, 'style')){
          item.setStyle(Navigation.getAttributesFromElement(child, 'style'));
        }
        var subChild = undefined;
        if(child.previousSibling){
          if (child.previousSibling && child.previousSibling.nodeName.toLowerCase() == 'a'){
            subChild = child.previousSibling;
          } else if (child.previousSibling.previousSibling && child.previousSibling.previousSibling.nodeName.toLowerCase() == 'a'){
            subChild = child.previousSibling.previousSibling;
          }
        }
        if (subChild){
          if (Navigation.hasAttributes(subChild, 'class')){
            item.setSubClassName(Navigation.getAttributesFromElement(subChild, 'class'));
          }
          if (Navigation.hasAttributes(subChild, 'style')){
            item.setSubStyle(Navigation.getAttributesFromElement(subChild, 'style'));
          }
          if (Navigation.hasAttributes(subChild, 'href')){
            item.setHref(Navigation.getAttributesFromElement(subChild, 'href'));
          }
          if (Navigation.hasAttributes(subChild, 'target')){
            item.setTarget(Navigation.getAttributesFromElement(subChild, 'target'));
          }
          if (Navigation.hasAttributes(subChild, 'onclick')){
            item.setOnClick(Navigation.getAttributesFromElement(subChild, 'onclick'));
          }
          if (Navigation.hasAttributes(subChild, 'title')){
            item.setTitle(Navigation.getAttributesFromElement(subChild, 'title'));
          }
          var label = Navigation.getTextNodeValue(subChild);
          item.setLabel(label);
        }
      }
      Navigation._getNavigationStructureByNode(child, arr, path, countx, containerPrefix);
    }
  }
  return structure;
}

// -------
// _getNavigationStructuretoString
// -------
Navigation._getNavigationStructuretoString = function(nodeList, str, x) {
  if (arguments.length!=3) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  for (var i in nodeList){
    var count = x;
    while (count > 0){
      str += '. .';
      count--;
    }
    str += i + ' = ' + nodeList[i] + '\n';
    if (typeof nodeList[i] == 'object'){
      str += Navigation._getNavigationStructuretoString(nodeList[i], '', x+1);
    }
  }
  return str;
}


// -------
// _getFirstItem
// -------
Navigation._getFirstItem = function(obj) {
  if (arguments.length!=1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  var count = 0;
  for (var i in obj){
    if (count == 0){
      return obj[i];
    }
  }
  return obj;
}

// ------------------------------------------------------------
// Öffentliche Klassenmehtoden
// ------------------------------------------------------------


// -------
// getTextNodeValue
// -------
Navigation.getTextNodeValue = function(node) {
  if (arguments.length!=1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  var str = '';
  for (var i=0; i<node.childNodes.length; i++){
    var child = node.childNodes[i];
    if (child.nodeType == 3){
      str += child.nodeValue;
    }
  }  
  return str;
}

// ----------------------------------
// Navigation.hasAttributes
// ----------------------------------
//
// Beschreibung:
// Methode teile die jeweilige Attribute-ZugriffsMethode zu
//
Navigation.hasAttributes = function(elem, attrName) {
  var str = '';
  if (document.all){
    if (Navigation._attributesToIE[attrName]){
      attrName = Navigation._attributesToIE[attrName];
    }
    if (attrName == 'className'){
      // OPERA kennt nur class
      if (elem.getAttribute('class')){
        attrName = 'class';
      }
    }
  }
  if (elem.getAttribute(attrName)){
    return true;
  }
  return false;
}

// ----------------------------------
// Navigation.GetAttributesFromElement
// ----------------------------------
//
// Beschreibung:
// Methode teile die jeweilige Attribute-ZugriffsMethode zu
//
Navigation.getAttributesFromElement = function(elem, attrName) {
  var str = '';
  if (document.all){
    str = Navigation._getAttributesFromElementIE(elem, attrName);
  } else {
    str = Navigation._getAttributesFromElementDOM(elem, attrName);
  }
  return str;
}

// ----------------------------------
// Navigation._getAttributesFromElementIE
// ----------------------------------
//
// Beschreibung:
// Da IE Array elem.attributes alle ITEMS=NULL wird hier die getAttribute(name) Methode verwendet
// Alle Attribute- und Style-Attribute-Name müssen vorher definiert werden, das getAttribute() mit diesem String-namen aufgerufen wird.
// Vorteil: Es werden nur Attribute und Style-Attriubte verwendet die auch definiert wurden.
//
Navigation._getAttributesFromElementIE = function(elem, attrName) { 
  var str = '';
  if (Navigation._attributesToIE[attrName]){
    var attr = Navigation._attributesToIE[attrName];
    if (attr == 'className'){
      // OPERA kennt nur class nicht className
      if (elem.getAttribute('class')){
        attr = 'class';
      }
    }
    var attrValue = elem.getAttribute(attr);
    if (attrValue){
      if (typeof attrValue == 'object'){
        for (var a in Navigation._styleAttributesIE){
          if (attrValue[a] && attrValue[a].length){
            str += Navigation._styleAttributesIE[a]+': '+attrValue[a]+'; ';
          }
        }
      } else {
        str += attrValue;
      }
    }
  }
  return str;
}

// ----------------------------------
// Navigation._getAttributesFromElementIELoop
// ----------------------------------
//
// Beschreibung:
// Da IE Array elem.attributes alle ITEMS=NULL wird hier die getAttribute(name) Methode verwendet
// Alle Attribute- und Style-Attribute-Name müssen vorher definiert werden, das getAttribute() mit diesem String-namen aufgerufen wird.
// Vorteil: Es werden nur Attribute und Style-Attriubte verwendet die auch definiert wurden.
//
Navigation._getAttributesFromElementIELoop = function(elem, attrName) { 
  var str = '';
  for (var i in Navigation._attributesIE){
    var attr = i;
    if (attr == 'className'){
      // OPERA kennt nur class nicht className
      if (elem.getAttribute('class')){
        attr = 'class';
      }
    }
    if (elem.getAttribute(attr)){
      var name = Navigation._attributesIE[i];
      if (name == attrName){
        var attrValue = elem.getAttribute(attr);
        if (attrValue){
          if (typeof attrValue == 'object'){
            for (var a in Navigation._styleAttributesIE){
              if (attrValue[a] && attrValue[a].length){
                str += Navigation._styleAttributesIE[a]+': '+attrValue[a]+'; ';
              }
            }
          } else {
            str += attrValue;
          }
        }
      } 
    }  
  }
  return str;
}

// ----------------------------------
// Navigation._getAttributesFromElementDOM
// ----------------------------------
//
// Attribute werden über Standard-DOM elem.arttributes Array ermittelt
// Funktioniert nicht bei IE!!!
//
Navigation._getAttributesFromElementDOM = function(elem, attrName) {
  var attributes = elem.attributes;
  var str = '';
  if (attributes.length){
    if (elem.getAttribute(attrName)){
      str += elem.getAttribute(attrName);
    }
  }
  return str;
}


// ----------------------------------
// Navigation._getAttributesFromElementDOMLoop
// ----------------------------------
//
// Attribute werden über Standard-DOM elem.arttributes Array ermittelt
// Funktioniert nicht bei IE!!!
//
Navigation._getAttributesFromElementDOMLoop = function(elem, attrName) {
  var attributes = elem.attributes;
  var str = '';
  var output = '';
  if (attributes.length){
    for (var i=0; i<attributes.length; i++){
      var attr = attributes.item(i);
      // output += attr.name + '=' + attr.value + ' | ';
      if (attr && attr.value && attr.value.length){
        var name = attr.name;
        if (attrName == name){
          var attrValue = attr.value;
          str += attrValue;
        }  
      }
    }
  }
  return str;
}

// -------
// getInstance
// -------
Navigation.getInstance = function(id) {
  if (arguments.length!=1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (! (Navigation._registerInstance[id])){
    focus();
    throw new Error("Es ist keine Navigation.Instance mit id=" + id + " registriert!");
  } 
  return Navigation._registerInstance[id];
}

// -------
// createInstance
// -------
Navigation.createInstance = function(id) {
  if (!arguments.length) {
    id = 'navigation' + Navigation._defaultID.length;
    Navigation._defaultID.push(1);
  }
  if (! (Navigation._registerInstance[id])){
    Navigation._registerInstance[id] = new Navigation(id);
  } 
  return Navigation.getInstance(id);
}


// ################################################################################
// #########################################################|  NavigationItem   |##
// ################################################################################

// ============================================================
// Klasse NavigationItem
// ============================================================
//
// Objekthierarchie:
// -----------------
//   Object
//     |-- Navigation
//           |-- NavigationItem
//
// Konstruktor:
// ------------
//   + NavigationItem()
//
// Eigenschaften:
// --------------
//   + _id : id (readonly)
//   + _rootArr : Array (readonly)
//   + _rootObj : Object (readonly)
//   + _properties : Object (readonly)
//   + _type : str (readonly) | 0=container, 1=link
//   + _style : str (readonly) css-style-angaben
//   + _className : str (readonly) cssName
//   + _subStyle : str (readonly) css-style-angaben
//   + _subClassName : str (readonly) cssName
//   + _href : str (readonly) url
//   + _label : str (readonly) name
//   + _target : str (readonly) target
//   + _onclick : str (readonly) eventHandler
//   + _title : str (readonly) 
//   + _action : link (readonly)
//   + _style : css (readonly)
//   + _target : str (readonly)
//
// Methoden:
// ---------
//   + _setID(str) : void
//   + setType(str) : void
//

// ------------------------------------------------------------
// Konstruktor
// ------------------------------------------------------------

function NavigationItem(id) {
  if (arguments.length>1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  // Attribute
  this._id = undefined;
  this._rootArr = [];
  this._rootObj = {};
  this._type = undefined;
  this._href = undefined;
  this._label = undefined;
  this._style = undefined;
  this._target = undefined;
  this._onclick = undefined;
  this._className = undefined;
  this._title = undefined;
  this._subStyle = undefined;
  this._subClassName = undefined;
  this._setID(id);
  this._properties = NavigationItemProperties.createNavigationItemProperties(this.id(), this._getParentElement());
}

// toString()
NavigationItem.prototype.toString = function() {
  return "\n[Navigation - id: " + this.id + "]\n";
}

// ------------------------------------------------------------
// Zugriffsmethoden
// ------------------------------------------------------------

// -------
// id
// -------
NavigationItem.prototype.id = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._id = str;
  }
  return this._id;
}

// -------
// type
// -------
NavigationItem.prototype.type = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._type = str;
  }
  return this._type;
}

// -------
// label
// -------
NavigationItem.prototype.label = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._label = str;
  }
  return this._label;
}

// -------
// href
// -------
NavigationItem.prototype.href = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._href = str;
  }
  return this._href;
}

// -------
// title
// -------
NavigationItem.prototype.title = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._title = str;
  }
  return this._title;
}

// -------
// target
// -------
NavigationItem.prototype.target = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._target = str;
  }
  return this._target;
}

// -------
// onclick
// -------
NavigationItem.prototype.onclick = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._onclick = str;
  }
  return this._onclick;
}

// -------
// style
// -------
NavigationItem.prototype.style = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._style = str;
  }
  return this._style;
}

// -------
// className
// -------
NavigationItem.prototype.className = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._className = str;
  }
  return this._className;
}

// -------
// subStyle
// -------
NavigationItem.prototype.subStyle = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._subStyle = str;
  }
  return this._subStyle;
}

// -------
// subClassName
// -------
NavigationItem.prototype.subClassName = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("Argument ist nicht vom Typ String!");
    }
    this._subClassName = str;
  }
  return this._subClassName;
}

// -------
// rootArr
// -------
NavigationItem.prototype.rootArr = function(arr) {
  if (arguments.length) {
    if (typeof arr != "object") {
      focus();
      throw new Error("Argument ist nicht vom Typ Object!");
    }
    this._rootArr = arr;
  }
  return this._rootArr;
}

// -------
// root
// -------
NavigationItem.prototype.rootObj = function(obj) {
  if (arguments.length) {
    if (typeof obj != "object") {
      focus();
      throw new Error("Argument ist nicht vom Typ Object!");
    }
    this._rootObj = obj;
  }
  return this._rootObj;
}

// -------
// properties
// -------
NavigationItem.prototype.properties = function(obj) {
  if (arguments.length) {
    if (typeof obj != "object") {
      focus();
      throw new Error("Argument ist nicht vom Typ Object!");
    }
    this._properties = obj;
  }
  return this._properties;
}

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// -------
// _setID
// -------
NavigationItem.prototype._setID = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.id(str);
}

// -------
// _setID
// -------
NavigationItem.prototype._getParentElement = function() {
  var elem = document.getElementById(this.id());
  var parentElem = '';
  if (elem){
    if (document.all){
      parentElem = elem.parentElement.id;
    } else {
      parentElem = elem.parentNode.id;
    }  
  }  
  return parentElem;
}



// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// -------
// setType
// -------
NavigationItem.prototype.setType = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.type(str);
}

// -------
// setLabel
// -------
NavigationItem.prototype.setLabel = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.label(str);
}

// -------
// setHref
// -------
NavigationItem.prototype.setHref = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.href(str);
}

// -------
// setTitle
// -------
NavigationItem.prototype.setTitle = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.title(str);
}

// -------
// setTarget
// -------
NavigationItem.prototype.setTarget = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.target(str);
}

// -------
// setOnClick
// -------
NavigationItem.prototype.setOnClick = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.onclick(str);
}

// -------
// setStyle
// -------
NavigationItem.prototype.setStyle = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.style(str);
}

// -------
// setClassName
// -------
NavigationItem.prototype.setClassName = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.className(str);
}

// -------
// setSubStyle
// -------
NavigationItem.prototype.setSubStyle = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.subStyle(str);
}

// -------
// setSubClassName
// -------
NavigationItem.prototype.setSubClassName = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  this.subClassName(str);
}

// -------
// setRoot
// -------
NavigationItem.prototype.setRoot = function(str) {
  if (arguments.length!=1) {
    focus();
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("Argument ist nicht vom Typ String!");
  }
  var arr = str.split(/-/);
  var _str = '';
  var rootListArr = [];
  var rootListObj = {};
  for (var i=0; i<arr.length; i++){
    if (i>0){
      _str += '-';
    }
    _str += arr[i];
    rootListObj[_str] = i;
    rootListArr[i] = _str;
  }
  this.rootArr(rootListArr);
  this.rootObj(rootListObj);
}

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

NavigationItem._defaultID = [];

NavigationItem._registerInstance = {};

NavigationItem._isRoot = false;

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klassenmehtoden
// ------------------------------------------------------------

// -------
// getInstance
// -------
NavigationItem.getInstance = function(id) {
  if (arguments.length!=1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (! (NavigationItem._registerInstance[id])){
    focus();
    throw new Error("Es ist keine NavigationItem.Instance mit id=" + id + " registriert!");
  } 
  return NavigationItem._registerInstance[id];
}

// -------
// hasInstance
// -------
NavigationItem.hasInstance = function(id) {
  if (arguments.length!=1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (! (NavigationItem._registerInstance[id])){
    return false;
  } 
  return true;
}

// -------
// createInstance
// -------
NavigationItem.createInstance = function(id) {
  if (!arguments.length) {
    id = 'navigation' + NavigationItem._defaultID.length;
    NavigationItem._defaultID.push(1);
  }
  if (! (NavigationItem._registerInstance[id])){
    NavigationItem._registerInstance[id] = new NavigationItem(id);
  } 
  return NavigationItem.getInstance(id);
}


// ################################################################################
// ###############################################|  NavigationItemProperties   |##
// ################################################################################

// ============================================================
// Klasse NavigationItemProperties
// ============================================================
//
// Objekthierarchie:
// -----------------
//   Object
//     |-- Navigation
//           |-- NavigationItem
//                     |-- NavigationItemProperties
//
// Konstruktor:
// ------------
//   + NavigationItemProperties()
//
// Eigenschaften:
// --------------
//   + _id : id (readonly)
//   + _id : id (readonly)
//   + _idParentElement : str (readonly)
//
// Methoden:
// ---------
//   + getTop() : void
//   + getLeft() : void
//   + getBottom() : void
//   + getRight() : void
//   + getWidth() : void
//   + getHeight() : void
//

// ------------------------------------------------------------
// Konstruktor
// ---------------------------


function NavigationItemProperties(id, idParentElement) {  
  // Attribute
  this._id = undefined;
  this._idParentElement = 'body';
  // Initialisierungen
  this.id(id);
  this.idParentElement(idParentElement);
}

// ------------------------------------------------------------
// Zugriffsfunktionen
// ------------------------------------------------------------

// -----------
// id(string)
// -----------
//
// Beschreibung:
// -------------
//

NavigationItemProperties.prototype.id = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }
    this._id = str;
  }
  return this._id;
}

// -----------
// idParentElement(string)
// -----------
//
// Beschreibung:
// -------------
//

NavigationItemProperties.prototype.idParentElement = function(str) {
  if (arguments.length) {
    if (typeof str != "string") {
      focus();
      throw new Error("ArgumentError:noString!");
    }  
    this._idParentElement = str.toLowerCase();
  }
  return this._idParentElement;
}

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// -------------------------------------------
// getTop()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode ermittelt relative Top-Position zu einem bestimmten Eltern-Element.
//
// Beispiel:
// ---------
// getTop();
//

NavigationItemProperties.prototype.getTop = function() {  
  if (this._existsElement(this.id())){
    var parentDiv = document.getElementById(this.id());
    var topPosition = 0;
    if (this._existsElement(this.idParentElement())){
      while (parentDiv && parentDiv.id != this.idParentElement()){
        if (parentDiv.nodeType == 1){
          topPosition += parseFloat(parentDiv.offsetTop);
        }
        parentDiv = parentDiv.offsetParent;
      }
    }
    else{
      while (parentDiv){
        if (parentDiv.nodeType == 1){
          topPosition += parseFloat(parentDiv.offsetTop);
        }
        parentDiv = parentDiv.offsetParent;
      }
    }
    return parseFloat(topPosition);
  }
  return undefined;
}

// -------------------------------------------
// getLeft()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode ermittelt relative Left-Position zu einem bestimmten Eltern-Element.
//
// Beispiel:
// ---------
// getLeft();
//

NavigationItemProperties.prototype.getLeft = function() {  
  if (this._existsElement(this.id())){
    var parentDiv = document.getElementById(this.id());
    var leftPosition = 0;
    if (this._existsElement(this.idParentElement())){
      while (parentDiv && parentDiv.id != this.idParentElement()){
        if (parentDiv.nodeType == 1){
          leftPosition += parseFloat(parentDiv.offsetLeft);
        }
        parentDiv = parentDiv.offsetParent;
      }
    }
    else{
      while (parentDiv){
        if (parentDiv.nodeType == 1){
          leftPosition += parseFloat(parentDiv.offsetLeft);
        }
        parentDiv = parentDiv.offsetParent;
      }
    }
    return parseFloat(leftPosition);
  }
  return undefined;
}

// -------------------------------------------
// getBottom()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode ermittelt relative Bottom-Position zu einem bestimmten Eltern-Element.
//
// Beispiel:
// ---------
// getBottom();
//

NavigationItemProperties.prototype.getBottom = function() {
  if (this._existsElement(this.id())){
    var bottomPosition = parseFloat(this.getTop() +  this.getHeight());
    return parseFloat(bottomPosition);
  }
  return undefined;
}

// -------------------------------------------
// getRight()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode ermittelt relative Right-Position zu einem bestimmten Eltern-Element.
//
// Beispiel:
// ---------
// getRight();
//

NavigationItemProperties.prototype.getRight = function() {  
  if (this._existsElement(this.id())){
    var rightPosition = parseFloat(this.getLeft() + this.getWidth());
    return parseFloat(rightPosition);
  }
  return undefined;
}

// -------------------------------------------
// getWidth()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode ermittelt width des Elements.
//
// Beispiel:
// ---------
// getWidth();
//

NavigationItemProperties.prototype.getWidth = function() {
  if (this._existsElement(this.id())){
    var width = parseFloat(document.getElementById(this.id()).offsetWidth);
    return parseFloat(width);
  }
  return undefined;
}

// -------------------------------------------
// getHeight()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode ermittelt height des Elements.
//
// Beispiel:
// ---------
// getHeight();
//

NavigationItemProperties.prototype.getHeight = function() {
  if (this._existsElement(this.id())){
    var height = parseFloat(document.getElementById(this.id()).offsetHeight);
    return parseFloat(height);
  }
  return undefined;
}

// -------------------------------------------
// _existsElement()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode ermittelt relative Right-Position zu einem bestimmten Eltern-Element.
//
// Beispiel:
// ---------
// _existsElement();
//

NavigationItemProperties.prototype._existsElement = function(id) {
  if (document.getElementById(id) != undefined){
    return true;
  }
  return false;
}

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// NavigationItemProperties.createNavigationItemProperties()
// -------------------------------------------
//
// Beschreibung:
// -------------
//   ...
//
// Beispiel:
// ---------
// NavigationItemProperties.createNavigationItemProperties(id, idParentElement);
//

NavigationItemProperties.createNavigationItemProperties = function(id, idParentElement) { 
  return new NavigationItemProperties(id, idParentElement);
}

// ------------------------------------------------------------
// toString()
// ------------------------------------------------------------

NavigationItemProperties.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  return Object.prototype.toString.apply(this);
}


// ################################################################################
// #########################################################|  NavigationTools   |##
// ################################################################################

// ============================================================
// Klasse NavigationTools
// ============================================================

// ------------------------------------------------------------
// Konstruktor
// ---------------------------

function NavigationTools() {
}

// ------------------------------------------------------------
// Zugriffsfunktionen
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

// -------------------------------------------
// NavigationTools.checkNumber()
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode prüft Argument auf type Number
//
// Beispiel:
// ---------
// NavigationTools.checkNumber(n);

NavigationTools.checkNumber = function(n){
  if (!arguments.length){
    return false;
  }
  if (n == undefined){
    return false;
  }
  n = n.toString();
  if (n == '0'){
    return n;
  }
  if (!n.length){
    return false;
  }
  n = n.replace(/,/g,'.');
  if (isNaN(n)){
    return false;
  }
  if (!isFinite(n)) {
    return false;
  }
  n = parseFloat(n);
  return n;
}

// -------------------------------------------
// NavigationTools.checkWertInArrayVorhanden(str, arr)
// -------------------------------------------
//
// Beschreibung:
// -------------
// Methode prüft ob ein Wert in einem Array vorhanden ist.
// Argument = wert und jeweiliges Array
//
// Beispiel:
// ---------
// NavigationTools.checkWertinArrayVorhanden(str, arr);

NavigationTools.checkWertInArrayVorhanden = function(){
  var str = arguments[0];
  var arr = new Array();
  arr = arguments[1];
  for (var i in arr){
    if (arr[i] == str){
      return true;
    } 
  }
  return false;
}

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// toString()
// ------------------------------------------------------------

NavigationTools.prototype.toString = function() {
  // zunaechst an Methode der Basisklasse weiterleiten
  return Object.prototype.toString.apply(this);
}


//==================================================================================
//==================================================================================
//
// Tools-MODUL Projektbezogene Methoden und Objekte
// OO-PROGRAMMIERUNG
// AUTOR: DF
// ERSTELLT: 09.05.2005
//
//==================================================================================
//==================================================================================

// ============================================================
// Klasse Tools
// ============================================================

function Tools() {
}

// ------------------------------------------------------------
// Private Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Instanzmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klasseneigenschaften
// ------------------------------------------------------------

// ------------------------------------------------------------
// Private Klassenmethoden
// ------------------------------------------------------------

// ------------------------------------------------------------
// Öffentliche Klassenmethoden
// ------------------------------------------------------------

Tools.openMicrosite = function(htmlElement, properties) {
  if (!arguments.length) {
    return false;
  }
  var url = '';
  var docSource = '';
  var tagName = htmlElement['tagName'];
  tagName = tagName.toLowerCase();
  if (tagName == 'form'){
    var nameValuePeer = [];
    for (var i=0; i<htmlElement.elements.length; i++){
      nameValuePeer[i] = {};
      if (htmlElement.elements[i].name.length){
        if (htmlElement.elements[i].type == 'select-one'){
            nameValuePeer[i]['name'] = htmlElement.elements[i].name;
            nameValuePeer[i]['value'] = htmlElement.elements[i].options[htmlElement.elements[i].selectedIndex].value;
        } else if (htmlElement.elements[i].type == 'select-multiple'){
          nameValuePeer[i]['name'] = htmlElement.elements[i].name;
          nameValuePeer[i]['value'] = [];
          for (var ii=0; ii<htmlElement.elements[i].options.length; ii++){
            if (htmlElement.elements[i].options[ii].selected){
              nameValuePeer[i]['value'][ii] = htmlElement.elements[i].options[ii].value;
            }
          }
        } else if (htmlElement.elements[i].type == 'radio'){
          nameValuePeer[i]['name'] = htmlElement.elements[i].name;
          if (htmlElement.elements[i].length){
            nameValuePeer[i]['value'] = [];
            for (var ii=0; ii<htmlElement.elements[i].length; ii++){
              if (htmlElement.elements[i][ii].checked){
                nameValuePeer[i]['value'][ii] = htmlElement.elements[i][ii].value;
              }
            }
          } else {
            if (htmlElement.elements[i].checked){
              nameValuePeer[i]['value'] = htmlElement.elements[i].value;
            }
          }
        } else if (htmlElement.elements[i].type == 'checkbox'){
          nameValuePeer[i]['name'] = htmlElement.elements[i].name;
          if (htmlElement.elements[i].length){
            nameValuePeer[i]['value'] = [];
            for (var ii=0; ii<htmlElement.elements[i].length; ii++){
              if (htmlElement.elements[i][ii].checked){
                nameValuePeer[i]['value'][ii] = htmlElement.elements[i][ii].value;
              }
            }
          } else {
            if (htmlElement.elements[i].checked){
              nameValuePeer[i]['value'] = htmlElement.elements[i].value;
            }
          }
        } else {
          nameValuePeer[i]['name'] = htmlElement.elements[i].name;
          nameValuePeer[i]['value'] = htmlElement.elements[i].value;
        }
      }
    }
    if (!htmlElement.method || htmlElement.method.toLowerCase() != 'post'){
      url += htmlElement.action + '?';
      for (var f=0; f<nameValuePeer.length; f++){
        if (typeof nameValuePeer[f]['value'] == 'object'){
          for (var ff=0; ff<nameValuePeer[f]['value'].length; ff++){
            if (nameValuePeer[f]['value'][ff]){
              url += '&' + encodeURIComponent(nameValuePeer[f]['name']);
              url += '=' + encodeURIComponent(nameValuePeer[f]['value'][ff]);
            }
          }
        } else {
          if (nameValuePeer[f]['value']){
            url += '&' + encodeURIComponent(nameValuePeer[f]['name']);
            url += '=' + encodeURIComponent(nameValuePeer[f]['value']);
          }
        }
      }
    } else {
      var charsetting = 'ISO-8859-1';
      if (document.charset){
        if (document.charset != charsetting){
          charsetting = document.charset;
        }
      } else if (document.characterSet){
        if (document.characterSet != charsetting){
          charsetting = document.characterSet;
        }
      }
      docSource += '<html>\n<head><title></title><meta http-equiv="content-type" content="text/html; charset='+ charsetting +'"/></head>\n<body background-color="#ffffff" onload="document.forms[\'myform\'].submit();"><div style="display: none;">\n';
      docSource += '<form name="myform" action="'+ htmlElement.action +'" method="post">\n';
      for (var f=0; f<nameValuePeer.length; f++){
        if (typeof nameValuePeer[f]['value'] == 'object'){
          for (var ff=0; ff<nameValuePeer[f]['value'].length; ff++){
            if (nameValuePeer[f]['value'][ff]){
              docSource += '<input type="checkbox" name="'+ nameValuePeer[f]['name'] +'" value="'+ nameValuePeer[f]['value'][ff] +'" checked="checked"/>\n';
            }
          }
        } else {
          if (nameValuePeer[f]['value']){
            docSource += '<input type="checkbox" name="'+ nameValuePeer[f]['name'] +'" value="'+ nameValuePeer[f]['value'] +'" checked="checked"/>\n';
          }
        }
      }
      docSource += '</form>\n</div></body>\n</html>';
    }
    try {
      htmlElement.reset();
    } catch(e){
    }
  } else if (tagName == 'a' || tagName == 'area'){
    url += htmlElement.href;
  }
  var windowProps = '';
  if (arguments[1]){
    windowProps = properties;
  } else {
    windowProps = 'width=800,height=600,scrollbars=yes,locationbar=no,menubar=no';
  }
  var fenster = window.open(url, 'Micorsite', windowProps);
  if (docSource.length){
    var doc = fenster.document;
    doc.open();
    doc.write(docSource);
    doc.close();
  }
  fenster.focus();
  return false;
}

Tools.getCookieValue = function(cookieName){
  var cookieValue = '';
  if (! navigator.cookieEnabled){
    alert('Ihr Browser erlaubt keine Cookies!');
    return cookieValue;
  }
  if (! cookieName){
    return cookieValue;
  }
  var allCookies = document.cookie;
  var allCookiesArr = allCookies.split(/\;/);
  var regExp = new RegExp('^' + cookieName + '=');
  for (var i=0; i<allCookiesArr.length; i++){
    var _val = Tools.stripSpace(allCookiesArr[i]);
    if (! _val.match(regExp)){
      continue;
    }
    cookieValue = _val.replace(regExp,'');
  }
  if (cookieValue.match(/^"/) && cookieValue.match(/"$/)){
    cookieValue = cookieValue.replace(/^"/,'');
    cookieValue = cookieValue.replace(/"$/,'');
  }
  cookieValue = cookieValue.replace(/###/,';');
  return cookieValue;
}

Tools.setCookieValue = function(cookieValue, cookieName, expiresDate, path, version, valueType){
  if (! navigator.cookieEnabled){
    alert('Ihr Browser erlaubt keine Cookies!');
    return false;
  }
  if (! cookieValue.length){
    //return false;
  }
  if(! cookieName){
    cookieName = 'myCookie';
  }
  var expDate = Tools.DateToGMTStringCookie(expiresDate);
  if (cookieValue.length >= 4000){
    alert('Das Cookie kann nicht gespeichert werden.\nDie Datenmenge übersteigt die maximal zu speichernde Datenmenge eines Cookies.\nBitte überprüfen Sie Ihre Daten.');
    return false;
  }
  cookieValue = cookieValue.replace(/;/,'###');
  var cookieStr = '';
  if (valueType == 'int'){
    cookieStr = cookieName +'=' + cookieValue +';';
  } else {
    cookieStr = cookieName +'="' + cookieValue +'";';
  }
  if (expDate){
    cookieStr += ' expires='+ expDate +';';
  }
  if (path){
    cookieStr += ' path='+ path + ';';
  }
  version = 3;
  if (version && version.toString().length){
    cookieStr += ' version="'+ version + '";';
  }
  document.cookie = cookieStr;
}

Tools.DateToGMTStringCookie = function(date){
  if (! date){
    return false;
  }
  var str = '';
  var gtm = '';
  var gtmJS = date.toGMTString();
  var gtmArr = gtmJS.split(/ /);
  for (var i=0; i<gtmArr.length; i++){
    if (i>1 && i<4){
      gtm += '-';
    } else if (i > 0){
      gtm += ' ';
    }
    gtm += gtmArr[i];
  }
  return gtm;
}

Tools.confirmURL = function(url){
  if (! url){
    return false;
  }
  var conf = confirm('Möchten Sie den Datensatz wirklich löschen?');
  if (conf) {
    return url;
  }
}

Tools.checkRequiredData = function(htmlElement) {
  if (!arguments.length) {
    return false;
  }
  var _dataType = new RegExp(' \\[datatype\\=');
  var _required = new RegExp(' \\[required');
  var _requiredOn = new RegExp(' \\[requiredOn\\]');
  var _requiredOr = new RegExp(' \\[requiredOr\\]');
  var tagName = htmlElement['tagName'];
  tagName = tagName.toLowerCase();
  if (tagName == 'form'){
    for (var i=0; i<htmlElement.elements.length; i++){
      var idRequiredOn = undefined;
      var elemRequiredOn = undefined;
      var idRequiredOr = undefined;
      var elemRequiredOr = undefined;
      var mulitple = undefined;
      if(htmlElement.elements[i].nodeName.toLowerCase() == 'fieldset'){
        continue;
      }
      if (!htmlElement.elements[i].name.length || (!htmlElement.elements[i].className.length || (!htmlElement.elements[i].className.toString().match(_required) && !htmlElement.elements[i].className.toString().match(_dataType))) ){
        continue;
      }
      var requiredElemHasValue = false;
      var dataTypeElemHasDataTypeValue = true;
      if (htmlElement.elements[i].className.toString().match(_dataType)){
        if (! Tools.checkDataTypeElement(htmlElement.elements[i])) {
          dataTypeElemHasDataTypeValue = false;
        }
      }
      if (htmlElement.elements[i].className.toString().match(_requiredOn)){
        idRequiredOn = htmlElement.elements[i].className.toString().split(_requiredOn)[1].toString().replace(/[\[\]]/gi,'');
        elemRequiredOn = document.getElementById(idRequiredOn);
        if (Tools.checkRequiredElement(elemRequiredOn)){
          requiredElemHasValue = Tools.checkRequiredElement(htmlElement.elements[i]);
        } else {
          requiredElemHasValue = true;
        }
      } else if (htmlElement.elements[i].className.toString().match(_requiredOr)){
        idRequiredOr = htmlElement.elements[i].className.toString().split(_requiredOr)[1].toString().replace(/[\[\]]/gi,'');
        elemRequiredOr = document.getElementById(idRequiredOr);
        if (Tools.checkRequiredElement(elemRequiredOr)){
          requiredElemHasValue = true;
        } else {
          requiredElemHasValue = Tools.checkRequiredElement(htmlElement.elements[i]);
        }
      } else {
        requiredElemHasValue = Tools.checkRequiredElement(htmlElement.elements[i]);
      }
      if (!requiredElemHasValue){
        var shownElemName = htmlElement.elements[i].name;
        if (htmlElement.elements[i].title){
          shownElemName = htmlElement.elements[i].title;
        }
        if (elemRequiredOr != undefined){
          var shownElemNameOr = elemRequiredOr.name;
          if (elemRequiredOr.title){
            shownElemNameOr = elemRequiredOr.title;
          }
          alert('Bitte füllen Sie das Feld >>'+ shownElemName +'<< oder >>'+ shownElemNameOr +'<< aus!');
        } else {
          alert('Bitte füllen Sie das Feld >>'+ shownElemName +'<< aus!');
        }
        if (htmlElement.elements[i].type != 'hidden') {
          htmlElement.elements[i].focus();
        }
        return false;
      }
      if (!dataTypeElemHasDataTypeValue){
        var shownElemName = htmlElement.elements[i].name;
        if (htmlElement.elements[i].title){
          shownElemName = htmlElement.elements[i].title;
        }
        if (htmlElement.elements[i].type != 'hidden') {
          htmlElement.elements[i].focus();
        }
        return false;
      }
    }
    return true;
  }
}

Tools.checkRequiredDataFormFragment = function(htmlElement, elem) {
  if (arguments.length != 2) {
    return false;
  }
  var _dataType = new RegExp(' \\[datatype\\=');
  var _required = new RegExp(' \\[required');
  var _requiredOn = new RegExp(' \\[requiredOn\\]');
  var _requiredOr = new RegExp(' \\[requiredOr\\]');
  var tagName = htmlElement['tagName'];
  tagName = tagName.toLowerCase();
  if (tagName == 'form'){
    for (var i=0; i<htmlElement.elements.length; i++){
      var idRequiredOn = undefined;
      var elemRequiredOn = undefined;
      var idRequiredOr = undefined;
      var elemRequiredOr = undefined;
      if(htmlElement.elements[i].nodeName.toLowerCase() == 'fieldset'){
        continue;
      }
      if (!htmlElement.elements[i].name.length || (!htmlElement.elements[i].className.length || (!htmlElement.elements[i].className.toString().match(_required) && !htmlElement.elements[i].className.toString().match(_dataType))) ){
        continue;
      }
      if (! Tools.isChildOfElement(elem, htmlElement.elements[i])) {
        continue;
      }
      var requiredElemHasValue = false;
      var dataTypeElemHasDataTypeValue = true;
      if (htmlElement.elements[i].className.toString().match(_dataType)){
        if (! Tools.checkDataTypeElement(htmlElement.elements[i])) {
          dataTypeElemHasDataTypeValue = false;
        }
      }
      if (htmlElement.elements[i].className.toString().match(_requiredOn)){
        var idRequiredOn = htmlElement.elements[i].className.toString().split(_requiredOn)[1].toString().replace(/[\[\]]/gi,'');
        var elemRequiredOn = document.getElementById(idRequiredOn);
        if (Tools.checkRequiredElement(elemRequiredOn)){
          requiredElemHasValue = Tools.checkRequiredElement(htmlElement.elements[i]);
        } else {
          requiredElemHasValue = true;
        }
      } else if (htmlElement.elements[i].className.toString().match(_requiredOr)){
        var idRequiredOr = htmlElement.elements[i].className.toString().split(_requiredOr)[1].toString().replace(/[\[\]]/gi,'');
        var elemRequiredOr = document.getElementById(idRequiredOr);
        if (Tools.checkRequiredElement(elemRequiredOr)){
          requiredElemHasValue = true;
        } else {
          requiredElemHasValue = Tools.checkRequiredElement(htmlElement.elements[i]);
        }
      } else {
        requiredElemHasValue = Tools.checkRequiredElement(htmlElement.elements[i]);
      }
      if (!requiredElemHasValue){
        var shownElemName = htmlElement.elements[i].name;
        if (htmlElement.elements[i].title){
          shownElemName = htmlElement.elements[i].title;
        }
        if (elemRequiredOr != undefined){
          var shownElemNameOr = elemRequiredOr.name;
          if (elemRequiredOr.title){
            shownElemNameOr = elemRequiredOr.title;
          }
          alert('Bitte füllen Sie das Feld >>'+ shownElemName +'<< oder >>'+ shownElemNameOr +'<< aus!');
        } else {
          alert('Bitte füllen Sie das Feld >>'+ shownElemName +'<< aus!');
        }
        if (htmlElement.elements[i].type != 'hidden') {
          htmlElement.elements[i].focus();
        }
        return false;
      }
      if (!dataTypeElemHasDataTypeValue){
        var shownElemName = htmlElement.elements[i].name;
        if (htmlElement.elements[i].title){
          shownElemName = htmlElement.elements[i].title;
        }
        if (htmlElement.elements[i].type != 'hidden') {
          htmlElement.elements[i].focus();
        }
        return false;
      }
    }
    return true;
  }
}

Tools.isChildOfElement = function(parentElem, childElem) {
  if (arguments.length != 2) {
    return false;
  }
  var nextElem = childElem;
  while (nextElem && nextElem.nodeName.toLowerCase() != 'body'){
    if (nextElem == parentElem){
      return true;
    }
    nextElem = nextElem.parentNode;
  }
  return false;
}

Tools.checkDataTypeElement = function(elem) {
  if (!arguments.length) {
    return false;
  }
  if (elem == undefined){
    return false;
  }
  var _dataTypeDE = new RegExp(' \\[datatype\\=Date\\_DE\\]');
  var _dataTypeCMS = new RegExp(' \\[datatype\\=Date\\_CMS\\]');
  var _dataTypeMail = new RegExp(' \\[datatype\\=Mail\\]');
  var _dataTypeAge = new RegExp(' \\[datatype\\=Age\\]');
  var _dataTypeLedgerNr = new RegExp(' \\[datatype\\=LedgerNr\\]');
  var _dataTypeInteger = new RegExp(' \\[datatype\\=Integer\\]');
  var _value = '';
  if (elem.type == 'select-one'){
    if (elem.selectedIndex < 0){
      return false;
    }
    _value = Tools.stripSpace(elem.options[elem.selectedIndex].value);
  } else if (elem.type == 'select-multiple'){
    for (var ii=0; ii<elem.options.length; ii++){
      if (elem.options[ii].selected){
        _value += Tools.stripSpace(elem.options[ii].value);
      }
    }
  } else if (elem.type == 'radio'){
    if (elem.length){
      for (var ii=0; ii<elem.length; ii++){
        if (elem[ii].checked){
          _value += Tools.stripSpace(elem[ii].value);
        }
      }
    } else {
      if (elem.checked){
        _value = Tools.stripSpace(elem.value);
      }
    }
  } else if (elem.type == 'checkbox'){
    if (elem.length){
      for (var ii=0; ii<elem.length; ii++){
        if (elem[ii].checked){
          _value += Tools.stripSpace(elem[ii].value);
        }
      }
    } else {
      if (elem.checked){
        _value = Tools.stripSpace(elem.value);
      }
    }
  } else {
    _value = Tools.stripSpace(elem.value);
  }
  if (! _value.length){
    return true;
  }
  if (elem.className.toString().match(_dataTypeDE)){
    return Tools.validateDateFormat(_value, 'DE');
  }
  if (elem.className.toString().match(_dataTypeCMS)){
    return Tools.validateDateFormat(_value, 'CMS');
  }
  if (elem.className.toString().match(_dataTypeMail)){
    return Tools.validateMailFormat(_value);
  }
  if (elem.className.toString().match(_dataTypeLedgerNr)){
    return Tools.validateLedgerNumber(_value);
  }
  if (elem.className.toString().match(_dataTypeAge)){
    return Tools.validateAge(_value);
  }
  if (elem.className.toString().match(_dataTypeInteger)){
    return Tools.validateInteger(_value);
  }
  return true;
}

Tools.validateInteger = function(value) {
  if (! arguments.length) {
    return;
  }
  if (! value.match(/^[+-]?\d\d*$/)) {
    alert('Bitte geben Sie nur ganze Zahlen ein!');
    return false;
  }
  return true;
}

Tools.validateAge = function(value) {
  if (! arguments.length) {
    return;
  }
  if (! Tools.validateInteger(value)) {
    return false;
  }
  if (! (parseInt(value) > 0 && parseInt(value) < 130)) {
    var str = '';
    if (parseInt(value) > 120){
      str += 'Herzlichen Glückwunsch zu Ihrem sehr hohen Alter!!\n'
    } else {
      str += 'Sie sind leider noch nicht geboren!!\n';
    }
    str += 'Bitte geben Sie eine Zahl zwischen 1 und 130 ein!'
    alert(str);
    return false;
  }
  return true;
}

Tools.validateLedgerNumber = function(value) {
  if (! arguments.length) {
    return;
  }
  if (! value.match(/^(\d\d?\d?\d?\d?\d?\d?\d?\d?\d?)$/)) {
    alert('Bitte geben Sie eine Zahl mit 1 - 10 Stellen ein!');
    return false;
  }
  return true;
}

Tools.validateDateFormat = function(value, variant) {
  if (! arguments.length) {
    return;
  }
  if (variant == 'CMS'){
    if (! value.match(/^(\d\d\d\d)\-(\d\d)\-(\d\d)$/)) {
      alert('Bitte geben Sie das Datum im Format jjjj-mm-dd an!');
      return false;
    }
  } else {
    if (! value.match(/^(\d\d?)\.(\d\d?)\.(\d\d\d\d)$/)) {
      alert('Bitte geben Sie das Datum im Format tt.mm.jjjj an!');
      return false;
    }
  }
  return true;
}

Tools.validateMailFormat = function(value) {
  if (!arguments.length) {
    return false;
  }
  var regEx = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)(\\@)([a-zA-Z0-9\\-\\.]+)(\\.)([a-zA-Z]{2,4})$');
  if (! value.match(regEx)){
    alert('Bitte geben Sie eine gültige E-Mail-Adresse an!');
    return false;
  }
  return true;
}

Tools.checkRequiredElement = function(elem) {
  if (!arguments.length) {
    return false;
  }
  if (elem == undefined){
    return false;
  }
  var _multipleRegEx = new RegExp(' \\[multiple\\]');
  var _multiple = false;
  if(elem.className.toString().match(_multipleRegEx)){
    _multiple = true;
  }
  if (_multiple){
    return Tools.checkRequiredElementMultiple(elem);
  }
  return Tools.checkRequiredElementSingle(elem);
}

Tools.checkRequiredElementMultiple = function(elem) {
  if (!arguments.length) {
    return false;
  }
  if (elem == undefined){
    return false;
  }
  var requiredValue = '';
  var arr = document.getElementsByName(elem.name);
  for (var i=0; i<arr.length; i++) {
    var multipleElem = arr[i];
    if (! Tools.checkRequiredElementSingle(multipleElem)){
      continue;
    }
    return true;
  }
  return false;
}

Tools.checkRequiredElementSingle = function(elem) {
  if (!arguments.length) {
    return false;
  }
  if (elem == undefined){
    return false;
  }
  var requiredValue = '';
  if (elem.type == 'select-one'){
    if (elem.selectedIndex < 0){
      return false;
    }
    requiredValue = Tools.stripSpace(elem.options[elem.selectedIndex].value);
  } else if (elem.type == 'select-multiple'){
    for (var ii=0; ii<elem.options.length; ii++){
      if (elem.options[ii].selected){
        requiredValue += Tools.stripSpace(elem.options[ii].value);
      }
    }
  } else if (elem.type == 'radio'){
    if (elem.length){
      for (var ii=0; ii<elem.length; ii++){
        if (elem[ii].checked){
          requiredValue += Tools.stripSpace(elem[ii].value);
        }
      }
    } else {
      if (elem.checked){
        requiredValue = Tools.stripSpace(elem.value);
      }
    }
  } else if (elem.type == 'checkbox'){
    if (elem.length){
      for (var ii=0; ii<elem.length; ii++){
        if (elem[ii].checked){
          requiredValue += Tools.stripSpace(elem[ii].value);
        }
      }
    } else {
      if (elem.checked){
        requiredValue = Tools.stripSpace(elem.value);
      }
    }
  } else {
    requiredValue = Tools.stripSpace(elem.value);
  }
  if (!requiredValue.length){
    return false;
  }
  return true;
}

Tools.resetFormElement = function(elem) {
  if (!arguments.length) {
    return false;
  }
  if (elem == undefined){
    return false;
  }
  var requiredValue = '';
  if (elem.type == 'select-one'){
    elem.options[0].selected = 'selected';
  } else if (elem.type == 'select-multiple'){
    elem.options[0].selected = 'selected';
  } else if (elem.type == 'radio'){
    if (elem.length){
      for (var ii=0; ii<elem.length; ii++){
        elem[ii].checked = false;
      }
    } else {
      elem.checked = false;
    }
  } else if (elem.type == 'checkbox'){
    if (elem.length){
      for (var ii=0; ii<elem.length; ii++){
        elem[ii].checked = false;
      }
    } else {
      elem.checked = false;
    }
  } else {
    elem.value = '';
  }
  return true;
}

Tools.stripSpace = function(attr){
  var result = '';
  if (attr){
    attr = new String(attr);
    result = attr.replace(/^\s+/,'');
    result = result.replace(/\s+$/,'');
  }
  return result;
}

Tools.checkDataSize = function(elem, size) {
  if (!arguments.length) {
    return false;
  }
  var _type = elem.type.toLowerCase();
  var _value = Tools.stripSpace(elem.value);
  if (_type == 'textarea'){
    if (_value.length >= size){
      elem.value = _value.substring(0, size);
    }
  }
}

Tools.validateEmail = function(elem) {
  if (!arguments.length) {
    return false;
  }
  var _value = Tools.stripSpace(elem.value);
  var regEx = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)(\\@)([a-zA-Z0-9\\-\\.]+)(\\.)([a-zA-Z]{2,4})$');
  if (! _value.match(regEx)){
    alert('Bitte geben Sie eine gültige E-Mail-Adresse an!');
    elem.focus();
  }
}

Tools.validateURL = function(elem) {
  if (!arguments.length) {
    return false;
  }
  var _value = Tools.stripSpace(elem.value);
  var regEx = new RegExp('^(http:\/\/|https:\/\/|mailto:\/\/|ftp:\/\/|\/)');
  if (! _value.match(regEx)){
    alert('Bitte geben Sie eine gültige URL an!\nEine gültige URL muß mit http://, https://, etc. anfangen');
    elem.focus();
  }
}

Tools.openLinkinOpener = function(url) {
  if (!arguments.length) {
    return false;
  }
  var root;
  if (window.opener){
    root = window.opener;
  }
  if (parent.opener){
    root = parent.opener;
  }
  if (parent.top.opener){
    root = parent.top.opener;
  }
  if (! root){
    return true;
  }
  root.location = url;
  root.focus();
  return false;
}

Tools.submitQuichsearch = function(htmlElement) {
  if (!arguments.length) {
    return false;
  }
  var tagName = htmlElement['tagName'];
  tagName = tagName.toLowerCase();
  if (tagName == 'form'){
    var regExp = new RegExp('Stichwort|Stichwort eingeben|Suchwort|Suchwort eingeben|Suchbegriff|Suchbegriff eingeben');
    for (var i=0; i<htmlElement.elements.length; i++){
      var _value = Tools.stripSpace(htmlElement.elements[i].value);
      if(! _value.match(regExp)){
        continue;
      }
      htmlElement.elements[i].value = '';
    }
    return true;
  }
}

Tools.formatCashFloat = function(n){
  cash_float = parseFloat(new String(n).replace(/\,/,'.'));
  cash_float = parseFloat(cash_float * 100);
  cash_float = parseFloat(Math.round(cash_float) / 100);
  cash_float = new String(cash_float);
  if (!cash_float.match(/\./)){
    cash_float = cash_float + '.00';
  }
  if (cash_float.split(/\./)[1].length == 1){
    cash_float = cash_float + '0';
  }
  cash_float = cash_float.replace(/\./,',');
  return cash_float;
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tools.addEvent = function(oneEvent, obj, handler, bol, ieWindow){
  if (arguments.length < 3) {
    focus();
    throw new Error('Tools.addEvent: Falsche Anzahl von Argumenten!');
  }
  if(window.addEventListener){
    // Other
    obj.addEventListener(oneEvent, handler, bol);
  } else if(obj.attachEvent){
    // IE
    var win = window;
    if (ieWindow) {
      win = ieWindow;
    }
    obj['e' + oneEvent + handler] = handler;
    obj[oneEvent + handler] = function() { obj['e' + oneEvent + handler] ( win.event ); win.event.cancelBubble = true;};
    obj.attachEvent('on' + oneEvent, obj[oneEvent + handler]);
  }
  return true;
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tools.removeEvent = function(oneEvent, obj, handler, bol){
  if (arguments.length < 3) {
    focus();
    throw new Error('Tools.removeEvent: Falsche Anzahl von Argumenten!');
  }
  if(window.removeEventListener){
    // Other
    obj.removeEventListener(oneEvent, handler, bol);
  } else if(obj.detachEvent){
    // IE
    obj.detachEvent( "on"+ oneEvent, obj[oneEvent + handler] );
    obj[oneEvent + handler] = undefined;
    obj["e" + oneEvent + handler] = undefined;
  }
  return true;
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tools.eventStopPropagation = function(event){
  if (arguments.length!=1){
    focus();
    throw new Error("Tools:eventStopPropagation: Falsche Anzahl von Argumenten!");
  }
  if (event.stopPropagation){
    // Other
    event.stopPropagation();
  } else {
    // IE
    event.cancelBubble = true;
  }
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tools.eventPreventDefault = function(event){
  if (arguments.length!=1){
    focus();
    throw new Error("Tools:eventPreventDefault: Falsche Anzahl von Argumenten!");
  }
  if (event.preventDefault){
    // Other
    event.preventDefault();
  } else {
    // IE
    event.returnValue = false;
  }
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tools.jumpForwardInput = function(e, elem){
 if (arguments.length != 2) {
   focus();
   throw new Error('Tools.jumpForwardInput: Falsche Anzahl von Argumenten!');
 }
 if (! elem){
   return;
 }
 Tools.eventPreventDefault(e);
 if (! window.addEventListener)  {
  // IE
  e = window.event;
  key = e.keyCode;
 } else {
   // OTHER
   key = e.which;
 }
 if (key != 8 && key < 48 || key > 122){
   return;
 }
 var idPostfix = elem.id.toString().replace(/_token/,'');
 if (key == 8){
   var nextIdx = '_token' + parseFloat(parseFloat(idPostfix) - 1);
   var nextElem = document.getElementById(nextIdx);
   if (elem.value){
     elem.value = '';
     return;
   }
 } else {
   var nextIdx = '_token' + parseFloat(parseFloat(idPostfix) + 1);
   var nextElem = document.getElementById(nextIdx);
   elem.value = String.fromCharCode(key);
 }
 if (nextElem){
   nextElem.focus();
   return;
 }
 var submitBut = document.getElementById('submit-form');
 if (submitBut && parseFloat(idPostfix) >= 4){
   submitBut.focus();
 }
 return;
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tools.reloadCounter = 0;

Tools.reloadCodeField = function(url){
  if (arguments.length != 1) {
    return;
  }
  Ajax.cursorWait();
  Tools.reloadCounter++;
  url += '&__RC=' + Tools.reloadCounter;
  //alert('aufruf: ' + url);
  var img = new Image();
  img.className = "form-code-validate-secure";
  img.onload = function () {Tools.drawCodeField(this);}
  img.src = url;
  return false;
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tools.drawCodeField = function(img){
  if (arguments.length != 1) {
    return;
  }
  //alert('nach bild-onload: ' + img.src);
  img.onload = '';
  var elem = document.getElementById('_sicherheitscode_');
  elem.innerHTML = '';
  elem.appendChild(img);
  /*
  var str = '<img src="'+ img.src +'" border="0" class="form-code-validate-secure" /><br />';
  elem.innerHTML = str;
  */
  Ajax.cursorFinished();
  return false;
}

Tools.setBank = function(elem, url){
  if (arguments.length != 2) {
    return;
  }
  var reqUrl = url + elem.value;
  Ajax.cursorWait();
  var myAjax = Ajax.createInstance();
  myAjax.setAsynchron(false);
  myAjax.setMethod('GET');
  myAjax.setURL(reqUrl);
  myAjax.open();
  myAjax.sendNull();
  var setBank = Tools._setBank(myAjax, elem);
  Ajax.cursorFinished();
}

Tools._setBank = function(ajax, elem){
  if (arguments.length != 2) {
    return;
  }
  if (ajax.getReadyState() != 4){
    return Ajax.cursorWait();
  }
  if (ajax.getReadyState() == 4){
    Ajax.cursorFinished();
    var xml = ajax.getReadableXMLNode();
    //alert(ajax.getResponseText());
    //alert(xml);
    if (! xml){
      alert('Es ist ein Fehler aufgetreten!');
      return;
    }
    var bankAnzeigeElem = document.getElementById('_Kreditinstitut_');
    var bankCGIElem = document.getElementById('konto_bank');
    var code = ajax.getSingleNodeValue('code');
    if (code == 'fail'){
      alert('Die Bankleitzahl konnte nicht ermittelt werden.\nBitte überprüfen Sie Ihre Angaben');
      bankAnzeigeElem.innerHTML = 'wird automatisch eingefügt';
      bankCGIElem.value = '';
      elem.value = '';
      elem.focus();
      return false;
    }
    var bankName = ajax.getSingleNodeValue('bank');
    bankCGIElem.value = bankName;
    if (bankAnzeigeElem) {
      bankAnzeigeElem.innerHTML = bankName;
    }
  }
  return true;
}




/////////////////////////////////////////////////////////////////////////////////////////////////////////////


var undefined;

//*****************************************************

function ContentRotator(idx) {
  this.id = undefined;  
  this._direction = 'horizontal'; // horizontal,vertical 
  this._mode = 'standard'; // standard,fade
  this._speed = 10; // '1 - n' timeout-speed msec
  this._speedStep =  2; // '1 - n' Pixelschritte px  
  this._activeElem = undefined;  
  this._locked = false;    
  this._timeout = undefined;  
  this.contentElementList = [];  
  
  this._setId(idx);
}

//*****************************************************

ContentRotator.prototype._setId = function (str) {
  if (arguments.length != 1) {
    focus();
    throw new Error("ContentRotator->_setId: Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("ContentRotator->_setId: Argument str ist nicht vom Typ String!");
  }
  this.id = str;
}        

//*****************************************************

ContentRotator.prototype._setActiveElem = function (str) {
  if (arguments.length != 1) {
    focus();
    throw new Error("ContentRotator->_setActiveElem: Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("ContentRotator->_setActiveElem: Argument str ist nicht vom Typ String!");
  }
  var elem = document.getElementById(str);
  if (! elem) {
    focus();
    throw new Error("ContentRotator->_setActiveElem: Es existiert kein HTML-Element mit ID="+ str +"!");
  }
  this._activeElem = elem;
}       

//*****************************************************

ContentRotator.prototype._getActiveElem = function () {
  if (this._activeElem == undefined) {
    if (this.contentElementList.length) {
      this._setActiveElem(this.contentElementList[0].id);
    }
  }
  return  this._activeElem;
}   

//*****************************************************

ContentRotator.prototype._getRootElem = function () {
  var root = document.getElementById(this.id);
  if (! parent) {
    focus();
    throw new Error('ContentRotator->_getRootElem: Es existiert kein HTML-Element mit ID='+ this.id +'!');
  }
  return root;
}  

//*****************************************************

ContentRotator.prototype._getMoveElem = function () {
  var moveElem = document.getElementById('_ContentRotator_inner_'+ this.id);
  if (! parent) {
    focus();
    throw new Error('ContentRotator->_getMoveElem: Es existiert kein HTML-Element mit ID=_ContentRotator_inner_'+ this.id +'!');
  }
  return moveElem;
}

//*****************************************************

ContentRotator.prototype.setDirection = function (str) {
  if (arguments.length != 1) {
    focus();
    throw new Error("ContentRotator->setDirection: Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("ContentRotator->setDirection: Argument str ist nicht vom Typ String!");
  }
  this._direction = str;
}

//*****************************************************

ContentRotator.prototype.setMode = function (str) {
  if (arguments.length != 1) {
    focus();
    throw new Error("ContentRotator->setMode: Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("ContentRotator->setMode: Argument str ist nicht vom Typ String!");
  }
  this._mode = str;
}

//*****************************************************

ContentRotator.prototype.setSpeed = function (n){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->setSpeed: Falsche Anzahl von Argumenten!');
  }
  if (typeof n != 'number') {
    focus();
    throw new Error('ContentRotator->setSpeed: Argument n ist nicht vom Typ number!');
  }
  this._speed = n;
}

//*****************************************************

ContentRotator.prototype.setSpeedStep = function (n){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->setSpeedStep: Falsche Anzahl von Argumenten!');
  }
  if (typeof n != 'number') {
    focus();
    throw new Error('ContentRotator->setSpeedStep: Argument n ist nicht vom Typ number!');
  }
  this._speedStep = n;
}

//*****************************************************

ContentRotator.prototype.addContentElement = function (obj){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->addContentElement: Falsche Anzahl von Argumenten!');
  }
  if (! (obj instanceof ContentRotatorElement)) {
    focus();
    throw new Error('ContentRotator->addContentElement: Argument obj ist keine Instance von ContentRotatorElement!');
  }
  this.contentElementList.push(obj);
}

//*****************************************************

ContentRotator.prototype.draw = function (){
  var html = this._getContentHTML();
  var root = this._getRootElem();
  root.innerHTML = html;
}

//*****************************************************

ContentRotator.prototype.rotate = function (id){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->rotate: Falsche Anzahl von Argumenten!');
  }
  if (this._locked) {
    return;
  }
  this._locked = true;
  if (this._mode == 'fade') {
    return this._fade(id);
  }
  return this._move(id);
}

//*****************************************************

ContentRotator.prototype._move = function (id){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->_move: Falsche Anzahl von Argumenten!');
  }
  if (this._direction == 'vertical') {
    return this._moveVertical(id);
  }
   return this._moveHorizontal(id);
}

//*****************************************************

ContentRotator.prototype._moveHorizontal = function (id){
  if (this._timeout) {
    window.clearTimeout(this._timeout);
  }
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->_moveHorizontal: Falsche Anzahl von Argumenten!');
  }
  var root = this._getRootElem();
  var moveElem = this._getMoveElem();
  var toRotate = document.getElementById(id);
  var posRoot = ContentRotator.getLeftPosition(root);
  var posToRotate = ContentRotator.getLeftPosition(toRotate);
  if (posRoot == posToRotate)  {
    this._setActiveElem(id);
    this._locked = false;
    return;
  }
  var moveStep = this._speedStep;
  if (Math.abs(posRoot - posToRotate) < moveStep) {
    moveStep = Math.abs(posRoot - posToRotate);
  }
  if (posToRotate > posRoot) {
    moveStep *= -1;
  }
  var _left = moveElem.style.left;
  if (_left == '') {
    //_left = ContentRotator.getLeftPosition(moveElem);
    _left = 0;
  }
  moveElem.style.left = parseFloat(parseFloat(_left) + moveStep) + 'px';
  var instance = ContentRotator.getInstance(this.id);
  var func = function () {
    return instance._moveHorizontal(id);
  }
  this._timeout = window.setTimeout(func, this._speed);
}

//*****************************************************

ContentRotator.prototype._moveVertical = function (id){
  if (this._timeout) {
    window.clearTimeout(this._timeout);
  }
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->_moveVertical: Falsche Anzahl von Argumenten!');
  }
  var root = this._getRootElem();
  var moveElem = this._getMoveElem();
  var toRotate = document.getElementById(id);
  var posRoot = ContentRotator.getTopPosition(root);
  var posToRotate = ContentRotator.getTopPosition(toRotate);
  if (posRoot == posToRotate)  {
    this._setActiveElem(id);
    this._locked = false;
    return;
  }
  var moveStep = this._speedStep;
  if (Math.abs(posRoot - posToRotate) < moveStep) {
    moveStep = Math.abs(posRoot - posToRotate);
  }
  if (posToRotate > posRoot) {
    moveStep *= -1;
  }
  var _top = moveElem.style.top;
  if (_top == '') {
    //_top = ContentRotator.getTopPosition(moveElem);
    _top = 0;
  }
  moveElem.style.top = parseFloat(parseFloat(_top) + moveStep) + 'px';
  var instance = ContentRotator.getInstance(this.id);
  var func = function () {
    return instance._moveHorizontal(id);
  }
  this._timeout = window.setTimeout(func, this._speed);
}

//*****************************************************

ContentRotator.prototype._fade = function (id){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->_fade: Falsche Anzahl von Argumenten!');
  }
  var toRotate = document.getElementById(id);
  var active = this._getActiveElem();
  var instance = ContentRotator.getInstance(this.id);
  var endFuncFadeIn = function () {
    instance._setActiveElem(id);
    instance._locked = false;
  }
  var endFuncFadeOut = function () {
    instance._fadeMoveToPosition(id);
    instance._resetOpacity(active);
    instance._fadeIn(toRotate, endFuncFadeIn);
    return;
  }
  this._fadeOut(active, endFuncFadeOut);
}

//*****************************************************

ContentRotator.prototype._fadeOut = function (elem, endFunc){
  if (this._timeout) {
    window.clearTimeout(this._timeout);
  }
  if (arguments.length<1) {
    focus();
    throw new Error('ContentRotator->_fadeOut: Falsche Anzahl von Argumenten!');
  }
  if (elem.filters != undefined){
    // IE
    var opValue = elem.filters['Alpha']['opacity'];
    if (opValue == undefined) {
      opValue = 100;
      elem.filters['Alpha']['opacity'] = opValue;
      elem.filters['Alpha']['finishopacity'] = opValue;
    }
    opValue = parseFloat(opValue);
    opValue -= 5;
    elem.filters['Alpha']['opacity'] = opValue;
    elem.filters['Alpha']['finishopacity'] = opValue;
  } else {
    // Other
    var opValue = elem.style.opacity;
    if (opValue == '') {
      opValue = 1;
      elem.style.opacity = opValue;
    }
    opValue = parseFloat(opValue);
    opValue -= 0.05;
    elem.style.opacity = opValue;
  }
  if (opValue > 0) {
    var instance = ContentRotator.getInstance(this.id);
    var func = function () {
      instance._fadeOut(elem, endFunc);
    }
    this._timeout = window.setTimeout(func, this._speed);
    return;
  }
  if (endFunc) {
    endFunc();
  }
}

//*****************************************************

ContentRotator.prototype._fadeIn = function (elem, endFunc){
  if (this._timeout) {
    window.clearTimeout(this._timeout);
  }
  if (arguments.length<1) {
    focus();
    throw new Error('ContentRotator->_fadeIn: Falsche Anzahl von Argumenten!');
  }
  var max = 1;
  if (elem.filters != undefined){
    // IE
    max = 100;
    var opValue = elem.filters['Alpha']['opacity'];
    if (opValue == undefined) {
      opValue = 0;
      elem.filters['Alpha']['opacity'] = opValue;
      elem.filters['Alpha']['finishopacity'] = opValue;
    }
    opValue = parseFloat(opValue);
    opValue += 5;
    elem.filters['Alpha']['opacity'] = opValue;
    elem.filters['Alpha']['finishopacity'] = opValue;
  } else {
    // Other
    var opValue = elem.style.opacity;
    if (opValue == '') {
      opValue = 0;
      elem.style.opacity = opValue;
    }   
    opValue = parseFloat(opValue);
    opValue += 0.05;
    elem.style.opacity = opValue;
  }
  if (opValue < max) {
    var instance = ContentRotator.getInstance(this.id);
    var func = function () {
      instance._fadeIn(elem, endFunc);
    }
    this._timeout = window.setTimeout(func, this._speed);
    return;
  }
  if (endFunc) {
    endFunc();
  }
}

//*****************************************************

ContentRotator.prototype._fadeMoveToPosition = function (id){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->_fadeMoveToPosition: Falsche Anzahl von Argumenten!');
  }
  var root = this._getRootElem();
  var toRotate = document.getElementById(id);
  var moveElem = this._getMoveElem();
  if (this._direction=='vertical') {
    var posRoot = ContentRotator.getTopPosition(root);
    var posToRotate = ContentRotator.getTopPosition(toRotate);
    var diff = parseFloat(posRoot - posToRotate);
    var _top = moveElem.style.top;
    if (_top == '') {
      _top = 0;
    }
    diff += parseFloat(_top);
    moveElem.style.top = diff + 'px';
    return;
  }
  var posRoot = ContentRotator.getLeftPosition(root);
  var posToRotate = ContentRotator.getLeftPosition(toRotate);
  var diff = parseFloat(posRoot - posToRotate);
  var _left = moveElem.style.left;
  if (_left == '') {
    _left = 0;
  }
  diff += parseFloat(_left);
  moveElem.style.left = diff + 'px';
}

//*****************************************************

ContentRotator.prototype._resetOpacity = function (elem){
  if (arguments.length!=1) {
    focus();
    throw new Error('ContentRotator->_resetOpacity: Falsche Anzahl von Argumenten!');
  }
  if (elem.filters != undefined){
    // IE
    elem.filters['Alpha']['opacity'] = 100;
    elem.filters['Alpha']['finishopacity'] = 100;
  } else {
    // Other
    elem.style.opacity = 1;
  }
}

//*****************************************************

ContentRotator.prototype._getContentHTML = function (){
   var html = '';
   html += '<div class="content-rotator-inner" id="_ContentRotator_inner_'+ this.id +'">\n'; 
     for (var i=0; i<this.contentElementList.length; i++) {
       var ce = this.contentElementList[i];
       html += '<div class="content-rotator-element" id="'+ ce.id +'">\n'; 
       html += ce.content;
       html += '<div class="float-aufheben"><br /></div>\n';
       var le = undefined;
       var ne = undefined;
       if (i>0 || i<parseFloat(this.contentElementList.length-1)) {
         html += '<p class="content-rotator-switch">\n'; 
         if (i>0) {
            le = this.contentElementList[i - 1];
            html += '<a href="javascript:void(0);" onclick="ContentRotator.getInstance(\''+ this.id +'\').rotate(\''+ le.id +'\');" class="content-rotator-switch">zurück</a>'; 
         }          
         if (i<parseFloat(this.contentElementList.length-1)) {
           if (i>0) {
              html += ' | '; 
           }         
           ne = this.contentElementList[i +1]; 
           html += '<a href="javascript:void(0);" onclick="ContentRotator.getInstance(\''+ this.id +'\').rotate(\''+ ne.id +'\');" class="content-rotator-switch">weiterlesen</a>'; 
         }          
         html += '</p>\n'; 
       }
       html += '<div class="float-aufheben"><br /></div>\n';
       html += '</div>\n'; 
     }
   html += '<div class="float-aufheben"><br /></div>\n'; 
   html += '</div>\n'; 
   return html;
}

//*****************************************************

ContentRotator._registerInstance = {};
ContentRotator._registerInstanceLength = [];
ContentRotator._increment = [];

//*****************************************************

ContentRotator.getTopPosition = function(elem) {
  if (arguments.length!=1) {
    focus();
    throw new Error("ContentRotator.getTopPosition: Falsche Anzahl von Argumenten!");
  }  
  var pos = 0;
  if (elem.nodeName.toLowerCase() == 'area'){
    elem = elem.parentNode;
  }
  if (elem.nodeName.toLowerCase() == 'map'){
    elem = elem.parentNode;
  }
  var nextElem = elem;
  pos += nextElem.offsetTop;
  while (nextElem.offsetParent) {
    pos += nextElem.offsetParent.offsetTop;
    nextElem = nextElem.offsetParent;
  }
  return parseFloat(pos);
}

//*****************************************************

ContentRotator.getLeftPosition = function(elem) {
  if (arguments.length!=1) {
    focus();
    throw new Error("ContentRotator.getLeftPosition: Falsche Anzahl von Argumenten!");
  }
  var pos = 0;
  if (elem.nodeName.toLowerCase() == 'area'){
    elem = elem.parentNode;
  }
  if (elem.nodeName.toLowerCase() == 'map'){
    elem = elem.parentNode;
  }
  var nextElem = elem;
  pos += nextElem.offsetLeft;
  while (nextElem.offsetParent) {
    pos += nextElem.offsetParent.offsetLeft;
    nextElem = nextElem.offsetParent;
  }
  return parseFloat(pos);
}

//*****************************************************

ContentRotator.getInstance = function(id) {
  if (arguments.length!=1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (! (ContentRotator._registerInstance[id])){
    focus();
    throw new Error("Es ist keine ContentRotator.Instance mit id=" + id + " registriert!");
  }
  return ContentRotator._registerInstance[id];
}

//*****************************************************

ContentRotator.createInstance = function(id) {
  if (!arguments.length) {
    id = '_ContentRotator_' + ContentRotator._increment.length;
    ContentRotator._increment.push(1);
  }
  if (! (ContentRotator._registerInstance[id])){
    ContentRotator._registerInstance[id] = new ContentRotator(id);
    ContentRotator._registerInstanceLength.push(id);
  } else {
    focus();
    throw new Error("ContentRotator.createInstance: id schon vorhanden!");
  }
  return ContentRotator.getInstance(id);
}



//*****************************************************
//*****************************************************
//*****************************************************
//*****************************************************

function ContentRotatorElement(idx) {
  this.id = undefined;
  this.content = '';
  
  this._setId(idx);
}

//*****************************************************

ContentRotatorElement.prototype._setId = function (str) {
  if (arguments.length != 1) {
    focus();
    throw new Error("ContentRotatorElement->_setId: Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("ContentRotatorElement->_setId: Argument str ist nicht vom Typ String!");
  }
  this.id = str;
}                    

//*****************************************************

ContentRotatorElement.prototype.setContent = function (str) {
  if (arguments.length != 1) {
    focus();
    throw new Error("ContentRotatorElement->setContent: Falsche Anzahl von Argumenten!");
  }
  if (typeof str != "string") {
    focus();
    throw new Error("ContentRotatorElement->setContent: Argument str ist nicht vom Typ String!");
  }
  this.content = str;
}

//*****************************************************

ContentRotatorElement._registerInstance = {};
ContentRotatorElement._registerInstanceLength = [];
ContentRotatorElement._increment = [];

//*****************************************************

ContentRotatorElement.getInstance = function(id) {
  if (arguments.length!=1) {
    throw new Error("Falsche Anzahl von Argumenten!");
  }
  if (! (ContentRotatorElement._registerInstance[id])){
    focus();
    throw new Error("Es ist keine ContentRotatorElement.Instance mit id=" + id + " registriert!");
  }
  return ContentRotatorElement._registerInstance[id];
}

//*****************************************************

ContentRotatorElement.createInstance = function(id) {
  if (!arguments.length) {
    id = '_ContentRotatorElement_' + ContentRotatorElement._increment.length;
    ContentRotatorElement._increment.push(1);
  }
  if (! (ContentRotatorElement._registerInstance[id])){
    ContentRotatorElement._registerInstance[id] = new ContentRotatorElement(id);
    ContentRotatorElement._registerInstanceLength.push(id);
  } else {
    focus();
    throw new Error("ContentRotatorElement.createInstance: id schon vorhanden!");
  }
  return ContentRotatorElement.getInstance(id);
}

//*****************************************************


