$(function(){

	// Determine season
	var bodyClass = 'summer';
	var gardenCalendarFile = 'garden-calendar-spring.html';
	var today = new Date();
	var spring = new Date('1/20/' + today.getFullYear());
	var summer = new Date('5/15/' + today.getFullYear());
	var fall = new Date('9/10/' + today.getFullYear());
	var holiday = new Date('11/20/' + today.getFullYear());
	var winter = new Date('12/26/' + today.getFullYear());
	
	if (today >= winter) {
		bodyClass = 'winter';
		gardenCalendarFile = 'garden-calendar-winter.html';
	} else if (today >= holiday) {
		bodyClass = 'holiday';
		gardenCalendarFile = 'garden-calendar-winter.html';
	} else if (today >= fall) {
		bodyClass = 'autumn';
		gardenCalendarFile = 'garden-calendar-fall.html';
	} else if (today >= summer) {
		bodyClass = 'summer';
		gardenCalendarFile = 'garden-calendar-summer.html';
	} else if (today >= spring) {
		bodyClass = 'spring';
		gardenCalendarFile = 'garden-calendar-spring.html';				
	} else {
		bodyClass = 'winter';
		gardenCalendarFile = 'garden-calendar-winter.html';
	}

	$('body').addClass(bodyClass);
	$('#nav a[href="garden-calendar-spring.html"]').attr('href', gardenCalendarFile);
	
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.80, /* Value betwee 0 and 1 */
		showTitle: false, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'light_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
	});
	
	$('form.addToCart select[name="os0"]').bind('change', function(){
		// Adjust weight as necessary
		var form = $(this).parents('form');
		var index = $(this).get(0).selectedIndex;
		form.find('input[name="weight"]').val(form.find('input[name="weights[]"]').eq(index).val())
		//alert($(this).parents('form').find('input[name="weight"]').val());
		return true;
	});
	
	var quotes = [
		/*
		{
			quote: "Mike , the crew was here yesterday and did an especially great job with the work. They did extra weed control and cleaned up an area of dead shrubs plus the usual. How wonderful to have a crew that does full care not just the normal cut and blow that is too common now. Next time some pruning will be done and will keep the yard looking great. A **** job. Thanks again for your super management of our yard and your excellent crew!!",
			author: "Jeanne"
		},
		{
			quote: "We are so pleased with the work you and your team have done to design and build the stone wall, and to lay out and plant all the new shrubs, trees, and grasses in our yard. After two years of planning, the place looks outstanding! Your ongoing maintenance is also of highest quality, and we have been very pleased with the team's pleasantness and work ethic. Thank you so much for such great work at such an affordable price. We look forward to working with you as we attack the upper gardens!",
			author: "Ed DesCamp, Bellevue"
		},
		{
			quote: "Thanks so much, Mike. It was a fun day. You guys worked so hard, got so much - well, everything! done. We'll definitely be in touch when it's getting beyond us again - which may be sooner than later with mulching in mind. Not yet though. My hula hoe (to be) will help with those weeds in the meantime. :) It's fun to be able to think now about planting. You're great. Thanks again.",
			author: "Mary Jane"
		},
		*/
		{
			quote: "Thanks, Mike! The house looks great and we appreciate your good work.",
			author: "Bob Kaufman"
		},
		{
			quote: "Your whole team was a pleasure to work with and always checked each step to assure it met our plans. All in all we are delighted with the work! Look forward to seeing you all again when we start on the front yard. Cheers!",
			author: "Ed and Jeanne"
		},
		/*
		{
			quote: "MJW Services have been a key part of my household program for over fifteen years. Attentive, conscientious, and professional, with a personal style that is always warm and familiar. Whether I need a hand with a last-minute project or a yard to be managed for an entire season while I'm out of town, the word that best describes MJW is Reliable.",
			author: "Doug Legan, Bellevue, Orlando"
		},
		*/
		{
			quote: "I have been nothing but impressed with you so far, very professional, and very straightforward. It has been a real pleasure dealing with you.",
			author: "Bill"
		},
		{
			quote: "Just wanted to say the guys did an awesome job on the yard - looks great!",
			author: "Todd Hooper"
		},
		{
			quote: "Thanks again so much for the wonderful job on our yard. Dan is quite pleased and I'm so thrilled. I will definitely call in about a month to schedule bed maintenance.",
			author: "Stephanie"
		},
		/*
		{
			quote: "I want to complement the gentlemen that did the work on my concrete driveway and walks. It looks great. I was thoughtless and didn't get his name, but when he saw me lugging groceries in the mist to the house, he stopped the washer, and came to my aid. I thanked him hurriedly, so would you please thank him again for me and let him know how much I appreciated his kindness. You have a super-duper pleasant crew.",
			author: "Mary Graham"
		},
		{
			quote: "I'm very happy with the service. I especially like that I don't have to think about it! Twice I've actually been home and was able to observe your staff on the property. They're friendly, professional and diligent about their work. The neighbors haven't said anything - and that's a good thing!",
			author: "Michael R. Judkins Town Home Association"
		},
		*/
		{
			quote: "I am inclined to trust him as he has created one of the most beautiful front entrances in Duvall.",
			author: "Marisa Rhett-Miller's Homestead Association, President"
		}
	];
	
	if ($('body').hasClass('front')) {
		var quote = quotes[Math.floor(Math.random()*5)];
		var html = '<p>&ldquo;' + quote.quote + '&rdquo;</p>';
		html += '<p class="author">&mdash;' + quote.author + '</p>';
		$('#featureFooter .quote').html(html);
	}
});