//Nome do caderno. Passado para o OpenX como CHANNEL
var caderno;
var temas, i_secoes, secoes, secao;

//ID do player multimidia começa em 1 e vai sendo incrementado caso mais de
//um player seja exibido na mesma página
var id_player = 1;
var id_swf = 1;

//variavel do Gooble Analytics para definir o nome do PageView que vai ser 
//registrado. Atualmente só é usado na coluna social
var ga_tpv;

//define se o caderno tem ou não RSS; por padrão vem como NÃO(false)
var rss = false;


function openTOM(){
  newWin = window.open("http://www.acessa.com/topofmind/tom2002/", "Tom2000","resizable=no,width=650,height=480,status=no,location=no,toolbar=yes,top=30,left=60");
}

function sometexto(f){
   if (f.email.value == "seu e-mail") {
     f.email.value = ""
   }
}

function voltatexto(f){
   if (f.email.value == "") {
     f.email.value = "seu e-mail"
   }
}

function selectGetURL(f){
if (f.options[f.selectedIndex].value == "tom")
        {
	openTOM();
	f.selectedIndex = 0;
	newWin.focus();
	return;
        }
if (f.name == "links")
        {
        var URL = f.options[f.selectedIndex].value;
	newWin = window.open(URL);
	f.selectedIndex = 0;
	newWin.focus();
	return;
        }
if (f.name == "optmenu_webm")
        {
        var URL = "http://www.acessa.com" + f.options[f.selectedIndex].value;
	window.open(URL);
	f.selectedIndex = 0;
	return;
        }
if (f.options[f.selectedIndex].value == "nada")
        {
        f.selectedIndex = 0;
        return;
        }
else
	{
	var URL = f.options[f.selectedIndex].value;
	f.selectedIndex = 0;
	top.location.href = URL;
	return;
	}
}

function selectPopURL(f, w, h) {
  if (f.options[f.selectedIndex].value == "nada") {
    f.selectedIndex = 0;
    return;
  } else {
  	var URL = "http://www.acessa.com"+f.options[f.selectedIndex].value;
  	newWin = window.open(URL, 'Signo','width='+w+',height='+h+',scrollbars=0,top=30,left=60');
  	f.selectedIndex = 0;
  	newWin.focus();
  	return;
  }
}

function openwin(URL, N, L, A) {
newWin = window.open(URL, N,"resizable=no,width=" + L + ",height=" + A + ",status=no,location=no,scrollbars=1,toolbar=no,top=30,left=60");
newWin.focus();
}

function openWin(URL, N, L, A) {
newWin = window.open(URL, N,"resizable=no,width=" + L + ",height=" + A + ",status=no,location=no,scrollbars=1,toolbar=no,top=30,left=60");
newWin.focus();
}

function openWin2(URL, N, L, A) {
newWin = window.open(URL, N,"resizable=no,width=" + L + ",height=" + A + ",status=no,location=no,scrollbars=0,toolbar=no,top=30,left=60");
newWin.focus();
}

function openwin2(URL, N, L, A) {
newWin = window.open(URL, N,"resizable=no,width=" + L + ",height=" + A + ",status=no,location=no,scrollbars=0,toolbar=no,top=30,left=60");
newWin.focus();
}

function openWinCenter(URL, N, W, H, S) {
  L = (screen.width - W) / 2;
  T = (screen.height - H) / 2;
  newWin = window.open(URL, N,"scrollbars="+S+",width=" + W + ",height=" + H +",top=" + T+ ",left=" + L);
  newWin.focus();
}

function setCookie(nome,valor,dir,exp) {
  if ((!navigator.cookieEnabled) || (!nome) || (!valor)) {
    return false;
  } else if (exp) {
    var d = new Date();
    var minutos = d.getTime() + (exp * 60 * 1000);
    d.setTime(minutos);
    document.cookie = nome+"="+valor+(dir?";path="+dir:"")+";expires="+d.toGMTString();
  } else { 
    document.cookie = nome+"="+valor+(dir?";path="+dir:"");
  }
  return true;
}

function deleteCookie(nome,dir) {
  if (!nome) {
    return false;
  } else {
    var d = new Date();
    var minutos = d.getTime() - 10000;
    d.setTime(minutos);
    document.cookie = nome+"=false"+(dir?";path="+dir:"")+";expires="+d.toGMTString();
  } 
}

function getCookie(n) {
  if (document.cookie.indexOf(n+"=") == -1) {
    return false;
  } else {
    v = document.cookie.substring(document.cookie.indexOf(n+"="),document.cookie.length);
  }
  if (v.indexOf(';') == -1) {
    v = v.substring(n.length+1);
  } else {
    v = v.substring(n.length+1,v.indexOf(';'));
  }
  return v;
}

function getBrowser() {
  if (navigator.userAgent.toUpperCase().indexOf("OPERA") != -1) {
    return "op";
  } else if (navigator.userAgent.toUpperCase().indexOf("MSIE") != -1) {
    return "ie";
  } else if (navigator.userAgent.toUpperCase().indexOf("MSIE") != -1) {
    return "ie";
  } else if (navigator.userAgent.toUpperCase().indexOf("CHROME") != -1) {
    return "cr";
  } else if (navigator.userAgent.toUpperCase().indexOf("SAFARI") != -1) {
    return "sf";
  } else {
    return "mz";
  }
}

function isMobile() {
  ua = new Array("Windows CE","Qtek","AvantGo","Mazingo","Mobile","T68","Syncalot","Blazer","BlackBerry","SonyEricsson","Smartphone","MMP","Nokia","NetFront","RIM","Xiino");
  if(screen.width < 640 || screen.height < 480) return true; 
  for (i=0;i<ua.length;i++) {
    if (navigator.userAgent.toUpperCase().indexOf(ua[i].toUpperCase()) != -1) return true;
  }
  return false;
}

function resizeSWF(id, h) {
  if (parent.document.getElementById("bnexp")) parent.document.getElementById("bnexp").style.height=h;
  if (getBrowser() == "ie") {
    document.getElementById(id+"_obj").style.height=h;
  } else {
    document.getElementById(id+"_emb").style.height=h;
  }
}

function resizeSWF__(obj,h) {
  if (getBrowser() == "ie") {
    obj.style.height=h;
  } else {
    obj.childNodes[6].style.height=h;
    if (h>60) {
      obj.childNodes[6].scale="exactfit";
    } else {
      obj.childNodes[6].scale="noborder";
    }
  }
  
}

function resizeSWF_(obj,h) {
  flash = obj.childNodes[0];
  flash.height=h;
  flash.style.height=h;
  if (h>60) {
    flash.scale="exactfit";
  } else {
    flash.scale="noborder";
  }
}

function resizeGIF(id, v) {
  document.getElementById(id).style.overflow=v;
}

function showExpSWF(src, width, height, height_exp, url, trg) {
  document.write('<span id="flash_exp" onMouseOver=resizeSWF("flash",'+height_exp+') onMouseOut=resizeSWF("flash",'+height+')>');
  document.write('<OBJECT id="flash_obj" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">');
  document.write('<PARAM NAME=movie VALUE='+src+'><PARAM NAME=flashvars VALUE="url='+url+'&target='+((trg)?(trg):("_self"))+'"><PARAM NAME=menu VALUE=false><PARAM NAME=scale VALUE=noborder><PARAM NAME=salign VALUE=T><PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent>');
  document.write('<EMBED id="flash_emb" src='+src+' flashvars="url='+url+'&target='+((trg)?(trg):("_self"))+'" menu=false quality=high scale=noborder salign=T wmode=transparent WIDTH="'+width+'" HEIGHT="'+height+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT></span>');
}

function showExpGIF(src, url, width, height, trg) {
  document.write('<span id="gif_exp" style="width:'+width+'px;height:'+height+'px" onMouseOver=resizeGIF(this.id,"visible") onMouseOut=resizeGIF(this.id,"hidden")><a href='+url+((trg)?(" target="+trg):(""))+'><img src='+src+' border=0></a></span>');
}

function showBannerSWF(src, width, height, url, bg, trg, win) {
  document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + width + '" HEIGHT="' + height + '">');
  document.write('<PARAM NAME=movie VALUE="' + src + '"><PARAM NAME=flashvars VALUE="url=' + url + '&target=' + ((trg)?(trg):("_self")) + '"><PARAM NAME=wmode VALUE="' + win + '"><PARAM NAME=menu VALUE=false><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#' + bg + '>');
  document.write('<EMBED src="' + src + '" menu=false flashvars="url=' + url + '&target=' + ((trg)?(trg):("_self")) + '" wmode="' + win + '" quality=high bgcolor=#' + bg + '  WIDTH="' + width + '" HEIGHT="' + height + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
}

function showBannerGIF(src, width, height, url, trg) {
  document.write('<a href='+url+((trg)?(" target="+trg):(""))+'><img src='+src+' width='+width+' height='+height+' border=0></a>');
}

function showSplash(width, height, top, left, time, dir, exp) {
  if (getCookie("splash_"+dir.substr(1)) == "sim") {
    return false;
  } else {
    if (exp) {
      setCookie("splash_"+dir.substr(1),"sim",dir,exp);
    } else {
      setCookie("splash_"+dir.substr(1),"sim",dir);
    }
    if (dir != "/") dir += "/";
    document.write('<iframe id="splash" src="http://www.acessa.com'+dir+'splash.php" scrolling="no" frameborder="0" width="'+width+'" height="'+height+'" allowtransparency="true" style="z-index:9999;position:absolute;left:'+left+'px;top:'+top+'px"></iframe>');
    document.getElementById("splash").onload = function(){startTimer(time);}
    return true;
  }
}


function startTimer(t) {
  timer = setTimeout("hideSplash()",t*1000);
}

function hideSplash() {
  document.getElementById("splash").style.visibility="hidden";
  clearTimeout(timer);
}

function parOuImpar() {
  return Math.floor(Math.random()*10)%2;
}

function showPop(width, height, top, left, dir, exp) {
  if (getCookie("pop_"+dir.substr(1)) != "sim") {
    if (exp) {
      setCookie("pop_"+dir.substr(1),"sim",dir,exp);
    } else {
      setCookie("pop_"+dir.substr(1),"sim",dir);
    }
    window.open("anuncio.apl","pop","width="+width+",height="+height+",top="+top+",left="+left);
    return true;
  } else {
    return false;
  }
}

function flash(src, width, height, bg, win, vars, scl, slg, alg) {
  if(document.getElementById("swf"+id_swf)) id_swf++;
  document.write('<div id="swf'+id_swf+'"><a href="http://www.macromedia.com/go/getflashplayer">Baixe o Flash Player</a> para visualizar esse conteúdo.</div>');  

  var params = {
    wmode: win,
    scale: scl,
    salign: slg,
    align: alg,
    menu: "false",
    bgcolor: bg
  };
  var flashvars = {};
  
  aux_vars = (vars != undefined && vars != "") ? vars.split("&") : "";
  for(i=0; i<aux_vars.length; i++) {
    aux = aux_vars[i].split("=");
    p = aux[0];
    if(aux.length>2) {
      aux.shift();
      v = aux.join("=");
    } else {
      v = aux[1];
    }
    eval("flashvars."+p+"='"+v+"';");
  }
  swfobject.embedSWF(src,"swf"+id_swf,width,height,"6","",flashvars,params); 
}

function flash_video(src, lgd, ali, trl) {
  lgd = lgd.replace(/(.*)[\"\'](.*)[\"\'](.*)/, "$1“$2”$3");
  hoje = new Date();
  ano = hoje.getFullYear();    
  var dir = location.pathname.substr(0,location.pathname.lastIndexOf("/")+1);
  var foto_url = src+".jpg";
  var video_url = (src.indexOf("/") == 0) ? src+".flv" : dir+src+".flv";
  var lgd = lgd + ((trl == "trailer")?"":" | © ACESSA.com 1997 - "+ano);
  document.write('<div style=padding:5px;float:'+ali+'>');
  flash("/swf/video.swf",220,240,"ffffff","opaque","nome="+lgd+"&video_url="+video_url+"&foto_url="+foto_url,"");
  document.write('</div>');
}

function mediaPlayer(width, height, file, auto) {
  var path = "/multimidia/img/";
  var dir = (file.indexOf("/") == 0) ? "" : location.pathname.substr(0,location.pathname.lastIndexOf("/")+1);
  var digits = (width>=200)?true:false;
  var logo = (width>=250)?path+"acessa_multimidia.png":path+"acessa_multimidia_p.png";
  var src = dir+file;
  var auto = (auto!=true) ? false : auto;
   
  flash(path+"mediaplayer.swf", width, (height+20), "ffffff", "opaque", "file=/multimidia/playlist.php&f="+src+"&showdigits="+digits+"&logo="+logo+"&autostart="+auto+"&shuffle=false&shownavigation=false&showfsbutton=false&repeat=list&volume=100");
}

function wm_(src, width, height, auto, ctrl, loop) {
  height = (ctrl == 1) ? height+45 : height;
  document.write('<OBJECT width="' + width + '" height="' + height + '" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Carregando..." type="application/x-oleobject">');
  document.write('<param name="fileName" value="' + src + '"><param name="ShowStatusBar" value="true"><param name="autoStart" value="' + auto + '"><param name="showControls" value="' + ctrl + '"><param name="loop"  value="' + loop + '">');
  document.write('<EMBED type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" showcontrols="' + ctrl + '" width="' + width + '" height="' + height + '" src="' + src + '" autostart="' + auto + '" loop="' + loop + '"></EMBED></OBJECT>');
}

function logaWM(f) {
  f.submit();
  f.reset();
  return false;
}

function verifica(f) {
  resultado = true;
  if(f.nodeName == "FORM") f = f.name;
  msg = ""; 
  for(var i=1; i<arguments.length; i++) {
    campo = eval("document." + f + "." + arguments[i]) ? eval("document." + f + "." + arguments[i]) : false;
    if (campo && !campo.disabled) {
      campo.value = trim(campo.value);
      if(campo.type.indexOf("select") != -1 && campo.options[campo.selectedIndex].value == "") {
        msg += arguments[i]+"\n";
        resultado = false;
      } else if (campo.name.toLowerCase().indexOf("mail") != -1 && !validaEmail(campo.value)) {
        msg += arguments[i]+"\n";  
        resultado = false;
      } else if(campo.name.toLowerCase().indexOf("cpf") != -1 && !validaCPF(campo.value)) {
        msg += arguments[i]+"\n";  
        resultado = false;
      } else if((campo.name.toLowerCase().indexOf("telefone") != -1 || campo.name.toLowerCase().indexOf("celular") != -1) && !validaTelefone(campo.value)) {
        msg += arguments[i]+"\n";  
        resultado = false;
      } else if (campo.value == '') {
        msg += arguments[i]+"\n";
        resultado = false;
      }
    }
  }
  if(!resultado) alert("ERRO!! Verifique o(s) seguinte(s) campo(s):\n"+msg.toUpperCase().replace(/_/g, " "));
  return resultado;
}

function verificaForm(f) {  
  resultado = true;       
  msg = "";  
  for(var i=0; i<f.elements.length; i++) {    
    campo = f.elements[i];
    //só verifica se o campo tem class=obr e nao esta disabled
    if (campo.className.indexOf("obr") == 0 && !campo.disabled) {
      if(campo.type == "text" || campo.type == "textarea") campo.value = trim(campo.value);                  
      if((campo.type.indexOf("select") != -1 && campo.options[campo.selectedIndex].value == "") ||
         (campo.name.toLowerCase().indexOf("mail") != -1 && !validaEmail(campo.value)) ||
         (campo.name.toLowerCase().indexOf("cpf") != -1 && !validaCPF(campo.value)) ||
         ((campo.name.toLowerCase().indexOf("telefone") != -1 || campo.name.toLowerCase().indexOf("celular") != -1) && !validaTelefone(campo.value)) ||
         (campo.type.indexOf("checkbox") != -1 && !campo.checked) ||
         (campo.value == '')) {
        msg += campo.name+"\n";
        campo.className += (campo.className.indexOf(" err") == -1) ? " err" : "";
        resultado = false;        
      } else {
        campo.className = campo.className.replace(" err", "");  
      }
    }
  }  
  //caso o campo SM_sbj seja usado sem ser hidden, troca o nome, na mensagem, para ASSUNTO
  msg = msg.replace("SM_sbj","assunto");  
  if(!resultado) alert("ERRO!! Verifique o(s) campo(s) marcado(s) em vermelho:\n"+msg.toUpperCase().replace(/_/g, " "));
  return resultado; 
}

/*
function verificaForm_old(f) {
  resultado = true;       
  msg = "";  
  for(var i=0; i<f.elements.length; i++) {    
    campo = f.elements[i];
    if (campo.className.indexOf("obr") == 0 && !campo.disabled) {
      if(campo.type == "text" || campo.type == "textarea") campo.value = trim(campo.value);
      
      if(campo.type.indexOf("select") != -1 && campo.options[campo.selectedIndex].value == "") {
        msg += campo.name+"\n";
        campo.className += (campo.className.indexOf(" err") == -1) ? " err" : "";
        resultado = false;        
      } else if (campo.name.toLowerCase().indexOf("mail") != -1 && !validaEmail(campo.value)) {
        msg += campo.name+"\n";   
        campo.className += (campo.className.indexOf(" err") == -1) ? " err" : "";     
        resultado = false;
      } else if(campo.name.toLowerCase().indexOf("cpf") != -1 && !validaCPF(campo.value)) {
        msg += campo.name+"\n";   
        campo.className += (campo.className.indexOf(" err") == -1) ? " err" : "";     
        resultado = false;
      } else if((campo.name.toLowerCase().indexOf("telefone") != -1 || campo.name.toLowerCase().indexOf("celular") != -1) && !validaTelefone(campo.value)) {
        msg += campo.name+"\n";   
        campo.className += (campo.className.indexOf(" err") == -1) ? " err" : "";     
        resultado = false;
      } else if (campo.value == '') {
        msg += campo.name+"\n";        
        campo.className += (campo.className.indexOf(" err") == -1) ? " err" : "";
        resultado = false;
      } else {
        campo.className = campo.className.replace(" err", "");        
      }      
    }
  }
  //caso o campo SM_sbj seja usado sem ser hidden, troca o nome, na mensagem, para ASSUNTO
  msg = msg.replace("SM_sbj","assunto");  
  if(!resultado) alert("ERRO!! Verifique o(s) campo(s) marcado(s) em vermelho:\n"+msg.toUpperCase().replace(/_/g, " "));
  return resultado; 
}
*/

function mudaSBJ(f,s) {
  f.SM_sbj.value = s;
}

function validaEmail(e) {
  reg_mail = /^[\w\-\.]{2,}@([a-z0-9][\w\-]*[a-z0-9]\.){1,2}([a-z0-9]{2,10}$|[a-z0-9]{2,10}\.[a-z]{2}$)/i;
  return reg_mail.test(e);   
}

/*
function validaEmail_old(e) {
  n = /^[\w\-\.]{2,}$/i;
  //comentada em 24/11/08 para suportar emails de subdomino: XXXX@YYYY.ZZZZ.COM.BR
  //m = /^[a-z0-9][\w\-]*[a-z0-9]\.([a-z0-9]{2,10}$|[a-z0-9]{2,10}\.[a-z]{2}$)/i;
  m = /^([a-z0-9][\w\-]*[a-z0-9]\.){1,2}([a-z0-9]{2,10}$|[a-z0-9]{2,10}\.[a-z]{2}$)/i;
  if (e.lastIndexOf("@") != e.indexOf("@") || e.indexOf("@") == -1 || e.lastIndexOf("@") == e.length-1) {
    return false;
  } else {
    aux = e.split("@");
    user = aux[0];
    domain = aux[1];
    if(n.test(user)) {
      if (m.test(domain)) {
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
}
*/

function validaCPF(n) {
//remove hifen, ponto e espaços
  n = n.replace(/[\.\-\s]/g, "");
  reg_cpf = /[0-9]{11}/;
  reg_igual = /(0{11}|1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11})/;
  if(!reg_cpf.test(n) || reg_igual.test(n)) {
    return false;
  } else {
//separa os DV    
    d1 = n.substr(9, 1);
    d2 = n.substr(10, 1);
        
//primeiro digito    
    soma = 0;
    mult = 10;
    for(i=0; i<n.length-2;i++) {
      soma += n[i] * mult;
      mult--;
    }
    resto = soma % 11;     
    if(resto < 2) { 
      if(d1 != 0) return false;
    } else {
      if(11 - resto != d1) return false;      
    }
    
//segundo digito    
    soma = 0;
    mult = 11;
    for(i=0; i<n.length-1;i++) {
      soma += n[i] * mult;
      mult--;
    }
    resto = soma % 11; 
    if(resto < 2) {
      if(d2 != 0) return false;
    } else {
      if(11 - resto != d2) return false;
    } 
    
//se passou pelas vefiricações, cpf valido    
    return true;        
  }  
}

function geraDV(n) {
  reg_cpf = /[0-9]{9}/;
  if(!reg_cpf.test(n)) {
    return false;
  } else {
    d2 = n.substr(10, 1);
//primeiro digito    
    soma = 0;
    mult = 10;
    for(var i=0; i<n.length;i++) {
      soma += n[i] * mult;
      mult--;
    }
    if(soma%11 < 2) d1 = 0;
    else d1 = 11 - (soma%11);
//segundo digito    
    n += ""+d1;
    soma = 0;
    mult = 11;
    for(var i=0; i<n.length;i++) {
      soma += n[i] * mult;
      mult--;
    }
    if(soma%11 < 2 ) d2 = 0;
    else  d2 = 11 - (soma%11);
    
    return n+""+d2;        
  }  
}

function validaTelefone(n) {
  n = trim(n);
  n = n.replace(/\s{2,}/g," ");//remove espaços duplos
  n = n.replace(/\s*\-\s*/g,"-");//remove espaços em torno de "-"
  reg_tel = /^(\+?\d{2})?\s?[\-\(\s]?(\d{2,3})?[\-\)\s]?\s?\d{4}[\-\s]?\d{4}$/;
  if(reg_tel.test(n)) return true;
  else return false;  
}

function indiqueAmigo() {
  aux = document.title.split("|");   
  //search = location.search.replace("&", "%26");
  openWinCenter("/indique.php?title="+escape(aux[0])+"&url="+escape(location.pathname+location.search),"Indique",430,300);
}

function suaOpiniao() {
  aux = document.title.split("|");
  //search = location.search.replace("&", "%26");
  openWinCenter("/comente.php?title="+escape(aux[0])+"&url="+escape(location.pathname+location.search),"Opinião",430,250);
}

function mudaClass(id,cl) {
  document.getElementById(id).className=cl;
}

//id do elemento, tamanho original da fonte, numero de tamanhos, incremento no tamanho
function aumentaFonte(id, sz, nt, it) {
  font = document.getElementById(id);
  if (font.style.fontSize == "") font.style.fontSize = sz+"px";
  f = font.style.fontSize.substr(0,font.style.fontSize.indexOf("px"));
  f = (f < sz+nt*it) ? parseInt(f)+it : sz;
  font.style.fontSize = f+'px';
} 


function aumentaFonte2(id, sz, nt, it) {
  font = document.getElementById(id);
  if (font.style.fontSize == "") font.style.fontSize = sz+"px";
  f = font.style.fontSize.substr(0,font.style.fontSize.indexOf("px"));
  f = (f < sz+nt*it) ? parseInt(f)+it : f;
  font.style.fontSize = f+'px';
}

//id do elemento, tamanho original da fonte, incremento no tamanho
function diminuiFonte(id, sz, it) {
  font = document.getElementById(id);
  if (font.style.fontSize == "") font.style.fontSize = sz+"px";
  f = font.style.fontSize.substr(0,font.style.fontSize.indexOf("px"));
  f = (f > sz) ? parseInt(f)-it : sz;
  font.style.fontSize = f+'px';
}

//muda o tamanho da fonte. se op == "+" aumenta; se op == "-" diminui
function fonte(op) {
  var inc = 0.2;//valor que será in(de)crementado no tamanho
  var min = 1;//tamanho mínimo da fonte
  var max = 1.6;//tamanho máximo da fonte
  font = document.getElementById("caderno");
  if (font.style.fontSize == "") size = 1;
  if (op == "+") {
    size += inc;
  } else if (op == "-") {
    size -= inc;
  }
  if (size < min) size = min;
  if (size > max) size = max;
  font.style.fontSize = size+"em";
}


//limita o numero de carcteres num textarea
//parametros: ta = textarea a ser limitado, lm = numero de caracteres
//terceiro parametro (true|false) opcional indica que vc quer exibir o numero de caracteres restantes 
//quarto parametro (somente se 3o. true) mostra o texto passado como parametro na frente do 
//numero de caracteres restantes. Ex: "Caracteres restantes: NNN" 
//essa funcao deve ser declarada no onfocus do textearea
function limitaTextArea(ta, lm) {
//define a funcao nos eventos onblur e onkeyup para evitar da pessoa 
//clicar com o botao direito ou pressionar uma tecla por muito tempo 
  if(ta.onblur == null) {
    ta.onblur = ta.onfocus;
    ta.onkeyup = ta.onfocus;
  }  
  n = lm - ta.value.length;//numero de caraceteres restantes    
  if(arguments.length > 2 && arguments[2] == true) {
    if(!(cont = document.getElementById("contTextArea"))) {//se nao existe o input q guarda o contador cria ele
      form = ta.form.name;
      altura = ta.clientHeight;   
      largura = ta.clientWidth;
      label = ta.parentNode; 
      label.innerHTML += '<input type="text" readonly disabled class="textAreaCounter" id="contTextArea">';      
      document.getElementById("contTextArea").style.top=altura+"px";
      document.getElementById("contTextArea").style.width=largura+"px";                                             
      eval("document."+form+"."+ta.name+".focus();");  
    } else {
      cont.value = (arguments[3] ? arguments[3] : "")+(n < 0 ? 0 : n);
    }            
  }    
  if(ta.value.length > lm) {
    ta.value = ta.value.substr(0,lm);
  }    
}

/*
function limitaTextArea_old(ta, lm) {
  if(ta.onblur == null) {
    ta.onblur = ta.onfocus;
    ta.onkeyup = ta.onfocus;
  }
  n = lm - ta.value.length;
  if(arguments.length > 2 && arguments[2].tagName == "INPUT" && arguments[2].type == "text") {
    arguments[2].value = (arguments[3] ? arguments[3] : "")+(n < 0 ? 0 : n);
  }
  if(ta.value.length > lm) {
    ta.value = ta.value.substr(0,lm);
  }
}  
*/

function getUrlArquivo(s) {
  var URL = s.options[s.selectedIndex].value;
	s.selectedIndex = 0;
	
	if(URL != "") top.location.href = URL;
	return;
}

function test_redir(s) {
  v = s.options[s.selectedIndex].value;
  if (v == "" || v == "nada") return false;
}

function selectRedir(s) {  
  v = s.options[s.selectedIndex].value;
  if (v == "" || v == "nada") return false;
  else location.href=v;
}

//Sorteia um numero inteiro entre 0 e n-1
function sorteio(n) {
  n = n.toString();
  z = '';
  for (i = 0; i < n.length; i++) z += '0';
  m = '1' + z; 
  while (true) {
    r = parseInt(Math.random() * m);
    if (r >= 0 && r < n) return r;
  }
}

//nome do tema tem que ser igual ao diretorio do caderno
function escolheTema(nome) {
  tema = getCookie("tema_"+nome);
  if (tema) {
   document.write('<link rel="stylesheet" href="/'+nome+'/css/'+tema+'.css" type="text/css">');
  } else {
   tema = temas[sorteio(temas.length)];
   setCookie("tema_"+nome,tema,'/');
   document.write('<link rel="stylesheet" href="/'+nome+'/css/'+tema+'.css" type="text/css">');
  }
}


function sorteiaTema() {
  if (temas == undefined || temas.length < 1) return;
  nome = caderno[1].substring(1);
  tema = getCookie("tema_"+nome);
  secao = getSecao();
  if(secao != undefined && secoes[secao].length > 2) {
    document.write('<link rel="stylesheet" href="/'+nome+'/css/'+secoes[secao][2]+'.css" type="text/css">');
    return;
  }
  if (tema) {
    document.write('<link rel="stylesheet" href="/'+nome+'/css/'+tema+'.css" type="text/css">');
  } else {
    tema = temas[sorteio(temas.length)];
    setCookie("tema_"+nome,tema,'/');
    document.write('<link rel="stylesheet" href="/'+nome+'/css/'+tema+'.css" type="text/css">');
  }
}

function getSecao() {
  caminho = document.location.pathname+document.location.search;
  if (secoes != undefined) {
    for (i=0; i<i_secoes.length; i++) {
      if(caminho.indexOf(i_secoes[i]) != -1) {
        return i_secoes[i];
      }
    }
  }
}

function isHomeCaderno() {
  caminho = document.location.pathname+document.location.search;
  caderno[1] = (caderno[1].lastIndexOf("/") == caderno[1].length-1) ? caderno[1].substring(0,caderno[1].length-1) : caderno[1];
  if(caminho == caderno[1]+"/" || caminho ==  caderno[1]+"/index.php"  || 
    caminho ==  caderno[1]+"/preview.php" || caminho ==  caderno[1]+"/lucio.php") {
    return true;
  } else {
    ano = new Date().getFullYear();
    for (i=1996; i<=ano; i++) 
      if(caminho == caderno[1]+"/"+i+"/" || caminho ==  caderno[1]+"/"+i+"/index.php"  || caminho ==  caderno[1]+"/"+i+"/preview.php" || caminho ==  caderno[1]+"/"+i+"/lucio.php") 
        return true;
  }
  return false;
}

//Função usada para corrigir submenus em CSS no IE
//Alterada para trocar a imagem de fundo do <LI class="sub"> q tem submenu
function startList(idMenu) {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById(idMenu);
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI" && node.className=="sub") {
          node.onmouseover=function() { this.className+=" over s_over"; }
          node.onmouseout=function() { this.className=this.className.replace(" over s_over", ""); }
      } else if (node.nodeName=="LI") {
        node.onmouseover=function() { this.className+=" over"; }
        node.onmouseout=function() { this.className=this.className.replace(" over", ""); }        
      }
    }
  }
}

/* COMENTADA EM 12/11/2008
//remove os espaços em branco e \n à direita e à esquerda de uma string
function trim(t){
  if (t == undefined || t.length <= 0) return t;
  var aux = "";
  for(var i=0; i<t.length; i++) {
    if(t.charCodeAt(i) == 32 || t.charCodeAt(i) == 10) aux += " ";
    else aux += t.charAt(i);
  }
  t = aux;
  while (t.indexOf(" ") == 0 || t.lastIndexOf(" ") == t.length-1) {
    if (t.indexOf(" ") == 0) {
      t = t.substring(1);//ltrim
    }
    if (t.length <= 0) return t;
    if (t.lastIndexOf(" ") == t.length-1) {
      t = t.substring(0,t.length-1);//rtrim
    }
  }
  return t;
}
*/

//remove os espaços em branco, ENTER, TAB... à direita e à esquerda de uma string
function trim(t) {
  if(typeof t != 'string' && typeof t != 'number') return "";   
  t = t.replace(/^[\s\t\n\r\f\v]*/,"");
  t = t.replace(/[\s\t\n\r\f\v]*$/,"");
  return t;
}

/* COMENTADA EM 26/09/2008
function versaoAudio() {
  t = document.title;
  p = (arguments.length > 0) ? arguments[0].substring(0,arguments[0].length-1) : location.pathname.substring(0,location.pathname.length-1);
  n = p.substring(p.lastIndexOf("/"))+".mp3";
  f = p+n;  
  pop = window.open("/multimidia/pop.php?w=200&h=150&f="+f+"&t="+t,"mediaPlayer","width=200,height=170");
}
*/

function versaoAudio() {  
  if(arguments.length > 0) {
    p = arguments[0].substring(0,arguments[0].length-1);
  } else {
    p = location.pathname;
    if(p.indexOf(".") != -1) {
      p = p.substring(0,p.lastIndexOf("/"));
    } else if(p[p.length-1] == "/") {
      p = p.substring(0,p.length-1);
    } 
  }
  t = document.title;
  n = p.substring(p.lastIndexOf("/"))+".mp3";  
  f = p+n;  
  pop = window.open("/multimidia/pop.php?w=200&h=150&f="+f+"&t="+t,"mediaPlayer","width=200,height=170");
}

//calcula a diferença de dias entre duas datas no formato Date(“Month dd, yyyy”)
function difDias(d1, d2) {
  dias = (d2 - d1)/1000/60/60/24;
  return Math.ceil(dias);
}

function faltaNatal() {
  hoje = new Date();
  natal = new Date("December 25, "+hoje.getFullYear());
  dias = difDias(hoje, natal);
  if (dias == 1) {
    msg = "Falta<br>1 dia para<br>o Natal";
  } else if (dias <= 0) {
    msg = "<p class=feliznatal>FELIZ&nbsp;<br>NATAL!!</p>";
  } else {
    msg = "Faltam<br>"+dias+" dias para<br>o Natal";
  }
  return msg;
}

function clickField(f,v) {
  if (f.value == v) {
    f.value = "";
    return;
  }
  if (f.value == "") f.value = v;
}

function someLabel(f) {
  f.style.zIndex = "3";
}

function mostraLabel(f) {
  if (f.value == "") f.style.zIndex = "1";
}

function atalhos() {
  caminho = document.location.pathname;
  document.write('<ul id="atalhos">');
  document.write('<li><a href="#conteudo">Ir para conteúdo</a></li>');
  if (caminho != "/" && caminho != "/index.php") {    
    document.write('<li><a href="#menu_caderno">Ir para menu do caderno</a></li>');    
  }
  document.write('<li><a href="#navegacao">Ir para menu do portal</a></li>');    
  document.write('</ul>');
}

function linkRSS() {
  if (rss) document.write('<a href="'+rss_link+'" target="_top" type="application/rss+xml">RSS</a>');
}

function data() {
  //dias = new Array("domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado");
  hoje = new Date();
  dia = hoje.getDate();
  mes = hoje.getMonth()+1;
  dia = (dia < 10) ? "0"+dia : dia;
  mes = (mes < 10) ? "0"+mes : mes;
  ano = hoje.getFullYear();
  //if(ano < 1900) ano+=1900; 
  //semana = dias[hoje.getDay()];
  return dia+"/"+mes+"/"+ano;
}

function mostraData() {
  document.write(data());
}

function tiraAcento(t) {
  vogais = new Array("a","e","i","o","u","A","E","I","O","U","c","C");
  acentos = new Array();
  acentos["a"] = "á|à|ã|â|ä";
  acentos["e"] = "é|è|ê|ë|&";
  acentos["i"] = "ì|í|î|ï";
  acentos["o"] = "ò|ó|ô|õ|ö";
  acentos["u"] = "ù|ú|û|ü";
  acentos["c"] = "ç";
  acentos["A"] = "Á|À|Ã|Â|Ä";
  acentos["E"] = "É|È|Ê|Ë";
  acentos["I"] = "Ì|Í|Î|Ï";
  acentos["O"] = "Ò|Ó|Ô|Õ|Ö";
  acentos["U"] = "Ù|Ú|Û|Ü";
  acentos["C"] = "Ç";

  for (var i=0; i<vogais.length; i++) {
    v = vogais[i];
    a = acentos[v].split("|");
    for (var j=0; j<a.length; j++) {
      if(t.indexOf(a[j]) != -1) eval('t = t.replace(/'+a[j]+'/g,"'+v+'")');
    }
  }
  return t;
}

function bloqueiaCopia() {
  alert("Prezado internauta,\n\nNão é permitida a utilização desse conteúdo para fins comerciais e/ou profissionais. Para comprar ou obter autorização de uso desse conteúdo, entre em contato com a ACESSA.com pelo e-mail: redacao@acessa.com");
}


function geraAjax() {
	try {
    xmlhttp = new XMLHttpRequest();
  } catch(ee) {
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch(E) {
        xmlhttp = false;
      }
    }
  }
 return xmlhttp;
}


/* ################### FUNÇÕES INVOCAÇÃO DE BANNER OPENX ################### */
var OA_channel;
var OA_source;
var OA_p=location.protocol=='https:'?'https:':'http:';
var OA_r=Math.floor(Math.random()*99999999);
if (!document.OA_used) document.OA_used = ',';
function OA_adjs(z,n)
{
  if (z>-1) {
    var az="<"+"script language='JavaScript' type='text/javascript' ";
    az+="src='"+OA_p+"//www.acessa.com/Openads/www/delivery/ajs.php?n="+n+"&zoneid="+z;
    az+="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
    az+="&mmm_fo="+(document.mmm_fo)?'1':'0';
    if (document.context) az+= "&context=" + escape(document.context);
    if (window.location) az+="&loc="+escape(window.location);
    if (document.referrer) az+="&referer="+escape(document.referrer);
    az+="'><"+"/script>";
    document.write(az);
  }
}
function OA_adpop(z,n)
{
  if (z>-1) {
    var az="<"+"script language='JavaScript' type='text/javascript' ";
    az+="src='"+OA_p+"//www.acessa.com/Openads/www/delivery/apu.php?n="+n+"&zoneid="+z;
    az+="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
    if (window.location) az+="&loc="+escape(window.location);
    if (document.referrer) az+="&referer="+escape(document.referrer);
    az+="'><"+"/script>";
    document.write(az);
  }
}
/* ################ FIM FUNCOES INVOCAÇÃO DE BANNER OPENX ################ */

function desconectaWiFi() {
  var ajax = geraAjax();
	aux = unescape(getCookie("cn_wf")).split("|");	
	ajax.open("GET","/Login/CVirtual_desconectar.php?ipserv="+aux[0]+"&login="+aux[1]+"&ip="+aux[2],true);
	deleteCookie("cn_wf","/");
	ajax.send(null);
	location.reload();
	alert("Sua conexão foi encerrada!");
}

/*	SWFObject v2.0 <http://code.google.com/p/swfobject/> Mar 14 */
var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();
/* FIM  SWFObject */

/* Funcoes do tinyMCE */
function writeFlash(p) {
	writeEmbed(
		'D27CDB6E-AE6D-11cf-96B8-444553540000',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'application/x-shockwave-flash',
		p
	);
}

function writeShockWave(p) {
	writeEmbed(
	'166B1BCA-3F9C-11CF-8075-444553540000',
	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
	'application/x-director',
		p
	);
}     

function writeQuickTime(p) {
	writeEmbed(
		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
		'video/quicktime',
		p
	);
}

function writeRealMedia(p) {
	writeEmbed(
		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
		'audio/x-pn-realaudio-plugin',
		p
	);
}

function writeWindowsMedia(p) {
	p.url = p.src;
	writeEmbed(
		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
		'application/x-mplayer2',
		p
	);
}

function writeEmbed(cls, cb, mt, p) {
	var h = '', n;

	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
	h += '>';

	for (n in p)
		h += '<param name="' + n + '" value="' + p[n] + '">';

	h += '<embed type="' + mt + '"';

	for (n in p)
		h += n + '="' + p[n] + '" ';

	h += '></embed></object>';

	document.write(h);
}
/* Fim funcoes do tinyMCE */

setCookie("atc",String(Math.random()).replace(/[01]\./, ""),"/");

//testa se o usuario está conectado via cartão virtual e mostra "desconectar" 
if (getCookie("cn_wf") && (parent == self)) {
  aux = unescape(getCookie("cn_wf")).split("|");
  url = "http://www.acessa.com/Login/CVirtual_desconectar.php?ipserv="+aux[0]+"&login="+aux[1]+"&ip="+aux[2];
  document.write("<span id=desconecta_cartao ><a href='"+url+"' style=color:#ff0><strong>Fechar conexão ACESSA Brasil [x]</strong></a></span>");
}

//exibe mensagem do SENDMAIL
if(location.search.indexOf("SM_rslt=okarq") != -1) alert("Sua mensagem foi enviada com sucesso!\nPorém, alguns arquivos foram bloqueados.");
else if(location.search.indexOf("SM_rslt=ok") != -1) alert("Sua mensagem foi enviada com sucesso!");
if(location.search.indexOf("SM_rslt=err") != -1) {
  alert("Ocorreu algum erro no envio de sua mensagem");
  history.back();
}