var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinNS6 = (isMinNS4 && navigator.userAgent.indexOf("Gecko")>=0) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.")) >= 0 ? 1 : 0;
var isDOM = (document.getElementById) ? 1 : 0;
var isMinOP4 = (navigator.appName.indexOf("Opera") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinOP9 = (navigator.appName.indexOf("Opera") >= 0 && parseFloat(navigator.appVersion) >= 9) ? 1 : 0;

function getLayer(name) {
  if (isDOM)
    return document.getElementById(name);
  if (isMinIE4)
    return eval("document.all." + name);
  if (isMinNS4)
    return findLayer(name, document); return null;
}

function findLayer(name, doc) {
  var i, layer;
  for (i = 0; i < doc.layers.length; i++) {
    layer = doc.layers[i];
    if (layer.name == name)
      return layer;
    if (layer.document.layers.length > 0) {
      layer = findLayer(name, layer.document);
      if (layer != null)
        return layer;
    }
  }
  return null;
}

function hideLayer(layer) {
  layer = getLayer(layer);
  if (isMinIE4||isDOM)
    layer.style.visibility = "hidden";
  if (isMinNS4)layer.visibility = "hide";
  }

function showLayer(layer) {
  layer = getLayer(layer);
  if (isMinIE4||isDOM)
    layer.style.visibility = "visible";
  if (isMinNS4) layer.visibility = "show";
}

function setTop(layer, y) {
  layer = getLayer(layer);
  if (isDOM)
    layer.style.top = y + "px";
  if (isMinIE4)
    layer.style.pixelTop = y;
  if (isMinNS4)
    layer.top = y; 
  return -1;
}

function getHeight(layer) {
  layer = getLayer(layer);
  if (isDOM) {
    if (layer.style.height && (layer.style.height != "auto"))
      return(parseInt(layer.style.height));
    else {
      return(layer.offsetHeight);
    }
  }
  if (isMinIE4) {
    if (false && layer.style.pixelHeight)
      return(layer.style.pixelHeight);
    else return(layer.clientHeight);
  }
  if (isMinNS4) {
    if (layer.document.height)
      return(layer.document.height);
    else return(layer.clip.bottom - layer.clip.top);
  }
  return -1;
}

var ieOpInt = 0;
var opIdObj = 0;

function incrementOpacity(){ if(ieOpInt <= 70){
  ieOpInt += 7;
  if(isMinIE4)
    bildbeschreibungDiv.style.filter="alpha(opacity="+ieOpInt+")";
  if(isMinNS6)
    getLayer("bildbeschreibungDiv").style.MozOpacity=ieOpInt/100;
      if(isMinOP9)
      bildbeschreibungDiv.style.opacity=ieOpInt/100;
  opIdObj = setTimeout("incrementOpacity()", 50);
  }
  if(ieOpInt > 70) {
    clearTimeout(opIdObj); ieOpInt = 70;
  }
}

function decrementOpacity(){
  if(ieOpInt > 0) {
    ieOpInt -= 7;
    if(isMinIE4)
      bildbeschreibungDiv.style.filter="alpha(opacity="+ieOpInt+")";
    if(isMinNS6)
      getLayer("bildbeschreibungDiv").style.MozOpacity=ieOpInt/100;
    if(isMinOP9)
      bildbeschreibungDiv.style.opacity=ieOpInt/100;
    opIdObj = setTimeout("decrementOpacity()", 50);
  }
  if(ieOpInt <= 0) {
    clearTimeout(opIdObj);
    ieOpInt = 0;
  }
}

function showGalleryAnnotation(hoehe) {
  if(isMinIE4)
    bildbeschreibungDiv.style.filter="Alpha(opacity=0)";
  if(isMinNS6)
    getLayer("bildbeschreibungDiv").style.MozOpacity=0;
  // setTop("bildbeschreibungDiv", hoehe - getHeight("bildbeschreibungDiv") - 10);
  showLayer("bildbeschreibungDiv"); incrementOpacity();
}

function hideGalleryAnnotation() {
  decrementOpacity();
  if (document.layers || isMinOP4 && !isMinOP9)
    hideLayer("bildbeschreibungDiv");
}
