
/*----------------------------------------------/
author : Joenas Ejes <joenasejes@gmail.com>
date : 4.17.10
-----------------------------------------------*/


function validateForm(){
	
	var title		=	$("#title").val();
	var textbody	=	$("#body").val();
	var reg 		= 	/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var email		=	$("#email").val();
	var fileupload	=	$("#fileupload").val();
	var fullname	=	$("#fullname").val();
	var petname		=	$("#petname").val();
	var captcha		=	$("#recaptcha_response_field").val();
	var terms		=	$("input[name=terms]:checked").val();
	var msg			= 	"";
	
	if(title == "")	msg+="- Title should not be empty.\n";
	if(textbody == "")	msg+="- Body should not be empty.\n";
	if(reg.test(email) == false) msg+="- Email should be in valid format, e.g. john@doe.com.\n";
	if(fullname == "") msg+="- Name should not be empty.\n";
	if(petname == "") msg+="- Pet's name should not be empty.\n";
	if(captcha == "") msg+="- Word verification should not empty.\n";
	if(terms != "yes") msg+="- You must agree to our Terms and Conditions.\n";

	if(msg){
		alert(msg);	
		return false;
	}else{
		return true;	
	}
	
}


