
$(document).ready(function() {	

	//initialize easy slider
	$("#slider").easySlider({auto: true, continuous: true, pause:10000, speed:1000});
	
	//Set here states of nested posts
	var url= window.location.href.split("/");
	var urlLength = url.length;
	var newurl = urlLength -2//;
	url= url[newurl];	
	//alert(url);
	if(url == "case-studies"){
		$('li#menu-item-273').addClass("current-menu-item");
	}
	if(url == "blog"){
		$('li#menu-item-153').addClass("current-menu-item");
	}

		
	//work menu
	$('#work ul li').each(function () {	
		var $span = $('h3', this).css({'opacity': '0', 'bottom':'-48px'});		
		$(this).hover(function () {		
			$span.stop().animate({ bottom: 0+'px', opacity:1 }, { queue:false, duration:300, easing: 'easeInOutQuart'});
			
		}, function () {	
			$span.stop().animate({ bottom: -48+'px', opacity:0 }, { queue:false, duration:300, easing: 'easeInOutQuart'});
		});
	});
	
	
	$('#work ul li:last-child').addClass('last');
	
	
	//Scroll to comments
	$('a.scroll').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 700, { easing:'elasout' });
		return false;
	});	
	
	$.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;
	};	
	//$('div.pane').scrollTo( 0 );//reset all scrollable panes to (0,0)
	//$.scrollTo( 0 );//reset the screen to (0,0)
	
		
		
		
});



