$(document).ready(function(){	

		$('.home div.slider img').each (function( i, el ) {
			$('<div class="figcaption"><h2>'+$(this).attr('alt')+'</h2><p>'+$(this).attr('title')+'</p></div>').insertAfter(el);
		});
		// Easy Slider 
		$('div.slider').easySlider({
			auto: false,
			continuous: true, 
			numeric: true,
			controlsBefore: '<div class="slider-controls">',
			controlsAfter: '</div>'
		});
		$('body:not(.home) div.slider-controls #prevBtn, body:not(.home) div.slider-controls #nextBtn').css('bottom', function() {
			return ($(this).parent().siblings('.slider').height() / 2)+'px';
		});
		$('body:not(.home) div.slider-controls #prevBtn, body:not(.home) div.slider-controls #nextBtn').hide();
		$('body:not(.home) div.slider').parent('.header-image').hover(
			function() {
				$(this).find('#prevBtn, #nextBtn').fadeIn('300');
			},
			function() {
				$(this).find('#prevBtn, #nextBtn').fadeOut('300');				
			}
		);
		
		$('body:not(.home) div.slider li .flash').parent('li').height(function() {
			var h = $(this).height();
			$(this).siblings('li').each(function() {
				h = ($(this).height() > h) ? $(this).height() : h;
			});
			return h;
		});
		$('body:not(.home) div.slider li .flash').parent('li').css('line-height', function() { return $(this).height()+'px'; }); 
		
		$('.werk .gallery a').hover(
			function() {
				$(this).find('figure img:last').fadeOut('300');
			},
			function() {
				$(this).find('figure img:last').fadeIn('300');
			}
		);
		
		
	// Page transitions
	$("#container").css("display", "none");
	
    $("#container").fadeIn(1000);
	
});	
