
/* #product-scroll 

 

#scrolling-content

.row

#product-scroll-nav .left-button 
#product-scroll-nav .right-button

*/

function productScroll(ele) {
	
	var contWidth = 960
	var scrollWidth = contWidth;
	var curPos = 1;	
	var scrollitems = ele.find('.product-row').length;
	
	ele.find('.right-button').click(function(){
		
		if (curPos == 0 ) { curPos = 1; }
	
		if (curPos < scrollitems) {	
			ele.find('.left-button').removeClass('left-disabled');	
			scrollWidth = (curPos * contWidth);
			ele.find('.scrolling-content').animate({ 
				'margin-left' : '-'+scrollWidth 
			}, 500);	
			curPos++;
			if (curPos == scrollitems){
				ele.find('.right-button').addClass('right-disabled');
			}
		}  
	});
	
	ele.find('.left-button').click(function(){
			curPos--;
		if (curPos > 0) {
			ele.find('.right-button').removeClass('right-disabled');
			scrollWidth = (scrollWidth - contWidth);
			ele.find('.scrolling-content').animate({
				'margin-left' : '-'+scrollWidth
			}, 500, function(){
			});
			
			if (curPos == 1) {
				ele.find('.left-button').addClass('left-disabled');
			}
			
		} 
	});
	

	
}
