/* functie die de juistheid van een datum nakijkt
************************************************/

function datumcheck(wat)
{
schrikkel=29;
var kortemaanden=new Array(4,6,9,11);
dag = document.getElementById(wat + 'dag').value;
maand = document.getElementById(wat + 'maand').value;
jaar = document.getElementById(wat + 'jaar').value;
for (a=0;a<4;a++)
{
 	if (maand == kortemaanden[a] && dag>30)
	{
	   document.getElementById(wat + 'dag').value=30;
	   alert ("deze maand heeft maar dertig dagen");
	   dag=30;
	}
}
if (jaar%4 > 0 || jaar%400==0)
{
 schrikkel=28;
}

if (maand == 2 && dag>schrikkel)
	{
	   document.getElementById(wat + 'dag').value=schrikkel;
	   alert ("februari heeft " + schrikkel + " dagen in " + jaar);
	   dag=schrikkel;
	}
document.getElementById(wat + 'datum').value=dateToString(dag)+"/"+dateToString(maand)+"/"+dateToString(jaar);
}


/* functie die 0 voor een getal die kleiner dan 10 is zet
*********************************************************/
function dateToString(nr){
	if(nr<10){
		return ("0" + nr);
	}
	else return ("" + nr);
}


/*functie die een datum op het scherm zet
******************************************/
function zetdatum(wat)
{
	var datum= new Date();
	
	document.write ('<tr><td>'+wat+'datum</td><td>')
	document.write ('<select onchange=datumcheck("'+wat+'") name="'+wat+'dag">')
	for(a=1;a<32;a++)
	{
	 	document.write ('<option value="'+a+'"')
		if (a==datum.getDate()) {document.write (' selected=selected');}
		document.write ('>'+a+'</option>')
	}
	document.write ('</select>')
	document.write ('<select onchange=datumcheck("'+wat+'") name="'+wat+'maand">')
	for(a=1;a<13;a++)
	{
	 	document.write ('<option value="'+a+'"')
		if (a==datum.getMonth()+1) {document.write (' selected=selected');}
		document.write ('>'+a+'</option>')
	}
	document.write ('</select>')
	document.write ('<select onchange=datumcheck("'+wat+'") name="'+wat+'jaar">')
	for(a=datum.getYear();a>datum.getYear()-99;a--)
	{
	 	document.write ('<option value="'+a+'"')
		if (a==datum.getYear()) {document.write (' selected=selected');}
		document.write ('>'+a+'</option>')
	}
	document.write ('</select>')
	document.write ('<input type="hidden" id="'+wat+'datum" name="'+wat+'datum" value=""></td></tr>')
	document.getElementById(wat + 'datum').value=dateToString(datum.getDate())+"/"+dateToString((datum.getMonth()+1))+"/"+dateToString(datum.getYear());
}


/*form validation
********************/
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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]);
    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+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
	  
  } 
  if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


//LTrim(string) : Returns a copy of a string without leading spaces.
//****************************************************************************
function LTrim(str)

   //PURPOSE: Remove leading blanks from our string.
   //IN: str - the string we want to LTrim

{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}


//RTrim(string) : Returns a copy of a string without trailing spaces.
//*******************************************************************

function RTrim(str)

   //PURPOSE: Remove trailing blanks from our string.
   //IN: str - the string we want to RTrim

{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...

      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;


      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;
}



//Trim(string) : Returns a copy of a string without leading or trailing spaces
//****************************************************************************
function Trim(str)

   //PURPOSE: Remove trailing and leading blanks from our string.
   //IN: str - the string we want to Trim

   //RETVAL: A Trimmed string!

{
   return RTrim(LTrim(str));
}

//-->



function verwijder( tekst )
		{
		 	var answer = confirm ("Bent u zeker dat u " + "\n"+ tekst + "\nwil verwijderen ?");
				if (answer){ 
		 		   			 return true;
				} 
				else{
		 			 return false;
				}
		}
		
		
function fotopop(map)
{

	venster=window.open("foto.asp?map="+map,"newWindow","width=250,height=250,location=no,scrollbars=no,resizable=yes,toolbar=no,menubar=no,directories=no,status=yes")
	venster.moveTo(50,0);

}
function picview(foto)
{
var a;
var b;
if(window.venster)
{window.venster.close();}
if (window.screen)
	{
	venster=window.open("picview.asp?foto="+foto,"pic","width=10,height=10,location=no,scrollbars=no,resizable=yes,toolbar=no,menubar=no,directories=no,status=no")
	
}
else
	{
	window.open("picview.asp?foto="+foto,"pic2","width=544,height=215,location=no,scrollbars=no,resizable=yes,toolbar=no,menubar=no,directories=no,status=yes")
	}
}


//functie om argumenten uit querystring te halen  bron:http://www.needscripts.com/
//********************************************************************************

/* Andrew Urquhart : Client-Side Request Object for javascript : www.andrewu.co.uk/tools/request/
COPYRIGHT:You are free to use this script for any use you wish if this comment is left intact. 
Feel free to enhance the script and send me the updated version. 
Please don't redistribute. 
This script is provided as is,with no warranty of any kind. 
Use it at your own risk. 
Copyright Andrew R Urquhart; VERSION:#1.2 2004-02-18 18:48 UTC*/
function RObj(ea){var LS="";var QS=new Object();var un="undefined";var f="function";var n="number";var r="string";var e1="ERROR:Index out of range in\r\nRequest.QueryString";var e2="ERROR:Wrong number of arguments or invalid property assignment\r\nRequest.QueryString";var e3="ERROR:Object doesn't support this property or method\r\nRequest.QueryString.Key";function Err(arg){if(ea)alert("Request Object:\r\n"+arg)};function URID(t){var d="";if(t){for(var i=0;i<t.length;++i){var c=t.charAt(i);d+=(c=="+"?" ":c);};};return unescape(d);};function OL(o){var l=0;for(var i in o){if(typeof(o[i])!=f) l++;};return l;};function AK(key){var auk=true;for(var u in QS){if(typeof(QS[u])!=f&&u.toString().toLowerCase()==key.toLowerCase()){auk=false;return u;}};if(auk){QS[key]=new Object();QS[key].toString=function(){return TS(QS[key])};QS[key].Count=function(){return OL(QS[key])};QS[key].Count.toString=function(){return OL(QS[key]).toString()};QS[key].Item=function(e){if(typeof(e)==un) return QS[key];else {if(typeof(e)==n){var a=QS[key][Math.ceil(e)];if(typeof(a)==un) Err(e1+"(\""+key+"\").Item("+e+")");return a;}else Err("ERROR:Expecting numeric input in\r\nRequest.QueryString(\""+key+"\").Item(\""+e+"\")");}};QS[key].Item.toString=function(e){if(typeof(e)==un) return QS[key].toString();else {var a=QS[key][e];if(typeof(a)==un) Err(e1+"(\""+key+"\").Item("+e+")");return a.toString();};};QS[key].Key=function(e){var t=typeof(e);if(t==r){var a=QS[key][e];return(typeof(a)!=un&&a&&a.toString()?e:"");}else Err(e3+"("+(e?e:"")+")");};QS[key].Key.toString=function(){return un};};return key};function AVTK(key,val){if(key!=""){var key=AK(key);var l=OL(QS[key]);QS[key][l+1]=val;}};function TS(o){var s="";for(var i in o){var ty=typeof(o[i]);if(ty=="object") s+=TS(o[i]);else if(ty!=f) s+=o[i]+", ";};var l=s.length;if(l>1)return(s.substring(0,l-2));return(s==""?un:s);};function KM(k,o){var k=k.toLowerCase();for(var u in o){if(typeof(o[u])!=f&&u.toString().toLowerCase()==k) return u;};}if(window.location&&window.location.search){LS=window.location.search;var l=LS.length;if(l>0){LS=LS.substring(1,l);var preAmpAt=0;var ampAt=-1;var eqAt=-1;var k=0;var skip=false;for(var i=0;i<l;++i){var c=LS.charAt(i);if(LS.charAt(preAmpAt)=="="||(preAmpAt==0&&i==0&&c=="=")) skip=true;if(c=="="&&eqAt==-1&&!skip) eqAt=i;if(c=="&"&&ampAt==-1){if(eqAt!=-1) ampAt=i;if(skip) preAmpAt=i+1;skip=false;};if(ampAt>eqAt){AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,ampAt)));preAmpAt=ampAt+1;eqAt=ampAt=-1;++k;};};if(LS.charAt(preAmpAt)!="="&&(preAmpAt!=0||i!=0||c!="=")){if(preAmpAt!=l){if(eqAt!=-1) AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,l)));else if(preAmpAt!=l-1) AVTK(URID(LS.substring(preAmpAt,l)),"");};if(l==1) AVTK(LS.substring(0,1),"");};};};var TC=OL(QS);if(!TC) TC=0;QS.toString=function(){return LS.toString()};QS.Count=function(){return(TC?TC:0)};QS.Count.toString=function(){return(TC?TC.toString():"0")};QS.Item=function(e){if(typeof(e)==un) return LS;else {if(typeof(e)==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])!=f&&++c==e) return QS[i];};Err(e1+"().Item("+e+")");}else return QS[KM(e,QS)];};return un;};QS.Item.toString=function(){return LS.toString()};QS.Key=function(e){var t=typeof(e);if(t==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])!=f&&++c==e) return i;}}else if(t==r){var e=KM(e,QS);var a=QS[e];return(typeof(a)!=un&&a&&a.toString()?e:"");}else Err(e2+"().Key("+(e?e:"")+")");Err(e1+"().Item("+e+")");};QS.Key.toString=function(){Err(e2+"().Key");};this.QueryString=function(k){if(typeof(k)==un) return QS;else {var k=KM(k,QS);if(typeof(QS[k])==un){t=new Object();t.Count=function(){return 0};t.Count.toString=function(){return "0"};t.toString=function(){return un};t.Item=function(e){return un};t.Item.toString=function(){return un};t.Key=function(e){Err(e3+"("+(e?e:"")+")");};t.Key.toString=function(){return un};return t;}if(typeof(k)==n) return QS.Item(k);else return QS[k];}};this.QueryString.toString=function(){return LS.toString();};this.QueryString.Count=function(){return(TC?TC:0)};this.QueryString.Count.toString=function(){return(TC?TC.toString():"0")};this.QueryString.Item=function(e){if(typeof(e)==un) return LS.toString();else {if(typeof(e)==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])!=f&&++c==e) return QS[i];};Err(e1+".Item("+e+")");}else return QS[KM(e,QS)];}if(typeof(e)==(n)) Err(e1+".Item("+e+")");return un;};this.QueryString.Item.toString=function(){return LS.toString()};this.QueryString.Key=function(e){var t=typeof(e);if(t==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof(QS[i])=="object"&&(++c==e)){return i;}}}else if(t==r){var e=KM(e,QS);var a=QS[e];return(typeof(a)!=un&&a&&a.toString()?e:"");}else Err(e2+".Key("+(e?e:"")+")");Err(e1+".Item("+e+")");};this.QueryString.Key.toString=function(){Err(e2+".Key");};this.Version=1.2;this.Author="Andrew Urquhart (www.andrewu.co.uk)";};var Request=new RObj(false);
