//author: B.G. Ulrich
//publisher: Kunstverein Trier Junge Kunst e.V.
//copyright: Kunstverein Trier Junge Kunst e.V.
//Letzte Aktualisierung: 13.1.2012

var checkedBrowser=false;
var isIE4=false; //Microsoft Internet Explorer 4.x
var isIE5=false; //Microsoft Internet Explorer 5.x
var isIE55=false; //Microsoft Internet Explorer 5.5
var isIE6=false; //Microsoft Internet Explorer ab 6.x
var isNc4=false; //Netscape Navigator 4.x
var isNc5=false; //Netscape Navigator ab Mozilla 5.x
var isOp5=false; //Opera 5.x bis 6.x
var isOp7=false; //Opera ab 7.x
var isMo5=false; //andere Browser ab Mozilla 5.x
var isW3C=false; //Netscape ab 5.x, Opera ab 7.x, Internet Explorer ab 6.x
var isMobile=false //Smartphones usw.
var isSmallX=false //weniger als 600px Breite
var isSmallY=false //weniger als 480px Höhe

function checkBrowser()
{
	if (!checkedBrowser)
	{
		if (navigator.appName=="Microsoft Internet Explorer")
		{
			reIE=/(.*)MSIE (.*)/i;
			matchIE=navigator.appVersion.match(reIE);
			if (matchIE)
			{
				if (matchIE[2].charAt(0)=='4')
				{
					isIE4=true;
				}
				else if (matchIE[2].charAt(0)=='5')
				{
					isIE5=true;
					if (matchIE[2].charAt(2)=='5')
					{
						isIE55=true;
					}
				}
				else if (matchIE[2].charAt(0)>='6')
				{
					isIE6=true;
					isW3C=true;
				}
			}
		}
		else if (navigator.appName=="Netscape")
		{
			if (navigator.appVersion.charAt(0)=='4')
			{
				isNc4=true;
			}
			else if (navigator.appVersion.charAt(0)=='5')
			{
				isNc5=true;
				isW3C=true;
			}
		}
		else if (navigator.appName=="Opera")
		{
			if (navigator.appVersion.charAt(0)=='4')
			{
				isNc4=true;
			}
			else if (navigator.appVersion.charAt(0)=='5' || navigator.appVersion.charAt(0)=='6')
			{
				isOp5=true;
				isMo5=true;
			}
			else if (navigator.appVersion.charAt(0)>='7')
			{
				isOp7=true;
				isW3C=true;
			}
		}
		else if (navigator.appVersion.charAt(0)>="5")
		{
			isMo5=true;
		}
		var UserAgent = navigator.userAgent.toLowerCase();
		if(UserAgent.search(/(mobile|phone|ipod|opera mini|fennec|palm|blackberry|android|symbian|series60)/)>-1)
		{
			isMobile=true;
		}
		if (screen.width<=600)
		{
			isSmallX=true;
		}
		if (screen.height<=480)
		{
			isSmallY=true;
		}
		checkedBrowser=true;
	}
}

function NavLeiste(art,pfad)
{
	checkBrowser();
	if (parent.parent.frames["NavigationFrame"])
	{	
		if (art==undefined)
		{
			art="";
		}
		if (pfad==undefined)
		{
			pfad="";
		}
		if (isMobile)
		{
			//keine subMenüs
			parent.parent.frames["NavigationFrame"].location=pfad+"juku3a1m.htm";
		}
		else if (isSmallX)
		{
			//keine subMenüs
			if (isSmallY)
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a3.htm";
			}
			else
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a.htm";
			}
		}
		else
		{
			if (isW3C || isMo5)
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a16"+art+".htm";
			}
			else
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a1"+art+".htm";
			}
		}	
	}	
}

function NavLeisteRelativ(pfad)
{
	//keine subMenüs
	checkBrowser();
	if (parent.parent.frames["NavigationFrame"])
	{	
		if (pfad==undefined)
		{
			pfad="";
		}
		if (isMobile)
		{
			//keine subMenüs
			parent.parent.frames["NavigationFrame"].location=pfad+"juku3a1m.htm";
		}
		else if (isSmallX)
		{
			//keine subMenüs
			if (isSmallY)
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a3.htm";
			}
			else
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a.htm";
			}
		}
		else
		{
			if (isW3C || isMo5)
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a16.htm";
			}
			else
			{
				parent.parent.frames["NavigationFrame"].location=pfad+"juku3a1.htm";
			}
		}	
	}	
}

function meineNavLeiste(ich)
{
	checkBrowser();
	var subnav="";
	var pos=ich.indexOf("-");
	if (pos>0)
	{
		subnav=ich.substr(pos,2);
	}
	if (isMobile)
	{
		if (ich!="juku3a1m.htm")
		{
			window.location.replace("juku3a1m.htm");
		}
	}
	else if (isSmallX)
	{
		//keine subMenüs
		if (isSmallY)
		{
			if (ich!="juku3a3.htm")
			{
				window.location.replace("juku3a3.htm");
			}
		}
		else
		{
			if (ich!="juku3a.htm")
			{
				window.location.replace("juku3a.htm");
			}
		}
	}
	else
	{
		if (isW3C || isMo5)
		{
			if (ich!="juku3a16"+subnav+".htm")
			{
				window.location.replace("juku3a16"+subnav+".htm");
			}
		}
		else
		{
			if (ich!="juku3a1"+subnav+".htm")
			{
				window.location.replace("juku3a1"+subnav+".htm");
			}
		}
	}	
}

function ein(derLayer)
{
	checkBrowser();
	if (!isMobile && !isSmallX)
	{
		moveLayer(derLayer,"20px");
	}
}

function aus(derLayer)
{
	moveLayer(derLayer,"-300px");
}

function getLayer(name)
{
	checkBrowser();
	if (parent.parent.frames["NavigationFrame"])
	{
		if (isIE4 || isIE5)
		{
			if (parent.parent.frames["NavigationFrame"].document.all[name])
			{
				return parent.parent.frames["NavigationFrame"].document.all[name].style;
			}
			else
			{
				return "";
			}
		}
		else if (isW3C)
		{
			if (parent.parent.frames["NavigationFrame"].document.getElementById(name))
			{
				return parent.parent.frames["NavigationFrame"].document.getElementById(name).style;
			}
			else
			{
				return "";
			}
		}
		else
		{
			return "";
		}
	}
	else
	{
		return "";
	}
}

function moveLayer(name,x)
{
	checkBrowser();
	var tmpLayer=getLayer(name);
	if (tmpLayer)
	{
		if (isIE5 || isW3C)
		{
			tmpLayer.left=x;
		}
		else if (isIE4)
		{
			tmpLayer.pixelLeft=x;
		}
	}
}

function getHeight() 
{  
	checkBrowser();
	var myHeight = 0;      
	if( window.innerWidth && typeof( window.innerWidth ) == 'number' ) 
	{  
		//Non-IE  
		myHeight = window.innerHeight;  
	} 
	else if( document.documentElement && document.documentElement.offsetHeight ) 
	{  
		//IE 7+  
		myHeight = document.documentElement.offsetHeight;  
		if (isIE55)
		{
			//IE5.5 gibt anscheinend die höhe des browserfensters zurück
			myHeight = myHeight - 175;  
		}
	} 
	else if( document.documentElement && document.documentElement.clientHeight ) 
	{  
		//IE 6 in 'standards compliant mode'  
		myHeight = document.documentElement.clientHeight;  
	} 
	else if( document.body && document.body.clientHeight ) 
	{  
		//IE 4 compatible  
		myHeight = document.body.clientHeight;  
	}  
	return myHeight; //aktuelle höhe des fensters bzw. frames
}  

function sizeTab()
{
	//aufruf in intro3a.htm, um die suchtabelle zu positionieren
	//aufruf in intro4a.htm, um die tabellengröße zu begrenzen
	if(getHeight()>500)
	{
		window.document.write("<style>");
		window.document.write("table.intro {height:500px}");
		window.document.write("table.intro3a {height:466px}");
		window.document.write("</style>");
	}
	else
	{
		window.document.write("<style>");
		window.document.write("table.intro3a {height:"+(getHeight()-14)+"px}");
		window.document.write("</style>");
	}
}

function pruefeBrowser()
{
	checkBrowser();
	if (!(isW3C || isMo5))
	{
		window.location.replace("juku3a0.htm");
	}
}

