/*
this method opens a pop-up window
-> method call: 
   <a href="JavaScript:NewWindow('url','Example name',width,height,xpos,ypos)">Link</a>
-> example for method call: 
   <a href="JavaScript:NewWindow('/imprint.html','Imprint',450,610,150,10)">[Imprint]</a>
*/
var isNav4, isNav6, isIE4;
function NewWindow(FileURL,WindowName,WindowWidth,WindowHeight,XPos,YPos) {
	if (isNav6) {
		fWindowWidth = WindowWidth +  8; fWindowHeight = WindowHeight + 27;
	} else if (isNav4) {
		fWindowWidth = WindowWidth + 15; fWindowHeight = WindowHeight + 15;
	} else {
		fWindowWidth = WindowWidth + 12; fWindowHeight = WindowHeight + 31;
	}
	Fenster = window.open(FileURL,WindowName,'width='+fWindowWidth+',height='+fWindowHeight+',screenX='+XPos+',screenY='+YPos+',dependent=yes,scrollbars=auto,resizable=yes');
	Fenster.moveTo(XPos,YPos);
	Fenster.resizeTo(fWindowWidth,fWindowHeight);
}

/*this method changes the style of an active menu point (dynarch)*/
function activatemenu(inputstring) {
	var inner_old = document.getElementById('mainmenu').innerHTML;
	var inner_new = inner_old.replace(inputstring,'<span class=currentmain>'+inputstring+'</span>');
	document.getElementById('mainmenu').innerHTML = inner_new;
}


/*Browser detectiob*/
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


var startwhen=0;

function initSlider() {
	/***************************************************************************************
	Copyright (C) 2001 ab_ditto
	This script is made by and copyrighted to ab_ditto at back.to/ab or ab_ditto@hotmail.com
	This may be used freely as long as this msg is intact!
	date:2001-09-30
	***************************************************************************************/
	//*****parameters to set*****
	//into this array insert the paths of your pics.
	//if there are only 2 images, set them two times i.e. 1/2/1/2
	imges=new Array (
	'images/slideshow/kranzbach_03.jpg',
	'images/slideshow/kranzbach_04.jpg', 
	'images/slideshow/kranzbach_05.jpg', 
	'images/slideshow/kranzbach_13.jpg',
	'images/slideshow/kranzbach_14.jpg', 
	'images/slideshow/kranzbach_06.jpg', 
	'images/slideshow/kranzbach_07.jpg', 
	'images/slideshow/kranzbach_08.jpg', 
	'images/slideshow/kranzbach_09.jpg', 
	'images/slideshow/kranzbach_10.jpg',
	'images/slideshow/kranzbach_11.jpg',
	'images/slideshow/kranzbach_12.jpg'
	);
	
	//set this to the left position of your pics to be shown on the page
	
	if (BrowserDetect.browser=="Explorer") {
		var bodywidth = document.body.offsetWidth;
	} else {
		var bodywidth = window.innerWidth;
	}
		
	var picleft = (bodywidth-979)/2+300;

	pictop=148; //set thid to the top position of your pics to be shown on the page
	picwid=679; //set this to the width of your widest pic
	pichei=387; //... and this to the height of your highest pic
	backgr="#CFE1CC"; //set this to the background color you want to use for the slide-area
	//(for example the body-background-color) if your pics are of different size
	sdur=3; //time to show a pic between fades in seconds
	fdur=1; //duration of the complete fade in seconds
	steps=30; //steps to fade from on pic to the next
	// "startwhen" leave it at "null" to start the function by calling it from your page by link
	// or set it to 1 to start the slide automatically as soon as the images are loaded
	//*****nothing more to do, have fun :)
	//**************************************************************************************
	ftim=fdur*1000/steps;stim=sdur*1000;emax=imges.length;
	for(e = 1; e <= emax; e++) {
		theid="img"+e;thesrc=imges[e-1];
		document.write("<div id='"+theid+"'><img src='"+thesrc+"' border='0'></img></div>");
		}
	document.write("<style type='text/css'>");
	for(b = 1; b <= emax; b++) {
		thestylid="img"+b;thez=1;thevis='hidden';
		if(b<=1) {thez=2; thevis='visible';}
		document.write("#"+thestylid+" {position:absolute; left:"+picleft+"px; top:"+pictop+"px; width:"+picwid+"px; height:"+pichei+"px; background-color:"+backgr+"; layer-background-color:"+backgr+"; visibility:"+thevis+"; z-index:"+thez+";}");
		}
	document.write("</style>");
	
}

function myfade() {
	parr = new Array();
	for(a = 1; a <= emax; a++) {
		idakt="img"+a;paktidakt=document.getElementById(idakt);
    ie5exep=new Array(paktidakt);parr=parr.concat(ie5exep);}
		i=1;u=0;slide (i);
		}
function slide(numa){
	ptofade = parr[numa-1];
	if(numa<=emax){pnext=parr[numa];}
	if(numa==emax){pnext=parr[0];}
	pnext.style.visibility = "visible";
	pnext.style.filter = "Alpha(Opacity=100)";
	pnext.style.MozOpacity = 1;
	ptofade.style.filter = "Alpha(Opacity=100)";
	ptofade.style.MozOpacity = 1;
	factor = 100/steps;
	slidenow();
	}
function slidenow(){
	check1=ptofade.style.MozOpacity;
	maxalpha = (100 - factor*u)/100*105;
	if(check1<=maxalpha/100){u=u+1;}
	curralpha = 100 - factor*u;
	ptofade.style.filter = "Alpha(Opacity="+curralpha+")";
	ptofade.style.MozOpacity = curralpha/100;
	if(u<steps){window.setTimeout("slidenow()",ftim);}
	if(u>=steps && i<emax){
		ptofade.style.visibility = "hidden";
		ptofade.style.zIndex = 1;
		pnext.style.zIndex = 2;
		i=i+1;u=0;
		window.setTimeout("slide(i)",stim);}
	if(u>=steps && i>=emax){
		ptofade.style.visibility = "hidden";
		ptofade.style.zIndex = 1;
		pnext.style.zIndex = 2;
		i=1;u=0;
		window.setTimeout("slide(i)",stim);}
	}
function dostart(){window.setTimeout("myfade()",stim);}
if(startwhen){onload=dostart; alert(startwhen); }


/*Slide layer function:
method call: <body onload="init();slideDown()" bgcolor="black">
*/
function moveTo(obj, x, y) {
	if (document.getElementById) {
	document.getElementById('menuDiv').style.left = x;
	document.getElementById('menuDiv').style.top = y;
	}
}

function init(){
	if(document.getElementById){
	obj = document.getElementById("menuDiv");
	obj.style.top = "-250px";
	}
}

function slideDown(){
	if(document.getElementById){
		if(parseInt(obj.style.top) < 0){
			obj.style.top = parseInt(obj.style.top) + 10 + "px";
			setTimeout("slideDown()",50);
		}
	}
}

function slideUp(){
	if(document.getElementById){
		if(parseInt(obj.style.top) > -250){
			obj.style.top = parseInt(obj.style.top) - 10 + "px";
			setTimeout("slideUp()",50);
		}
	}
}