$(document).ready(function() {	
	// Set Time of Day
	setTOD();
});

function setTOD(){
	offset = -4;
	d = new Date();   
    utc = d.getTime() + (d.getTimezoneOffset() * 60000);   
    nd = new Date(utc + (3600000*offset));	
	thehour = nd.getHours();  
	themonth = nd.getMonth();

	// Special Holidays
	if (getQueryVariable('holiday'))
		holiday = getQueryVariable('holiday');
	else
	{
		if (themonth == 9)
			holiday = "halloween ";
		else if (themonth = 10)
			holiday = "thanksgiving ";
		else if (themonth = 11)
			holiday = "christmas ";
		else 
			holiday = "";
	}

	if (getQueryVariable('tod'))
		tod = getQueryVariable('tod');
	else
	{	  
		if (thehour >= 20)  
			tod = "night";  
		else if (thehour >= 16)  
			tod = "dusk";  
		else if (thehour >= 7)  
			tod = "day";  
		else if (thehour >= 4)  
			tod = "dawn";  
		else if (thehour >= 0)  
			tod = "midnight";  
		else  
			tod = "day";  
	}	

	var cssString = holiday + tod;
	$("body").addClass(cssString);

}

function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");

		if (pair[0] == variable) {
		  return pair[1];
		}
	}
}