// in_array - Funktion
Array.prototype.contains = function (element){
	for (var i = 0; i < this.length; ++i) {
		if (this[i] == element) return true;
		}
	return false;
	}







//Cookie Gueltigkeit
var auszeit = new Date();
auszeit = new Date(auszeit.getTime() +1000*60*60*24*365);

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
	}
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
		}
	return null;
	}





var fsize=new Array();

function getSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
		}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
		}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
		}
	return [ myWidth, myHeight ];
	}


function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
		}
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
		}
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
		}
	return [ scrOfX, scrOfY ];
	}




function BW(wo,wie){
	var Quelle = document.getElementById(wo).src;
	var Ergebnis = Quelle.search(/.gif/);
	if(Ergebnis != -1) Endung=".gif";
	else Endung=".jpg";
	if (wie==1){
		Neu = Quelle.replace(Endung,"-a"+Endung);
		document.getElementById(wo).src = Neu;
		}
	else{
		Neu = Quelle.replace("-a"+Endung,Endung);
		document.getElementById(wo).src = Neu;
		}
	}




function anzeigen(das){
	if(document.getElementById(das).style.display=='none') 
		document.getElementById(das).style.display='block'; 
	else document.getElementById(das).style.display='none';
	}




function Zeige(was){
	if(vorschau[was])
		document.getElementById('vorschau').innerHTML = vorschau[was];
	else 
		document.getElementById('vorschau').innerHTML = "";
	}


function Schliessen(wo){
	document.getElementById('aktuell['+wo+']').style.position = 'absolute';
	document.getElementById('aktuell['+wo+']').style.top = '-1000px';
	document.cookie="c_aktuell["+wo+"]=1";
	}










//Bilder-Galerie
function Dia(welche){
	Vorschau="";
	Unten='<td valign="bottom" align="center"><span id="bildtitel">'+bt[welche[0]]+'<\/span><img src="./elemente/close2-0.png" onclick="Dia_ende();" align="right" class="close"></td>';
	if(welche.length > 1){
		Vorschau='<td class=\"dvorschau\"><div>';
		for(x=0;x<welche.length;x++){
			Vorschau+='<img src="bilder/bild_klein/'+welche[x]+'.jpg" onclick="Dia_wechsel('+welche[x]+')"> ';
			}
		Vorschau+='<\/div><\/td>';
		Unten='<td id="bildtitel">'+bt[welche[0]]+'<\/td><td valign="bottom" align="right"><img src="./elemente/close2-0.png" onclick="Dia_ende();" align="right" class="close"></td>'
		}
	Dia_HG(1);
	var scrollpos=getScrollXY();
	var pos=(fsize[1]-520)/2 + scrollpos[1];
	document.getElementById('dia').innerHTML = '<table cellpadding="0" cellspacing="0" border="0" id="dia_table" align=\"center\"><tr>'
		+'<td align="center" id="dia_bild"><img id="dia_img" src="bilder/bild_dia/'+welche[0]+'.jpg">'
		+'<\/td>'+Vorschau+'<\/tr>'
		+'<tr>'+Unten+'<\/tr>'
		+'<\/table>';
	document.getElementById('dia').style.visibility="visible";
	document.getElementById('dia_table').style.top=pos+"px";
	}
function Dia_wechsel(was){
	document.getElementById('dia_img').src = "bilder/bild_dia/"+was+".jpg";
	document.getElementById('bildtitel').innerHTML = bt[was];
	}
function Dia_ende(){
	document.getElementById('dia_table').style.top="-2000px";
	document.getElementById('dia').style.visibility='hidden';
	Dia_HG();
	}

function Dia_HG(wie){
	if(wie){
		var dhoehe=document.body.offsetHeight;
		fsize = getSize();
		if(dhoehe<fsize[1]) dhoehe=fsize[1];
		document.getElementById('dia').style.height = dhoehe+"px";
		}
	else{
		document.getElementById('dia').style.height = 0;
		}
	}





