﻿var imagepath, aktiveChange_, aktTeaserImg_=-1, maxImgHighShool=11, aktImage=1, bildanzahl;


function teaser(startpath) //-------- initialisiert Teaserbilder
{
	path = document.location.href;
	
	
	if((path.indexOf("sprachreisen-schueler", 0)>0) || (path.indexOf("high-school-programm", 0)>0)) //------ Schüler?
	{
		
		bildanzahl = 22;
		imagepath="teaser-schueler/"
		zahl = 999;
	
	}
	else //--- Erwachsene
	{
		imagepath="teaser/"
		bildanzahl = 21;
		zahl = 999;
		
	}	
	

/*	while (zahl > bildanzahl)
	{
		zahl = Math.ceil(Math.random()*bildanzahl); 
	}
*/
	aktImage = Math.floor(Math.random()*bildanzahl)+1;
	zahl=aktImage;
	
	
	var path = startpath+"images/"+imagepath+"teaser"+zahl+".jpg";	
	
	for(var i=1;i<menues_; i++)
	{
		var path = startpath+"images/"+imagepath+"teaser"+i+".jpg";	
		eval("dummy = new Image();");
		eval("dummy.src = '"+path+"';");
	}

	document.write("<div id='teaserImg'><img src='"+startpath+"images/spacer.gif' height='200'  width='141' alt='' border='0'></div>") //-------- wird als spacer eingetragen


	var path = startpath+"images/"+imagepath+"teaser"+zahl+".jpg";	
	document.getElementById("teaserImg").innerHTML="<img src="+path+" alt='' border='0'>";		

	var aktiveChange_ = window.setInterval("teaseImageChange('"+imagepath+"')", 4000);	
	
	
}



function teaseImageChange(imagepath)
{
	/*zahl = 999;

	while (zahl > maxImgHighShool)
	{
		zahl = Math.ceil(Math.random()*bildanzahl); 
	}
	*/
	
	aktImage++;
	
	if(aktImage>bildanzahl)
		aktImage=1;
	
	zahl=aktImage;
	
	var path = startpfad_+"images/"+imagepath+"/teaser"+zahl+".jpg";
	document.getElementById("teaserImg").innerHTML="<img src="+path+" alt='' border='0'>";

}



function flashsterne(startpath)
{
	var filePath=startpath+"/images/sterne2.swf";
	/*document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' height='99' width='182'>");
		document.write("<param name='movie' value='"+filePath+"'>");
		document.write("<param name='quality' value='best'>");
		document.write("<param name='play' value='true'>");
		document.write("<embed height='99' pluginspage='http://www.macromedia.com/go/getflashplayer' src='"+filePath+"' type='application/x-shockwave-flash' width='182' quality='best' play='true'>");
	document.write("</object>");*/
}
