$(document).ready(function() {
	
		$('.fancify').live('mouseenter', function(){ 				
		$(this).fancybox({
			'width'	:806,
			'height' : 770,
			'transitionIn': 'fade',
			'transitionOut': 'fade',
			'titlePosition': 'over',
			'easingIn': 'easeOutBack',
			'easingOut': 'easeInBack',
			'type': 'iframe',
			'href' : $(this).attr('href')
		}); 
		//return false;
});
						   
	var hash = window.location.hash.substr(1);
	var href = $('#nav li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){ 
			var toLoad = hash+'.html #content';
			$('#content').load(toLoad)
		}											
	});

	$('.thumbnails li a').click(function(){
								  
		var toLoad = $(this).attr('href')+' #content';
		
	
		
		$('#content').fadeOut('easingOut: easeInBack', loadContent );/*.hide('fast',loadContent);*/
		$('#load').fadeOut();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('easingIn: easeOutBack');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#content').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#content').fadeIn('easingIn: easeOutBack',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('easingOut: easeInBack');
		}
		return false;
		
	});


});
