// JavaScript Document

window.onload = function () {
//		alert ("inside window.onload");
if (document.getElementById('formpage')) {
	document.getElementById ("formpage").onsubmit = function() {
//		alert ("inside onsubmit");
	
	errors=0;
	fullname = document.getElementById ("fullname").value;
	email = document.getElementById("email").value;
	phone = document.getElementById ("phone").value;



// checking for valid Full Name		
	if (fullname =="" ) {
		document.getElementById( "fullname_error" ).innerHTML = "Please enter your Full Name ";
		document.getElementById( "fullname" ).style.background = "#EFEED1";
		errors++;
		} // close the if of the firstname check
	else {
		document.getElementById( "fullname_error" ).style.background = "#FFFFDF";
		document.getElementById("fullname_error" ).innerHTML = "";
		}  // close the firstname error checking if statement 

	if (email =="" ) {
		document.getElementById( "email_error" ).innerHTML = "Please enter your Email address ";
		document.getElementById( "email" ).style.background = "#EFEED1";
		errors++;
		} // close the if of the firstname check
	else {
		document.getElementById( "email_error" ).style.background = "#FFFFDF";
		document.getElementById("email_error" ).innerHTML = "";
		}  // close the firstname error checking if statement 
	if (phone =="" ) {
		document.getElementById( "phone_error" ).innerHTML = "Please enter your Phone Number ";
		document.getElementById( "phone" ).style.background = "#EFEED1";
		errors++;
		} // close the if of the firstname check
	else {
		document.getElementById( "phone_error" ).style.background = "#FFFFDF";
		document.getElementById("phone_error" ).innerHTML = "";
		}  // close the firstname error checking if statement 



	if (errors > 0) {
		return false; 
		} // close the if error checking
	else {
		return true; 

		} // close the else of error checking


} // close the on submit function
} // end check for document.getElementById
}