/* Portfolio Controls */
jQuery(function( $ ){
	$('.portCtrl').fadeTo(0, 0.7);
	$('.portCtrl').hover(function(){
		$(this).fadeTo(350, 1.0);
	}, function(){
		$(this).fadeTo(350, 0.7);
	});
	
	$.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;
	};

	var itemSize = $('div.portfolioPost').size();
	var containerWidth = itemSize*240;
	$('#postContainer').css({'width': containerWidth })
	var endPoint = 0-containerWidth+961;
	$('.olderEvents').click(function () {
		var slidePos = $('#postContainer').position();
		if (slidePos.left<=endPoint) {
			$('#slideScreen').scrollTo('-='+containerWidth, 1000 );
		} else {
			$('#slideScreen').scrollTo('+=480', 500 );
    	}	
    });
    
    $('.newerEvents').click(function () {
		var slidePos = $('#postContainer').position();
		if (slidePos.left==0) {
			$('#slideScreen').scrollTo('+='+containerWidth, 1000);
		} else {
			$('#slideScreen').scrollTo('-=480', 500 );
		}
    });
});

/* Portfolio Thumbs */
jQuery(function( $ ){
	var height = $('.thumbScreen img').height();
	var width = $('.thumbScreen img').width();
	
	$('.thumbScreen img').fadeTo(0, 0.85);
	$('.thumbScreen').hover(function(){
		$(this).find('img').stop(false,true).animate({ 
			top: -13,
			left: -56,
			height : height*.6, 
			width : width*.6, 
			opacity: 1.0 
		}, 500, 0);
	}, function(){
		$(this).find('img').stop(false,true).animate({ 
			top: -51,
			left: -176,
			height : height, 
			width : width, 
			opacity: 0.85 
		}, 500, 0);
	});
});	

