
/***********************************************
* Fading Scroller- c Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
  

var delay = 500; //set delay between message change (in miliseconds)
var maxsteps=15; // number of steps to take to change from start color to endcolor
var stepdelay=100; // time in miliseconds of a single step
var timeToShow = 1500;
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(9,46,129); //(#092E81); //#0D31CA start color (red, green, blue)
var endcolor=new Array(255,255,255); // end color (red, green, blue)

//var fcontent=new Array();

begintag="<div>"; //set opening tag, such as font declarations


/*
fcontent[0]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5119'>Citrix offre le cloud aux clients VMware</a>";
fcontent[1]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5117'>Citrix fait évoluer la virtualisation de postes de travail</a>";
fcontent[2]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5096'>Citrix étend son leadership en matière de postes virtuels avec l’acquisition de RingCube</a>";
fcontent[3]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5094'>Citrix étend sa présence dans la Silicon Valley en engageant des vétérans de l\'industrie venant de Cisco, HP et Symantec</a>";
fcontent[4]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5092'>IDC reconnaît Citrix, comme le seul fournisseur dans la catégorie des leaders, dans son étude de marché </a>";
fcontent[5]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5089'>Avec l\'acquisition de Cloud.com, Citrix fait évoluer le paysage des infrastructures en cloud</a>";
fcontent[6]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5090'>Citrix XenServer dans le haut du Quadrant pour les analystes</a>";
fcontent[7]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5091'>Citrix figure dans le quadrant des leaders du Quadrant Magique 2011 des infrastructures de virtualisation de serveurs x86 </a>";
fcontent[8]="<a href='/SpecialCases/pressPage.asp?cnt_Id=5073'>Citrix étend son portefeuille de solutions de virtualisation de postes avec l\'acquisition de Kaviza</a>";
var pressCnt = 9;


fcontent[pressCnt + 0]="<a href='/podcast/2011/01/le-podcast-de-citrix-demenage/'>Le podcast de Citrix déménage !</a>";
fcontent[pressCnt + 1]="<a href='/podcast/2010/12/le-nouveau-xendesktop-design-handbook-est-disponible-sans-enregistrement-prealable/'>Le nouveau XenDesktop Design Handbook est disponible sans enregistrement préalable !</a>";
fcontent[pressCnt + 2]="<a href='/podcast/2010/12/le-projet-alcatraz/'>Le projet Alcatraz</a>";
var podcastCnt = 3;
*/
closetag='</div>';

var fwidth='100%'; //set scroller width
var fheight='18px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;
var vitDivConstant = "";

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 changeTitle(idx)
{
  /*if (!DOM2) return;

  if(idx==0)
    document.getElementById("titlePress").innerHTML = "COMMUNIQU&Eacute;S";
  else if(idx==pressCnt)
    document.getElementById("titlePress").innerHTML = "A LA UNE DU PODCAST";*/
}


/*Rafael Raposo edited function*/
//function to change content
function changecontent(fcontent){
  if (index>=window.fcontent.length)
    index=0

  //changeTitle(index);

  if (DOM2){
    //document.getElementById("fscroller").style.backgroundColor="#ffffff";
    document.getElementById("fscroller").style.marginBottom="0px";
    document.getElementById("fscroller").style.marginTop="0px";
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").style.width="695px";
    document.getElementById("fscroller").innerHTML=begintag+window.fcontent[index]+closetag
    var tmp = document.getElementById("fscroller");
    tmp.innerHTML=vitDivConstant+tmp.innerHTML;

     if (fadelinks)
      linkcolorchange(1);
    //colorfade(1, 15);
    setTimeout("colorfade(1, 15)", window.timeToShow);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+window.fcontent[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

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);
  }
}

/*Rafael Raposo edited function*/
var fadecounter;


/*Rafael Raposo's new function*/
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="border:0 px solid black;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
*/
var fcontent = new Array();
$(document).ready(function(){
    
     $('#news-line-container').children('span').each(function(){
        fcontent[fcontent.length] = $(this).html();
    })
    changecontent(window.fcontent);
});

