/*
 * Descrição:	Funçao relogio() é responsável por executar o relógio
 *				que fica localizado no topo do site TPA.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * Usar: partida=setTimeout("relogio()", 1000);
 */
function relogio(){
	//Inicia o relógio nesse ponto
	partida=setTimeout("relogio()", 1000);
	
	Hoje=new Date();			//Pegamos a data e hora de hoje
	horas=Hoje.getHours();		//Apenas as horas
	segundos=Hoje.getSeconds(); //Apenas os segundos
	minutos=Hoje.getMinutes();	//Apenas os minutos
	
	/*
	 * Se horas for menor que 10 então adicionar 0 na frente.
	 */
	if(horas<10){
		horas="0"+horas
	}
	/*
	 * Se segundos for menor que 10 então adicionar 0 na frente.
	 */
	if(segundos<10){
		segundos="0"+segundos
	}
	/*
	 * Se minutos for menor que 10 então adicionar 0 na frente.
	 */
	if(minutos<10){
		minutos="0"+minutos
	}
	//Altera o conteúdo do Div relogio.
	document.getElementById('relogio').innerHTML=horas + ":" +minutos+ ":" + segundos;
}

/*
 * Descrição:	A função comecarPainel() inicia as notícias randomicas
 *				e alterar com fade. Plugin JQuey Cycles.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * Usar: comecarPainel();
 */
function comecarPainel(){
		var noticias = $(function() {
						$('#painel').show(); //Mostrar o div com notícias
						$('#painel').cycle({ 
							fx:     'fade', //Efeito Fade
							timeout: 5000, //5 segundos
							speed: 500, //Velocidade de efeito
							next:   '.next', //Próxima notícia
							prev:   '.previous' //Voltar notícia
						});
						$('#parar').click(function() {
						$('#painel').cycle('pause');  //Para de roda notícias
						});  
						$('#iniciar').click(function() {  
						$('#painel').cycle('resume');  //Continuar rodando notícias
						});  
					});
}

/*
 * Descrição: 	A função verEmailItem() é responsável por válidar o e-mail.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param email String email - E-mail que deve ser válidado.
 * Usar: verEmailItem('email@email.com.br');
 */
function verEmailItem(email) {
	var regEmail = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	if (regEmail.test(email)) {
		return true;
	} else if (email != null && email != "") {
		return false;
	}
}

/*
 * Descrição: 	A função inputError() sinaliza o input que deve ser revisto.
 *				Função criada por média de melhorar o desempenho do javascript, 
 *				e ajudar o usuário final a identificar onde o error aconteceu.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param input Object input - Campo com error
 * Usar: inputError(input);
 */
function inputError(input){
	input.focus();
	input.style.border = 'solid 1px red';
}

/*
 *
 *	Comentar
 *
 *
 */
function inputCorreto(div, input){
	var divMsgError = div;
	divMsgError.style.display = 'block';
	divMsgError.innerHTML = '';
	input.style.border = 'solid 1px #999999';
}
 
/*
 * Descrição: 	A função inputError() sinaliza o input que deve ser revisto.
 *				Função criada por média de melhorar o desempenho do javascript, 
 *				e ajudar o usuário final a identificar onde o error aconteceu.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param input Object input - Campo com error
 * Usar: inputError(input);
 */
function msgError(div, mensagem){
	var divMsgError = div;
	divMsgError.style.display = 'block';
	divMsgError.innerHTML = mensagem;
}
/*
 * Descrição:	A função comentarNoticia() faz a validação dos dados,
 *				se tudo estiver okey chama ajax para adicionar.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param formulario Object formulario - Formulário do comentar
 * Usar: comentarNoticia(document.NOMEFORM);
 */
function comentarNoticia(formulario){
	var df = formulario;
	var divMsgError = document.getElementById('msgError');
	var enviar = true;
	
	if (df.nomeCompleto.value == '' && enviar) {
		//alert('Você deve preencher o campo nome.');
		msgError(divMsgError, 'Você deve preencher o campo nome.');
		inputError(df.nomeCompleto);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.nomeCompleto);
		if (df.nomeCompleto.value.length < 4) {
			//alert('Por favor digite o nome completo.');
			msgError(divMsgError, 'Por favor digite o nome completo.');
			inputError(df.nomeCompleto);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.nomeCompleto);
		}
	}
	
	if (df.emailLeitor.value == '' && enviar) {
		//alert('Você deve preencher o campo e-mail.');
		msgError(divMsgError, 'Você deve preencher o campo e-mail.');
		inputError(df.emailLeitor);
		enviar = false;
		return false;
	}else{
		if (verEmailItem(df.emailLeitor.value)){
			inputCorreto(divMsgError, df.emailLeitor);
		}else{
			//alert('O e-mail '+df.emailLeitor.value+' não é válido.');
			msgError(divMsgError, 'O e-mail '+df.emailLeitor.value+' não é válido.');
			inputError(df.emailLeitor);
			enviar = false;
			return false;
		}
	}
	
	if (df.comentarioLeitor.value == '' && enviar){
		//alert('Você deve preencher o campo comentário.');
		msgError(divMsgError, 'Você deve preencher o campo comentário.');
		inputError(df.comentarioLeitor);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.comentarioLeitor);	
	}
	if (df.captcha.value == '' && enviar){
		//alert('Você deve preencher as letras.');
		msgError(divMsgError, 'Você deve preencher as letras.');
		inputError(df.captcha);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.captcha);
		if (df.captcha.value.length < 4) {
			//alert('Você deve preencher as 4 letras.');
			msgError(divMsgError, 'Você deve preencher as 4 letras.');
			inputError(df.captcha);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.captcha);
		}
	}
	if (enviar) {
		if(enviarComentarioNoticia(df)){
			df.submit();
		}
	}
}
/*
 * Descrição: 	A função abrirComentarNoticia() abre um DIV flutuande onde o leitor
 *				poderá comentar a notícia.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param codigo Integer codigo - Código da notícia.
 * Usar: abrirComentarNoticia(codigo)
 */
function abrirComentarNoticia(codigo){
	if (codigo == '') {
		alert('Problema na execução do pedido.');
		return false;
	}else{
		document.getElementById('codNoticia').value = codigo;
	}

	var divMsgError = document.getElementById('msgError');
		divMsgError.style.display = 'none';

	var botaoComentar = $("#botaoComentar");
	var posX = botaoComentar.offset().left; 
    var posY = botaoComentar.offset().top;

	$(function() {
                $("#botaoComentar").scrollToTop();
    });

	/*Criar fundo transparente.*/
	var fundoTran = document.getElementById("fundoTran");
		fundoTran.style.top = "0px";
		fundoTran.style.left = "0px";
		fundoTran.style.width = document.body.clientWidth+'px';
		fundoTran.style.height = document.body.clientHeight+'px';
		//fundoTran.style.display = "block";
	$("#fundoTran").fadeIn(250);
	/*Criar fundo transparente.*/
	
	//document.getElementById('comentar').style.top = '60px';
	//document.getElementById('comentar').style.left= '250px';
		
	var divComentario = $(document).ready(function(){
						$("#comentar").fadeIn(500)
					  	});
	$('#fundoTran').click(function() {
				$('#comentar').fadeOut(500, function() { 
														$('#fundoTran').fadeOut(250); 
														});								
	});
	
}

/*
 * Descrição:	A função denunciarNoticia() faz a validação dos dados,
 *				se tudo estiver okey chama ajax para adicionar.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param formulario Object formulario - Formulário do comentar
 * Usar: denunciarNoticia(document.NOMEFORM);
 */
function denunciarNoticia(formulario){
	var df = formulario;
	var divMsgError = document.getElementById('msgError-denuncia');
	var enviar = true;
	
	if (df.nomeCompleto.value == '' && enviar) {
		//alert('Você deve preencher o campo nome.');
		msgError(divMsgError, 'Você deve preencher o campo nome.');
		inputError(df.nomeCompleto);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.nomeCompleto);
		if (df.nomeCompleto.value.length < 4) {
			//alert('Por favor digite o nome completo.');
			msgError(divMsgError, 'Por favor digite o nome completo.');
			inputError(df.nomeCompleto);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.nomeCompleto);
		}
	}
	
	if (df.emailLeitor.value == '' && enviar) {
		//alert('Você deve preencher o campo e-mail.');
		msgError(divMsgError, 'Você deve preencher o campo e-mail.');
		inputError(df.emailLeitor);
		enviar = false;
		return false;
	}else{
		if (verEmailItem(df.emailLeitor.value)){
			inputCorreto(divMsgError, df.emailLeitor);
		}else{
			//alert('O e-mail '+df.emailLeitor.value+' não é válido.');
			msgError(divMsgError, 'O e-mail '+df.emailLeitor.value+' não é válido.');
			inputError(df.emailLeitor);
			enviar = false;
			return false;
		}
	}
	
	if (df.comentarioLeitor.value == '' && enviar){
		//alert('Você deve preencher o campo comentário.');
		msgError(divMsgError, 'Você deve preencher o campo comentário.');
		inputError(df.comentarioLeitor);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.comentarioLeitor);	
	}
	if (df.captcha.value == '' && enviar){
		//alert('Você deve preencher as letras.');
		msgError(divMsgError, 'Você deve preencher as letras.');
		inputError(df.captcha);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.captcha);
		if (df.captcha.value.length < 4) {
			//alert('Você deve preencher as 4 letras.');
			msgError(divMsgError, 'Você deve preencher as 4 letras.');
			inputError(df.captcha);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.captcha);
		}
	}
	if (enviar) {
		if(enviarDenunciaNoticia(df)){
			df.submit();
		}
	}
}

/*
 * Descrição: 	A função abrirDenunciarNoticia() abre um DIV flutuande onde o leitor
 *				poderá comentar a notícia.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param codigo Integer codigo - Código da notícia.
 * Usar: abrirDenunciarNoticia(codigo)
 */
function abrirDenunciarNoticia(codComentario){
	if (codComentario == '') {
		alert('Problema na execução do pedido.');
		return false;
	}else{
		document.getElementById('codComentario').value = codComentario;
	}

	var divMsgError = document.getElementById('msgError');
		divMsgError.style.display = 'none';

	var botaoComentar = $("#botaoComentar");
	var posX = botaoComentar.offset().left; 
    var posY = botaoComentar.offset().top;

	$(function() {
                $("#denuncie-comentario").scrollToTop();
    });

	/*Criar fundo transparente.*/
	var fundoTran = document.getElementById("fundoTran");
		fundoTran.style.top = "0px";
		fundoTran.style.left = "0px";
		fundoTran.style.width = document.body.clientWidth+'px';
		fundoTran.style.height = document.body.clientHeight+'px';
		//fundoTran.style.display = "block";
	$("#fundoTran").fadeIn(250);
	/*Criar fundo transparente.*/
	
	//document.getElementById('comentar').style.top = '60px';
	//document.getElementById('comentar').style.left= '250px';
		
	var divComentario = $(document).ready(function(){
						$("#denuncia").fadeIn(500)
					  	});
	$('#fundoTran').click(function() {
				$('#denuncia').fadeOut(500, function() { 
														$('#fundoTran').fadeOut(250); 
														});								
	});
	
}

/*
 * Descrição:	Função para limitar o número de caracteres dos comentário.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param campo Object campo - Campo que deve ser limitado.
 * Usar: limitarCaracteres(campo)
 */
function limitarCaracteres(campo){
	//Máximo de caracteres
	var numCaracteres = 500;
	//Campo do comentário
	var numCampo = campo.value.length;
	//Abrir variavel
	var imprimirValor;
	
	//Alterar propriedades do textarea
	$('#comentarioLeitor').keyup(function(){
			var max = parseInt($(this).attr('maxlength'));
			if($(this).val().length > max){
				$(this).val($(this).val().substr(0, $(this).attr('maxlength')));
			}
			$(this).parent().find('#caracteres').html('Você tem <span id="numerosCaracteres">' + (max - $(this).val().length) + '</span> caracteres restantes');
		});
}
/*
NOVO
*/
function carregandoImagem(arrDados){

	// DOM Ready
	$(function () {
		var nome;
		// Image Sources
		var images = new Array();
			  images[0] = arrDados[0][1];
			  images[1] = arrDados[1][1];
			  images[2] = arrDados[2][1];
			  images[3] = arrDados[3][1];
			  
		  // loop through images
		  $(images).each(function(index,value){ 
				  // create the LI programatically
				  if (index == '0'){
					  nome = 'baixo';
				  }
				  if (index == '1'){
					  nome = 'alto';
				  }
				  if (index == '2'){
					  nome = 'baixo';
				  }
				  if (index == '3'){
					  nome = 'alto';
				  }
					  
				  var list = $('<div class="imagem-'+nome+'" id="imagem-'+index+'"><a href="#" id="link-'+index+'" class="classLink" title="Teste"></a></div>');
				  // append the new LI to UL
				  $('div#galeria').append(list);	
				  // current LI object
				  var curr = $("div#galeria a#link-"+index);			
				  // new image object
				  var img = new Image();					
				  // load image
				  $(img).load(function () {
					  $(this).css('display','none'); // since .hide() failed in safari
					  $(curr).removeClass('loading').append(this);
					  $(this).fadeIn();
				  }).error(function () {
					  // error handling remove current element
					  $(curr).remove();
				  }).attr('src', value);
				  $('a#link-'+index).attr('href', 'http://www.tpa.com.br/fotos/galeria.php?codGaleria='+arrDados[index][0]+'&pagina=1');
		  });
		  
	 });	
}
/**
 * Verifica campo inicial de acesso ao WebMail
 */
function preencheConteudoWebMailNovoCapa() {
	if (document.formWebMail.email.value == '') {
		document.formWebMail.email.value = 'Digite e-mail completo';
	}
}
/**
 * Verifica campo inicial de acesso ao WebMail
 */
function limpaConteudoWebMailNovoCapa() {
	if (document.formWebMail.email.value == 'Digite e-mail completo') {
		document.formWebMail.email.value = '';
	}
}

/**
 * Abre POP-UP para impressão
 */
function popUpParaImpressao(codNoticia){
	if (!codNoticia){
		alert('Ocorreu um error código da notícia não foi informado.');
		return false;
	}
	if (codNoticia){
		window.open('?modulo=popUp&noticia='+codNoticia,'NoticiaImpressao','scrollbars=yes,width=610,height=600,menubar=yes');
	}
}

/*Abas-Diretas*/
function goGuiaTpa(){
	document.location = 'http://www.guiatpa.com.br/';
}
function goSuporte(){
	document.location = 'http://www.tpa.com.br/portal/?modulo=suporte';
}
function goContato(){
	document.location = 'http://www.tpa.com.br/portal/?modulo=suporte';
}
/*Abas-Diretas*/

/*Incluir JS*/
document.write('<script language="javascript" type="text/javascript" src="http://www.tpa.com.br/portal/geral/js/flash/AC_RunActiveContent.js"></script>');
/*Incluir JS*/


//////////////
///	BLOGS ///
////////////

/*
 * Descrição:	A função comentarBlog() faz a validação dos dados,
 *				se tudo estiver okey chama ajax para adicionar.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param formulario Object formulario - Formulário do comentar
 * Usar: comentarBlog(document.NOMEFORM);
 */
function comentarBlog(formulario){
	var df = formulario;
	var divMsgError = document.getElementById('msgError');
	var enviar = true;
	
	if (df.nomeCompleto.value == '' && enviar) {
		//alert('Você deve preencher o campo nome.');
		msgError(divMsgError, 'Você deve preencher o campo nome.');
		inputError(df.nomeCompleto);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.nomeCompleto);
		if (df.nomeCompleto.value.length < 4) {
			//alert('Por favor digite o nome completo.');
			msgError(divMsgError, 'Por favor digite o nome completo.');
			inputError(df.nomeCompleto);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.nomeCompleto);
		}
	}
	
	if (df.emailLeitor.value == '' && enviar) {
		//alert('Você deve preencher o campo e-mail.');
		msgError(divMsgError, 'Você deve preencher o campo e-mail.');
		inputError(df.emailLeitor);
		enviar = false;
		return false;
	}else{
		if (verEmailItem(df.emailLeitor.value)){
			inputCorreto(divMsgError, df.emailLeitor);
		}else{
			//alert('O e-mail '+df.emailLeitor.value+' não é válido.');
			msgError(divMsgError, 'O e-mail '+df.emailLeitor.value+' não é válido.');
			inputError(df.emailLeitor);
			enviar = false;
			return false;
		}
	}
	
	if (df.comentarioLeitor.value == '' && enviar){
		//alert('Você deve preencher o campo comentário.');
		msgError(divMsgError, 'Você deve preencher o campo comentário.');
		inputError(df.comentarioLeitor);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.comentarioLeitor);	
	}
	if (df.captcha.value == '' && enviar){
		//alert('Você deve preencher as letras.');
		msgError(divMsgError, 'Você deve preencher as letras.');
		inputError(df.captcha);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.captcha);
		if (df.captcha.value.length < 4) {
			//alert('Você deve preencher as 4 letras.');
			msgError(divMsgError, 'Você deve preencher as 4 letras.');
			inputError(df.captcha);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.captcha);
		}
	}
	if (enviar) {
		if(enviarComentarioBlog(df)){
			df.submit();
		}
	}
}

/*
 * Descrição: 	A função abrirComentarBlog() abre um DIV flutuande onde o leitor
 *				poderá comentar a notícia.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param codigo Integer codigo - Código da notícia.
 * Usar: abrirComentarBlog(codigo)
 */
function abrirComentarBlog(codigo){
	if (codigo == '') {
		alert('Problema na execução do pedido.');
		return false;
	}else{
		document.getElementById('codBlog').value = codigo;
	}

	var divMsgError = document.getElementById('msgError');
		divMsgError.style.display = 'none';

	var botaoComentar = $("#botaoComentar");
	var posX = botaoComentar.offset().left; 
    var posY = botaoComentar.offset().top;

	$(function() {
                $("#botaoComentar").scrollToTop();
    });

	/*Criar fundo transparente.*/
	var fundoTran = document.getElementById("fundoTran");
		fundoTran.style.top = "0px";
		fundoTran.style.left = "0px";
		fundoTran.style.width = document.body.clientWidth+'px';
		fundoTran.style.height = document.body.clientHeight+'px';
		//fundoTran.style.display = "block";
	$("#fundoTran").fadeIn(250);
	/*Criar fundo transparente.*/
	
	//document.getElementById('comentar').style.top = '60px';
	//document.getElementById('comentar').style.left= '250px';
		
	var divComentario = $(document).ready(function(){
						$("#comentar").fadeIn(500)
					  	});
	$('#fundoTran').click(function() {
				$('#comentar').fadeOut(500, function() { 
														$('#fundoTran').fadeOut(250); 
														});								
	});
	
}

/*
 * Descrição:	A função denunciarBlog() faz a validação dos dados,
 *				se tudo estiver okey chama ajax para adicionar.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param formulario Object formulario - Formulário do comentar
 * Usar: denunciarBlog(document.NOMEFORM);
 */
function denunciarBlog(formulario){
	var df = formulario;
	var divMsgError = document.getElementById('msgError-denuncia');
	var enviar = true;
	
	if (df.nomeCompleto.value == '' && enviar) {
		//alert('Você deve preencher o campo nome.');
		msgError(divMsgError, 'Você deve preencher o campo nome.');
		inputError(df.nomeCompleto);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.nomeCompleto);
		if (df.nomeCompleto.value.length < 4) {
			//alert('Por favor digite o nome completo.');
			msgError(divMsgError, 'Por favor digite o nome completo.');
			inputError(df.nomeCompleto);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.nomeCompleto);
		}
	}
	
	if (df.emailLeitor.value == '' && enviar) {
		//alert('Você deve preencher o campo e-mail.');
		msgError(divMsgError, 'Você deve preencher o campo e-mail.');
		inputError(df.emailLeitor);
		enviar = false;
		return false;
	}else{
		if (verEmailItem(df.emailLeitor.value)){
			inputCorreto(divMsgError, df.emailLeitor);
		}else{
			//alert('O e-mail '+df.emailLeitor.value+' não é válido.');
			msgError(divMsgError, 'O e-mail '+df.emailLeitor.value+' não é válido.');
			inputError(df.emailLeitor);
			enviar = false;
			return false;
		}
	}
	
	if (df.comentarioLeitor.value == '' && enviar){
		//alert('Você deve preencher o campo comentário.');
		msgError(divMsgError, 'Você deve preencher o campo comentário.');
		inputError(df.comentarioLeitor);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.comentarioLeitor);	
	}
	if (df.captcha.value == '' && enviar){
		//alert('Você deve preencher as letras.');
		msgError(divMsgError, 'Você deve preencher as letras.');
		inputError(df.captcha);
		enviar = false;
		return false;
	}else{
		inputCorreto(divMsgError, df.captcha);
		if (df.captcha.value.length < 4) {
			//alert('Você deve preencher as 4 letras.');
			msgError(divMsgError, 'Você deve preencher as 4 letras.');
			inputError(df.captcha);
			enviar = false;
			return false;
		}else{
			inputCorreto(divMsgError, df.captcha);
		}
	}
	if (enviar) {
		if(enviarDenunciaBlog(df)){
			df.submit();
		}
	}
}

/*
 * Descrição: 	A função abrirDenunciarBlog() abre um DIV flutuande onde o leitor
 *				poderá comentar a notícia.
 * Autor: William R. Fernandes
 * Empresa: BlueOne Informática LTDA.
 * @param codigo Integer codigo - Código da notícia.
 * Usar: abrirDenunciarBlog(codigo)
 */
function abrirDenunciarBlog(codComentario, codBlog){
	if (codComentario == '') {
		alert('Problema na execução do pedido.');
		return false;
	}else{
		document.getElementById('codComentarioDenuncia').value = codComentario;
		document.getElementById('codBlogDenuncia').value = codBlog;
	}

	var divMsgError = document.getElementById('msgError');
		divMsgError.style.display = 'none';

	var botaoComentar = $("#botaoComentar");
	var posX = botaoComentar.offset().left; 
    var posY = botaoComentar.offset().top;

	$(function() {
                $("#denuncie-comentario").scrollToTop();
    });

	/*Criar fundo transparente.*/
	var fundoTran = document.getElementById("fundoTran");
		fundoTran.style.top = "0px";
		fundoTran.style.left = "0px";
		fundoTran.style.width = document.body.clientWidth+'px';
		fundoTran.style.height = document.body.clientHeight+'px';
		//fundoTran.style.display = "block";
	$("#fundoTran").fadeIn(250);
	/*Criar fundo transparente.*/
	
	//document.getElementById('comentar').style.top = '60px';
	//document.getElementById('comentar').style.left= '250px';
		
	var divComentario = $(document).ready(function(){
						$("#denuncia").fadeIn(500)
					  	});
	$('#fundoTran').click(function() {
				$('#denuncia').fadeOut(500, function() { 
														$('#fundoTran').fadeOut(250); 
														});								
	});
	
}

/*Pesquisar*/
function pesquisarNoticias(){
	var df = document.formPesquisa;
	var url = 'http://www.tpa.com.br/portal/?modulo=editorais-pesquisar&palavra='+df.palavra.value+'&secao='+df.secao.value;
	if(df.palavra.value != ''){
		document.location = url;
		return true;
	}else{
		return false;	
	}
}

/*verificarWebMail*/
function validate_senha(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
   	 alert(alerttxt);return false;
    }
  else
    {
    	return true;
    }
  }
}

function validate_email(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="Digite e-mail completo")
    {
    	alert(alerttxt);return false;
    }
  else
    {
    	return true;
    }
  }
}



function validate_form(thisform)
{
with (thisform)
  {
  if (validate_email(thisform.email,"Digite um Email")==false){
		limpaConteudoWebMailNovoCapa();
		thisform.email.focus();
		return false;
	}
  
  if (validate_senha(thisform.senha,"Digite uma senha")==false){
	  thisform.senha.focus();
	  return false;
	}
  }
}


/*Abas-Diretas*/
function goCentral(elemento){
	elemento.style.backgroundColor="#CF271E";
	document.getElementById('webmail-li').style.backgroundColor="#DEDEDC";
	document.getElementById('pesquisar-li').style.backgroundColor="#DEDEDC";
	document.getElementById('central-a').style.color="#FFF";
	document.getElementById('pesquisar-a').style.color="#000";
	document.getElementById('webmail-a').style.color="#000";
	document.getElementById('central').style.display = 'block';
	document.getElementById('guia-tpa').style.display = 'none';
	document.getElementById('webmail').style.display = 'none';
	document.getElementById('pesquisar').style.display = 'none';
	document.getElementById('guia-suporte').style.display = 'none';
	document.getElementById('guia-contato').style.display = 'none';
}
function goPesquisar(elemento){
	elemento.style.backgroundColor="#CF271E";
	document.getElementById('central-li').style.backgroundColor="#DEDEDC";
	document.getElementById('webmail-li').style.backgroundColor="#DEDEDC";
	document.getElementById('pesquisar-a').style.color="#FFF";
	document.getElementById('central-a').style.color="#000";
	document.getElementById('webmail-a').style.color="#000";
	document.getElementById('central').style.display = 'none';
	document.getElementById('guia-tpa').style.display = 'none';
	document.getElementById('webmail').style.display = 'none';
	document.getElementById('pesquisar').style.display = 'block';
	document.getElementById('guia-suporte').style.display = 'none';
	document.getElementById('guia-contato').style.display = 'none';
}
function goWebmail(elemento){
	elemento.style.backgroundColor="#CF271E";
	document.getElementById('central-li').style.backgroundColor="#DEDEDC";
	document.getElementById('pesquisar-li').style.backgroundColor="#DEDEDC";
	document.getElementById('webmail-a').style.color="#FFF";
	document.getElementById('pesquisar-a').style.color="#000";
	document.getElementById('central-a').style.color="#000";
	document.getElementById('central').style.display = 'none';
	document.getElementById('guia-tpa').style.display = 'none';
	document.getElementById('webmail').style.display = 'block';
	document.getElementById('pesquisar').style.display = 'none';
	document.getElementById('guia-suporte').style.display = 'none';
	document.getElementById('guia-contato').style.display = 'none';
}
/*Abas-Diretas*/

/*Fechar-Comentar-Denuncia*/
function cancelarComentario(){
	$('#comentar').fadeOut(500, function() { 
			$('#fundoTran').fadeOut(250); 
	});								
}
function cancelarDenuncia(){
	$('#denuncia').fadeOut(500, function() { 
		$('#fundoTran').fadeOut(250); 
	});								
}
/*Fechar-Comentar-Denuncia*/