$(document).ready(function() {
						   
	// ----------------------------------------------------------------------
	// Feast
	// ----------------------------------------------------------------------


	
	$.address.change(function(event) { 
							  						  
		$('#videoPlayer').html('');
		
		switch(event.value){
			
			case "/":
				$("div.panes").height($("div#side").height());	
				break;						
			case "/about_the_show":
				$("div.panes > div.content").fadeOut("slow", function(){															  
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#about_the_show").fadeIn("slow");							
					};		
				});	
				// Set page height 
				if ($("div#about_the_show").height() > $("div#side").height()){
					$("div.panes").height($("div#about_the_show").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}	
				break;
			case "/tickets_and_info":
				$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#tickets_and_info").fadeIn("slow");
					};		
				});		
				// Set page height 
				if ($("div#tickets_and_info").height() > $("div#side").height()){
					$("div.panes").height($("div#tickets_and_info").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}					
				break;	
			case "/getting_there":
				$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#getting_there").fadeIn("slow");
					};			
				});	
				// Set page height 
				if ($("div#getting_there").height() > $("div#side").height()){
					$("div.panes").height($("div#getting_there").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}				
				break;	
			case "/packages":
				$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#packages").fadeIn("slow");
					};			
				});	
				// Set page height 
				if ($("div#packages").height() > $("div#side").height()){
					$("div.panes").height($("div#packages").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}		
				break;		
			case "/faqs":
				$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#faqs").fadeIn("slow");
					};			
				});		
				// Set page height 
				if ($("div#faqs").height() > $("div#side").height()){
					$("div.panes").height($("div#faqs").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}
				break;	
			case "/book_info":
				$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#tickets_and_info").fadeIn("slow");
					};		
				});		
				// Set page height 
				if ($("div#tickets_and_info").height() > $("div#side").height()){
					$("div.panes").height($("div#tickets_and_info").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}		
				break;	
			case "/voucher_info":
				$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#tickets_and_info").fadeIn("slow");
					};		
				});		
				// Set page height 
				if ($("div#tickets_and_info").height() > $("div#side").height()){
					$("div.panes").height($("div#tickets_and_info").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}					
				break;						
			case "/neverland_info":
				$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#tickets_and_info").fadeIn("slow");
					};		
				});		
				// Set page height 
				if ($("div#tickets_and_info").height() > $("div#side").height()){
					$("div.panes").height($("div#tickets_and_info").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}					
				break;	
			case "/home":
				$("div.panes > div.content").fadeOut("slow");
				$("div.panes").height($("div#side").height());					
				break;	
			case "/video":
					$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#video").fadeIn("slow");
					};	
				});		
				// Set page height 
				if ($("div#video").height() > $("div#side").height()){
					$("div.panes").height($("div#video").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}	
				// Inline function
				AddVideo();				
				break;	
			case "/contact":
					$("div.panes > div.content").fadeOut("slow", function(){
					if ($(this).attr('id') == $("div.panes > div.content:last").attr('id')) {
						$("div#contact").fadeIn("slow");
					};	
				});		
				// Set page height 
				if ($("div#contact").height() > $("div#side").height()){
					$("div.panes").height($("div#contact").height() + 120);	
				} else {
					$("div.panes").height($("div#side").height());
				}			
				break;					
		};	
	});  	


	// Assign link actions
	$("a.link, a.rightInfo, a#neverlandbook").click(function(event){	
	    $.address.value($(this).attr('href'));  		
		event.preventDefault();			
	});		
	

	
});
