//Copyright Peter€Enzenberger.de, 1999
//All rights reserved
//Die Nutzung ohne Einwilligung des Author ist nicht gestattet

PictureDir = "./_Inhalt/"; PictureExt = ".gif";
PicturePre = "B_b_"; PicturePost = "";
PictureOverPre = "B_c_"; PictureOverPost = "";
PictureClickPre = "B_g_"; PictureClickPost = "";

var PictureShown = null;
var FileShown = 0;
var PictureList = new Array();
var FileList = new Array();
NameIndex = "myName";
// Zeiger, um von der angezeigten Filenummer
// aus FileList die Namen der Seiten zu holen


var loaded = false;  // tells mainFrame that this page has loaded

function initThings(){
//PictureList enthält alle Angaben zu den Grafiken im Inhaltsframe
if (loaded == false) {
//alert ("loaded" + loaded + "--");
	PictureList = getTheList(
		'Titelseite',			'Titelseite.html',
		'Anfrage',				'Anfrage.html'
		)
	FileList = PictureList;
	loaded = true;
}
// Ausbau denkbar: Wenn die FileList für die Sitetour länger sein soll,
// müssen in der linken Spalte die Picturenamen mehrmals stehen.
// Wenn die FileList nicht alle Links in den Picturenamen abklappern soll,
// müssen rechts die Links leer sein = ''
// Das ist in getTheList allerdings noch nicht eingebaut.
}
function getTheList(theList){
var getPic = new Array(); var theIndex; var theName;
// Zugriff auf globale Variable geht nicht,
// da dann die folgenden Zuweisungen nicht funktionieren
	if (document.images) {
		for (var i=0; i < getTheList.arguments.length; i=i+2){
			theName = getTheList.arguments[i];
			getPic[theName] = new Image();
			getPic[theName].src = PictureDir +  PicturePre + theName + PicturePost + PictureExt;
			getPic[theName].click = new Image();
			getPic[theName].clicksrc = PictureDir + PictureClickPre + theName + PictureClickPost + PictureExt;
			getPic[theName].over = new Image();
			getPic[theName].oversrc = PictureDir + PictureOverPre + theName + PictureOverPost + PictureExt;
			theIndex=(i/2);
			// die gelesenen Filenamen für die Sitetour gehen von 0 .. lastFile
			getPic[theName].fileNo = theIndex;
			// Verweis von PictureList in die nummerierte FileList.
			getPic[theIndex] = getTheList.arguments[i+1];
			// jeweils rechte Spalte lesen = i+1 = Dateiname
			getPic[NameIndex+theIndex] = theName;
			// Verweis von FileList mit Indexnummern in die PictureList mit Indexnamen
			getPic.lastFile = theIndex;
	//		alert(getPic[NameIndex+theIndex]);
	//		alert(getPic[theIndex]);
		}
	}
return getPic;
}
function overPicture(thePicture,theList) {
 if (document.images) {
	if (PictureShown != thePicture)
		theList[thePicture].src = PictureList[thePicture].oversrc;
 }
}
function outPicture(thePicture,theList) {
if (PictureShown != thePicture) {
 if (document.images) theList[thePicture].src = PictureList[thePicture].src}
}
function clickPicture(thePicture,theList) {
parent.focus(); //prevents IE from showing imageframe
with (parent.Inhalt) {
//alert("click: " + PictureShown + " " + thePicture);
 if (document.images) {
	if (PictureShown != thePicture) {
		theList[thePicture].src = parent.Inhalt.PictureList[thePicture].clicksrc;
		if (PictureShown != null) theList[PictureShown].src = parent.Inhalt.PictureList[PictureShown].src;
		PictureShown = thePicture;
		FileShown = parent.Inhalt.FileList[PictureShown].fileNo
	}
 }
} // with parent.Inhalt
}
function previousPage(){
with (parent.Inhalt) {
	if (FileShown == 0) {FileShown = FileList.lastFile} else {FileShown--}
//	alert("NO "+FileShown+"-"+ FileList[FileShown]);
	window.open(FileList[FileShown],'Hauptframe');
	clickPicture(FileList[NameIndex+FileShown],parent.Inhalt.document.images);
}
}
function nextPage(){
with (parent.Inhalt) {
//	alert("NO "+FileShown+"-"+ FileList.lastFile);
	if (FileShown == FileList.lastFile) {FileShown = 0} else {FileShown++}
//	alert("NO "+FileShown+"-"+ FileList[FileShown]);
	window.open(FileList[FileShown],'Hauptframe');
//	alert (FileList[NameIndex+FileShown]);
	clickPicture(FileList[NameIndex+FileShown],parent.Inhalt.document.images);
}
}
function initPage(theName,theList){
if (PictureShown == null) {initThings()}
clickPicture(theName,theList);
FileShown = FileList[theName].fileNo;
}
function gotoPage(thePage){
 with (parent.Inhalt) {
	FileToShown = FileList[thePage].fileNo;
	window.open(FileList[FileToShown],'Hauptframe');
//	alert(FileToShown + " " + parent.Inhalt.FileShown);
	clickPicture(FileList[NameIndex+FileToShown],parent.Inhalt.document.images);
 }
}
function mailWindow() {
window.open('','Ergebnis','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=no,width=485,height=600');
}

function Schiebepuzzle(x,y) {
	StartGame('Schiebepuzzle/Bild-1','Schiebepuzzle',x,y);
}

function Pollenbunkern(x,y) {
//	StartGame('Pollenbunkern/biene.html','Pollen bunkern',x,y);
	theWindow = window.open("/Spiele/Pollenbunkern/biene.html",0,'width=700,height=466');
	theWindow.focus();
}

function StartGame(playPath,playTitle,x,y){
	theWindow = window.open(playPath,playTitle,"toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=no,width="+x+",height="+y);
	theWindow.focus();
}


var newPopup;

function openPopUp(winurl) {
	newPopup = window.open(winurl, "_blank");
	if(newPopup) {
		if(!newPopup.closed) {
			newPopup.focus();
		}
	}
}