
/***********************************************
* Fading Scroller- © 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 = 9000; //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(244,235,56); // start color (red, green, blue)
var endcolor=new Array(43,106,157); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="padding:0px; line-height:20px;">'; //set opening tag, such as font declarations
fcontent[0]=" <p><em>&quot;Just a quick note to say that the mouse mats look great!<br /> Thanks again. &quot;</em> <br /><br />- Patrick</p>";
fcontent[1]="<p><em>&quot;Hi Bill - Just to let you know the bags arrived this afternoon and they are great - thank you for the quick turn around&quot;</em></p><p>Regards - Nicky warren</p>";
fcontent[2]="<p><em>&quot;Thank you for all your friendly help and timely assistance whenever we ordered or requested quotes, it has been a pleasure to work with you.<br /> All the best and take care.&quot;</em></p>";
fcontent[3]="<p><em>&quot;Brilliant! Your efficiency has saved many an academic from getting a slap on the wrists!&quot;</em></p>";
fcontent[4]="<p><em>&quot;Bill,<br />Just to say I was really impressed by the work your company did with the vests. We need to create an RBC football strip. Would you be able to help out with some initial costings if I were to send the requirements through?<br /><br />A star twice over - thank you.&quot;</em></p>";
fcontent[5]="<p><em>&quot;Just went down and picked them up... had a quick look at one and they look great to me.<br />Many thanks for sharp service again.&quot;</em></p>";
fcontent[6]="<p><em>&quot;GREAT THANKS BILL TRACKED THEM DOWN!!!! <br />Look Fab!&quot;</em></p>";
fcontent[7]="<p><em>&quot;Just wanted to confirm that the pedometers arrived yesterday and the wrist bands today - LOVE them! Thanks very much.&quot;</em></p>";
fcontent[8]="<p><em>&quot;Thanks so much- you are a superstar!&quot;</em></p>";
fcontent[9]="<p><em>&quot;Thanks for letting me know, and the great feedback.&quot;</em></p>";
fcontent[10]="<p><em>&quot;Bill - thanks for all your hard work as always.&quot;</em></p>";
fcontent[11]="<p><em>&quot;I just want to say thank you so much for the wonderful job you did with the ITAOU balloons and t-shirts.&quot;</em></p>";
fcontent[12]="<p>You were bang on with delivery times. Very impressed considering the short turn around we gave you and the odd delay in our communication back. We will definitely be using you again Bill. Credit also to Glenn as he highly recommended you- and we can now see why!!&quot;</em></p><p>Many thanks - Martin</p>";
closetag='</div>';

var fwidth='211px'; //set scroller width
var fheight='200px'; //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="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


