$(document).ready(function(){
	
$("#track-listing").jScrollPane({
					scrollbarWidth: 19,
					showArrows: true,
					scrollbarMargin: 0
				});

					
				



	$("#myController").jFlow({
		slides: "#mySlides",
		controller: ".jFlowControl", // must be class, use . sign
		slideWrapper : "#jFlowSlide", // must be id, use # sign
		selectedWrapper: "jFlowSelected",  // just pure text, no sign
		width: "920px",
		height: "250px",
		duration: 400,
		prev: ".jFlowPrev", // must be class, use . sign
		next: ".jFlowNext" // must be class, use . sign
		
	});


var clickGallery = {

	init: function() {
		var n = $('#gallery-image li').length;
		var x = 1;
		
		$('#gallery-image li:first-child').show();
		if (n > 1) {
			// only show the nav if there is more than one image
			$('#gallery-image').append('<div class="slideshow_controls"><div id="prev"></div><div id="next"></div></div>');				
		}
		
		$('#gallery-image .slideshow_controls #next').click(function() {
			var vis = $('#gallery-image li:visible').hide();
			if ($(vis).is('li:last-child')) {
				x = 1;
				$('li:first-child').show();
			} else {
				x += 1;
				$(vis).next().show();
			}
		});

		$('#gallery-image .slideshow_controls #prev').click(function() {
			var vis = $('#gallery-image li:visible').hide();
			if ($(vis).is('li:first-child')) {
				x = n;
				$('li:last-child').show();
			} else {
				x -= 1;
				$(vis).prev().show();
			}
		});
	}
	
};
	

clickGallery.init();

});// End doc ready
