// JavaScript Document
// Check Form
function checkappointmentForm() {
	formErrors = false;
	if (document.post.day.value.length < 1) {
		formErrors = "Please Select The Day That You Would Like to be Seen.";
		document.post.day.focus();
	}
	if (document.post.timeday.value.length < 1) {
		formErrors = "Please Select The Time of Day That Best Works for You.";
		document.post.timeday.focus();
	}
	if (document.post.attorney.value.length < 1) {
		formErrors = "Please Select The Attorney You Would Like to See.";
		document.post.attorney.focus();
	}
	if (document.post.area.value.length < 1) {
		formErrors = "Please Select The Area of Law Pertaining to Your Request.";
		document.post.area.focus();
	}

	if (document.post.email1.value != document.post.email2.value) {
		formErrors = "The E-mail Addresses You Entered Do Not Match.";
		document.post.email1.focus();
	}
        // is second email adress valid?
        var y = document.post.email2.value;
        if( y.indexOf('@')==-1 || y.indexOf('.')==-1 || y.indexOf(' ')!=-1 || y.length<7 || !y)
        {
               	formErrors = "You Must Enter a Valid Email Address.";
	       	document.post.email2.focus();
        }
        // is first email adress valid?
        var x = document.post.email1.value;
        if( x.indexOf('@')==-1 || x.indexOf('.')==-1 || x.indexOf(' ')!=-1 || x.length<7 || !x)
        {
               	formErrors = "You Must Enter a Valid Email Address.";
	       	document.post.email1.focus();
        }
	if (document.post.phone.value.length < 1) {
		formErrors = "Please Enter Your Phone Number.";
		document.post.phone.focus();
	}
	if (document.post.zip.value.length < 1) {
		formErrors = "Please Enter Your Zip Code.";
		document.post.zip.focus();
	}
	if (document.post.state.value.length < 1) {
		formErrors = "Please Select Your State.";
		document.post.state.focus();
	}
	if (document.post.city.value.length < 1) {
		formErrors = "Please Enter Your City.";
		document.post.city.focus();
	}
	if (document.post.address.value.length < 1) {
		formErrors = "Please Enter Your Address.";
		document.post.address.focus();
	}
	if (document.post.lname.value.length < 1) {
		formErrors = "Please Enter Your Last Name.";
		document.post.lname.focus();
	}

	if (document.post.fname.value.length < 1) {
		formErrors = "Please Enter Your First Name.";
		document.post.fname.focus();
	}
	if (formErrors) {
		alert(formErrors);
		return false;
	}
}

