/* JavaScript by Armin Priesner, Webdesignen.at */

// DinnerJazz Animation
function fnWait() {
	var tag = document.getElementById("dinnerjazz");
	tag.innerHTML = "";
	window.setTimeout("fnAddChr('', 0)", 1000);
}
function fnAddChr(str, i) {
	var chrArray = new Array('D', 'i', 'n', 'n', 'e', 'r', 'J', 'a', 'z', 'z', ' - ', 'T', 'a', 'n', 'z', 'M', 'u', 's', 'i', 'k', ' - ', 'P', 'a', 'r', 't', 'y', 'F', 'u', 'n', 'k');
	var tag = document.getElementById("dinnerjazz");
	if(i < chrArray.length) {
		str += chrArray[i];
		i++;
		tag.innerHTML = str;
		window.setTimeout("fnAddChr('"+str+"', "+i+")", 140);
	}
	/*
	else
		window.setTimeout("fnWait()", 2000);
	*/
}
function fnDinnerJazz() {
	if(document.getElementById("dinnerjazz"))
		fnAddChr("", 0);
}
window.onload = fnDinnerJazz;


// Popup - Hintergrundmusik
function fnPopupBM() {
	var popup = window.open("hintergrundmusik.php", "", "width=300px,height=100px,resizable=yes");
	popup.blur();
}


// Popup
function fnPopup(file) {
	var popup = window.open("popup.php", "", "width=180px,height=180px,resizable=yes");
	popup.img = file;
}
var imgLoading = new Image();
imgLoading.src = "img/ladeanimation.gif";
function fnImage(picture) {
	function myImgOnLoadHandler() {
		document.images['myImg'].src = img.src;
	}
	
	function myImgOnErrorHandler() {
		alert("Das angeforderte Bild konnte nicht geladen werden!\nThe requested image could not be loaded.");
	}
	
	function myImgCompleteHandler() {
		document.images['myImg'].src = imgLoading.src;
	}
	
	var img = new Image();
	img.onload = myImgOnLoadHandler;
	img.onerror = myImgOnErrorHandler;
	
	// Preloader: Unterscheidung IE und Mozilla, Opera
	if(navigator.userAgent.indexOf('MSIE') > -1) {
		var bool = true; // MS IE
	}
	else {
		var bool = false; // Mozilla, Opera
	}
	do {
		myImgCompleteHandler();
	}
	while(img.complete == bool);
	
	img.src = picture;
	window.setTimeout("fnResize()", 1000);
	//alert("H: " + document.images[0].height + "\nB: " + document.images[0].width);
	//var imgHeight = img.height;
	//var imgWidth = img.width;
	//window.resizeTo(imgWidth, imgHeight);
	//window.moveTo(1, 1);
}

function fnResize() {
	//alert("e");
	window.resizeTo(document.images[0].width +55, document.images[0].height+85);
	/*
	var i = 0;
	if(navigator.appName == 'Netscape') i=40;
	if(document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
	*/
	self.focus();
}
/*
function fnImage(picture) {
	function myImgOnLoadHandler() {
		document.images['myImg'].src = img.src;
	}
	
	function myImgOnErrorHandler() {
		alert("Das angeforderte Bild konnte nicht geladen werden!\nThe requested image could not be loaded.");
	}
	
	function myImgCompleteHandler() {
		document.images['myImg'].src = imgLoading.src;
	}
	
	var img = new Image();
	img.onload = myImgOnLoadHandler;
	img.onerror = myImgOnErrorHandler;
	
	// Preloader: Unterscheidung IE und Mozilla, Opera
	if(navigator.userAgent.indexOf('MSIE') > -1) {
		var bool = true; // MS IE
	}
	else {
		var bool = false; // Mozilla, Opera
	}
	do {
		myImgCompleteHandler();
	}
	while(img.complete == bool);
	
	img.src = picture;
	alert("H: " + img.height + "\nB: " + img.width);
	var imgHeight = img.height;
	var imgWidth = img.width;
	window.resizeTo(imgWidth, imgHeight);
}
*/