jQuery(function( $ ){
	//borrowed from jQuery easing plugin
	//http://gsgd.co.uk/sandbox/jquery.easing.php
	$.easing.elasout = function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	};	

/*
$('button').click(function(){//this is not the cleanest way to do this, I'm just keeping it short.
		var index = parseInt( $(this).prev('input').val() ) || 0;
		var $c = $(this).parent().next();
		//alert($c.attr('class')+' '+index);
		$c.stop().scrollTo('li:eq('+index+')', {speed:2500, easing:'elasout',axis:'y'});
	});
	*/
	
	

$(".nav").click(function () { 
    var id = $(this).attr("navTo");
	var $c = $(this).parent().next();
	//alert($c._scrollable());
	//alert($(this).parent().next().attr('id'));
//	$c.stop().scrollTo('li:eq('+index+')', {speed:500, easing:0,axis:'y'});
	
	$c.stop().scrollTo('p#'+id, {speed:500, easing:0,axis:'y'});
	return false;
});


$(".nav3").click(function () { 
    var id = $(this).attr("navTo");
	var $c = $(this).parent().parent().parent().parent().parent().parent().parent().parent().next();
	//alert($c.attr('id'));
	//alert($c._scrollable());
	//alert($(this).parent().next().attr('id'));
//	$c.stop().scrollTo('li:eq('+index+')', {speed:500, easing:0,axis:'y'});
	
	$c.stop().scrollTo('p#'+id, {speed:500, easing:0,axis:'y'});
	return false;
});




	$('.container .back').click(function(){
		var $c = $(this).parents('.container');

//		alert($c.attr('id'));
		$c.stop().scrollTo(0, {speed:500,axis:'y', queue:true} );
		return false;
	});

/*
	$('.tabs a').click(function(){
		var $c = $('#container1');
		$c.stop().scrollTo( 0, {speed:500,axis:'y', queue:true} );
		return false;
	});
	
	*/
});


