<!--

$(document).ready(function() {

	var floaterVisible = false,
		folioNav = false;

	$(window).resize(function() {
		var floaterHeight = $(window).height() - $('#header_content').outerHeight() - 89 - 34 - 21;
		if ( floaterHeight > 400 ) {
			$('#floater').css("height", 400);
		} else if ( floaterHeight > 200 ) {
			$('#floater').css("height", floaterHeight);
		} else {
			$('#floater').css("height", 200);
		}
		$('#floater_content').jScrollPane({maintainPosition: false}).data('jsp').reinitialise();
	});
	
	$('#floater_content').jScrollPane();
	
	$(window).resize();

	function set_cookie(name, value) {
		var cookie_string = name + "=" + escape(value);
		document.cookie = cookie_string;
	}
	
	function get_cookie(cookie_name) {
		var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
		if ( results )
			return (unescape(results[2]));
		else
			return null;
	}

	$('#header').hover(
		function () {
			$(this).stop().animate({top: "0px"}, 750, 'easeOutQuart');
		}, 
		function () {
			if ( !folioNav ) $(this).stop().animate({top: "-117px"}, 750, 'easeOutQuart');
		}
	);
	
	$('.main_nav').click(function(e) {
		e.preventDefault();
		var content = $(this).attr('href');
		var api = $('#floater_content').jScrollPane({maintainPosition: false}).data('jsp');
		$('#header').animate({top: "-117px"}, 500, 'easeOutQuart');
		if ( floaterVisible ) {
	    	$('#floater').animate({left: "-640px"}, 500, 'easeOutQuart', function() {
				api.getContentPane().load(content, function() {api.reinitialise()});
	    	});
		} else {
			api.getContentPane().load(content, function() {api.reinitialise()});
		}
    	$('#floater').animate({left: "235px"}, 750, 'easeOutQuart', function(){floaterVisible = true;});
	});

	$('.folio_nav').click(function(e) {
		e.preventDefault();
		var content = $(this).attr('href');
	    $(Galleria.get(0).getActiveImage()).fadeTo(400, 0);
	    folioNav = true;
		$('#header').animate({top: "-117px"}, 500, 'easeOutQuart', function(){window.location.href = content; folioNav = false;});
    	$('#floater').animate({left: "-640px"}, 500, 'easeOutQuart', function(){floaterVisible = false;});
	});	

	$('.splash_folio_nav').click(function(e) {
		e.preventDefault();
		var content = $(this).attr('href');
		$('#splash').fadeOut(750, 0);
		$('#header_content').animate({top: "-117px"}, 750, 'easeOutQuart', function(){window.location.href = content});
    	$('#floater').animate({left: "-640px"}, 500, 'easeOutQuart', function(){floaterVisible = false;});
	});	

	$('#floater_close').click(function() {
    	$('#floater').animate({left: "-640px"}, 500, 'easeOutQuart', function(){floaterVisible = false;});
	});	
	
	// drop down menu
    $('#menu li').hover(
        function () {
            $('ul', this).stop(true, true).delay(33).slideDown(300);
        },
        function () {
            $('ul', this).stop(true, true).slideUp(300);        
        }
    );
    
});

//-->
