
$(document).ready(function() {	

	//***********************************************
	//Easy slider
	//***********************************************
	$("#banner").easySlider({auto: true, continuous: true, numeric:true, pause:6500, speed:800});

	//***********************************************		
	//URL SHARING
	//***********************************************
	$('#share li a').click(function(evt){	
		var url = $(this).attr("href");
		evt.preventDefault();
		openWindow(url);	
	});	
	function openWindow(url) {
		var width = 600;
		var height = 500;
		var left = (screen.width - width)/2;
		var top = (screen.height - height)/2;
		var params = 'width='+ width +', height='+ height+', top='+ top +', left='+ left+ ', resizable=1';
		newwin = window.open(url,'', params);
		if (window.focus) {newwin.focus()}
		return false;
	}

	$("#gallery a").prettyPhoto({
		show_title: false,
		deeplinking: false,
		social_tools: false
		//,theme: 'dark_rounded'
	});
	
	//Set here states of nested posts
	var url= window.location.href.split("/");
	var urlLength = url.length;
	var newurl = urlLength -3//;
	url= url[newurl];	
	//alert(url);
	if(url == "portfolio"){
		$('li#menu-item-29').addClass("current_page_item");
	}
	if(url == "blog"){
		$('li#menu-item-31').addClass("current_page_item");
	}
	//***********************************************
	//Scroll to comments
	//***********************************************
	$('a.scroll').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 700);
		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)
	
		
		
		
});



