$(document).ready(function(){
	$("a.fancy").fancybox({
		'titleShow' : false,
		'transitionIn' : 'fade',
		'transitionOut' : 'fade'
	});
	$("a.bel-mij-terug").fancybox({
		'titlePosition' : 'inside',
		'transitionIn' : 'fade',
		'transitionOut' : 'fade'
	});

	$("#header ul li").hover(function(){
		$("ul", this).fadeIn(250);
	},function(){
		$("ul", this).fadeOut(0);
	});
	
	$('.project > div').hover(function(){
		$(this).stop().animate({"width": "540px"},{"queue":"false","duration":"500"});
		$(this).find("span").stop().fadeOut(500);
		$(this).find("p").stop().animate({"height": "140px"},{"queue":"false","duration":"500"});
	},function(){
		$(this).stop().animate({"width": "190px"},{"queue":"false","duration":"500"});
		$(this).find("span").stop().fadeIn(500);
		$(this).find("span").css("opacity","1");
		$(this).find("p").stop().animate({"height": "0px"},{"queue":"false","duration":"500"});
	});
	
	$('.large > div').hover(function(){
		$(this).stop().animate({"width": "580px"},{"queue":"false","duration":"500"});
		$(this).find("span").stop().fadeOut(500);
		$(this).find("p").stop().animate({"height": "155px"},{"queue":"false","duration":"500"});
	},function(){
		$(this).stop().animate({"width": "230px"},{"queue":"false","duration":"500"});
		$(this).find("span").stop().fadeIn(500);
		$(this).find("span").css("opacity","1");
		$(this).find("p").stop().animate({"height": "0px"},{"queue":"false","duration":"500"});
	});
	
	$("a[href=#top]").click(function(){
		$("html, body").animate({scrollTop:0}, 750);
		return false;
	});
});

$(function(){
	var msie6 = $.browser == 'msie' && $.browser.version < 7;
	if (!msie6) {
		var top = $('#side-bar').offset().top - parseFloat($('#side-bar').css('margin-top').replace(/auto/, 0));
		$(window).scroll(function(event){
			var y = $(this).scrollTop();
			if (y >= top - 20){$('#side-bar').addClass('fixed');}
			else {$('#side-bar').removeClass('fixed');}
		});
	}
});
