(function($,window,undefined){

$(function()
		{
			var pane = $('.scroll-pane');
			pane.jScrollPane(
				{
				animateScroll: true,
				animateDuration: 300,
				animateEase: 'linear',
				verticalDragMaxHeight: 100,
				horizontalDragMaxWidth: 100,
				autoReinitialise: true
			}
		);
		
		var api = pane.data('jsp');
		
		$('#upArrow').bind(
		'click',
		function()
			{
			api.scrollByY(-380);
			return false;
			}
		);
		
		$('#downArrow').bind(
		'click',
		function()
			{
			api.scrollByY(380);
			return false;
			}		
		);
		
		$('#arrowScrollerLeft').bind(
		'mouseover',
		function()
			{
			document.getElementById('scrollForward').style.display = "block";
			}
		);
		
		$('#arrowScrollerLeft').bind(
		'click',
		function(){
			var thisWidth = document.documentElement.clientWidth - 60;	
			api.scrollByX(thisWidth,true);
			return false;
			}
		);
		
		$('#arrowScrollerLeft').bind(
		'mouseout',
		function(){
			document.getElementById('scrollForward').style.display = "none";
			return false;
			}
		);

		$('#arrowScrollerRight').bind(
		'mouseover',
			function()
			{
			document.getElementById('scrollBackward').style.display = "block";
			}
		);
		
		$('#arrowScrollerRight').bind(
		'click',
			function(){
			var thisWidth = -(document.documentElement.clientWidth - 80);	
			api.scrollByX(thisWidth,true);
			return false;
			}
		);
		
		$('#arrowScrollerRight').bind(
		'mouseout',
			function(){
			document.getElementById('scrollBackward').style.display = "none";
			return false;
			}
		);
	
		$(window).bind(
				'resize',
				function()
				{
					if ($.browser.msie) {
						if (!throttleTimeout) {
							throttleTimeout = setTimeout(
								function()
								{
									api.reinitialise();
									throttleTimeout = null;
								},
								50
							);
						}
					} else {
						api.reinitialise();								
					}
				}
			);
	});

})(jQuery,this);	
