// JavaScript Document

// Email Validation
function validate_email(field) {
	with (field) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			return false;
		} else {
			return true;
		}
	}
}

// Form Check
function validate_form(this_form) {
	with (this_form) {
		var error_count = 0;
	
		// Check Field "Name"
		if ( name.value == "Your Name" ) {
			name.style.color = "#cf5a1f";
			error_count =++ error_count; // Increase by 1 - *ERROR* :- An error occured with the input information Form
		}
		
		// Check Field "E-mail Address"
		if ( email_address.value == "Enter Email Address" ) {
			email_address.style.color = "#cf5a1f";
			error_count =++ error_count; // Increase by 1 - *ERROR* :- An error occured with the input information Form
		} else if ( validate_email(email_address) == false) {
			email_address.style.color = "#cf5a1f";
			error_count =++ error_count; // Increase by 1 - *ERROR* :- An error occured with the input information Form
		}
		
		// Check Phone Number
		/* if ( phone_number.value == "Phone Number" ) {
			phone_number.style.color = "#cf5a1f";
			error_count =++ error_count; // Increase by 1 - *ERROR* :- An error occured with the input information Form
		} */
		
		// Check Comments
		if ( comments.value == "Comments and Questions" ) {
			comments.style.color = "#cf5a1f";
			error_count =++ error_count; // Increase by 1 - *ERROR* :- An error occured with the input information Form
		}
		
	}
	
	// Pass or Fail
	if ( error_count > 0 ) { return false; }
}
