/*
 * 	Bildergalerie animation by rouven
 * rekursion! Alles nach dem funktionsaufruf wird gespeichert und für ende der funktionausführung aufgehoben, daher keine rukursion,
 * sondern pro animation eine funktion!
*/


function animiere_galerie_mit_stopp($animation, $richtung) {
	
	if ($animation<300 && $richtung=='rechts')
	{
		$animation=$animation+1;
	}
	
	if ($animation<530 && $richtung=='rechts')
	{
		$animation=$animation+2;
	} 

	
	if ($animation<562 && $richtung=='rechts')
	{
		$animation=$animation+1;
		document.getElementById('galerie_bilder').style.marginLeft='-' + $animation + 'px';
		window.setTimeout("animiere_galerie_mit_stopp(" + $animation + ", 'rechts')", 1);
	}else{

	if ($animation==562 && $richtung=='rechts')
	{
		window.setTimeout("animiere_galerie_mit_stopp_2(562, 'rechts_2')", 7000);
	}
	}
}


function animiere_galerie_mit_stopp_2($animation, $richtung) {
	if ($animation<864 && $richtung=='rechts_2')
	{
		$animation=$animation+1;
	}	
	
	if ($animation<1094 && $richtung=='rechts_2')
	{
		$animation=$animation+2;
	}

	if ($animation<1124 && $richtung=='rechts_2')
	{
		$animation=$animation+1;
		document.getElementById('galerie_bilder').style.marginLeft='-' + $animation + 'px';
		window.setTimeout("animiere_galerie_mit_stopp_2(" + $animation + ", 'rechts_2')", 1);
	}else{
	
	if ($animation==1124 && $richtung=='rechts_2')
	{
		window.setTimeout("animiere_galerie_mit_stopp_links(1124, 'links')", 7000);
	}
	}
}



























function animiere_galerie_mit_stopp_links($animation, $richtung) {
	

	if ($animation>792 && $richtung=='links')
	{
		$animation=$animation-1;
	}	
	
	if ($animation>592 && $richtung=='links')
	{
		$animation=$animation-2;
	}	

	if ($animation>562 && $richtung=='links')
	{
		$animation=$animation-1;
		document.getElementById('galerie_bilder').style.marginLeft='-' + $animation + 'px';
		window.setTimeout("animiere_galerie_mit_stopp_links(" + $animation + ", 'links')", 1);
	}else{

	if ($animation==562 && $richtung=='links')
	{
		window.setTimeout("animiere_galerie_mit_stopp_links_2(562, 'links_2')", 7000);
	}
	}
}

function animiere_galerie_mit_stopp_links_2($animation, $richtung) {
	if ($animation>300 && $richtung=='links_2')
	{
		$animation=$animation-1;
	}	
	
	if ($animation>30 && $richtung=='links_2')
	{
		$animation=$animation-2;
	}

	if ($animation>0 && $richtung=='links_2')
	{
		$animation=$animation-1;
		if ($animation==0)
		{
			document.getElementById('galerie_bilder').style.marginLeft='0px';
		}else
		{
			document.getElementById('galerie_bilder').style.marginLeft='-' + $animation + 'px';
		}
		window.setTimeout("animiere_galerie_mit_stopp_links_2(" + $animation + ", 'links_2')", 1);
	}else{

	if ($animation==0 && $richtung=='links_2')
	{
		window.setTimeout("animiere_galerie_mit_stopp(0, 'rechts')", 7000);
	}	
	}
			
}










/*
 * 	DIV-Tag lader by rouven
*/

function link_zu(html_href) {
//wird von javascriptlinks genutzt
 //http://www.comspirit.com/medienwerkstatt/broschuere-fiege.htm  zu  divs/broschuere-fiege.htm aufbereiten
  var nur_datei=html_href.lastIndexOf("/");
  var ende=nur_datei + 1;
  nur_datei = 'divs/' + html_href.substr(ende);
  
  fenster(nur_datei, 'ohne_blenden');
}


function weiter_over() {
  //wird in der grafik-map ausgeführt, macht den mausover künstlich für den pfeil nach rechts
  if (document.all.vor.style.backgroundImage != "url(pics/popup_pfeil_rechts_over.gif)")
  {
    document.all.vor.style.backgroundImage = "url(pics/popup_pfeil_rechts_over.gif)";
    
  }
}
function zurueck_over() {
  //wird in der grafik-map ausgeführt, macht den mausover künstlich für den pfeil nach rechts
  document.all.zurueck.style.backgroundImage = "url(pics/popup_pfeil_links_over.gif)";
}

function over_weg() {
  //wird in der grafik-map ausgeführt, macht den mausover künstlich für den pfeil nach rechts
  if (document.all.zurueck) {document.all.zurueck.style.backgroundImage = "url(pics/popup_pfeil_links.gif)";}
  if (document.all.vor) {document.all.vor.style.backgroundImage = "url(pics/popup_pfeil_rechts.gif)";}
}


function getScrollXY() {  
	var scrOfX = 0, scrOfY = 0;  
	if( typeof( window.pageYOffset ) == 'number' ) {  
	//Netscape compliant  
	scrOfY = window.pageYOffset;  
	scrOfX = window.pageXOffset;  
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {  
	//DOM compliant  
	scrOfY = document.body.scrollTop;  
	scrOfX = document.body.scrollLeft;  
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {  
	//IE6 standards compliant mode  
	scrOfY = document.documentElement.scrollTop;  
	scrOfX = document.documentElement.scrollLeft;  
	}  
 	return [ scrOfX, scrOfY ];  
} 



function pageScroll () {
	
    	if (getScrollXY()[1]>10) {window.scrollBy(0,-5);}  
    	if (getScrollXY()[0]>10) {window.scrollBy(-5,0);} 
	
    	if (getScrollXY()[1]>5) {window.scrollBy(0,-5);}  
    	if (getScrollXY()[0]>5) {window.scrollBy(-5,0);} 		
		
    	if (getScrollXY()[1]>0) {window.scrollBy(0,-1);}  
    	if (getScrollXY()[0]>0) {window.scrollBy(-1,0);} 	
		
		if (getScrollXY()[1]>0 || getScrollXY()[0]>0) 
		{
    		scrolldelay = setTimeout('pageScroll()',0.3); 
		}
}




function fenster_schliessen() {
 	ausblenden(1);
}

function fenster(src, $wie) {

  //if (document.getElementById('geruest').style.zIndex!=2)
  //{
  	document.getElementById('div_fenster').style.visibility='visible'; // für alle
   	//document.getElementById('div_fenster').style.display='table'; das mag der alte ie nicht
   	document.getElementById('geruest').style.zIndex=1;	 //für safari und chrome
   	document.getElementById('div_fenster').style.zIndex=2;	//für safari und chrome
   	


  //}
	
	document.all.div_fenster.style.height=document.all.geruest.scrollHeight;
  pageScroll();
	 
http_request = false;
if (window.XMLHttpRequest) {
   http_request = new XMLHttpRequest();
   if (http_request.overrideMimeType) {
      http_request.overrideMimeType('text/xml');
   }
    } else if (window.ActiveXObject) { // IE
    try {
       http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
       http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
    }
    }
   if (!http_request) {
       alert('Das Request Objekt konnte nicht erzeugt werden! Bitte ueberpruefen Sie Ihre JAVA Einstellungen!');
        return false;
    }
   
   http_request.onreadystatechange = show;
   http_request.open('GET', src, true);

   http_request.send(null);
 	 


	if ($wie=="mit_blenden")
	{
		einblenden(0, "alles");
	}
   
}








function einblenden($transparenz, $was) 
{	
	if ($was=="alles")
	{
		
		if (window.ActiveXObject) { // IE
		document.getElementById('div_inhalt').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('div_inhalt').style.MozOpacity = $transparenz;	
		document.getElementById('div_inhalt').style.KhtmlOpacity = $transparenz;	
		document.getElementById('div_inhalt').style.opacity = $transparenz;
	
		document.getElementById('fenster_ml').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('fenster_ml').style.MozOpacity = $transparenz;	
		document.getElementById('fenster_ml').style.KhtmlOpacity = $transparenz;	
		document.getElementById('fenster_ml').style.opacity = $transparenz;
		
		document.getElementById('fenster_mr').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('fenster_mr').style.MozOpacity = $transparenz;	
		document.getElementById('fenster_mr').style.KhtmlOpacity = $transparenz;	
		document.getElementById('fenster_mr').style.opacity = $transparenz;	
		
		document.getElementById('fenster_u').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('fenster_u').style.MozOpacity = $transparenz;	
		document.getElementById('fenster_u').style.KhtmlOpacity = $transparenz;	
		document.getElementById('fenster_u').style.opacity = $transparenz;
		}else{
			document.getElementById('div_inhalt').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
			document.getElementById('div_inhalt').style.MozOpacity = $transparenz;	
			document.getElementById('div_inhalt').style.KhtmlOpacity = $transparenz;	
			document.getElementById('div_inhalt').style.opacity = $transparenz;	
		}
		
		if ($transparenz<0.7)
		{
			$transparenz=$transparenz+0.1;
			window.setTimeout("einblenden(" + $transparenz + ", 'alles')", 10);
		}else
		{
			$transparenz=$transparenz+0.1;
			window.setTimeout("einblenden(" + $transparenz + ", 'nur_inhalt')", 10);
		}	
	}else{

	if ($was=="nur_inhalt")
	{
		document.getElementById('div_inhalt').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('div_inhalt').style.MozOpacity = $transparenz;	
		document.getElementById('div_inhalt').style.KhtmlOpacity = $transparenz;	
		document.getElementById('div_inhalt').style.opacity = $transparenz;

		if ($transparenz<1.1)
		{
			$transparenz=$transparenz+0.1;
			window.setTimeout("einblenden(" + $transparenz + ", 'nur_inhalt')", 5);
		}	
	}
	}
}



function ausblenden($transparenz, $was) 
{	

		if (window.ActiveXObject) { // IE
		document.getElementById('div_inhalt').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('div_inhalt').style.MozOpacity = $transparenz;	
		document.getElementById('div_inhalt').style.KhtmlOpacity = $transparenz;	
		document.getElementById('div_inhalt').style.opacity = $transparenz;
	
		document.getElementById('fenster_ml').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('fenster_ml').style.MozOpacity = $transparenz;	
		document.getElementById('fenster_ml').style.KhtmlOpacity = $transparenz;	
		document.getElementById('fenster_ml').style.opacity = $transparenz;
		
		document.getElementById('fenster_mr').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('fenster_mr').style.MozOpacity = $transparenz;	
		document.getElementById('fenster_mr').style.KhtmlOpacity = $transparenz;	
		document.getElementById('fenster_mr').style.opacity = $transparenz;	
		
		document.getElementById('fenster_u').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
		document.getElementById('fenster_u').style.MozOpacity = $transparenz;	
		document.getElementById('fenster_u').style.KhtmlOpacity = $transparenz;	
		document.getElementById('fenster_u').style.opacity = $transparenz;
		}else{
			document.getElementById('div_inhalt').style.filter = "alpha(opacity=" + ($transparenz*100) + ")";
			document.getElementById('div_inhalt').style.MozOpacity = $transparenz;	
			document.getElementById('div_inhalt').style.KhtmlOpacity = $transparenz;	
			document.getElementById('div_inhalt').style.opacity = $transparenz;	
		}
		
		if ($transparenz>-0.1)
		{
			$transparenz=$transparenz-0.1;
			window.setTimeout("ausblenden(" + $transparenz + ")", 1);
		}else{
	
	
			document.getElementById('div_fenster').style.visibility='hidden'; // für alle
			document.getElementById('geruest').style.zIndex=2;	//für safari und chrome
			document.getElementById('div_fenster').style.zIndex=1;	 //für safari und chrome
			//document.getElementById('div_fenster').style.display='none'; das mag der alte ie nicht	
		}

	
}










function show() {
if (http_request.readyState == 4) {
	  //document.all.div_inhalt.innerHTML = http_request.responseText;
      document.getElementById("div_inhalt").innerHTML = http_request.responseText;
 	 
	 
}
}

