// JavaScript Document
var delay = 40000; //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
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(0,0,0); // start color (red, green, blue)
var endcolor=new Array(255,255,255); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: normal 16px Arial; padding: 3px; padding-top: 60px; " align="justify">'; //set opening tag, such as font declarations
fcontent[0]="It has truly been a very eventful first half. The successes we have reaped in the past six months once more prove the power that we have when we all work together. As your leader, I could not have asked for a better, stronger team. I am in awe of your passion and commitment in delivering great results and in going beyond what is required.  It is indeed a great privilege to lead and to be working with all of you.";
fcontent[1]="Our corporate identity as the company for women is further strengthened as we champion the crusade against domestic violence. And just recently, we walked the talk by turning over the funds we've raised through the Speak Out campaign in March to the Women’s Crisis Center. The funds we gave will enable WCC to extend their hotline service, providing access to victims and allowing them to speak out and seek help. All of you helped make this happen. I encourage you to continue supporting the campaign.";
fcontent[2]="We became green advocates with the launch of Hello Green Tomorrow in our market. With our Chairman and CEO, Andrea Jung, leading the project, our commitment for a beautiful tomorrow transcends not only in providing unmatched earnings opportunity but includes our pledge for a cleaner and greener environment. This objective continues and I am confident we will see this through for the rest of 2009 and for years to come.";
fcontent[3]="The first half of the year also paved way for Avon's recognition to its representatives. During the recently concluded SL Congress, we have made history by treating them to more firsts and included the PC Banquet in this major event. To deliver, it required active preparation and tireless hours for a limited time. But that's what separates our company from other direct selling outfits, our fearless approach to overcome any posed challenge and foresight to give the best results. To the team that made this happen, gratitude comes from each and every representative we have touched during the event. The memories they continue to relive is our best reward.";
fcontent[4]="The bleak background of the economy continues to be a battle we face in our industry. But despite the crisis, we continue to maintain a healthy sales growth and provide the best earnings opportunity for our representatives. And this is what I ask each of you to focus on. The Avon Representative. It is she for whom we are working so hard for. Because the more committed we are with what we do in Avon, the more we help make her dreams come true.";
fcontent[5]="Remember that we deliver our best when we have each other. And trust that all the changes and decisions made are for a stronger Avon and for our Avon Representatives. ";
closetag='</div>';

var fwidth='419px'; //set scroller width
var fheight='392px'; //set scroller height

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

///No need to edit below this line/////////////////


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


/*Rafael Raposo edited function*/
//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++
}

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

/*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:0px solid white;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
