// JavaScript Document
function lilvalidate(form) {
  	var e = form.elements;
  	
	if(e['name'].value == "") {
		alert('Please fill in the Name field.');
		return false;
	}
	if(e['email'].value == "") {
		alert('Please fill in the Email field.');
		return false;
	}	
	
  	var apos = e['email'].value.indexOf("@");
  	var dotpos = e['email'].value.lastIndexOf(".");
  	if (apos<1||dotpos-apos<2) {
		alert('Please enter a valid Email address.');
		return false;
	}
	
	if(e['phone'].value == "") {		
		alert('Please fill in the Phone field.');
		return false;
	} 
	
	var stripped = e['phone'].value.replace(/[\(\)\.\-\ ]/g, '');   
	if (isNaN(parseInt(stripped))) {
		alert("The phone number contains illegal characters.");
		return false;
	} else if (!(stripped.length == 10)) {
		alert("The phone number is the wrong length. Make sure you included an area code.");
		return false;
	} 
	
	return true;
}