////////////////// Käfer der Woche //////////////////

var IntroSel = 0;

// Bildwechsel durchführen
function Bw2(BildNr) {
  document.getElementById('B'+IntroSel).style.backgroundPosition = "0px "+(-84-IntroSel*48)+"px";
  document.getElementById('B'+BildNr).style.backgroundPosition = "0px "+(-108-BildNr*48)+"px";
  document.getElementById('LPic').src = "/Pages/Fotos/FotoIntro/"+BtlofWeek+"/IntroS"+BildNr+".jpg";
  document.getElementById("Lupelink").href ="/Pages/Fotos/FotoIntro/"+BtlofWeek+"/IntroL"+BildNr+".jpg";
  IntroSel = BildNr;
}

////////////////// Dynamische Teaserbox //////////////////
var TeaserFoto = new Array(NumPics - 1);
var TeaserNr = 0;
var fade = 0;
var zoom = 0;
var slomo = 0;
var adder = 0.2;
var teasertimer = window.setInterval("Teaser()",16);

// Fotos einlesen
for (i = 0; i < NumPics; i++) {
  TeaserFoto[i] = new Image();
  TeaserFoto[i].src = "/Pages/Fotos/FotoIntro/_Temp/TsrPic"+i+".jpg";
}

// Verzögerung bei Maus im Teaserbild
function slomo_on(){ slomo = 1; }

// Verzögerung ausschalten
function slomo_off(){	slomo = 0; }

// Zeitgesteuerten Bildwechsel durchführen
function Teaser() {
	var mypic=window.document.Teaser;
  if (slomo == 1 && adder > 0.1){adder -= 0.005}
  if (slomo == 0 && adder < 0.2){adder += 0.005}
  zoom += adder;
  if (zoom < 10) { fade += 0.02 }
  if (zoom > 50) { fade -= 0.02 }
  if (zoom >= 60){
    zoom = 0;
    fade = 0;
    TeaserNr = (TeaserNr + 1) % NumPics;
    mypic.src = TeaserFoto[TeaserNr].src;
  }
  mypic.style.opacity = fade;
  mypic.style.width = 165+zoom+"px";
  mypic.style.height = 123+zoom*2/3+"px";
}
