// Form Field checker - Litigation


function ValidateLitigation(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
	if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.telephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.telephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
		if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}

	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}



// Form Field checker - Conveyancing


function ValidateConveyancing(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
	if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.telephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.telephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}
	

	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}


// Form Field checker - Change of Name


function ValidateChangeOfName(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
	if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.tp.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.tp.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}
	

	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}


// Form Field checker - Lasting Powers of Attorney


function ValidateLpa(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
	if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.telephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.telephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}
	

	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}





// Form Field checker - Divorce and Family


function ValidateDivorceAndFamily(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
		if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.telephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.telephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}
	

	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}




///////////////////////////////////////////////////////////////////////////////


// Form Field checker - Probate


function ValidateProbate(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
	if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.telephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.telephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}
	
	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}

/////////////////////////////////////////////////////////////


// Form Field checker - Wills


function ValidateWills(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
	if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.telephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.telephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}
	
	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}

// Form Field checker - Personal Injury


function ValidatePersonalInjury(objForm)
{
	
	if (!objForm.chTermsConditions.checked)
	{
		window.alert("You need to agree to the terms & conditions.");
		objForm.chTermsConditions.focus();
		return false;
	}
	
	if (objForm.fullname.value == "")
	{
		window.alert("Full Name is a required Field");
		objForm.fullname.focus();
		return false;
	}

	if (objForm.telephone.value == "")
	{
		window.alert("Telephone is a required Field");
		objForm.telephone.focus();
		return false;
	}
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}
	
	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}
	

	if (!objForm.chconfirmdelivery.checked)
	{
		window.alert("Please confirm that the papers and documents will be sent by special or other secure delivery.");
		objForm.chconfirmdelivery.focus();
		return false;
	}


	return true;
}





/////////////////////////////////////////////////////**



/*
 * Create email adresses
 * Used instead of mailto: for preventing spam
 */
 
sendMail = function(user,domain) {
	try {
		locationstring = "mailto:" + user + "@" + domain; 
		window.location = locationstring; 
	}
	catch(error) {
		errorMessage(error, "There was an error when trying to send mail to:\n\n"+user+"@"+domain);
		return false;
	}
}



//////////////////////////////////////////////////

// Form Field checker - Contact


function Validate(objForm)
{
	if (objForm.txtName.value == "")
	{
		window.alert("Name is a required Field");
		objForm.txtName.focus();
		return false;
	}
	
	
	if (objForm.txtEmail.value == "")
	{
		window.alert("Email Address is a required Field");
		objForm.txtEmail.focus();
		return false;
	}

	if (objForm.txtEmail.value.indexOf("@", 0) == -1 || (objForm.txtEmail.value.indexOf("@", 0) != objForm.txtEmail.value.lastIndexOf("@", (objForm.txtEmail.value.length - 1))) || objForm.txtEmail.value.indexOf(".", 0) == -1)
	{
		window.alert("Email Address must be a valid Email Address");
		objForm.txtEmail.focus();
		return false;
	}


	if (objForm.txtEmail.value != objForm.txtEmailConfirm.value)
	{
		window.alert("Email has not been confirmed");
		objForm.txtEmailConfirm.focus();
		return false;
	}

	

	return true;
}

//////////////////////////////////////////////////

