jQuery(document).ready(function(){
	jQuery('#home_slider')
		.before('<div id="home_pager_wrapper"><div id="home_pager"></div></div>')
		.cycle({
			fx:     'scrollHorz',
			timeout: 7000,
			speed:   2000,
			prev:   '#prev_home', 
			next:   '#next_home',
			pager: '#home_pager',
			cleartype:     1,
			cleartypeNoBg: true
		});
					
	jQuery("header li a").hover(
		  function () {
			jQuery(this).animate({"color": "#fab52b", "border-color": "1px solid #fab52b"}, 200);
		  }, 
		  function () {
			jQuery(this).animate({"color": "#fefefe", "border-color": "1px solid #fefefe"}, 200);
		  }
	);
		
	jQuery("header ul li:last-child ul").hover(
		 function () {
			jQuery(this).animate({"border-color": "#fab52b"}, 200);
		  }, 
		  function () {
			jQuery(this).animate({"border-color": "#fefefe"}, 200);
		  }
	);

	jQuery("header ul li:last-child ul li.active").parent().hover(
		 function () {
			jQuery(this).animate({"border-color": "#fab52b"});
		  }, 
		  function () {
			jQuery(this).animate({"border-color": "#fab52b"});
		  }
	);

	jQuery('header ul li:last-child ul li.active').parent().css('border-color', '#fab52b');
	
	jQuery("#next , #prev").hover(
		 function () {
			jQuery(this).animate({"opacity": "0.8"}, 200);
		  }, 
		  function () {
			jQuery(this).animate({"opacity": "0.25"}, 200);
		  }
		);
							
	jQuery('#indicator li').click(function(){
		// jQuery(this).siblings().removeClass('active');
		jQuery(this).addClass('active');
	});
 
	jQuery(".left.list a").hover(
		function () {
		   jQuery(this).animate({"color": "#fab52b"}, 200);
		}, 
		function () {
		   jQuery(this).animate({"color": "#fefefe"}, 200);
		}
	);
		
	// ACCORDION
	jQuery('#accordion div').click(function(){
		jQuery('#accordion div.active').find('h3').show();
		jQuery('#accordion div.active').find('p').hide();
		jQuery('#accordion div.active').removeClass('active');
		
		jQuery(this).find('h3').hide();
		jQuery(this).find('p').show();
		// setTimeout(function(){
			jQuery(this).addClass('active');	
		// },1000);
	});
	
	jQuery('#nutritional').toggle( function() {
		  jQuery('#nutritional_list').slideToggle(500);
			jQuery(this).addClass('active2');
		  jQuery(this).find('img').addClass('active');
		},
		function() {
		  jQuery('#nutritional_list').slideToggle(500);
			jQuery(this).removeClass('active2');
		  jQuery(this).find('img').removeClass('active');
		}
	);
	
	jQuery('#ingredients').toggle( function() {
		  jQuery('#ingredient_list').slideToggle(500);
			jQuery(this).addClass('active2');
		  jQuery(this).find('img').addClass('active');
		},
		function() {
		  jQuery('#ingredient_list').slideToggle(500);
			jQuery(this).removeClass('active2');
		  jQuery(this).find('img').removeClass('active');
		}
	);
		
	jQuery('.location img').click(function(){
		jQuery(this).animate({"z-index": "-100", "opacity": "0"}, 500);
		jQuery(this).nextAll('p').text('Close');
	});
		
	jQuery('.location p.location_toggle').toggle( 
		function() {
			jQuery(this).prevAll('.photo').animate({"z-index": "-100", "opacity": "0"}, 500);
			jQuery(this).text('Close');
		},
		function() {
			jQuery(this).prevAll('.photo').animate({"z-index": "100"}, 0);
			jQuery(this).prevAll('.photo').animate({"opacity": "1"}, 500);
			jQuery(this).text('Get Directions');
	});
	
	jQuery('.ddTitle').toggle(function() {
		jQuery(this).addClass('active3');
	},
	function() {
		jQuery(this).removeClass('active3');
	});
	
	jQuery('#slick-toggle').click(function() {
		jQuery('#slickbox').toggle(400);
		return false;
	});
}); // ## END of jQuery(document).ready(function(){


/* The following appears in the console.log() when the below is commented out:
[cycle] terminating; too few slides: 1
*/

menu = jQuery('.left.list');
//console.log(menu);
actualMenu = jQuery(".menu.float");							
//console.log(actualMenu);
//steve = jQuery('.left');
//console.log(steve);


var initial_pos = menu.offset().top;
jQuery(window).scroll(function(){
	scrolled = jQuery(window).scrollTop();
	position = initial_pos - scrolled;
	console.log(position);
	if (position < 0){
		menu.addClass('fixed');
		actualMenu.css("margin-left", "220px");
	} else {
		menu.removeClass('fixed');
		actualMenu.css("margin-left", "0px");
	}
});

menu2 = jQuery('.left.list');
actualContent = jQuery(".content.float");							
var initial_pos = menu2.offset().top;
jQuery(window).scroll(function(){
	scrolled = jQuery(window).scrollTop();
	position = initial_pos - scrolled;
	console.log(position);
	if (position < 0){
		menu2.addClass('fixed');
		actualContent.css("margin-left", "220px");
	} else {
		menu2.removeClass('fixed');
		actualContent.css("margin-left", "0px");
	}
});

contactContent = jQuery(".contact_form.float");							
var initial_pos = menu2.offset().top;
jQuery(window).scroll(function(){
	scrolled = jQuery(window).scrollTop();
	position = initial_pos - scrolled;
	console.log(position);
	if (position < 0){
		menu2.addClass('fixed');
		contactContent.css("margin-left", "220px");
	} else {
		menu2.removeClass('fixed');
		contactContent.css("margin-left", "0px");
	}
});

locationContent = jQuery(".locations.float");							
var initial_pos = menu2.offset().top;
jQuery(window).scroll(function(){
	scrolled = jQuery(window).scrollTop();
	position = initial_pos - scrolled;
	console.log(position);
	if (position < 0){
		menu2.addClass('fixed');
		locationContent.css("margin-left", "220px");
	} else {
		menu2.removeClass('fixed');
		locationContent.css("margin-left", "0px");
	}
});

menu3 = jQuery('.left.list');
aboutContent = jQuery("#about_content");							
var initial_pos = menu3.offset().top;
jQuery(window).scroll(function(){
	scrolled = jQuery(window).scrollTop();
	position = initial_pos - scrolled;
	console.log(position);
	if (position < 0){
		menu3.addClass('fixed');
		aboutContent.css("margin-left", "220px");
	} else {
		menu3.removeClass('fixed');
		aboutContent.css("margin-left", "0px");
	}
});

menu4 = jQuery('.left.list');
accordionContent = jQuery("#accordion");							
var initial_pos = menu4.offset().top;
jQuery(window).scroll(function(){
	scrolled = jQuery(window).scrollTop();
	position = initial_pos - scrolled;
	console.log(position);
	if (position < 0){
		menu4.addClass('fixed');
		accordionContent.css("margin-left", "220px");
	} else {
		menu4.removeClass('fixed');
		accordionContent.css("margin-left", "0px");
	}
});


jQuery(window).scroll();

