var root_url = "";
var url = "";

/* Ajax nav */
function ajaxNavigation(link) {
	$('#page-content').hide();
	$.fancybox.showActivity();
	$(document).ready(function() {
		$.ajax({
		  'complete':function(){
		    $('#page-content').show();
		  },
		  url: link,
		  success: function(data) {
			$.fancybox.hideActivity();
		    $('#page-content').html(innerShiv(data,false));
		  } 
		});
	});
}
$(document).ready(function() {
	$('.internal-link').click(function() {
		var link = $(this).attr('href');
		$.address.value(link);
		return false;
	});
});
$.address.change(function(event) {
	var link = event.value,
	link = link.replace(root_url,"");
	
	if (link != "/" && link.substring(0,6) != "anchor") {
		ajaxNavigation(link);
	}
});

/* Carousel dedications */
jQuery(document).ready(function() {
	jQuery('#carousel-dedications').jcarousel({
        scroll: 1,
        auto: 2,
	    initCallback: mycarousel_initCallback,
        wrap: "last"
    });
});
function mycarousel_initCallback(carousel) {
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
