	function P_Check()
	{	var strError = '';
		
		strError = P_CheckEmptyItems();
		if (strError == '')
		{	strError = P_CheckNumericItems();  }
		
		//Check ingevulde velden.
	   	if (strError == '')
		{  if (document.frmMain.radSex[0].checked == false && document.frmMain.radSex[1].checked == false)
		   {  strError = 'Fout, u dient uw geslacht in te vullen!';  
		      document.frmMain.radSex[0].focus();
		   }
		}
		if (strError == '') 
		{  if (document.frmMain.txtLastname.value == '') { strError = 'Fout, u dient uw achternaam in te vullen!'; document.frmMain.txtLastname.focus(); } 
		}
		if (strError == '') 
		{  if (document.frmMain.txtFirstname.value == '') { strError = 'Fout, u dient uw voorletters in te vullen!'; document.frmMain.txtFirstname.focus(); } 
		}
		if (strError == '') 
		{  if (document.frmMain.txtEmail.value == '') { strError = 'Fout, u dient uw e-mail adres in te vullen!'; document.frmMain.txtEmail.focus(); } 
		}
		if (strError == '') 
		{  if (document.frmMain.txtAddress.value == '' || document.frmMain.txtZipcode.value == '' || document.frmMain.txtCity.value == '') 
		   {  strError = 'Fout, u dient uw "verhuizen van" gegevens volledig in te vullen!'; 
			   document.frmMain.txtAddress.focus();
			}
		}
		if (strError == '') 
		{  if (document.frmMain.txtAddressTo.value == '' || document.frmMain.txtZipcodeTo.value == '' || document.frmMain.txtCityTo.value == '') 
		   {  strError = 'Fout, u dient uw "verhuizen naar" gegevens volledig in te vullen!'; 
			   document.frmMain.txtAddressTo.focus();
			}
		}
		if (strError == '')
      	{  if (!CheckEmail(document.frmMain.txtEmail.value))
		   {  strError = 'Fout, u heeft een ongeldig email adres ingevuld!';
			   document.frmMain.txtEmail.focus();
		   }
		}
		if (strError == '')
      	{  if (document.frmMain.txtPhone.value != '' || document.frmMain.chkPhone.checked == true)
		   {  if (!IsPhoneNumber(document.frmMain.txtPhone.value))
				{  strError = 'Fout, u heeft een ongeldig telefoonnummer ingevuld!';
					document.frmMain.txtPhone.focus();
				}
			}
     	}
		if (strError == '')
      	{  if (document.frmMain.txtCountry.value == '' && document.frmMain.selCountry.value == 'Nederland')
		   {  if (!CheckZipCode(document.frmMain.txtZipcode.value))
		      {  strError = 'Fout, u heeft een ongeldige "verhuizen van" postcode ingevuld!';
			      document.frmMain.txtZipcode.focus();
			   }
		   }
		}
		if (strError == '')
		{	if (document.frmMain.selCountry.value=='NIETINLIJST' && document.frmMain.txtCountry.value == '')
			{  strError = 'U dient een "verhuizen van" land in te vullen!';
			}
		}
		if (strError == '')
      	{  if (document.frmMain.txtCountryTo.value == '' && document.frmMain.selCountryTo.value == 'Nederland')
		   {  if (!CheckZipCode(document.frmMain.txtZipcodeTo.value))
		      {  strError = 'Fout, u heeft een ongeldige "verhuizen naar" postcode ingevuld!';
			      document.frmMain.txtZipcodeTo.focus();
			   }
		   }
		}
		if (strError == '')
		{	if (document.frmMain.selCountryTo.value=='NIETINLIJST' && document.frmMain.txtCountryTo.value == '')
			{  strError = 'U dient een "verhuizen naar" land in te vullen!';
			}
		}
		if (strError == '')
		{	if (document.frmMain.txtDistance.value == '') { strError = 'Fout, u dient het aantal kilometers tussen laad en losadres in te vullen!'; document.frmMain.txtDistance.focus(); } 
		}
		if (strError == '')
		{	if (!IsNumeric(document.frmMain.txtDistance.value)) { strError = 'U heeft een ongeldig aantal kilomters ingevuld! U dient hele getallen in te vullen!'; document.frmMain.txtDistance.focus(); } 
		}
		
		if (strError == '')
		{  if (document.frmMain.selLiftAanw.value=='NOCHOICE')
		   {  strError = 'U dient aan te geven of er een lift aanwezig is bij het "verhuizen van" adres!';  }
		}
		if (strError == '')
		{  if (document.frmMain.selLiftNodig.value=='NOCHOICE')
		   {  strError = 'U dient aan te geven of u een verhuislift nodig heeft bij het "verhuizen van" adres!';  }
		}
		if (strError == '')
		{  if (document.frmMain.selLiftAanwTo.value=='NOCHOICE')
		   {  strError = 'U dient aan te geven of er een lift aanwezig is bij het "verhuizen naar" adres!';  }
		}
		if (strError == '')
		{  if (document.frmMain.selLiftNodigTo.value=='NOCHOICE')
		   {  strError = 'U dient aan te geven of u een verhuislift nodig heeft bij het "verhuizen naar" adres!';  }
		}
		
		if (strError == '')
		{  if (document.frmMain.selReference.value == '0')
		   {  strError = 'U dient een keuze te maken bij "Hoe heeft u ons gevonden?"!';  }
		}

      	return strError;
	}

 	function CheckEmail(strEmail)
	{	var at,dot;

      	return(((at = strEmail.indexOf("@")) >= 0 &&
            (dot = strEmail.lastIndexOf(".")) >= 0 &&
            (strEmail.indexOf(" ")) == -1 &&
            (strEmail.indexOf(",")) == -1 &&
            (strEmail.indexOf(";")) == -1 &&
            (strEmail.indexOf("\t")) == -1 &&
             dot > at) ? true:false);
	}

	function P_CheckEmptyItems()
	{  //deze functie controleert of er minimaal 1 item is ingevuld.
	   	var strError = '';
	   	var i = 0;
		var fOk = false;
		var strFld = '';
		
		for (i=0; i<document.frmMain.elements.length; i++)
		{  	strFld = document.frmMain.elements[i].name;
			if (strFld.indexOf('itm') > -1)
		   	{  if (document.frmMain.elements[i].value != '')
			   {  fOk = true;
				   break;
				}
			}
		}
		
		if (fOk == false) { strError = 'U dient minimaal 1 te verhuizen item in te vullen!'; }		
		return strError;
	}

	function P_CheckNumericItems()
	{  	//deze functie controleert of de ingevulde items numeriek zijn.
	   	var strError = '';
	   	var i = 0;
		var fOk = true;
		var strFld = '';
		var iItem = 0;
		
		for (i=0; i<document.frmMain.elements.length; i++)
		{  	strFld = document.frmMain.elements[i].name;
			if (strFld.indexOf('itm') > -1)
		   	{	if (!IsNumeric(document.frmMain.elements[i].value))
			   	{	iItem = i;
				   	fOk = false;
				   	break;
				}
			}
		}
		
		if (fOk == false) 
		{  	strError = 'U heeft een ongeldig aantal ingevuld!'; 
		   	strError += ' [' + document.frmMain.elements[iItem].title + ']\n';
			strError += 'U dient hele getallen in te vullen!';
			document.frmMain.elements[iItem].focus();
		}		
		return strError;
	}
	
	function CheckZipCode(strValue)
	{  	var fOK = false;
	   	var strNumbers = '0123456789';
		var strChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	   //Postcode bestaat uit:
	   //- 6 karakters
		//- 4 cijfers, 2 letters
		//acties:
		//-alle spaties uit de meegegeven waarde verwijderen
		//-controleren of daadwerkelijk de eerste 4 karakters cijfers zijn, en de laatste 2 letters
      
		//haal alles spaties uit de postcode
		if (strValue.length > 0)
		{  while (strValue.indexOf(' ') > -1)
		   {  strValue = strValue.replace(' ','');  }
		}
		
		if (strValue.length == 6)
		{  if (strNumbers.indexOf(strValue.substring(0,1)) > -1) { fOK = true; } else { fOK = false; }
		   if (fOK == true)
			{  if (strNumbers.indexOf(strValue.substring(1,2)) > -1) { fOK = true; } else { fOK = false; }  }
		   if (fOK == true)
			{  if (strNumbers.indexOf(strValue.substring(2,3)) > -1) { fOK = true; } else { fOK = false; }  }
		   if (fOK == true)
			{  if (strNumbers.indexOf(strValue.substring(3,4)) > -1) { fOK = true; } else { fOK = false; }  }
		   if (fOK == true)
			{  if (strChars.indexOf(strValue.toUpperCase().substring(4,5)) > -1) { fOK = true; } else { fOK = false; }  }
		   if (fOK == true)
			{  if (strChars.indexOf(strValue.toUpperCase().substring(5,6)) > -1) { fOK = true; } else { fOK = false; }  }
		}
		
		if (fOK)
		{  //postcodes onder de 1000 zijn niet geldig.
		   if (strValue.substring(0,4) < '1000') {  fOK = false;  } 
		}
		
		return fOK;
	}

   function IsNumeric(strValue)
   {  var strValidChars = '0123456789';
      var fIsNumber = true;
      var strChar;
		var i;
 
      for (i = 0; i < strValue.length && fIsNumber == true; i++) 
      {  strChar = strValue.charAt(i); 
         if (strValidChars.indexOf(strChar) == -1) 
        {  fIsNumber = false;  }
      }
      return fIsNumber;
   }

	function IsPhoneNumber(strValue) 
	{  //controleer of een telefoonnummer minimaal 10 nummers heeft.
	   var strCheck = '1234567890';
	   var i = 0;
      var x = 0; 
      var strChar = '';
		
		for (i=0; i<strValue.length; i++)
		{  strChar = strValue.charAt(i); 
		   if (strCheck.indexOf(strChar) != -1) 
		   {  x++; } 
		}
		if (x >= 10) 
		{  return true; }
		else
		{  return false; }
	}

	function SendPage()
	{  var strError = '';

		//strError = P_Check();
	   
		if (strError == '')
	   	{  //document.frmMain.action = 'offer.aspx'; //'send.aspx';
		   document.frmMain.submit();
		}
		else
		{  alert(strError);
		}		
	}

	//if (window.Event)   
   	//document.captureEvents(Event.MOUSEUP);   

	//function nocontextmenu()    
	//{  	event.cancelBubble = true  
   	//	event.returnValue = false;  
   	//	return false;  
	//}  
	
	//function norightclick(e)   
	//{  if (window.Event)   
   	//{  if (e.which == 2 || e.which == 3)  
    //  	return false;  
   	//}  
   	//else  
   	//if (event.button == 2 || event.button == 3)  
   	//{  event.cancelBubble = true  
    //  	event.returnValue = false;  
    //  	return false;  
   	//}  
	//}  
	
	//document.oncontextmenu = nocontextmenu;   
	//document.onmousedown = norightclick;   