// Submit Comment
function submitComment(){
	if ($("#commentName").val() == ""){
		alert("Name required");
		$("#commentName").focus();
	} else if($("#commentEmail").val() == ""){
		alert("Email required");		
		$("#commentEmail").focus();
	} else if (($("#commentEmail").val().indexOf(".") < 2) || ($("#commentEmail").val().indexOf("@") < 0)){
			alert("Email not valid");
			$("#commentEmail").focus();
	} else if($("#commentComment").val() == ""){
		alert("Comment required");
		$("#commentComment").focus();
	} else {
		$("#formComment").hide();
		$("#commentLoading").show();
		$.post("guestbook.php",{
			tName: $("#commentName").val(),
			tEmail: $("#commentEmail").val(),
			tComment: $("#commentComment").val(),
			action: "send-comment"
		}, function(json) {
			json = JSON.decode(json);
			if (json) {
				$("#commentForm").hide();
				if (json.error.code != 0) {
					$("#commentMsg").css('display', 'block').html(json.error.description);
				} else {
					$("#commentMsg").css('display', 'block').html(json.payload.msg);
				}
			}
		});
		$("#commentLoading").hide();
	}
	
	return false;
}