

/***********************************************
* 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, gree n, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: normal 14px Arial; padding: 5px;">'; //set opening tag, such as font declarations
//fcontent[0]="<img src='images/banner_tiger2010.gif' width='667' height='80'>";
fcontent[0]="<font size=+1><a href='products_powermeterseries900.html'>ARTiPRO</a> Meter is now available at major Home-Fix DIY Stores</font><br><font color=#353c32>Check our <a href='products_powermeterseries900.html'>Distributor List</a> for the latest update!</font>";
fcontent[1]="<font size=+1><a href='products_powermeterseries900.html'>Download the</a><br><font size=+2><a href='products_powermeterseries900.html'>ARTiPRO 5 Steps for Home and Office here!</a></font>";
fcontent[2]="<font size=+1><a href='products_powermeterseries900.html'>ARTiPRO</a> Distributors Wanted</font><br><font color=#353c32>We are looking for distributor for our <a href='products_powermeterseries900.html'><i>ARTiPRO</i></a> products.<br>Please contact us at <a href='mailto:distributor@rtihub.com'><strong>distributor@rtihub.com</strong></a> to find out more.</font>";
fcontent[3]="<a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'><font size=+1>Energy Saving Tips</font></a>&nbsp;&nbsp;<font size=-2><font color=#70b0f1><a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'>Energy Efficient Singapore - Energy Saving Tips</a></font></font><br><font color=#353c32>The air-conditioner uses the bulk of the electricity in a home. A fan uses less than 10% the electricity used by an air-conditioner! <strong>Use a fan instead of an air-conditioner to keep cool.</strong> Save about $40 a month or about $500 a year*.</font>";
fcontent[4]="<a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'><font size=+1>Energy Saving Tips</font></a>&nbsp;&nbsp;<font size=-2><font color=#70b0f1><a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'>Energy Efficient Singapore - Energy Saving Tips</a></font></font><br><font color=#353c32>The lower the temperature setting, the more energy used by your air-conditioner. <strong>If you use an air-conditioner, set the temperature at 25 C or higher.</strong> For every degree raised, save about $15 a year*.</font>";
fcontent[5]="<a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'><font size=+1>Energy Saving Tips</font></a>&nbsp;&nbsp;<font size=-2><font color=#70b0f1><a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'>Energy Efficient Singapore - Energy Saving Tips</a></font></font><br><font color=#353c32><strong>Switch off home appliances at the power socket.</strong> Standby power can account for up to 10% of your home electricity use. Do not leave them on standby. Save about $40 a year*.</font>";
fcontent[6]="<a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'><font size=+1>Energy Saving Tips</font></a>&nbsp;&nbsp;<font size=-2><font color=#70b0f1><a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'>Energy Efficient Singapore - Energy Saving Tips</a></font></font><br><font color=#353c32><strong>Choose energy efficient light bulbs (e.g. compact fluorescent lamps).</strong> Using a compact fluorescent lamp (7W) instead of an incandescent bulb (40W) can save about about $15 per bulb per year*.</font>";
fcontent[7]="<a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'><font size=+1>Energy Saving Tips</font></a>&nbsp;&nbsp;<font size=-2><font color=#70b0f1><a href='http://www.e2singapore.gov.sg/energy-saving-tips.html' target='_blank'>Energy Efficient Singapore - Energy Saving Tips</a></font></font><br><font color=#353c32><strong>Choose an energy-efficient appliance (e.g. air-conditioner. refrigerator) by checking the energy labels.</strong> A 4-tick air-conditioner saves you about $270 in electricity bills a year compared to a 1-tick model, and a 4-tick refrigerator saves you about $80 a year over a 1-tick model*.</font>";
closetag='</div>';

var fwidth='635px'; //set scroller width
var fheight='90px'; //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:0px 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
