// slideShowSpeed (milliseconds)
var slideShowSpeed = 7000;

// duration of crossfade (seconds)
var crossFadeDuration = 3;

// specify the image files
var Pic = new Array();
Pic.push( 'img/tg10.jpg' );
Pic.push( 'img/fsg1.jpg' );
Pic.push( 'img/fsg2.jpg' );
Pic.push( 'img/fsg3.jpg' );
Pic.push( 'img/fsg4.jpg' );
Pic.push( 'img/fsg5.jpg' );
Pic.push( 'img/fsg7.jpg' );
Pic.push( 'img/fsg8.jpg' );
Pic.push( 'img/fsg9.jpg' );
Pic.push( 'img/fsg10.jpg' );
Pic.push( 'img/fsg11.jpg' );
Pic.push( 'img/fsg12.jpg' );
Pic.push( 'img/fsg13.jpg' );
Pic.push( 'img/fsg14.jpg' );
Pic.push( 'img/fsg15.jpg' );
Pic.push( 'img/fsg16.jpg' );
Pic.push( 'img/fsg17.jpg' );
Pic.push( 'img/fsg18.jpg' );
Pic.push( 'img/fsg19.jpg' );
Pic.push( 'img/fsg20.jpg' );
Pic.push( 'img/fsg21.jpg' );
Pic.push( 'img/fsg22.jpg' );
Pic.push( 'img/fsg23.jpg' );
Pic.push( 'img/fsg24.jpg' );
Pic.push( 'img/fsg25.jpg' );


var displayed = new Array();

var preLoad = new Array();
for( var i = 0; i < Pic.length; i++ ){
   preLoad[i] = new Image();
}
var idx=0;
preLoad[idx].src=Pic[idx];

function runSlideShow()
{

   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)";
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
      document.images.SlideShow.filters.blendTrans.Apply();
   }

   document.images.SlideShow.src = preLoad[idx].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }

   setTimeout( 'runSlideShow()', slideShowSpeed );
   idx = getNextImage();
   if(!preLoad[idx].src) preLoad[idx].src=Pic[idx];
   if(!ini)	{
	   marquee('w','');    //Damit Laufband Events läuft 'spons' eintragen, Uwe 18.01.2012
	   inibtns('nav');
   }
}


function getNextImage()
{
	// all have been displayed
	if( displayed.length == Pic.length ) {
		displayed = new Array();
	}

	// get random image, and check if it has been displayed
	var rand = Math.floor( Math.random() * Pic.length );
	for( var idx=0; idx < displayed.length; idx++ ) {
		if( displayed[idx] == rand ) {
			return getNextImage();
		}
	}

	displayed.push( rand );
	return rand;
}
var win, sponsoren,h,hw,step,tstep,go,ini;
var men ='<div id="teamenu"><a href="team4.htm" target="dl">Andreas Herrig</a> &bull; <a href="team5.htm" target="dl">Martin Weberschock</a> &bull; <a href="team6.htm" target="dl">Peter Hubbertz</a> &bull; <a href="team3.htm" target="dl">Martin Herrig</a> &bull; <a href="team1.htm" target="dl">Armin Hortzitz</a> &bull; <a href="team2.htm" target="dl">Helmut Edenhofer</a><br><a href="team7.htm" target="dl">Corinne Schneider</a> &bull; <a href="team8.htm" target="dl">Ingo Jerx</a> &bull; <a href="team9.htm" target="dl">Tobias Knoblauch</a> &bull; <a href="team10.htm" target="dl">Uwe Schlaffke-Mowinkel</a> &bull; <a href="team11.htm" target="dl">Frank Thomas</a></div>';
var menen ='<div id="teamenu"><a href="team4en.htm" target="dl">Andreas Herrig</a> &bull; <a href="team5en.htm" target="dl">Martin Weberschock</a> &bull; <a href="team6en.htm" target="dl">Peter Hubbertz</a> &bull; <a href="team3en.htm" target="dl">Martin Herrig</a> &bull; <a href="team1en.htm" target="dl">Armin Hortzitz</a> &bull; <a href="team2en.htm" target="dl">Helmut Edenhofer</a><br><a href="team7en.htm" target="dl">Corinne Schneider</a> &bull; <a href="team8en.htm" target="dl">Ingo Jerx</a> &bull; <a href="team9en.htm" target="dl">Tobias Knoblauch</a> &bull; <a href="team10en.htm" target="dl">Uwe Schlaffke-Mowinkel</a> &bull; <a href="team11en.htm" target="dl">Frank Thomas</a></div>';
function inibtns(a){
	var btns=document.getElementById(a).getElementsByTagName('a');
	for(var i=0;i<btns.length;i++){
		btns[i].onmouseover=function(){this.style.background='url(img/btn_hover.png)';}
		btns[i].onmouseup=function(){this.style.background='url(img/btn_hover.png)';}
		btns[i].onmouseout=function(){this.style.background='url(img/btn.png)';}
		btns[i].onmousedown=function(){this.style.background='url(img/btn_click.png)';}
	}
}

function marquee(w,sp){
	win=document.getElementById(w);		// div, welches als Fenster für den Lauftext fungiert
	sponsoren=document.getElementById(sp);  // Tabelle mit den Sponsoren
	sponsoren.style.top='0px';
	sponsoren.innerHTML += sponsoren.innerHTML; // Tabelle verdoppeln
	h = parseInt(sponsoren.offsetHeight)/2;		// Höhe der Tabelle
	hw = parseInt(win.offsetHeight);		// Höhe des Fensters
	step=1;		// Pixel-Schrittweite beim scrollen
	tstep=30;	// Wartezeit in Millisekunden
	win.onmouseover=function(){window.clearInterval(go);}
	win.onmouseout=function(){go=window.setInterval('moves()',tstep)}
	go = window.setInterval('moves()',tstep);	//	startet den Lauftext
	ini=true;

}
function moves(){
	var delta = parseInt(sponsoren.style.top);
	sponsoren.style.top = delta - step + 'px';
	if(delta < -h) sponsoren.style.top='0px';
}

function load(e,s){
  s=s||0;
  var menu= lang=='de' ? men : menen;
  parent.document.getElementById('main').innerHTML= s ? menu+e : e;
}
var lang='de';
function setLang(language){
	if(language=='de'){
		lang='de';
		document.getElementById('subnav').style.display='';
		document.getElementById('subnaven').style.display='none';
		document.getElementById('fde').className='opac0';
		document.getElementById('fen').className='opac';
		document.getElementById('title_marq').innerHTML='Mit Unterstützung von:';
		dl.location.href='home.html';
	}
	else{
		lang='en';
		document.getElementById('subnav').style.display='none';
		document.getElementById('subnaven').style.display='block';
		document.getElementById('fde').className='opac';
		document.getElementById('fen').className='opac0';
		document.getElementById('title_marq').innerHTML='Supported by:';
		dl.location.href='homeen.html';
	}
} 
function setTitle(obj,comp){
	obj.title=lang=='de'?'gehe zur homepage von '+comp:'go to homepage of '+comp;
}
