/***********************************************
* 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 = 5000; //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 10px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="Margaret 22nd November - Thank you for the excellent service! The pashmina arrived today as predicted, and looks perfect: a present , so I havent opened the cellophane wrapping. Having trudged around Birmingham for an item such as this to no...";
fcontent[1]="Brilliant! What a speedy service. I look forward to receiving them and hope to do more shopping with you. - Pen - 2nd October 2007";
fcontent[2]="Cashmere jumper arrived the following day – amazingly speedy service! Most importantly, the jumper is absolutely beautiful ... I think the other three may be getting cashmere now too! - Many thanks for excellent service and quality - Deborah Toft.";
fcontent[3]="I did not know exactly what to expect from my first order of a sweater. Delivery was swift, and the product - well, just yummy. As nice a cashmere sweater as those I saw at Nieman Marcus! You can count on me as a repeat customer. Janette - Milwaukee";
fcontent[4]="Hello Paul, Just to let you know that the sweater arrived this morning - it is really beautiful, lovely colour! Many thanks, best wishes, Carolyn";
fcontent[5]="Thank you so much for the oil blue fitted v-neck sweater which arrived today. It is beautiful and was delivered the day after I ordered it which is terrific service. Really great value too, about half the price of nearly every other supplier...";
fcontent[6]="...I could find but I am delighted with the quality. The website also gave me the feeling that the people behind it care about their customers. I will be back - and am recommending you to all my friends. Best wishes, Liz Bellchambers";
fcontent[7]="HI PAUL!!, THE SWEATER AND PASHMINA ARRIVED TODAY! THEY BOTH MATCH PERFECTLY, I AM JUST THRILLED WITH THEM! I CAN NOT THANK YOU ENOUGH FOR YOUR TIME & ATTENTION. THANKS AGAIN TABITHA";
fcontent[8]="Hi Paul, The sweater arrived today and is divine, the entire process from start to finish is so easy and efficient, thanks I'll be back, not to mention all the people I'll refer to your site.Regards Michelle (New Zealand)";
fcontent[9]="Dear Paul and Caroline, Just to let you know that the water pashmina arrived yesterday and it is amazing! I didn’t really know what to expect but it is more beautiful than I had imagined. Its exquisite, and I am DEFINITELY having one of those for myself!";
fcontent[10]="My sweater has arrived yesterday, in only 3 days. It is simply perfect, the colour is stunning, the fabric wonderful. I had looked for something like this in Regent's Street without success, now I'm really happy with it....Thanks ;-)ciao from Italy";
fcontent[11]="Hello Paul or Sarah, just to say this have arrived and I am DELIGHTED with it yet again. This makes my 4th cashmere stole from you!! - and one cashmere hoodie which is also much loved!";
fcontent[12]="I am absolutely delighted with the quality & colour of the garment I received & can't wait to wear it soon. What VFM! Thank you! I will recommend to all my pals.";
fcontent[13]="My pashmina arrived today and I just wanted to congratulate you such a speedy and efficient service. The pashmina is beautiful – great quality and colour is perfect and exactly as I imagined from your website. I would recommend you highly ...";
fcontent[14]="I would like to say how delighted I am with my beautiful pashmina which arrived today, great service and great price.";
fcontent[15]="Just thought you might like to know that my pashmina arrived, as promised, and I'm absolutely thrilled with it. It's very unusual to find such a beautiful item accompanied by friendly, personal and efficient service. Many thanks.";
fcontent[16]="I received the tie front cardigan yesterday. What a brilliant service - order to delivery in under 24 hours. The cardigan is pretty special too.";

closetag='</div>';

var randomizecontents="yes" //randomize dislay order of images? "yes" or "no"
function shuffleit(){
return Math.floor((Math.random()*fcontent.length-1))
}

if (randomizecontents=="yes")
fcontent.sort(shuffleit)

var fwidth='150px'; //set scroller width
var fheight='130px'; //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 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
