var ie=false;  var n4=false; var DOM=false; var btx=false; var BuggyIE=false;

var obj = ""; var obSt = "";

if (document.getElementById){
DOM = true; obj = "document.getElementById";
}
else
if (document.layers || (navigator.appName.indexOf("Netscape") > -1 && navigator.appVersion.substring(0,1)==4)){
n4=true;     /* alter Netscape 4.x */
obj = "document.layers";
browser = "n4";
}
else
btx=true;    /* Exoten */


if (document.all)
ie = true;

function objSt(item)
{
 if(DOM)
 obSt=obj+'("'+item+'").style';
return obSt;
}
function objCont(item,Str)
{
Str=unescape(Str);
 if(DOM)
 obSt=obj+'("'+item+'").innerHTML="'+Str+'"';
return obSt;
}

if (navigator.appVersion.indexOf("MSIE 5")>-1)
BuggyIE=true;


/*
Fuer Galerie [mp 2005]
*/

var picContainer;
var PicArray=new Array();
var Guri="";
var GBeschreibung,GTitel;
var Einzelpic=false;

function grossesBild(uri,Beschreibung,Titel,einzel) {

if (einzel)
Einzelpic=true;
else
Einzelpic=false;

Guri=uri;
GBeschreibung=Beschreibung;
GTitel=Titel;
//alert(ClipCountOut);





window.clearInterval(RollIntervalIn);
window.clearInterval(RollIntervalOut);

if (ClipCountOut > 0) {
RollIntervalOut = window.setInterval("RollOut()",1);
//alert("Tach");
return;
} else {
RollIntervalIn = window.setInterval("RollIn()",1);
}

	if (PicArray.length == 0) {
	var AlleLinks=document.getElementsByTagName("a");
		for (var i=0;i<AlleLinks.length;i++){
		
			if ((AlleLinks[i].href.indexOf(".jpg")>-1)) {
			var ClickAttribut=String(AlleLinks[i].getAttribute("onclick"));
			ClickAttribut=ClickAttribut.replace(/\n/g,'');
//			alert(ClickAttribut);
			var tmp=new Array();
			tmp=ClickAttribut.split(",\'");
				for (var j =0 ; j <tmp.length; j++ ) {
				tmp[j]=tmp[j].replace(/\'/g,'');
				tmp[j]=tmp[j].replace(/\n/g,'');
				tmp[j]=tmp[j].replace(/EIN_KOMMA/g, ",");
				}
//			alert(tmp[1]);
			PicArray[PicArray.length]=new Array(AlleLinks[i].getAttribute("href"), tmp[1], tmp[2].substring(0,tmp[2].indexOf(");")));
//			alert(PicArray[(PicArray.length-1)]);
			}
		}	
	}



picContainer=document.getElementById("extradiv1");
ClipCountIn=0;
ClipCountOut=950;
//RollIntervalIn = window.setInterval("RollIn()",1);

var picString="";

picString+="\n<div class=\"BildMenu\">";

var imgsrc="\n<img id='BigPic' src=\""+Guri.replace("fotos_klein","fotos_gross")+"\" />";

if (!Einzelpic) {
	for (var k=0 ; k< PicArray.length; k++) {
	//	alert(PicArray[k][0] + "\n" + uri);
		if ( PicArray[k][0].substr(PicArray[k][0].indexOf("fotos_klein")) == Guri.substr(Guri.indexOf("fotos_klein")) ) {
		if (PicArray[k-1])
		picString+="<a href=\"JavaScript:grossesBild('"+PicArray[k-1][0]+"','"+PicArray[k-1][1]+"','"+PicArray[k-1][2]+"')\"\>voriges Bild</a>";
		else
		picString+="<span>voriges Bild</span>";
			if (PicArray[k+1]) {
			picString+="<a href=\"JavaScript:grossesBild('"+PicArray[k+1][0]+"','"+PicArray[k+1][1]+"','"+PicArray[k+1][2]+"')\"\>n&auml;chstes Bild</a>";
			imgsrc="\n<a title=\"zum n&auml;chsten Bild\" href=\"JavaScript:grossesBild('"+PicArray[k+1][0]+"','"+PicArray[k+1][1]+"','"+PicArray[k+1][2]+"')\"\>"+imgsrc+"</a>";
			} else {
			picString+="<span>n&auml;chstes Bild</span>";
			imgsrc="\n<a title=\"zum ersten Bild\" href=\"JavaScript:grossesBild('"+PicArray[0][0]+"','"+PicArray[0][1]+"','"+PicArray[0][2]+"')\"\>"+imgsrc+"</a>";
			}
		}
	}
} else {
imgsrc="\n<a title=\"Schlie&szlig;en\" href=\"JavaScript:weg()\"\>"+imgsrc+"</a>";
}
picString+="<a href=\"Javascript:weg()\">Schlie&szlig;en</a><a id=\"foc\" href='#'></a></div>"+
"\n<div class=\"Bildbeschreibung\"><h4>"+Titel+"</h4>"+Beschreibung+"</div>";


Guri=Guri.replace("fotos_klein","fotos_gross");


//picString+="\n<img id='BigPic' src=\""+Guri+"\" />"+
picString+=imgsrc+

"\n<div></div>";
picContainer.innerHTML=picString;

picContainer.className="Foto";

if (Einzelpic) {
picContainer.style.left=170+"px";
}

if (ie)
picContainer.style.top=(document.documentElement.scrollTop+20)+"px";
else
picContainer.style.top=(window.pageYOffset+20)+"px";
if (BuggyIE)
picContainer.style.top=(document.body.scrollTop+20)+"px";

self.focus();



}

function weg() {
window.clearInterval(RollIntervalIn);
window.clearInterval(RollIntervalOut);
/*picContainer.className="FotoHide";
ClipCountIn=0;
ClipCountOut=0;
picContainer.style.clip="rect(0px auto "+ClipCountIn+"px 0px)";*/
RollIntervalOut = window.setInterval("RollOut(1)",1);
document.getElementById("foc").focus();
}

var ClipCountIn=0;
var ClipCountOut=0;
var RollIntervalIn;
var RollIntervalOut;

function RollIn() {
//window.status=ClipCountIn;
	if (ClipCountIn < 900) {
	ClipCountIn+=7;
	picContainer.style.clip="rect(0px auto "+ClipCountIn+"px 0px)";
	} else {
	ClipCountIn=0;
	window.clearInterval(RollIntervalIn);
	document.getElementById("foc").focus();
//	AktuellesDiv.className="AntwortDivShow"
	}
}
function RollOut(n) {
//window.status=ClipCountOut;
//document.getElementById("extradiv2").innerHTML=ClipCountOut;
	if (ClipCountOut > 0) {
	ClipCountOut-=15;
	picContainer.style.clip="rect(0px "+ClipCountOut+"px auto 0px)";
	} else {
	window.clearInterval(RollIntervalOut);
	ClipCountOut=0;
//	AktuellesDiv.className="AntwortDiv";
//	AktuellesDiv=warteDiv;
//	AktuellesDiv.className="AntwortDivShow"
	if(!n)
	if (Einzelpic)
	grossesBild(Guri,GBeschreibung,GTitel,1);
	else
	grossesBild(Guri,GBeschreibung,GTitel);
	//RollIntervalIn = window.setInterval("RollIn()",1);
	}
}








/*
function gross() {
var EvaBreit=EvaWin.document.getElementById("BigPic").width + 50;
var EvaHoch=EvaWin.document.getElementById("BigPic").height + 220;
EvaWin.resizeTo(EvaBreit,EvaHoch);

}
*/

/*
Fuer Navigation [mp 2005]
*/

function init_navigation() {
var uri=String(window.location);
uri=uri.substr(uri.lastIndexOf("/"));

var theNode=document.getElementById("navigation2").firstChild;

	while (theNode.nextSibling) {
		if (theNode.nextSibling.nodeName=="UL") {
		theNode=theNode.nextSibling;
		break;
		}
	theNode=theNode.nextSibling;
	}

var AlleLinks=theNode.getElementsByTagName("a");
for (var i=0;i<AlleLinks.length;i++){
var tmp=AlleLinks[i].getAttribute("href").substr(AlleLinks[i].getAttribute("href").lastIndexOf("/"));
		if (tmp==uri) {
		var text=document.createTextNode(AlleLinks[i].firstChild.data);
		var theSpan=document.createElement("span");
		theSpan.appendChild(text);
		AlleLinks[i].parentNode.removeAttribute("class");
		AlleLinks[i].parentNode.className="";
		AlleLinks[i].parentNode.replaceChild(theSpan, AlleLinks[i].parentNode.firstChild);
		}
	}

/*
viel anstrengender ist die Hauptnavi. Nach Ordnern suchen...
*/

uri=String(window.location).substr(String(window.location).indexOf("//")+2);
uri=uri.substr(uri.indexOf("/"));

var uriAr=uri.split("/");
var letzterOrdner=uriAr[uriAr.length-2];

theNode=document.getElementById("navigation").firstChild;
	while (theNode.nextSibling) {
		if (theNode.nextSibling.nodeName=="UL") {
		theNode=theNode.nextSibling;
		break;
		}
	theNode=theNode.nextSibling;
	}

var AlleLinks=theNode.getElementsByTagName("a");
for (var i=0;i<AlleLinks.length;i++){
var tmp=AlleLinks[i].getAttribute("href");

var tmpAr=tmp.split("/");
var eltern=false;
for (var k=0;k<tmpAr.length;k++) {
	if (tmpAr[k-1]==letzterOrdner)
	eltern=true;
}

		if (eltern) { 
		var text=document.createTextNode(AlleLinks[i].firstChild.data);
		AlleLinks[i].parentNode.removeAttribute("class");
		AlleLinks[i].parentNode.className="";
		AlleLinks[i].parentNode.replaceChild(text, AlleLinks[i].parentNode.firstChild);
		}
	}

}
/* Kalender aufrufen */

function getJahr(frm) {
var inp=frm.jahr.value;
var jetzt=new Date;
var j=jetzt.getFullYear();
if (isNaN(inp))
inp=j;
if (inp < 1600 || inp > 2199)
inp=j;
var kalUrl="/de/kal/"+inp+".html";
window.open(kalUrl);
return false;
}

window.onload=init;
function init() {
var linkar=document.getElementById("Metanavigation").getElementsByTagName("a");
	for (var i=0; i< linkar.length; i++) {
		if (linkar[i].href.indexOf("/de")>-1) { if (!BuggyIE)
			if (!document.all)
			linkar[i].setAttribute("onclick","zeigeInhalt(this.href);return false");
			else 
			linkar[i].setAttribute("onclick",function anonymous() {zeigeInhalt(this.href);return false} );
		}
	}
draginit();
}
function draginit() {
 // Initialisierung der Überwachung der Events
  document.onmousemove = drag;
}
function drag(ereignis) {
posx = document.all ? window.event.clientX+document.documentElement.scrollLeft : ereignis.pageX;
posy = document.all ? window.event.clientY+document.documentElement.scrollTop : ereignis.pageY;

//window.status=posx-document.documentElement.scrollLeft;

if(!document.all)
var Fensterbreite=window.innerWidth;
else
//var Fensterbreite=document.body.offsetWidth;
var Fensterbreite=screen.width;

/*var begrenzungx=posx-document.documentElement.scrollLeft;
if (begrenzungx>eval(Fensterbreite-440))
posx=eval(Fensterbreite-540);
*/
/*
var begrenzungx=posx-document.documentElement.scrollLeft;
if (begrenzungx>800)
posx=900;
*/

begrenzungx=posx-document.documentElement.scrollLeft;

begrenzungy=posy-document.documentElement.scrollTop;
//if (begrenzungy<400)
//posy=400;

//posx=posx-document.documentElement.scrollLeft;
//window.status=begrenzungy;
}

var aktBox=null;
var posx;
var posy;
var begrenzungx;
var begrenzungy;
function Hilfetext(klick) {

/*
if (aktBox!=null) {
	aktBox.removeAttribute("style");
	aktBox.removeAttribute("style");
}
*/
var uri=klick.href;
//aktBox=klick.parentNode.parentNode.parentNode;
aktLink=klick;
if (!document.getElementById("ende2")) {
var weglink=document.createElement("a")
weglink.setAttribute("href","javascript:zu2()");
weglink.setAttribute("title","Schließen");
weglink.appendChild(document.createTextNode(" "));
document.body.appendChild(weglink);
weglink.setAttribute("id","ende2");}

	if (!document.getElementById("ifr")) {
	var histCh=document.createElement("div")
	histCh.setAttribute("id","ifr");
	document.body.appendChild(histCh);
	/*
	var historyContainer=document.createElement("div");
	historyContainer.setAttribute("id","container");
	document.body.appendChild(historyContainer); */
	var historyContainerContent=document.createElement("div");
	historyContainerContent.setAttribute("id","containerContent");
	document.getElementById("extradiv3").appendChild(historyContainerContent);
	/*
	var historyView=document.createElement("div");
	historyView.setAttribute("id","content");
//	document.body.appendChild(historyView);
	document.getElementById("container").appendChild(historyView);
	*/
	}
//document.getElementById("extradiv3").style.left=posx + "px";
document.getElementById("extradiv3").style.left="260px";
var postIt=eval(posy-400);
	if (begrenzungy<400)
	postIt+=eval(400-begrenzungy);
document.getElementById("extradiv3").style.top=postIt + "px"; 
	loadContentHelp(uri);
/*
document.getElementById("extradiv2").style.width="350px";
document.getElementById("extradiv2").style.height="290px"; */

/*	aktBox.style.backgroundColor="#F95F0B";
	aktBox.style.color="white"; 
	aktLink.style.color="white";
*/
document.getElementById("extradiv3").className='viewHilfe';
document.getElementById("ende2").style.top=eval(postIt+30) + "px"; 
document.getElementById("ende2").style.left="680px"; 
}

function zeigeInhalt(uri) {
loadContent(uri);
if (!document.getElementById("ende")) {
var weglink=document.createElement("a")
weglink.setAttribute("href","javascript:zu()");
weglink.appendChild(document.createTextNode("Schliessen"));
document.body.appendChild(weglink);
weglink.setAttribute("id","ende");} 
document.getElementById("extradiv2").className='view';
document.getElementById("extradiv2").style.width="712px";
document.getElementById("extradiv2").style.height="300px"; 
}

function zu() {
document.getElementById("extradiv2").style.display='none';
document.getElementById("ende").style.top="7px"; 
document.getElementById("ende").style.left="720px"; 
document.getElementById("ende").style.display='none'; 
document.getElementById("extradiv2").style.left="80px";
document.getElementById("extradiv2").style.top="30px"; 
}
function zu2() {
document.getElementById("extradiv3").style.display='none';
document.getElementById("ende2").style.display='none'; 
}

cloneContent = function() {	
newContent = top.contentLoader.document.getElementById("content").innerHTML;//content;
document.getElementById("extradiv2").innerHTML = newContent;
document.getElementById("extradiv2").style.display='block';
document.getElementById("ende").style.display='block';
}
cloneContent2 = function() {	
newContent = top.contentLoader2.document.getElementById("content").innerHTML;//content;
document.getElementById("containerContent").innerHTML = newContent;
document.getElementById("extradiv3").style.display='block';
document.getElementById("ende2").style.display='block';
}
loadContent = function(url) {
if (!document.getElementById("ifr")) {
var ContView=document.createElement("div")
ContView.setAttribute("id","ifr");
document.body.appendChild(ContView); }
if (!window.contentLoader) {
document.getElementById("ifr").innerHTML = '<iframe id="ifram" name="contentLoader" src="' + url + '" onload="cloneContent();" style="display:none;" width="1" height="1"></iframe>';
} else contentLoader.location.href=url; }

loadContentHelp = function(url) {
if (!document.getElementById("ifr2")) {
var ContView=document.createElement("div")
ContView.setAttribute("id","ifr2");
document.body.appendChild(ContView); }
if (!window.contentLoader2) {
document.getElementById("ifr2").innerHTML = '<iframe id="ifram2" name="contentLoader2" src="' + url + '" onload="cloneContent2();" style="display:none;" width="1" height="1"></iframe>';
} else contentLoader2.location.href=url; }

