
/***********************************************
* 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
***********************************************/

begintag_S='<div class="specialPricesContents">'; //set opening tag, such as font declarations
closetag_S='</div>';


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_S=0;
var index_S=0;
/*var fwidth_S='100%'*/
/*var fheight_S='60px'*/


/*Rafael Raposo edited function*/
//function to change content
function changecontent_S(){
  if (index_S>=fcontent_S.length)
    index_S=0
  if (DOM2){
    document.getElementById("fscroller_S").style.color="rgb("+startcolor_S[0]+", "+startcolor_S[1]+", "+startcolor_S[2]+")"
    document.getElementById("fscroller_S").innerHTML=begintag_S+fcontent_S[index_S]+closetag_S
    if (fadelinks)
      linkcolorchange_S(1);
    colorfade_S(1, 15);
  }
  else if (ie4)
    document.all.fscroller_S.innerHTML=begintag_S+fcontent_S[index_S]+closetag_S;
  index_S++
}

// colorfade_S() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange_S(step){
  var obj=document.getElementById("fscroller_S").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_S;
function colorfade_S(step) {
  if(step<=maxsteps_S) {	
    document.getElementById("fscroller_S").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange_S(step);
    step++;
    fadecounter_S=setTimeout("colorfade_S("+step+")",stepdelay_S);
  }else{
    clearTimeout(fadecounter_S);
    document.getElementById("fscroller_S").style.color="rgb("+endcolor_S[0]+", "+endcolor_S[1]+", "+endcolor_S[2]+")";
    setTimeout("changecontent_S()", delay_S);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor_S[i]-endcolor_S[i]);
    if(diff > 0) {
      newcolor[i] = startcolor_S[i]-(Math.round((diff/maxsteps_S))*step);
    } else {
      newcolor[i] = startcolor_S[i]+(Math.round((Math.abs(diff)/maxsteps_S))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
  document.write('<div id="fscroller_S" style="border:0px solid black;width:'+fwidth_S+';height:'+fheight_S+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent_S, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent_S)
else if (document.getElementById)
window.onload=changecontent_S
