//Standard stuff
$(document).ready(function() {
					   
	//drop down menu
	$("ul.sub-menu").parent(); //Only shows drop down trigger when js is enabled
	$("ul#menu li a").hover(function() { //When trigger is clicked...
	
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.sub-menu").slideDown('fast').show(); //Drop down the subnav on click
	
		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.sub-menu").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
		});
	
		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
						
	//open in a new window
	$('a[rel="external"]').click(function(){ 
		this.target = "_blank";
	});
	
	$('#footer_nav li:last-child').addClass('end');
	//$('#.gallery_image_wrap:nth-child(6n)').addClass('end');
	
	//Jquery innerfade ------------------------------------------
	$('#hero').innerfade({
		animationtype: 'fade',
		speed: 750,
		timeout: 6000,
		type: 'random',
		containerheight: '300px'
	});
	
	//fancybox modal popup
	$("a[rel=gallery]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
       
	$('#home-banner').nivoSlider({
		effect: 'random',
		captionOpacity: 0,
		directionNav: false
	});
});


