/** Slider **/
jQuery(function($) {

	$('#slideshow li h2').fadeOut();

	$('#slideshow').serialScroll({
		items: 'li.slider',
		prev: '#screen2 a.prev',
		next: '#screen2 a.next',
		offset: -250, //when scrolling to photo, stop 230 before reaching it (from the left)
		start: 0, //we have the fake, so start at the start
		duration: 1200,
		force: true,
		stop: true,
		interval: 8500,
		lock: false,
		cycle: true, //don't pull back once you reach the end
		easing: 'easeOutQuart', //use this easing equation for a funny effect
		jump: false, //click on the images to scroll to them,
		onBefore: function(e, elem, $pane, $items, pos) {
			$(elem)
				.siblings()
					.children('h2')
						.fadeOut()
					.end()
				.end()
				.children('h2').fadeIn();
			$("#buttons .slidernum")
				.removeClass('selected')
				.eq(pos)
					.addClass('selected');

		},
		onAfter: function(elem) {
			$(elem)
				.children('h2').fadeIn(); // Do it here too for the first element
		}
	});

	$("#buttons .slidernum").click(function(event) {
		event.preventDefault();
		$(this)
			.siblings()
				.removeClass('selected')
			.end()
			.addClass('selected');
		var index = $(this).attr("href").substr(1, 1) - 1;
		$("#slideshow").trigger('goto', [index]);
	});

});

/** Loves **/
$(function() {
	$('.thumbs a').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " - ",
		fade: 250
	});
	$('#most-loved .col1').hover(
		    function() { $(".most-loved-label").fadeOut("fast"); }
		    , function() { $(".most-loved-label").fadeIn("fast"); }
	    );
	$('.thumbs').hover(
		    function() { $(".most-loved-label").fadeOut("fast"); }
		    , function() { $(".most-loved-label").fadeIn("fast"); }
	    );
});

/** Shop **/
jQuery(function($) {

	$('#shop-slider').serialScroll({
		items: 'li',
		prev: '#shop a.prev',
		next: '#shop a.next',
		offset: 0, //when scrolling to photo, stop 230 before reaching it (from the left)
		start: 1, //as we are centering it, start at the 2nd
		duration: 1200,
		force: true,
		stop: true,
		interval: 12500,
		lock: false,
		cycle: true, //don't pull back once you reach the end
		easing: 'easeOutQuart', //use this easing equation for a funny effect
		jump: false //click on the images to scroll to them
	});

});
