/***********************************************
* 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 = 10000; //set delay between message change (in miliseconds)
var maxsteps=50; // 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(0,0,0); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: normal 11px verdana; padding:7px 0px;">'; //set opening tag, such as font declarations
fcontent[0]='"Cindy, I have truly enjoyed working with you over the past 18 years.  I can honestly say there is no other person in your field I enjoy working with more.  Your honesty, integrity and hard work have always been something I could count on.  I wish you continued success in all that you do."<br />- <strong><em>President, Software Company</em></strong>';
fcontent[1]='"I just wanted to drop you a line expressing my sincere thanks for the excellent job Management Recruiters of Cedar Rapids has done placing a Quality Assurance Manager with our company. He has been an excellent addition to our management staff. I especially appreciate your follow-up to determine how he is working out. You have made the recruiting experience very positive with your professionalism. I look forward to working with you again in the future. Thank you very much."<br />- <em><strong>Bio Pharmaceutical Company</strong></em>';
fcontent[2]='"Our two new employees are working out really well. They both are enthusiastic, have good attitudes and personalities. They dig right in and seem to learn very quickly. They fit right in. I think that you did a great job of matching up the position with the right person; they both seem to be right for their positions."<br />- <em><strong>Chemical Company</strong></em>';
fcontent[3]='"Just a quick thank you for your help. Your advice and suggestions were right on.  Of all the people I met with through this process I found you to be the most professional and on top of your game."<br />- <em><strong>Dave B.</strong></em>';
fcontent[4]='"Your steady progress is a direct result of your work ethic, customer service/concern, and positive results in fulfilling our needs as clients. These same attributes are also demonstrated by your staff in their daily contact with us, which is a direct reflection on what you expect and why we all feel very confident when dealing with your organization both directly and indirectly, that is why when we have a need we always turn to you first for assistance."<br />- <em><strong>Manager Human Resources Utility Company</strong></em>';
closetag='</div>';
fcontent[5]='"I want to thank you and the staff of Management Recruiters of Cedar Rapids for finding an exceptional employee for the Cedar Rapids Museum of Art.  For six months we had advertised and bet the bushes nationally and locally for a senior development officer to add to our fund raising staff and had not found anyone that fit the bill.  I was delighted when several of the museum\'s trustees suggested Management Recruiters of Cedar Rapids and I began to have renewed optimism when Cindy Lyness and Sarah Fare so clearly understood the type of person we were looking for.  Nevertheless, I was both amazed and grateful when you successfully located the perfect candidate for our needs and then helped us in the hiring process.  I could not be more pleased with the process and the outcome."<br />- <em><strong>Executive Director<br />Non-Profit Organization</strong></em>';

var fwidth='400px'; //set scroller width

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;


function getIndex() {
	var range = fcontent.length;
	var ph = Math.floor(Math.random() * range);
	return ph;
}

/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
	
  index=getIndex();

  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);
  }
  else if (ie4) {
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  }

  /*
  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);
  }
  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("colorfadeout(maxsteps)", delay);
	
  }   
}

var fadecounter2;
function colorfadeout(step) {
  if(step>=0) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step--;
    fadecounter2=setTimeout("colorfadeout("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter2);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
	changecontent();
    //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] + ")");
}

function fadeText() {
	if (ie4||DOM2)
	  document.write('<div id="fscroller"></div>');

	if (window.addEventListener)
	window.addEventListener("load", changecontent, false)
	else if (window.attachEvent)
	window.attachEvent("onload", changecontent)
	else if (document.getElementById)
	window.onload=changecontent
}