// Code to run when the document is fully loaded
window.addEvent('domready', function(){
	// Smoothbox
	var imageOfTheDay = $$("a.smoothbox");
	
	// Backgrounds
	var numOfBackgrounds = 3;									   
	var ranNum = Math.floor(Math.random()*numOfBackgrounds);
	$$('#bg-random').addClass('bg' + ranNum);
	
	// Show Menu
	$('show-select').addEvent('change', function() {
		var selection = this.options[this.selectedIndex].value;
		$$($('shows-list').getElements('.show')).setStyles({'display': 'none'});
		$$($('shows-list').getElements('.' + selection)).setStyles({'display': 'block'});
	});
	
	// Show Listing
	$$('.show').addEvent('mouseenter', function() {
		this.addClass('hover');
	});
	$$('.show').addEvent('mouseleave', function() {
		this.removeClass('hover');
	});
	$$('.show').addEvent('click', function(evt) {
		if (evt.target.tagName != 'IMG' && evt.target.tagName != 'A') {
			this.getElement('.visible').onclick(evt);
		}
	});
});

// Avoid ActiveContent click requirement for Youtube Embed
(function() {
	var flashvars = {};
	var params = {};
	var attributes = { id: "youtube-content" }
	swfobject.embedSWF(
		"http://www.youtube.com/cp/vjVQa1PpcFOE1Ml1TnFsiB8IfEnHfM3DbAtEGX3c_Es=", 
		"active-content", "746", "413", "9.0.0", "vendor/swfobject/expressInstall.swf", flashvars, params, attributes
	);
})(); // Comment out the (); on this line to disable the embed for debugging...

// Ajax Poll
/*
function getVote(int) {
	new Request.HTML({
		url: '/poll/poll_vote.php',
		update: $('#poll-elements'),
		data: 'vote=' + int + '&sid=' + Math.random()
	}).get();
}*/
