nn = ((document.captureEvents) && (!document.getElementById)) ? true : false;

var buttons = new Array();
buttons[0] = "rewindButton";
buttons[1] = "traceButton";
buttons[2] = "stopButton";
buttons[3] = "playButton";
buttons[4] = "forwardButton";

var bigPic    = new Array();
bigPic[0]     = new Image(); bigPic[0].src = "images/liz01.jpg";
bigPic[1]     = new Image(); bigPic[1].src = "images/liz02.jpg";
bigPic[2]     = new Image(); bigPic[2].src = "images/liz03.jpg";
bigPic[3]     = new Image(); bigPic[3].src = "images/liz04.jpg";
bigPic[4]     = new Image(); bigPic[4].src = "images/liz05.jpg";
bigPic[5]     = new Image(); bigPic[5].src = "images/liz06.jpg";
bigPic[6]     = new Image(); bigPic[6].src = "images/liz07.jpg";
bigPic[7]     = new Image(); bigPic[7].src = "images/liz08.jpg";
bigPic[8]     = new Image(); bigPic[8].src = "images/liz09.jpg";
bigPic[9]     = new Image(); bigPic[9].src = "images/liz10.jpg";
bigPic[10]    = new Image(); bigPic[10].src = "images/liz11.jpg";
bigPic[11]    = new Image(); bigPic[11].src = "images/liz12.jpg";
bigPic[12]    = new Image(); bigPic[12].src = "images/liz13.jpg";
bigPic[13]    = new Image(); bigPic[13].src = "images/liz14.jpg";
bigPic[14]    = new Image(); bigPic[14].src = "images/liz15.jpg";
bigPic[15]    = new Image(); bigPic[15].src = "images/liz16.jpg";
bigPic[16]    = new Image(); bigPic[16].src = "images/liz17.jpg";
bigPic[17]    = new Image(); bigPic[17].src = "images/liz18.jpg";

var smallPic  = new Array();
smallPic[0]   = new Image(); smallPic[0].src = "images/liz01.gif";
smallPic[1]   = new Image(); smallPic[1].src = "images/liz02.gif";
smallPic[2]   = new Image(); smallPic[2].src = "images/liz03.gif";
smallPic[3]   = new Image(); smallPic[3].src = "images/liz04.gif";
smallPic[4]   = new Image(); smallPic[4].src = "images/liz05.gif";
smallPic[5]   = new Image(); smallPic[5].src = "images/liz06.gif";
smallPic[6]   = new Image(); smallPic[6].src = "images/liz07.gif";
smallPic[7]   = new Image(); smallPic[7].src = "images/liz08.gif";
smallPic[8]   = new Image(); smallPic[8].src = "images/liz09.gif";
smallPic[9]   = new Image(); smallPic[9].src = "images/liz10.gif";
smallPic[10]  = new Image(); smallPic[10].src = "images/liz11.gif";
smallPic[11]  = new Image(); smallPic[11].src = "images/liz12.gif";
smallPic[12]  = new Image(); smallPic[12].src = "images/liz13.gif";
smallPic[13]  = new Image(); smallPic[13].src = "images/liz14.gif";
smallPic[14]  = new Image(); smallPic[14].src = "images/liz15.gif";
smallPic[15]  = new Image(); smallPic[15].src = "images/liz16.gif";
smallPic[16]  = new Image(); smallPic[16].src = "images/liz17.gif";
smallPic[17]  = new Image(); smallPic[17].src = "images/liz18.gif";


var picCounter = 0;
var fooArrayLength = bigPic.length-1;
var aktiv = false;
var slideStarted = false;
	
function ButtonDown( which ){
	objActiveButton = document.getElementById( which );
	objPicInnerText = document.getElementById( "picInnerText" );
	switch( which ){
		case "stopButton":
			objPicInnerText.innerHTML="<b>SlideShow gestoppt</b>";
			break;
		case "playButton":
			objPicInnerText.innerHTML="<b>SlideShow gestartet</b>";
			break;
		case "traceButton":
			objPicInnerText.innerHTML="<b>SlideShow pausiert</b>";
			break;
		case "rewindButton":
			objPicInnerText.innerHTML="<b>Bild zurück</b>";
			break;
		case "forwardButton":
			objPicInnerText.innerHTML="<b>Bild vor</b>";
			break;
	}
	for( i = 0 ; i < buttons.length ; i++ ){
		objButton = document.getElementById( buttons[i] );
		objButton.style.borderTop    = "1px solid white";
		objButton.style.borderLeft   = "1px solid white";
		objButton.style.borderBottom = "1px solid #404040";
		objButton.style.borderRight  = "1px solid #404040";			
	}
	objActiveButton.style.borderTop    = "1px solid #404040";
	objActiveButton.style.borderLeft   = "1px solid #404040";
	objActiveButton.style.borderBottom = "1px solid white";
	objActiveButton.style.borderRight  = "1px solid white";	
}
function ButtonUp( which ){
	objActiveButton = document.getElementById( which );
	objActiveButton.style.borderTop    = "1px solid white";
	objActiveButton.style.borderLeft   = "1px solid white";
	objActiveButton.style.borderBottom = "1px solid #404040";
	objActiveButton.style.borderRight  = "1px solid #404040";
}
function slidePics(){
	if( slideStarted == false ){
		aktiv = setInterval( "changePicForward('slide')" , 2000 );
		slideStarted = true;	
	}		
}
function clearSlideShow( what ){
	if( aktiv != false ){
		clearInterval(aktiv);
		slideStarted = false;
	}
	if(what == "stop"){		
		setPicStyleDefault();
		picCounter=-1;
		changePicForward( "forward" );
	}
}
function changePicForward( what ){	
	setPicStyleDefault();
	picCounter++;
	if( what == "slide" ){				
		if( picCounter == bigPic.length )picCounter=0;
	}
	else clearSlideShow(); 
	if( picCounter == bigPic.length ){
		document.PicChange.src = bigPic[fooArrayLength].src;
		objSmallPic = document.getElementById( "lizPic"+(fooArrayLength) );
		picCounter = fooArrayLength;
	}
	else{
		document.PicChange.src = bigPic[picCounter].src;
		objSmallPic = document.getElementById( "lizPic"+(picCounter) );
	} 	
	changeBorderStyle();
}
function setPicStyleDefault(){
	if( picCounter >= 0 ){
		for( j = 0 ; j <= fooArrayLength ; j++ ){
			objSmallPic = document.getElementById( "lizPic"+j );
			objSmallPic.style.borderTop    = "2px solid #808080";
			objSmallPic.style.borderLeft   = "2px solid #808080";
			objSmallPic.style.borderBottom = "2px solid white";
			objSmallPic.style.borderRight  = "2px solid white";
		}			
	}
}
function changePic( where ){
	setPicStyleDefault();	
	if( where == "forward" && picCounter < bigPic.length ) changePicForward( "move" );
	else if( where == "rewind" && picCounter >= 0 ){	
		picCounter--;
		clearSlideShow();		
		if( picCounter <= 0 ){
			document.PicChange.src = bigPic[fooArrayLength].src;			
			picCounter = 0;
		}
		else{
			document.PicChange.src = bigPic[picCounter].src;
			objSmallPic = document.getElementById( "lizPic"+(picCounter) );
		} 			
		objSmallPic = document.getElementById( "lizPic"+picCounter );			
		changeBorderStyle();
		document.PicChange.src = bigPic[picCounter].src;			
	}
	else{
		clearSlideShow();
		ButtonUp( "playButton" );
		ButtonUp( "traceButton" );
		document.PicChange.src = bigPic[where].src;
		objSmallPic = document.getElementById( "lizPic"+(where) );
		changeBorderStyle();
		picCounter = where;
	}
}
function changeBorderStyle(){	
	objSmallPic.style.borderTop    = "2px solid #FDF46A";
	objSmallPic.style.borderLeft   = "2px solid #FDF46A";
	objSmallPic.style.borderBottom = "2px solid #FDF46A";
	objSmallPic.style.borderRight  = "2px solid #FDF46A";
}
//ende javascript für galerie

function makePos(){	
	objBodyBox = document.getElementById( "BodyBox" );	
	if( document.all ){
		intWinWidth = document.body.offsetWidth;
		intWinHeight = document.body.offsetHeight;				
	} 		
	else{		
		 intWinWidth = window.innerWidth;
		 intWinHeight = window.innerHeight;
	}	
	if( intWinWidth < 773 ){				
		objBodyBox.style.marginLeft = "0px";		
		objBodyBox.style.left = "0px";		
	}
	else{
		objBodyBox.style.marginLeft = "-384px";		
		objBodyBox.style.left = "50%";
		
	}
	if( intWinHeight < 586 ){			
		objBodyBox.style.marginTop = "0px";
		objBodyBox.style.top = "0px";
	}
	else{
		objBodyBox.style.marginTop = "-296px";
		objBodyBox.style.top = "50%";
	}
	
}
function makeVisible( which ){
	objSpeiseLink = document.getElementById("SpeiseLink");
	objGetraenkeLink = document.getElementById("GetraenkeLink");
	objLinkVisible = document.getElementById(which);
	objSpeiseLink.style.display = "none";
	objGetraenkeLink.style.display = "none";
	objLinkVisible.style.display = "block";
	
	objLink2_1 = document.getElementById("link_2_1");
	objLink2_2 = document.getElementById("link_2_2");
	objLink3_1 = document.getElementById("link_3_1");
	objLink3_2 = document.getElementById("link_3_2"); 
	objLink2_1.style.backgroundColor = "none";
	objLink2_2.style.backgroundColor = "none";
	objLink3_1.style.backgroundColor = "none";
	objLink3_2.style.backgroundColor = "none";
	objLink2_1.style.color = "white";
	objLink2_2.style.color = "white";
	objLink3_1.style.color = "white";
	objLink3_2.style.color = "white";
}
function makeHidden(){
	objSpeiseLink = document.getElementById("SpeiseLink");
	objGetraenkeLink = document.getElementById("GetraenkeLink");	
	objSpeiseLink.style.display = "none";
	objGetraenkeLink.style.display = "none";	
}
function makeHighlight( which ){
	objLink2_1 = document.getElementById("link_2_1");
	objLink2_2 = document.getElementById("link_2_2");
	objLink3_1 = document.getElementById("link_3_1");
	objLink3_2 = document.getElementById("link_3_2");	
	objLinkHighlight = document.getElementById(which);
	objLink2_1.style.backgroundColor = "#none";
	objLink2_2.style.backgroundColor = "#none";
	objLink3_1.style.backgroundColor = "#none";
	objLink3_2.style.backgroundColor = "#none";
	objLink2_1.style.color = "white";
	objLink2_2.style.color = "white";
	objLink3_1.style.color = "white";
	objLink3_2.style.color = "white";	
	objLinkHighlight.style.backgroundColor = "#none";/*"white";*/
	objLinkHighlight.style.color = "black";
}

function hidePopUp(){	
	objPopUp = document.getElementById("popUp");	
	objPopUp.style.display = "none";
}
function makePopUp(){	
	objPopUp = document.getElementById("popUp");	
	objPopUp.style.zIndex = "2";	
}
