$(document).ready(function() {
		
		
	//Get Selected Nav
	var url= window.location.href.split("/");
	var urlLength = url.length;
	url= url[urlLength-1];
	url = url.split(".");
	url = url[0];
	if(url == ""){
		$('#nav ul li#index').addClass("selected");
	}
	else{
		$('#nav ul li#' +url).addClass("selected");
	}
	//alert(url);
	
	
	
	//Back 2 Top
	$.easing.elasout = function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
		
	//this one is important, many browsers don't reset scroll on refreshes
	$('div.pane').scrollTo( 0 );//reset all scrollable panes to (0,0)
	$.scrollTo( 0 );//reset the screen to (0,0)			
	//TOC, shows how to scroll the whole window
	$('#snav li a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 700, { easing:'elasout' });
		return false;
	});	

});
