// JavaScript Document

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



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

	if (lastname =="" ) {
		document.getElementById( "realname_error" ).innerHTML = "Please enter your Last Name ";
		document.getElementById( "realname" ).style.background = "#EFEED1";
		errors++;
		} // close the if of the firstname check
	else {
		document.getElementById( "realname_error" ).style.background = "#FFFFDF";
		document.getElementById("realname_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 (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
}