var arr_vert_menu = new Array();
var arr_hor_menu = new Array();
var arr_links = new Array();

function gohome()
{
	document.location.href = "default.htm?Home.htm";
}
function getcontact()
{
	document.location.href = "default.htm?Contact.htm";
}
function changeIcon(id, chr)
{			
	var img = document.getElementById("img_" + id.split("_")[1]);	
	img.src = "images/menu/menu_" + chr + ".gif";
}
function startup()
{
	var_url = document.location.href.split("?");	
	if (var_url.length == 1){
		str_url = "home.htm";
	}
	else{
		str_url = var_url[1];
	}
	var obj = frames.iframe_content;
	obj.location.href = "content/" + str_url;
	status = "Huidige pagina: " + str_url.split(".")[0];
	build_hor_menu();
	build_vert_menu();
	build_links();
}

function build_vert_menu()
{			
	var arr_menu = arr_vert_menu;
	var srcTd = getSourceTd("td_vert_menu");
	var tbl = document.createElement('TABLE');
	var tblBdy = document.createElement('TBODY');
	var nwTr, nwTd, nwImg, nwLink;
	
	for(var i=0; i < arr_menu.length; i++){
		arr_item = arr_menu[i].split("|");
		str_menu = arr_item[0];
		str_link = arr_item[1];
		
		nwTr = document.createElement('TR');
		nwTd = document.createElement('TD');
		nwImg = document.createElement('IMG');		
		
		nwImg.id = 'img_' + i;
		nwImg.src = "images/menu/menu_i.gif";
		
		nwTd.appendChild(nwImg);
		nwTr.appendChild(nwTd);
		
		nwTd = document.createElement('TD');
		nwTd.id = 'td_' + i;		
		setClassName(nwTd, 'vert_menu');
		
		nwTd.onmouseover = function(){this.style.cursor='hand'; changeIcon(this.id, 'o');};
		nwTd.onmouseout = function(){this.style.cursor='pointer'; changeIcon(this.id, 'i');};
		
		nwLink = document.createElement('A');
		setClassName(nwLink, 'vert_menu');
		nwLink.href = "default.htm?" + str_link;
		
		nwLink.appendChild(document.createTextNode(str_menu));
		
		nwTd.appendChild(nwLink);
		nwTr.appendChild(nwTd);
		
		nwTd = document.createElement('TD');
		nwTd.height = 5;
		
		nwTr.appendChild(nwTd);
		tblBdy.appendChild(nwTr);
	}
	
	
	tbl.appendChild(tblBdy);
	srcTd.appendChild(tbl);
}


function build_hor_menu()
{
	var arr_menu = arr_hor_menu;
	var srcTd = getSourceTd("td_hor_menu");
	var tbl = document.createElement('TABLE');
	var tblBdy = document.createElement('TBODY');
	var nwTr = document.createElement('TR');
	var nwTd, nwSep, nwLink;
		
	for(var i = 0; i < arr_menu.length; i++){
		arr_item = arr_menu[i].split("|");		
		str_menu = (arr_item[0].split('/').length > 1) ? arr_item[0].split('/')[0] : arr_item[0];		
		str_link = arr_item[1];
				
		nwTd = document.createElement('TD');
		setClassName(nwTd, 'hor_menu');			
		
		nwLink = document.createElement('A');
		setClassName(nwLink, 'hor_menu');
		nwLink.href = 'default.htm?' + str_link;
		
		nwLink.appendChild(document.createTextNode(str_menu));
		nwTd.appendChild(nwLink);
		nwTr.appendChild(nwTd);
		
		if (i < arr_menu.length){			
			var blnSep = false;			
			
			if(arr_item[0].split('/').length > 1){				
				nwSep = document.createElement('IMG');
				nwSep.src = 'images/menu/menu_scheiding.gif';
				nwSep.border = 0;
								
				blnSep = true;
			}
			else{				
				if(i != (arr_menu.length - 1)){
					nwSep = document.createTextNode('|');
					blnSep = true;
				}
					
			}
			
			if(blnSep){
				nwTd = document.createElement('TD');
				setClassName(nwTd, 'hor_menu');
				nwTd.appendChild(nwSep);
				nwTr.appendChild(nwTd);
			}
		}		
		
	}
	tblBdy.appendChild(nwTr);
	tbl.appendChild(tblBdy);
	srcTd.appendChild(tbl);
}

function build_frame()
{
	document.writeln("<iframe name='iframe_content' frameborder='0' src='' style='width: 100%; height: 100%; margin-left: 0px; margin-right: 0px; margin-top: 0px; margin-bottom: 0px; scrolling: auto;'></iframe>");
}

function build_links()
{
	var srcTd = getSourceTd('td_links');
	var tbl = document.createElement('TABLE');
	var tblBdy = document.createElement('TBODY');
	var nwTr, nwTd, nwImg, nwLink;
	
	for(var i = 0; i < arr_links.length; i++){
		arr_item = arr_links[i].split("|");
		str_menu = arr_item[0];
		str_image = arr_item[1]
		str_link = arr_item[2];
		
		nwTr = document.createElement('TR');
		nwTd = document.createElement('TD');
		nwLink = document.createElement('A');
				
		
		nwLink.title = str_menu;
		setClassName(nwLink, 'vert_menu');
		nwLink.href= str_link;
		nwLink.target = '_blank';
		
		nwImg = document.createElement('IMG');
		
		nwImg.border = 0;
		nwImg.src = 'images/links/' + str_image;		
		
		nwLink.appendChild(nwImg);
		nwTd.appendChild(nwLink);
		nwTr.appendChild(nwTd);			
		tblBdy.appendChild(nwTr);
		
		nwTr = document.createElement('TR');
		nwTd = document.createElement('TD');
		nwTd.height = 5;
		
		nwTr.appendChild(nwTd);
		tblBdy.appendChild(nwTr);		
	}
	tbl.appendChild(tblBdy);
	srcTd.appendChild(tbl);
}


function getSourceTd(strId)
{
	return (document.all) ? document.all[strId] : document.getElementById(strId);
}

function setClassName(obj, strClass)
{
	if(document.all){
		obj.className = strClass;
	}
	else{
		obj.setAttribute('class', strClass);
	}
}	
