/* DJ AM */
/* Slider Navigation
----------------------------------------------------------------------------- */

	$(document).ready(function() {
	
		$('div.ui-slider-handle').hide();

	});

	$(window).load(function() {
		
		$('div.ui-slider-handle').show();

		$('#slider').slider();

		// Define Navigation Ranges
		$('div.ui-slider-handle').mouseup(function() { navigate($(this).css('left')); });
		
		function navigate(xPos) {
		
			// Define Navigation Positions
			var home = 59;
			var amlive = 171;
			var amnow = 282;
			var photos = 393;
			var press = 505;
			var deckstar = 1000;

			var xPos = xPos.replace('px','');

			if (xPos < home) {
			
				window.location = "/home";
			
			} else if (xPos > home && xPos < amlive) {

				window.location = "/events";
			
			} else if (xPos > amlive && xPos < amnow) {

				window.location = "/blog";
				
			} else if (xPos > amnow && xPos < photos) {

				window.location = "/photos";
				
			} else if (xPos > photos && xPos < press) {

				window.location = "/press";
				
			} else if (xPos > press && xPos < deckstar) {

				window.location = "/deckstar";
			
			}
		
		}

		// Adjust Inclination of Slider Handle
		$('div.ui-slider-handle').mousemove(function() { incline($(this).css('left')); });
		
		function incline(xPos) {

			var yPos = Math.round(xPos.replace('px','') * .02);

			$('div.ui-slider-handle').css('bottom',yPos + "px");
		
		}	
		

		// Define Page Positions
		
		if (section == "home") {
		
			$('div.ui-slider-handle').css('left','0px');
		
		} else if (section == "events") {
		
			$('div.ui-slider-handle').css('left','114px');
			
		} else if (section == "amnow") {
		
			$('div.ui-slider-handle').css('left','230px');
			
		} else if (section == "photos") {
		
			$('div.ui-slider-handle').css('left','340px');
			
		} else if (page == "press") {
		
			$('div.ui-slider-handle').css('left','449px');
			
		} else if (page == "deckstar") {
		
			$('div.ui-slider-handle').css('left','556px');
		
		}
		
		incline($('div.ui-slider-handle').css('left'));

	});
