function emailDecode(wert1,wert2,wert3){

    var mail = wert3+"@"+wert2+wert1;
    location.href = "mailto:"+mail;
    
}

var xBild = 0;

function bildleisteWeiter(){

    document.getElementById("butZurueck").style.display = "block";

    var n = 0;
    
    for(z=0;z<8;z++){
       if(document.getElementById("leiste").getElementsByTagName("img")[z]){
          n++;
       }
    }
    
    n = n - 5;
    
    if(xBild >= (-190*n)){
       xBild = xBild - 190;
       new Effect.Move('leiste', {x: xBild, y: 0, mode: 'absolute'}); 
    }
    
    if(xBild < (-190*n)){
       document.getElementById("butWeiter").style.display = "none";
    }
}

function bildleisteZurueck(){

    document.getElementById("butWeiter").style.display = "block";

    if(xBild < 0){
       xBild = xBild + 190;
       new Effect.Move('leiste', {x: xBild, y: 0, mode: 'absolute'}); 
    }
    
    if(xBild == 0){
        document.getElementById("butZurueck").style.display = "none";
    }
}


function addBookmark(title,url) {
 
    var bookmarkurl="http://www.pauly-biskuit.de"
    var bookmarktitle="Pauly Biskuit AG"
    
    if (window.sidebar)
    { // Mozilla Firefox Bookmark
        window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
    }
    else if(window.external)
    { // IE Favorite
        window.external.AddFavorite(bookmarkurl, bookmarktitle);
    }
    else if(window.opera && window.print)
    { // Opera Hotlist
        alert("Bitte die Tastenkombination STRG + D drücken");
        return true;
    }
    else
    {
       alert("Bitte die Tastenkombination STRG + D drücken");
       return true;
    }

}

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/spacer.gif')";
         document.getElementById("img_"+(r+1)).style.backgroundPosition = "0px 47px"; */

         document.getElementById("img_"+(r+1)).style.paddingBottom = "4px";
         document.getElementById("img_"+(r+1)).style.borderBottomColor = "#ffffff";
         document.getElementById("img_"+(r+1)).style.borderBottomStyle = "solid";
         document.getElementById("img_"+(r+1)).style.borderBottomWidth = "4px";
       }
   }
}

function imageChange(pfad,id){
   img = new Image();
   img.src = pfad;
   eval("document.images['img"+id+"'].src = '"+img.src+"'");
   
   document.getElementById("img_"+id).style.paddingBottom = "4px";
   document.getElementById("img_"+id).style.borderBottomColor = "#0D4885";
   document.getElementById("img_"+id).style.borderBottomStyle = "solid";
   document.getElementById("img_"+id).style.borderBottomWidth = "4px";
}


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 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("img_"+(r+1))){
      
          document.getElementById("img_"+(r+1)).style.paddingBottom = "4px";
          document.getElementById("img_"+(r+1)).style.borderBottomColor = "#ffffff";
          document.getElementById("img_"+(r+1)).style.borderBottomStyle = "solid";
          document.getElementById("img_"+(r+1)).style.borderBottomWidth = "4px";

      }

   }

   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 = imgG["+parseInt(id+1)+"].src");

   img = new Image();
   img.src = pfadTn;
   eval("document.images['img"+parseInt(id+1)+"'].src = '"+img.src+"'");

   if(document.getElementById("img_"+parseInt(id+1))){
      
      document.getElementById("img_"+(id+1)).style.paddingBottom = "4px";
      document.getElementById("img_"+(id+1)).style.borderBottomColor = "#0D4885";
      document.getElementById("img_"+(id+1)).style.borderBottomStyle = "solid";
      document.getElementById("img_"+(id+1)).style.borderBottomWidth = "4px";
   }

}

var selectImg = 0;

function FensterOeffnen(url,width,height) {
  MeinFenster = window.open(url, "eAppointment", "width="+width+", height="+height+", directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=yes, resizable=yes, dependent=no");
  MeinFenster.focus();
}
