function initDate() {
	var currentYear = (new Date).getFullYear();
	$("#Year").text((new Date).getFullYear());
}



function initMenus(){
$('.Menu .Container').hide();
$('.Menu .Selector').wrapInner("<span />");
$('.Menu.ShowFirst .Selector:nth-child(1)').addClass('Open');
$('.Menu.ShowFirst .Selector.Open').next().show();
$('.Menu .Selector').click(function(){
var checkElement=$(this).next();
if((checkElement.is('.Container'))&&(checkElement.is(':visible'))){$(this).removeClass('Open');checkElement.slideUp('normal')}
if((checkElement.is('.Container'))&&(!checkElement.is(':visible'))){
checkElement.slideDown('normal');
$(this).addClass('Open');return false}})}
	
	
	
	
function flameText(){		
	$('#menu-main-navigation li:nth-child(4)').addClass('Fire');
	$('#menu-main-navigation li:nth-child(5)').addClass('HideMobile');
	$('#menu-main-navigation li:nth-child(6)').addClass('HideMobile');
	
	var step = 1;
	function nextShadow(){
		$('.Fire').each(function(){
			y = parseFloat($(this).attr("y_pos"));
			y += step + Math.random()*3;
			$(this).attr("y_pos", y);
			shaking = Math.random();
			shadow1 = "0px 0px "+(y%5)+"px white";
			shadow2 = shaking*24/y*Math.cos(y/5)*15+"px -"+(shaking*4/y+(y%17))+"px "+(shaking+(y%17))+"px #f6f399";
			shadow3 = shaking*24/y*Math.cos(y/7)*15+"px -"+(shaking*4/y+(y%31))+"px "+(shaking+(y%31))+"px #ea5d32";
			shadow4 = shaking*24/y*Math.cos(y/13)*15+"px -"+(shaking*4/y+(y%41))+"px "+(shaking+(y%41))+"px #eaaf32";
			$(this).css("text-shadow", shadow2+", "+shadow1+", "+shadow4+", "+shadow3);
		});
	}
	$(function(){
		$('.Fire').each(function(){$(this).attr("y_pos","0");});
	   setInterval(nextShadow, 50); 
	});
}



$(document).ready(function(){
	if ($('.HideIfEmpty ul li:contains("Please check back soon")').length > 0) {
		$(".HideIfEmpty").remove();
	}	
	
	initMenus();
	flameText();
	initDate();

	// change background depending on user's time
	datetoday = new Date();
	timenow = datetoday.getTime();
	datetoday.setTime(timenow);
	thehour = datetoday.getHours();
	if (thehour >= 20)
	$('body').addClass('night');
	else if (thehour >= 18)
	$('body').addClass('sunset');
	else if (thehour >= 9)
	$('body').addClass('day');
	else if (thehour >= 7)
	$('body').addClass('sunrise');
	else if (thehour >= 0)
	$('body').addClass('night');
	else
	$('body').addClass('general');
	
	
	
	
/* MovingBoxes  */
$(function(){
	$('#slider-one').movingBoxes({
		navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
	});

	$('#slider-two').movingBoxes({
		startPanel   : 3,      // start with this panel
		width        : 650,    // overall width of movingBoxes (not including navigation arrows)
		panelWidth   : .7,     // current panel width adjusted to 70% of overall width
		buildNav     : true,   // if true, navigation links will be added
		navFormatter : function(index, panel){ return panel.find('h2 span').text(); } // function which gets nav text from span inside the panel header
	});
});

});
