<!--

//====================== Browser checks
var os = navigator.platform.toLowerCase(); 
var agt = navigator.userAgent.toLowerCase(); 
var IE5 = false;
if ((os.indexOf('win') != -1) && (agt.indexOf("msie 5.0")!=-1)) {
	var IE5 = true;
}
var IE = (document.all && document.getElementById) ? true:false;
var Opera = window.opera ? true : false;
newSession = true;
//====================== 

//====================== Functions that are triggered onload are collected in the init() function:
init = function(){
	
	checkWidth();
	//refineQuery();
	//new limitList();  //more knopje onder ul lijst
	new subItems();
	submitRollovers();
	toTopLink();
	//addWebtrendsCodeToAnchors();
}
//======================
//======================
getBrowserWidth = function(){
	if (window.innerWidth){
		return window.innerWidth;}	
	else if (document.documentElement && document.documentElement.clientWidth != 0){
		return document.documentElement.clientWidth;	}
	else if (document.body){return document.body.clientWidth;}		
		return 0;
};
checkWidth = function(){
	var browserWidth = getBrowserWidth();
	var illu = document.getElementById('page-illustration');
	if (browserWidth < 1000){
		adjustPageLayout("higher-res",0);
		if(IE && !(Opera)) { adjustPageLayout("higher-res-ie",0); }
	}
	if (browserWidth >= 1000){
		adjustPageLayout("higher-res",1);
		if(IE && !(Opera)) { adjustPageLayout("higher-res-ie",1); }
	}
};

adjustPageLayout = function(description,on_off){
   var link_elts = document.getElementsByTagName("link");
   for(var i=0; i<link_elts.length; i++){
	if(link_elts[i].getAttribute("title") == description && on_off == 0){link_elts[i].disabled = true;}
	if(link_elts[i].getAttribute("title") == description && on_off == 1){
		link_elts[i].disabled = false; 
		if(IE){  }
	}
	}
};

setCssAttributesForIE = function(){
	var link_elts = document.getElementsByTagName("link");
	for(var i=0; i<link_elts.length; i++){
		if(link_elts[i].getAttribute("title")=="higher-res") { link_elts[i].disabled = true; }
		if(link_elts[i].getAttribute("title")=="higher-res-ie") { link_elts[i].disabled = true; }
	}
};

if(IE && !(Opera)) { setCssAttributesForIE(); }

checkWidth();
//======================

//====================== Call functions at Onload-event:
window.onload = function() {
	init();	
}
//====================== 
//====================== Call functions at Onresize-event:
window.onresize = function() {
	checkWidth();
	toTopLink();
}
//====================== find input elements with the class name 'submit' and 
//====================== assign a rollover image to them
function submitRollovers() {
	this.buttons = new Array;
	// find the 'content-middle' div
	var startNode = document.getElementById('content-section');
	var candidates = startNode.getElementsByTagName('input');
	for (var i=0; i<candidates.length; i++) {
		if (candidates[i].className == 'submit') {
			this.imgName = candidates[i].src;
			this.buttons[this.buttons.length] = new Button(this,candidates[i],this.imgName);
		}
	}
}
Button = function(buttons,subButton,imgName) {
	this.buttons = buttons;
	this.subButton = subButton;
	this.imgName = imgName;
	this.imgNameOver = this.imgName.replace('.gif','-over.gif');
	this.imgName.Button = this;
	this.imgNameOver.Button = this;	
	this.subButton.Button = this;
	this.subButton.onmouseover = function() {
		this.Button.rollOver(true);
		return true;
	}
	this.subButton.onmouseout = function() {
		this.Button.rollOver(false);
		return true;
	}
}
// toggle rollover images
Button.prototype.rollOver = function(action) {
	if (action) {
		this.subButton.src = this.imgNameOver;
	}
	else
		{
		this.subButton.src = this.imgName;
	}
}
//====================== 
//====================== Hide all 'query-steps' and reveal them after the submit button is clicked
function refineQuery() {
	this.hiddenDivs = new Array;
	this.submitButtons = new Array;
	this.divArr = new Array;
	// find the 'content-middle' div
	var startNode = document.getElementById('content-middle');
	var candidates = startNode.getElementsByTagName('div');
	var counter = 0;
	for (var c=0; c<candidates.length; c++) {
		// inside 'content-middle' div, look for all divs with className 'query-step'
		if (candidates[c].className == 'query-step') {
			var divElements = candidates[c].getElementsByTagName('input');
			for (var i=0; i<divElements.length; i++) {
				// and inside 'query-step' divs, find submit buttons
				if (divElements[i].className == 'submit') {
					this.submitButtons[this.submitButtons.length] = divElements[i];
				}
			}
			// if there's no submit button in the div, set the variable to 0 to avoid errors
			if (!this.submitButtons[counter]) {
				submitButton = 0;
			}
			else {
				submitButton = this.submitButtons[counter];
			}
			this.divArr[this.divArr.length] = candidates[c];
			this.hiddenDivs[this.hiddenDivs.length] = new hiddenDiv(this,candidates[c],submitButton,counter,this.divArr);
			counter++;
		}
	}
}
// collecton of div objects
hiddenDiv = function(refineQuery,div,submitButton,num,array) {
	this.refineQuery = refineQuery;
	this.div = div;
	this.submitButton = submitButton;
	this.num = num;
	this.array = array;
	this.hiddenDiv = this;
	this.hiddenDiv.initDivs();
	this.submitButton.hiddenDiv = this;
	this.submitButton.onclick = function() {
		this.hiddenDiv.showNext();
		toTopLink();
		return false;
	}
}
// set up the div's visibility for the first time
hiddenDiv.prototype.initDivs = function() {
	// hide all divs except for the first
	if (this.num > 0) {
		this.div.className = "hidden";
	}	
}
// change the next div's class to 'query-step', which makes it visible!
hiddenDiv.prototype.showNext = function() {
	this.array[this.num + 1].className = "query-step";
}
//====================== 
//====================== limit the number of items displayed in a list, 
//====================== and hide and reveal them when 'more' and 'less' buttons are clicked
//====================== the amount of items displayed is defined by the classname in the html
limitList = function() {
	this.listItems = new Array;
	this.controls = new Array;
	// find the 'content-middle' div
	var startNode = document.getElementById('content-middle');
	var candidates = startNode.getElementsByTagName('ul');
	for (var c=0; c<candidates.length; c++) {
		// inside 'content-middle' div, look for all lists with className 'expander'
		if (candidates[c].className == 'expander') {
			var listElements = candidates[c].getElementsByTagName('li');
			for (var i=0; i<listElements.length; i++) {
				if (listElements[i].className.indexOf('show') != -1) {
					this.more = listElements[i];
					this.cName = listElements[i].className;
				}
				else if (listElements[i].className ==  'hidden') {
					this.less = listElements[i];
				}
				else {
					this.listItems[this.listItems.length] = listElements[i];
				}
			}
			this.controls[this.controls.length] = new Control(this,this.more,this.cName,this.less,this.listItems);
		}
		// delete the old array and make a new empty one for the next 'expander' list
		this.listItems = null;
		this.listItems = new Array;
	}
}
Control = function(limitList,more,cName,less,listItems) {
	this.limitList = limitList;
	this.more = more;
	this.cName = cName;
	this.less = less;
	this.listItems = listItems;
	this.more.Control = this;
	this.cName.Control = this;
	this.less.Control = this;
	this.listItems.Control = this;
	this.Control = this;
	// get the number of items to be displayed out of the classname
	this.cnArr = cName.split('show');
	this.amount = this.cnArr[1];
	this.Control.hideItems();
	this.more.onclick = function () {
        this.Control.showItems();
		toTopLink();
        return false;
    }
	this.less.onclick = function () {
		this.Control.hideItems();
		toTopLink();
		return false;
	}
}
Control.prototype.hideItems = function () {
	for (var c=this.amount; c<this.listItems.length; c++) {
		// we use the style property here instead of classname because
		// some list items may have classnames like 'download'
		this.listItems[c].style.display = 'none';
		this.more.className = 'less-list';
		this.less.className = 'hidden';
	}
}
Control.prototype.showItems = function () {
	for (var c=this.amount; c<this.listItems.length; c++) {
		this.listItems[c].style.display = "block";
		this.more.className = 'hidden';
		this.less.className = 'more-list';
	}
}
//====================== 
//====================== find list items with sub-items 
//====================== and hide and reveal them when 'more' and 'less' buttons are clicked
//====================== the amount of items displayed is defined by the classname in the html
function subItems() {
	// get all the able items within the enabled and put them in an array
	// array for all list items
	this.posItems = new Array();
	var startNode = document.getElementById('submap');
	if (!startNode) {
		return false;
	}
	// if submap exists
	else {
		// find all possible nested unordered lists
		// first get all unordered lists
		var arrItems = startNode.getElementsByTagName('ul');
		for (var i=0; i<arrItems.length; i++){
			// get the parent element (li)
			this.parentItem = arrItems[i].parentNode;
			if (this.parentItem.tagName == 'LI') {
				// and the link inside it (a)
				this.linkItem = this.parentItem.firstChild;
				//if the linkItem really is a link
				if (this.linkItem.tagName == 'A') {
					this.listItem = this.linkItem.parentNode;
					this.posItems[this.posItems.length] = new menuItem(this,this.linkItem,this.listItem);
				}
			}
		}
	}
}
menuItem = function(menu,linkItem,listItem) {
	this.menu = menu;
	this.linkItem = linkItem;
	this.listItem = listItem;
	this.linkItem.menuItem = this;
	this.setStyles();
	this.linkItem.onclick = function() {
		this.menuItem.toggle();
        return false;
	}
}
/* apply sub style to links to submenus */
menuItem.prototype.setStyles = function() {
	this.listItem.className = 'close-list';
}
menuItem.prototype.toggle = function() {
	if (this.listItem.className != 'close-list') {
		this.listItem.className = 'close-list';
	}
	else if (this.listItem.className == 'close-list') {
		this.listItem.className = 'sub-list';
	}
}
//====================== 
//====================== find the 'to-top' link and hide it if it's not needed 
//====================== activated on load, resize and by functions refineQuery, limitList
function toTopLink() {
	var topList = document.getElementById('to-top');
	if (!topList) {
		return false;
	}
	else {
		var browserHeight = getBrowserHeight();
		//var documentHeight = getDocumentHeight();
		/*if (documentHeight - browserHeight == '0') {
			topList.className = 'off';
		}
		else {
			topList.className = 'on';
		}*/
		var contentHeight = getContentHeight();
		if (contentHeight < browserHeight) {
			topList.className = 'off';
		}
		else {
			topList.className = 'on';
		}
	}
}
function getBrowserHeight() {
	if (window.innerHeight) {
		return window.innerHeight;
	}	
	else if (document.documentElement && document.documentElement.clientHeight != 0) {
		return document.documentElement.clientHeight;
	}
	else if (document.body) {
		return document.body.clientHeight;
	}		
	return 0;
}
// unused
function getDocumentHeight() {
	if (document.all) {
		return document.body.offsetHeight;
	}
	else {
		return document.getElementsByTagName("html")[0].offsetHeight;
	}
}
function getContentHeight() {
	var headSec = document.getElementById('header-section').offsetHeight;
	var conSec = document.getElementById('content-section').offsetHeight;
	var footSec = document.getElementById('footer-section').offsetHeight;
	var contentHeight = headSec + conSec + footSec;
	return contentHeight;
}

// Webtrends code 
// Webtrends code 
function addHandler(obj, evt, newhandler, captures) 
{ 
 if (obj.attachEvent) 
  obj.attachEvent('on' + evt, newhandler); 
 else if (obj.addEventListener) 
  obj.addEventListener(evt, newhandler, captures); 
 /*else 
 { 
  var oldhandler; 
  if (oldhandler = obj['on' + evt]) 
   obj['on' + evt] = function() 
   { 
    newhandler();
    oldhandler();  
   } 
  else obj['on' + evt] = newhandler; 
 }*/ 
} 

function RegisterExit(e,x) {
	e = e || window.event;
	x = x || this;
	var elem;
	if(e.srcElement) 
	{
		elem = e.srcElement;
		if(elem.href+""=="undefined")
			elem = e.srcElement.parentNode;
		if(elem.href+""=="undefined")
			elem = e.srcElement.parentNode.parentNode;
	}
	else{
		elem = x;}

	dcsMultiTrack('DCS.dcsuri', '', 'DCS.dcsqry', '', 'WT.cg_n', '', 'DCS.dcssip', elem.href.substring(7), 'WT.ti', 'Exit Link'); 
}

function RegisterDownload(e,x) {
	e = e || window.event;
	x = x || this;
	var elem;
	if(e.srcElement) 
	{
		elem = e.srcElement;
		if(elem.href+""=="undefined")
			elem = e.srcElement.parentNode;
		if(elem.href+""=="undefined")
			elem = e.srcElement.parentNode.parentNode;
	}
	else
		elem = x;
	dcsMultiTrack('DCS.dcsuri', 'downloads/'+RemoveHTML(elem.innerHTML)+'.pdf', 'WT.ti', RemoveHTML(elem.innerHTML)); 
}

function RegisterMail(e,x) {
	e = e || window.event;
	x = x || this;
	dcsMultiTrack('DCS.dcsuri', window.location.pathname, 'WT.ti', 'Mail: '+document.title, 'DCSext.actie', 'Mail'); 
}

function RegisterPrint(e,x) {
	e = e || window.event;
	x = x || this;
	dcsMultiTrack('DCS.dcsuri', window.location.pathname, 'WT.ti', 'Print: '+document.title, 'DCSext.actie', 'Print'); 
}


function RemoveHTML( strText )
{
	var regEx = /<[^>]*>/g;
	return strText.replace(regEx, "");
}

function addWebtrendsCodeToAnchors()
{
var anchorColl = document.links;
var href = "";
var touched = false;
var temp="";

for (i=0; i<anchorColl.length;i++ ) {
	
	href= anchorColl[i].href+"";
	touched = false;

	if(anchorColl[i].onclick != null)
	{
		if(String(anchorColl[i].onclick).indexOf('dcsMultiTrack')>-1)
			touched=true;
	}


	if (!touched && href.indexOf('dsresource?')>-1)
	{
		addHandler(anchorColl[i], 'click', RegisterDownload, false);
		touched=true;
	}

	if (!touched && anchorColl[i].innerHTML.indexOf('Stuur door')==0)
	{	
		addHandler(anchorColl[i], 'click', RegisterMail, false);
		touched=true;
	}
	if (!touched && anchorColl[i].innerHTML.indexOf('Print')==0)
	{
		addHandler(anchorColl[i], 'click', RegisterPrint, false);
		touched=true;
	}
	
	if(!touched && href.length>0 && href.indexOf(window.location.protocol + "//" + window.location.host)!=0)
	{
		addHandler(anchorColl[i], 'click', RegisterExit, false); 
	}
}
}
//-->
