/* Declare a namespace for the site */
var Site = window.Site || {};

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {
	
	//same as $(document).ready();
	$(function() {
		
		$("#contato").submit(function() {
			if($("#nome").val() == "") {
				$.talert('Por favor, preencha seu nome.');
				$("#nome").focus();
				return false;
			} else if($("#email").val() == "") {
				$.talert('Por favor, preencha seu email.');
				$("#email").focus();
				return false;
			} else if($("#mensagem").val() == "") {
				$.talert('Por favor, diga-nos o que deseja.');
				$("#mensagem").focus();
				return false;
			} else {
				/* Posta */
				$("#botao").html('Enviando').attr('disabled', true);
				$.post("contato.php", { nome: $("#nome").val(), email: $("#email").val(), mensagem: $("#mensagem").val() }, function(d) {
					$("#nome").attr('disabled', true);
					$("#email").attr('disabled', true);
					$("#mensagem").attr('disabled', true);
					$.talert('Sua mensagem foi enviada com sucesso! Obrigado!');
				});
			}
			return false;
		});

	});


	$(window).bind("load", function() {
		
		
	
	});
	
})(jQuery);
