///////////////////////// Email Check Validation /////////////////////////////
function echeck(str) 
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   alert("Ongeldig E-mail-ID")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Ongeldig E-mail-ID")
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Ongeldig E-mail-ID")
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		alert("Ongeldig E-mail-ID")
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Ongeldig E-mail-ID")
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		alert("Ongeldig E-mail-ID")
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		alert("Ongeldig E-mail-ID")
		return false
	 }

	 return true					
}

/////////////////////////////// Contact Us Send Mail From Validations ////////////////////////
function ContactValidation()
{

	if (( document.contactform.rdoContactPerson[0].checked == false ) && ( document.contactform.rdoContactPerson[1].checked == false ) && ( document.contactform.rdoContactPerson[2].checked == false )) 
	{ 
		alert ( "Gelieve de juiste contactpersoon te selecteren." ); 
		return false; 
	} 
  if (document.contactform.txtName.value==''){
	    alert('Geef uw naam op.');
		document.contactform.txtName.focus();
		return false;
	}
 if (document.contactform.txtAddress.value==''){
	    alert('Vul uw adres in.');
		document.contactform.txtAddress.focus();
		return false;
	}
 if (document.contactform.txtPostcode.value==''){
	    alert('Geef uw postcode op.');
		document.contactform.txtPostcode.focus();
		return false;
	}
 if (document.contactform.txtPlaats.value==''){
	    alert('Geef uw plaats op.');
		document.contactform.txtPlaats.focus();
		return false;
	}
 if ((document.contactform.txtEmail.value==null)||(document.contactform.txtEmail.value=="")){
		alert("Vul uw e-mailadres in.")
		document.contactform.txtEmail.focus();
		return false;
   }
	if (echeck(document.contactform.txtEmail.value)==false){
		document.contactform.txtEmail.value=""
		document.contactform.txtEmail.focus();
		return false;
	}	
	if (document.contactform.txtTelefone.value==''){
	    alert('Geef uw telefoonnummer op.');
		document.contactform.txtTelefone.focus();
		return false;
	}	
	if (document.contactform.txtVragen.value==''){
	    alert('Stel uw vraag.');
		document.contactform.txtVragen.focus();
		return false;
	}
	return true;
}


/////////////////////////// Regstration Validations ///////////////////////////////////////////
 
function RegValidation()
{
  
	if (document.regform.txtusername.value==''){
		alert('Please Enter User Name.');
		document.regform.txtusername.focus();
		return false;
	}
	if (document.regform.txtPassword.value==''){
	    alert('Please Enter Password.');
		document.regform.txtPassword.focus();
		return false;
	}
	if (document.regform.txtCpassword.value==''){
	    alert('Please Enter Confirm Password.');
		document.regform.txtCpassword.focus();
		return false;		
	}
	if (document.regform.txtPassword.value!=document.regform.txtCpassword.value){
	    alert('Passwords do not match, please retype.');
		document.regform.txtCpassword.focus();
		return false;		
	}
	if (document.regform.txtfirstname.value==''){
		alert('Please Enter First Name.');
		document.regform.txtfirstname.focus();
		return false;
	}
	if (document.regform.txtLastname.value==''){
		alert('Please Enter Last Name.');
		document.regform.txtLastname.focus();
		return false;
	}
	if (( document.regform.rdoGender[0].checked == false ) && ( document.regform.rdoGender[1].checked == false )) 
	{ 
		alert ( "Please Select Gender M/F" ); 
		return false; 
	} 
	if (document.regform.txtContactNo.value==''){
		alert('Please Enter Contact Number.');
		document.regform.txtContactNo.focus();
		return false;
	}
	if (document.regform.txtAddress.value==''){
		alert('Please Enter Your Address.');
		document.regform.txtAddress.focus();
		return false;
	}	
	if (document.regform.txtFax.value==''){
		alert('Please Enter Fax Number.');
		document.regform.txtFax.focus();
		return false;
	}
	if ((document.regform.txtEmail.value==null)||(document.regform.txtEmail.value=="")){
		alert("Please Enter your Email ID")
		document.regform.txtEmail.focus();
		return false;
   }
	if (echeck(document.regform.txtEmail.value)==false){
		document.regform.txtEmail.value=""
		document.regform.txtEmail.focus();
		return false;
	}
	if (document.regform.txtpostalcode.value==''){
		alert('Please Enter Postal Code.');
		document.regform.txtpostalcode.focus();
		return false;
	}
	if (document.regform.txtCountry.value==''){
		alert('Please Enter Country Name.');
		document.regform.txtCountry.focus();
		return false;
	}
	
	 return true;
}

//////////////////////// Login Validations /////////////////////////////////////
 
function LoginValidation()
{
  
	if (document.flogin.txtuserid.value==''){
		alert('Gelieve Geef User ID.');
		document.flogin.txtuserid.focus();
		return false;
	}
	if (document.flogin.txtpassword.value==''){
	    alert('Voer uw wachtwoord.');
		document.flogin.txtpassword.focus();
		return false;
	}
   return true;
}

/////////////////////////// Landlord Validations ///////////////////////////////////////////
 //////////////////////////////// Forgot Password ///////////////////////////////
function Forgotepassword()
{
  if (document.frmforgotpwd.txtUsername.value==''){
	    alert('Vul uw gebruikersnaam in.');
		document.frmforgotpwd.txtUsername.focus();
		return false;
	}
	if ((document.frmforgotpwd.txtEmail.value==null)||(document.frmforgotpwd.txtEmail.value=="")){
		alert("Vul uw e-mailadres in.")
		document.frmforgotpwd.txtEmail.focus();
		return false;
   }
	if (echeck(document.frmforgotpwd.txtEmail.value)==false){
		document.frmforgotpwd.txtEmail.value=""
		document.frmforgotpwd.txtEmail.focus();
		return false;
	}
	return true;
}

/////////////////////////// BOA FORM  Validations ///////////////////////////////////////////
 
function FormValidation()
{
  
	if (document.frm_boa.txtNaambedrijf.value==''){
		alert('Geef uw Naambedrijf.');
		document.frm_boa.txtNaambedrijf.focus();
		return false;
	}
	if (document.frm_boa.txtNaamdeelnemer.value==''){
	    alert('Vul uw Naamdeelnemer.');
		document.frm_boa.txtNaamdeelnemer.focus();
		return false;
	}
	if (document.frm_boa.txtAdres.value==''){
	    alert('Vul txtAdres.');
		document.frm_boa.txtAdres.focus();
		return false;		
	}
	if (document.frm_boa.txtPostcode.value==''){
		alert('Vul uw Postcode.');
		document.frm_boa.txtPostcode.focus();
		return false;
	}
	if (document.frm_boa.txttav.value==''){
		alert('Geef uw tav.');
		document.frm_boa.txttav.focus();
		return false;
	}
	if (document.frm_boa.txtAdres1.value==''){
		alert('Vul uwAdres1 in.');
		document.frm_boa.txtAdres1.focus();
		return false;
	}
	if (document.frm_boa.txtPostcode1.value==''){
		alert('Geef uw tPostcode1.');
		document.frm_boa.txtPostcode1.focus();
		return false;
	}
	if ((document.frm_boa.txtE_mail.value==null)||(document.frm_boa.txtE_mail.value=="")){
		alert("Vul uw e-mailadres in.")
		document.frm_boa.txtE_mail.focus();
		return false;
   }
	if (echeck(document.frm_boa.txtE_mail.value)==false){
		document.frm_boa.txtE_mail.value=""
		document.frm_boa.txtE_mail.focus();
		return false;
	}	
	 return true;
}
///////////////////////////////////////////////////////////////////////////////////
