/*   All Javascript code is Copyright 2010 HunterGD @ HunterGD.com   *
*  Do not use or borrow my code without giving credit to me, at the  *
*  least, please leave this header with the code.                   */

/* Slides the #events div up to hide it and sets right-margin for #content. */

$(document).ready(function() {
	$('#close').add("#close2").click(function() {
		$("#events").slideUp('slow');

		$("#content").add("#footer").animate({
			marginRight: "10px"
		}, 'slow');

		$("#close").hide();
		$("#open").show();

		setCookieClosed();
	});

	$("#logo").textShadow({
		color:   "#000",
		xoffset: "0px",
		yoffset: "0px",
		radius:  "0px",
		opacity: "75"
	});
});

/* Slides the #events div down and sets right-margin for #content. */

$(document).ready(function() {
	$('#open').click(function() {
		$("#events").slideDown('slow');

		$("#content").add("#footer").animate({
			marginRight: "235px"
		}, 'slow');

		$("#open").hide();
		$("#close").show();

		setCookieOpened();
	});
});


/* Setting a cookie to remember the status of the events box. */

var current_date = new Date;
var cookie_year = current_date.getFullYear() + 1;
var cookie_month = current_date.getMonth();
var cookie_day = current_date.getDate();
var expires = new Date(cookie_year, cookie_month, cookie_day);

function setCookieClosed() {
	document.cookie = "eventsBox=closed; expires="+ expires.toGMTString();
}

function setCookieOpened() {
	document.cookie = "eventsBox=opened; expires="+ expires.toGMTString();
}
