
if(self!=top){
	top.location.replace(window.location.href);
}

function confirmation(msg){
	var answer = confirm(msg);
	if(answer==true){
		return true;
	}else{
		return false;
	}
}

// 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 linkETC(){
	document.getElementById('etclink').setAttribute("target", "_blank");
}
function clipbox(id){
	if(document.getElementById('clipbox'+id).className == "clipboxoff"){
		document.getElementById('clipbox'+id).className = "clipboxon";
	}else{
		document.getElementById('clipbox'+id).className = "clipboxoff";
	}
}
function galUp(pictureid,picturewidth,pictureheight){
	var fullsc = document.getElementById('fullscreen');
	var fullbg = document.getElementById('fullscreenbg');
	var top	= (document.all) ? document.documentElement.scrollTop : window.pageYOffset;
	if(fullsc){
		fullsc.innerHTML = '<div id="horizon"><div id="highimg"><img src="Picture-'+pictureid+'-'+picturewidth+'.pht" alt="Ansicht" /><span class="pfeil"></span><a href="javascript:galDown();void(0);" class="schliessen">schließen</a><span class="pfeil"></span><div class="clear"></div></div></div>';
	}
	document.getElementById('horizon').style.marginTop="-"+(Math.round(pictureheight/2)+22)+"px";
	if(fullbg){
		fullbg.style.top="0px";
		fullbg.style.display="block";
	}
	if(fullsc){
		fullsc.style.top=top+"px";
		fullsc.style.display="block";
	}
}
function galUpAll(pictureid,picturearr,gallery){

	var fullsc = document.getElementById('fullscreen');
	var fullbg = document.getElementById('fullscreenbg');
	var top	= (document.all) ? document.documentElement.scrollTop : window.pageYOffset;
	
	var content = document.getElementById('content');
	var linklist = document.getElementsByTagName('a');
	
	var galid = new Array();
	var galwidth = new Array();
	var galheight = new Array();
	var tempgalid = '';
	var tempgalwidth = '';
	var tempgalheight = '';
	
	for(var i = 0; i < linklist.length; i++){
		if(linklist[i].rel==gallery){
		
			tempgalid = linklist[i].rev.substr((linklist[i].rev.search('picture:')+8),linklist[i].rev.search('width'));
			tempgalwidth = linklist[i].rev.substr((linklist[i].rev.search('width:')+6),linklist[i].rev.search('height'));
			tempgalheight = linklist[i].rev.substr((linklist[i].rev.search('height:')+7),linklist[i].rev.length);
			galid.push(tempgalid.substring(0,tempgalid.length-9));
			galwidth.push(tempgalwidth.substring(0,tempgalwidth.length-11));
			galheight.push(tempgalheight);
		}
	}
	
	var full = galid.length;
	var prev = (picturearr-1);
	var next = (picturearr+1);
	if(prev<0) prev = full-1;
	if(next==full) next = 0;
	
	//alert(galid[picturearr]+' '+galwidth[picturearr]+' '+galheight[picturearr]);
	
	var picturewidth = galwidth[picturearr];
	var pictureheight = galheight[picturearr];
	
	if(fullsc){
		fullsc.innerHTML = '<div id="horizon"><div id="highimg"><img src="Picture-'+pictureid+'-'+picturewidth+'.pht" alt="Ansicht" /><a href="javascript:galUpAll(\''+galid[prev]+'\','+prev+',\''+gallery+'\');" class="pfeil">&#60;</a><a href="javascript:galDown();void(0);" class="schliessen">schließen</a><a href="javascript:galUpAll(\''+galid[next]+'\','+next+',\''+gallery+'\');" class="pfeil">&#62;</a><div class="clear"></div></div></div>';
	}
	
	document.getElementById('horizon').style.marginTop="-"+(Math.round(pictureheight/2)+22)+"px";
	if(fullbg){
		fullbg.style.top="0px";
		fullbg.style.display="block";
	}
	if(fullsc){
		fullsc.style.top=top+"px";
		fullsc.style.display="block";
	}
}

function galDown(){
	var fullsc = document.getElementById('fullscreen');
	var fullbg = document.getElementById('fullscreenbg');
	if(fullbg){
		document.getElementById('fullscreenbg').style.top="-5000px";
	}
	if(fullsc){
		document.getElementById('fullscreen').style.top="-5000px";
		document.getElementById('fullscreen').innerHTML='';
	}
}

function contentLinks(target){
	var contentlinks = document.getElementById(target);
	var links = contentlinks.getElementsByTagName("a");
	for (var i = 0; i < links.length; i++){
		if(links[i].getAttribute('href')){
			var thislink = links[i].getAttribute('href').toString();
			if(thislink.substring(0, 7) == 'http://'){
				links[i].setAttribute("target", "_blank");
				/*
				if (typeof document.createElementNS != 'undefined') {
					var img = document.createElementNS('http://www.w3.org/1999/xhtml', 'img');
				}
				if (typeof document.createElement != 'undefined') {
					var img = document.createElement('img');
				}
				var linkname = links[i].childNodes[0];
				var linkkomplett = linkname.nodeValue + ' ';
				linkname.nodeValue = linkkomplett;
				img.setAttribute("src", "/htdocs/_images/externallink.gif");
				img.setAttribute("style", "display:inline; width:8px; height:8px; padding:0px; margin:0px; border:0px none #fff;");
				img.className="externallink";
				img.setAttribute("border", "0");
				img.setAttribute("alt", "Externer Link");
				links[i].appendChild(img);
				*/
			}
		}
	}
}

