function disableLayers()
{
	document.getElementById("fenster").style.display="none";
	document.getElementById("fenster1").style.display="none";
	document.getElementById("callback").style.display="none";
	document.getElementById("bg").style.display="none";
}

function validateParentWithName(page_name)
{
	if(parent.name != "stratedi")
		top.location.href="./?page="+page_name;
}
function validateParent(page_name)
{
	if(parent.name != "stratedi")
		top.location.href="./?page="+page_name;
}

	function send(ext)
	{
		var sPath = parent.cont.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
			location.href="http://www.stratedi."+ext+location.search;
	}

function isArray(obj) {
   if (obj.constructor.toString().indexOf("Array") == -1)
      return false;
   else
      return true;
}

function setStatus(idName)
{
	var elem = document.getElementById(idName);
	if(elem.style.display == "none")
		elem.style.display="block";
	else
		elem.style.display="none";
}
var menucounter = 0
function getInternalArrayAmount(arr)
{
	var count = 0
	for(i=0; i< arr.length;i++)
	{
		if(isArray(arr[i]))
			count = count + 1;
	}
	return count;
}
function disableAll(id,total,current)
{
	for(i=1;i<=total;i++)
	{
		if(i != current)
			document.getElementById(id+i).style.display='none';
	}
}
function getNextNavPoint(arr,nam)
{
	var tmp = arr;
	var val = "";
	while(isArray(tmp))
	{
		val = val + "document.getElementById('"+nam+"1').style.display='block';";
		nam = tmp[0].split(';')[0]
		tmp = tmp[1];
	}
	val=val + "cont.location.href='"+tmp.split(';')[0]+"';";
	return val;
	
}

function writeNewMenu(menue,count,rand)
{
	var placeholder = "";
	for(x=0; x < count; x++)
	 var placeholder = placeholder + "&nbsp;&nbsp;";
	var totalcount = getInternalArrayAmount(menue);
	var internalamount = 0;
	if(rand ==0)
		rand = Math.random()*10;
	for(var i=0;i<menue.length;i++)
	{

		var eintrag = menue[i];
		if(isArray(eintrag))
		{
			internalamount = internalamount +1;
			menuid = menucounter +1;
			menucounter = menuid;
			newcount = count+1;
			
			var bla = eintrag[0];

			var mtext = bla.split(';')[0];
			var style = bla.split(';')[1];
			var styleover;
			if(style == 0)
			{
				style="navigation";
				styleover="navover";
			}
			else if(style==1)
			{
				style="submenu";
				styleover = "submenuover"
			}
			else if(style==2)
			{
				style= "subsubmenu";
				styleover = "subsubmenuover";
			}
			
			subrand = (Math.random()*10);
			if(!isArray(eintrag[1]))
				linkName = "cont.location.href='"+eintrag[1].split(';')[0]+"';";
			else
				linkName = getNextNavPoint(eintrag[1],mtext);
			document.write("<div class="+style+" onmouseout=this.className='"+style+"' "+
				"onmouseover=this.className='"+styleover+"' onclick=\"disableAll('"+rand+"','"+totalcount+"','"+internalamount+"');setStatus('"+rand+internalamount+"');"+
				""+linkName+"\">"+ placeholder+mtext + "</div>");

			document.write("<div id='"+rand+internalamount+ "' style='display:none;'>");

			writeNewMenu(eintrag,newcount,mtext);
			document.write("</div>");
		}
		else
		{
			if(i>0)
			{
				if(placeholder == '')
					document.write("&nbsp;&nbsp;");
				

				var fName = eintrag.split(';')[0];
				var text  = eintrag.split(';')[1];
				var style = eintrag.split(';')[2];
				var vis   = eintrag.split(';')[3];
				if(style == 0)
				{
					style="navigation";
					styleover="navover";
				}
				else if(style==1)
				{
					style="submenu";
					styleover = "submenuover"
				}
				else if(style==2)
				{
					style= "subsubmenu";
					styleover = "subsubmenuover";
				}
				if(!vis)
					document.write("<div class='"+style+"' onmouseout=this.className='"+style+"' "+
						"onmouseover=this.className='"+styleover+"' onclick=cont.location.href='./"+
						fName+"' >"+placeholder+text+ "</div>");
			}
		}
		
	}
	
}

function trim(s) {
	var s1 = '';
	for(var i = 0; i< s.length;i++)
	{
		if(s.substring(i,i+1) != ' ' && s.substring(i,i+1) != '&')
			s1 = s1+s.substring(i,i+1);
		else if(s.substring(i,i+1) == ' ')
			s1 = s1+"...";
		else
			s1 = s1+":::";
	}
	return s1;
}
function validateSearch(se)
{
	if(se != null)
	{
		search =se.substring(1, se.length);
		var x = search.split('&');
		var temp = x[0].split('=');
		if(temp[0] == "page")
		{
			if(x.length >1)
			{
				var rel = x[1].split('=')
				if(rel[0] == "top")
				{
					var m = rel[1].split(";");
					for(var i = 0; i < m.length; i++)
					{
						document.getElementById(m[i]).style.display="block";
					}
				}
			}
			if(x.length >2)
			{
				var n = x[2].split('=');
			}
			parent.cont.location.href=temp[1]+"";
		}
	}
}

							function showMenu(numb)
							{
								var count = 1;
								var status = "block";
	
								while(document.getElementById("menu"+count) != null)
								{
									if(count != numb)
										document.getElementById("menu"+count).style.display="none";
									count ++;
								}
	
								if(document.getElementById("menu"+numb).style.display == "block")
									status = "none"
								document.getElementById("menu"+numb).style.display=status;
							}
							function showSubMenu(numb)
							{
								var count = 1;
								var status = "block";
	
								while(document.getElementById("submenu"+count) != null)
								{
									if(count != numb)
										document.getElementById("submenu"+count).style.display="none";
									count ++;
								}
	
								if(document.getElementById("submenu"+numb).style.display == "block")
									status = "none"
								document.getElementById("submenu"+numb).style.display=status;
							}

							
							
							
		function showSzen()
		{
			showSzen("null");
		}
		function showSzen(folder)
		{
			var sel = document.getElementById("szen").selectedIndex;
			sel = document.getElementById("szen")[sel].value;
			if(sel != -1)
			{
				if(folder)
					link = "."+folder+"/"+ sel + ".htm";
				else
					link = "./"+ sel + ".htm";
				enableLayer(link);
			}
		}
		function enableLayer(link)
		{
			top.internalframe.location.href= ""+link;
			parent.document.getElementById("bg").style.display="block";
			parent.document.getElementById("fenster").style.display="block";
			parent.document.getElementById("about").style.display="none";
		}
		
		function setDemoLayer(status,inhalt)
		{
			flash = "block";
			lay   = "none";
			if(status == "true")
			{
				flash = "none";
				lay   = "block";
			}
			parent.document.getElementById("bg").style.display=lay;
			parent.document.getElementById("fenster1").style.display=lay;
			parent.document.getElementById("about").style.display=flash;
			parent.document.getElementById("msgFenster").value= inhalt;
		}
