function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global variable for tracking the currently active button.

var activeButton = null;

// Capture mouse clicks on the page so any active button can be
// deactivated.

if (browser.isIE)
  document.onmousedown = pageMousedown;
if (browser.isNS)
  document.addEventListener("mousedown", pageMousedown, true);

function pageMousedown(event) {

  var el;

  // If there is no active menu, exit.

  if (!activeButton)
    return;

  // Find the element that was clicked on.

  if (browser.isIE)
    el = window.event.srcElement;
  if (browser.isNS)
    el = (event.target.className ? event.target : event.target.parentNode);

  // If the active button was clicked on, exit.

  if (el == activeButton)
    return;

  // If the element clicked on was not a menu button or item, close the
  // active menu.

  if (el.className != "menuButton"  && el.className != "menuItem" &&
      el.className != "menuItemSep" && el.className != "menu")
    resetButton(activeButton);
}

function buttonClick(button, menuName) {

  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Associate the named menu to this button if not already done.

  if (!button.menu)
    button.menu = document.getElementById(menuName);

  // Reset the currently active button, if any.

  if (activeButton && activeButton != button)
    resetButton(activeButton);

  // Toggle the button's state.

  if (button.isDepressed)
    resetButton(button);
  else
    depressButton(button);

  return false;
}

function buttonMouseover(button, menuName) {

  // If any other button menu is active, deactivate it and activate this one.
  // Note: if this button has no menu, leave the active menu alone.

  if (activeButton && activeButton != button) {
    resetButton(activeButton);
    if (menuName)
      buttonClick(button, menuName);
  }
}

function depressButton(button) {

  var w, dw, x, y;

  // Change the button's style class to make it look like it's depressed.

  button.className = "menuButtonActive";

  // For IE, set an explicit width on the first menu item. This will
  // cause link hovers to work on all the menu's items even when the
  // cursor is not over the link's text.

  if (browser.isIE && !button.menu.firstChild.style.width) {
    w = button.menu.firstChild.offsetWidth;
    button.menu.firstChild.style.width = w + "px";
    dw = button.menu.firstChild.offsetWidth - w;
    w -= dw;
    button.menu.firstChild.style.width = w + "px";
  }

  // Position the associated drop down menu under the button and
  // show it. Note that the position must be adjusted according to
  // browser, styling and positioning.

  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;
  if (browser.isIE) {
    x += 2;
    y += 2;
  }
  if (browser.isNS && browser.version < 6.1)
    y--;

  // Position and show the menu.

  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";

  // Set button state and let the world know which button is
  // active.

  button.isDepressed = true;
  activeButton = button;
}

function resetButton(button) {

  // Restore the button's style class.

  button.className = "menuButton";

  // Hide the button's menu.

  if (button.menu)
    button.menu.style.visibility = "hidden";

  // Set button state and clear active menu global.

  button.isDepressed = false;
  activeButton = null;
}

function getPageOffsetLeft(el) {

  // Return the true x coordinate of an element relative to the page.

  return el.offsetLeft + (el.offsetParent ? getPageOffsetLeft(el.offsetParent) : 0);
}

function getPageOffsetTop(el) {

  // Return the true y coordinate of an element relative to the page.

  return el.offsetTop + (el.offsetParent ? getPageOffsetTop(el.offsetParent) : 0);
}

function doresize ()
        {location.reload();return false;}
if(document.layers)window.captureEvents(Event.RESIZE); //window.onresize=doresize;

var  js10 = (document.images)?false:true; // NN2.x
var  js11 = (document.images) && ((window.screen)?false:true); // NN3.x
var  ie = ((document.all) && (window.offscreenBuffering)) ? true : false; // IE >= 4.x
var  isNS = ((document.captureEvents) && (!document.getElementById)) ? true : false; // NN4.x
var  mz = ((document.getElementById) && (!document.all) && (document.documentElement)) ? true : false; // NN6/MZ
var  op = ((document.getElementById) && (navigator.userAgent.indexOf('Opera') != -1)) ?true : false;
var isMacIE = ( (navigator.userAgent.indexOf("IE 4") > -1) && (navigator.userAgent.indexOf("Mac")  > -1) );

y=0; weiter=0;

function testen()
{
br=0;
        if (ie)
        {
        br=2;
        schicht='document.all["';stil='"].style';
        }
        if (isNS)
        {
        schicht='document.layers.scrollWindowDiv.document.layers["';stil='"]';
        }
        if (mz)
        {
        schicht='document.getElementById("';stil='").style';
        }
        if(op)
        {
        schicht='document.getElementById("';stil='").style';
        }
        /* elsewindow.location.href="controlling.html"; // nur NN und IE !!!*/
}

function moveIt(wen,wert)
{
test=y;  // Hilfsvariable
y+=wert;
if (y < -251 || y > 1)
        {
        y=test;
        eval(schicht+wen+stil+'.top="'+y+'"');
}
else
        {
        eval(schicht+wen+stil+'.top="'+y+'"');
        }
}

function scrollen(wert)
{
moveIt('scrollContentDiv',wert);
a=wert;
if ((weiter)&&(y<10)) setTimeout("scrollen(a)",1);
}

function gone()
{
if(isNS)
        {
        document.scrollWindowDiv.document.scrollContentDiv.moveTo(20,0);
        y=0;
        }
if(ie)
        {
        scrollContentDiv.style.pixelLeft=20;
        scrollContentDiv.style.pixelTop=0;
        y=0;
        }
if(mz)
        {
        document.getElementById("scrollContentDiv").style.left="20px";
        document.getElementById("scrollContentDiv").style.top="0px";
        y=0;
        }
if(op)
        {
        scrollContentDiv.style.pixelLeft=20;
        scrollContentDiv.style.pixelTop=0;
        y=0;
        }
}

function minplu(y) {
var x = 0;
if (document.kinderanzahl.kinder.value=="" || isNaN(document.kinderanzahl.kinder.value)==true){
    document.kinderanzahl.kinder.value=1;
    document.getElementsByName('kinderanzahl')[0].submit()
     }
  else
    {
    x = eval( document.kinderanzahl.kinder.value );
    document.kinderanzahl.kinder.value = x + y;
    if  (document.kinderanzahl.kinder.value<0) document.kinderanzahl.kinder.value=0;
    document.getElementsByName('kinderanzahl')[0].submit()
    }
}

function high(which2)
{theobject=which2
highlighting=setInterval("highlightit(theobject)",50)

}function low(which2)
{clearInterval(highlighting)
which2.filters.alpha.opacity=40
}function highlightit(cur2)
{if(cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if(window.highlighting)
clearInterval(highlighting)
}
var anfrage;
function openanfrage(cont1,cont2,cont3) {
if (anfrage){ anfrage.close()
 anfrage=window.open(cont1,cont2,cont3);
}
else{
anfrage=window.open(cont1,cont2,cont3);
 }
}
