ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
ie5 = (navigator.appVersion.toLowerCase().indexOf("msie 5")>-1)?true:false;
ns6 = (navigator.appName=="Netscape" && navigator.appVersion.substring(0,1)=="5")?true:false;
w3c = (document.getElementById)? true:false;
mac = (navigator.appVersion.toLowerCase().indexOf("mac")>-1)? true:false;
//kunde="jakobsweg";
loaded=false;
function showLayer(layerName){
if (layerName!="")
{
	var showArray;
	showArray=layerName.split(";");
	for (x in showArray)
	{
		if (showArray[x]!="")
		{
			document.getElementById(showArray[x]).style.visibility="visible";
		}
	}
}
}
        
function hideLayer(layerName){
if (layerName!="")
{
	var hideArray;
	hideArray=layerName.split(";");
	for (x in hideArray)
	{
		if (hideArray[x]!="")
		{
			document.getElementById(hideArray[x]).style.visibility="hidden";
		}
	}
}
}

function posLayer(layerName,left,top){
	document.getElementById(layerName).style.top=top;
	document.getElementById(layerName).style.left=left;
}


function writeLayer(id,content){
//alert(content);
	document.getElementById(id).innerHTML=content;
}

function openSpecial(bez){
	if(bez=="wohngeschichten")
	{
		w=screen.availWidth;
		h=screen.availHeight;
		window.open("/de/flash_wohngeschichten.htm","wg","width="+w+",height="+h+",resizeable=no,scrollbars=no,0,0");	
	}
}
function popupGeneral(img,titel){
	window.open("/php/popup_general.php4?img="+img+"&titel="+titel,"foto","width=100,height=100,scrollbars=no");	
}
maustaste="";
onNav=false;
navigation=new Array();
subnavOpen=new Array();
currentNavItem="";
activeItems=new Array();
secondRepos=new Array();
function reposAll(){
	checkScroll();
	for(x in navigation)
	{
		//erst mal alle mainsubs:
		if(navigation[x]['subnav']!=null)
		{
			if(navigation[x]['under']==null)
			{
				//ist main-sub
				thisE=document.getElementById(x);
				subE=document.getElementById("under"+x);
				subE.style.left=parseInt(thisE.style.left);
				subE.style.top=parseInt(thisE.style.top)+parseInt(thisE.offsetHeight)-1;
				subTop=0;
				for(s=0;s<subnavbox[x].length;s++)
				{
					subsubE=document.getElementById(subnavbox[x][s]);
					subsubHeight=subsubE.offsetHeight;
					subsubE.style.width=120;		
					subsubE.style.top=subTop;
					subTop+=subsubHeight-1;			
				}
			}	
		}	
	}
	for(x in navigation)
	{
		if(navigation[x]['subnav']!=null)
		{
			if(navigation[x]['under']!=null)
			{
				//ist Sub-Element
				boxE=document.getElementById("under"+navigation[x]['under']);
				boxETop=parseInt(boxE.style.top);
				boxELeft=parseInt(boxE.style.left);
				thisE=document.getElementById(x);
				subE=document.getElementById("under"+x);
				subE.style.left=boxELeft+parseInt(thisE.offsetWidth)-1;
				subE.style.top=boxETop+parseInt(thisE.style.top);
				subTop=0;
				for(s=0;s<subnavbox[x].length;s++)
				{
					subsubE=document.getElementById(subnavbox[x][s]);
					subsubHeight=parseInt(subsubE.offsetHeight);
					subsubE.style.width=120;		
					subsubE.style.top=subTop;
					subTop+=subsubHeight-1;			
				}
			}	
		}	
	}		
	loaded=true;
	setTimeout('sendTop()',1000);
}
function onMain(id){
	if(mode=="wysiwyg")
		clearFragments();
	onNav=true;
	currentNavItem=id;
	resetNav('');
	setHl(id);
	if(navigation[id]['subnav']!=null)
	{	
		if(secondRepos[id]==null)
		{
			thisE=document.getElementById(id);
			secondRepos[id]=true;
			subE=document.getElementById("under"+id);
			subE.style.left=parseInt(thisE.style.left);
			subE.style.top=parseInt(thisE.style.top)+parseInt(thisE.offsetHeight)-1;
			subTop=0;
			for(s=0;s<subnavbox[id].length;s++)
			{
				subsubE=document.getElementById(subnavbox[id][s]);
				subsubHeight=subsubE.offsetHeight;
				subsubE.style.width=120;		
				subsubE.style.top=subTop;
				subTop+=subsubHeight-1;			
			}
		}
		showLayer("under"+id);	
		subnavOpen[id]=true;
	}
}
function remfArray(id){
	temp=new Array();
	for(x in subnavOpen)
	{
		if(x !=	id)
			temp[x]=true;
	}
	subnavOpen=temp;
}
function offMain(id){
	onNav=false;	
}
function clickMain(id){
	//alert("in clickMain");
	if(navigation[id]['url']!=null)
	{
		//alert(mode);
		if(mode=="wysiwyg" || mode=="result")
		{
			if(id==thisId)
				document.location.href="start.php";
			else
				document.location.href=navigation[id]['url']+"&resetCat=true";
		}
		else
		document.location.href=navigation[id]['url'];
	}
}
function hl(id){
	ref=document.getElementById(id);
	ref.style.backgroundColor="#F7C331";	
}
function hlnull(id){
	ref=document.getElementById(id);
	ref.style.backgroundColor="#FFFFFF";	
}
function onSub(id){
	onNav=true;
	currentNavItem=id;
	resetNav(navigation[id]['under']);
	setHl(id);
	if(navigation[id]['subnav']!=null)
	{
		if(secondRepos[id]==null)
		{
			secondRepos[id]=true;
			thisE=document.getElementById(id);
			boxE=document.getElementById("under"+navigation[id]['under']);
			boxETop=parseInt(boxE.style.top);
			boxELeft=parseInt(boxE.style.left);
			subE=document.getElementById("under"+id);
			subE.style.left=boxELeft+parseInt(thisE.offsetWidth)-1;
			subE.style.top=boxETop+parseInt(thisE.style.top);
			subTop=0;
			for(s=0;s<subnavbox[id].length;s++)
			{
				subsubE=document.getElementById(subnavbox[id][s]);
				subsubHeight=parseInt(subsubE.offsetHeight);
				subsubE.style.width=120;		
				subsubE.style.top=subTop;
				subTop+=subsubHeight-1;			
			}
		}
		showLayer("under"+id);	
		subnavOpen[id]=true;
	}
}
function offSub(id){
	onNav=false;
}
function clickSub(id){
	if(maustaste=="rechts")
		openCat(id);
	else if(navigation[id]['url']!=null)
		document.location.href=navigation[id]['url'];
}
function setHl(id){
	hl(id);
	if(navigation[id]['under']!=null)
		setHl(navigation[id]['under']);
}
function resetNav(under){
	for(x in navigation)
	{
		if(activeItems[x]==true)
			hl(x);
		else
			hlnull(x);
	}
	if(under=="")
	{
		for(x in subnavOpen)
		{			
			hideLayer("under"+x);
		}
		subnavOpen=new Array();
	}
	else
	{
		//löschen auf gleicher ebene
		for(x in navigation)
		{
			if(	navigation[x]['under'] == under && navigation[x]['subnav']!=null)
			{
				hideLayer("under"+x);
				remfArray(x);
				hlnull(x);				
			}
		}
	}
}
function clearNav(){
	for(i=0;i<subnavOpen.length;i++)
	{
		hideLayer("under"+subnavOpen[i]);
	}
	subnavOpen=new Array();
}
function turnaround(){
	if(!onNav)
		resetNav('');
	setTimeout(	'turnaround()',3000);
}
function buildActive(cat){	
	activeItems[cat]=true;
	if (navigation[cat]['under']!=null)
		buildActive(navigation[cat]['under']);
	else
		setTimeout('turnaround()',1000);
}
/*
function Tastendruck(Ereignis){
	if (!Ereignis)
		Ereignis = window.event;
	if (Ereignis.button) 
	{
		if (Ereignis.button == 1)
		{
		  maustaste="links";
		}
		else
		{
		  maustaste="rechts";		  
		}
		return false;
	}
}
*/

//document.onmousedown = Tastendruck;
//document.oncontextmenu= Tastendruck;
//document.ondragstart= Tastendruck;
//document.onselectstart= Tastendruck;

