<!--

/**************************************************************

	Back, takes you back (or to a default page when there is nothing to go back to)
	Author : Tom van Gemert
	For: Trimedia Interactive Projects
	http://www.trimedia.nl
	Added to project: 20070123	

**************************************************************/

function get_back(page) {

	if (history.length < 2) {
		window.location = page;
	} else {
		history.back();
	}

}

/**************************************************************
	
	Toggle the disable of text input fields through checkbox
	also takes a default value for the disabled field.
	
	Author : Tom van Gemert
	For: Trimedia Interactive Projects
	http://www.trimedia.nl
	Added to project: 20070123

	Script based on: http://lists.evolt.org/archive/Week-of-Mon-20020121/066412.html
	
**************************************************************/

function toggle_input(form_name,field_name,default_value) {

	if (document.forms[form_name].elements[field_name].checked) {
		document.forms[form_name].elements[field_name + '_txt'].disabled = false;
		document.forms[form_name].elements[field_name + '_txt'].style.backgroundColor = '#ffffff';
		document.forms[form_name].elements[field_name + '_txt'].value = '';
		document.forms[form_name].elements[field_name + '_txt'].focus();
	} else {
		document.forms[form_name].elements[field_name + '_txt'].disabled = true;
		document.forms[form_name].elements[field_name + '_txt'].value = '';
		document.forms[form_name].elements[field_name + '_txt'].style.backgroundColor = '#dedede';
		document.forms[form_name].elements[field_name + '_txt'].value = default_value;
		document.forms[form_name].elements[field_name].focus();
	}

}

/**************************************************************
	
	Toggle the initial value of a text field
	
	Author : Tom van Gemert
	For: Trimedia Interactive Projects
	http://www.trimedia.nl
	Added to project: 20070227

	Script based on: http://lists.evolt.org/archive/Week-of-Mon-20020121/066412.html
	
**************************************************************/

function toggle_default(form_name,field_name,default_value) {

	if (document.forms[form_name].elements[field_name].value == default_value) {
		document.forms[form_name].elements[field_name + '_txt'].style.backgroundColor = '#ffffff';
		document.forms[form_name].elements[field_name + '_txt'].value = '';
		document.forms[form_name].elements[field_name + '_txt'].focus();
	}

}

/**************************************************************

**************************************************************/

function enable_custom_field(functie, which_field) {
	if (functie == 'anders') {
		//alert(functie);
		//var sfEls = document.getElementById("custom_functie_field").display;
		//alert(sfEls);
		document.getElementById(which_field).style.display='block';
	} else {
		document.getElementById(which_field).style.display='none';
	}
}

/**************************************************************

	Set a div to a height if smaller... Or to page height or to a
	static height, depending on parameters and content of said divs.

	Author : Tom van Gemert
	For: Trimedia Interactive Projects
	http://www.trimedia.nl
	Added to project: 20051207

	Script based on: http://www.saila.com/attic/sandbox/set-height.html

**************************************************************/

function compareNum(a,b) {
	return a-b
}


function pageHeight() {

  var myWidth = 0, myHeight = 0;

  if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myHeight = document.body.clientHeight;
  }
  //window.alert( 'Height = ' + myHeight );
  return myHeight;

}

function set_div_height(static_height, min_height) {

	page_height = pageHeight();
	d = document;

	box = new Array("container","content","content_wide","column_right","column_right_trainingen","column_right_quickscan","navigation");
	box_top_space = new Array(45,241,241,241,241,241,241);
	box_length = box.length;
	box_heights = new Array(box_length);

	for(x = 0; x < box_length; x++) {

		boxname = box[x];

		if (d.getElementById(box[x]) != null) {
	  		h = d.getElementById(box[x]).offsetHeight + box_top_space[x];
	  		box_heights[x] = h;
	  	} else {
	  		box_heights[x] = 0;
	  	}

	 }

	box_heights.sort(compareNum);
	tallest_h = box_heights[(box_length-1)];
	//alert("min_height: " + min_height + " tallest_h: " + tallest_h + " page_height: " + page_height);

	if (static_height != "") {

		for(x = 0; x < box_length; x++) {
		  if (d.getElementById(box[x]) != null) {
		  	d.getElementById(box[x]).style.height = static_height - box_top_space[x] + "px";
		  }
		}

	} else {

		if ((tallest_h < min_height) && (!(min_height < page_height))) {

			for(x = 0; x < box_length; x++) {
			  if (d.getElementById(box[x]) != null) {
			  	d.getElementById(box[x]).style.height = min_height - box_top_space[x] + "px";
			  }
			}

		} else {

			if (tallest_h < page_height) {

				for(x = 0; x < box_length; x++) {
					if (d.getElementById(box[x]) != null) {
						d.getElementById(box[x]).style.height = page_height - box_top_space[x] + "px";

					}
				}

			} else {

				for(x = 0; x < box_length; x++) {
					if (d.getElementById(box[x]) != null) {
						d.getElementById(box[x]).style.height = tallest_h - box_top_space[x] + "px";
					}

				}

			}

		}

	}

}



/**************************************************************
Standards Compliant image Rollover Script
Author : Daniel Nolan
http://www.bleedingego.co.uk/webdev.php
**************************************************************/

function initRollovers() {

	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {

		if (aImages[i].className == 'imgover') {

			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_on'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}

			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}

		}

	}

}


//-->