// JavaScript Document

	<!--NEWSLETTER-->
	
	$(document).ready(function(){
	
	
	$('#newsletter').click(function() {
		$('#dialog_newsletter').dialog('open');
	});	
	
	$("#dialog_newsletter").dialog({
		autoOpen: false,
		height: 300,
		width: 400,
		draggable: false,
		resizable: false,
		title: "Newsletter",
		modal: true,
		buttons: {
			'Cancelar': function() {
				$(this).dialog('close');
			},
			
			'Enviar': function() {	
			
				//alert(data);
				if($("#email").val()== ''){
					alert('Por favor preencha o email.');
				}else{
					$.post("./include/jx_newsletter.php", $("#frm_newsletter").serialize(), function(data){
						if (data == '1'){
							alert("Cadastro realizado com sucesso.");
							$("#dialog_newsletter").dialog('close');
						} else {
							alert("Falha no cadastro. Desculpe, tente novamente mais tarde.");
						}
					
					
				
					});
				}
			}
			
		},
		close: function() {
			$('embed, object, select').css({ 'visibility' : 'visible' });
			$("#nome").val('');
			$("#email").val('');
		}
	});
});



