// JavaScript Document
 $(document).ready(function() {
	$(".txt").focus(function(){
			if($(this).val() == "nome" 
				|| $(this).val() == "e-mail"
				|| $(this).val() == "assunto"
				|| $(this).val() == "login"
				|| $(this).val() == "senha"
				|| $(this).val() == "e-mail cadastrado") {
			  $(this).val("");
			}
		}).blur(function(){
			if($(this).val() == "") {
				$(this).val($(this).attr("name"));
			}
	});
	$("#ajuda").focus(function(){
			if($(this).val() == "observações") {
			  $(this).val("");
			}
		}).blur(function(){
			if($(this).val() == "") {
				$(this).val("observações");
			}
	});
	$("#ajudaS").focus(function(){
			if($(this).val() == "em que podemos ajudar?") {
			  $(this).val("");
			}
		}).blur(function(){
			if($(this).val() == "") {
				$(this).val("em que podemos ajudar?");
			}
	});
	$(".txt").focus(function(){
			if($(this).val() == "telefone fixo" || $(this).val() == "celular") {			
			  $(this).val("");			
			  $(this).mask("(99) 9999-9999");  
			}
		}).blur(function(){
			if($(this).val() == "") {
			$(this).mask("********");
			$(this).val($(this).attr("name"));
		}
	});
	    $('#send').click(function() {
		$(this).closest("form").find("label").remove();
		var tipo = $(this).closest("form").attr("id");
		var nome = $('#nome').val();
		var email = $('#email').val();
		var assunto = $('#assunto').val();
		var tel = $('#tel').val();
		var cel = $('#cel').val();
		var ajuda = $('#ajudaS').val();
		$.post('mail.php', {
		    nome: nome,
		    assunto: assunto,
		    email: email,
		    tel: tel,
		    cel: cel,
		    ajuda: ajuda,
		    contato: true,
		    tipo: tipo
		}, function(data, textStatus) {
		    $('#resposta').html(data);	
		    var form = $('#resposta').siblings("form"); 
		    $('#resposta li').each(function(){
			var classe = $(this).attr("class");
			if (classe=="suc") {
			  form.find(".nome").append('<label for="'+classe+'" class="suc">'+$(this).html()+'</label>')
			} else {
			  form.find("."+classe).append('<label for="'+classe+'" class="error">'+$(this).html()+'</label>')
			}
			
		    });
		});
		return false;
	    });
	
});

 
 

