
if(self!=top){
	top.location.replace('www.waldabenteuer.de');
}

// E-Mail Spamschutz
function UnCryptMailto(string){
	var ckey=7;
	var num=0;
	var rebuild="";
	for(var i=0; i < string.length; i++) {
		num=string.charCodeAt(i);
		if (num>=8364) {num = 128;}
		rebuild += String.fromCharCode(num-(ckey));
	}
	return rebuild;
}
function linkTo_UnCryptMailto(string)	{
	location.href=UnCryptMailto(string);
}

function calendar_up(){
	document.getElementById('fullscreen').style.top="0px";
	document.getElementById('fullscreenbg').style.top="0px";
	document.getElementById('content').style.overflow="hidden";
}
function calendar_down(){
	document.getElementById('fullscreen').style.top="-5000px";
	document.getElementById('fullscreenbg').style.top="-5000px";
	document.getElementById('content').style.overflow="auto";
}
// AJAX für Galerie

var	i = 0, url = "/htdocs/xml.galerie.php", httpRequest = false;

function menuColor(key,menge){
	for(i=1;i<=menge;i++){
		document.getElementById('button'+(i-1)).className='off';
	}
	document.getElementById('button'+key).className='on';
	return true;
}
function sendRequest(key,galerie) {
	httpRequest = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		httpRequest = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (httpRequest.overrideMimeType) {
		httpRequest.overrideMimeType('text/xml');
		// zu dieser Zeile siehe weiter unten
	}
	if (!httpRequest) {
		alert('XML nicht verf&uuml;gbar');
		return false;
	}
	httpRequest.onreadystatechange = responseInhalt;
	httpRequest.open('GET', url+'?galerie='+galerie+'&key='+key, true);
	httpRequest.send(null);
}
function responseInhalt() {
	if (httpRequest.readyState == 4) {
		if (httpRequest.status == 200) {
			var xmldoc = httpRequest.responseXML;
			var root_node = xmldoc.getElementsByTagName('impressionen').item(0);
			var key = root_node.getElementsByTagName('keynow').item(0).firstChild.data;
			var menge = root_node.getElementsByTagName('menge').item(0).firstChild.data;
			var galerie = root_node.getElementsByTagName('galerie').item(key).firstChild.data;
			var text = root_node.getElementsByTagName('text').item(key).firstChild.data;
			var bild = root_node.getElementsByTagName('value').item(key).firstChild.data;
			menuColor(key,menge);
			document.getElementById('galpict').innerHTML = '<img src="/Picture-'+bild+'-440-260.pht" alt="'+text+'" />';
			document.getElementById('loaded').value = key;
			document.getElementById('menge').value = (menge-1);
		}
	}
}
function pfeil(action,galerie){
	if(action=="next"){
		var key = document.getElementById('loaded').value;
		var menge = document.getElementById('menge').value;
		key++;
		if(key<=menge){
			sendRequest(key,galerie);
		}else{
			sendRequest(0,galerie);
		}
	}else{
		var key = document.getElementById('loaded').value;
		var menge = document.getElementById('menge').value;
		key--;
		if(key>=0){
			sendRequest(key,galerie);
		}else{
			sendRequest(menge,galerie);
		}
	}
}
function minicalclose(calen){
	document.getElementById('minical'+calen).style.top="-5000px";
}
function minical(id){
	document.getElementById('minical'+id).style.top="50%";
	document.getElementById('minical'+id).style.left=((screen.width/2)-220)+"px";
}
function printdate(day,month,year){
	if(day<=9) day = '0'+day;
	if(month<=9) month = '0'+month;
	document.getElementById('datum').value=day+"."+month+"."+year;
}
