/**
 * @author Thiago Prazeres - thiagoprazeres@gmail.com
 */
$(document).ready(function(){
	$("#telefone").mask("(99) 9999-9999");
	//Torna campo obrigatório
	//$("#nome, #email2, #assunto, #mensagem").attr("accept", true);
	//$("#email2").attr("mask", "email");
	//Habilita validação do formulário
	$('#form_contato').submit(function(){
		$("input[name!=telefone], textarea").each(function(i){
			if($(this).attr("value")==""){
				$(this).addClass("invalidInput");
				//$("#respostaemail").fadeIn().html("Preencha o campo "+$(this).attr("name"));
				return false;
			}else{
				$(this).removeClass("invalidInput");
			}
		});
		return callback();
	});
});
function callback(){
	var parametros = $('#form_contato').serialize();
			$.ajax({type: "POST",
					url: $("#form_contato").attr("action"),
					data: parametros,
					success: function(msg){
						$("#respostaemail").fadeIn().html(msg);
					}
			});
	return false;
}
