var delay = 3000; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=40; // time in miliseconds of a single step
var startcolor= new Array(63,85,107);
var endcolor=new Array(63,85,107);

var fcontent=new Array();
begintag='<p class="last-ele">';

// MESSAGGI DA VISUALIZZARE ------------------------------------------------------------------------------

fcontent[0]="<b>Enero 2010</b><br />Realizamos para <b>TomTom</b> un completo informe de huella digital sobre la reputación de sus productos en blogs y foros. ";
fcontent[1]="<b>Enero 2010</b><br />Adaptamos y distribuimos en webs, blogs y foros el formulario sobre la enfermedad de Crohn para los laboratorios <b>Abbott</b>. ";
fcontent[2]="<b>Febrero 2010</b><br />Organizamos la presentación a líderes de opinión online de las novedades de <b>Samsung</b> en el Mobile World Congress. ";
fcontent[3]="<b>Marzo 2010</b><br />Comenzamos una <b>monitorización de crisis</b> alimentaria coordinando varios países europeos. ";
fcontent[4]="<b>Abril 2010</b><br />Analizamos la huella digital y la reputación online de <b>3M</b>, así como de algunos de sus productos. ";
fcontent[5]="<b>Mayo 2010</b><br />Con motivo del Día Mundial de las Enfermedades Gastrointestinales, ponemos en marcha la campaña de <a href='http://www.sincrohnizate.com' target='_blank'><b>Sincrohnízate</b></a>, para informar sobre la Enfermedad de Crohn. ";
fcontent[6]="<b>Junio 2010</b><br />Iniciamos la comunicación de un lanzamiento estrella de <b>Samsung</b>: el Galaxy S, un móvil con superpoderes. Para ello, reunimos a expertos comunicadores de medios online. ";
fcontent[7]="<b>Julio 2010</b><br />Continuamos comunicando el compromiso de <b>Tetra Pak</b> contra el cambio climático, con la ayuda de Facebook solicitamos compromisos ciudadanos. ";
closetag='</p>';
// -------------------------------------------------------------------------------------------------------

var fwidth='218px';
var fheight='95px';
var fadelinks=1;
var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;

//function to change content
function changecontent(){
  if (index>=fcontent.length)
	index=0
  if (DOM2){
	document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
	document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
	if (fadelinks)
	  linkcolorchange(1);
	colorfade(1, 15);
  }
  else if (ie4)
	document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
	for (i=0;i<obj.length;i++)
	  obj[i].style.color=getstepcolor(step);
  }
}

var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {	
	document.getElementById("fscroller").style.color=getstepcolor(step);
	if (fadelinks)
	  linkcolorchange(step);
	step++;
	fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
	clearTimeout(fadecounter);
	document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
	setTimeout("changecontent()", delay);
	
  }   
}

function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
	diff = (startcolor[i]-endcolor[i]);
	if(diff > 0) {
	  newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
	} else {
	  newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
	}
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
  document.write('<div id="fscroller" style="width:'+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent



 
  