$(document).ready(function(){
	// Shadowbox Initialisation
	if ($.browser.msie) {
		//Stops shadowbox from hiding flash, which breaks IE's connection with the SWF
		Shadowbox.init({overlayOpacity: 0.85, skipSetup: true, /* onClose:shadowBoxClosed,  */troubleElements: ["select", "canvas"]});	
		}
	else {
		Shadowbox.init({overlayOpacity: 0.85});
	}
	
	// Setup Non-Flash Shadowboxes
	$('#howDoesItWork a').click(function(){
		openSimpleShadowbox('../FootyShow/howDoesItWork.html', 'iframe', 658, 668);
	});
	$('div#noFlash a#afl').click(function(){
		openSimpleShadowbox('../FootyShow/afl.aspx', 'iframe', 658, 668);
	});
	$('div#noFlash a#nrl').click(function(){
		openSimpleShadowbox('../FootyShow/nrl.aspx', 'iframe', 658, 668);
	});
	$('#closeBtn').click(function(){
		window.close();
	});
});

function openSimpleShadowbox(content, player, width, height){
	Shadowbox.open({
		content:	content,
		player:		player,
		width:		width,
		height:		height,
		viewportPadding: 0
	});
}
// Call shadowbox from flash
function openShadowbox(content, player, title, width, height){
    Shadowbox.open({
        content:    content,
        player:     player,
        title:      title,
        width:		width,
        height:		height
    });
}

// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6062837-10']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
