function fenster_oeffnen(w,h){

	Fenster1 = window.open("","Infos", "width="+w+",height="+h+",left=100,top=200,scrollbars=yes");
 	Fenster1.focus();

}

function fenster_oeffnen_news(w,h){

	Fenster2 = window.open("","Aktuell", "width="+w+",height="+h+",left=100,top=200,scrollbars=yes");
 	Fenster2.focus();

}

function cookieSetzen(nr){

anfang = document.cookie;

anfang2 = anfang.substring(anfang.indexOf("=")+1,anfang.indexOf("=")+2);

// alert(anfang . anfang2);

var ablauf = new Date();
var infuenfTagen = ablauf.getTime() + (24 * 60 * 60 * 1000);
ablauf.setTime(infuenfTagen);
document.cookie = "ende="+nr;
document.cookie = "anfang="+anfang2;

 /* if(anfang.indexOf("=") > -1){
     document.cookie = "anfang="+anfang2+"; expires=" + ablauf.toGMTString();
 } */
}
 
function cookieLoeschen(){

var ablauf = new Date();
var infuenfTagen = ablauf.getTime() + (24 * 60 * 60 * 1000);
ablauf.setTime(infuenfTagen);
document.cookie = "ende=";
document.cookie = "anfang=";

/* document.cookie = "ende=; expires=" + ablauf.toGMTString();
document.cookie = "anfang=; expires=" + ablauf.toGMTString(); */

}

function flashbug(){

 if (navigator.cookieEnabled == true) {

    imglength = document.images.length;

    if(navigator.userAgent.indexOf("MSIE") > -1){

        if(document.images[imglength-1].complete == true){
          document.getElementById("flash_navi").style.visibility = "visible";
          document.getElementById("flash_navi").style.top = 0 + "px";
        }

    }else{
         document.getElementById("flash_navi").style.visibility = "visible";
          document.getElementById("flash_navi").style.top = 0 + "px";
    }

  }

}

var selectImg = 0;


function imageChangeBack(){
   for(r=0;r<bilderliste.length;r++){
       if(selectImg != r){
         img = new Image();
         img.src = bilderliste[r];
         eval("document.images['img"+(r+1)+"'].src = '"+img.src+"'");
         document.getElementById("img_"+(r+1)).style.backgroundImage = "url('images/hg_thumb.gif')";
         document.getElementById("img_"+(r+1)).style.backgroundPosition = "4px 4px";
         /* widthImg = document.getElementById("img_"+id).style.width;
         document.getElementById("img_"+id).style.width = parseInt(widthImg)+4+"px";
         document.getElementById("img_"+(r+1)).style.paddingTop = "0px";
         document.getElementById("img_"+(r+1)).style.paddingLeft = "0px"; */
       }
   }
}

function imageChange(pfad,id){
   img = new Image();
   img.src = pfad;
   eval("document.images['img"+id+"'].src = '"+img.src+"'");
   document.getElementById("img_"+id).style.backgroundImage = "url('images/hg_thumb_a.gif')";
   document.getElementById("img_"+id).style.backgroundPosition = "4px 4px";
   /* widthImg = document.getElementById("img_"+id).style.width;
   document.getElementById("img_"+id).style.width = parseInt(widthImg)-4+"px";
   document.getElementById("img_"+id).style.padding = "0px";
   document.getElementById("img_"+id).style.paddingTop = "4px";
   document.getElementById("img_"+id).style.paddingLeft = "4px";*/
}

function imageSelect(pfad,pfadTn,id){

   for(r=0;r<bilderliste.length;r++){
      img = new Image();
      img.src = bilderliste[r];
      eval("document.images['img"+(r+1)+"'].src = '"+img.src+"'");
   }

   for(r=0;r<bilderliste.length;r++){

      if(document.getElementById("bildText_"+(r+1))){
          document.getElementById("bildText_"+(r+1)).style.display = "none";
          document.getElementById("img_"+(r+1)).style.backgroundImage = "url('images/hg_thumb.gif')";
          document.getElementById("img_"+(r+1)).style.backgroundPosition = "4px 4px";
          /* document.getElementById("img_"+(r+1)).style.paddingTop = "0px";
          document.getElementById("img_"+(r+1)).style.paddingLeft = "0px"; */
      }

   }

   for(r=0;r<bilderliste.length;r++){
      document.getElementById("buttonLightbox_"+(r+1)).style.display = "none";
   }

   selectImg = id;

   img = new Image();
   img.src = pfad;
   eval("document.images['img0'].src = '"+img.src+"'");

   img = new Image();
   img.src = pfadTn;
   eval("document.images['img"+parseInt(id+1)+"'].src = '"+img.src+"'");

   if(document.getElementById("bildText_"+parseInt(id+1))){
      document.getElementById("bildText_"+parseInt(id+1)).style.display = "block";

      document.getElementById("img_"+parseInt(id+1)).style.backgroundImage = "url('images/hg_thumb_a.gif')";
      document.getElementById("img_"+parseInt(id+1)).style.backgroundPosition = "4px 4px";
      /* document.getElementById("img_"+parseInt(id+1)).style.paddingTop = "0px";
      document.getElementById("img_"+parseInt(id+1)).style.paddingLeft = "0px"; */

      document.getElementById("buttonLightbox_"+parseInt(id+1)).style.display = "block";
   }

}

var p = 0;

function fieldView(){

      p = p + 1;

      if(p == 1){
        document.getElementById("field").style.display = "block";
        /* document.getElementById("link").style.display = "none";
        document.getElementById("link2").style.display = "block"; */
      }else{
        document.getElementById("field").style.display = "none";
        /* document.getElementById("link").style.display = "block";
        document.getElementById("link2").style.display = "none"; */
        p = 0;
      }
}

var schritte = 0;

function imageForward(){
   schritte = schritte + 5;

   for(r=0;r<bilderliste.length;r++){
      document.getElementById("img_"+(r+1)).style.display = "none";
   }

   var g = 0;
   var s = 0;

   for(r=schritte;r<bilderliste.length;r++){
      g = g + 1;

      if(g < 6){
          document.getElementById("img_"+(r+1)).style.display = "block";
          s = s + 1;
      }

   }

   if(s == 5 & (schritte+6) < (bilderliste.length+1)){
       document.getElementById("weiter").style.display = "block";
   }else{
       document.getElementById("weiter").style.display = "none";
   }

   if(s > 0){
       document.getElementById("zurueck").style.display = "block";
   }
}

function imageBack(){
   schritte = schritte - 5;

   if(schritte > -1){

   for(r=0;r<bilderliste.length;r++){
      document.getElementById("img_"+(r+1)).style.display = "none";
   }

   var g = 0;


   for(r=schritte;r<bilderliste.length;r++){
      g = g + 1;

      if(g < 6){
          document.getElementById("img_"+(r+1)).style.display = "block";
      }

   }
       if(schritte == 0){
          document.getElementById("zurueck").style.display = "none";
          document.getElementById("weiter").style.display = "block";
       }else{
          document.getElementById("zurueck").style.display = "block";
          document.getElementById("weiter").style.display = "block";
       }

   }
}

function pageMiddle(){

      if(document.all){
        var hoeheE=document.all.body.offsetHeight;
        var breiteE=document.all.body.offsetWidth;

            if(hoeheE > 650){
                hoeheE = Math.round((hoeheE-650)/2); 
                document.all.page.style.posTop = hoeheE-30;
            }else{
                document.all.page.style.posTop = "0px";
            }

      }else if(document.getElementById){
        var hoehe = window.innerHeight;
        var breite = window.innerWidth;

            if(hoehe > 650){
                hoehe = Math.round((hoehe-650)/2); 
                document.getElementById("page").style.top = hoehe-30+"px";
            }else{
                document.getElementById("page").style.top = "0px";
            }
      } 

     setTimeout("pageMiddle()",250);
}

var anfrage = 0;

function anfrageVisibleHidden(wert){

      if(wert == undefined){
         anfrage = anfrage + 1;

         if(anfrage == 1){
             document.getElementById("anfrage").style.display = "block";
         }else{
             anfrage = 0;
            document.getElementById("anfrage").style.display = "none";
         }

      }


      if(wert == 'back'){
          anfrage = 0;
          document.getElementById("anfrage").style.display = "none";
          wert = undefined;
      }

}

function emailDecode(wert1,wert2,wert3){

    var mail = wert3+"@"+wert2+wert1;

    location.href = "mailto:"+mail;
}