$(document).ready(function(){

	//fancybox
	$("a[rel=fancybox]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});
	
	// horizontal scrollables. each one is circular and has its own navigator instance
	var horizontal = $(".scrollable").scrollable({size: 1, speed: 1500}).circular().autoscroll({ autoplay: true, interval: 5000 }).navigator(".navi");
	
	// when page loads setup keyboard focus on the first horzontal scrollable
	horizontal.eq(0).scrollable().focus();
	
	$("#header-dropdown_arrow").mouseover(function() {
		$("#header-dropdown_container").slideDown();
	});
	$("#header-dropdown_container").mouseleave(function() {
		$("#header-dropdown_container").slideUp();
	});
	
	$("#dropdown_trigger").click(function() {
		
		var display = $("#dropdown_container").css("display");
		if(display == "none") { $("#dropdown_container").show(); }
		if(display == "block") { $("#dropdown_container").hide(); }
		
	});
	
	$("#dropdown-school li").hover(
	function () {
		var new_className = $(this).find(".dropdown_location_css").html();
		var old_className = $(this).find("a").attr("class");
		$(this).find(".dropdown_location_css").html(old_className);
	    $(this).find("a").attr("class", new_className);
	  }, 
	  function () {
	  	var new_className = $(this).find(".dropdown_location_css").html();
		var old_className = $(this).find("a").attr("class");
		$(this).find(".dropdown_location_css").html(old_className);
	    $(this).find("a").attr("class", new_className);
	});
	
		
	
	$(".picture-locations li").mouseenter(function() {
		$(this).find(".tooltip").show();
	});
	
	$(".picture-locations li").mouseleave(function() {
		$(this).find(".tooltip").hide();
	});
	
});
