$().ready(function() {
	// validate the comment form when it is submitted
	$("#commentForm").validate();

	$('#send-button').click(function(){
		if( $('#commentForm').valid() ) {
			$('#send-button').attr("disabled", true);
			$.ajax({
				type: "POST",
				url: $("#commentForm").attr('action'),
				data: $("#commentForm").serialize(),
				success: function(ret){
		       			//alert( "Gracias, por contactarse con nosotros");
					alert( ret );
					$('#send-button').attr("disabled", false);
					document.getElementById('commentForm').reset();
				},				
				error: 	function(e){	
					$('#send-button').attr("disabled", false);
				}
			});
		}
	});

	// validate the comment form when it is submitted
	$("#commentFormRecommend").validate();

	$('#send-buttonRecommend').click(function(){
		if( $('#commentFormRecommend').valid() ) {
			$('#send-buttonRecommend').attr("disabled", true);
			$.ajax({
				type: "POST",
				url: $("#commentFormRecommend").attr('action'),
				data: $("#commentFormRecommend").serialize(),
				success: function(ret){
		       			//alert( "Gracias, por contactarse con nosotros");
					alert( ret );
					$('#send-buttonRecommend').attr("disabled", false);
					document.getElementById('commentFormRecommend').reset();
				},				
				error: 	function(e){	
					$('#send-buttonRecommend').attr("disabled", false);
				}
			});
		}
	});

	// validate the comment form when it is submitted
    $("#publicationForm").validate();

	$('#send-buttonPub').click(function(){
		if( $('#publicationForm').valid() ) {
			$('#send-buttonPub').attr("disabled", true);
			$.ajax({
				type: "POST",
				url: $("#publicationForm").attr('action'),
				data: $("#publicationForm").serialize(),
				success: function(ret){
		       			//alert( "Gracias, por contactarse con nosotros");
					alert( ret );
					$('#send-buttonPub').attr("disabled", false);
					document.getElementById('publicationForm').reset();
				},				
				error: 	function(e){	
					$('#send-buttonPub').attr("disabled", false);
				}

			});
		}
	});

});


