/*
	Wechelt die Bilder in der angegebenen Reihenfolge
	© 2003 LCL Software GmbH
	Entwickler:	Frank Litges
*/
/*	Variablen								*/
var AktPictures=new Array();
var AktPicIdn=new Array();
var AktLink=new Array();
var AktPicTitle=new Array();
var AktPicName=new Array();
var AktRotCounter=new Array();
var Found=false;
var Counter=0;
var newPic=0;
/*	Timer setzen								*/
function SetTimer()
{
 	if(AktPictures.length>0||Found)
 	{
  		Found=true;
  		Counter++;
  		if(Counter>10)
  		{
   			Counter=0;
   			RotatePicture();
  		}
 	}
 	else
 	{
  		CountImages();
 	}
 	window.status="© 2003 LCL Software GmbH";
}
var Timer=window.setInterval("SetTimer()",500);
/*		Bilder zählen und in Rototionsarray belegen				*/
function CountImages()
{
 	InitRotation();
 	var ImgCountReihe=0;
 	var ImgCountZufall=0;
 	for(i=0 ; i<document.images.length ; i++)
 	{
 		/*		Bilder, die in Reihenfolge geschaltet werden			*/
  		if(document.images[i].id=="Reihe")
  		{
   			AktPictures[0]=new Array();
   			for(j=0 ; j < AktRotCounter[0] ; j++)
   			{
   				/*	Namen zuweisen	*/
    			AktPictures[0][j]=new Image();
    			AktPictures[0][j].src=AktPicName[0][j];
    		}
   			ImgCountReihe++;
  		}
  		if(document.images[i].id=="Zufall")
  		{
   			AktPictures[1]=new Array();
   			for(j=0 ; j < AktRotCounter[1] ; j++)
   			{
   				/*	Namen zuweisen	*/
    			AktPictures[1][j]=new Image();
    			AktPictures[1][j].src=AktPicName[1][j];
    		}
   			ImgCountZufall++;
  		}  		
	}
}
/*		Bilder wechseln									*/
function RotatePicture()
{
	/*	Bilder in Reihenfolge		*/ 			
	var actPic=document.getElementById("Reihe");
	if (actPic != null)
	{
		if(AktPictures[0].length > 0)
		{
			if(actPic.src==AktPictures[0][newPic].src)
			{
 				newPic++;
			}
			if (newPic>= AktPictures[0].length)
			{
				newPic=0;
			}
			actPic.src=AktPictures[0][newPic].src;
			actPic.title=AktPicTitle[0][newPic];
		}
   	}
	else
  	{
  		CountImages();
	}
	var actPicZufall=document.getElementById("Zufall");
	if( actPicZufall != null)
	{
		var newPicZufall=parseInt(AktPictures[1].length*Math.random());
		if(AktPictures[1].length > 0)
		{
			if(actPicZufall.src==AktPictures[1][newPicZufall].src)
			{
				newPicZufall++;
			}
			if (newPicZufall >= AktPictures[1].length)
			{
				newPicZufall=0;
			}
			actPicZufall.src=AktPictures[1][newPicZufall].src;
			actPicZufall.title=AktPicTitle[1][newPicZufall];
		}
		else
		{
			CountImages();
		}  
	}		
}

/*			Hyperlinks starten			*/
function ClickPicture(ImgObj)
{
	var NameAktPic=ImgObj.src.substr(ImgObj.src.lastIndexOf("/")+1,ImgObj.src.length-ImgObj.src.lastIndexOf("/")+1);
 	//alert(NameAktPic)
 	var PicID=0;
 	var NameObj=ImgObj.id
 	if (NameObj == "Reihe") PicID=0;
 	if (NameObj == "Zufall") PicID=1;
 	var PicNr=0;
 	/*	Aktuelles Bild suchen 					*/
 	for(i=0 ; i < AktPicName[PicID].length ; i++)
 	{
  		AktPicName[PicID][i] = AktPicName[PicID][i].substr(AktPicName[PicID][i].lastIndexOf("/")+1,AktPicName[PicID][i].length-AktPicName[PicID][i].lastIndexOf("/")+1);
  		if(AktPicName[PicID][i]==NameAktPic)
  		{
  			PicNr=i;
  		}
 	}
 	if(AktLink)
 	{
  		 
		eval(AktLink[PicID][PicNr]);
 	}
}
/*	Webseite in neuem Fenster öffnen						*/
function OpenNewWebPage(AktUrl)
{
 	window.open(AktUrl,"LCLSoftwareGmbH","location=yes,MenuBar=yes,status=yes,toolbar=yes,resizable=yes,scrollbars=yes");
}

// Webseite in neuem Fenster öffnen mit Parameterübergabe

function OpenPopUp(theURL,winName,features) {  window.open(theURL,winName,features);}

//Hier der Aufruf / es können auch Parameter weggelassen werden die nicht benötigt werden
//OpenPopUp('Internetseite ????', 'Name ????', 'top=50, left=50, width=730, height=500,menubar=no, status=no, resizable=no, toolbar=no, dependent=no, scrollbars=no');"

function OpenWindowInFrame(AktUrl, AktFrame)
{
	parent.frames[AktFrame].location.href = AktUrl;
}