$(document).ready(function() {  
	
	// show content
	//$('#content').delay(800).css({visibility: "visible"})
	
	// galleries
	$("a[rel='art']").colorbox({height:"90%"});
	$("a[rel='teaser']").colorbox({height:"90%"});
	$("a[rel='sketch']").colorbox({height:"90%"});
	
	// track unity usage
	if (detectUnityWebPlayer ()) {
		_gaq.push(['_trackEvent', 'Browser', 'Unity', 'Installed']);
	} else {
		_gaq.push(['_trackEvent', 'Browser', 'Unity', 'Not Installed']);
	}
	
	
	// page related
	/*
    //alert("ready!");
	//$('#content-teaser').slideUp();
	$('#content-gallery').slideUp();
	$('#content-about').slideUp();
	$('#content-team').slideUp();
	$('#content-extra').slideUp();
	
	//$('#content-teaser').slideDown('normal');
	
	var hash = window.location.hash.substr(1);
	if (hash == "teaser" || hash == "gallery" || hash == "about" || hash == "team" || hash == "extra") {
		clickTab(hash);
	}
		
	
	// actions
	
	$('#site_nav a').click(function(){
									
		//var toLoad = $(this).attr('href')+' #content';
		
		var hash = $(this).attr('href').substr(1,$(this).attr('href').length);
		
		window.location.hash = hash;
		
		//alert("toLoad: " + toLoad);
		
		clickTab(hash);
		
		return false; 
		
	});
	*/
	
});

function detectUnityWebPlayer () {
    var tInstalled = false;
    if (navigator.appVersion.indexOf("MSIE") != -1 &&
        navigator.appVersion.toLowerCase().indexOf("win") != -1)
    {
        tInstalled = detectUnityWebPlayerActiveX();
    }
    else if (navigator.mimeTypes && navigator.mimeTypes["application/vnd.unity"])
    {
        if (navigator.mimeTypes["application/vnd.unity"].enabledPlugin &&
            navigator.plugins && navigator.plugins["Unity Player"])
        {
            tInstalled = true;	
        }
    }	
    return tInstalled;	
}

function clickTab(_tab) {
	$('#content-teaser').slideUp(400);
	$('#content-gallery').slideUp(400);
	$('#content-about').slideUp(400);
	$('#content-team').slideUp(400);
	$('#content-extra').slideUp(400);
	
	// show the right one
	var showMe = "#content-" + _tab;
	//alert(showMe);
	$(showMe).delay(400).slideDown('normal');
	
}
