// JavaScript Document

function outputMainDiv(hoehe) {
	var breite = 0;
	if(window.innerWidth) {
		breite = (window.innerWidth - 798) / 2;
	}
	else if(document.body.offsetWidth) {
		breite = (document.body.offsetWidth - 798) / 2;
	}
	document.write("<div id=\"background\" class=\"background\" style=\"margin-left: " + breite + "px; height: " + hoehe + "px;\">");
}

function Fensterweite() {
	if(window.innerWidth) {
		return window.innerWidth;
	}
	else if(document.body && document.body.offsetWidth) {
		return document.body.offsetWidth;
	}
	else {
		return 0;
	}
}

function neuAufbau() {
	if(Weite != Fensterweite()) {
		location.href = location.href;
	}
}

function wechsel(url, bw) {
	var anzeige, bild, endung;
	if(bw == 1) {
		var teile = url.split(".jpg");
		bild = teile[0];
		endung = teile[1];
		anzeige = bild + 'Farbe' + '.jpg';
	}
	else {
		anzeige = url;
	}
	window.document.images[url].src = anzeige;
}

function fenster(datei, width, height) {
	var params = "scrollbars=no,menubar=no,status=no,resizable=no,locationbar=no,width=" + width + ",height=" + height;
	Fenster = window.open(datei, "", params);
	Fenster.focus();
}

// nächstes Bild laden, Zähler raufsetzen, bei mehr als X wieder bei 1 anfangen
function naechstesBild() {
	document.animation.src = bilder[bildNummer].src;
	//document.animation.width = bilder[bildNummer].width;
	//document.animation.height = bilder[bildNummer].height;
	bildNummer++;
	if(bildNummer > anzahl) {
		bildNummer = 1;
	}
}
