﻿// JScript File
// JavaScript Document
function abrir(){
    var x=document.getElementById('aviso')
    if(x!=null)
	    x.style.display = 'block';
}
function fechar(){
	var x=document.getElementById('aviso')
    if(x!=null)
    x.style.display = 'none';
}

function fechar_login(obj)
{
    var divFechar=document.getElementById(obj);
    divFechar.style.display = 'none';
}

function video(){
	document.getElementById('foto').style.display = 'none';
	document.getElementById('podcast').style.display = 'none';
	document.getElementById('video').style.display = 'block';
}
function foto(){
	document.getElementById('foto').style.display = 'block';
	document.getElementById('podcast').style.display = 'none';
	document.getElementById('video').style.display = 'none';
}
function podcast(){
	document.getElementById('foto').style.display = 'none';
	document.getElementById('podcast').style.display = 'block';
	document.getElementById('video').style.display = 'none';
}
function background(){
    //Trocar as funcoes por AJAX.  //Sossego
    var pagina='altera_imagem_home.aspx?meuEstiloId=1653';
    abrePersonalizacao(pagina)
    location.href=pagina;
}
function background2(){
  
    //Trocar as funcoes por AJAX.  //Familia
    var pagina='altera_imagem_home.aspx?meuEstiloId=1654';
    abrePersonalizacao(pagina)
    location.href=pagina;
}
function background3(){
 
    //Trocar as funcoes por AJAX.  //Aventura
    var pagina='altera_imagem_home.aspx?meuEstiloId=1651';
    abrePersonalizacao(pagina)
    location.href=pagina;
}
function background4(){
  
    //Trocar as funcoes por AJAX.  //Esporte
     var pagina='altera_imagem_home.aspx?meuEstiloId=1652';
     abrePersonalizacao(pagina)
      location.href=pagina;
}
function newsletter(){
    document.getElementById('newsletter').style.display = 'block';
    document.getElementById('Login1_login').style.display = 'none';
}
function meuestilo(){
    document.getElementById('trocaBG').style.display = 'inline';
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function pop_politicas(link)
{
    window.open('politicas_popup.html#' + link,'popup','width=540,height=495');
}

function validaSenha(src, args)
{
    args.IsValid=false;
    var nomeCampo = document.forms[0].campoSenhahide.value;
    var senhaHid = document.getElementById(nomeCampo);
    if( senhaHid.value!="" || args.Value!="")
    {
        args.IsValid=true;
    }
    else
    {
        args.IsValid=false;
    }
}

function showMenu()
{
    var noticia = document.getElementById("txtMateria");
    if(noticia!=null){
        noticia.style.overflow="hidden";
    }
    var menu = document.getElementById("flash_menu");
    if(menu!=null){
        var fl = menu.getElementsByTagName("embed");
        if(fl[0]!=null)
            fl[0].height=210;
    }
}

function hideMenu()
{
    var noticia = document.getElementById("txtMateria");
    if(noticia!=null){
        noticia.style.overflow="auto";
    }
    var menu = document.getElementById("flash_menu");
    if(menu!=null){
        var fl = menu.getElementsByTagName("embed");
        if(fl[0]!=null)
            fl[0].height=100;
    }
}

function vinheta_desperte()
{

    qs=new Array();
    variaveis=location.search.replace(/\x3F/,"").replace(/\x2B/g," ").split("&");
    if(variaveis!=""){
        for(i=0;i<variaveis.length;i++){
            nvar=variaveis[i].split("=");
            qs[nvar[0]]=unescape(nvar[1])
        }
    }
    var divRotator=document.getElementById('galeriaFoto');
    divRotator.innerHtml='';
    var novo = new SWFObject('imagerotator.swf','rotator','320','240','8');   
    novo.addVariable('file','xml/materia_interna_galeria.aspx?conteudo=' + qs['conteudo']);
    novo.addVariable('transition','always'); 
    novo.addVariable('overstretch','false');	
    novo.addVariable('width','320'); 
    novo.addVariable('height','240'); 
    novo.addVariable('shownavigation','true'); 
    novo.addVariable('lightcolor','0x990066');
    novo.addVariable('overstretch','false'); 
    novo.addVariable('linktarget','_self'); 
    novo.write('galeriaFoto');
}

function desligaEnter (field, event) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13)
		return false;
	else
	    return true;
}

var estadoVideo='0';
function abreTutorial()
{
    window.location.href='default_tutorial.aspx';
    
    /*var janela = document.getElementById("video_apresentacao");
    janela.style.visibility="visible";

    if(estadoVideo=='0'){
        sendEvent('tutorial_reduz','playpause');
    }
    */
}
function fechaTutorial()
{
    window.location.href='default.aspx';
    /*var janela = document.getElementById("video_apresentacao");
    janela.style.visibility="hidden";
    if(estadoVideo=='2')
        sendEvent('tutorial_reduz','playpause');*/
}
function sendEvent(swf,typ,prm) { 
    var obj = thisMovie(swf);
    obj.sendEvent(typ,prm); 
}

function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}

function getUpdate(typ,pr1,pr2,swf) { 
  if(typ == 'state') { estadoVideo=pr1; }
}
function thisMovie(swf) {
      if(navigator.appName.indexOf("Microsoft") != -1) {
            return document.getElementById(swf);
      } else {
            return document[swf];
      }
}