// JavaScript Document
$(document).ready(function(){
	$("a[rel=external]").attr('target','_blank');
	$('#form_nome').focus(function(){
  		if (this.value == "Seu nome")
		{
			this.value = "";	
		}
	});
	$('#form_email').focus(function(){
  		if (this.value == "Seu e-mail")
		{
			this.value = "";	
		}
	});
	$('#form_nome').blur(function(){
  		if (this.value == "")
		{
			this.value = "Seu nome";	
		}
	});
	$('#form_email').blur(function(){
  		if (this.value == "")
		{
			this.value = "Seu e-mail";	
		}
	});
	$("#form-aviseme").validate({
		submitHandler: function(form) {
			$(form).ajaxSubmit({
				type: 'post',
				success: resultado
			});
		},
		rules: {
			nome: {
				required: true,
				remote: 'processa/checanome'
			},
			email: {
				required: true,
				email: true,
				remote: 'processa/checaemail'
			}
		},
		messages: {
			nome: { remote: 'Preencha corretamente seu nome.'},
			email: { remote: 'Seu e-mail já está cadastrado em nossa base de dados.'}	
		}
	});
});
function resultado(data) {
	$('#result').html(data);
		
}
