
// SLIDING FUNCTIONS

jQuery(function( $ ){
	
	/**
	 * Most jQuery.localScroll's settings, actually belong to jQuery.ScrollTo, check it's demo for an example of each option.
	 * @see http://www.freewebs.com/flesler/jQuery.ScrollTo/
	 * You can use EVERY single setting of jQuery.ScrollTo, in the settings hash you send to jQuery.LocalScroll.
	 */
	
	var target = $('#slider').get(0);//the scrolled div
	
	/**
	 * restart the scroll position to ( 0, 0 ) (Firefox doesn't reset it)
	 * could use $(target).scrollTo( 0, {axis:'xy'));
	 * but this needs to be quick(synchronous), to reset before $.localScroll.hash() begins
	 */
	/*target.scrollLeft = target.scrollTop = 0;*/
	
	//scroll initially if there's a hash (#something) in the url 
	/*$.localScroll.hash({
		target: target, //could be a selector or a jQuery object too.
		axis:'xy',//the default is 'y'
		queue:true,
		duration:1500
	});*/
	
	/*var $last = $([]);*///save the last link
	
	/**
	 * NOTE: In the former version of the demo, I called $('#navigation').localScroll()
	 * Now I want to also affect the >> and << links, so I'll use $.localScroll() instead
	 */
	/*$.localScroll({
		target: target, //could be a selector or a jQuery object too.
		axis:'xy',//the default is 'y'
		queue:true,
		duration:1200,
		hash:false,
		onBefore:function( e, anchor, $target ){//'this' is the clicked link
			this.blur();//remove the awful outline
			
		}
	});*/
	
			$('a.list_btn').click(function(){
				$('div.list').slideToggle("slow");
			});
	
			//by default, the scroll is only done vertically ('y'), change it to both.
			$.scrollTo.defaults.axis = 'xy'; 			
			//this one is important, many browsers don't reset scroll on refreshes
			$('div#content').scrollTo( 0 );//reset all scrollable panes to (0,0)
			$.scrollTo( 0 );//reset the screen to (0,0)
			

			
			//Target examples bindings
			var $paneTarget = $('#content');	
			
			$('#home_btn').click(function(){
				$paneTarget.stop().scrollTo( '0', 1000, {
					
				});
				$('div.list').slideUp("fast");
			});
			
			$('#activity_btn').click(function(){
				$paneTarget.stop().scrollTo( '800px', 1000, {
					
				});
				$('div.list').slideUp("fast");
			});
			
			$('#location_btn').click(function(){
				$paneTarget.stop().scrollTo( '1600px', 1000, {
					
				});
				$('div.list').slideUp("fast");
			});
			
			$('#rates_btn').click(function(){
				$paneTarget.stop().scrollTo( '2400px', 1000, {
					
				});
				$('div.list').slideUp("fast");
			});
			
						
			$('#contact_btn').click(function(){
				$paneTarget.stop().scrollTo( '3200px', 1000, {
					
				});
				$('div.list').slideUp("fast");
			});
			
			$('a.booking').click(function(){
				$paneTarget.stop().scrollTo( '3200px', 1000, {
					
				});
				$('div.list').slideUp("fast");
				$("#sparks").css({ left: "574px", width: "100px" });
			});
					
	
			
	var mysrc = '../flash/sparks_loader.swf';
	$('div#navigation ul ').after('<div id="sparks"></div>');
	
	
	$('#sparks').flash(
	{ src: mysrc,
	width: 200,
	height: 120,
	wmode: 'transparent'}, 
	{ update: false }
	);
	
	$("#sparks").css({ left: "15px", width: "100px" });
	
	
	$("ul.nav li.chalet a").click(
		function(){
			$("#sparks").css({ left: "15px", width: "100px" });
		}
	);
	$("ul.nav li.activity a").click(
		function(){
			$("#sparks").css({ left: "154px", width: "100px" });
		}
	);
	$("ul.nav li.location a").click(
		function(){
			$("#sparks").css({ left: "293px", width: "100px" });
		}
	);
	$("ul.nav li.rates a").click(
		function(){
			$("#sparks").css({ left: "433px", width: "100px" });
		}
	);
	$("ul.nav li.contact a").click(
		function(){
			$("#sparks").css({ left: "574px", width: "100px" });
		}
	);
		
	
});
