function Noticias(o){this.id=o.id;this.veiculo=o.veiculo||"noticias";this.IdEdicao=o.IdEdicao||false;this.IdCanal=o.IdCanal;this.IdSubCanal=o.IdSubCanal;this.ocultarNoticia=o.ocultarNoticia;this.ocultarCanal=o.ocultarCanal;this.ordem=o.ordem||false;this.titulo=o.titulo||"&Uacute;ltimas not&iacute;cias";this.cssTitulo=o.cssTitulo||"color:#FFF; background-color:#900;";this.cssRodape=o.cssRodape||"color:#FFF; background-color:#900;";this.comFoto=o.comFoto||false;this.target=o.target||"_self";this.largura=o.largura||280;this.porPagina=o.porPagina||4;this.totalRegistros=o.totalRegistros||12;this.div=o.div||false;this.rand=Math.random();this.result="";this.iUrl="/plugins/noticias/";this.larguraFoto=100;this.alturaFoto=70;this.semFoto=false;this.fontSize=12;this.resultados=0;this.obj=function(o){return document.getElementById(o)};if(this.largura<=250&&this.largura>=200){this.larguraFoto=80;this.alturaFoto=56}else{if(this.largura<200&&this.largura>=160){this.larguraFoto=50;this.alturaFoto=35}else{if(this.largura<160){this.semFoto=true}}}if(this.largura<100){this.largura=100}if(this.largura<200){this.fontSize=10}this.loader=function(id,r){var url=this.iUrl+"noticias.class.php";var variaveis="veiculo="+this.veiculo+"&totalRegistros="+this.totalRegistros;if(this.IdEdicao){variaveis+="&IdEdicao="+this.IdEdicao}if(this.IdCanal){variaveis+="&IdCanal="+this.IdCanal}if(this.IdSubCanal){variaveis+="&IdSubCanal="+this.IdSubCanal}if(this.ocultarNoticia){variaveis+="&ocultarNoticia="+this.ocultarNoticia}if(this.ocultarCanal){variaveis+="&ocultarCanal="+this.ocultarCanal}if(this.comFoto){variaveis+="&comFoto=1"}if(this.ordem){variaveis+="&ordem="+this.ordem}var req=null;if(window.XMLHttpRequest){req=new XMLHttpRequest()}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP")}}if(req){req.onreadystatechange=function(){if(req.readyState==4){if(req.status==200||req.status==0){eval(id+".carregaXML(req.responseXML,r)")}}}}req.open("GET",url+"?"+variaveis,true);req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");req.send(variaveis)};this.gerar=function(){this.result+='<div style="width:'+this.largura+"px;height:"+(80*this.porPagina+40)+'px">';this.result+='<div id="BlocoNoticias'+this.rand+'" style="width:'+this.largura+"px; height:360px; clip:rect(0px "+this.largura+"px "+(80*this.porPagina+40)+'px 0px); position:absolute; font-family:Tahoma, Geneva, sans-serif; font-size:12px;">';this.result+='<div id="TopoBloco'+this.rand+'" style="height:20px;line-height:20px;text-align:center;background-image:url(\''+this.iUrl+"otempo.png');background-repeat:no-repeat;"+this.cssTitulo+'">'+this.titulo+"</div>";this.result+='<div id="BlocoNoticia'+this.rand+'" style="top:0px; left:0px; width:'+(this.largura*2)+"px; height:"+(80*this.porPagina)+'px; position:relative;">';this.result+='<table cellpadding="0" cellspacing="0" border="0"><tr>';for(var i=0;i<(this.totalRegistros/this.porPagina);i++){if(i==0){var display=""}else{var display="none"}this.result+='<td><div id="Bloco'+(i+1)+this.rand+'" style="width:'+this.largura+"px;height:"+(80*this.porPagina)+"px; float:left;display:"+display+'"></div></td>'}this.result+="</tr></table>";this.result+="</div>";this.result+='<div id="RodapeBloco'+this.rand+'" style="height:20px;position:relative;top:0px;line-height:20px;'+this.cssRodape+'">';this.result+='<span id="spanAnterior'+this.rand+'" style="float:left;display:none">&nbsp;&laquo;&nbsp;<a href="#" id="btAnterior'+this.rand+'" style="'+this.cssRodape+';text-decoration:none;">Anterior</a></span>';this.result+='<span id="spanProxima'+this.rand+'" style="float:right;display:none"><a id="btProxima'+this.rand+'" href="javascript:'+this.id+".MaisNoticias(2,'p')\" style=\""+this.cssRodape+';text-decoration:none">Pr&oacute;xima</a>&nbsp;&raquo;&nbsp;</span>';this.result+="</div>";this.result+="</div>";this.result+="</div>";if(this.div){this.obj(this.div).innerHTML=this.result}else{document.write(this.result)}this.obj("Bloco1"+this.rand).innerHTML='<div style="padding:10px"><img src="/lib/2us/img/loading.gif"></div>';this.loader(this.id,this.rand)};this.carregaXML=function(xml,r){for(var i=0;i<(this.totalRegistros/this.porPagina);i++){eval("var tabela"+(i+1)+"=''")}var rootNode=xml.childNodes;for(var a=0;a<rootNode.length;a++){if(rootNode[a].nodeType=="1"){var cont=1;var pag=1;for(var b=0;b<rootNode[a].childNodes.length;b++){if(rootNode[a].childNodes[b].nodeType=="1"){var tab='<div style="height:80px;background:url('+this.iUrl+"bg.gif);cursor:pointer;clip:rect(0px "+this.largura+'px 80px 0px)" onClick="">';tab+='<table cellpadding="0" cellspacing="0" border="0" width="100%">';tab+='<tr height="80">';for(c=0;c<rootNode[a].childNodes[b].childNodes.length;c++){if(rootNode[a].childNodes[b].childNodes[c].nodeType=="1"){switch(rootNode[a].childNodes[b].childNodes[c].nodeName){case"IdNoticia":var url=rootNode[a].childNodes[b].childNodes[c].firstChild.nodeValue;break;case"Foto":var foto=rootNode[a].childNodes[b].childNodes[c].firstChild.nodeValue;if(foto!="0"){tab+='<td width="1">';if(this.semFoto==false){tab+='<img src="'+foto+'" width="'+this.larguraFoto+'" height="'+this.alturaFoto+'" border="0">'}tab+="</td>"}break;case"Titulo":tab+='<td style="font-size:'+this.fontSize+'px;padding-left:10px;padding-right:3px;">';tab+=rootNode[a].childNodes[b].childNodes[c].firstChild.nodeValue;tab+="</td>";break}}}if(this.target=="_blank"){tab=tab.replace('onClick=""',"onClick=\"window.open('"+url+"')\"")}else{tab=tab.replace('onClick=""',"onClick=\"parent.document.location.href='"+url+"'\"")}tab+="</tr></table></div>";eval("tabela"+pag+"+=tab");if(cont<this.porPagina){cont++}else{cont=1;pag++}this.resultados++}}}}for(var i=0;i<(this.totalRegistros/this.porPagina);i++){eval("this.obj('Bloco"+(i+1)+"'+r).innerHTML=tabela"+(i+1))}if(this.resultados>this.porPagina){this.obj("spanProxima"+this.rand).style.display=""}};this.MaisNoticias=function(pagina,acao){var ix=pagina-1;this.obj("Bloco"+pagina+this.rand).style.display="";if(acao=="p"){var param1=">-"+this.largura;var param2="-20"}else{var param1="<0";var param2="+20";this.obj("BlocoNoticia"+this.rand).style.left=(parseInt(this.obj("BlocoNoticia"+this.rand).style.left)-this.largura)+"px"}this.verifica(param1,param2,pagina)};this.verifica=function(p1,p2,pagina){if(eval("parseInt(this.obj('BlocoNoticia"+this.rand+"').style.left)"+p1)){var left=eval("parseInt(document.getElementById('BlocoNoticia"+this.rand+"').style.left)"+p2);this.obj("BlocoNoticia"+this.rand).style.left=left+"px";setTimeout(this.id+".verifica('"+p1+"','"+p2+"','"+pagina+"')",1)}else{for(var i=0;i<(this.totalRegistros/this.porPagina);i++){if((i+1)!=pagina){this.obj("Bloco"+(i+1)+this.rand).style.display="none"}}this.obj("BlocoNoticia"+this.rand).style.left="0px";this.obj("Bloco"+pagina+this.rand).style.display="";this.obj("spanAnterior"+this.rand).style.display="";this.obj("btAnterior"+this.rand).href="javascript:"+this.id+".MaisNoticias("+(parseInt(pagina)-1)+",'a')";this.obj("spanProxima"+this.rand).style.display="";this.obj("btProxima"+this.rand).href="javascript:"+this.id+".MaisNoticias("+(parseInt(pagina)+1)+",'p')";if(pagina==1){this.obj("spanAnterior"+this.rand).style.display="none"}if(pagina==(this.totalRegistros/this.porPagina)||this.resultados<=(pagina*this.porPagina)){this.obj("spanProxima"+this.rand).style.display="none"}}};this.gerar()};