

/***********************************************
* 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 delay1 = 100; //set delay1 between message change (in miliseconds)
var maxsteps1=30;
var maxsteps2=30;// number of steps to take to change from start color to ecolor
var stepdelay1=40;
var stepdelay2=40;// time in miliseconds of a single step
//**Note: maxsteps1*stepdelay1 will be total time in miliseconds of fading effect
var scolor= new Array(255,255,255); // start color (red, green, blue)
var ecolor=new Array(16,20,127); // end color (red, green, blue)
var rTime = 9000;
var smbContent=new Array();
btag='<div>'; //set opening tag, such as font declarations
smbContent[0]="There are 20 million Small and Medium Businesses in the USA, employing 54% of the 138 million workforce";
smbContent[1]="Small and Medium Businesses deliver 52% of the $13,807.5 billion US GDP in 2007.";
smbContent[2]="50% of small businesses fail in the first year, 95% in the first five years according to the US Small Business Administration";
smbContent[3]="Small and Medium Businesses with less than 20 employees have a 37% chance of surviving four years, 9% of surviving 10 years according to Dunn &amp; Bradstreet";
smbContent[4]="10%  of Small and Medium Businesses close in bankruptcy, 90% because business was not successful, revenues not achieved, or too weak to continue according to Dunn &amp; Bradstreet ";
smbContent[5]="Small and Medium Businesses are most often led by entrepreneurs, not managers.";
smbContent[6]="Small and Medium Businesses don\'t often have ready access to advanced management skills and practices";
smbContent[7]="Small and Medium Businesses don\'t often know what they don't know.";
smbContent[8]="27 percent of new product launches fail to meet the original Small and Medium Business expectations, AMR Research";
smbContent[9]="One-third of small manufacturers and nearly one quarter of midsize manufacturers lack a formal process for bringing new products to market, AMR Research";
smbContent[10]="Louisville, Co is #26 in Fortune\'s Small Business 100 Best Places Live and Launch a Business - April, 2008";
smbContent[11]="Fort Collins, Co is #39 in Fortune\'s Small Business 100 Best Places Live and Launch a Business - April, 2008";
smbContent[12]="Denver, Co is #7 in Fortune\'s Small Business 100 Best Places Live and Launch a Business &ndash; April, 2008";
smbContent[13]="<a href=\"http://money.cnn.com/magazines/fsb/fsb100/2008/snapshots/6.html\">Dynamic Materials</a>, Boulder, CO is #6 of Fortune\'s Small Business 100 Fastest Growing Companies";
smbContent[14]="<a href=\"http://money.cnn.com/magazines/fsb/fsb100/2008/snapshots/62.html\">Mesa Laboratories</a>, Lakewood, CO is #62 of Fortune\'s Small Business 100 Fastest Growing Companies";
smbContent[15]="90% of US businesses are family owned &ndash; US Small Business Administration, 2001";
smbContent[16]="30% of family run businesses succeed to the second generation, 15% to the third generation &ndash; US Small Business Administration, 2001";
smbContent[17]="Colorado\'s Royal Gold, Mesa Labs, and Ramtron are among FSB’s 100 Fastest Growing Small Public Companies";
smbContent[18]="2500 New Businesses Started in Northern Colorado Business in Q109";
smbContent[19]="Sales, Taxes, Government Regulation, and Red Tape Dominate SMB Owner Concerns &ndash; NFIB, 2/09";
ctag='</div>';

var fwidth1='150px'; //set scroller width
var fheight1='150px'; //set scroller height

var fadelinks1=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4a=document.all&&!document.getElementById;
var DOM2a=document.getElementById;
var faderdelay1=0;


//randomization
var now = new Date();
var secs = now.getSeconds();
var raw_random_number = Math.random(secs);
var random_number = Math.round(raw_random_number * (smbContent.length));

if (random_number == smbContent.length){random_number = 0}
var index1=random_number;
function rand ( n )
{
  return ( Math.floor ( Math.random ( ) * n + 1 ) );
}


/*Rafael Raposo edited function*/
//function to change content
function changeSmb(){
  if (index1>=smbContent.length)
    index1= rand (random_number);
  if (DOM2a){
    document.getElementById("smbScroll").style.color="rgb("+scolor[0]+", "+scolor[1]+", "+scolor[2]+")"
    document.getElementById("smbScroll").innerHTML=btag+smbContent[index1]+ctag
    if (fadelinks1)
	changelink(1);
    setTimeout("fadecolor(1, 15)", rTime);
  }
  else if (ie4a)
    document.all.smbScroll.innerHTML=btag+smbContent[index1]+ctag;
  index1= rand (random_number);
}

// fadecolor() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function changelink(step){
  var object=document.getElementById("smbScroll").getElementsByTagName("A");
  if (object.length>0){
    for (i=0;i<object.length;i++)
      object[i].style.color=stepcolor(step);
  }
}
function revchangelink(step){
  var object1=document.getElementById("smbScroll").getElementsByTagName("A");
  if (object1.length>0){
    for (i=0;i<object1.length;i++)
      object1[i].style.color=stepcolorA(step);
  }
}
/*Rafael Raposo edited function*/
var fcounter;
function fadecolor(step) {
  if(step<maxsteps1) {	
    document.getElementById("smbScroll").style.color=stepcolor(step);
    if (fadelinks1)
      changelink(step);
    step++;
    fcounter=setTimeout("fadecolor("+step+")",stepdelay1);
  }else{
	changeSmb();
    fadecolorA(1, 15);
  }   
}

var fcounter2;
function fadecolorA(step) {
  if(step<=maxsteps2) {	
    document.getElementById("smbScroll").style.color=stepcolorA(step);
	if (fadelinks1)
	revchangelink(step);
    step++;
    fcounter2=setTimeout("fadecolorA("+step+")",stepdelay2);
  }else{
    clearTimeout(fcounter2);
    document.getElementById("smbScroll").style.color="rgb("+scolor[0]+", "+scolor[1]+", "+scolor[2]+")";
	
  }   
}

/*Rafael Raposo's new function*/
function stepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (scolor[i]-ecolor[i]);
    if(diff > 0) {
      newcolor[i] = scolor[i]-(Math.round((diff/maxsteps1))*step);
    } else {
      newcolor[i] = scolor[i]+(Math.round((Math.abs(diff)/maxsteps1))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

function stepcolorA(step) {
  var diffA
  var newcolorA=new Array(3);
  for(var i=0;i<3;i++) {
    diffA = (scolor[i]-ecolor[i]);
    if(diffA > 0) {
      newcolorA[i] = ecolor[i]+(Math.round((diffA/maxsteps1))*step);
    } else {
      newcolorA[i] = ecolor[i]-(Math.round((Math.abs(diff)/maxsteps1))*step);
    }
  }
  return ("rgb(" + newcolorA[0] + ", " + newcolorA[1] + ", " + newcolorA[2] + ")");
}



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


