/***********************************************
* 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
***********************************************/

/***********************************************
* J A S O N ' S    N O T E
* SAME CODE AS CLE SCROLLER, EXCEPT
* EVERY VARIABLE AND FUNCTION HAS THE LETTER 'g' IN FRONT OF IT SO THAT THE
* SCRIPTS WOULD NOT CONFLICT
***********************************************/

var gdelay = 3000; //set delay between message change (in miliseconds)
var gmaxsteps=30; // number of steps to take to change from start color to endcolor
var gstepdelay=100; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var gstartcolor= new Array(194,194,194); // start color (red, green, blue)
var gendcolor=new Array(0,0,0); // end color (red, green, blue)

/* LIMIT EACH ITEM TO ABOUT 40 WORDS. EACH NEW DIV CONSTITUTES 6 WORDS. */
var gcontent=new Array();
gbegintag=''; //set opening tag, such as font declarations
gcontent[0]='<div class="newsheadline"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_147.jsp#approved">New York</a>: 1/30/09</div><div class="newsheadline"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_131.jsp#approved">Indiana</a>: 12/5/08</div><div class="newsheadline"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_145.jsp#approved">New Jersey</a>: 12/15/08</div><div class="newsheadline"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_190.jsp#approved">Oklahoma</a>: 1/1/09</div><div class="newsheadline"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_151.jsp#approved">Oregon</a>: 1/1/09</div>';
gcontent[1]='<span class="newsheadline">New York: 1/30/09</span><div class="newsstory">Beginning with the year starting 1/1/2009, all annual periods will switch from a September to August CPE year to a January to December CPE period. All CPE earned from between 9/1/2008 and 12/31/2008 will be applied to the 2009 CPE year</div><div class="newslink"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_147.jsp#approved">More details</a></div>';
gcontent[2]='<span class="newsheadline">Indiana: 12/5/08</span><div class="newsstory">For the period beginning on 1/1/2009 and thereafter, a minimum of four (4) hours in the reporting period shall be in ethics for accountants.  Also, half credits will be allowed after the first full hour of education is completed.</div><div class="newslink"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_131.jsp#approved">More details</a></div>';
gcontent[3]='<span class="newsheadline">New Jersey: 12/15/08</span><div class="newsstory">Half credits will be accepted after the first hour of education is completed, at least 60 hours of education must be completed in didactic, in-person instruction...</div><div class="newslink"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_145.jsp#approved">More details</a></div>';
gcontent[4]='<span class="newsheadline">Oklahoma: 1/1/09</span><div class="newsstory">The Ethics requirement for the period ending 12/31/2009 and all periods thereafter will be measured on a 4 credit hour per rolling triennial basis.</div><div class="newslink"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_190.jsp#approved">More details</a></div>';
gcontent[5]='<span class="newsheadline">Oregon: 1/1/09</span><div class="newsstory">The 4 hour Ethics requirement must now be earned in every biennial.  All new licensees must earn Ethics in the biennial in which they were licensed.</div><div class="newslink"><a href="http://www.reqwired.org/reqwired/resources/accountancy/summary_151.jsp#approved">More details</a></div>';
gclosetag='';

var gwidth='220px'; //set scroller width
var gheight='175px'; //set scroller height

var gfadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var gie4=document.all&&!document.getElementById;
var gDOM2=document.getElementById;
var gfaderdelay=0;
var gindex=0;


/*Rafael Raposo edited function*/
//function to change content
function gchangecontent(){
  if (gindex>=gcontent.length)
    gindex=0
  if (gDOM2){
    document.getElementById("gscroller").style.color="rgb("+gstartcolor[0]+", "+gstartcolor[1]+", "+gstartcolor[2]+")"
    document.getElementById("gscroller").innerHTML=gbegintag+gcontent[gindex]+gclosetag
    if (gfadelinks)
      glinkcolorchange(1);
    gcolorfade(1, 15);
  }
  else if (gie4)
    document.all.gscroller.innerHTML=gbegintag+gcontent[gindex]+gclosetag;
  gindex++
}

// gcolorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function glinkcolorchange(step){
  var gobj=document.getElementById("gscroller").getElementsByTagName("A");
  if (gobj.length>0){
    for (i=0;i<gobj.length;i++)
      gobj[i].style.color=ggetstepcolor (step);
  }
}

/*Rafael Raposo edited function*/
var gfadecounter;
function gcolorfade(step) {
  if(step<=gmaxsteps) {	
    document.getElementById("gscroller").style.color=ggetstepcolor (step);
    if (gfadelinks)
      glinkcolorchange(step);
    step++;
    gfadecounter=setTimeout("gcolorfade("+step+")",gstepdelay);
  }else{
    clearTimeout(gfadecounter);
    document.getElementById("gscroller").style.color="rgb("+gendcolor[0]+", "+gendcolor[1]+", "+gendcolor[2]+")";
    setTimeout("gchangecontent()", gdelay);
	
  }   
}

/*Rafael Raposo's new function*/
function ggetstepcolor (step) {
  var gdiff
  var gnewcolor=new Array(3);
  for(var i=0;i<3;i++) {
    gdiff = (gstartcolor[i]-gendcolor[i]);
    if(gdiff > 0) {
      gnewcolor[i] = gstartcolor[i]-(Math.round((gdiff/gmaxsteps))*step);
    } else {
      gnewcolor[i] = gstartcolor[i]+(Math.round((Math.abs(gdiff)/gmaxsteps))*step);
    }
  }
  return ("rgb(" + gnewcolor[0] + ", " + gnewcolor[1] + ", " + gnewcolor[2] + ")");
}

if (gie4||gDOM2)
  document.write('<div id="gscroller" style="width:'+gwidth+';height:'+gheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", gchangecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", gchangecontent)
else if (document.getElementById)
window.onload=gchangecontent