/*
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

	TICKER
	
-----------------------------------------------------------------------------------------------------------------------------

	DEPENDENCIES: 
	MooTools - version 1.20              
	copyright 2007 | Valerio Proietti | http://mootools.net/
	MIT-style license | http://www.opensource.org/licenses/mit-license.php
	
	Clientside CNET Libraries for MooTools
	For descriptions and documentation: http://clientside.cnet.com/wiki/cnet-libraries
	
-----------------------------------------------------------------------------------------------------------------------------
	
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
*/

/* 	intialize ticker
---------------------------------------------------------------------------------------------------------------------------*/
function initTicker() {

// set variables
	tickerIndex = 0;
	headline = new Array();

// load the arrays	
	headline[0] = '<a href="Dealers.html">Interested in a Super Igloo Dealership? - Click Here</a>';
	headline[1] = '<a href="Wind.html">Take a look at Domestic Wind Technology</a>';
	headline[2] = '<a href="Sponsor-kenya.html">YOU can now help families World-Wide</a>';
	headline[3] = '<a href="Flywheel.html">How will we store energy in the near future?</a>';
	headline[4] = '<a href="Dealers.html">We are actively seeking International Dealers and Manufacturers</a>';
	headline[5] = '<a href="Video.html">Click Here - View some product videos</a>';
	
	
// initialize the Marquee object
	fxmq = new Fx.Marquee($('newsText'), {
		delay: 100, 
		revert: false,
		duration: 400,
		showEffect: {
			top: 10,
			left: [-300, 5],
			opacity: [0,1]
		},
		hideEffect: {
			top: 10,
			left: [5,300],
			opacity: [1,0]
		}
	});

// run the ticker
showMessage();
runTicker();
}

/* 	set an interval to call the showMessage() function
---------------------------------------------------------------------------------------------------------------------------*/
function runTicker() { intervalID = setInterval("showMessage()", 6000); }

/* 	show the messages
---------------------------------------------------------------------------------------------------------------------------*/
function showMessage() {

// insert the message	
	fxmq.announce({message: headline[tickerIndex]});

	
// increment counter, see if you're, if true then clear the interval and start over	
	tickerIndex++;
	if(tickerIndex == 6){
		tickerIndex = 0;
		clearInterval(intervalID);
		runTicker();
	}
}



/* 	INIT STUFF after DOM loads
---------------------------------------------------------------------------------------------------------------------------*/

window.addEvent('domready', function(){
	initTicker();
});


