	//Função 100% AJAX por "wender lima"
	//http://www.ajaxianos.com.br/
	//Função única que fará a transação
	function getEndereco( n ) {
		// Se o campo CEP não estiver vazio
		if($.trim($("#cep"+n).val()) != ""){
			$.getScript("http://cep.republicavirtual.com.br/web_cep.php?formato=javascript&cep="+$("#cep"+n).val(), function(){
				// o getScript dá um eval no script, então é só ler!
				//Se o resultado for igual a 1
				if(resultadoCEP['resultado']){
					if(resultadoCEP['logradouro']  == '')
						alert('Endereço não encontrado');
					else{
						// troca o valor dos elementos
						$("#rua"+n).val(unescape(resultadoCEP['tipo_logradouro'])+': '+unescape(resultadoCEP['logradouro']));
						$("#bairro"+n).val(unescape(resultadoCEP['bairro']));
						$("#cidade"+n).val(unescape(resultadoCEP['cidade']));
						$("#estado"+n).val(unescape(resultadoCEP['uf']));
					}
				}else{
					alert('Endereço não encontrado');
				}
			});
		}
	}


	$(document).ready(function(){
		$('#boletins li a').click(function(){
			window.open($(this).attr('href'));
			return false;
		});
		$('#add').click(function(){
			$('#trD2').clone(true).appendTo('table');
			$('table tr:last:input').reset();
		});
		
		$('#menu > li').hover(
			function () {
				$(this).css({ backgroundImage: "url('http://www.grupovivamelhor.org.br/img/bg-menu-li-h.png')" });
				$(this).children('a').css({ backgroundImage: "url('http://www.grupovivamelhor.org.br/img/bg-menu-a-h.jpg')" });
				$(this).find('ul').show();
		},
			function () {
				$(this).css({ backgroundImage: "url('http://www.grupovivamelhor.org.br/img/bg-menu-li.png')" });
				$(this).children('a').css({ backgroundImage: "url('http://www.grupovivamelhor.org.br/img/bg-menu-a.jpg')" });
				$(this).find('ul').hide();
		});
		
		var tamanho = 12;
		$('#conteudo #lupa span').eq(0).click(function(){
			if(tamanho < 24 )
			{
				tamanho += 2;
				$('#conteudo').css('font-size', tamanho+'px');
				$('#conteudo span').css('font-size', tamanho+'px');
				$('#conteudo p').css('font-size', tamanho+'px');
				$('#conteudo li').css('height', (parseInt(tamanho)*11)+'px');
				$(this).css('font-size', '12px');
				$('#conteudo #lupa span').eq(1).css('font-size', '12px');
			}
			else
				alert('Aumento máximo');
		});
		$('#conteudo #lupa span').eq(1).click(function(){
			tamanho = 12;
			$('#conteudo').css('font-size', '12px');
			$('#conteudo span').css('font-size', '12px');
			$('#conteudo p').css('font-size', '12px');
		});
		$('#newsletter li a').click(function(){
			window.open($(this).attr('href'));
			return false;
		});
	});