﻿// JScript File
/////////////////////////////////////////////////////////////////////
// Função: Usada para aumentar e/ou dimunuir a fonte do site.
// Arquivos que usam: SHOW GERAL
// Ultima atualização: 08/07/2009 19:35
/////////////////////////////////////////////////////////////////////
var tam = 11;
function mudaFonte(tipo,elemento){
    if (tipo=="mais") {
        if(tam<16) tam+=1;
        createCookie('fonte',tam,365);
    } else {
        if(tam>11) tam-=1;
        createCookie('fonte',tam,365);
    }
    document.getElementById('conteudoInternoTextos').style.fontSize = tam+'px';
}

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 readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++)
    {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
}

/////////////////////////////////////////////////////////////////////
// Função: Usada nas shows para fazer listas com descrição escondida.
// Arquivos que usam: SHOW - Tipo Glossário
// Ultima atualização: 08/07/2009 19:32
/////////////////////////////////////////////////////////////////////

function AbrirDiv(id){
    if(document.getElementById(id).style['display'] == 'block'){
        document.getElementById(id).style['display'] = 'none';
	}else{
	    document.getElementById(id).style['display'] = 'block';
	}
}

function mouseOverMenu(obj){
   objEvento = obj.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
}

function abreDiv(id){
    document.getElementById(id).style['display'] = 'block';
}

function fechaDiv(id){
    if(document.getElementById('dvEsconder').value != "false"){
        document.getElementById(id).style['display'] = 'none';
    }
}

function fecharTodasPerguntas()
{
    for(x=1;x<80;x++)
    {
        if(window.document.getElementById('esconder'+x)){
            window.document.getElementById('esconder'+x).style.display = 'none';
        }else{
            break;
        }
    }
}

function abreFechaDiv(idDiv){
    var dv = document.getElementById(idDiv);
    if(dv.style.display == "none"){
        dv.style.display = "block";
    }else{
        dv.style.display = "none";
    }
}

/////////////////////////////////////////////////////////////////////
// Função: Usada para fazer a impressão da página.
// Arquivos que usam: BARRA DE FUNÇÕES
// Ultima atualização: 08/07/2009 19:32
/////////////////////////////////////////////////////////////////////

function imprimir() {
    window.open("Imprimir.aspx");
    return false;
}

/////////////////////////////////////////////////////////////////////
// Função: Usada para fazer a marcara do telefone do Fale com RI
// Arquivos que usam: FALE COM RI
// Ultima atualização: 10/07/2009 17:00
/////////////////////////////////////////////////////////////////////

function c_Mascara()
{
    this.Mascara = function(o,f)
    {
        this.setFun(f);
        this.setObj(o);
        setTimeout("classMascara.exe()",1);
    }

    this.exe = function()
    {
        switch (this.getFun())
        {
            case "Telefone" : obj = this.getObj();
            obj.value = this.Telefone(this.getObj());
            break;
        }
    }

    this.Telefone = function(o)
    {
        valor = o.value;
        valor=valor.replace(/\D/g,"")
        valor=valor.replace(/^(\d\d)(\d)/g,"($1) $2")
        valor=valor.replace(/(\d{4})(\d)/,"$1-$2")
        return valor;
    }

    this.getObj = function(){return ob;}
    this.setObj = function(o){ob = o;}
    this.getFun = function(){return fun;}
    this.setFun = function(f){fun = f;}
}
classMascara = new c_Mascara();


/////////////////////////////////////////////////////////////////////
// Função: Usada para fechar Modal PopUp
// Arquivos que usam: 
// Ultima atualização: 10/07/2009 17:00
/////////////////////////////////////////////////////////////////////

function abrirEnviarParaAmigo()
{
    $find('mpExtender').show();
    return false;
}   

function fecharEnviarParaAmigo()
{
    $find('mpExtender').hide(); 
}


