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

var fcontent=new Array();
begintag='<div id="fscroller" style="font: bold 16px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="Areva NP, Inc. (Nuclear Power)";
fcontent[1]="ABB Power Generation";
fcontent[2]="ABB Combustion Engineering";
fcontent[3]="Acentech, Inc. ";
fcontent[4]="Acciona Wind Energy USA";
fcontent[5]="American Electric Power (AEP)";
fcontent[6]="Babcock & Brown Wind";
fcontent[7]="Bermuda Electric Light Co. <br />Hamilton, Bermuda";
fcontent[8]="Braden Manufacturing ";
fcontent[9]="Bechtel Power Corporation ";
fcontent[10]="Black and Veatch Engineers ";
fcontent[11]="BP Alternative Energy ";
fcontent[12]="Calpine Corporation";
fcontent[13]="Cerrey, S.A. de C.V. <br />Nuevo Leon, Mexico";
fcontent[14]="CRS Sirrine Engineers";
fcontent[15]="Community Energy <br />Alternatives (CEA)";
fcontent[16]="Conectiv Energy";
fcontent[17]="Contact Energy Wellington, <br />New Zealand ";
fcontent[18]="Constellation Power";
fcontent[19]="Cooper Industries ";
fcontent[20]="Destec Energy Services";
fcontent[21]="Deltak ";
fcontent[22]="Duke/Fluor Daniel";
fcontent[23]="Dynegy Engineering ";
fcontent[24]="Energy Services, Inc. ";
fcontent[25]="Energy National, Inc. <br />Pacific Generation ";
fcontent[26]="Everpower Renewables ";
fcontent[27]="Farr Company ";
fcontent[28]="First Wind ";
fcontent[29]="Gas Turbine Corp. ";
fcontent[30]="Gamesa Energy ";
fcontent[31]="General Electric Power Systems ";
fcontent[32]="GE Environmental Services, Inc.";
fcontent[33]="Horizon Wind Energy";
fcontent[34]="Iberdrola Renewables";
fcontent[35]="InterGen London, UK";
fcontent[36]="Ingenco Power Systems";
fcontent[37]="International Business <br />machines (IBM)";
fcontent[38]="Jamison Sound Proof Door Company";
fcontent[39]="LS Power Development";
fcontent[40]="Mission Energy";
fcontent[41]="Nooter/Eriksen Systems";
fcontent[42]="Noble Environmental Power";
fcontent[43]="Oglethorpe Power Corporation";
fcontent[44]="OPPD, Omaha Public Power District";
fcontent[45]="Pepco Energy Services";
fcontent[46]="PG&E Generating Co.";
fcontent[47]="Pratt and Whitney of Canada, <br />Ltd Lonqueuil, Quebec, Canada";
fcontent[48]="Pratt and Whitney Power Systems";
fcontent[49]="Thermo Electron Corp.";
fcontent[50]="Rolls Royce Energy Services, Inc.";
fcontent[51]="Ruston Gas Turbines Lincoln, England";
fcontent[52]="Siemens Westinghouse Power";
fcontent[53]="Sound Construction and Engineering";
fcontent[54]="Snowy Hydro Victoria, Australia";
fcontent[55]="ABB Combustion Engineering";
fcontent[56]="SRP Salt River Project";
fcontent[57]="Salt River Project";
fcontent[58]="U.S. Turbine, Inc";
fcontent[59]="Unistar Nuclear Power";
fcontent[60]="University of California at <br />San Francisco (UCSF)";
fcontent[61]="Siemens Westinghouse Power";
fcontent[62]="Worthington Pump Company";
fcontent[63]="USA We Energies";
fcontent[64]="Zachry Engineering";

closetag='</div>';

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

