/*
Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com).
For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com.
Credit MUST stay intact
*/
var mtext = new Array ()
mtext [0] = "<b>Foam cups...still white, but greener than you thought.</b>";
mtext [1] = "Foam cups are a great product with a lot of science behind them.";
mtext [2] = "Please don't litter.&nbsp;&nbsp;&nbsp;Dispose of this cup thoughtfully.";
mtext [3] = "Foam cups are a great product with a lot of science behind them.";
mtext [4] = "Foam drinking cups are actually easier to recycle than paper cups since they\'re made of a single material.&nbsp;&nbsp;&nbsp;Paper cups are lined with plastic.";
mtext [5] = "Foam cups are a great product with a lot of science behind them.";
var mwidth="763px";
var mheight="24px";
var speed=1;
var mbgcolor="#FFCC66";
v=Math.round(Math.random()*(mtext.length-2)+1);
w=Math.round(Math.random()*(mtext.length-2)+1);
x=Math.round(Math.random()*(mtext.length-2)+1);
y=Math.round(Math.random()*(mtext.length-2)+1);
z=Math.round(Math.random()*(mtext.length-2)+1);
mgap='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
mribbon=mtext[0] + mgap  + mtext[v] + mgap + mtext[0] + mgap  + mtext[w] + mgap + mtext[0] + mgap  + mtext[x] + mgap + mtext[0] + mgap  + mtext[y] + mgap + mtext[0] + mgap  + mtext[z] + mgap  + mtext[0];
mcontent='<nobr>' + mribbon +  '</nobr>';
  
document.write('<span id="temp" style="visibility:hidden; position:absolute; left:-9000px; top:-20px;">' + mcontent + '</span>'); //defines how much 'ribbon' can fall off of the left-hand side of the page
document.write('<table border="0" cellspacing="0" cellpadding="0"><td class="plants">');
document.write('<div style="position:relative; width:' + mwidth + '; height:' + mheight + '; overflow:hidden">');//crops text to window
document.write('<div style="position:absolute; width:' + mwidth + ';height:' + mheight + '; background-color:' + mbgcolor +'">');//writes background color
document.write('<div id="iemarquee" style="position:absolute; left:0px; top:5px"></div></div></div></td></table>');
//writes the marquee with (left:) redefined by the populate function
  
function populate(){
	marquee=document.getElementById ? document.getElementById("iemarquee") : document.all.iemarquee;
	marquee.style.left = parseInt(mwidth)-763 + "px"; //sets the default of the (left:) style to the width of the marquee
	marquee.innerHTML = mcontent;
	actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth;
	lefttime=setInterval("scrollmarquee()", 16); // sets the interval between runs of the scrollmarquee function to 16 ms
}
  
function scrollmarquee(){ //updates the (left:) style for the div id marquee to be reduced by (speed) pixels
	if (parseInt(marquee.style.left)>(actualwidth*(-1)+1))
	marquee.style.left=parseInt(marquee.style.left) - speed + "px";
	else
	marquee.style.left=parseInt(mwidth) + "px";
}
  
window.onload=populate;
