function setToTopLink() {
  if(document.all) {
    bh = document.body.offsetHeight;
    dd = document.getElementById('seitenende').offsetTop;
    if (document.body.offsetHeight>(document.getElementById('seitenende').offsetTop + document.getElementById('seitenende').offsetHeight)) {
       writeHTMLinElement('toTop', '');
    }
  } else {
    bh = window.innerHeight;
    dd = document.body.offsetHeight;
    if (document.body.offsetHeight<window.innerHeight) {
      writeHTMLinElement('toTop', '');
    }
  }
}

function writeHTMLinElement(id, html) {
  // writes an HTML-String in an HTML-Element (fetched by ID)...
  var e = document.getElementById(id);
  if(e){
	  e.innerHTML = html;
  }
}

function resizeWindow(w, h) {
  // resize current window...
  window.resizeTo(w,h);
  if(document.all){
    
  } else {
   // window.innerHeight = h;
   // window.innerWidth = w;
  }
}
function swapImage(imgName, imgSrc) {
  if (document.images) {
    document.images[imgName].src = imgSrc;
  }
}

function imgOn(imgName) {
  if (document.images && activeImg != imgName) {
    // document.getElementById("L_" + imgName).style.marginTop = "0px";
    document.images[imgName].src = bild_mo_arr[imgName];
  }
}

function imgOff(imgName) {
  if (document.images && activeImg != imgName) {
    // document.getElementById("L_" + imgName).style.marginTop = "10px";
    document.images[imgName].src = bild_arr[imgName];
  }
}

function imgClick(imgBild) {
  if(activeImg != "") {
    temp = activeImg;
    activeImg = imgBild;
    imgOff(temp);
  } else { 
    activeImg = imgBild;
  }
}

function popup(url,name,width,height) {
 var a = window.open(url, name, 'width='+width+',height='+height+',left=0,top=0,status=0,scrollbars=0,toolbar=0');
}

function popupScrollbar(url,name,width,height) {
 var a = window.open(url, name, 'width='+width+',height='+height+',left=0,top=0,status=0,scrollbars=1,toolbar=0');
}

function openInParent(url) {
 opener.location = url;
 window.close();
}

function getScreenParam(windowWidth,windowHeight){
  if (screen.width >= windowWidth) {
    windowLeft = (screen.width-windowWidth)/4*3;
  } else {
    windowLeft = 0;
  }
  if (screen.height >= windowHeight) {
    windowTop = (screen.height-windowHeight)/2;
  } else {
    windowTop = 0;
  }
  var ret = new Array(windowLeft,windowTop);
  return ret;
}

function Go (select) {
  var wert = select.options[select.options.selectedIndex].value;
  if (wert == "leer") {
    select.form.reset();
    return;
  } else {
    if (wert == "ende") {
      top.location.href = parent.frames[1].location.href;
    } else {
      window.location.href = wert;
      select.form.reset();
    }
  }
}


function rewriteLink(id, width, height) {
 if(document.all) {
  //IE braucht etwas mehr breite
  width=width+20;
 }
 var el = document.getElementsByName(id)[0];
 var href = el.href;
 el.target = "";
 el.href = "javascript:var a = window.open('"+href+"','openWindow','width="+width+",height="+height+",left=0,top=0,status=0,scrollbars=1,toolbar=0');";
 for(var a=0; a < document.links.length; a++) {
  if(document.links[a].name == id) {
   //alert(document.links[a]);
   //document.links[a] = "javascript: var w = window.open('"+href+"', 'openWindow', 'width="+width+",height="+height+",left=0,top=0,status=0,scrollbars=1,toolbar=0');";
   //document.links[a].target=''
  }
 }
}
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function changeHeight(div, hoehe) {
  document.getElementById(div).style.height = hoehe + "px";
}