/*
// onderkant main staat nu altijd op een vaste postie vanaf de onderkant van de pagina
var ie5 = (document.getElementById && document.all);
var ns6 = (document.getElementById && !document.all);

// de waarde vanaf de onderkant + laag.top
var topPos = 111;
var bottomPos = 100; // how much pixel before bottom 

function stayDown()
{
    if(ie5)
	{
	pageYOffset = document.body.scrollTop;
	innerHeight = document.body.offsetHeight;
	}
	if(ie5 || ns6)
	{
    mainLayer = document.getElementById('main');
	uitlegLayer = document.getElementById('uitleg');
	zoekenLayer = document.getElementById('zoeken');
	// main moet de goede hoogte hebben
	mainLayer.style.height = innerHeight - bottomPos -topPos;
	// uitleg sluit daar precies op aan
	uitlegLayer.style.top = innerHeight - bottomPos;
	// zoeken doet ook mee daar onderin
	zoekenLayer.style.top = innerHeight - 30;
	setTimeout ('stayDown()', 10);
	}
}
*/

var hoofdMenu = '';
var subMenu = '';
var aktief_hoofdstuk = '';
var aktieve_pagina = '';


function getCookie(the_info)

{
	// load the cookie into a variable and unescape it
	var the_cookie = document.cookie;
	var the_cookie = unescape(the_cookie);
	
	if (the_cookie.indexOf('$') == -1)
		{	
		hoofdMenu = 'Schoffelmeer Engineering';
		subMenu = 'introductie';
		}
	else
		{
		// separate the values from the cookie name
	
		var broken_cookie = the_cookie.split('$');
		var the_values = broken_cookie[1];
	
		// break each name:value pair into an array
	
		var separated_values = the_values.split('&');
	
		// loop through the list of name:values and load
		// up the associate array
	
		var property_value = '';
	
		for (var loop = 0; loop < separated_values.length; loop++)
			{
			property_value = separated_values[loop];
			var broken_info = property_value.split('=');
			var the_property = broken_info[0];
			var the_value = broken_info[1];
			the_info[the_property] = the_value;
			}
		
		hoofdMenu = cookie_information['hoofdMenu'];
		subMenu = cookie_information['subMenu'];
		}
}
var cookie_information = new Array();
getCookie(cookie_information);
		

// bepaald het huidige aktieve hoofdstuk
var huidigUrl = location.pathname.split('/');
//var base = 'http://' + window.location.hostname + '/';
//var base = 'http://localhost/sietse/';

function getString(the_info)
{
		var newString = unescape(location.search.substring(1));
		var separated_values = newString.split('&');
	
		// loop through the list of name:values and load
		// up the associate array	
		var property_value = '';
	
		for (var loop = 0; loop < separated_values.length; loop++)
			{
			property_value = separated_values[loop];
			var broken_info = property_value.split('=');
			var the_property = broken_info[0];
			var the_value = broken_info[1];
			the_info[the_property] = the_value;
			}
}

if (location.search.length > 0)
{
	var string_information = new Array();
	getString(string_information);
	
	aktieve_pagina = string_information['sub'];
	aktief_hoofdstuk = string_information['hoofd'];
}

// onMouseOver functie voor hoofdmenu
function turn_on(hoofdMenu,hoofdMenu2,subMenu)
	{
	if (hoofdMenu != '')
		{
		//window.alert('1');
		document.getElementById(hoofdMenu).color = '#BC903F';
		//document.getElementById(hoofdMenu+'_1').style.backgroundColor = '#988248';
		}
	if (hoofdMenu2 != '')
		{
		//window.alert('2');
		document.getElementById(hoofdMenu2).src = 'images/menuKnoppen/' + hoofdMenu2 + '_01.jpg';
		//document.getElementById(hoofdMenu).color = '#ffff00';
		}
	if (subMenu != '')
		{
		//window.alert('3');
		document.getElementById(subMenu).style.backgroundColor = '#666666';
		//document.getElementById(subMenu).style.color = '#B9B9B9';
		}
	}

// onMouseOut functie voor hoofdmenu met controle op huidige hoofdstuk.
// Het plaatje van het aktieve hoofdstuk moet namelijk niet terug naar de beginwaarde.
function turn_off(hoofdMenu,hoofdMenu2,subMenu)
	{
	 if ((hoofdMenu != '') && (aktief_hoofdstuk != hoofdMenu))
		{
		document.getElementById(hoofdMenu).color = '#FFFFFF';
		//document.getElementById(hoofdMenu+'_1').style.backgroundColor = '#010101';
		}
	if ((hoofdMenu2 != '') && (aktief_hoofdstuk != hoofdMenu2))
		{
		document.getElementById(hoofdMenu2).src = 'images/menuKnoppen/' + hoofdMenu2 + '.jpg';
		document.getElementById(hoofdMenu).color = '#0000cc';
		}	
	if ((subMenu != '') && ('sub' + aktieve_pagina != subMenu))
		{
		document.getElementById(subMenu).style.backgroundColor = '#B9B9B9';
		document.getElementById(subMenu).style.color = '#666666';
		}
	}


function setCookie(deString)
{
	var deString = deString + 'path=/;';
	document.cookie = deString;
}

function vindId(exVar)
{
	var newWords = exVar.split("&");
	// set de gevonden teksten als variabele
	var isSamenHoofd = newWords[0];
	var isSamenSub = newWords[1];
	var isLosHoofd = isSamenHoofd.split('=');
	var isLosSub = isSamenSub.split('=');
	hetIdHoofd = isLosHoofd[1];
	hetIdSub = isLosSub[1];

	return hetIdHoofd;
	return hetIdSub;
}

// onClick functie voor hoofdmenu
function go_to(hoofdMenu,subMenu,exVar)
{
	var pagina = hoofdMenu;
	// als het subMenu niet leeg is moet je de waarde als gekozen pagina nemen
	if (subMenu != '')
		{
		hoofdStuk = hoofdMenu;
		pagina = subMenu;
		}
	if (exVar != '')
		{
		vindId(exVar);
		hoofdMenu = hetIdHoofd
		subMenu = hetIdSub
		}

	var deString = 'menuwaardes$hoofdMenu=' + hoofdMenu + '&' + 'subMenu=' + subMenu + ';';
	setCookie(deString);
	window.location.replace(base + hoofdStuk + '/' + pagina + '.htm' + exVar); 
}


function herstelMenu()
{		
		if (hoofdMenu != '')
		{
		document.getElementById(hoofdMenu).src = 'images/menuKnoppen/' + hoofdMenu + '_01.jpg';
		}
		if ((subMenu != '') && (document.getElementById('sub' + subMenu) != null))
		{
		document.getElementById('sub' + subMenu).style.backgroundColor = '#666666';
		document.getElementById('sub' + subMenu).style.color = '#B9B9B9';
		}
}

// Open nieuw window 
function newWindow(file,window,hoogte,breedte) 
{
	var w = 1024, h = 768;
	if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
	}
	var popW = breedte, popH = hoogte;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
    msgWindow=open(file,window,'resizable=yes ,scrollbars=yes, width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
    if (msgWindow.opener == null) msgWindow.opener = self;
}

/*
// popup functionaliteit

var ie5 = (document.getElementById && document.all);
var ns6 = (document.getElementById);

var loaded = false;
var wissel = '';

function schrijfLayer(layerId,plaatje)
{
	if ((wissel != '') && (wissel == layerId))
		{
		document.getElementById('popUpDiv').innerHTML = '';
		wissel = '';
		}
	else
		{
		document.getElementById('popUpDiv').innerHTML = '<div id=' + layerId + ' style="position:absolute; z-index:44; visibility:visible;	padding:8px; background-color: #FFFFFF; layer-background-color: #FFFFFF;"><a href="javascript:schrijfLayer(\'' + layerId + '\');"><img src="' + plaatje + '" border="1"></a></div>'
	
		wissel = layerId;
		divs = document.getElementsByTagName("div");
	
		if (ie5)
			{
			innerWidth = document.body.clientWidth;
			innerHeight = document.body.clientHeight;
			pageXOffset = document.body.scrollLeft;
			pageYOffset = document.body.scrollTop;
			}
				
			divs[layerId].style.left = pageXOffset + innerWidth/2 - divs[layerId].offsetWidth/2;
			divs[layerId].style.top = pageYOffset + innerHeight/2 - divs[layerId].offsetHeight/2;
		}
}

*/

