$(document).ready(function(){	var easestyle = 'easeInQuad';	var myspeed = 400;	var mydelay = 2000;	//var easestyle = 'easeOutBounce';	var container = $('div.sliderGallery');	var ul = $('ul', container);	//var mycursorfix = $('div.sliderContainer');	//mycursorfix.css('cursor','pointer');	var itemsWidth = 3891; 	//var itemsWidth = ul.innerWidth() - container.outerWidth();		//$(this).children('div:first').stop(false,true).animate({top:0},{duration:200, easing: style}); 		$('.slider', container).slider({		min: 0,		max: itemsWidth,		handle: '.ui-slider-handle',		animate: true,		stop: function (event, ui) {						//ul.css('left', ui.value * -1);				//$('.slider', container).slider.stop(1,1).css('left', ui.value * -1);				//ul.stop(0,0).animate({'left' : ui.value * -1},{duration:myspeed, easing: easestyle});			 					},		slide: function (event, ui) {			//ul.css('left', ui.value * -1);				//if( $(event.originalTarget).equals($('#scrollbarLabel-1')) | $(event.originalTarget).equals($('#scrollbarLabel-2')) | $(event.originalTarget).equals($('#scrollbarLabel-3'))	| $(event.originalTarget).equals($('#scrollbarLabel-4')) | $(event.originalTarget).equals($('#scrollbarLabel-5')) ) {			//	$(".sliderGallery .slider").slider('value', ui.value);			//	return false;			//} else {				ul.stop(0,1).animate({'left' : ui.value * -1},{duration:myspeed, easing: easestyle});			//}		}	});		function animateSlider(elValue){			// BINDING FAIL		//$('.selector').bind('slidestop', function(event, ui) {		//  ...		//});		//$('.slider', container).slider('value', elValue) // line up the scroller perfectly				// CHAINING FAIL		//$(".sliderGallery ul").stop(0,1).animate({'left' : elValue * -1},{duration:myspeed, easing: easestyle}, function(){		//	$('.slider', container).slider('value', elValue);		//});		//ul.css('left', ui.value * -1);					$(".sliderGallery ul").stop(0,0).animate({'left' : elValue * -1},{duration:myspeed, easing: easestyle}); // reposition  images after stop to perfect		$('.slider', container).slider('value', elValue); // line up the scroller perfectly		//$(".sliderGallery .scroller").stop(0,0).animate({'left' : elValue / itemsWidth * 100},{duration:myspeed, easing: easestyle});		//$('.slider', container).wait(myspeed).slider('value', elValue); // line up the scroller perfectly					}   $(".btn-left").click(function(){	    var elValue = $('.slider', container).slider('option', 'value');		if(elValue > 0) {			elValue = elValue - 100;			if(elValue < 0) {				elValue = 0;			}			animateSlider(elValue);		}	});	$(".btn-right").click(function(){	  var elValue = $('.slider', container).slider('option', 'value');		if(elValue < itemsWidth) {			elValue = elValue + 100; 			if(elValue > itemsWidth) {				elValue = itemsWidth;			}			animateSlider(elValue);		}	});	function gotoStart(){		var elValue = $('.slider', container).slider('option', 'value');		elValue = 0;		animateSlider(elValue);	};	$("span.start").click(gotoStart);	$("a#scrollbarLabel-1").click(gotoStart);	$("a#scrollbarLabel-2").click(function(){	  var elValue = $('.slider', container).slider('option', 'value');		elValue = 0.24877923 * itemsWidth;		animateSlider(elValue);	});	$("a#scrollbarLabel-3").click(function(){	  var elValue = $('.slider', container).slider('option', 'value');		elValue = 0.499871 * itemsWidth;		animateSlider(elValue);	});	$("a#scrollbarLabel-4").click(function(){	  var elValue = $('.slider', container).slider('option', 'value');		elValue = 0.749936 * itemsWidth;		animateSlider(elValue);	});	function gotoEnd(){	  var elValue = $('.slider', container).slider('option', 'value');		elValue = itemsWidth;		animateSlider(elValue);	};	$("span.end").click(gotoEnd);	$("a#scrollbarLabel-5").click(gotoEnd);		// Setup Keyboard Functionality for tabs	$(document.documentElement).keyup(function (event) {		var direction = null;		// handle cursor keys		if (event.keyCode == 37) {		  // slide left		  direction = 'prev';		} else if (event.keyCode == 39) {		  // slide right		  direction = 'next';		}		if (direction != null) {		  $('.tabnavigation li a.selected').parent()[direction]().find('a').click();		}	});			$(document).ready( function() {		// if there is an anchor link, goto it.		  if (window.location.hash) {			  var myhash = window.location.hash.substr(1);			  //console.log(myhash);			  if ( myhash === 'showFullyear' ) {				//$("a#scrollbarLabel-1").delay(mydelay).click();				elValue = 0;				$(".sliderGallery ul").stop(0,0).css('left', elValue * -1); // reposition  images after stop to perfect				$('.slider', container).slider('value', elValue); // line up the scroller perfectly			  } else if ( myhash === 'showSemester') {				//$("a#scrollbarLabel-2").click();				elValue = 0.24877923 * itemsWidth;				$(".sliderGallery ul").stop(0,0).css('left', elValue * -1); // reposition  images after stop to perfect				$('.slider', container).slider('value', elValue);			  } else if ( myhash === 'showSummer2credit') {				//$("a#scrollbarLabel-3").click();				elValue = 0.499871 * itemsWidth;				$(".sliderGallery ul").stop(0,0).css('left', elValue * -1); // reposition  images after stop to perfect				$('.slider', container).slider('value', elValue);			  } else if ( myhash === 'showSummer1credit') {				//$("a#scrollbarLabel-4").click();				elValue = 0.749936 * itemsWidth;				$(".sliderGallery ul").stop(0,0).css('left', elValue * -1); // reposition  images after stop to perfect				$('.slider', container).slider('value', elValue);			  } else if ( myhash === 'showOnline') {				//$("a#scrollbarLabel-5").click();				elValue = itemsWidth;				$(".sliderGallery ul").stop(0,0).css('left', elValue * -1); // reposition  images after stop to perfect				$('.slider', container).slider('value', elValue);			  }		} else {			gotoStart();		}	});});
