window.jQuery && $(document).ready(function() {
	// Enable the holiday message buttons
	$("ul.message-control li")
		.click(function() {
			var newText = $(this).text();
			$("#header")
				.attr("class","").addClass($(this).attr("class"))
				.attr("title",newText)
				.text(newText);
		})
		.mousedown(function() {
			$(this).find("span").css({borderStyle: 'inset'});
		})
		.mouseup(function() {
			$(this).find("span").css({borderStyle: 'outset'});
		});

	// Make the snowflakes draggable
	$(".snowflake")
		.each(function() {
			this.origleft = $(this).offset()["left"];
			adjustFlakes.call(this);
		})
		.draggable({
			stop: function(event, ui) {
				this.origleft = ui.position.left;
			}
		});

	// Adjust placement of snowflakes on window resize
	$(window).resize(function() {
		$(".snowflake").each(adjustFlakes);
	});

	// Add a drop shadow to the content container (relies on jquery.dropshadow.js)
	$.fn.dropShadow && $(".content").dropShadow({left:10, top:10, opacity:0.2});
});

function adjustFlakes() {
	var flakeleft = parseInt(this.origleft) / 1125 * document.body.clientWidth;
	$(this).css('left', flakeleft + 'px');
}
