	$(document).ready(function() { 		

		$('.fade').fadeIn('slow');
		
		$('#navigation ul li ul').each(function() {
			$(this).height($(this).height()).hide();
		});
		
		$('#navigation ul li.section').children('ul').show();
		$('#navigation ul li.current').children('ul').show();
		
		$('#navigation ul li a.children').click(function() {
			
			if ($(this).siblings("ul :hidden").length > 0) {
				$('#navigation ul li ul').slideUp('slow');
				$(this).siblings("ul").slideToggle('slow');
			}
			else if ($(this).siblings("ul :visible").length > 0) {
				$(this).siblings("ul").slideToggle('slow');
			}
			return false;
			
		});
		
		$('#gallery-images-wrap').cycle({ 
		    fx:     'fade', 
		    speed:  'slow', 
		    timeout: 0, 
		    pager:  '#gallery-pagination p', 
		    before:  onBefore, 
		    after:   onAfter 
		});
		
		function onBefore() { 
			if ($('#gallery-text p').length > 0) {
				$('#gallery-text p').fadeOut('fast'); 
			}
		} 
		function onAfter() { 
			if ($('#gallery-text p').length > 0) {
			    $('#gallery-text p').html(this.alt).fadeIn('fast'); 
			}
		}
		
		$('.news-gallery-images-wrap').each(function(){
			
			var $this = $(this);
			
			$this.cycle({
				fx:     'fade', 
			    speed:  'slow', 
			    timeout: 0, 
			    pager:  $this.siblings('.news-gallery-pagination').find('p')
			});
			
		});	
		
		$("a.transition").click(function(event){
			event.preventDefault();
			linkLocation = this.href;
			if ($('.fade').length) { // implies *not* zero
				if ($("#supersized").length) {
					$("#supersized").fadeOut(1000);
				}
				$(".fade").fadeOut(1000, redirectPage);
			} else {
				redirectPage()
			}			
		});

		function redirectPage() {
			window.location = linkLocation;
		}	
		

	});

