  var d=document;
  var v = 0;
  var tam = 100;
  var numpage = 0;
  var openclose = 0;
  var reini = d.getElementsByTagName('a');
  var imgbot = d.getElementsByTagName('img');
  var myimages = new Array();
  
  function createExternalLinks() {
	  if(document.getElementsByTagName) {
		  var anchors = document.getElementsByTagName('a');
		  for(var i=0; i<anchors.length; i++) {
			  var anchor = anchors[i];
			  if(anchor.getAttribute("href") && anchor.getAttribute('rel')=='nofollow') { // <-- É necessário inserir rel="nofollow" no link
				  anchor.target = '_blank';
				  var title = anchor.title + ' (Este link abre uma nova janela)'; // <-- Insere este texto no final do Title do link
				  anchor.title = title;
			  }
		  }
	  }
  }
  
  var xmlhttp = getXmlHttpRequest();
	  
	  function getXmlHttpRequest() {
	  
		  if (window.XMLHttpRequest) {
			  return new XMLHttpRequest(); } 
			  
			  else if (window.ActiveXObject) {
			  return new ActiveXObject("Microsoft.XMLHTTP"); }
			  
		   }	
  
	  function alteraURL(id) {
		  xmlhttp.open("GET", 'gera_destaque.php?hot='+HOT+'&id='+id, true);
		  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-1");
		  xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		  xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
		  xmlhttp.setRequestHeader("Pragma", "no-cache");
		  
		  xmlhttp.onreadystatechange = function() {
		  
			 if (xmlhttp.readyState==1) {
			 d.getElementById("noticiaDestaque").innerHTML = "<div><img src='imagens/carregando.gif' /></div>";
			 }
		  
			 if (xmlhttp.readyState==4) {
			   if(xmlhttp.status == 200) {
	  
				  d.getElementById("noticiaDestaque").innerHTML = xmlhttp.responseText;
				  }
				  
			  else {
			  d.getElementById("noticiaDestaque").innerHTML = "Erro:" + xmlhttp.status;
			  }	
			 }
			}	
		  
		  xmlhttp.send(null);
	  }
	  
  function slide_start() {
  timer=setTimeout('slide_next()',0);
  
  }	
  
  function slide_next() {
	  numpage++;
  
	  if (numpage <= NUM_DESTAQUES) {
	  alteraURL(numpage);
	  numant=numpage;
	  
	  timer=setTimeout('slide_next()',10000);	
  
	  }
	  
	  else {
	  numpage=0;
	  timer=setTimeout('slide_next()',0);
	  
	  }
  
  }
  
  function slide_prox() {
	  
	  for (var x=0; x<reini.length; x++) {
   //
   if (reini[x].title == 'Reiniciar') {
	  
	  for (var y=0; y<imgbot.length; y++) {
		if (imgbot[y].alt == 'Reiniciar') {
	   
		reini[x].title = 'Pausar';
		imgbot[y].src ='imagens/botoes_r3_c1.jpg';
		imgbot[y].alt = 'Pausar';
	 
		}
	  }
  
   }//
  }
	  
	  clearTimeout(timer);
	  timer=setTimeout('slide_next()',0);
  
  }
  
  function slide_ant() {
	  
	  for (var x=0; x<reini.length; x++) {
  
   if (reini[x].title == 'Reiniciar') {
	  
	  for (var y=0; y<imgbot.length; y++) {
		if (imgbot[y].alt == 'Reiniciar') {
	   
		reini[x].title = 'Pausar';
		imgbot[y].src ='imagens/botoes_r3_c1.jpg';
		imgbot[y].alt = 'Pausar';
	   
		}
	  }
  
   }
  }	
	  
  if (numpage==1) {
	  numant = NUM_DESTAQUES;	
  }
  
  
  if (numpage != NUM_DESTAQUES && numpage > 1) {
	  numant= (numpage - 1);
  }
  
  
  if (numpage == NUM_DESTAQUES) {
	  numant = (NUM_DESTAQUES - 1);	
  }

  alteraURL(numant);
  
  numpage=numant;
  clearTimeout(timer);
  timer=setTimeout('slide_next()',10000);
	
  }
  
  function slide_parar() {
  
  for (var x=0; x<reini.length; x++) {
   //
   if (reini[x].title == 'Pausar') {
	  
	  for (var y=0; y<imgbot.length; y++) {
		if (imgbot[y].alt == 'Pausar') {
	   
		clearTimeout(timer);
		reini[x].title = 'Reiniciar';
		imgbot[y].src ='imagens/botoes_r5_c1.jpg';
		imgbot[y].alt = 'Reiniciar';
	 
		}
	  }
  
   }//
   
   //
   else if (reini[x].title == 'Reiniciar') {
   
	  for (var y=0; y<imgbot.length; y++) {
		if (imgbot[y].alt == 'Reiniciar') {
	   
		reini[x].title = 'Pausar';
		imgbot[y].src ='imagens/botoes_r3_c1.jpg';
		imgbot[y].alt = 'Pausar';
	 
		}
	  }
	  
  timer=setTimeout('slide_next()',10000);	
   
   }//
   
  }
  
  }
	  