// Parameter fuer die CallBack-Funktion
// ************************************
var Delay = 300; // Verzoegerung zum Einblenden der CallBack-Box in Sekunden
var Expire = 60; // Verfall des Cookies in Minuten
var Fade = 5; // Fadingzeit in Sekunden
// ************************************

// Weiches ein und ausblenden
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
    var Fertig = 1;
    //return Fertig;
} 

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}


// Liest ein Cookie aus
function WertHolen () {
  var Wert = "";
  if (document.cookie) {
    var Wertstart = document.cookie.indexOf("=") + 1;
    var Wertende = document.cookie.indexOf(";");
    if (Wertende == -1)
      Wertende = document.cookie.length;
    Wert = document.cookie.substring(Wertstart, Wertende);
    return Wert;
  }
  else
    {
    Wert = "x";
    return Wert;
    }
  
}

// Schreibt ein Cookie
function WertSetzen (Bezeichner, Wert, Verfall) {
  var jetzt = new Date();
  var Auszeit = new Date(jetzt.getTime() + Verfall);
  document.cookie = Bezeichner + "=" + Wert + "; expires=" + Auszeit.toGMTString() + ";";
}


// Blendet die CallBack-Box ein und aus
function Show_Stuff(id)
// Function that will swap the display/no display for
// all content within span tags
{
    var blende = Fade*1000;
    var content = document.getElementById(id);
    var contentInnen = document.getElementById(id+"Innen");
    if (content.style.display == "none")
    {
        content.style.display = "";
        contentInnen.style.display = "";
        opacity(id, 0, 50, blende);
        opacity(id+"Innen", 0, 100, blende);
    }
    else
    {
        content.style.display = "none";
        contentInnen.style.display = "none";
    }
    Verfall = Expire*1000*60;
    WertSetzen("CallBack", "1", Verfall);
}

// Funktions-Set zum Kontrolle der Mausbewegungen
ie5=(document.getElementById && document.all && document.styleSheets)?1:0;

      var timer, status=0;
      var x1=0, x2=0, y1=0, y2=0;
      var Verfall, CookieSet;

      // CallBack starten, wenn Timer bei 0 und kein Cookie
      function timerCheck() {
        CookieSet = WertHolen();
        if(CookieSet=="x"){status=0;}
        if(status==1) {
          timer-=1000;
          if(timer>0 || CookieSet==1){setTimeout('timerCheck()',1000);}
          else
            {
            window.setTimeout("Show_Stuff('CallBack')", 1);
            }
        }
      }

      // Auf Mausbewegung prüfen
      function mouseCheck() {
        if(x1==0 && y1==0) {
          x1=event.screenX;
          y1=event.screenY;
          setTimeout('x1=0; y1=0',40);
        }
        x2=event.screenX;
        y2=event.screenY;
        setTimeout('x2=0; y2=0',40);
        if(x1 != x2 || y1 != y2) timerStart();
      }

      // Timer-Startwert setzen oder erneuern und Timer ggf. starten
      function timerStart() {
        timer=Delay*1000;
        if(status==0) {
          status=1;
          timerCheck();
        }
      }

// Oeffnet ein PopUp-Fenster
function oeffnefenster (url) {
 fenster=window.open(url, "CallBack", "width=460,height=600,status=yes,scrollbars=yes,resizable=yes");
 fenster.focus();
}