// JavaScript Document
var delay = 45000; //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: 5px; padding-top: 60px; " align="justify">'; //set opening tag, such as font declarations
fcontent[0]="Set before us in the first quarter was the Chairman's Challenge, which called on all Avon markets worldwide to rise above the economic crisis and deliver the numbers to maintain Avon's  leadership position. My heartfelt appreciation goes to all associates for your efforts in driving the business forward with passion and team spirit guided by our Avon values. All these contributed to Avon Philippines achieving its Sales plan. Congratulations to all of you!";
fcontent[1]="What an exciting year-opener the first quarter has been. Our advocacy on Domestic Violence was launched, making Avon’s commitment to issues affecting women more pronounced. Various institutions and agencies had been fully supportive of our mission to create awareness and raise funds. With the proceeds from the sales of the Global Empowerment Necklace and the Avon Lotion in March, Avon would be able to support selected domestic violence crusade advocate NGOs in their programs and the ensure the activation of a hotline program to help victims of domestic violence.";
fcontent[2]="Avon’s commitment to provide representatives and customers with the most modern shopping convenience sees reality with the opening of the new Cebu branch, the first branch to showcase the New Avon Look and the activation of the pilot Internet Ordering Facility in our EDSA branch.";
fcontent[3]="We move into the second quarter fuelled by successes and lessons learned  in the first quarter. Against the present global economic climate, each Avon Associate can derive strength knowing that we have survived and thrived for 123 years because of our deep commitment to women. And during these challenging times, the earning opportunity that we continuously provide them has never been more relevant. I would encourage you to always keep this in mind as we attend to each task or undertake every project --- that more than ever, we are in the best position and this is our moment  to make a difference and change women's lives for the better.";
fcontent[4]="As we go out into the world, armed with the enthusiasm to make a positive change, let us focus on the role we have to play on three important things: strengthening PATD and drive active representatives and order count; provide our representatives with great service, products and processes to make earning money easier for them. Remember these initiatives will only deliver the results if our team is   commitment to work together and drive the business forward.";
fcontent[5]="Yes We Can make a difference in women’s lives and Yes We Will keep Avon Philippines the number 1 direct selling company in the country! ";
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
