// scroll page
$(document).ready(function(){
	/* This code is executed after the DOM has been completely loaded */
	
	$('#top a.up').click(function(e){
										  
		// If a link has been clicked, scroll the page to the link's hash target:
		
		$.scrollTo( this.hash || 0, 600);
		e.preventDefault();
	});

});

// show/hide sub-menus
$('nav li ul').css({
	display: "none", left: "auto", top: "auto"
});
$('nav li').hover(function() {
	$(this).find('ul').stop(true, true).slideDown('fast');
}, function() {
	$(this).find('ul').stop(true, true).slideUp('fast');
});
$('nav li ul li a').click(function() {
	$('nav li ul').css({ display: "none"});
});

// news accordion
$(function() {
	$( "aside dl#news" ).accordion({
		autoHeight: false,
		collapsible: false
	});
});

/** lightbox */
$(document).ready(function() {
	$("a[rel=example_group]").fancybox({
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});
