NS6 = (document.getElementById&&!document.all)
IE = (document.all)
NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")

ssmItems=new Array();
ssmSubItems=new Array();
subShown=0;
ssmStarted=false;
moving=setTimeout('null',1)

function moveOut() {
	if ((NS6||NS)&&parseInt(ssm.top)>1 || IE && ssm.pixelTop>1) {
		clearTimeout(moving);
		moving = setTimeout('moveOut()', slideSpeed);
		slideMenu(10);
	}
	else {
		clearTimeout(moving);
		moving=setTimeout('null',1)
	}
};

function moveBack() {
	clearTimeout(moving);
	moving = setTimeout('moveBack1()', waitTime)
}

function moveBack1() {
	if ((NS6||NS) && parseInt(ssm.top)<(bottomHeight + (ssmItems.length * hdrHeight)) || IE && ssm.pixelTop<(bottomHeight + (ssmItems.length)*hdrHeight)) {
		clearTimeout(moving);
		moving = setTimeout('moveBack1()', slideSpeed);
		slideMenu(-10)
	}
	else {
		clearTimeout(moving);
		moving=setTimeout('null',1)
	}
}

function slideMenu(num){
	if (IE) {ssm.pixelTop -= num;}
	if (NS||NS6) {ssm.top = parseInt(ssm.top)-num;}
	if (NS) {bssm.clip.top-=num;bssm2.clip.top-=num;}
}

function openPage(url,targ){
	if(targ == "_blank"){
		window.open(url)
	} else {
		window.location.href = url
	}
}

function showSubMenu(num){
	divId = 'submenu' + num;
	smenu=document.all(divId).style;
	smenu.visibility = "visible";
	menuId = 'menu' + num;
	document.all(menuId).bgColor = linkOverBGColor;
	subShown = 1;
}

function hideSubMenu(num){
	divId = 'submenu' + num;
	smenu=document.all(divId).style;
	smenu.visibility = "hidden"
	menuId = 'menu' + num;
	document.all(menuId).bgColor = linkBGColor;
}

function initSlide() {
	if (NS6){
		ssm=document.getElementById("thessm").style;
		bssm=document.getElementById("basessm").style;
		bssm.clip="rect(0 "+document.getElementById("thessm").offsetWidth+" "+document.getElementById("thessm").offsetHeight+" 0)";ssm.visibility="visible";
		}
	else if (IE) {
		ssm=document.all("thessm").style;
		bssm=document.all("basessm").style
		bssm.clip="rect(0 "+thessm.offsetWidth+" "+(thessm.offsetHeight+1)+" 0)";
		bssm.visibility = "visible";
		}
	else if (NS) {bssm=document.layers["basessm1"];
		bssm2=bssm.document.layers["basessm2"];ssm=bssm2.document.layers["thessm"];
		bssm2.clip.left=0;ssm.visibility = "show";}
	ssmStarted=true;
}

function buildMenu() {
	if (IE||NS6) {document.write('<DIV ID="basessm" style="overflow:hidden;visibility:hidden;Position : Absolute ;Left : '+XOffset+' ;Top : '+YOffset+' ;Z-Index : 20;width:'+(menuWidth)+';height:'+(buttonHeight + bottomHeight + (ssmItems.length)*hdrHeight)+'"><DIV ID="thessm" style="Position : Absolute ;Top : '+(bottomHeight + (ssmItems.length)*hdrHeight)+' ;Left : 0 ;Z-Index : 20;" onmouseover="moveOut()" onmouseout="moveBack()">')}
	if (NS) {document.write('<LAYER name="basessm1" top="'+YOffset+'" LEFT='+XOffset+' visibility="show"><ILAYER name="basessm2"><LAYER visibility="hide" name="thessm" bgcolor="'+menuBGColor+'" left="'+(-menuWidth)+'" onmouseover="moveOut()" onmouseout="moveBack()">')}
	if (NS6){document.write('<table border="0" cellpadding="0" cellspacing="0" width="'+(menuWidth+2)+'" bgcolor="'+menuBGColor+'"><TR><TD valign="top">')}
	document.write('<img src="'+buttonImage+'" height="'+buttonHeight+'" border="0" style="z-index:20;postion:absolute;left:0;top:0;filter=progid:DXImageTransform.Microsoft.Alpha(opacity=100);">');
	//document.write('<img src="/cultuur/images/txtpagina/rood/navigatie_border.gif" height="'+buttonHeight+'" border="0" style="z-index:10;postion:absolute;left:0;top:0;filter=progid:DXImageTransform.Microsoft.Alpha(opacity=100);">');
	document.write('<table id="menutable" border="0" cellpadding="0" cellspacing="0" width="'+(menuWidth+2)+' height="'+(ssmItems.length * hdrHeight + bottomHeight)+'" bgcolor="'+menuBGColor+'" style="table-layout:static;filter=progid:DXImageTransform.Microsoft.Alpha(opacity=80);">');
	for(i=0;i<ssmItems.length;i++) {
		if(ssmItems[i-1]){
			document.write('<TR>')
		}
		if(!ssmItems[i][1]){
			document.write('<td bgcolor="'+hdrBGColor+'" HEIGHT="'+(hdrHeight)+'" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'">&nbsp;<font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+ssmItems[i][0]+'</b></font></td>')
		}
		else {if(!ssmItems[i][2])
			ssmItems[i][2]=linkTarget;
			if(ssmItems[i][3]>0){
				MenuId = 'menu' + i;
				document.write('<TD id="'+MenuId+'" BGCOLOR="'+linkBGColor+'" HEIGHT="'+(hdrHeight)+'" onclick="openPage(\''+ssmItems[i][1]+'\',\''+ssmItems[i][2]+'\')" onmouseover="if(ssm.pixelTop==1||parseInt(ssm.top)==1){bgColor=\''+linkOverBGColor+'\';showSubMenu(\''+i+'\');window.status=\''+ssmItems[i][4]+'\'}" onmouseout="if(ssm.pixelTop==1||parseInt(ssm.top)==1){bgColor=\''+linkBGColor+'\';hideSubMenu(\''+i+'\'); window.status=\'\'}" style="cursor: pointer;" nowrap><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" onclick="moveBack()" WIDTH="100%" ALIGN="'+linkAlign+'"><DIV  ALIGN="'+linkAlign+'">&nbsp;<FONT CLASS="menu" style="color:'+linkFontColor+'">'+ssmItems[i][0]+'<img src="/cultuur/images/shared/arrow.gif" alt="" border="0" style="left: '+(menuWidth-6)+'px; position: absolute; vertical-align: bottom;"></font></DIV></LAYER></ILAYER></TD>')
			}
			else {
				document.write('<TD BGCOLOR="'+linkBGColor+'" HEIGHT="'+(hdrHeight)+'" onclick="openPage(\''+ssmItems[i][1]+'\',\''+ssmItems[i][2]+'\')" onmouseover="if(ssm.pixelTop==1||parseInt(ssm.top)==1){bgColor=\''+linkOverBGColor+'\';window.status=\''+ssmItems[i][4]+'\'}" onmouseout="bgColor=\''+linkBGColor+'\'; window.status=\'\'" style="cursor:pointer;"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" onclick="moveBack()" WIDTH="100%" ALIGN="'+linkAlign+'"><DIV  ALIGN="'+linkAlign+'">&nbsp;<FONT CLASS="menu" style="color:'+linkFontColor+'">'+ssmItems[i][0]+'</font></DIV></LAYER></ILAYER></TD>')
			}	
		}
		document.write('</TR>')
	}
	document.write('<tr><td bgcolor="'+linkBGColor+'" height="'+(bottomHeight-4)+'">&nbsp;</td></tr>');
	document.write('</table>')
	if (NS6){document.write('</TD></TR></TABLE>')}
	if (IE||NS6) {document.write('</DIV></DIV>')}
	if (NS) {document.write('</LAYER></ILAYER></LAYER>')}

	//Start Submenu
	for(i=0;i<ssmItems.length;i++) {
		if(ssmItems[i][3]>0) {
			submenuHeight = ssmItems[i][3]*sublinkHeight;
			submenuTop = YOffset+buttonHeight+i*hdrHeight+2;
			if(submenuTop+submenuHeight > (YOffset+buttonHeight + (ssmItems.length)*hdrHeight)) {
				submenuTop = YOffset+buttonHeight+(i+1)*hdrHeight-submenuHeight+2
			};
			divId = 'submenu' + i;
			document.write('<div id="'+divId+'" style="visibility:hidden;Position : Absolute ;Left : '+(XOffset+menuWidth)+' ;Top : '+submenuTop+' ;Z-Index : 20;height:'+(submenuHeight)+'" onmouseover="moveOut();showSubMenu(\''+i+'\')" onmouseout="moveBack();hideSubMenu(\''+i+'\')" onclick="moveBack();hideSubMenu(\''+i+'\')">')
			document.write('<table border="0" cellpadding="0" cellspacing="0" height="'+(submenuHeight)+'" bgcolor="'+menuBGColor+'" style="table-layout:static;filter=progid:DXImageTransform.Microsoft.Alpha(opacity=80);">');
			for(j=0;j<ssmSubItems.length;j++) {
				if(ssmSubItems[j][0] == i) {
					document.write('<tr><td BGCOLOR="'+linkBGColor+'" HEIGHT="'+sublinkHeight+'" onclick="openPage(\''+ssmSubItems[j][2]+'\',\''+ssmSubItems[j][3]+'\')" onmouseover="bgColor=\''+linkOverBGColor+'\';window.status=\''+ssmSubItems[j][4]+'\'" onmouseout="bgColor=\''+linkBGColor+'\';window.status=\'\'" style="cursor:pointer;">&nbsp;&nbsp;<FONT CLASS="menu" style="color:'+linkFontColor+'">'+ssmSubItems[j][1]+'</font>&nbsp;&nbsp;</td></tr>')
				}
			}
			document.write('</table>')
			document.write('</div>')
		}
	}
	//End Submenu
	setTimeout('initSlide();', 1)
}
