function testForColors(){
	var colorstring = window.name;
	if (colorstring.length >0){
		colors = colorstring.split("~");
	}
}













function Navi(correspContentSwapper) {
	var stepsD = new Array("0.0", "0.2", "0.4", "0.6", "0.8", "1.0");
	var stepsI = new Array("0", "20", "40", "60", "80", "100");
	var cosZoomFactors = new Array(18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 33, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 29, 29, 29, 29, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 24, 24, 24, 23, 23, 23, 23, 22, 22, 22, 21, 21, 21, 21, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18);
	var npics = document.getElementById("navipics").getElementsByTagName("img");
	var npicscount = npics.length;
	var firstpic = npics[0];
	var lastpic = npics[npicscount-1];
	var step = 5;
	var obj = "navipics";
	var npicsContainer = document.getElementById("navipics");
	var picOffsetParent1  = document.getElementById("picturecontent");
	var picOffsetParent2 = picOffsetParent1.parentNode;
	var object;
	var interval = false;
	var currentX = 0;
	var currentY = 0;
	var isHidden = false;
	var currentOffset = 0;
	var sliderwidth = picOffsetParent1.offsetWidth;
	var slidermid = parseInt(sliderwidth/2);
	var scrolltimeout = false;
	var instanceController = this;
	var cSwap = correspContentSwapper;
	
	var originalText = document.getElementById('navitext_a').innerHTML;
	
	
	this.show = function() {
		step = Math.max(0,step);
		step = Math.min(5,step);
		if(interval)clearTimeout(interval);
		object = document.getElementById(obj).style;
		object.display = "";
		showStep();
		isHidden=false;
	}
	this.hide = function() {
		step = Math.max(0,step);
		step = Math.min(5,step);
		if(interval)clearTimeout(interval);
		object = document.getElementById(obj).style;
		hideStep();
		isHidden = true;
	}
	this.onclicknavipic = function(num){
		npics[cSwap.currentPicture].onclick = function(e){
			var srce = this.src;
			var pcount = 0;
			for ( var n = 0; n<npicscount; n++){
				if (npics[n].src == srce){pcount=n;}
			}
			instanceController.onclicknavipic(pcount);
		}
		if (cSwap.links[num]){
			npics[num].onclick = function(e){
				document.location.href = cSwap.links[cSwap.currentPicture];
			}
		}
		cSwap.fadeTo(num);
		}
	this.onmouseenter = function (evt){
		currentX = evt.clientX - picOffsetParent1.offsetLeft;
		currentY = evt.clientY - picOffsetParent1.offsetTop;
		if (isHidden){
			document.getElementById("navitext_a").innerHTML = ''; 
			cSwap.stopPicLoop();
			this.show();
		}
	}
	this.onmouseexit = function (evt){
		currentX = evt.clientX - picOffsetParent1.offsetLeft;
		currentY = evt.clientY - picOffsetParent1.offsetTop;
		if ( (currentX<=2) || (currentX>=parseInt(document.getElementById("mainpic").offsetWidth)-2) || (currentY<=2) || (currentY>=parseInt(document.getElementById("mainpic").offsetHeight)+2) ) {
			this.hide(); 
			cSwap.startPicLoop();
			document.getElementById('navitext_a').innerHTML = originalText;
		}
	}
	this.onmousemove = function (evt){
		currentX = evt.clientX - picOffsetParent1.offsetLeft;
		currentY = evt.clientY - picOffsetParent1.offsetTop;
		currentX = Math.max(currentX, parseInt(npics[0].offsetWidth / 2)+2);
		currentX = Math.min(currentX, sliderwidth - parseInt(npics[npicscount-1].offsetWidth / 2)-2);
		calculateAll();
	}
	document.getElementById("picturecontent").onmouseover = function (e) {
		var ev = (e)? e : window.event;	
		instanceController.onmouseenter(ev);
	}
	document.getElementById("naviback").onmouseover = function (e) {
		var ev = (e)? e : window.event;	
		instanceController.onmouseenter(ev);
	}
	document.getElementById("navitext").onmouseover = function (e) {
		var ev = (e)? e : window.event;	
		instanceController.onmouseenter(ev);
	}
	document.getElementById("navipics").onmousemove = function(e){
		var ev = (e)? e : window.event;
		instanceController.onmousemove(ev);
	}
	picOffsetParent1.onmouseout = function (e) {
		var ev = (e)? e : window.event;
		instanceController.onmouseexit(ev);
	}
	picOffsetParent2.onmouseout = function (e) {
		var ev = (e)? e : window.event;
		instanceController.onmouseexit(ev);
	}
	document.getElementById("naviback").onmouseout = function (e) {
		var ev = (e)? e : window.event;
		instanceController.onmouseexit(ev);
	}
	document.getElementById("navitext").onmouseout = function (e) {
		var ev = (e)? e : window.event;
		instanceController.onmouseexit(ev);
	}
	for(var c = 0; c <npicscount; c++){npics[c].onclick = function (e) {
		var srce = this.src;
		var pcount = 0;
		for ( var n = 0; n<npicscount; n++){
			if (npics[n].src == srce){pcount=n;}
		}
		instanceController.onclicknavipic(pcount);
	}}
	var showStep = function () {
		object.opacity = stepsD[step];
		object.filter = "Alpha(opacity = " + stepsI[step] + ")";
		if (step<5) {interval = setTimeout(showStep,25);}else{interval = false}
		step ++; 
	}
	var hideStep = function () {
		object.opacity = stepsD[step];
		object.filter = "Alpha(opacity = " + stepsI[step] + ")";
		if (step>0) {interval = setTimeout(hideStep,40);}else{object.display = "none";interval = false;}
		step -=1; 
	}
	var calculateAll = function(){
		if (scrolltimeout) clearTimeout(scrolltimeout);
		var offStandard = currentOffset + 100 + slidermid - 400 - currentX ;
		for (var n=0, currentPic ; n< npicscount; n++){
			currentPic = npics[n];
			var currenMid = parseInt(currentPic.offsetWidth / 2) + offStandard ;
			var xp =currentPic.offsetLeft + currenMid;
			if ( (xp >= 0) && (xp <= 200) ){
				var newval = cosZoomFactors[xp] + "px";
				currentPic.style.width = newval;
				currentPic.style.height = newval;
			} else {
				currentPic.style.width = "18px";currentPic.style.height = "18px";
			}
		}
		var completeWidth = lastpic.offsetLeft - firstpic.offsetLeft + lastpic.offsetWidth;
		if (completeWidth>sliderwidth) {
			if (currentX<100){
				if (currentOffset+2 < (completeWidth - sliderwidth)/2){
					currentOffset +=2;
					scrolltimeout = setTimeout(calculateAll,25);
				} else {
					currentOffset = parseInt((completeWidth - sliderwidth)/2);
				}
			}
			if (currentX>sliderwidth-100){
				if (currentOffset-2 > (sliderwidth - completeWidth)/2){
					currentOffset -=2;
					scrolltimeout = setTimeout(calculateAll,25);
				} else {
					currentOffset = parseInt((sliderwidth - completeWidth)/2);
				}
			}
			npicsContainer.style.marginLeft = (-250 + currentOffset) +"px";
		}
	}
}




function Cookies(){
	var ct = document.cookie;
	var loc = document.location.href;
	loc = loc.substring(loc.lastIndexOf("/")+1);
	loc = loc.substring(0,loc.indexOf(".php"));
	loc = loc + "_php";
	
	
	
	
	var cookies = new Array("0","0","false","false","false","false");
	if (ct.indexOf(loc)>(-1)){
		
		ct = ct.substr(ct.indexOf(loc));
		ct = ct.substr(ct.indexOf("=")+1);
		ct = ct + ";" ;
		ct = ct.substr(0, ct.indexOf(";"));
		ct = decodeURIComponent(ct);
		ct=ct.replace(/\\'/g,'\'');
		ct=ct.replace(/\\"/g,'"');
		ct=ct.replace(/\\\\/g,'\\');
		ct=ct.replace(/\\0/g,'\0');
		act =ct.split("+");
		ct = act.join(" ");
		cookies = ct.split("~");
		
	}
	
	this.setCookie = function (key, value){
		var num=0;
		switch (key){
			case ("picture"):num = 0;break;
			case ("textnum"):num = 1;break;
			case ("subtitle"):num = 2;break;
			case ("title"):num = 3;break;
			case ("text"):num = 4;break;
			case ("button"):num = 5;break;
		}
		cookies[num] = value;
		ct =cookies.join("~");
		ct = encodeURIComponent(ct);
		
		act =ct.split("%20");
		ct = act.join("+");
		
		document.cookie = loc + "=" + ct;
	}
	
	this.getCookie = function(key){
		var num=0, val;
		switch (key){
			case ("picture"):num = 0;break;
			case ("textnum"):num = 1;break;
			case ("subtitle"):num = 2;break;
			case ("title"):num = 3;break;
			case ("text"):num = 4;break;
			case ("button"):num = 5;break;
		}
		return(cookies[num]);
	}
}



function ContentSwapper() {
	var stepsD = new Array("0.0", "0.2", "0.4", "0.6", "0.8", "1.0");
	var stepsI = new Array("0", "20", "40", "60", "80", "100");
	var step = 0;
	var interval = false;
	var nsrc;
	
	var picDivs = new Array(); 
	var imgs = new Array(); 
	var swapimage = false;
	var mainimage = document.getElementById("mainpic");
	if(document.getElementById("pictainer")) {
		swapimage = document.getElementById("swappic");
		picDivs = document.getElementById("pictainer").getElementsByTagName("div");
		imgs = document.getElementById("pictainer").getElementsByTagName("img");
	}
	var subPicTitles = new Array();
	var picTexts = new Array();
	var picTitles = new Array();
	this.links = new Array();
	var currentLink = "";
	var subtitletarget = document.getElementById("subtitle");
	var titletarget = document.getElementById("maintitle");
	var texttarget = document.getElementById("text");
	var self = this;
	var cookies = new Cookies();
	
	this.currentPicture = cookies.getCookie("picture");

for (var n=0; n< picDivs.length; n++){
		subPicTitles[n] = "&nbsp;";
		picTitles[n] = false;
		picTexts[n] = false;
		this.links[n] = false;
		var h2s=picDivs[n].getElementsByTagName("h2");
		var as=picDivs[n].getElementsByTagName("a");
		var h1s=picDivs[n].getElementsByTagName("h1");
		var ps=picDivs[n].getElementsByTagName("p");
		if (h2s.length>0){subPicTitles[n] = h2s[0].innerHTML;}
		if (as.length>0){this.links[n] = as[0].href;}
		if (h1s.length>0){picTitles[n] = h1s[0].innerHTML;}
		if (ps.length>0){picTexts[n] = ps[0].innerHTML;}
	}
	var object = swapimage.style;
	var textLoop = false; 
	var picLoop = false;
	
	if (this.links[this.currentPicture]){
			currentLink = this.links[this.currentPicture];
			mainimage.onclick = function(e){
				document.location.href = currentLink;
			}
		}
	
	this.stopPicLoop = function (){if(picLoop){clearInterval(picLoop);picLoop=false;}}
	this.startPicLoop = function (){if(picLoop){clearInterval(picLoop);}picLoop=setInterval(nextPic,10000);}
	
	
	
	
	this.startTextLoop = function (){textLoop=setInterval(nextText,15000);}
	this.stopTextLoop = function (){if(textLoop){clearInterval(textLoop);textLoop=false;}}
	this.resetTextLoop = function (){if(textLoop){clearInterval(textLoop);textLoop=setInterval(nextText,15000);}}
	
	var textDivs = new Array();
	if(document.getElementById("textainer")) {textDivs = document.getElementById("textainer").getElementsByTagName("div");}
	var textTexts = new Array();
	var textTitles = new Array();
	for ( var n=0; n<textDivs.length; n++){
		textTexts[n]=textDivs[n].getElementsByTagName("p")[0].innerHTML;
		textTitles[n]=textDivs[n].getElementsByTagName("h1")[0].innerHTML;	
	}
	
	var textCount =textDivs.length;
	var currentTextNum = parseInt(cookies.getCookie("textnum"));
	var nButton = document.getElementById("nextButton");
	this.nextText = function (){
		//this.resetTextLoop();
		var newnum = currentTextNum + 1;
		var mid="[...]";
		if(newnum ==textDivs.length-1)mid="[zur&uuml;ck]";
		if(newnum ==textDivs.length)newnum=0;
		var newText = textTexts[newnum];;
		var newTitle = textTitles[newnum];
		texttarget.innerHTML = newText;
		titletarget.innerHTML = newTitle;
		nButton.innerHTML = mid;
		currentTextNum = newnum;
		cookies.setCookie("textnum",newnum);
		cookies.setCookie("text",newText);
		cookies.setCookie("title",newTitle);
		cookies.setCookie("button",mid);
		
	}
	
	var nextPic = function (){
		self.startPicLoop();
		var num = self.currentPicture;
		num ++;
		if (num == imgs.length){num=0;}
		self.fadeTo(num);
		
	}
	this.fadeTo = function (picNum){
		if (interval) clearTimeout(interval);
		var actSrc = imgs[picNum].src;
		step = 0;
		swapimage.src = actSrc;
		subtitletarget.innerHTML = subPicTitles[picNum]; 
		cookies.setCookie("subtitle",subPicTitles[picNum]);

		this.currentPicture = picNum;
		if (this.links[picNum]){
			currentLink = this.links[picNum];
			mainimage.onclick = function(e){
				document.location.href = currentLink;
			}
		} else {
			mainimage.onclick = function(e){}
		}
		cookies.setCookie("picture",picNum);
		if (picTitles[picNum]){titletarget.innerHTML = picTitles[picNum];}
		if (picTexts[picNum]){texttarget.innerHTML = picTexts[picNum]}
		object.display  = "block";
		blendStep();
	}
	var blendStep = function () {
		object.opacity = stepsD[step];
		object.filter = "Alpha(opacity = " + stepsI[step] + ")";
		if (step<5) interval = setTimeout(blendStep,25);
		if (step==5){
			mainimage.src = swapimage.src;
			object.opacity = "0.0";
			object.filter = "Alpha(opacity = 0)";
			object.display  = "none";
			interval = false;
			}
		step ++; 
	}
}


function stat(arguments){
	var content = "";
	for (var i=0; i< stat.arguments.length; i++){
		content = content + (i+1) + ": " + stat.arguments[i] + " - - - ";
	}
	document.getElementById("lowerline").innerHTML = content;
}

