/* Author: 
	Toby Trembath Jan 2012
	www.twobyte.com
*/

// Define the entry point
$(document).ready(function()
{
	// customize scrollbar here
	var JSsettings = {
		showArrows: false
	};
	var LBsettings = {
		imageLoading:			'images/lightbox/lightbox-ico-loading.gif',
		imageBtnPrev:			'images/lightbox/lightbox-btn-prev.gif',
		imageBtnNext:			'images/lightbox/lightbox-btn-next.gif',
		imageBtnClose:			'images/lightbox/lightbox-btn-close.gif',
		imageBlank:				'images/lightbox/lightbox-blank.gif'
	};
	// set reference to scrollbar api
	var api;
	//var timeout;
	// initialize scrollbar
	fixWidth();
	
	function fixWidth()
	{
		if (typeof api != "undefined") {
        	// object exists ... 
			// destroy it so we can rebuild after resize.
			api.destroy();
			
		}
		//alert($(window).width());
		//api.reinitialise();
		api = $('.scroll-pane').width($(window).width()).jScrollPane(JSsettings).data().jsp;
		
		//timeout = setTimeout(hideScroll, 2500);
		//$('.jspTrack').hide();
		
		/*$('.jspScrollable').mouseenter(function(){
			clearTimeout(timeout);
			$('.jspTrack').stop(true, true).fadeIn('slow');
		});
		
		$('.jspScrollable').mouseleave(hideScroll);
		
		function hideScroll(){
			$('.jspTrack').stop(true, true).fadeOut('slow');
			clearTimeout(timeout);
		}*/
	}
	
	$(window).resize(function() {
		fixWidth();
	});
	/*$(window).load(function () {
		fixWidth();
	});*/
	// get your lightbox on.
	$('#gallery a').lightBox(LBsettings);
});

