var timer, slider;
var doTimer = true;

window.addEvent('domready', function() {
	slider = new Slider({
		panelHolder: $('Panels'),
		panels: $$('.homeMainPanel'),
		container: $('HomePageBanners'),
		buttons: $$('#HomePanelNav li a')
	});
	
	$$('.homeMainPanel').each(function (pnl) {
		pnl.addEvent('mouseenter', stopTimer);
		pnl.addEvent('mouseleave', startTimer);
	});
	$('HomePanelNav').getElement('ul').addEvent('mouseenter', stopTimer);
	$('HomePanelNav').getElement('ul').addEvent('mouseleave', startTimer);
	$$('#HomePanelNav li a').invoke('addEvent', 'click', function (e) { doTimer = false; });
	startTimer();
	
	flashParams = {"wmode":"opaque"};
	flashVarsImages = {"dataSource":"/flash/hpLogos.xml", "startPoint":"0", "interval":"5"};
	flashAttributesImages = {"name": "usingZapointswf", "id": "usingZapointswf"};
	swfobject.embedSWF("/flash/logoDisplay.swf", "usingZapointswf", "930", "69", "10.0.0", "/flash/expressInstall.swf", flashVarsImages, flashParams, flashAttributesImages);
	
});


function startTimer() {
	timer = nextSlide.periodical(9000);
}
function stopTimer(e) {
	clearInterval(timer);
}
function nextSlide(e) {
	if (doTimer) {
		slider.showNext();
	}
}

function shake(el) {
	var myFx = new Fx.Tween(el, {duration:100, property: 'left'});
	var start = 0;
	var end = 10;
	myFx.start(start, end).chain(
	    function(){ this.start(end, start); },
	    function(){ this.start(start, end); },
	    function(){ this.start(end, start); }
	);
}
