function isEmailAddr(theemail) {
	var result = false
	var theStr = new String(theemail)
	var index = theStr.indexOf("@");
	if (index > 0) {
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1))
		result = true;
	}
	return result;
}

//Used by cust_template_restylane.cfm (Sign up for news about Restylane) AND cus_template_schedule.cfm (Schedule A Free Consultation)
function validateOne(that) {
	if ((that.first.value=="") | (that.first.value=="First Name")) {
		alert("Please enter a first name.");
		that.first.focus();
		return false;
	}
	if ((that.last.value=="") | (that.last.value=="Last Name")) {
		alert("Please enter a last name.");
		that.last.focus();
		return false;
	}
	if ((that.email.value=="") | (that.email.value=="E-Mail")) {
		alert("Please enter an email address.");
		that.email.focus();
		return false;
	}
	if (!isEmailAddr(that.email.value)) {
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		that.email.focus();
		return false;
	}
	if (that.email.value.length < 3) {
		alert("Please enter at least 3 characters in the \"email\" field.");
		that.email.focus();
		return false;
	}
	if (that.telephone.value.length < 10) {
		alert("Phone number (with area code) is required.")
		that.telephone.focus();
		return false;
	}
}

function validateSearch(that) {
	if (that.srch.value=="") {
		alert("Please enter search criteria.");
		that.srch.focus();
		return false;
	}
}

function validateTwo(that) {
	if (that.first.value=="") {
		alert("Please enter a first name.");
		that.first.focus();
		return false;
	}
	if (that.last.value=="") {
		alert("Please enter a last name.");
		that.last.focus();
		return false;
	}
	if (that.email.value=="") {
		alert("Please enter an email address.");
		that.email.focus();
		return false;
	}
	if (!isEmailAddr(that.email.value)) {
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		that.email.focus();
		return false;
	}
	if (that.email.value.length < 3) {
		alert("Please enter at least 3 characters in the \"email\" field.");
		that.email.focus();
		return false;
	}
}

function validateThree(that) {
	if (that.first.value=="") {
		alert("Please enter a first name.");
		that.first.focus();
		return false;
	}
	if (that.last.value=="") {
		alert("Please enter a last name.");
		that.last.focus();
		return false;
	}
	if (that.email.value=="") {
		alert("Please enter an email address.");
		that.email.focus();
		return false;
	}
	if (that.telephone.value=="") {
		alert("Please enter your telephone number.");
		that.telephone.focus();
		return false;
	}
	if (!isEmailAddr(that.email.value)) {
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		that.email.focus();
		return (false);
	}
	if (that.email.value.length < 3) {
		alert("Please enter at least 3 characters in the \"email\" field.");
		that.email.focus();
		return (false);
	}
	with (that.locations) {
		RetVal = true;
		if (options[selectedIndex] == null) RetVal = false;
			else RetVal = !(options[selectedIndex].value == '');
		if (!RetVal) alert('Please choose a Location for the Appointment.');
		return RetVal
	}
	with (that.services) {
		RetVal = true;
		if (options[selectedIndex] == null) RetVal = false;
			else RetVal = !(options[selectedIndex].value == '');
		if (!RetVal) alert('Please choose at least once service.');
		return RetVal
	}
}
