// gallery fade - thanks to http://www.sohtanaka.com/web-design/greyscale-hover-effect-w-css-jquery/

	$(document).ready(function() {
		$("#work ul li").hover(function() {
		var thumbOver = $(this).find("img").attr("src");
		$(this).find("a.gallery").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
		$(this).hide()
		}); } , function() {
		$(this).find("span").stop().fadeTo('normal', 1).show();
	}); });


// fancy box

	$(document).ready(function() {	$("a.gallery").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack',
		'overlayShow'	:  true,
		'overlayColor'	: 'rgb(26,26,26)',
		'overlayOpacity': .7,
		'titlePosition'	: 'inside'
	}); });


// validate

	$(document).ready(function(){
		$("#contactForm").validate();
	});


// smooth scrolling

	var jump=function(e) {
       //prevent the "normal" behaviour which would be a "hard" jump
       e.preventDefault();
       //Get the target
       var target = $(this).attr("href");
       //perform animated scrolling
       $('html,body').animate(
       {
               //get top-position of target-element and set it as scroll target
               scrollTop: $(target).offset().top
       //scrolldelay: 1 second
       },1000,function()
       {
               //attach the hash (#jumptarget) to the pageurl
               location.hash = target;
       });
	}

	$(document).ready(function() {
    	$('a[href*=#]').bind("click", jump);
    	return false;
	});


// google analytics

var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-12016474-1']);
	_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
