var hide=0;

function kitaMenu(o){
	hideMenu(); 
	// if (document.getElementById) { 
		// alert(o.id+"Menu "+o.parentNode.parentNode.parentNode.tagName +" offsettop: " + o.parentNode.parentNode.parentNode.offsetTop + " offsetleft: " + o.parentNode.parentNode.parentNode.offsetLeft + " o.offsettop: " + o.offsetTop + " o.offsetleft: " + o.offsetLeft);
	// }
	// else {
		// alert("No Document.getElementById");
	// }
	oldleft=document.getElementById(o.id+"Menu").style.left;
	oldtop=document.getElementById(o.id+"Menu").style.top;
	if (navigator.appName == "Microsoft Internet Explorer") {
		topoffset = 19;
	}
	else {
		topoffset = 25;
	}
	document.getElementById(o.id+"Menu").style.top = eval(o.offsetTop + o.parentNode.parentNode.parentNode.offsetTop + topoffset)+'px';
	if (o.id == "Einrichtung") {
		document.getElementById(o.id+"Menu").style.left = eval(o.offsetLeft + o.parentNode.parentNode.parentNode.offsetLeft+10)+'px';
	}
	else {
		document.getElementById(o.id+"Menu").style.left = eval(o.offsetLeft + o.parentNode.parentNode.parentNode.offsetLeft - 80)+'px'; 
	} 
	if (o.id == "Foerderkreis") {
		document.getElementById(o.id+"Menu").style.left = eval(o.offsetLeft + o.parentNode.parentNode.parentNode.offsetLeft - 150)+'px';
	}
	
 //	alert("otop: "+oldtop+" oleft: "+ oldleft+" top: " + document.getElementById(o.id+"Menu").style.top + " left: " + document.getElementById(o.id+"Menu").style.left);
	if (document.getElementById(o.id+"Menu").style.display == "none") { 
		if (o.className != "on") o.className = "overGR"; 
		document.getElementById(o.id+"Menu").style.display = "";
	} 
	else { 
		setTimeout("hideMenu()",500); 
	}
}
function hideMenu(){
	switch (hide) {
		case 0: 
			document.getElementById("EinrichtungMenu").style.display = "none"; 
			if (document.getElementById("Einrichtung").className != "on") document.getElementById("Einrichtung").className = "off"; 
			document.getElementById("NeuigkeitMenu").style.display = "none"; 
			if (document.getElementById("Neuigkeit").className != "on") document.getElementById("Neuigkeit").className = "off"; 
			document.getElementById("BirkenblattMenu").style.display = "none"; 
			if (document.getElementById("Birkenblatt").className != "on") document.getElementById("Birkenblatt").className = "off"; 
			document.getElementById("FoerderkreisMenu").style.display = "none"; 
			if (document.getElementById("Foerderkreis").className != "on") document.getElementById("Foerderkreis").className = "off"; 
			break;
		case 1: 
			document.getElementById("NeuigkeitMenu").style.display = "none"; 
			if (document.getElementById("Neuigkeit").className != "on") document.getElementById("Neuigkeit").className = "off"; 
			document.getElementById("BirkenblattMenu").style.display = "none"; 
			if (document.getElementById("Birkenblatt").className != "on") document.getElementById("Birkenblatt").className = "off"; 
			document.getElementById("FoerderkreisMenu").style.display = "none"; 
			if (document.getElementById("Foerderkreis").className != "on") document.getElementById("Foerderkreis").className = "off"; 
			break;
		case 2: 
			document.getElementById("EinrichtungMenu").style.display = "none"; 
			if (document.getElementById("Einrichtung").className != "on") document.getElementById("Einrichtung").className = "off"; 
			document.getElementById("BirkenblattMenu").style.display = "none"; 
			if (document.getElementById("Birkenblatt").className != "on") document.getElementById("Birkenblatt").className = "off"; 
			document.getElementById("FoerderkreisMenu").style.display = "none"; 
			if (document.getElementById("Foerderkreis").className != "on") document.getElementById("Foerderkreis").className = "off"; 
			break;
		case 3: 
			document.getElementById("EinrichtungMenu").style.display = "none"; 
			if (document.getElementById("Einrichtung").className != "on") document.getElementById("Einrichtung").className = "off"; 
			document.getElementById("NeuigkeitMenu").style.display = "none"; 
			if (document.getElementById("Neuigkeit").className != "on") document.getElementById("Neuigkeit").className = "off"; 
			document.getElementById("FoerderkreisMenu").style.display = "none"; 
			if (document.getElementById("Foerderkreis").className != "on") document.getElementById("Foerderkreis").className = "off"; 
			break;
		case 4: 
			document.getElementById("EinrichtungMenu").style.display = "none"; 
			if (document.getElementById("Einrichtung").className != "on") document.getElementById("Einrichtung").className = "off"; 
			document.getElementById("NeuigkeitMenu").style.display = "none"; 
			if (document.getElementById("Neuigkeit").className != "on") document.getElementById("Neuigkeit").className = "off"; 
			document.getElementById("BirkenblattMenu").style.display = "none"; 
			if (document.getElementById("Birkenblatt").className != "on") document.getElementById("Birkenblatt").className = "off"; 
			break;
		}
	}
function menuOn(o){ 
	hide = 0; 
	hideMenu(); 
	if (o.className != "on") {
		o.className = "over";
	}
	}
function menuOff(o){ 
	if (o.className != "on") {
		o.className = "off";
	}
	}

function create_hidden_menu(){
	shtml=	"<div id='EinrichtungMenu' style='top: 90px; left: 10px; display: none;' onmouseover='hide=1' onmouseout='hide=0;setTimeout(\"hideMenu()\",500);'>"+
				"<a href='einrichtung.html' target='_top'>Die Einrichtung</a> <br> " +
				"<a href='kinder.html' target='_top'>Die Kinder</a> <br> " +
				"<a href='team.html' target='_top'>Das Team</a> <br> " +
				"<a href='elternrat.html' target='_top'>Der Elternrat</a> <br> " +
				"<a href='konzept.html' target='_top'>Die Konzeption</a> <br> " +
				"<a href='paedagogik.html' target='_top'>Reggio-Pädagogik</a> <br> " +
				"<a href='dokumentation.html' target='_top'>Dokumentation & Kommunikation</a> <br> " +
				"<a href='traeger.html' target='_top'>Der Träger</a> " +
			"</div>"+
			"<div id='NeuigkeitMenu' style='top: 90px; left: 320px; display: none;' onmouseover='hide=2' onmouseout='hide=0;setTimeout(\"hideMenu()\",500);'>" +
				"<a href='termine.html' target='_top'>Termine</a> | " +
				"<a href='projekte.html' target='_top'>Projekte</a> | " +
				"<a href='feste.html' target='_top'>Feste</a> | " +
				"<a href='presse.html' target='_top'>Presse</a> | " +
				"<a href='sprueche.html' target='_top'>Kindersprüche</a>" +
			"</div>" +
			"<div id='BirkenblattMenu' style='top: 90px; left: 468px; display: none;' onmouseover='hide=3' onmouseout='hide=0;setTimeout(\"hideMenu()\",500);'>" +
			"<a href='bbaktuell.html' target='_top'>Aktuelle Ausgabe</a> | " +
			"<a href='bbarchiv.html' target='_top'>Archiv</a> | " +
			"<a href='birkenblattteam.html' target='_top'>Das Birkenblatt Team</a>" +
			"</div>" +
			"<div id='FoerderkreisMenu' style='top: 90px; left: 470px; display: none;' onmouseover='hide=4' onmouseout='hide=0;setTimeout(\"hideMenu()\",500);'>" +
				"<a href='foerderkreis.html' target='_top'>Förderkreis stellt sich vor</a> | " +
				"<a href='aufnahmeantrag.html' target='_top'>Aufnahmeantrag</a> | " +
				"<a href='einzugsermaechtigung.html' target='_top'>Einzugsermächtigung</a>" +
			"</div>" 
	document.write(shtml);
}

function create_title(stitle){
	shtml =	"<table width='734' height='60' cellpadding='0' cellspacing='0'> " +
				"<tbody>" +
				"<tr>" +
					"<td rowspan='2'><a href='http://www.paritaet-nrw.org/' target='_blank'><img src='bilder/logo_traeger01.gif'  border='0' alt=''></a></td>"+
					"<td colspan='2' align='middle'><i><font face='Arial, Helvetica, sans-serif' size='1' color='#666666'>Eine Einrichtung der PariSozial Wuppertal gGmbH</font></i></td>"+
					//"<td rowspan='2'><a href='index.html' target='_self'><img src='bilder/birke_logo2.gif' width='80' height='59' border='0' alt=''></a></td>"+
				"</tr>" +
				"<tr>" +
					"<td><img src='bilder/"+stitle+"'></a></td>" +
					"<td><a href='index.html' target='_self'><img src='bilder/kita_logo.jpg'></a></td>" +
				"</tr>" +
			"</table>";
	document.write(shtml);
}

function create_menu(inmenu){
	var shtml =	"<table width='765' cellpadding='0' cellspacing='0' class='menu'> " +
				"<tbody>" +
				"<tr> " +
					"<td width='9' class='crop'>&nbsp;</td> " +
					"<td class='";
	document.write(shtml);
	document.write((inmenu=="1")?"on":"off");
	shtml = "' id='Einrichtung' onmouseover='hide=1;kitaMenu(this)' onmouseout='hide=0;kitaMenu(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'>Die Kita stellt sich vor</td>" +
					"<td width='1' class='crop'>&nbsp;</td>" +
					"<td class='";
	document.write(shtml);
	document.write((inmenu=="2")?"on":"off");
	shtml =	"' id='Neuigkeit' onmouseover='hide=2;kitaMenu(this)' onmouseout='hide=0;kitaMenu(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'>Hier ist was los</td>" +
					"<td width='1' class='crop'>&nbsp;</td>" +
					"<td class='";
	document.write(shtml);
	document.write((inmenu=="3")?"on":"off");
	shtml =	"' id='Birkenblatt' onmouseover='hide=3;kitaMenu(this)' onmouseout='hide=0;kitaMenu(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'>Das Birkenblatt</td>" +
					"<td width='1' class='crop'>&nbsp;</td>" +
					"<td class='";
	document.write(shtml);
	document.write((inmenu=="4")?"on":"off");
	shtml =	"' id='Foerderkreis' onmouseover='hide=4;kitaMenu(this)' onmouseout='hide=0;kitaMenu(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'>Förderkreis</td>" +
					"<td class='crop' width='1'>&nbsp;</td>" +
					"<td class='";
	document.write(shtml);
	document.write((inmenu=="5")?"on":"off");
	shtml =	"' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='kontakt.html' target='_top'>Kontakt</a></td>" +
					"<td width='1' class='crop'>&nbsp;</td>" +
					"<td class='crop' width='8'>&nbsp;</td>" +
				"</tr>" +
				"</tbody>" +
			"</table>";
	document.write(shtml);
}

function create_submenu(mname,inmenu){
	var shtml =	"<table width='750' cellpadding='0' cellspacing='0' class='menu'> " +
				"<tbody>" +
				"<tr> " +
					"<td width='9' class='crop'>&nbsp;</td> " +
					"<td class='";
	if (mname != "0") {document.write(shtml);}
	switch (mname){
		case "feste":
			document.write((inmenu=="1")?"on":"off");
			shtml = "' id='Karneval' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='karneval.html' target='_top'>Karneval</a></td>" +
							"<td width='1' class='crop'>&nbsp;</td>" +
							"<td class='";
			document.write(shtml);
			document.write((inmenu=="2")?"on":"off");
			shtml = "' id='Osterbrunch' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='osterbrunch.html' target='_top'>Osterbrunch</a></td>" +
							"<td width='1' class='crop'>&nbsp;</td>" +
							"<td class='";
			document.write(shtml);
			document.write((inmenu=="3")?"on":"off");
			shtml = "' id='Sommerfest' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='sommerfest.html' target='_top'>Sommerfest</a></td>" +
							"<td width='1' class='crop'>&nbsp;</td>" +
							"<td class='";
			document.write(shtml);
			document.write((inmenu=="4")?"on":"off");
			shtml = "' id='Laternenfest' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='laternenfest.html' target='_top'>Laternenfest</a></td>" +
							"<td width='1' class='crop'>&nbsp;</td>" +
							"<td class='";
			document.write(shtml);
			document.write((inmenu=="5")?"on":"off");
			shtml = "' id='Adventskaffee' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='adventskaffee.html' target='_top'>Adventskaffee</a></td>";
			document.write(shtml);
			break;
		case "projekte":	
			document.write((inmenu=="1")?"on":"off");
			shtml = "' id='BdB' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='projekte_BdB.html' target='_top'>Bob der Baumeister</a></td>" +
							"<td width='1' class='crop'>&nbsp;</td>" +
							"<td class='";
			document.write(shtml);
			document.write((inmenu=="2")?"on":"off");
			shtml = "' id='Lesespass' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='projekte_lese.html' target='_top'>Lesespass</a></td>" +
							"<td width='1' class='crop'>&nbsp;</td>" +
							"<td class='";
			document.write(shtml);
			document.write((inmenu=="3")?"on":"off");
			shtml = "' id='Apfel' onmouseover='menuOn(this)' onmouseout='menuOff(this)'><img src='bilder/birke.gif' align='middle' style='margin-right: 2px;'><a href='projekte_apfel.html' target='_top'>Apfelprojekt</a></td>";
			document.write(shtml);
			break;
	}
	shtml = "<td class='crop' width='8'>&nbsp;</td>" +
				"</tr>" +
				"</tbody>" +
			"</table>";
	if (mname != "0") {document.write(shtml);}
}

function preloadImages() { 
  var d=document; 
  if(d.images){
	if(!d.kita_p) d.kita_p=new Array();
	var i,j=d.kita_p.length,a=preloadImages.arguments; 
    for(i=2; i<a.length; i++)
    	if (a[i].indexOf("#")!=0){
	    	d.kita_p[j]=new Image; 
	    	d.kita_p[j++].src=a[i];
    	}
	setTimeout("startshow("+j+",0,'"+a[0]+"',"+a[1]+")",a[1]*1000);
  }
}


function swapImage(nam,n) { // Name,new_img#
  var i,x,a=swapImage.arguments; 
  var d=document;
  if ((x=d.getElementById(nam))!=null){
	   d.kita_sr=x; if(!x.oSrc) x.oSrc=x.src; x.src=d.kita_p[n].src;
	   }
}

function startshow(n,on,nam,t) { // #Images,name
	var next_im=Math.round(Math.random()*(n-1));
	while ( next_im == on ) {
		next_im=Math.round(Math.random()*(n-1));
	}
	swapImage(nam,next_im);
	setTimeout("startshow("+n+","+next_im+",'"+nam+"',"+t+")",t*1000);
} 