<!--
//====================== Browser checks
var os = navigator.platform.toLowerCase();
var agt = navigator.userAgent.toLowerCase();
var IE5 = false;
var IE55 = false;
var Safari = false;
if ((os.indexOf('win') != -1) && (agt.indexOf("msie 5.0")!=-1)) {
	var IE5 = true;
}
if ((os.indexOf('win') != -1) && (agt.indexOf("msie 5.5")!=-1)) {
	var IE55 = true;
}
if ((os.indexOf('win') != -1) && (agt.indexOf("msie 6")!=-1)) { // ie6 sniffer added 13 nov 2007
	var IE6 = true;
}
if ((os.indexOf('win') != -1) && (agt.indexOf("msie 7")!=-1)) { // ie7 sniffer added 15 nov 2006
	var IE7 = true;
}
if (agt.indexOf("safari")!=-1) {
	var Safari = true;
}
var IE = (document.all && document.getElementById) ? true:false;
var Opera = window.opera ? true : false;
//======================

//====================== Functions initalised on page load
function init(){
	if ((IE) && (!Opera) && (!IE7)) { // ie7 added 15 nov 2006
		scalePage();
	}
	if ((IE) && (!Opera) && (!IE5)) {
		mainNavigation();
	}
	swapWidthMenuItem();
	tableRowHover();
	clearSearchField();
	formButtonRollovers();
	SelectChangeStyle();
	captureClick();
	//if	(document.getElementById("tabs")){
		tabsOpenClose();
	//}
	if(document.getElementById("redirect-button")){
		addRedirectFunct();
	}
	ClickOnThumbstone();
	externalLinks();
}
window.onload = function() {
	//checken of stylesheets disabled zijn met offsetLeft++++++++++++++++++++++++
	//+++++++++++++++++++++++++++++++++++++++++++++++
	if(document.getElementById("meta-nav").offsetLeft>200){
		init();
	}
	if(!IE || (IE && Opera)) { realignMenu(); }
}
//======================

//====================== Functions initalised on page resize
window.onresize = function() {
	checkDropDowns();
	swapWidthMenuItem();
	if((IE) && (!Opera) && (!IE7)){  // ie7 added 15 nov 2006
		scalePage();
	}
	if(!IE || (IE && Opera)) { realignMenu(); }
}
//======================

/*======================
ppkpatch 061109:
1) liArr weer leeggooien tegen memory leaks in IE6 (Kees van Rabobank)
2) tablerow (nodeList met alle table rows erin) wordt ontdaan van mouseover en mouseout
3) Links in alt-dropdowns (zoals op de homepage) worden ontdaan van mouseover, mouseout en click

Additions to prevent more memory leaks are made by Johan Huijkman (Eden)"
4) onmouseover and onmouseout action set for input with className="button" are trashed
5) onclick's for tombstones are trashed
6) onclick's for tabs are trashed

====================== */
window.onunload = function ()  {
 if (this.liArr != null) {
  for (var c = 0; c < this.liArr.length; c++) {
   //this.liArr[c].close ();
   this.liArr[c] = null;
  }
 }
 this.liArr = null;
 for (var i=0;i<tablerow.length;i++) {
  tablerow[i].onmouseover = null;
  tablerow[i].onmouseout = null;
 }
 tablerow = null;
 var allDivs = document.getElementsByTagName('div');
 for (var i=0;i<allDivs.length;i++) {
  if (!(allDivs[i].className == "alt-dropdown" || allDivs[i].className =="tombstone" || allDivs[i].className =="tab")) continue;
  if(allDivs[i].className == "alt-dropdown"){
   var allLinks = allDivs[i].getElementsByTagName('a');
   for (var j=0;j<allLinks.length;j++) {
    allLinks[j].onmouseover = null;
    allLinks[j].onmouseout = null;
    allLinks[j].onclick = null;
   }
  }
  /* Addition 5) and 6) to this function made by Johan Huijkman (Eden) */
  if(allDivs[i].className == "tombstone"){ allDivs[i].onclick = null; }
  if(allDivs[i].className == "tab"){ allDivs[i].onclick = null; }
 }
 /* Addition 4) to this function made by Johan Huijkman (Eden) */
 if(document.getElementById("main-content")){
	 var startNode = document.getElementById("main-content");
	 var allInputs = startNode.getElementsByTagName("input");
	 for (var i=0; i<allInputs.length; i++) {
	  if(allInputs[i].className.indexOf("button") == -1) continue;
	  allInputs[i].onmouseover = null;
	  allInputs[i].onmouseout = null;
	 }
 }
}

//====================== This function finds the initial window width and adjusts
//====================== the page layout to avoid jumping on pageload
var initialWidth;
if ((IE) && (!Opera) && (!IE7)) {  // ie7 added 15 nov 2006
	initialWidth = winWidth();
	firstWidth(initialWidth);
}

function firstWidth(initialWidth) {
	var minWidth = 770;
	var maxWidth = 960;
	var pageWidth;
	var indent = (initialWidth - maxWidth)/2;
	indent > 0 ? indent = (indent-8) +"px":indent = 0;
	if (initialWidth < minWidth) {
		pageWidth = minWidth + "px";
	}
	else if (initialWidth > maxWidth) {
		pageWidth = maxWidth + "px";
	}
	else if ((initialWidth > minWidth) && (initialWidth <= maxWidth)) {
		pageWidth = "100%";
	}
	var pLeft="padding-left:"+indent+";";
	var pWidth="width:" + pageWidth + ";";
	createStyleRule("#container", pLeft);
	createStyleRule("#container", pWidth);
	//alert(pLeft + pWidth);
}
//======================

//====================== This function defines maximum and minimum page widths
//====================== for internet explorer only
function scalePage() {
	var minWidth = 770;
	var maxWidth = 960;
	var wid = document.body.offsetWidth;
	var indent = (wid - maxWidth)/2;
	if (indent > 0) { // centre page
		document.getElementById("container").style.paddingLeft = indent + "px";
	}
	if (wid < minWidth) {
		document.getElementById("container").style.width = minWidth + "px";
	}
	else if (wid > maxWidth) {
		document.getElementById("container").style.width = maxWidth + "px";
	}
	else if ((wid > minWidth) && (wid <= maxWidth)) {
		document.getElementById("container").style.width = "100%";
	}
}
//====================== The function realignMenu() is used in All browsers except IE;
//====================== It repositions the last two menu items when width of browserwindow is lower than a specific amount of pixels (830).
//====================== The last two menu itmes will open to the left the instead of right;

function realignMenu() {
	var wid = document.body.offsetWidth;
	if (wid < 880) {
		createStyleRule("#main-nav ul li#nav04:hover ul", "left:-178px;");
		createStyleRule("#main-nav ul li#nav05:hover ul", "left:-159px;");
		createStyleRule("#main-nav ul li#nav06:hover ul", "left:-124px;");
		createStyleRule("#main-nav ul li#nav07:hover ul", "left:-190px;");
		createStyleRule("#main-nav ul li#nav05 li a", "width:190px;");
        // news-teaser needs to be adjusted to prevent it from floating to the left side.
        createStyleRule("#main-content .theme-columns .news-teaser", "width:29.42%;");
        createStyleRule("#main-content .news-teaser.highlight", "width:49%;");
        createStyleRule("#main-content .news-teaser.right", "width:49.26%;");


	} else {
		createStyleRule("#main-nav ul li#nav05 li a", "width:auto;");
		createStyleRule("#main-nav ul li#nav04:hover ul", "left:-1px;");
		createStyleRule("#main-nav ul li#nav05:hover ul", "left:-1px;");
		createStyleRule("#main-nav ul li#nav06:hover ul", "left:-1px;");
		createStyleRule("#main-nav ul li#nav07:hover ul", "left:-1px;");

        createStyleRule("#main-content .theme-columns .news-teaser", "width:31.2%;");
        createStyleRule("#main-content .news-teaser.highlight", "width:50%;");
        createStyleRule("#main-content .news-teaser.right", "width:49.5%;");
	}
}
//====================== If width of browserwindow <800px change width of menu-item "Financial Institutions":

function swapWidthMenuItem(){
	if(!document.getElementById("nav02")) return;
	var menuItem = document.getElementById("nav02");
	var wid = document.body.offsetWidth;
	if (wid < 800){
		if(menuItem.className.indexOf("short")<0 && menuItem.className.indexOf("current")>=0 && IE6){
			menuItem.className = menuItem.className.replace("current", "current-short");
			if(IE) menuItem.parentObj.originalClass = menuItem.parentObj.originalClass.replace("current", "current-short");
		} else if(menuItem.className.indexOf("short")<0) {
			menuItem.className += " short";
			if(IE) menuItem.parentObj.originalClass += " short";
		}

	} else {
		if(menuItem.className.indexOf("current-short")>=0){
			menuItem.className = menuItem.className.replace("current-short", "current");
			if(IE) menuItem.parentObj.originalClass = menuItem.parentObj.originalClass.replace("current-short", "current");
		} else if(menuItem.className.indexOf("short")>=0){
			menuItem.className = menuItem.className.replace("short","");
			if(IE) menuItem.parentObj.originalClass = menuItem.parentObj.originalClass.replace("short","");
		}
	}
}
//====================== This function applies rollover functionality to the main (top) navigation bar
//====================== for internet explorer only
//if (window.addEventListener) window.addEventListener( "load", mainNavigation, false );

function mainNavigation() {
	this.liArr = new Array;
	// get top level UL
	var topLevelUL = document.getElementById("main-nav").getElementsByTagName("UL")[0];
	// get all lis
	var topLevelLIs = topLevelUL.getElementsByTagName("LI");
	for (var c=0; c < topLevelLIs.length; c++) {
		// exclude nested list items, so only those on the top level are collected
		if (topLevelLIs[c].parentNode.parentNode.tagName != "LI") {
			// get first unordered list if it exists
			this.secondLevelUL = topLevelLIs[c].getElementsByTagName("UL")[0];
			var widest = 190;
			this.liArr[this.liArr.length] = new menuItem(this, this.menu, topLevelLIs[c], this.secondLevelUL);
		}
	}
}

// previous menu item
var previousListItem;
var time;
menuItem = function (mainNavigation, menu, listItem, listContents) {
	this.mainNavigation = mainNavigation;
	this.listItem = listItem;
	listItem.parentObj = this;
	this.originalClass = this.listItem.className;
	this.listContents = listContents;
	this.listItem.menuItem = this;

	//this.time; // this will be the amount of time the menu stays visible
	this.closetime; // allows us to clear the timer function

	previousListItem = this.listItem; // set the previousListItem on load

	this.listItem.onmouseover = function () {
		if (listContents) {
			this.menuItem.timeMouseover();
		}
		return true;
	}
	this.listItem.onmouseout = function () {
		if (listContents) {
			this.menuItem.timeMouseout();
		}
		previousListItem = listItem;
		return true;
	}
}

menuItem.prototype.timeMouseover = function () {
	clearTimeout(this.closetime);
	if(previousListItem.className.indexOf("current")>-1){
		if(previousListItem.className.indexOf("current-short")>=0) previousListItem.className = "current-short";
		else if(previousListItem.className.indexOf("short")>=0) previousListItem.className = "current short";
		else previousListItem.className = "current";
	} else {
		if(previousListItem.className.indexOf("current-short")>=0) previousListItem.className = "current-short";
		else if(previousListItem.className.indexOf("short")>=0) previousListItem.className = "short";
		else previousListItem.className = "";
	}
                   // added browser detect (mg 02-01-2008)
	if ((previousListItem.getElementsByTagName("iframe")[0]) && (IE) && (!Opera) && (!IE7)) {
		removeIframeLayer(previousListItem);
	}
	var bwid = document.body.offsetWidth;
	if(bwid<880 && (this.listItem.id=="nav04"||this.listItem.id=="nav05"||this.listItem.id=="nav06"||this.listItem.id=="nav07")){
		this.listItem.className = this.originalClass + " hover-reversed";
	} else {
		this.listItem.className = this.originalClass + "hover";
	}
                   // added browser detect (mg 02-01-2008)
	if ((this.listContents) && (IE) && (!Opera) && (!IE7)) {
		createIframeLayer(this.listContents);
	}
}

menuItem.prototype.timeMouseout = function () {
	if (previousListItem == this.listItem) {
		time = 300;
	}
	else {
		time = 0;
	}
	var me = this; // we have to assign 'this' to a variable
					// because setTimeout has global scope
					// and this.listItem is local
	this.closetime = setTimeout(function() {
		if(me.listItem.className.indexOf("current")>-1){
			if(me.listItem.className.indexOf("current-short")>=0) me.listItem.className = "current-short";
			else if(me.listItem.className.indexOf("short")>=0) me.listItem.className = "current short";
			else me.listItem.className = "current";
		} else {
			if(me.listItem.className.indexOf("current-short")>=0) me.listItem.className = "current-short";
			else if(me.listItem.className.indexOf("short")>=0) me.listItem.className = "short";
			else me.listItem.className = "";
		}
                // added browser detect (mg 02-01-2008)
    	if ((me.listContents) && (IE) && (!Opera) && (!IE7)) {
			removeIframeLayer(me.listContents);
		}
	}, time);
}
//======================

//====================== These functions creates/remove an iframe 'mask' underneath dropdown lists in main nav
//====================== for internet explorer only
function createIframeLayer(menu) {
    var layer = document.createElement('iframe');
    layer.tabIndex = '-1';
    layer.src = 'javascript:false;';
	menu.parentNode.appendChild(layer);
	// make the iframe the same size and position as the dropdown
    layer.style.left = menu.offsetLeft + 'px';
    layer.style.top = menu.offsetTop + 'px';
    layer.style.width = menu.offsetWidth + 'px';
    layer.style.height = menu.offsetHeight + 'px';
}

function removeIframeLayer(menu) {
    var layers = menu.parentNode.getElementsByTagName('iframe');
    while (layers.length > 0) {
      layers[0].parentNode.removeChild(layers[0]);
    }
}
//======================
// ppkpatch 061109
// tablerow is een global variable geworden om makkelijk de event handlers te kunnen verwijderen.
tableRowHover = function ()
	{
	if(!(document.getElementById("main-content"))) return;
 /* var */ tablerow = document.getElementsByTagName('tr');
			for (var i=0;i<tablerow.length;i++)
			{
				// find all the links in this table row
				var tablerowlinks = tablerow[i].getElementsByTagName('A');
				for (var t=0; t<tablerowlinks.length; t++) {
					// only apply mouseover to table rows containing links
					if (tablerowlinks[t]) {
						tablerow[i].onmouseover = function()
						{
							var cell = this.getElementsByTagName('td');
							var	thcell = this.getElementsByTagName('th');
							for (var i=0;i<cell.length;i++)
							{
								cell[i].style.borderColor = '#000099';
							}
							if (thcell.length < 2)
							{
							for (var i=0;i<thcell.length;i++)
							{
								thcell[i].style.borderColor = '#000099';
							}
						}
					}
				}
			}
		}
		/* var */ tablerow = document.getElementsByTagName('tr');
			for (var i=0;i<tablerow.length;i++)
			{
				// find all the links in this table row
				var tablerowlinks = tablerow[i].getElementsByTagName('A');
				for (var t=0; t<tablerowlinks.length; t++) {
					// only apply mouseover to table rows containing links
					tablerow[i].onmouseout = function()
					{
						var cell = this.getElementsByTagName('td');
						var	thcell = this.getElementsByTagName('th');
						for (var i=0;i<cell.length;i++)
						{
							cell[i].style.borderColor = '#ddd';
						}
						if (thcell.length < 2)
						{
						for (var i=0;i<thcell.length;i++)
						{
							thcell[i].style.borderColor = '#ddd';
						}
					}
				}
			}
		}
	}

//======================  Select Replacement

//Thanx Alex Vincent (http://www.codingforums.com/showthread.php?t=7028)
var notWhitespace = /\S/;

function cleanWhitespace(node) {
  for (var x = 0; x < node.childNodes.length; x++) {
    var childNode = node.childNodes[x]
    if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue))) {
// that is, if it's a whitespace text node
      node.removeChild(node.childNodes[x])
      x--
    }
    if (childNode.nodeType == 1) {
// elements can have text child nodes of their own
      cleanWhitespace(childNode)
    }
  }
}

// Capture mouseclicks; Functionality is used by dropdowns:
captureClick = function (){
	if (document.getElementById && (!(IE))) document.captureEvents(Event.CLICK)
	document.onclick = checkDropDowns;
	//document.onblur = function() { alert("out"); }
}

var current_open;

// show specific dropdown menu:
showSelected = function(elt){
	var y = 0;
	var x = 0;
	var thisRef = elt;
	while( thisRef.offsetParent != null ) {
		y +=thisRef.offsetTop;
		x += thisRef.offsetLeft;
		thisRef = thisRef.offsetParent;
    }
	if(IE5 || IE55){
		y += (elt.offsetHeight-6);

    } else if(Safari){
        y += (elt.offsetHeight-1);
		x -= 1;
    } else {
		y += (elt.offsetHeight-11);

	}
	x += 2;
	document.getElementById(elt.parent_id).style.top = y + "px";
	document.getElementById(elt.parent_id).style.left= x + "px";
	setTimeout('current_open="' + elt.parent_id + '";', 10);
}

// Create dropdown menus in custom select:
selectReplacement = function(elt,selectedValue){
	cleanWhitespace(elt);

	var hidden_submits = elt.parentNode.getElementsByTagName("div");
	for(var n=0; n<hidden_submits.length; n++){
		if(hidden_submits[n].className.indexOf("hidden-function")>-1){
			hidden_submits[n].style.display = "none";
		}
	}

	var dd_options = elt.getElementsByTagName("option");
	var dd_div = document.createElement("div");
	if(IE5 || IE55){
		dd_div.style.width = (elt.offsetWidth) + "px";
    } else {
		dd_div.style.width = (elt.offsetWidth-22) + "px";
	}

	for(var i=0; i<dd_options.length; i++){

		if(!(dd_options[i].firstChild.nodeValue==selectedValue)){
			var this_value = dd_options[i].firstChild.nodeValue;
			var this_a = document.createElement("A");
			//default color text in select
			this_a.style.color = "#525152";
			this_a.url_value = dd_options[i].value;
			this_a.parent_id = "dd_"+elt.id;
			//this_a.selection_id = "selected_"+elt.id; /* removed 20 oct 2006 */
			this_a.open_in = "intern";
			if(dd_options[i].className == "open-ext") { this_a.open_in = "extern"; }
			this_a.onmouseover = function(){
				if(IE) { this.style.cursor = "hand"; }
				else { this.style.cursor = "pointer"; }
				this.style.color = "#ff6600";
				this.style.background = "url(/content/images/bullets.gif) 0 -194px no-repeat";
				this.style.borderBottom = "1px solid #009";
			}


			this_a.onmouseout = function(){
				this.style.color = "#525152";
				this.style.background = "none";
				this.style.borderBottom = "1px solid #eee";
			}
			this_a.onclick = function(){
				if(this.open_in == "intern"){
					location.href = this.url_value;
				} else {
					window.open(this.url_value);
				}
				/*
				removed 20 oct 2006 so that selected option doesn't stay selected (see also above)
				var orig_value = document.getElementById(this.selection_id).firstChild.nodeValue;
				var orig_url = document.getElementById(this.selection_id).url_value;
				var orig_opener = document.getElementById(this.selection_id).open_in;

				document.getElementById(this.selection_id).innerHTML = this.firstChild.nodeValue;
				document.getElementById(this.selection_id).url_value = this.url_value;
				document.getElementById(this.selection_id).open_in = this.open_in;

				this.url_value = orig_url;
				this.innerHTML = orig_value;
				this.open_in = orig_opener;*/

				document.getElementById(this.parent_id).style.left="-999em";
				current_open = "";
				return false;
			}
			this_a.appendChild(document.createTextNode(this_value));
			dd_div.appendChild(this_a);
		} else {
			var this_value = dd_options[i].firstChild.nodeValue;
			var this_selection = document.createElement("a");
			//default color text in select
			this_selection.style.color = "#525152";
			this_selection.onmouseover = function(){
				if(IE) { this.style.cursor = "hand"; }
				else { this.style.cursor = "pointer"; }
				this.style.color = "#ff6600";
			}
			this_selection.onmouseout = function(){
				this.style.color = "#525152";
			};
			this_selection.onclick = function(){
				if(this.parent_id==current_open){
					document.getElementById(this.parent_id).style.left = "-999em";
					current_open = "";
				} else {
					if(!(current_open=="" || current_open==null || current_open=="undefined")){
						document.getElementById(current_open).style.left = "-999em";
					}
					showSelected(this);
				}
				return false;
			};
			this_selection.appendChild(document.createTextNode(this_value));
			elt.parentNode.appendChild(this_selection);
			this_selection.className = "selected-item";
			this_selection.parent_id = "dd_"+elt.id;
			this_selection.id = "selected_"+elt.id;
			this_selection.url_value = dd_options[i].value;
			if(dd_options[i].className == "open-ext")  this_selection.open_in = "extern" ;
			elt.style.display = "none";
		}
	}
	document.getElementsByTagName("body")[0].appendChild(dd_div);
	dd_div.id = "dd_"+elt.id;
	dd_div.className = "alt-dropdown";
}

    function setForm() {
      var s = document.getElementsByTagName('select');
      for (var i=0; i<s.length; i++) {
		if(s[i].className.indexOf("custom-select")>-1){
			//alert(s[i].options[0].firstChild.nodeValue);
			selectReplacement(s[i],s[i].options[0].firstChild.nodeValue);
		}
      }
    }
    SelectChangeStyle = function() {
      (document.all && !window.print) ? null : setForm();
    }

checkDropDowns = function (e) {
	if(!(current_open=="" || current_open==null || current_open=="undefined")){
		if(document.getElementById(current_open) && document.getElementById(current_open).offsetLeft > 0){
			document.getElementById(current_open).style.left = "-999em";
			current_open = "";
		}
	}
}

//======================  end select replacements

//======================  start add functionality to redirect-form
addRedirectFunct = function(){
	var btn = document.getElementById("redirect-button");
	btn.onclick = function(){
		var s = document.getElementById("redirect-select");
		var thisValue = s.options[s.selectedIndex].value;
		if(s.options[s.selectedIndex].className == "open-ext"){
			window.open(thisValue);
		} else {
			location.href = thisValue;
		}
		return false;
	}
};
//======================  end add functionality to redirect-form

//======================  click on thumbstones div

function ClickOnThumbstone()
{
	if(!(document.getElementById("main-content"))) return;
	var s = document.getElementById("main-content").getElementsByTagName("div");


	for (var i=0;i<s.length;i++)
	{
		if(s[i].className == "illustration") return false;
		if(s[i].className != "tombstone") continue;
		s[i].style.cursor = "hand";
		s[i].style.cursor = "pointer";
		if (s[i].getElementsByTagName("a"))
		s[i].linkinhoud = s[i].getElementsByTagName("a")[0].getAttribute("href");

		//return false;
		//text = s[i].href;
		//alert(text);
/* possible memory leak : */
		s[i].onclick = function (){
		document.location.href = this.linkinhoud;
		};
	}
}


//======================  open and close tabs
function tabsOpenClose() {
	if(!(document.getElementById("main-content"))) return;
	var tabArr = new Array;
	var divs = document.getElementById("main-content").getElementsByTagName("div");
	for(var n=0; n<divs.length; n++){
		if(divs[n].className.indexOf("tabs-container")>-1){
			var startNode = divs[n];
			var candidates = startNode.getElementsByTagName("div");
			for (var c=0; c<candidates.length; c++) {
				if (candidates[c].className == "tab") {
					this.tab = candidates[c];
				}
				if (candidates[c].className == "tabcontent") {
					this.tabContent = candidates[c];
				}
				if (this.tabContent) {
					tabArr[tabArr.length] = new tabFunct(this,this.tab,this.tabContent);
					this.tab = null;
					this.tabContent = null;
				}
			}
		}
	}
}
tabFunct = function(tabsOpenClose,tab,tabContent) {
	this.tabsOpenClose = tabsOpenClose;
	this.tab = tab;
	this.tabContent = tabContent;
	// If a specific faq is requested it will open when page is loaded and the page will jump to this faq
	// else all faq's will be closed
	var thisLoc;
	if(document.location.hash){
		thisLoc = document.location.hash.toString();
		thisLoc = thisLoc.substr(thisLoc.indexOf("#")+1);
		if(this.tab.id==thisLoc){
			this.tabContent.className = "tabcontent";
			this.tab.className = "tabopen";
		} else {
			this.toggleTab(); //close for the first time
		}
	} else {
		this.toggleTab(); //close for the first time
	}
	this.tab.tabFunct = this;
/* possible memory leak : */
	this.tab.onclick = function () {
		this.tabFunct.toggleTab();
		return false;
	}
}
tabFunct.prototype.toggleTab = function () {
	if (this.tabContent.className != "tabcontent") {
		this.tabContent.className = "tabcontent";
		this.tab.className = "tabopen";
	}
	else {
		this.tabContent.className = "tabclosed";
		this.tab.className = "tab";

	}
}
//======================

//====================== This functions clears the default text in the search field when focussed
function clearSearchField() {
	var searchField = document.getElementById("site-search");
	searchField.onfocus = function() {
		searchField.value = "";
	}
}
//======================

//====================== find input elements with the class name 'button' and
//====================== assign a rollover class to them
function formButtonRollovers() {
	if(!(document.getElementById("main-content"))) return;
	this.buttons = new Array;
	// find the 'main-content' div
	var startNode = document.getElementById("main-content");
	var candidates = startNode.getElementsByTagName("input");
	for (var i=0; i<candidates.length; i++) {
		if (candidates[i].className.indexOf("button") != -1) {
			this.buttons[this.buttons.length] = new Button(this,candidates[i]);
		}
	}
}
Button = function(formButtons,the_button) {
	this.formButtons = formButtons;
	this.the_button = the_button;
	this.the_button.Button = this;
/* possible memory leak : */
	this.the_button.onmouseover = function() {
		this.style.color = "#f60";
		this.style.cursor = "hand";
		return true;
	}
/* possible memory leak : */
	this.the_button.onmouseout = function() {
		this.style.color = "#009";
		this.style.cursor = "pointer";
		return true;
	}
}

// ===================== Open an external window functionality :
function externalLinks() {
	if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
	}
}

//====================== Function that creates styles dynamically before page is loaded
function createStyleRule(selector, declaration) {
    if (!document.getElementsByTagName ||
      !(document.createElement || document.createElementNS)) return;
   	var is_ie = ((agt.indexOf("msie") != -1) &&  (agt.indexOf("opera") == -1));
    var is_iewin = (is_ie &&  (agt.indexOf("win") != -1));
    var is_iemac = (is_ie &&  (agt.indexOf("mac") != -1));
    if (is_iemac) return; // script doesn't work properly in IE/Mac
    var head = document.getElementsByTagName("head")[0];
    var style = (typeof document.createElementNS != "undefined") ?
      document.createElementNS("http://www.w3.org/1999/xhtml", "style") :
      document.createElement("style");
    if (!is_iewin) {
        var styleRule = document.createTextNode(selector + " {" + declaration + "}");
	    style.appendChild(styleRule); // bugs in IE/Win
    }
	style.setAttribute("type", "text/css");
    style.setAttribute("media", "screen");
    head.appendChild(style);
    if (is_iewin &&  document.styleSheets &&  document.styleSheets.length > 0) {
        var lastStyle = document.styleSheets[document.styleSheets.length - 1];
        if (typeof lastStyle.addRule == "object") {
            lastStyle.addRule(selector, declaration);
        }
    }
}

// get window width before page has loaded
function winWidth() {
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}

// fuction te refresh captcha imge when not readable
function newCaptcha(imageElementId, captchaUrl) {
    var imageElement = document.getElementById(imageElementId);
    if (imageElement != null) {
        captchaUrl += '?newCaptcha=true&rand=' + Math.random();
        imageElement.src = captchaUrl;
    }
}


// Hide non-javascript elements for custom selects when page loads:
function hideCustomSelectElts(){
	if (document.getElementById) {
    	createStyleRule(".custom-select", "position:absolute;");
		createStyleRule(".custom-select", "top:-999em;");
		createStyleRule(".hidden-function", "position:absolute;");
		createStyleRule(".hidden-function", "top:-999em;");
	}
}
if(!(IE5 || IE55)) { hideCustomSelectElts(); }
//======================
//-->
