//vertical scroll - product page - basket items 
	$JQ(document).ready(function(){	
		
		
	}); 

				
// vertical scroll script 
	$JQ(function()
	{
		$JQ('#vpane').jScrollPane();
		$JQ('#vpaneBasket').jScrollPane({scrollbarMargin:10});
	});


// vertical scroll - product page - basket items		
	$JQ(document).ready(function(){	
	    scrollBasket();						
	}); 
	
	function scrollBasket() {
	    var height;
		var totalHeight=0;
		var limitHeight=340;
		var productHeightMargin = 10;
		
		/* scrollbar on the items in the basket if there are too many to show at once */
		var basketItemHeight= 0;			
		

		// count width of product item divs
		$JQ('.basket .basketItem').each(function() { 
			var height = $JQ(this).height();
			totalHeight += height;	
			totalHeight += productHeightMargin;					
		});
							
		if (totalHeight < limitHeight) {		
			$JQ('.basket .jScrollPaneContainer').height(totalHeight);
		}
		
		basketItemHeight = $JQ('.basket .jScrollPaneContainer').height();		
		if(basketItemHeight > 340)
		{
			$JQ('.basket .jScrollPaneContainer').height(340);
			$JQ('.basket #vpaneBasket').height(340);
			$JQ('.basket .jScrollPaneTrack').show();
			$JQ('.basket #vpaneBasket').width(234);
		}
	}
	

// products page - horizontal scroll - width for the scroll div

    function productHScroll() {
		var width;
		var total=0;
		var limit=774;
		var productMargin = 8;

		// count width of product item divs
		$JQ('#products .item').each(function() { 
			var width = $JQ(this).width();
			total += width;	
			total += productMargin;						
		});
						
						
		// show/hide paneTrack
		if (total < limit) {
			$JQ('#products .jScrollPaneTrackHorizontal').hide();
		}
		else {
			$JQ('#products #hpaneWidth').width(total);
			$JQ('#products .jScrollPaneTrackHorizontal').show();
		}	
    }

	$JQ(document).ready(function(){	
        productHScroll();	
	}); 
	
	
	
	
	
// collection page - horizontal scroll - width for the scroll div
	$JQ(document).ready(function(){	
				
		var width;
		var total=0;
		var limit=818;
		var productMargin = 51;
		var count=0;

		// count width of collection item divs
		$JQ('#collections .collection').each(function() { 
			var width = $JQ(this).width();
			total += width;	
			total += productMargin;					
		});
										
		// show/hide paneTrack
		if (total < limit) {			
			$JQ('#collections .jScrollPaneTrackHorizontal').hide();			
			
		}
		else {
			$JQ('#collections #hpaneWidth').width(total);
			$JQ('#collections .jScrollPaneTrackHorizontal').show();
		}			
					
	}); 		
	
// horizontal scroll script
	$JQ(function() {
		var originalSizes = new Array();
		$JQ('#hpane').jScrollHorizontalPane();
	});
	

