/************************************************************
	
	Arquivo: js_noticiasPaginaInicial.js
	Data: 24/11/2006
	Descrição:
		Funções para habilitar as noticias da página inicial
	
************************************************************/

var delayRP = 8500; 
var maxstepsRP = 30; 
var stepdelayRP = 40;
var startcolorRP = new Array(255,255,255); 
var endcolorRP = new Array(0,0,0);

var fcontentRP = new Array();
begintag = '<div class="boxNoticia_RP" style="text-align:justify;position:relative;left:12px;">';
closetag = '</div>';

var fwidthRP = '250px'; 
var fheightRP = '65px'; 

var fadelinksRP = 1; 

var ie4_RP = document.all&&!document.getElementById;
var DOM2_RP = document.getElementById;
var faderdelayRP = 0;
var indexRP = 0;

function changecontentRP(){
  if (indexRP>=fcontentRP.length)
    indexRP=0
  if (DOM2_RP){
    document.getElementById("fscrollerRP").style.color="rgb("+startcolorRP[0]+", "+startcolorRP[1]+", "+startcolorRP[2]+")"
    if (fcontentRP.length == 1){
	document.getElementById("fscrollerRP").innerHTML=begintag+fcontentRP[indexRP]+closetag
	}
	else
	{
	document.getElementById("fscrollerRP").innerHTML=begintag+fcontentRP[indexRP]+" ("+(indexRP+1)+" "+varLigacao_de_of+" "+fcontentRP.length+")"+closetag	
	}
    if (fadelinksRP)
      linkcolorchangeRP(1);
    colorfadeRP(1, 15);
  }
  else if (ie4_RP)
    document.all.fscrollerRP.innerHTML=begintag+fcontentRP[indexRP]+closetag;
  indexRP++
}


function linkcolorchangeRP(step){
  var obj=document.getElementById("fscrollerRP").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolorRP(step);
  }
}

var fadecounterRP;
function colorfadeRP(step) {
  if(step<=maxstepsRP) {	
    document.getElementById("fscrollerRP").style.color=getstepcolorRP(step);
    if (fadelinksRP)
      linkcolorchangeRP(step);
    step++;
    fadecounterRP=setTimeout("colorfadeRP("+step+")",stepdelayRP);
  }else{
    clearTimeout(fadecounterRP);
    document.getElementById("fscrollerRP").style.color="rgb("+endcolorRP[0]+", "+endcolorRP[1]+", "+endcolorRP[2]+")";
    setTimeout("changecontentRP()", delayRP);
	
  }   
}

function getstepcolorRP(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolorRP[i]-endcolorRP[i]);
    if(diff > 0) {
      newcolor[i] = startcolorRP[i]-(Math.round((diff/maxstepsRP))*step);
    } else {
      newcolor[i] = startcolorRP[i]+(Math.round((Math.abs(diff)/maxstepsRP))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4_RP||DOM2_RP)
  document.write('<div id="fscrollerRP" style="border:0px solid black;width:'+fwidthRP+';height:'+fheightRP+';align:left;"></div>');

/*if (window.addEventListener)
	window.addEventListener("load", changecontentRP, false)
else if (window.attachEvent)
	window.attachEvent("onload", changecontentRP)
else if (document.getElementById)
	window.onload=changecontentRP*/


