function calculateHeight()
{
    var contentHeight = 0;

    // get the height of the 3 columns and set contentheight to the largest value
    if (document.getElementById('banners')) {
        contentHeight = document.getElementById('banners').offsetHeight;
    }

    if (document.getElementById('content')) {
        if (document.getElementById('content').offsetHeight > contentHeight) {
            contentHeight = document.getElementById('content').offsetHeight;
        }
    }

    if (document.getElementById('content_right')) {
        if (document.getElementById('content_right').offsetHeight > contentHeight) {
            contentHeight = document.getElementById('content_right').offsetHeight;
        }
    }

    contentHeight += 35;

    // put the opacity div heights
    document.getElementById('content_left_background').style.height = contentHeight + "px";
    document.getElementById('content_left_wrapper').style.height = contentHeight + "px";
    document.getElementById('content_left').style.height = contentHeight + "px";

    document.getElementById('content_right_background').style.height = contentHeight + "px";
    document.getElementById('content_right_wrapper').style.height = contentHeight + "px";
    document.getElementById('content_right').style.height = contentHeight + "px";
}

function open_menu(menu, clickedItem)
{
    menu.style.display = 'block';
    clickedItem.style.background = '#0054A4';

}

function close_menu(menu, clickedItem)
{
    menu.style.display = 'none';
    clickedItem.style.background = '#A0CBED';
}

function FocusCol(obj)
{
	if (document.getElementById ||
		document.all)
	{
		obj.style.color="#000000";
		obj.style.backgroundColor="#FFFFFF";
		obj.style.fontWeight="normal";
		}
	}
	
function BlurCol(obj)
{
	if (document.getElementById ||
		document.all)
	{
		obj.style.color="#666666";
		obj.style.backgroundColor="#EFEDE7";
		obj.style.fontWeight="normal";
		}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) { 
		test=args[i+2]; val=MM_findObj(args[i]);
//alert(args[i]+ ': '+val.value+' ('+test+')'); 
		if (val) { 
			nm=val.name; 
			if ((val=val.value)!="") {
				if (test.indexOf('isEmail')!=-1) { 
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) {
						errors+='- '+nm+' dient een geldig emailadres te zijn.\n';
					}
				} 
				else if (test.indexOf('isSofi')!=-1) { 
					if (!check_sofi(val)) {
						errors+='- '+nm+' dient een geldig sofinummer te zijn.\n';
					}
				} 
				else if (test.indexOf('isDate')!=-1) { 
					if (!check_date(val)) {
						errors+='- '+nm+' dient een geldige datum te zijn.\n';
					}
				}
				else if (test!='R') { 
					num = parseFloat(val);
					if (isNaN(val)) {
						errors+='- '+nm+' dient een nummer te zijn.\n';
					}
					if (test.indexOf('inRange') != -1) { 
						p=test.indexOf(':');
						min=test.substring(8,p); max=test.substring(p+1);
						if (num<min || max<num) {
							errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
						}
					} 
				} 
			} 
			else if (test.charAt(0) == 'R') {
				errors += '- '+nm+' is een verplicht veld.\n'; 
			}
		}
	} 
	if (errors) alert('De volgende fouten hebben zich voorgedaan:\n'+errors);
  	document.MM_returnValue = (errors == '');
}

/**--------------------------
//* Validate Date Field script- By JavaScriptKit.com
//* For this script and 100s more, visit http://www.javascriptkit.com
//* This notice must stay intact for usage
---------------------------**/

function check_date(input){
	var validformat=/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/; //Basic check for format validity
	return (validformat.test(input));
}

function check_sofi(str) {
	if(str.length != 9) {
		return false;
	} else {
		var sum = 0;
		for(var i=0; i < 8; i++) {
			sum += (9-i) * parseInt(str.charAt(i));
		}
		sum -= parseInt(str.charAt(8));

		if(!((sum % 11) == 0)) {
			return false;
		}
	}
	return true;
}

