$(document).ready(function(){

	 $("input,textarea").focus(function () {
         $(this).css('background-color','#d0ffbf');
    });

	$("input,textarea").blur(function () {
         $(this).css('background-color','white');
    });
	
});

function validateComment() {
	if(document.comment.name.value == "") {
		alert("You must enter your name.");
		document.comment.name.focus();
		document.comment.name.style.backgroundColor = "pink";
		return false;
	}	
	var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
	if(!pattern.test(document.comment.email.value)) {
		alert("You must enter a vaild email address.");
		document.comment.email.focus();
		document.comment.email.style.backgroundColor = "pink";
		return false;
	}
	if(document.comment.comment.value == "") {
		alert("You can't post a blank comment, please enter some comment text.");
		document.comment.comment.focus();
		document.comment.comment.style.backgroundColor = "pink";
		return false;
	}	
	return true;
}
