/**
 * Simple Scroller
 * @author adamh
 */

$(function() {
	// featured products
    var featuredProductsScoller = {
		orientation: "vertical",
		max: 100,
		min: 0,
		value: 85,
		slide : function(event, ui){
			var myContent = $(this).siblings().find('.veritcal_scroll_content');
			$contentY = -((($(myContent).height() - 80) / 100) * (100 - ui.value));
			$(myContent).css('top', $contentY + 'px');
		}
	};
	
	//New Simple Scroller
	$('#featured_products').simpleScroller({
		itemWidth : 237
		,autoScroll : true
		,autoEasing : 'swing'
		,autoDelay : 4500
		,autoSpeed : 1200
        ,beforeClone : function(target) {
            $(target).find('.vertical_slider').slider( "destroy" );
        }
        ,afterAppend : function(target) {
            $(target).find('.vertical_slider').slider(featuredProductsScoller);
        }
	});
	
	$('#bestsellers').simpleScroller({
		itemWidth : 142
		,autoScroll : true
		,autoEasing : 'swing'
		,autoDelay : 4500
		,autoSpeed : 800
	});
	
	$('#associated_products').simpleScroller({
		itemWidth : 137
		,width : 685
		,autoScroll : true
		,autoEasing : 'swing'
		,autoDelay : 4500
		,autoSpeed : 800
	});
	
	//	Sliders for featured products
	$('.vertical_slider').slider(featuredProductsScoller);
});

