$(window).load(function(){
						
	/* page fader
	
	$("body").fadeIn(2000);
	var i;
	$(".nav-main ul li a").click(function (a) {
		i = this.href;
		$("body").fadeOut(1500);
	});
	
	*/
	
	/* jQuery shuffle an unorderd list of li-tags
	
	(function($){
	   $.fn.shuffle = function() {
		 return this.each(function(){
		   var items = $(this).children();
		   return (items.length)
			 ? $(this).html($.shuffle(items))
			 : this;
		 });
	   }
	
	   $.shuffle = function(arr) {
		 for(
		   var j, x, i = arr.length; i;
		   j = parseInt(Math.random() * i),
		   x = arr[--i], arr[i] = arr[j], arr[j] = x
		 );
		 return arr;
	   }
	})(jQuery);
	
	$("#easy-slider ul").shuffle();
	
	*/

	
	/* easy slider */
	$("#easy-slider").easySlider({
		auto: 			true,
		speed: 			1000,
		pause:			5000,
		continuous: 	true
	});	
	

	/* flickr */
	$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=39628604@N08&lang=en-us&format=json&jsoncallback=?", displayImages);
	
	function displayImages(data) {
		var htmlString = "";
		$.each(data.items, function(i,item){
			var sourceSquare = (item.media.m).replace("_m.jpg", "_s.jpg");
			if ( i == 6 ) return false;
			htmlString += '<li><a href="' + item.link + '" title="' + item.title + '">';
			htmlString += '<img title="' + item.title + '" src="' + sourceSquare;
			htmlString += '" alt="'; htmlString += item.title + '" />';
			htmlString += '<span class="overlay"/></a></li>';
		});
		$('#flickr').html(htmlString);
	}

	
	/* navigation */
	$(".nav-main li").prepend("<span></span>");
	$(".nav-main li").each(function() { 
		var linkText = $(this).find("a").html();
		$(this).find("span").show().html(linkText);
	}); 
	
	$(".nav-main li").hover(function() {
		$(this).find("span").stop().animate({ 
			marginTop: "-16"
		}, 250);
	} , function() {
		$(this).find("span").stop().animate({
			marginTop: "0"
		}, 250);
	});
	
	
	/* twitter */
	$(".tweet").tweet({
	  username: "martijndevalk",
	  count: 1,
	  loading_text: "tweets worden geladen..."
	});
	
	
	/* scroll to top */
	$('.top').click(function(){
							 
	$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});

	
});