// JavaScript Document

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var valida=1;
function AbreForm(vfnURL, vfnLargura, vfnAltura){

	var vT;

	var vL;

	var vNome;

	var vVetor;

	vT = (window.screen.height/2) - (vfnAltura/2);

	vT = (vT-40);

	vL = (window.screen.width/2) - (vfnLargura/2);	

	window.open(vfnURL, '_blank', 'width='+ vfnLargura +'px, height='+ vfnAltura +'px, left='+ vL +'px, top='+vT+'px' );

}



function AbreScrollForm(vfnURL, vfnLargura, vfnAltura){

	var vT;

	var vL;

	var vNome;

	var vVetor;

	vT = (window.screen.height/2) - (vfnAltura/2);

	vT = (vT-40);

	vL = (window.screen.width/2) - (vfnLargura/2);	

	window.open(vfnURL, '_blank', 'scrollbars=yes width='+ vfnLargura +', height='+ vfnAltura +', left='+ vL +', top='+vT);

}



var valor, valorTexto;

valor = 0;

valorTexto = 0;

function mudaTamanho(val)

{

	if(valor == 0 && valorTexto == 0){

		document.getElementById('titulo-noticias').style.fontSize = 20;

		valor = 20;

		document.getElementById('texto-noticias').style.fontSize = 11;

		valorTexto = 11;

		

		valor = valor + val;

		document.getElementById('titulo-noticias').style.fontSize = valor;

		valorTexto = valorTexto + val;

		document.getElementById('texto-noticias').style.fontSize = valorTexto;

	}

	else{

		if((valorTexto >= 5 && val == 1) || (valorTexto != 5 && val == -1))

		{	

			valor = valor + val;

			document.getElementById('titulo-noticias').style.fontSize = valor;

			valorTexto = valorTexto + val;

			document.getElementById('texto-noticias').style.fontSize = valorTexto;

		}

	}

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



 function validaComents()

 {

	 if(document.frm_coments.nome.value == "")

	 {

		 alert("Campo Obrigatorio !");

		 document.frm_coments.nome.style.background = "#fc5a5a";

		 document.frm_coments.nome.focus();

	 }

	else

	 {

		document.frm_coments.nome.style.background = "#FFFFFF";

        validaEmail();

	 } 

 }

 

 function validaEmail()

 {

	 if(document.frm_coments.email.value == "") 

	 {

		 alert("Campo Obrigatorio !");

		 document.frm_coments.email.style.background = "#fc5a5a";

		 document.frm_coments.email.focus();

	 }

	else

	 {

		document.frm_coments.email.style.background = "#FFFFFF";

        validaPost();

	 } 

 }

 

 function validaPost()

 {

	 if(document.frm_coments.comentario.value == "")

	 {

		 alert("Campo Obrigatorio !");

		 document.frm_coments.comentario.style.background = "#fc5a5a";

		 document.frm_coments.comentario.focus();

	 }

	else

	 {

		document.frm_coments.comentario.style.background = "#FFFFFF";

        document.frm_coments.submit();

	 } 

 }

 

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



function abrir(id,codigo,tipo)

{

	var div = id;

	window.location.href="index.php?codigo="+codigo+"&tipo="+tipo;

	document.getElementById(div).style.display = "inline";

	document.getElementById("tela").style.display = "inline";

	

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



function abrir2(id,codigo,tipo)

{

	var div = id;	

	window.location.href="index.php?codigo="+codigo+"&tipo="+tipo;

	document.getElementById(div).style.display = "inline";

	document.getElementById("tela").style.display = "inline";

	document.getElementById("botao").style.display = "inline";	

	

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function fechar2(id){

	var div = id;

	window.location.href="index.php";

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function fechar(id){

	var div = id;

	window.location.href="index.php";

}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



function novo(url, largura, altura)

	{

		var topo, left

		topo = (window.screen.height / 2) - (altura / 2);

		iLeft = (window.screen.width / 2) - (largura / 2);

		window.open(url, "Form", "width="+ largura +", height="+ altura +", left="+ left +", top=" + topo);

	}

	

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function trocaAba(id)

	{

	  var id = id;

	  var nome;

	  var divId;

	  

	  nome = "aba"+id;

	  divId = "tela"+id;

	  

	  for(var x=1; x<4; x++)

	  {

	   	if (document.getElementById(nome).id == nome)

		{			

			document.getElementById(nome).style.background = "#FFFFFF";

			document.getElementById(divId).style.display="";

			

		    if(id == 1){

			document.getElementById("tela2").style.display="none";

			document.getElementById("aba2").style.background="#e1e1e1";

			document.getElementById("tela3").style.display="none";

		    document.getElementById("aba3").style.background="#e1e1e1";

			}

			if(id == 2){

			document.getElementById("tela1").style.display="none";

			document.getElementById("aba1").style.background="#e1e1e1";

			document.getElementById("tela3").style.display="none";

			document.getElementById("aba3").style.background="#e1e1e1";

			}

			if(id == 3){

			document.getElementById("tela1").style.display="none";

			document.getElementById("aba1").style.background="#e1e1e1";

			document.getElementById("tela2").style.display="none";

			document.getElementById("aba2").style.background="#e1e1e1";

			}

	  	}

	  }

	}

/*------------------------------------------------------------------------------------------------------------------------------*/



function mudaCor(id)

{

	var nome;

	nome = "txt"+id;	

	document.getElementById(nome).style.color = "#464646";

	

			if(id == 1){

			document.getElementById("txt2").style.color = "#5c5c5c";	

		    document.getElementById("txt3").style.color = "#5c5c5c";

			}

			if(id == 2){

			document.getElementById("txt1").style.color = "#5c5c5c";	

		    document.getElementById("txt3").style.color = "#5c5c5c";

			}

			if(id == 3){

			document.getElementById("txt1").style.color = "#5c5c5c";	

		    document.getElementById("txt2").style.color = "#5c5c5c";

			}

}


