function setupEvents(current_page) {
	
	if (current_page == "contact") {
		
//		document.getElementById("question_form").action = "";
		
		invalid_email = 0;
		
		function submitForm(event){
			
			//Prevent the form from submitting until it has been validated.
			YAHOO.util.Event.stopEvent(event);
			
			var email_el_1 = document.getElementById('email');
			var email_1 = email_el_1.value;
			var email_1_label = document.getElementById('email_label');
			var email_el_2 = document.getElementById('email_confirm');
			var email_2 = email_el_2.value;
			var email_2_label = document.getElementById('email_confirm_label');
			if (email_1.length > 0) {
				//TODO: modify regex to prevent two consecutive dot (".") charachters in the local-name 
				if (email_1.match(/^([a-zA-Z0-9_\-])([a-zA-Z0-9_\.\-])*\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)) {
					//There is no longer a problem with email_1
					email_el_1.className = email_el_1.className.replace(/\bform_error\b/, "");
					email_1_label.className = email_1_label.className.replace(/\bform_error\b/, "");
					if (email_1 == email_2) {
						//There is no longer a problem with email_2
						email_el_2.className = email_el_2.className.replace(/\bform_error\b/, "");
						email_2_label.className = email_2_label.className.replace(/\bform_error\b/, "");
						
						var question_el = document.getElementById('question');
						var question = question_el.value;
						var question_label = document.getElementById('question_label');
						if (question.length > 0) {
						//Submit the form
						document.getElementById("question_form").action = "contact.php";
						document.getElementById("question_form").submit();
						}
						else {
							alert("Please enter a question.");
							question_el.focus();
							if (!question_el.className.match(/\bform_error\b/)) 
								question_el.className += " form_error";
							if (!question_label.className.match(/\bform_error\b/)) 
								question_label.className += " form_error";
						}
					}
					else {
						alert("Please enter the same email address in both fields, to ensure that I can communicate with you.");
						email_el_2.focus();
						if (!email_el_2.className.match(/\bform_error\b/)) 
							email_el_2.className += " form_error";
						if (!email_2_label.className.match(/\bform_error\b/)) 
							email_2_label.className += " form_error";
					}
				}
				else {
					var alert_str = "Please enter a valid email address.";
					if (invalid_email > 0) 
						alert_str += " The following obscure characters are not allowed: ! # $ % * / ? | ^ { } ` ~ & ' + = ";
					alert(alert_str);
					invalid_email++;
					email_el_1.focus();
					if (!email_el_1.className.match(/\bform_error\b/)) 
						email_el_1.className += " form_error";
					if (!email_1_label.className.match(/\bform_error\b/)) 
						email_1_label.className += " form_error";
				}
			}
			else {
				alert("Please enter an email address so that I can contact you to answer your question.");
				email_el_1.focus();
				if (!email_el_1.className.match(/\bform_error\b/)) 
					email_el_1.className += " form_error";
				if (!email_1_label.className.match(/\bform_error\b/)) 
					email_1_label.className += " form_error";
			}
		}
		
//		YAHOO.util.Event.addListener(document.getElementById('question_submit'), "click", submitForm);
		YAHOO.util.Event.addListener(document.getElementById('question_form'), "submit", submitForm);
	}
}
