
jQuery(function( $ ){
//borrowed from jQuery easing plugin
//http://gsgd.co.uk/sandbox/jquery.easing.php
$.scrollTo.defaults.axis = 'xy'; 
$.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 currentPage;

$(document).ready(
    function()
    {
		scrollOffset = $('#middle').offset().top;

		if (window.location.hash != '')
		{
			currentPage = window.location.hash;
			$.scrollTo(currentPage, 600, {offset: -(scrollOffset-5)}); //easing:'elasout'
			
		}
		
		$('#topMenu a, #headerLogo a').click(function(){

			goTo = $(this).attr('href');
			
			//if (goTo != currentPage)
			//{
				$.scrollTo(goTo, 700, {offset: -(scrollOffset-5)}); //easing:'elasout'
				//currentPage = goTo;
			//}
			return false;
		});
		
		// play with social links
		$('#socialLinks a').mouseover(function(){
			$(this).animate({bottom: '5px'}, 150).mouseout(function(){
				$(this).stop().animate({bottom: '0px'}, 100);
			});
		});
		
		/*
		$('.clientWorkBox').mouseover(function(){
			workImage = $(this).find('.workImage');
			workImage.stop().animate({marginTop: '-50px'}, 150);

		});
		
		$('.clientWorkBox').mouseout(function(){
			workImage = $(this).find('.workImage');
			workImage.stop().animate({marginTop: '0'}, 400);
		});
		*/
		
		$('.clientWorkBox').mouseover(function(){
			$(this).stop().animate({bottom: '10px', left: '3px'}, 250).mouseout(function(){
				$(this).stop().animate({bottom: '0px', left: '0'}, 200);
			});
		});
		
		// Make the contact member descriptions appear on hover
		$('.memberInfo').mouseover(function(){
			contactDesc = $(this).next('.contactDescription');
			contactDesc.css('opacity', 1);
			contactDesc.stop().fadeIn(450);
			
			$(this).mouseout(function(){
				contactDesc.stop().fadeOut(200);
			})
			
		})
    }
)

