function applyCountDown(endDay)
{
	$('#defaultCountdown').countdown({until: endDay});
	$('#year').text(endDay.getFullYear());	
}

$(document).ready(function() {
	$("#mainmenu").twolevel(
			{resetTimer: 100}
	);
			//$.preloadImages("http://www.edmontonopera.com/img/mainpage/buttons/tickets-hover.png", "http://www.edmontonopera.com/img/mainpage/buttons/subscriptions-hover.png", "http://www.edmontonopera.com/img/mainpage/buttons/donation-hover.png");
  
  
   jcps.fader(300, '#switcher-panel');
   
   
   
$("#twitter").getTwitter({
userName: "edmontonopera",
numTweets: 3,
loaderText: "Loading tweets...",
slideIn: true,
slideDuration: 750,
showHeading: true,
headingText: "Latest Tweets",
showProfileLink: true,
showTimestamp: true
});
    
	/*
      $(".tweet").tweet({
        join_text: "auto",
        username: "seaofclouds",
        avatar_size: 48,
        count: 3,
        auto_join_text_default: "we said,",
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "we replied",
        auto_join_text_url: "we were checking out",
        loading_text: "loading tweets..."
      });
    */
	
	 // run the code in the markup!
    $('#sponsors pre code').each(function() {
        eval($(this).text());
    });
	
	$('#cyclecontest').cycle({
		fx:		'fade',
		speed:		300,
		timeout:	3000
	});
	
	$("a[rel^='prettyPhoto']").prettyPhoto();
    var endDay = new Date();
	var today = new Date();
	endDay = new Date(2012, 2 - 1, 4, 19, 30, 0, 0);
	var difference = endDay.getTime() - today.getTime();
	if(( (difference) <= (3*1000*60*60*24)) && ( (difference) >= 0)) {
			applyCountDown(endDay);	
			
	}
	//alert(difference);
});

