function center_title() {
	var h = $("#content").height();
	var wh = $(window).height();
	var t = Math.max((wh - h) * .45, 10);
	// var ww = $(window).width();
	// var l = (ww - 800) / 2;
	// var l = Math.max((ww - $("#content").width()) / 2, 10);
	$("#content").css( { 'position' : 'absolute', 'top' : t, 'left' : 0 } );
}

function onYouTubePlayerReady(playerId) {
	ytplayer = document.getElementById("ytplayer");
	ytplayer.addEventListener("onStateChange", "onPlayerStateChange");
	ytplayer.addEventListener("onError", "onPlayerError");
}

function onPlayerError(errorCode) {
	console.log("An error occured of type:" + errorCode);
}

function onPlayerStateChange(newState) {
	// console.log("playerState: " + newState);
	if ( newState  == 1 || newState  == 3 ) {
		// $("#content :not(#ytplayer)").animate({ "opacity" : 0 }, 300);
		$("#content :not(#ytplayer)").animate({ "opacity" : 0 }, 0);
		$("body").addClass("trailer-playing");
	} else if ( newState == 0 ) {
		$("#content :not(#ytplayer)").animate({ "opacity" : 1 }, 3000);
		$("body").removeClass("trailer-playing");		
	} else {
		$("#content :not(#ytplayer)").animate({ "opacity" : 1 }, 300);
		$("body").removeClass("trailer-playing");
	}
}

function css_upgrade() {
	$(".artists-list li:odd").addClass("odd");
}

function toggleMenu() { 
	$('#mainnav').toggleClass('hide'); 
	$('body > header .leftButton').toggleClass('pressed'); 
}

$(document).ready(function(){
	css_upgrade();
	$('.slideshow').cycle({	fx: 'fade',	timeout: 6000 });
});
