$(document).ready(function(){

	// subnav 
	$("#mainMenu ul li a").hover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find(".subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find(".subnav").slideUp('normal'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		})

  	$("#mainMenu ul li").hover(function() {
		    $(this).find(".subnav").parent().addClass("subhover");
  		}, function(){	//On Hover Out
  			$(this).find(".subnav").parent().removeClass("subhover");
  	});

	// Fancy
	$("a.fancy").fancybox({
		'titleShow'		: false
	});


	$("a.fancy[rel=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>';
		}
	});

});
