$(document).ready(function(){
	
	// Nav animation
	generateSprites(".nav", "current-", true, 300, "fade");
	
	// Home page slideshow
	$('ul#reasons').innerfade({
	speed: 5000,
	timeout: 10000,
	type: 'sequence',
	containerheight: '203px'
	});
	
	// Outlinks added target=_blank
	$('.outlink').attr('target', '_blank');
	
	// Table striping
	$(".facts tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
	$(".facts tr:even").addClass("alt");

	// Quality of Life page slideshow		
	$('#photo-slider').anythingSlider({
		width            : 580,
		height           : 385,
		pauseOnHover     : true,
		buildArrows      : true,
		forwardText      : "next",
		backText         : "previous",
		delay            : 5000,
		buildNavigation  : false
	});
	
	// Tabs	
	
	if(location.hash) { // Hash present in URL
		$(location.hash).show(); // Show the tab's content
		$("ul.tabs li a." + location.hash.substr(1)).addClass("active"); // Mark the tab as active
	} else {
		$("ul.tabs li a:first").addClass("active").show(); //Activate first tab
		$(".tab-content:first").show(); //Show first tab content
	}

	$('ul.tabs > li > a').click(function(e) {

    //Get Location of tab's content
    var contentLocation = $(this).attr('href');
	location.hash = contentLocation; //Add the anchor to the url (for refresh)


    //Let go if not a hashed one
    if(location.hash.charAt(0)=="#") {

        e.preventDefault();

        //Make Tab Active
        $(this).parent().siblings().children('a').removeClass('active');
        $(this).addClass('active');

        //Show Tab Content & add active class
        $(location.hash).show().addClass('active').siblings().hide().removeClass('active');

		}
		return false;
	});
});

