<!--

    function MF_Form_Validator1(theForm)
    {
      var landcode = "";	
      if (theForm.voornaam.value == "")
      {
        alert("U heeft uw voornaam/letters niet ingevuld.");
        theForm.voornaam.focus();
        return (false);
      }
      if (theForm.voornaam.value == theForm.voornaam.value.toLowerCase())
      {
        alert("Gebruik de juiste hoofdletters en kleine letters.");
        theForm.voornaam.focus();
        return (false);
      }
      if (theForm.achternaam.value == "")
      {
        alert("U heeft uw achternaam niet ingevuld.");
        theForm.achternaam.focus();
        return (false);
      }
      if ((theForm.achternaam.value == theForm.achternaam.value.toLowerCase()) || (theForm.achternaam.value == theForm.achternaam.value.toUpperCase()))
      {
        alert("Gebruik de juiste hoofdletters en kleine letters.");
        theForm.achternaam.focus();
        return (false);
      }
      if (theForm.adres.value == "")
      {
        alert("U heeft uw adres niet ingevuld.");
        theForm.adres.focus();
        return (false);
      }
      if (theForm.adres.value.indexOf(" ") == -1)
      {
        alert("U heeft uw adres niet juist ingevuld.");
        theForm.adres.focus();
        return (false);
      }      
      if ((theForm.adres.value == theForm.adres.value.toLowerCase()) || (theForm.adres.value == theForm.adres.value.toUpperCase()))
      {
        alert("Gebruik de juiste hoofdletters en kleine letters.");
        theForm.adres.focus();
        return (false);
      }
      if (theForm.postcode.value == "")
      {
        alert("U heeft uw postcode niet ingevuld.");
        theForm.postcode.focus();
        return (false);
      }
      if (theForm.plaats.value == "")
      {
        alert("U heeft uw woonplaats niet ingevuld.");
        theForm.plaats.focus();
        return (false);
      }
      if ((theForm.plaats.value == theForm.plaats.value.toLowerCase()) || (theForm.plaats.value == theForm.plaats.value.toUpperCase()))
      {
        alert("Gebruik de juiste hoofdletters en kleine letters.");
        theForm.plaats.focus();
        return (false);
      }
      if (theForm.landnum.value == "")
      {
        alert("U heeft uw land niet gekozen.");
        theForm.landnum.focus();
        return (false);
      }
      if (theForm.landnum.value == "0")
      {
        alert("U heeft uw land niet gekozen.");
        theForm.landnum.focus();
        return (false);
      }
      if (theForm.email.value == "")
      {
        alert("U heeft uw e-mailadres niet ingevuld.");
        theForm.email.focus();
        return (false);
      }
      if (ValidEmail(theForm.email.value) == false)
      {
        alert("U heeft geen correct e-mailadres ingevuld.");
        theForm.email.focus();
        return (false);
      }	 	  
      if (theForm.landnum.value == "32")
      {
        theForm.postcode.value=theForm.postcode.value.replace(/\D/g, "");
		landcode = "BE";		
      }      
      if (theForm.landnum.value == "31")
      {
		landcode = "NL";
      	if (theForm.postcode.value.indexOf(" ") > 0)
      	{
      	  if(theForm.postcode.value.length !== 7)
      	  {
        	alert("Uw postcode is onjuist.");
        	theForm.postcode.focus();
        	return (false);
		  }
		}  
		else if(theForm.postcode.value.length !== 6)
      	{
      		alert("Uw postcode is onjuist.");
        	theForm.postcode.focus();
        	return (false);
      	}
	  }
      if(theForm.bedrijfsnaam.value.length > 0) {
	    if ((theForm.landnum.value == "31") || (theForm.landnum.value == "32")) {
    	    if (theForm.btwcode.value == "") {
        		alert("U heeft uw BTW-nummer niet ingevuld.\n\nAls u vrijstelling heeft, vul dan\nhet woord \'vrijstelling\' in.");
             	theForm.btwcode.focus();
            	return (false);		
		    }
	        if (theForm.btwcode.value.toLowerCase() != 'vrijstelling') {
	            theForm.btwcode.value = theForm.btwcode.value.replace("NL-", "");
	            theForm.btwcode.value = theForm.btwcode.value.replace("BE-", "");	            
	            theForm.btwcode.value = theForm.btwcode.value.replace("NL", "");
	            theForm.btwcode.value = theForm.btwcode.value.replace("BE", "");	            
	            theForm.btwcode.value = theForm.btwcode.value.replace(/\./g, "");
				if (checkbtw(landcode,theForm.btwcode.value) == 'false') {
					alert("Het ingevulde BTW-nummer is onjuist.");
					theForm.btwcode.focus();
					return (false);						
				}
            }
		}
	  }
      var ordernum = 0;
      ordernum = checkbestel(theForm.voornaam.value,theForm.achternaam.value, 'bestel');
  	  if (ordernum > 0) {
		return confirm("U heeft vrij recent al een bestelling geplaatst.\n(bestelnummer: " + ordernum + ")\n\nKlik op 'OK' als u nog een bestelling wilt plaatsen.\n");
	  }	  
      return (true);
    }

function checkbestel(voornaam,achternaam, besteltype) {
	var retval = "";
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.open('GET', '../checkbestelling.php?voornaam=' + voornaam + '&achternaam=' + achternaam + '&besteltype=' + besteltype, false);
      http_request.send(null);
      retval = http_request.responseText;
	  //alert(retval);
	  return retval;
}
	

function checkbtw(landcode,btwcode) {
	var retval = "";
	http_request = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/html');
		}
	} else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.open('GET', '../checkbtw.php?countrycode=' + landcode + '&btwcode=' + btwcode, false);
      http_request.send(null);
      retval = http_request.responseText;
	  //alert(retval);
	  return retval;
}
	
function ValidEmail(incoming) {
	var emailstring = incoming;
	var ampIndex = emailstring.indexOf("@");
	var afterAmp = emailstring.substring((ampIndex + 1), emailstring.length);
		// find a dot in the portion of the string after the ampersand only
	var dotIndex = afterAmp.indexOf(".");
		// determine dot position in entire string (not just after amp portion)
	dotIndex = dotIndex + ampIndex + 1;
		// afterAmp will be portion of string from ampersand to dot
	afterAmp = emailstring.substring((ampIndex + 1), dotIndex);
		// afterDot will be portion of string from dot to end of string
	var afterDot = emailstring.substring((dotIndex + 1), emailstring.length);
	var beforeAmp = emailstring.substring(0,(ampIndex));
	var email_regex = /^\w(?:\w|-|\.(?!\.|@))*@\w(?:\w|-|\.(?!\.))*\.\w{2,3}/ 
		// index of -1 means "not found"
	if ((emailstring.indexOf("@") != "-1") &&
		(emailstring.length > 5) &&
		(afterAmp.length > 0) &&
		(beforeAmp.length > 1) &&
		(afterDot.length > 1) &&
		(email_regex.test(emailstring)) ) {
		  return true;
	} else {
			return false;
	}
}	

function MF_Form_Validator2(theForm)
{
  var flandcode = "";
  if (theForm.fvoornaam.value == "")
  {
    alert("U heeft uw voornaam/letters niet ingevuld.");
    theForm.fvoornaam.focus();
    return (false);
  }
  if (theForm.fvoornaam.value == theForm.fvoornaam.value.toLowerCase()) 
  {
    alert("Gebruik de juiste hoofdletters en kleine letters.");
    theForm.fvoornaam.focus();
    return (false);
  }
  if (theForm.fachternaam.value == "")
  {
    alert("U heeft uw achternaam niet ingevuld.");
    theForm.fachternaam.focus();
    return (false);
  }
  if ((theForm.fachternaam.value == theForm.fachternaam.value.toLowerCase()) || (theForm.fachternaam.value == theForm.fachternaam.value.toUpperCase()))
  {
    alert("Gebruik de juiste hoofdletters en kleine letters.");
    theForm.fachternaam.focus();
    return (false);
  }
  if (theForm.fadres.value == "")
  {
    alert("U heeft uw adres niet ingevuld.");
    theForm.fadres.focus();
    return (false);
  }
  if (theForm.fadres.value.indexOf(" ") == -1)
  {
   alert("U heeft uw adres niet juist ingevuld.");
   theForm.fadres.focus();
   return (false);
  }  
  if ((theForm.fadres.value == theForm.fadres.value.toLowerCase()) || (theForm.fadres.value == theForm.fadres.value.toUpperCase()))
  {
    alert("Gebruik de juiste hoofdletters en kleine letters.");
    theForm.fadres.focus();
    return (false);
  }
  if (theForm.fpostcode.value == "")
  {
    alert("U heeft uw postcode niet ingevuld.");
    theForm.fpostcode.focus();
    return (false);
  }
  if (theForm.fplaats.value == "")
  {
    alert("U heeft uw woonplaats niet ingevuld.");
    theForm.fplaats.focus();
    return (false);
  }
  if ((theForm.fplaats.value == theForm.fplaats.value.toLowerCase()) || (theForm.fplaats.value == theForm.fplaats.value.toUpperCase()))
  {
    alert("Gebruik de juiste hoofdletters en kleine letters.");
    theForm.fplaats.focus();
    return (false);
  }
  if (theForm.flandnum.value == "")
  {
    alert("U heeft uw land niet gekozen.");
    theForm.flandnum.focus();
    return (false);
  }
  if (theForm.flandnum.value == "0")
  {
    alert("U heeft uw land niet gekozen.");
    theForm.flandnum.focus();
    return (false);
  }
  if (theForm.flandnum.value == "32")
  {
  	theForm.fpostcode.value=theForm.fpostcode.value.replace(/\D/g, "");
    flandcode = "BE";
  }  
  if (theForm.flandnum.value == "31")
  {
    flandcode = "NL";
 	if (theForm.fpostcode.value.indexOf(" ") > 0)
   	{
   	  if(theForm.fpostcode.value.length !== 7)
   	  {
      	alert("Uw postcode is onjuist.");
       	theForm.fpostcode.focus();
       	return (false);
	  }
	}  
	else if(theForm.fpostcode.value.length !== 6)
   	{
   		alert("Uw postcode is onjuist.");
       	theForm.fpostcode.focus();
       	return (false);
   	}
  }
  
       if(theForm.fbedrijfsnaam.value.length > 0) {
	    if ((theForm.flandnum.value == "31") || (theForm.flandnum.value == "32")) {
    	    if (theForm.fbtwcode.value == "") {
        		alert("U heeft uw BTW-nummer niet ingevuld.\n\nAls u vrijstelling heeft, vul dan\nhet woord \'vrijstelling\' in.");
             	theForm.fbtwcode.focus();
            	return (false);		
		    }
	        if (theForm.fbtwcode.value.toLowerCase() != 'vrijstelling') {
	            theForm.fbtwcode.value = theForm.fbtwcode.value.replace("NL-", "");
	            theForm.fbtwcode.value = theForm.fbtwcode.value.replace("BE-", "");	            
	            theForm.fbtwcode.value = theForm.fbtwcode.value.replace("NL", "");
	            theForm.fbtwcode.value = theForm.fbtwcode.value.replace("BE", "");	            
	            theForm.fbtwcode.value = theForm.fbtwcode.value.replace(/\./g, "");
				if (checkbtw(flandcode,theForm.fbtwcode.value) == 'false') {
					alert("Het ingevulde BTW-nummer is onjuist.");
					theForm.fbtwcode.focus();
					return (false);						
				}
            }
		}
	  } 
  
  return (true);
}

function ShowList() {
	var div1 = null;
	var div2 = null;
	if (document.getElementById) {
		div1 = document.getElementById('morelink');
		div2 = document.getElementById('morelist');
	} else if (document.all){
		div1 = document.all['morelink'];
		div2 = document.all['morelist'];
	} else if (document.layers){
		div1 = document.layers['morelink'];
		div2 = document.layers['morelist'];
	}	
	div1.style.display = "none"; 
	div2.style.display = ""; 		
}


//-->
