function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {hideCol3();});

function hideCol3()
	{
	var d=document.getElementById("rightcolumn");
	if (d)
		{
		var h=TrimString(d.innerHTML.replace(/<!(?:--[\s\S]*?--\s*)?>\s*/g,''));
		if (h.length==0 || h=="&nbsp;") {d.style.display="none";}
		}
	}

function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}
	
function traceerLI(p)
	{
	var str="hoofdmenu_"+String(p);
	var d=document.getElementById(str);
	if (d)
		{
		if(d.nodeName=="LI" && d.parentNode.nodeName=="UL" && d.parentNode.id=="hoofdmenu") //item is hoofd-item, zoek naar beneden
			{
			return d;
			}
		else
			{
			if(d.nodeName=="LI" && d.parentNode.nodeName=="UL") //item is sub-item, zoek omhoog
				{
				if(d.parentNode.parentNode && d.parentNode.parentNode.nodeName=="SPAN")
					{
					if (d.parentNode.parentNode.parentNode && d.parentNode.parentNode.parentNode.nodeName=="LI")
						{
						return d.parentNode.parentNode.parentNode;
						}
					}
				}
			}	
		}
	else {return false;}
	}
	
function openHoofdmenu(p)
	{
	var str="hoofdmenu_"+String(p);
	var s=k=document.getElementById(str);
	if (k) {k.className="activeItem";}
	
	var d=traceerLI(p);
	if (d==false) {return false;}
	
	var s=document.getElementById("submenu");

	//we hebben het hoofd-item te pakken!
	d.className="activeItem";

	if(d.childNodes.length>0)
		{
		//spoor titel op
		if (d.childNodes[0].childNodes.length>0)
			{
			if(d.childNodes[0].childNodes[0].nodeName=="A")
				{
				var t=d.childNodes[0].childNodes[0].childNodes[0].nodeValue;
				var h1=document.createElement("H1");
				var ti=document.createTextNode(t);
				h1.appendChild(ti);
				
				}
			}
			
		//spoor child UL op
		 if (d.childNodes[0].childNodes.length>1)
			{
			if(d.childNodes[0].childNodes[1].nodeName)
				{
				//re-parent
				if (s && h1) {s.appendChild(h1);}
				if (s) {s.appendChild(d.childNodes[0].childNodes[1]);}
				}
			}
		}

	}
	

function goStartlijsten()
	{
	var form = document.createElement("form");
	form.setAttribute("method", "post");
	form.setAttribute("action", "http://www.startlijsten.nl/index.php?t=ex");

	// setting form target to a window named 'formresult'
	form.setAttribute("target", "_blank");

	var hiddenField0 = document.createElement("input");              
	hiddenField0.setAttribute("name", "soortlijst");
	hiddenField0.setAttribute("value", "0");
	
	var hiddenField1 = document.createElement("input");              
	hiddenField1.setAttribute("name", "plaats");
	hiddenField1.setAttribute("value", "Ravenswaaij");
	
	var hiddenField2 = document.createElement("input");              
	hiddenField2.setAttribute("name", "datum");
	hiddenField2.setAttribute("value", "0");
	
	var hiddenField3 = document.createElement("input");              
	hiddenField3.setAttribute("name", "type");
	hiddenField3.setAttribute("value", "0");
	
	var hiddenField4 = document.createElement("input");              
	hiddenField4.setAttribute("name", "dier");
	hiddenField4.setAttribute("value", "0");
	
	form.appendChild(hiddenField0);
	form.appendChild(hiddenField1);
	form.appendChild(hiddenField2);
	form.appendChild(hiddenField3);
	form.appendChild(hiddenField4);
	document.body.appendChild(form);
	form.submit();
	}
	
//Form checks
function MM_validateFormEN() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormNL.arguments;

  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);hr=args[i+1];o=val;

   // if (String(val.type)=="undefined") {val=getElementsByTagName(val);}
    if (val) { nm=val.name;T=val.type;

    if(val.length>0 && val[0].type=="radio") {T="radio";}

if ((val=val.value)!="" && T!="checkbox" && T!="radio") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+URLDecode(hr)+' must contain a valid e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+URLDecode(hr)+' must contain a number.\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+='- '+URLDecode(hr)+'must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') 
	{
	
	if (T=="checkbox" && o.checked==false) {errors += '- '+URLDecode(hr)+' is required\n'; }
	if (T=="radio" && getCheckedValue(o)==false) {errors += '- '+URLDecode(hr)+' is required\n'; }
	if (T!="checkbox" && T!="radio")
		{errors += '- '+URLDecode(hr)+' is required\n'; }
	}
}
  } if (errors) alert('The following information is incorrect:\n'+errors);

  document.MM_returnValue = (errors == '');
}

function MM_validateFormNL() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormNL.arguments;

  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);hr=args[i+1];o=val;

   // if (String(val.type)=="undefined") {val=getElementsByTagName(val);}
    if (val) { nm=val.name;T=val.type;

    if(val.length>0 && val[0].type=="radio") {T="radio";}

if ((val=val.value)!="" && T!="checkbox" && T!="radio") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+URLDecode(hr)+' moet een geldig e-mail adres bevatten.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+URLDecode(hr)+' moet een nummer bevatten.\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+='- '+URLDecode(hr)+' moet een nummer tussen '+min+' en '+max+' bevatten.\n';
    } } } else if (test.charAt(0) == 'R') 
	{
	
	if (T=="checkbox" && o.checked==false) {errors += '- '+URLDecode(hr)+' is verplicht\n'; }
	if (T=="radio" && getCheckedValue(o)==false) {errors += '- '+URLDecode(hr)+' is verplicht!\n'; }
	if (T!="checkbox" && T!="radio")
		{errors += '- '+URLDecode(hr)+' ontbreekt\n'; }
	}
}
  } if (errors) alert('De volgende informatie is incorrect:\n'+errors);

  document.MM_returnValue = (errors == '');
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return false;
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return false;
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return false;
}

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 URLDecode(psEncodeString)
	{
	var lsRegExp = /\+/g;
	return unescape(String(psEncodeString).replace(lsRegExp, " "));
	}
			
