var open = selected ? (menu[selected-1]["parent"] != 0 ? menu[selected-1]["parent"] : menu[selected-1]["id"]) : 0;


document.writeln('<table cellpadding="0" cellspacing="0" border="0" width="305">');
z = 1;
	var isOpen=false;
for(i=0;i<=menu.length;i++){
   eval("navi"+(i+99)+"On=new Image();navi"+(i+99)+"On.src='/images/kasten_over.gif';navi"+(i+99)+"Off=new Image();navi"+(i+99)+"Off.src='/images/kasten.gif';");
}
for(i=0;i<menu.length;i++){

var link = menu[i]["link"].replace(/.*href="([^"]+)"[^>]*>.*<\/a>/,"$1");
var text = menu[i]["link"].replace(/.*href="[^"]+"[^>]*>(.*)<\/a>/,"$1");
	
		if(open && menu[i]["id"] == open+1 && (i<(menu.length -1) && menu[i+1]["parent"]==open)){
document.writeln('<tr height="1">');
		document.writeln('	<td height="1" width="14"></td>');
		document.writeln('	<td width="1" height="1"></td>');
	document.writeln('	<td height="1" bgcolor="white"><img src="/images/pixel.gif" width="5" height="1" border="0"></td>');
		document.writeln('	<td height="1" bgcolor="white"><img src="/images/pixel.gif" width="196" height="1" border="0"></td>');

		document.writeln('</tr>');
		document.writeln('<tr height="1">');
		document.writeln('	<td height="1" width="14"></td>');
		document.writeln('	<td width="1" height="1"></td>');
		document.writeln('	<td height="1" colspan="2" >');
		
		document.writeln('		<table border="0" cellpadding="0" cellspacing="0" width="200" bgcolor="#d9e4f0">');
		isOpen=true;
	}else if(isOpen && menu[i]["parent"] != open){
		document.writeln('		</table>');
		document.writeln('	</td>');
		document.writeln('</tr>');
		isOpen=false;
}
	if(isOpen){
		document.writeln('			<tr height="14">');
		document.writeln('				<td height="14" ID="box'+(i+100)+'" width="5"'+((menu[i]["id"] == selected) ? 'bgcolor="#d20019"' : '')+'><img src="/images/pixel.gif" width="7" height="14" border="0" name="navi'+(i+100)+'"></td>');
		document.writeln('				<td height="14" width="5"><img src="/images/pixel.gif" width="3" height="1" border="0"></td>');
		document.writeln('				<td height="14" width="190"><a  href="'+link+'"'+((menu[i]["id"] != selected) ? ' OnMouseOver="change(\'sub'+(i+100)+'\',\'1\')" OnMouseOut="change(\'navi'+(i+100)+'\',\'0\')"' : '')+'>'+((menu[i]["id"] == selected) ? '<font color="#d20019">' : '')+text+((menu[i]["id"] == selected) ? '</font>' : '')+'</a></td>');
		document.writeln('			</tr>');
	}else if(menu[i]["parent"]==0){	
	
		document.writeln('<tr height="1">');
		document.writeln('	<td height="1" width="14"></td>');
		document.writeln('	<td width="1" height="1"></td>');
	                document.writeln('	<td height="1" bgcolor="white"><img src="/images/pixel.gif" width="5" height="1" border="0"></td>');
		document.writeln('	<td height="1" bgcolor="white"><img src="/images/pixel.gif" width="196" height="1" border="0"></td>');
	 	document.writeln('</tr>');
	
		document.writeln('<tr height="14">');
		document.writeln('	<td width="14" '+((menu[i]["id"] == open) ? ' bgcolor="#d20019"' : ' bgcolor="#b1bfce"')+' height="14" id="box'+(i+100)+'"><img src="/images/pixel.gif" width="14" height="14" border="0" name="navi'+(i+100)+'"></td>');
		document.writeln('	<td width="1" height="1"><img src="/images/pixel.gif" width="1" height="1"></td>');
		document.writeln('	<td width="5" height="14" bgcolor="#d9e4f0"><img src="/images/pixel.gif" width="5" height="1" border="0"></td>');
		document.writeln('	<td width="285" height="14" bgcolor="#d9e4f0"><a class="top" href="'+link+'"'+((menu[i]["id"] != open) ? ' OnMouseOver="change(\'navi'+(i+100)+'\',\'1\')" OnMouseOut="change(\'navi'+(i+100)+'\',\'0\')"' : '')+'>'+((menu[i]["id"] == open) ? '<font color="#d20019"><b>' : '')+text+((menu[i]["id"] == open) ? '</font></b>' : '')+'</a></td>');
		document.writeln('</tr>');

	}	
}
document.writeln('<tr height="1">');
document.writeln('	<td height="1" width="14"></td>');
document.writeln('	<td width="1" height="1"></td>');
document.writeln('	<td height="1" bgcolor="white"></td>');
document.writeln('	<td height="1" bgcolor="white"></td>');
document.writeln('</tr>');
document.writeln('</table>');
