var UOLLib=window.UOLLib||{};
UOLLib.rotativoDeChamadas={painel:null,itens:null,botoes:null,botoesTxts:{next:"proximo",prev:"anterior",stop:"parar",play:"executar"},botoesRefClickUOL:"",ativado:0,anterior:0,proximo:0,navMSIE:!!navigator.userAgent.match(/MSIE/g),timeOut:null,timer:10,animando:false,banner:document.createElement("div"),showBanner:false,contaTrocas:0,init:function(a){this.painel=document.getElementById(a.id);
this.timer=a.timer||this.timer;
this.botoesRefClickUOL=a.botoesRefClickUOL||this.botoesRefClickUOL;
this.botoesTxts=a.botoesTxts||this.botoesTxts;
if(typeof mostrabanner=="undefined"){mostrabanner=1} this.showBanner=1//this.showBanner=showBanner=(document.cookie.indexOf("rotativoDeChamadasNoBanner=1")==-1)?true:false;alert(document.cookie.indexOf("rotativoDeChamadasNoBanner=1"));
this.itens=this.painel.getElementsByTagName("li");
this.setNavegacao(this.ativado);
this.aplicarSombras();
if(this.itens.length==1){a.startOff=true}else{this.montarBotoes()}if(document.cookie.indexOf("rotativoDeChamadasStop=1")!=-1){a.startOff=true}if(!a.startOff){this.stopPlay()}else{this.setBtStopPlay("play")}},events:{preventDefault:function(a){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}},add:function(c,b,a){if(document.attachEvent){c.attachEvent("on"+b,a)}else{if(document.addEventListener){c.addEventListener(b,a,true)}}}},stopPlay:function(a){if((!a&&this.timeOut==null)||(a&&this.timeOut!=null)){clearInterval(this.timeOut);
this.timeOut=setInterval(function(){UOLLib.rotativoDeChamadas.navegar(1)},UOLLib.rotativoDeChamadas.timer*1000);
document.cookie="rotativoDeChamadasStop=0; path=/";
this.setBtStopPlay("stop")}else{document.cookie="rotativoDeChamadasStop=1; path=/";
clearInterval(this.timeOut);
this.timeOut=null;
this.setBtStopPlay("play")}},setBtStopPlay:function(a){if(this.botoes!=null){var b=this.botoes.getElementsByTagName("a")[1];
b.className="bt"+a;
b.innerHTML=this.botoesTxts[a]}},setNavegacao:function(a){this.ativado=(parseInt(a)+(this.ativado||this.itens.length))%this.itens.length;
this.anterior=((this.ativado||this.itens.length)-1)%this.itens.length;
this.proximo=((this.ativado||this.itens.length)+1)%this.itens.length},fadeIO:function(b,d,c){if(d){b.style.opacity=0;
b.style.filter="Alpha(Opacity=0)"}else{b.style.opacity=1;
b.style.filter="Alpha(Opacity=100)"}UOLLib.rotativoDeChamadas.animando=true;
for(var a=1;a<=10;a++){setTimeout(function(e){return function(){if(UOLLib.rotativoDeChamadas.navMSIE){b.style.filter="Alpha(Opacity="+(d?10*e:100-10*e)+")"}else{b.style.opacity=(d?0.1*e:1-0.1*e)}if(e==10){UOLLib.rotativoDeChamadas.animando=false;
if(typeof c=="function"){c()}}}}(a),75*a)}},fecharBanner:function(){document.cookie="rotativoDeChamadasNoBanner=1; path=/";
this.showBanner=false; 
clearTimeout(UOLLib.rotativoDeChamadas.bannerFadeOutTimer);
this.bannerFadeOut()},bannerFadeOut:function(){this.fadeIO(this.banner,false,function(){UOLLib.rotativoDeChamadas.banner.style.display="none";
UOLLib.rotativoDeChamadas.botoes.style.display="block"});
this.fadeIO(this.botoes,true,null)
document.getElementById('ctl00_ContentPlaceHolder1_bannerDisplay').style.display="none";},navegar:function(b){var a=this.ativado;
this.removerBanner=false;
this.contaTrocas++;


if(mostrabanner==1&&this.showBanner&&this.contaTrocas>0&&this.contaTrocas%this.itens.length==0){document.getElementById('ctl00_ContentPlaceHolder1_bannerDisplay').style.display="block";//alert('banner');
//this.banner.className="banner";
//this.banner.innerHTML='<a href="'+mostrabannerLINK+'" target="_blank"><img src="'+mostrabannerIMG+'" border="0" /></a><div class="rodape"><img src="http://home.img.uol.com.br/h3/pub_h_120_b.gif" class="txtPublicidade" border="0" /><a href="javascript:void(0)" onclick="UOLLib.rotativoDeChamadas.fecharBanner()"><img src="http://home.img.uol.com.br/h3/banner-fechar.gif" border="0" /></div>';
//this.painel.appendChild(this.banner);
this.fadeIO(this.banner,true,function(){UOLLib.rotativoDeChamadas.botoes.style.display="none"});
this.fadeIO(this.botoes,false,null);
if(this.timeOut!=null){UOLLib.rotativoDeChamadas.bannerFadeOutTimer=setTimeout(function(){UOLLib.rotativoDeChamadas.bannerFadeOut()},UOLLib.rotativoDeChamadas.timer*1000)}}else{this.setNavegacao(b);
document.getElementById('ctl00_ContentPlaceHolder1_bannerDisplay').style.display="none";
this.itens[this.ativado].className=this.itens[this.ativado].className.replace(/desativado/g,"");
this.itens[this.ativado].style.zIndex=3;
this.itens[a].style.zIndex=4;
this.itens[this.ativado].style.opacity=1;
this.itens[this.ativado].style.filter="none";
this.fadeIO(this.itens[a],false,function(){if(UOLLib.rotativoDeChamadas.navMSIE){UOLLib.rotativoDeChamadas.itens[a].style.filter=UOLLib.rotativoDeChamadas.itens[a].style.filter="none"}UOLLib.rotativoDeChamadas.itens[a].className="desativado";
UOLLib.rotativoDeChamadas.itens[a].style.zIndex=2});
this.writeBotoesHTML();
if(this.timeOut==null){this.setBtStopPlay("play")}else{this.setBtStopPlay("stop")}}},montarBotoes:function(){this.botoes=document.createElement("div");
this.botoes.className="botoesNavegacao";
this.writeBotoesHTML();
this.painel.appendChild(this.botoes)},aplicarSombras:function(){var b=document.createElement("div");
b.className="sombra";
for(var a=0;a<this.itens.length;a++){if(a>0){this.itens[a].className+=" desativado"}this.itens[a].appendChild(b.cloneNode(true))}},writeBotoesHTML:function(){this.botoes.innerHTML="<a rel='-1' href='"+this.itens[this.anterior].getElementsByTagName("a")[0].href.replace(/(^.*?click\.uol.*?rf\=).*?(&u\=.*?)$/g,"$1"+this.botoesRefClickUOL+"$2")+"' class='anterior' name='"+this.botoesRefClickUOL+"'>"+this.botoesTxts.prev+"</a>      <a rel='0' href='"+this.itens[this.ativado].getElementsByTagName("a")[0].href.replace(/(^.*?click\.uol.*?rf\=).*?(&u\=.*?)$/g,"$1"+this.botoesRefClickUOL+"$2")+"' class='' name='"+this.botoesRefClickUOL+"'></a>      <a rel='+1' href='"+this.itens[this.proximo].getElementsByTagName("a")[0].href.replace(/(^.*?click\.uol.*?rf\=).*?(&u\=.*?)$/g,"$1"+this.botoesRefClickUOL+"$2")+"' class='proximo' name='"+this.botoesRefClickUOL+"'>"+this.botoesTxts.next+"</a>";
var b=this.botoes.getElementsByTagName("a");
for(var a=0;a<b.length;a++){this.events.add(b[a],"click",function(c){UOLLib.rotativoDeChamadas.btNavegacaoClick(c)})}},btNavegacaoClick:function(a){UOLLib.rotativoDeChamadas.events.preventDefault(a);
if(a.srcElement&&!a.target){a.target=a.srcElement}if(a.target.rel==0){UOLLib.rotativoDeChamadas.stopPlay()}else{if(UOLLib.rotativoDeChamadas.animando==false){setTimeout(function(){UOLLib.rotativoDeChamadas.navegar(a.target.rel);
UOLLib.rotativoDeChamadas.stopPlay(true)},30)}}}};
