function trim(text){
	text = text.replace(/^\s+/, "");
	text = text.replace(/\s+$/, "");
	text = text.replace(/\s+/g, " ");
	return text;
}

function checkFeedbackForm(){		
	
	if (trim($("#contact-name").val()).length < 2 || trim($("#contact-name").val()) == "Type Your Full Name"){
		alert("Please enter your full name.");
		$("#contact-name").val(trim($("#contact-name").val()));
		$("#contact-name").focus();
		return false;
	}
	
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(trim($("#contact-email").val()))) || trim($("#contact-email").val()) == "name@domain.com"){
		alert("Please enter a valid email address.");
		$("#contact-email").val(trim($("#contact-email").val()));
		$("#contact-email").focus();
		return false;
	}
	
	if (trim($("#contact-comment").val()).length < 2 || trim($("#contact-comment").val()) == "Type your comments here"){
		alert("Please enter your comment.");
		$("#contact-comment").val(trim($("#contact-comment").val()));
		$("#contact-comment").focus();
		return false;
	}
	
	return true;
}
