window.addEvent('domready', function(){
	//scroll internal links
	new SmoothScroll();
	//timer
	new Countdown($('remainingDays'),{
		 formatDays: '<h3>%days% Days</h3>',
		formatHours: '%hours% hours, ',
		formatMinutes: '%minutes% minutes, ',
		formatSeconds: '%seconds% seconds <h4>Until Election Day</h4><h4>on November 4, 2008</h4>'
	},
		{message: 'Go Vote!'}
	);
	//button animations
	var normalSize=105, smallSize=98, fullSize=135;
	var navs = $$("#nav a");
	var fx = new Fx.Elements(navs, {wait: false, duration: 300, transition: Fx.Transitions.Back.easeOut});
	navs.each(function(link, i) {
		link.addEvent("mouseenter", function(event) {
			var o = {};
			o[i] = {
				width: [link.getStyle("width").toInt(), fullSize],
				color: [link.getStyle("color"), "#1e3c65"],
				backgroundColor: [link.getStyle("backgroundColor"), "#FFF"]
				}
			navs.each(function(other, j) {
				if(i != j) {
					var w = other.getStyle("width").toInt();
					if(w != smallSize) o[j] = {
						width: [w, smallSize],
						color: [other.getStyle("color"), "#dedede"],
						backgroundColor: [other.getStyle("backgroundColor"), "#284a79"]
					};
				}
			});
			fx.start(o);
		});
	});
	 
	$("nav").addEvent("mouseleave", function(event) {
		var o = {};
		navs.each(function(link, i) {
			o[i] = {
				width: [link.getStyle("width").toInt(),normalSize],
				color: [link.getStyle("color"), "#FFF"],
				backgroundColor: [link.getStyle("backgroundColor"), "#1e3c65"]
			}
		});
		fx.start(o);
	});
});
window.addEvent('load', function(){
//reveal the countdown
	var doit = $('countdown');
	var revealTimer = new Fx.Styles(doit, {duration: 1000, transition: Fx.Transitions.Bounce.easeOut});
	if(window.ie){
	revealTimer.start({
		'height': [0, $('countdown').getStyle('height')],
		'opacity':[0,1]
	});
	}else{
	revealTimer.start({
		'height': [0, $('countdown').getStyle('height')],
		'opacity':[0,1],
		'fontSize':['0em',$('countdown').getStyle('fontSize')]
	});
	}
});