//::::::::::::::::::Validate Email:::::::::::

function checkEmail(string, isrequired)
{
	if (string != '') // User is not required to enter an email address.  If there is no email address, continue. But if there is one, check to make sure it is valid.
		{
		atChar = string.indexOf("@"); // search for @ in email address to see if it is valid
		dotChar = string.lastIndexOf("."); // search for a period (.) in email address to see if it is valid

		if (atChar && dotChar == "-1") // if there is no "@" or ".", the email is invalid
			{
			alert("You're E-mail address seems to be invalid")
			return false;
			}
		}
}

//::::::::::::::::::Validate Phone Number:::::::::::
function checkPhone(string, required)
{

if (string == '')
	{
	alert ("Please provide your phone number");
	return false;
	}

else if (string != '') 
	{
	var validCharacters = "0123456789 ()-."
	for (i=0; i<string.length; i++)
		if (validCharacters.indexOf(string.charAt(i)) == -1) // take each character in "string"; if you can find it in list of "validCharacter", then the string is good; if there is an odd character, result will be "-1" causing a "return false"
		{
		alert ("Your phone number seems to be invalid.\nPlease don't use any letters.");
		return false;
		}
	}
}


