// -= WadioMedia.org Javascript =- \\
//                                 \\
//  -= Created by Darkimmortal =-  \\
//    -= Powered by jQuery =-      \\

/*

-- NOTES --

Used jQuery-UI functions:

- puff (a.k.a scale)
- shake
- core
- explode


*/


jQuery.cookie = function(name, value, options) {
	if (typeof value != 'undefined') {
	    options = options || {};
	    if (value === null) {
	        value = '';
	        options.expires = -1;
	    }
	    var expires = '';
	    if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
	        var date;
	        if (typeof options.expires == 'number') {
	            date = new Date();
	            date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
	        } else {
	            date = options.expires;
	        }
	        expires = '; expires=' + date.toUTCString();
	    }
	    var path = options.path ? '; path=' + (options.path) : '';
	    var domain = options.domain ? '; domain=' + (options.domain) : '';
	    var secure = options.secure ? '; secure' : '';
	    document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
	} else {
	    var cookieValue = null;
	    if (document.cookie && document.cookie !== '') {
	        var cookies = document.cookie.split(';');
	        for (var i = 0; i < cookies.length; i++) {
	            var cookie = jQuery.trim(cookies[i]);
	            if (cookie.substring(0, name.length + 1) == (name + '=')) {
	                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
	                break;
	            }
	        }
	    }
	    return cookieValue;
	}
};
/*
$.fn.activateCountdowns = function(){
	return this.each(function(){
		$(this).contents(".countdown > div").countdown('resume');
	});
};

$.fn.deactivateCountdowns = function(){
	return this.each(function(){
		$(this).contents(".countdown > div").countdown('lap');
	});
};*/


$.fn.cdown = function(){
	return this.each(function(){
		/*var cdown = new Date();
		cdown.setTime(this.tiem);		
		$(this).text("").countdown({
			format: 'dhMS',
			until: cdown,  
			compact: true
		});*/
	});
};


var sidebarActions = [
	function(){
		spop('http://stream.wadiomedia.org/flash/clean/', 'play', 220, 207, 'toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0');
	},
	function(){
		document.location.href="wadio.zip";
	},
	function(){
		document.location.href="http://www.wadiomedia.org/play";
	},         
	function(){
		document.location.href="skype:WadioMediaSkype?call";
	},         
	function(){
		effectLoad("request");
	},
	function(){
		document.location.href="http://www.facebook.com/home.php#/group.php?gid=22632878929";
	},
	function(){
		document.location.href="http://twitter.com/WadioMedia";
	}
];

var speakerOffsets = [-150, -100, -35, 15, 75, 120, 160, 215];

/**
 * Stores page hash
 * @type {String}
 */
var hash;
/**
 * Time between slow moving things
 * @type {Number}
 */
var boomTime = 23000;
/**
 * True if something else isn't fucking around with the speaker when the slow moving thing should happen
 * @type {Boolean}
 */
var safeToBoom = true;
/**
 * Effects enabled?
 * @type {Boolean}
 */
var fx = true;
/**
 * Delay between hash update checks (back/forward etc.)
 * @type {Number}
 */
var hashDelay = 700;
/**
 * Is a page loading?
 * @type {Boolean}
 */
var pageLoading = false;
/**
 * Time between updates of Now Playing
 * @type {Number}
 */
var updateNowPlayingDelay = 15000;

var allowEast = false;
var allowEast2 = false;

var updateTeamspace = function(hashrel){	
	var heit = (hashrel.offsetHeight)-240;
	if(heit < 0){
		heit = 0;
	}
	heit += 60;
	debug(heit);
	if(fx){
		$("#teamspace").animate({height: heit+"px"}, "normal");
	} else {
		$("#teamspace").css({height: heit+"px"});
	}
}

var boom = function(){
	if(safeToBoom && fx){
		/*if(Math.round(Math.random()) === 0){
			$(".speaker").toggle("explode", {pieces: 15}, 1000);
			setTimeout(function(){
				$(".speaker").toggle("explode", {pieces: 15}, 1000);
			}, 1200);
		} else {*/
			$(".speaker").effect("shake", { direction: 'right', times: 1, distance: 130, easing: (Math.round(Math.random()) === 0 ? 'easeOutElastic' : null) }, 2500);
		/*}*/
	}
	setTimeout( boom, boomTime );
};

var debug = function(dbg){
	if(typeof console != "undefined" && console.debug){
		console.debug(dbg);
	}
};
var effectLoad = function(id){
	if(!pageLoading){
		if(fx){
			pageLoading = true;
			$(".contentitself:eq(0) > .team, .workaround").fadeOut("normal", function(){			
				//$(".contentitself:eq(0) > .safe").toggle("puff", {percent: 120}, "normal", function(){
				$(".contentitself:eq(0) > .safe").fadeOut("normal", function(){
					setTimeout(function(){
						load(id, true);
					}, 100);
					setTimeout(function(){
						$(".contentitself:eq(0)").show();
						$(".contentitself:eq(0) > .safe, .contentitself:eq(0) > .team").hide();
						$(".contentitself:eq(0) img").css({width: "", height: ""});
						//$(".contentitself:eq(0) > .safe").toggle("puff", {percent: 120}, "normal", function(){
						$(".contentitself:eq(0) > .safe").fadeIn("normal", function(){
							$(".contentitself:eq(0) > .team").show("normal");
						});
						pageLoading = false;
					}, 300);
				});			
			});
		} else {
			$(".contentitself:eq(0)").hide();
			load(id, false);
			$(".contentitself:eq(0), .contentitself:eq(0) > .safe, .contentitself:eq(0) > .team").show();
		}
	}
			
};

var updateNowPlaying = function(){
	$(".nowplaying span").fadeTo("fast", 0.4, function(){
		$(this).html("Please wait - updating...");
	});
	setTimeout(function(){
		$.ajax({
			cache: false,
			dataType: "text",
			type: "GET",
			url: "ajax/songrefresh.php",
			success: function(data){
				$(".nowplaying span").html(data).fadeTo("normal", 1.0);
			}
		});
	}, 400);
	setTimeout(updateNowPlaying, updateNowPlayingDelay);
};

var load = function(id, how){
	//debug("loading: "+id);
	//$("#contentitself").html($("#"+id).html());
	$(".contentitself").removeClass('contentitself').addClass('pagecache');
	$("#p_"+id).removeClass('pagecache').addClass('contentitself');
	if(how){
		$("#p_"+id).hide();
	}
	document.location.href="#"+id;
	hash = location.hash.replace("#", "");    
	setupEvents();
};

//stolen from the original wadio site :P
function spop( fichier, nom, largeur, hauteur, options ){
		var id = Math.round( Math.random() * 100 );
		var gauche = ( screen.width - largeur ) / 2;
		  var haut = ( screen.height - hauteur ) / 2;
		if ( options )
				{
						options = 'width=' + largeur + 'px, height=' + hauteur + 'px,  top=' + haut + ', left=' + gauche + ', ' + options;
				}
		else
				{
						options = 'width=' + largeur + 'px, height=' + hauteur + 'px,  top=' + haut + ', left=' + gauche;
				}
		window.open( fichier, nom + id, options );
}
var updateDisenable = function(){
	$("#disenable").text(fx ? "Disable effects" : "Enable effects");
};

var hashHandler = function(){
	if(location.hash.replace("#", "") != hash){
		hash = location.hash.replace("#", "");
		effectLoad(hash > "" ? hash : 'home');
	}
	setTimeout(hashHandler, hashDelay);	
};

var setupEvents = function(){


	//$(".countdown").countdown('destroy');
	if(hash == 'schedule'){
		$(".team-day").each(function(){
			$("#sch_"+$(this).attr("rel")).show();
			
			$(this).siblings(".team-left").children(".selector:eq("+(parseInt($(this).attr("rel"), 10) - 1)+")").each(function(){
				
				$("#p_"+hash+" .slidey").css({top: (($("#p_"+hash+" .selector").index(this) + 1) * 42) + "px"});
				
				$(this).siblings().children("span").removeClass('active');
				$(this).children("span").addClass('active');
				var rel = $(this).attr("rel");
				$(".team-right > div:visible").hide();
				$("#"+rel).show();//.contents().find(".countdown").cdown();
				
			});
			
		});
		$(".team-left img").css({paddingRight: "", paddingLeft: ""});
	} else if(hash == 'team'){
		$(".team-body:visible").hide();
		$("#sel_"+uid).show();
		$(".selector").children("span").removeClass('active');
		$(".selector[rel='sel_"+uid+"']").children("span").addClass('active');
		$(".slidey").css({top: (42*parseInt(uid))+"px"});
		$(".team-left img").css({paddingRight: "", paddingLeft: ""});
	} else if(hash == 'podcasts'){
		$(".team-body:visible").hide();
		$("#pod_0").show();
		$(".selector").children("span").removeClass('active');
		$(".selector[rel='pod_0']").children("span").addClass('active');
		$(".slidey").css({top: "42px"});
		$(".team-left img").css({paddingRight: "", paddingLeft: ""});
	} else if(hash == 'request'){
		$.ajax({
			cache: false,
			dataType: "json",
			type: "GET",
			url: "ajax/requestcheck.php",
			timeout: 10000,
			success: function(data, textStatus){
				$("#no-show, #dj-offline, #dj-online").hide();
				if(!data.djactive){
					$("#no-show").html(data.error);
					$("#no-show").show();
				} else {
					$("#dj-online").show();
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown){
				var i; var join; var send;
				if(typeof XMLHttpRequest == "object" || typeof XMLHttpRequest == "array"){
					for(i in XMLHttpRequest){
						if (XMLHttpRequest.hasOwnProperty(i)){
							join+="||"+i;
						}
					}
				} else {
					join="Incorrect format. Skipping due to highly likely browser crash";
				}
				send="XMLHttpRequest: "+XMLHttpRequest+"\n<br />XMLHttpRequest.join('||'): "+join+"\n<br />textStatus: "+textStatus+"\n<br />errorThrown: "+errorThrown+"\n<br />Page: "+document.location.href;
				$("#c-result").html("An error occured in the AJAX submission system used in this form. Please send a copy of the following to <a href='mailto:tech@wadiomedia.org'>tech@wadiomedia.org</a>:<br /><br /><br />"+send);
			}
		});		
	}
	
	
	
};
	
$(document).ready(function(){
	
	$("#c-submit, #r-submit").removeAttr("disabled");
	
	$(".selector").hover(function(){
		$(this).children("span").addClass('hover');
	}, function(){
		$(this).children("span").removeClass('hover');	
	});

	$("#footer-container, .faderlink").hover(function(){
		$(this).children().stop().fadeTo(fx ? "normal" : 1, 0.9);
	}, function(){
		$(this).children().stop().fadeTo(fx ? 1500 : 1, 0.4);
	});
	
	$("#c-subj").change(function(){
		if($(this).val() == "DJ Application"){
			$("#c-subject-thingy").fadeOut("normal", function(){ $("#c-exp-thingy, #c-dj-thingy, #c-msn-thingy").fadeIn("normal"); });			
		} else {
			$("#c-exp-thingy, #c-dj-thingy, #c-msn-thingy").fadeOut("normal", function(){ $("#c-subject-thingy").fadeIn("normal"); });			
		}
	});
	
	$("#c-subj").change();
	
	$("#c-submit").click(function(){
		$(this).attr("disabled", "disabled").text("Sending message...");		
		$.ajax({
			cache: false,
			dataType: "json",
			data: {
				name: $("#c-name").val(),
				email: $("#c-email").val(),
				msn: $("#c-msn").val(),
				site: $("#c-site").val(),
				user: $("#c-user").val(),
				subject: $("#c-subject").val(),
				body: $("#c-body").val(),
				subj: $("#c-subj").val(),
				exp: $("#c-exp").val(),
				dj: $("#c-dj").val()
			},
			type: "POST",
			url: "ajax/contact.php",
			timeout: 10000,
			success: function(data, textStatus){
				$("#c-result").html(data.result);
				if(!data.resbool){
					$("#c-submit").removeAttr("disabled").text("Retry");
					//debug(data);
					//$("#c-body").css({backgroundColor: ""});
					$(".c-left, #c-body-text, #c-exp-text, #c-subject-text").css({color: ""});
					$.each(data.errors, function(error, val){
						/*if(error == 'body'){
							$("#c-body").css({backgroundColor: "#FF9F9F"});
						} else {*/
						$("#c-"+error+"-text").css({color: "#FF0000"});
						//}
					});
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown){
				var i; var join; var send;
				if(typeof XMLHttpRequest == "object" || typeof XMLHttpRequest == "array"){
					for(i in XMLHttpRequest){
						if (XMLHttpRequest.hasOwnProperty(i)){
							join+="||"+i;
						}
					}
				} else {
					join="Incorrect format. Skipping due to highly likely browser crash";
				}
				send="XMLHttpRequest: "+XMLHttpRequest+"\n<br />XMLHttpRequest.join('||'): "+join+"\n<br />textStatus: "+textStatus+"\n<br />errorThrown: "+errorThrown+"\n<br />Page: "+document.location.href;
				$("#c-result").html("An error occured in the AJAX submission system used in this form. Please send a copy of the following to <a href='mailto:tech@wadiomedia.org'>tech@wadiomedia.org</a>:<br /><br /><br />"+send);
			}
		});        			
	});
	
	
	$("#r-submit").click(function(){
		$(this).attr("disabled", "disabled").html("Sending request...");		
		$.ajax({
			cache: false,
			dataType: "json",
			data: {
				name: $("#r-name").val(),
				song: $("#r-song").val(),
				artist: $("#r-artist").val(),
				dedi: $("#r-dedi").val()
			},
			type: "POST",
			url: "ajax/request.php",
			timeout: 10000,
			success: function(data, textStatus){
				$("#r-result").html(data.result);
				$(".r-left").css({color: ""});
				if(!data.resbool){
					$("#r-submit").removeAttr("disabled").html("<strong>Make Request</strong>");
					$.each(data.errors, function(error, val){
						$("#r-"+error+"-text").css({color: "#FF0000"});
					});
				} else {
					$("#r-submit").removeAttr("disabled").html("<strong>Make Request</strong>");
				}
			},
			error: function(XMLHttpRequest, textStatus, errorThrown){
				var i; var join; var send;
				if(typeof XMLHttpRequest == "object" || typeof XMLHttpRequest == "array"){
					for(i in XMLHttpRequest){
						if (XMLHttpRequest.hasOwnProperty(i)){
							join+="||"+i;
						}
					}
				} else {
					join="Incorrect format. Skipping due to highly likely browser crash";
				}
				send="XMLHttpRequest: "+XMLHttpRequest+"\n<br />XMLHttpRequest.join('||'): "+join+"\n<br />textStatus: "+textStatus+"\n<br />errorThrown: "+errorThrown+"\n<br />Page: "+document.location.href;
				$("#c-result").html("An error occured in the AJAX submission system used in this form. Please send a copy of the following to <a href='mailto:tech@wadiomedia.org'>tech@wadiomedia.org</a>:<br /><br /><br />"+send);
			}
		});        			
	});
	
	
	$(".nowplaying span, #listenlive").click(function(){
		//debug("lol");
		$(".fadechild-left, .fadechild-right").children().fadeTo("fast", 1.0, function(){
			$(this).fadeTo("slow", 0.4);
		});
	});
	/*
	$(".team-left").each(function(){
		var height = $(this).children(".selector").index($(this).children(".selector:last-child"))*42+300;
		debug(height);
		$(this).css({height: height+"px"});
		//debug($(this).innerHeight())
	});*/
	
	$(".selector").click(function(){
							
		$(this).siblings().children("span").removeClass('active');
		$(this).children("span").addClass('active');
		var rel = $(this).attr("rel");
		var hashrel = $("#"+rel).get(0);
		var uberthis = this;
		var top = (($("#p_"+hash+" .selector").index(uberthis) + 1) * 42);
		var top2 = (top-32)+"px";
		top = top+"px"
		$("#"+rel).show();
		updateTeamspace(hashrel);
		$("#"+rel).hide();
		if(hash == 'schedule'){
			//$(".team-right > div:visible .countdown").countdown('destroy');
			//debug($(".team-right > div:visible").contents(".countdown > div"));
			//$("#"+rel+" .countdown").cdown();
		}
		
	
		if(fx){
			$(".team-right > div:visible").fadeOut("normal", function(){
				
				/*if(hash != 'schedule'){
					$("#"+rel).animate({top: top}, 1200, "easeOutQuad");
					$(".team-body :not(#"+rel+")").css({top: top});
				}*/
				if(hash != 'schedule'){
					$("#"+rel).css({top: top2});
				}					
			});
			$("#"+rel).fadeIn("normal"/*, function(){ updateTeamspace(hashrel) }*/);
			$("#p_"+hash+" .slidey").stop().animate({top: top}, 1200, "easeOutElastic");
		} else {
			$(".team-right > div:visible").hide();
			if(hash != 'schedule'){
				$("#"+rel).css({top: top2});
			}
			$("#"+rel).show();
			//updateTeamspace(hashrel);
			$("#p_"+hash+" .slidey").css({top: (($("#p_"+hash+" .selector").index(this) + 1) * 42) + "px"});	
		}		
		
		//	$("#"
		//} else {
	});
	
	
	
	$(".fadechild").children().each(function(){
		$(this).children().css({backgroundColor: "#fff"}).stop().fadeTo(1, 0.4);        
	});
	
	$(".fadechild").hover(function(){
		if(fx){
			$(this).children(".fadechild-left").stop().animate({left: "7px"}, "normal");
			$(this).children(".fadechild-right").stop().animate({left: "-7px"}, "normal");
		} else {
			$(this).children(".fadechild-left").css({left: "7px"});
			$(this).children(".fadechild-right").css({left: "-7px"});	
		}
		$(this).children().each(function(){
			$(this).children().stop().fadeTo(fx ? "normal" : 1, 1.0);		
		});
	}, function(){
		if(fx){
			$(this).children(".fadechild-left").stop().animate({left: "0px"}, "normal");
			$(this).children(".fadechild-right").stop().animate({left: "0px"}, "normal");
		} else {
			$(this).children(".fadechild-left, .fadechild-right").css({left: "0px"});			
		}
		$(this).children().each(function(){
			$(this).children().stop().fadeTo(fx ? "normal" : 1, 0.4);        
		});
	});
	
	/*$(".menupart").each(function(){
		var letters = $(this).html().split("");
		var newtext = "<span class='first'>"+letters[0]+"</span>";
		for(var i = 1; i < letters.length; i++){
			newtext += "<span>"+letters[i]+"</span>";
		}
		$(this).html(newtext);
	});*/
	
	
	/*$("#wadio").mouseover(function(){
		safeToBoom = false;
		if(fx){
			$(".speaker").effect("shake", { times: 1, distance: 70 }, 350, function(){ safeToBoom = true; });
		}
	});*/
	
	$(".fadechild").click(function(){
		setTimeout( sidebarActions[$(".fadechild").index(this)], 1);	
	});
	
	$(".menupart, .selector, .team-day, .djlink").each(function(){
		$(this).attr("rel", $(this).attr("title"));
		$(this).removeAttr("title");
	});
	
	$(".djlink").click(function(){
		var auid = $(this).attr("rel");
		$.ajax({
			cache: false,
			dataType: "text",
			data: {
				uid: auid
			},
			type: "GET",
			url: "ajax/uid2uref.php",
			success: function(data){
				uid = data;
			//	debug(uid);
				effectLoad("team");
			}				
		});
	}).attr("href", "javascript:void('    This link will take you to the Team page. Thanks for reading the status bar ;-)    ');");
	
	$(".menupart").hover(function(){
		if(fx){
			$(this).stop().animate({fontSize: "18px"}, "fast").css({color: "#000", backgroundColor: "#fff"});
			$(".speaker").stop().animate({left: speakerOffsets[$(".menupart").index(this)]+"px"}, 1000, 'easeOutCirc');
		} else {
			$(this).css({color: "#000", backgroundColor: "#fff", fontSize: "18px"});
			$(".speaker").css({left: speakerOffsets[$(".menupart").index(this)]+"px"});
		}				
	}, function(){
		if(fx){
			$(this).stop().animate({backgroundColor: "#000"}, "fast").css({fontSize: "12px", color: "#fff"});
		//	var returnSpeakerTi
		} else {
			$(this).css({fontSize: "12px", color: "#fff", backgroundColor: "#000"});			
		}
	});
	
	$("#menu").mouseout(function(){
		if(fx){
			$(".speaker").stop().animate({left: "0px"}, 1000, 'easeOutCirc');
		} else {
			$(".speaker").css({left: "0px"});
		}			
	});
		
	
	$(".menupart").click(function(){
		var rel = $(this).attr("rel");
		/*if(rel=='chat'){
			load('chat');
		} else {
			if(hash != 'chat'){*/
				//if(!fx){
				//	load(rel, false);
				//} else {
					effectLoad(rel);
				//}
			/*} else {
				$("#contentitself").hide().text(" ");
				load(rel);
				$("#contentitself").toggle("puff", {}, "normal");
			}
				
		}*/
	});
	
	//$(".sch-table tr:odd:not(.sch-not)").css({backgroundColor: "#EFEFEF"});
	
	$("#credits strong:eq(0)").click(function(){
		if(allowEast){
			allowEast2 = true;
			setTimeout(function(){ allowEast2 = false; }, 3500);
		}
	});
	
	$("#credits strong:eq(1)").click(function(){
		allowEast = true;
		setTimeout(function(){ allowEast = false; }, 3500);
	});
	
	$("#credits strong:eq(3)").click(function(){
		if(allowEast && allowEast2){
			if(!fx){
				alert("Congratulations! You found Darkimmortal's easter egg :D\r\n\r\nYou probably have effects disabled for a good reason, so I'll skip making the entire site explode :P");
				return false;
			}
			alert("Congratulations! You found Darkimmortal's easter egg :D\r\n\r\nNow watch as the site explodes :D\r\n\r\n\r\n(and prepare for some major lag :P)");
			/*$("#logobar-container").toggle("explode", {pieces: 15}, 2000, function() {
				$("#header-container").toggle("explode", {pieces: 15}, 2000, function() {
					$("#content-container").toggle("explode", {pieces: 15}, 2000, function() {
						$("#footer-container").toggle("explode", {pieces: 15}, 2000, function() {
							$("#credits-container").toggle("explode", {pieces: 15}, 2000, function() {
								alert("Boom.");
								$("#wrapper div:hidden").fadeIn("normal");
							});
						});
					});
				});
			});*/
			$("#inner-wrapper").toggle("explode", {pieces: 15}, 5000, function() {
				alert("Boom.");
				$("#inner-wrapper").show();
			});
		}
		allowEast = false;
		allowEast2 = false;
	});
	
	$("#easter, #egg").click(function(){
		alert("You failed to find the easter egg! (This is NOT the easter egg)\r\n\r\n -Darkimmortal");
	});
	
	var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
	$(document).keydown(function(e) {
	  kkeys.push( e.keyCode );
	  if ( kkeys.toString().indexOf( konami ) >= 0 ){
		$(document).unbind('keydown',arguments.callee);
		alert("Sparkle sunshine! \r\n\r\n <3 Kevthedude \r\n(P.S. Press any key to add to your sparkle collection!)");
		$.getScript('http://www.cornify.com/js/cornify.js',function(){
		  cornify_add();
		  $(document).keydown(cornify_add);
		});          
	  }
	});

	
	//$(".countdown").each(function(){	
		//var cdown = new Date();
		//this.tiem = parseInt($(this).text(), 10) * 1000;
		/*cdown.setTime(this.tiem);		
		$(this).text("").countdown({
			format: 'dhMS',
			until: cdown,  
			compact: true
		}).countdown('lap');*/
	//});
	
	$("#disenable").click(function(){
		fx = !fx;
		updateDisenable();
		$.cookie('disableeffects', fx ? 'no' : 'yes');
	});
	
	/*$(".speaker").click(function(){
		if(safeToBoom){
			safeToBoom = false;
			//$(".speaker").effect("shake", { direction: 'right', times: 1, distance: 130, easing: 'easeOutElastic' }, 2500);
			$(".speaker").toggle("explode", {pieces: 15}, 1000);
			setTimeout(function(){
				$(".speaker").toggle("explode", {pieces: 15}, 1000);
				safeToBoom = true;
			}, 2000);
		}
	});*/
		
	hash = location.hash.replace("#", "");
	load(hash > "" ? hash : 'home', false);
	
	fx = $.cookie('disableeffects') != 'yes';
	updateDisenable();
	
	$(".pagecache").hide();
	
	$("#footer-container div, .faderlink img").fadeTo(1, 0.4);
	
	//setupEvents();
	//setTimeout( boom, boomTime );
	setTimeout(hashHandler, hashDelay);	
	setTimeout(updateNowPlaying, updateNowPlayingDelay);
	
});
