//===prompt user before deleting records
function fConfirmDeletion() {
	if (!(confirm("This record will be permanently removed from the database. \n\n Are you sure you wish to delete this record?"))) {
		return(false)
	}
}


//===validate forms before submission
function fValidate(vThisForm){		
	//--admin login
	if (vThisForm == "frmLogin") {
		if (document[vThisForm].username.value == "") {
		alert("The field -Username- can not be left blank.")
		document[vThisForm].username.focus()
		return(false)
		}
		if (document[vThisForm].password.value == "") {
		alert("The field -Password- can not be left blank.")
		document[vThisForm].password.focus()
		return(false)
		}
	}
	
	if (vThisForm == "frmContact") {
		var vThisEmail = new String(document[vThisForm].EMAIL.value)
		if (document[vThisForm].EMAIL.value == "" || vThisEmail.search("@") == -1) {
			alert("The field - E-Mail - cannot be left blank and must be properly formatted.")
			document[vThisForm].EMAIL.focus()
			return(false)
		}
	}
	if (vThisForm == "frmNewsletter") {
		var vThisEmail = new String(document[vThisForm].EMAIL.value)
		if (document[vThisForm].EMAIL.value == "" || vThisEmail.search("@") == -1) {
			alert("The field - E-Mail - cannot be left blank and must be properly formatted.")
			document[vThisForm].EMAIL.focus()
			return(false)
		}
	}
		
	if (vThisForm == "addSchedule") {
		if (document[vThisForm].fname.value == "") {
		alert("The field -First Name- can not be left blank.")
		document[vThisForm].fname.focus()
		return(false)
		}
		if (document[vThisForm].lname.value == "") {
		alert("The field -Last Name- can not be left blank.")
		document[vThisForm].lname.focus()
		return(false)
		}
		if (document[vThisForm].street.value == "") {
		alert("The field -Street- can not be left blank.")
		document[vThisForm].street.focus()
		return(false)
		}
		if (document[vThisForm].city.value == "") {
		alert("The field -City- can not be left blank.")
		document[vThisForm].city.focus()
		return(false)
		}
		if (document[vThisForm].state.value == "") {
		alert("The field -State- can not be left blank.")
		document[vThisForm].state.focus()
		return(false)
		}
		if (document[vThisForm].zip.value == "") {
		alert("The field -Zip- can not be left blank.")
		document[vThisForm].zip.focus()
		return(false)
		}
		var vThisEmail = new String(document[vThisForm].email.value)
		if (document[vThisForm].email.value == "" || vThisEmail.search("@") == -1) {
			alert("The field -Contact Email- cannot be left blank and must be properly formatted.")
			document[vThisForm].email.focus()
			return(false)
		}
		if (document[vThisForm].phone.value == "") {
		alert("The field -Contact Phone- can not be left blank.")
		document[vThisForm].phone.focus()
		return(false)
		}
		var strGroupName="appt";
		var checkedCount=0;
		//alert(addSchedule.elements[strGroupName].length)
		for (var i=0; i<addSchedule.elements[strGroupName].length; i++)
		{
		   var curBox=addSchedule.elements[strGroupName][i];
		   checkedCount += (curBox.checked)?1:0;
		}
		if (checkedCount == 0)			
		{
		alert("You need to check at least one checkbox for the Appointment.");
		return(false)
		}
		if (document[vThisForm].aboutus.selectedIndex < 1) {
		alert("Please select --How did you hear about us?-- from the list.")
		document[vThisForm].aboutus.focus()
		return(false)
		}
		
			
	}
	
	
}