$(window).load(function(){	
	
	var content         = $('#content');
	var page_bkg        = $('#page_bkg');
	var transparent_bkg = $('#transparent_bkg');
	var footer          = $('#footer');
	
	page_bkg.height( content.outerHeight(false) );
	transparent_bkg.height( page_bkg.outerHeight(true) + $('.footer').height() );
	
	var footer_pos = transparent_bkg.position( );
	
	$('.footer').css( {top: footer_pos.top + transparent_bkg.height( ) - footer.height( ), left: footer_pos.left} );


	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.topnav li span").click(function() { //When trigger is clicked...

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

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //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"
		$(this).click( );
	}, function(){	//On Hover Out
		$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	
	
	$('#slider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:500, //Slide transition speed
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		pauseOnHover:false //Stop animation while hovering
	});

});


$(document).ready( function() {
	$('a[rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
	$('div.gallery a').lightBox(); 
});

