<!--

IE = document.all&&!window.opera; 
DOM = document.getElementById&&!IE; 


//create onDomReady Event
      window.onDomReady = initReady;
 
      // Initialize event depending on browser
      function initReady(fn)
      {
      	//W3C-compliant browser
      	if(document.addEventListener) {
          document.addEventListener("DOMContentLoaded", fn, false);
        }
      	//IE
      	else {
          document.onreadystatechange = function(){readyState(fn)}
        }
      }
 
      //IE execute function
      function readyState(func)
      {
      	// DOM is ready
      	if(document.readyState == "interactive" || document.readyState == "complete")
      	{
      		func();
      	}
      }
window.onscroll = javaktiv;
function javaktiv()
{
 positionieren(getScrollXY());
}


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 [scrOfY]; 
}

function galstart(bild)
{
	var h = bild.split(",");
	var nName = document.getElementById(h[3]).name;
	var anzahl = document.getElementsByName(nName).length;
	var onmouse = document.getElementById(h[3]).onmouseup;
	var text = "";

	if(anzahl == 1)
	{
		gal(bild+",nur");
	}
	else
	{
		for(x=0;x<anzahl;x++)
		{
			var text = text+document.getElementsByName(nName)[x].src+"\n";
			if(onmouse == document.getElementsByName(nName)[x].onmouseup)
			{
				var ztext = "Bild "+(parseInt(x)+1)+"/"+anzahl;
				if(x+1 >= anzahl)
				{
					document.getElementById("weiter").onmouseup = document.getElementsByName(nName)[0].onmouseup;
					document.getElementById("zurueck").onmouseup = document.getElementsByName(nName)[x-1].onmouseup;
					break;

				}
				else
				{
					if(x != "0")
					{
						document.getElementById("weiter").onmouseup = document.getElementsByName(nName)[x+1].onmouseup;
						document.getElementById("zurueck").onmouseup = document.getElementsByName(nName)[x-1].onmouseup;
						break;
					}
					else
					{
						document.getElementById("weiter").onmouseup = document.getElementsByName(nName)[x+1].onmouseup;
						document.getElementById("zurueck").onmouseup = document.getElementsByName(nName)[anzahl-1].onmouseup;
						break;
					}
				}
			}
			else
			{
			}
		}
		gal(bild+",gal");
	}
}
function positionieren(y)
{
	if(document.getElementById("gal").style.display == "block")
	{
		document.getElementById("gal").style.top = y+"px";
	}
}
function gal(bild)
{

	try
	{
		window.clearTimeout(timerfadean);
	}
	catch(err)
	{

 	}
	document.getElementById("load").style.display = "block";
	var top = getScrollXY();
	var kleinerum = parseInt("160");
	var h = bild.split(",");
		var ganzebreite = getWindowWidth();
		if(ganzebreite >= document.body.offsetWidth)
		{
			var ganzebreite = document.body.offsetWidth;
		}
	
		var ganzehoehe = getWindowHeight();
		if(ganzehoehe <= document.body.offsetHeight)
		{
			var ganzehoehe = document.body.offsetHeight;
		}
		document.getElementById("innenimg").style.display = "none";
		document.getElementById("innenimg").src = "bg/gal.png";
		pic = new Image();
		pic.src = h[0];

		if(document.getElementById("gal").style.display == "block")
		{
			document.getElementById("gal").style.top = top+"px";
			document.getElementById("gal").style.left = "0px";
			document.getElementById("gal").style.width = ganzebreite+"px";
			document.getElementById("gal").style.height = ganzehoehe +"px";
			document.getElementById("innen").style.top = "50px";
		
			wachsenh(document.getElementById("innen").style.height+","+(parseInt(h[2])+parseInt(20))+";"+document.getElementById("innen").style.width+","+(parseInt(h[1])+parseInt(20)));
		}
		else
		{
			document.getElementById("gal").style.display = "block";
			document.getElementById("gal").style.top = top+"px";
			document.getElementById("gal").style.left = "0px";
			document.getElementById("gal").style.width = ganzebreite+"px";
			document.getElementById("gal").style.height = ganzehoehe +"px";
			document.getElementById("innen").style.top = "50px";
			if(kleinerum > h[2])
			{
				var kleinerum = h[2]/2;
			}
			var ii = parseInt(h[2])-kleinerum;
			document.getElementById("innen").style.height = ii+"px";
			if(kleinerum > h[1])
			{
				var kleinerum = h[1]/2;
			}
			var ii = parseInt(h[1])-kleinerum;
			document.getElementById("innen").style.width = ii+"px";
			document.getElementById("load").style.width = ii+"px";
			document.getElementById("mitte").style.width = (parseInt(ii)-20)+"px";
			document.getElementById("loadpic").style.left = ((parseInt(ii)/2)-93)+"px";
			wachsenh(document.getElementById("innen").style.height+","+(parseInt(h[2])+parseInt(20))+";"+document.getElementById("innen").style.width+","+(parseInt(h[1])+parseInt(20)));
		}
	if(h[4] == "nur")
	{
		document.getElementById("zurueck").style.display = "none";
		document.getElementById("weiter").style.display = "none";
		if(IE)
		{
			document.getElementById("schliessen").style.filter = "alpha(opacity=50)";
			document.getElementById("loadpic").style.filter = "alpha(opacity=50)";
		}
		if(DOM && !window.opera)
		{
			document.getElementById("schliessen").style.MozOpacity = 0.50;
			document.getElementById("loadpic").style.MozOpacity = 0.50;
		}

	}
	else
	{
		if(IE)
		{
			document.getElementById("zurueck").style.filter = "alpha(opacity=50)";
			document.getElementById("weiter").style.filter = "alpha(opacity=50)";
			document.getElementById("schliessen").style.filter = "alpha(opacity=50)";
			document.getElementById("loadpic").style.filter = "alpha(opacity=50)";
		}
		if(DOM && !window.opera)
		{
			document.getElementById("zurueck").style.MozOpacity = 0.50;
			document.getElementById("weiter").style.MozOpacity = 0.50;
			document.getElementById("schliessen").style.MozOpacity = 0.50;
			document.getElementById("loadpic").style.MozOpacity = 0.50;
		}
		document.getElementById("zurueck").style.display = "block";
		document.getElementById("weiter").style.display = "block";

	}
}
function wachsenh(bild)
{
	var x = bild.split(";");
	var h = x[0].split(",");
	var vonh = parseInt(h[0]);
	var aufh = parseInt(h[1]);

	if(vonh > aufh)
	{
		schrumpfh(bild);
	}
	else
	{
		var neuh = parseInt(vonh)+parseInt(8);
		if( neuh >= aufh)
		{
			document.getElementById("innen").style.height = aufh+"px";
			document.getElementById("mitte").style.height = aufh+"px";
			document.getElementById("ml").style.height = (parseInt(aufh)-20)+"px";
			document.getElementById("mr").style.height = (parseInt(aufh)-20)+"px";
			document.getElementById("load").style.top = (parseInt(aufh)/2)-13+"px";
			window.clearTimeout(timerh );
			wachsenb(x[1]);
		}
		else
		{
			document.getElementById("innen").style.height = neuh +"px";
			document.getElementById("mitte").style.height = neuh +"px";
			document.getElementById("ml").style.height = (parseInt(neuh )-20)+"px";
			document.getElementById("mr").style.height = (parseInt(neuh )-20)+"px";
			document.getElementById("load").style.top = (parseInt(neuh)/2)-13+"px";
			timerh = window.setTimeout("wachsenh('"+neuh+","+h[1]+";"+x[1]+"')", 1);
		}
	}
}
function schrumpfh(bild)
{
	var x = bild.split(";");
	var h = x[0].split(",");
	var vonh = h[0];
	var aufh = h[1];
	var neuh = parseInt(vonh)-parseInt(8);
	if( neuh <= aufh)
	{
		document.getElementById("innen").style.height = aufh+"px";
		document.getElementById("mitte").style.height = aufh+"px";
		document.getElementById("ml").style.height = (parseInt(aufh)-20)+"px";
		document.getElementById("mr").style.height = (parseInt(aufh)-20)+"px";
		document.getElementById("load").style.top = (parseInt(aufh)/2)-13+"px";
		window.clearTimeout(timerh);
		wachsenb(x[1]);
	}
	else
	{
		document.getElementById("innen").style.height = neuh +"px";
		document.getElementById("mitte").style.height = neuh +"px";
		document.getElementById("ml").style.height = (parseInt(neuh )-20)+"px";
		document.getElementById("mr").style.height = (parseInt(neuh )-20)+"px";
			document.getElementById("load").style.top = (parseInt(neuh)/2)-13+"px";
		timerh = window.setTimeout("schrumpfh('"+neuh+","+h[1]+";"+x[1]+"')", 1);
	}
}

function wachsenb(bild)
{
	var h = bild.split(",");
	var vonb = parseInt(h[0]);
	var aufb = parseInt(h[1]);

	if(vonb > aufb)
	{
		schrumpfb(bild);
	}
	else
	{
		var neub = parseInt(vonb)+parseInt(8);
		if(neub >= aufb)
		{
			document.getElementById("innen").style.width = aufb+"px";
			document.getElementById("mitte").style.width = (parseInt(aufb)-20)+"px";
			document.getElementById("load").style.width = aufb+"px";
			document.getElementById("loadpic").style.left = ((parseInt(aufb)/2)-93)+"px";
			window.clearTimeout(timerb);
			fertig();
		}
		else
		{
			document.getElementById("innen").style.width = neub+"px";
			document.getElementById("mitte").style.width = (parseInt(neub)-20)+"px";
			document.getElementById("load").style.width = neub+"px";
			document.getElementById("loadpic").style.left = ((parseInt(neub)/2)-93)+"px";
			timerb = window.setTimeout("wachsenb('"+neub+","+h[1]+"')", 1);
		}
	}
}
function schrumpfb(bild)
{
	var h = bild.split(",");
	var vonb = parseInt(h[0]);
	var aufb = parseInt(h[1]);
	var neub = parseInt(vonb)-parseInt(8);
	if(neub <= aufb)
	{
			document.getElementById("innen").style.width = aufb+"px";
			document.getElementById("mitte").style.width = (parseInt(aufb)-20)+"px";
			document.getElementById("load").style.width = aufb+"px";
			document.getElementById("loadpic").style.left = ((parseInt(aufb)/2)-93)+"px";
			window.clearTimeout(timerb);
			fertig();
	}
	else
	{
			document.getElementById("innen").style.width = neub+"px";
			document.getElementById("mitte").style.width = (parseInt(neub)-20)+"px";
			document.getElementById("load").style.width = neub+"px";
			document.getElementById("loadpic").style.left = ((parseInt(neub)/2)-93)+"px";
			timerb = window.setTimeout("schrumpfb('"+neub+","+h[1]+"')", 1);
	}

}
function fertig()
{
	if(pic.complete)
	{
		try
		{
			window.clearTimeout(fertigtim);
		}
		catch(err)
		{
	
 		}
		document.getElementById("innenimg").src = pic.src;
		bildfadean("5");
	}
	else
	{
		fertigtim = window.setTimeout("fertig()",100);
	}
}
function bildfadean(bild)
{
	document.getElementById("load").style.display = "none";
	if(bild >= 100)
	{
		document.getElementById("innenimg").style.display = "block";
		if(IE)
		{
			document.getElementById("innenimg").style.filter = "alpha(opacity=100)";
		}
		if(DOM && !window.opera)
		{
			document.getElementById("innenimg").style.MozOpacity = 1.00;
		}
		window.clearTimeout(timerfadean);
	}
	else
	{
		document.getElementById("innenimg").style.display = "block";

		if(IE)
		{
			document.getElementById("innenimg").style.filter = "alpha(opacity="+bild+")";
		}
		if(DOM && !window.opera)
		{
			var ii = parseInt(bild)/100;
			document.getElementById("innenimg").style.MozOpacity = ii;
		}
		var neuerfade = parseInt(bild)+5;
		timerfadean = window.setTimeout("bildfadean('"+neuerfade+"')", 1);
	}
	

}
function bildfadeaus(bild)
{

	window.clearTimeout(timerfadean);
	var h = bild.split(",");
	document.getElementById("load").style.display = "none";
	if(h[0] <= 0)
	{
		document.getElementById("innenimg").style.display = "block";
		if(IE)
		{
			document.getElementById("innenimg").style.filter = "alpha(opacity=0)";
		}
		if(DOM && !window.opera)
		{
			document.getElementById("innenimg").style.MozOpacity = 0.00;
		}
		if(h[1] == "ende")
		{
			galende();
		}
		window.clearTimeout(timerfadeaus);
	}
	else
	{
		document.getElementById("innenimg").style.display = "block";

		if(IE)
		{
			document.getElementById("innenimg").style.filter = "alpha(opacity="+h[0]+")";
		}
		if(DOM && !window.opera)
		{
			var ii = parseInt(h[0])/100;
			document.getElementById("innenimg").style.MozOpacity = ii;
		}
		var neuerfade = parseInt(h[0])-5;
		if(h[1] == "ende")
		{
			timerfadeaus = window.setTimeout("bildfadeaus('"+neuerfade+",ende')", 1);
		}
		else
		{
			timerfadeaus = window.setTimeout("bildfadeaus('"+neuerfade+"')", 1);
		}
	}
	

}

function galende()
{
	try
	{
		document.getElementById("gal").style.display = "none";
		window.clearTimeout(timerb);
		window.clearTimeout(timerh);
		window.clearTimeout(timerfadean);
	}
	catch(err)
	{

	}
}
function getWindowHeight(win) 
{ 
	if (win == undefined) win = window; 
	if (win.innerHeight) 
	{ 
		return win.innerHeight; 
	} 
	else 
	{ 
		if (win.document.documentElement && win.document.documentElement.clientHeight) 
		{ 
			return win.document.documentElement.clientHeight; 
		} 
		return win.document.body.offsetHeight; 
	} 
}
function getWindowWidth(win) 
{ 
	if (win == undefined) win = window; 
	if (win.innerWidth) 
	{ 
		return win.innerWidth; 
	} 
	else 
	{ 
		if (win.document.documentElement && win.document.documentElement.clientWidth) 
		{ 
			return win.document.documentElement.clientWidth; 
		} 
		return win.document.body.offsetWidth; 
	} 
} 

function arrayschreibenkleiner()
{
	alert(document.getElementsByName("leistung").length);
}

function kleiner(bild)
{

	var h = bild.split(",");
	var iDisplay = document.getElementById(h[1]).style.display;
	if(iDisplay == "" || iDisplay == "none")
	{
		document.getElementById(h[1]).style.display = "block";
		document.getElementById(h[1]).style.height = "1px";
		document.getElementById(h[2]).style.backgroundImage = "url(bg/minus.jpg)";
		document.getElementById(h[2]).style.float = "right";
		wachsenleistung(bild);
	}
	else
	{
		document.getElementById(h[2]).style.backgroundImage = "url(bg/plus.jpg)";
		document.getElementById(h[2]).style.float = "right";
		schrumpfenleistung(bild);

	}
}
function wachsenleistung(bild)
{
	var h = bild.split(",");
	var momh =  document.getElementById(h[1]).style.height.substr(0, document.getElementById(h[1]).style.height.length-2);
	var zielh = parseInt(h[0])+10;
	var nexth = parseInt(momh)+5;
	if(zielh == nexth || nexth >= zielh)
	{
		document.getElementById(h[1]).style.height = zielh+"px";
		window.clearTimeout(leistungwachsentimer);

	}
	else
	{
		document.getElementById(h[1]).style.height = (parseInt(momh)+5)+"px";
		leistungwachsentimer = window.setTimeout("wachsenleistung('"+bild+"')", 1);
	}
}
function schrumpfenleistung(bild)
{
	var h = bild.split(",");
	var momh =  document.getElementById(h[1]).style.height.substr(0, document.getElementById(h[1]).style.height.length-2);
	var zielh = h[0];
	var nexth = parseInt(momh)-5;
	if(0 == nexth || nexth >= 0)
	{
		document.getElementById(h[1]).style.height = (parseInt(momh)-5)+"px";
		leistungschrumpfentimer = window.setTimeout("schrumpfenleistung('"+bild+"')", 1);
	}
	else
	{
		document.getElementById(h[1]).style.display = "none";
		window.clearTimeout(leistungschrumpfentimer);
	}
}
//-->
