// JavaScript Document

// PopUp
function popup(){
window.open('http://www.anda.jor.br/wp-content/themes/anda/radio_online.php','popup','width=200,height=260,scrolling=auto,top=0,left=0')
}

// Link Tradutor
function link_tradutor(lk){
	document.location.href = lk; 
}

function verificaReporter()
	{
		if (document.contact_form.nome.value =='')
		{
			window.alert("Informe o seu nome.");
			document.contact_form.nome.focus();
			return false;
		}
		
		if (document.contact_form.credito.value=='')
		{
			window.alert("Informe o nome para crédito.");
			document.contact_form.credito.focus();
			return false;
		}
		
		if (document.contact_form.email.value=='')
		{
			window.alert("Informe o seu email.");
			document.contact_form.email.focus();
			return false;
		}
		else
		{
			if (!(Email(document.contact_form.email.value)))
			{
				window.alert("Informe o seu email corretamente.");
				document.contact_form.email.focus();
				return false;
			}
		} 	
			
		if (document.contact_form.rg.value=='')
		{
			window.alert("Informe o seu RG.");
			document.contact_form.rg.focus();
			return false;
		}
		
		if (document.contact_form.cpf.value=='')
		{
			window.alert("Informe o seu CPF.");
			document.contact_form.cpf.focus();
			return false;
		}
			
		if (document.contact_form.uf.value=='')
		{
			window.alert("Selecione o seu estado.");
			document.contact_form.uf.focus();
			return false;
		}
		
		if (document.contact_form.uf.value=='')
		{
			window.alert("Selecione o seu estado.");
			document.contact_form.uf.focus();
			return false;
		}
		
		
		if (document.contact_form.cidade.value=='')
		{
			window.alert("Informe a sua cidade.");
			document.contact_form.cidade.focus();
			return false;
		}
		
		
		if (document.contact_form.cep.value=='')
		{
			window.alert("Informe o seu CEP.");
			document.contact_form.cep.focus();
			return false;
		}
		
		if (document.contact_form.pais.value=='')
		{
			window.alert("Informe o seu país.");
			document.contact_form.pais.focus();
			return false;
		}
		
		if (document.contact_form.cep.value=='')
		{
			window.alert("Informe o seu CEP.");
			document.contact_form.cep.focus();
			return false;
		}
		
		if (document.contact_form.telefone_ddd.value=='')
		{
			window.alert("Informe o DDD do seu telefone.");
			document.contact_form.telefone_ddd.focus();
			return false;
		}
		
		if (document.contact_form.telefone.value=='')
		{
			window.alert("Informe o seu telefone.");
			document.contact_form.telefone.focus();
			return false;
		}
		
		if (document.contact_form.celular_ddd.value=='')
		{
			window.alert("Informe o DDD do seu celular.");
			document.contact_form.celular_ddd.focus();
			return false;
		}
		
		if (document.contact_form.celular.value=='')
		{
			window.alert("Informe o seu celular.");
			document.contact_form.celular.focus();
			return false;
		}
		
		if (document.contact_form.msg.value=='')
		{
			window.alert("Informe a descrição do seu material.");
			document.contact_form.msg.focus();
			return false;
		}
		
		if (document.contact_form.termos.checked==false)
		{
			window.alert("Você deve autorizar a publicação do material.");
			return false;
		}
	}
	
	email="qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM@0123456789-_.";
	function Email(campo)
	{
		campo = campo.toLowerCase(); 
		str_email = campo; 
		tamanho=campo.length-1;
		for (var i=0;i<=str_email.length;i++)
		{
			if (email.indexOf(str_email.charAt(i))<0)
			{
				return false;
			}
		}
		if (campo.indexOf(".")==0||campo.indexOf("@")==0||campo.indexOf("@")==tamanho||campo.indexOf(".")==tamanho)
		{
			return false;
		}
		if (campo.indexOf(".")<0||campo.indexOf("@")<0)
		{
			return false;
		}
		if (campo.indexOf(".com")<0 && campo.indexOf(".net")<0&& campo.indexOf(".br")<0&& campo.indexOf(".org")<0&& campo.indexOf(".gov")<0)
		{
			return false;
		}
		posicao_antes=campo.indexOf("@");
		posicao_antes=posicao_antes-1;
		posicao_depois=campo.indexOf("@");
		posicao_depois=posicao_depois+1;
		if (campo.indexOf(".")==posicao_antes||campo.indexOf(".")==posicao_depois)
		{
			return false;
		}
		return true;
	}

// Form Enviar
function enviar(site,post,lk){
window.open(site+'/wp-content/themes/anda/enviar.php?site='+site+'&post='+post+'&lk='+lk,'popup','width=400,height=350,scrolling=auto,top=0,left=0')
}

// Adicionar Favorito
function addFav(){
    var url=document.location;
	var title=document.title;
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

// Auto Size
function letra_maior(){
	document.getElementById("chapeu_").style.fontSize = '20px';
	document.getElementById("title_").style.fontSize = '40px';
	document.getElementById("title_").style.lineHeight = '40px';
	document.getElementById("data_").style.fontSize = '21px';
	document.getElementById("txt").style.fontSize = '28px';
	document.getElementById("txt").style.lineHeight = '36px';
}

function letra_normal(){
	document.getElementById("chapeu_").style.fontSize = '15px';
	document.getElementById("title_").style.fontSize = '30px';
	document.getElementById("title_").style.lineHeight = '30px';
	document.getElementById("data_").style.fontSize = '16px';
	document.getElementById("txt").style.fontSize = '21px';
	document.getElementById("txt").style.lineHeight = '27px';
}

function letra_menor(){
	document.getElementById("chapeu_").style.fontSize = '10px';
	document.getElementById("title_").style.fontSize = '20px';
	document.getElementById("title_").style.lineHeight = '20px';
	document.getElementById("data_").style.fontSize = '11px';
	document.getElementById("txt").style.fontSize = '14px';
	document.getElementById("txt").style.lineHeight = '18px';
}

function letra_maior_page(){
	document.getElementById("chapeu_").style.fontSize = '20px';
	document.getElementById("title_").style.fontSize = '40px';
	document.getElementById("title_").style.lineHeight = '40px';
	document.getElementById("txt").style.fontSize = '28px';
	document.getElementById("txt").style.lineHeight = '36px';
}

function letra_normal_page(){
	document.getElementById("chapeu_").style.fontSize = '15px';
	document.getElementById("title_").style.fontSize = '30px';
	document.getElementById("title_").style.lineHeight = '30px';
	document.getElementById("txt").style.fontSize = '21px';
	document.getElementById("txt").style.lineHeight = '27px';
}

function letra_menor_page(){
	document.getElementById("chapeu_").style.fontSize = '10px';
	document.getElementById("title_").style.fontSize = '20px';
	document.getElementById("title_").style.lineHeight = '20px';
	document.getElementById("txt").style.fontSize = '14px';
	document.getElementById("txt").style.lineHeight = '18px';
}