document.writeln('<div id="bildverdeckungback" style="position:absolute;top:0px;left:0px;background-color:white;display:none;"><\/div>');
document.writeln('<div id="bildanzeigediv" style="position:absolute;top:0px;left:0px;margin:0px;padding:0px;display:none;">');
document.writeln('<a href="javascript:close_image();"><img src="" id="bildanzeigebild" name="bildanzeigebild" onload="show_image();" border="0" \/><\/a>');
document.writeln('<\/div>');
document.writeln('<div id="bildverdeckungtop" style="position:absolute;top:0px;left:0px;background-color:white;display:none;font-size:12px;" align="center">Klick auf das Bild schließt das Bild.<\/div>');
document.writeln('<div id="bildverdeckungleft" style="position:absolute;top:0px;left:0px;background-color:white;display:none;"><\/div>');
document.writeln('<div id="bildverdeckungright" style="position:absolute;top:0px;left:0px;background-color:white;display:none;"><\/div>');
document.writeln('<div id="bildverdeckungbottom" style="position:absolute;top:0px;left:0px;background-color:white;display:none;"><\/div>');

function close_image(){
  if(document.getElementById){
    document.getElementById('bildanzeigediv').style.display = 'none';
    document.getElementById('bildverdeckungtop').style.display = 'none';
    document.getElementById('bildverdeckungleft').style.display = 'none';
    document.getElementById('bildverdeckungright').style.display = 'none';
    document.getElementById('bildverdeckungbottom').style.display = 'none';
    document.getElementById('bildverdeckungback').style.display = 'none';
  }
}

var timeout = 1;
var step = 10;
var counter;
var covertop;
var coverleft;
var startcovertop;
var startcoverleft;

function load_image(bildurl){
  neues_bild = new Image();
	neues_bild.src = bildurl;
  if(window.innerWidth){
    width = window.innerWidth;
    height = window.innerHeight;
  } else if(document.body.clientWidth){
    width = document.body.clientWidth;
    height = document.body.clientHeight;
  }
  if(document.getElementById){
    document.getElementById('bildanzeigebild').style.width = 'auto';
    document.getElementById('bildverdeckungtop').style.width = width;
    document.getElementById('bildverdeckungleft').style.height = height;
    document.getElementById('bildverdeckungright').style.height = height;
    document.getElementById('bildverdeckungbottom').style.width = width;
    document.getElementById('bildverdeckungback').style.width = width;
    document.getElementById('bildverdeckungback').style.height = height;
    startcovertop = (height / 2);
    startcoverleft = (width / 2);
    document.getElementById('bildverdeckungright').style.left = width - startcoverleft;
    document.getElementById('bildverdeckungbottom').style.top = height - startcovertop;
    document.getElementById('bildverdeckungtop').style.height = startcovertop;
    document.getElementById('bildverdeckungleft').style.width = startcoverleft;
    document.getElementById('bildverdeckungright').style.width = startcoverleft;
    document.getElementById('bildverdeckungbottom').style.height = startcovertop;
    document.getElementById('bildverdeckungtop').style.display = 'block';
    document.getElementById('bildverdeckungleft').style.display = 'block';
    document.getElementById('bildverdeckungright').style.display = 'block';
    document.getElementById('bildverdeckungbottom').style.display = 'block';
    document.getElementById('bildverdeckungback').style.display = 'block';
    document.getElementById('bildanzeigediv').style.display = 'block';
    document.getElementById('bildanzeigebild').src = neues_bild.src;
  }
	return false;
}
function show_image(){
  if(document.getElementById){
    picwidth = document.images.bildanzeigebild.width;
    picheight = document.images.bildanzeigebild.height;
		
    // Bild größer als Anzeigebereich
    if(picwidth > (width - 40) || picheight > (height - 40)){
      var picratio = picwidth / picheight;
      var screenratio = width / height;
      if(picratio > screenratio){
        // Bild breiter
        var faktor = picwidth / (width - 40);
      } else {
        // Bild höher
        var faktor = picheight / (height - 40);
      }
      picwidth = picwidth / faktor;
			picheight = picheight / faktor;
      document.getElementById('bildanzeigebild').style.width = picwidth;
    }
    coverleft = (width / 2) - (picwidth / 2);
    covertop = (height / 2) - (picheight / 2);
    document.getElementById('bildanzeigediv').style.width = picwidth;
    document.getElementById('bildanzeigediv').style.height = picheight;
    document.getElementById('bildanzeigediv').style.left = coverleft;
    document.getElementById('bildanzeigediv').style.top = covertop;
  } 
	counter = 0;
  resize();
}

function resize(){
  goon = false;
  counter += step;
  if(document.getElementById){ 
    if((startcovertop - counter) + step > covertop){
      document.getElementById('bildverdeckungtop').style.height = startcovertop - counter;
      document.getElementById('bildverdeckungbottom').style.height = startcovertop - counter;
      document.getElementById('bildverdeckungbottom').style.top = startcovertop + counter;
      goon = true;
    }
    if((startcoverleft - counter) + step > coverleft){
      document.getElementById('bildverdeckungleft').style.width = startcoverleft - counter;
      document.getElementById('bildverdeckungright').style.width = startcoverleft - counter;
      document.getElementById('bildverdeckungright').style.left = startcoverleft + counter;
      goon = true;
    }
  }
  if(goon){
    //resize();
    window.setTimeout("resize()", timeout);
  }
}