/***********************************************
* 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 = 8000; //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(255,255,255); // start color (red, green, blue)
var endcolor=new Array(102,0,153); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="padding:0px;"><h3 style="text-align:center;font-size:120%;margin:0px 0px 10px 0px;color:rgb(102,0,153);">Student Testimonials:</h3>'; //set opening tag, such as font declarations
fcontent[0]="<p style=\"margin-top:0px;\"><em>&quot;I think the HFCH is a great [resource] because it allows people to become more involved in the community - " +
            "to see and hear people speak about important subjects, rather than just sitting in a classroom.&quot;</em></p>" +
            "<div style=\"margin-top:5px;text-align:right;font-weight:bold;\">- Melissa B.</div>";
fcontent[1]="<p style=\"margin-top:0px;\"><em>&quot;I think the Hagan Foundation Center for the Humanities is a very good thing. Today, teens and even " +
            "adults watch so much TV. It's nice to have a place where you can go and listen to poets and authors speak. " +
            "Listening to poets speak and talk about their poems and how they got to where they are today made me " +
            "appreciate poetry a lot more.&quot;</em></p>" +
            "<div style=\"margin-top:5px;text-align:right;font-weight:bold;\">- Torie S.</div>";
fcontent[2]="<p style=\"margin-top:0px;\"><em>&quot;The Hagan Foundation Center for the Humanities gave me a chance to listen to different guest " +
            "speakers on the SCC campus. I enjoyed not having to go off campus!&quot;</em></p>" +
            "<div style=\"margin-top:5px;text-align:right;font-weight:bold;\">- Devaney D.</div>";
fcontent[3]="<p style=\"margin-top:0px;\"><em>&quot;Last week was the first time I attended the HFCH. All the presentations were very enjoyable, and " +
            "I look forward to hearing more speakers there.&quot;</em></p>" +
            "<div style=\"margin-top:5px;text-align:right;font-weight:bold;\">- Nick C.</div>";
fcontent[4]="<p style=\"margin-top:0px;\"><em>&quot;I think the Hagan Foundation Center for the Humanities has a great purpose at SCC. There are " +
            "educational events always going on and the center is resourceful for everyone. With going there and learning " +
            "comes great relief, and I feel that it is a sanctuary for English students.&quot;</em></p>" +
            "<div style=\"margin-top:5px;text-align:right;font-weight:bold;\">- Krista C.</div>";
fcontent[5]="<p style=\"margin-top:0px;\"><em>&quot;I think the HFCH is a great place. We need to keep it going. Lots of cool events need a great [venue] " +
            "and the center is perfect.&quot;</em></p>" +
            "<div style=\"margin-top:5px;text-align:right;font-weight:bold;\">- Eric M.</div>";
fcontent[6]="<p style=\"margin-top:0px;\"><em>&quot;I think the HFCH is a great place to learn because you get to meet the people and ask questions, " +
            "whether it be about a book or our economy.&quot;</em></p>" +
            "<div style=\"margin-top:5px;text-align:right;font-weight:bold;\">- Zak R.</div>";
closetag='</div>';

var fwidth='290px'; //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="border:none;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
