jQuery(function($) {
				
			$('#productThumbnails + #mainImage').empty();
//			$('#productThumbnails li.active img').css('display', 'inline');
	
			$('ul.gallery').galleria({
			history   : false,
			insert    : '#mainImage', // the containing selector for our main image
			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
//				if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
					image.css('display','none').fadeIn(1000);
//				}
				caption.css('display','none').fadeIn(1000);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				image.attr('title','Next image >>');
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
				)
			}
		});
}); 

$(document).ready(function(){
	var currentPosition = 0;
	var slideWidth = 500;
	var slides = $('.slide');
	var numberOfSlides = slides.length;
	
	// Remove scrollbar in JS
	$('#slidesContainer').css('overflow', 'hidden');
	
	// Wrap all .slides with #slideInner div
	slides
		.wrapAll('<div id="slideInner"></div>')
		// Float left to display horizontally, readjust .slides width
		.css({
			'float' : 'left',
			'width' : slideWidth,
			'display' : 'block'
		});

	// Set #slideInner width equal to total width of all slides
	$('#slideInner').css('width', slideWidth * numberOfSlides);

	function moveIt(dir) {
		currentPosition = (dir == 'right') ? currentPosition+1 : currentPosition-1;

		$('#slideInner').animate({
			'marginLeft' : slideWidth*(-currentPosition)
		});
	};
	
	slides.children('img')
		.bind('click', function(){
			if(currentPosition<numberOfSlides-1)
				moveIt('right');
			else {
				currentPosition = 1;
				moveIt('left');
			}
		});
});

$(document).ready(function() {
	var fadeInSpeed     = 50;
	var fadeOutSpeed    = 200;

	// use each() to scope things so we don't have to
	// look up the image in each hover function
	$('.thumbs a').each(function() {

		// override our CSS shenanigans
		$('> span', this).css('display', 'block').hide();

		var $img = $('> img', this);

		$(this).hover(function() {
			$('> span', this).stop(false, true).fadeIn(fadeInSpeed);
	
		}, function() {
			$('> span', this).stop(false, true).fadeOut(fadeOutSpeed);
		});
	
	});
	
	
	$('li > ul').each(function(i) {
		var parent_li = $(this).parent('li');
		var sub_ul = $(this).remove();
		parent_li.wrapInner('<a/>').find('a').click(function() {
			sub_ul.toggle();
		});
		parent_li.append(sub_ul);
		if(!$(this).parent('li').hasClass('open'))
			$(this).hide();
		else
			$(this).show();
	});
	$('#productList').slideDown();

});

