
var site = {
	
/*
buttonRollovers: function() {
		// Button Rollovers
		$('#main-nav > li').append('<div class="overState"></div>').hover(function(){
			$(this).find('.overState').stop().animate({ opacity: 1 }, 200);
		}, function(){
			$(this).find('.overState').stop().animate({ opacity: 0 }, 200);
		});
		$('#main-nav > li .overState').css({ opacity: 0 });
	},
*/

	//  =========================== carousel init functions ===========================
	carousel: {
		
		initWeatherCarousel: function() {
			var carouselOptions = {
				targetId: "weather",
				slideTimeout: 5000,
				listNav: false,
				nextId: "next-weather",
				prevId: "previous-weather"
			};
			
			simpleCarousel.init(carouselOptions);	
		}
	},
	
	
	//  =========================== light box init ===========================
	lightboxContentImages: function() {
		$('#main-col a img').each(function(){
			$(this).parents("a[href$=jpg],a[href$=gif],a[href$=png],a[href$=jpeg]").attr("title", "<a href='#' onClick='print();'>Print</a>").lightBox();
		});
		$('#gallery-1 a').lightBox();
	},
	
	historySlider: function() {
		var getTimelinePosition = function(ui) {
			if (ui.value <= 37) {
				return	 $('#timeline > ul > li.item1');
			}
			if (ui.value > 37 && ui.value <= 42) {
				return $('#timeline > ul > li.item2');
			}
			if (ui.value > 42 && ui.value <= 48) {
				return $('#timeline > ul > li.item3');
			}
			if (ui.value > 48 && ui.value <= 58) {
				return $('#timeline > ul > li.item4');
			}
			if (ui.value > 58 && ui.value <= 67) {
				return $('#timeline > ul > li.item5');
			}
			if (ui.value > 67 && ui.value <= 72) {
				return $('#timeline > ul > li.item6');
			}
			if (ui.value > 72 && ui.value <= 85) {
				return $('#timeline > ul > li.item7');
			}
			if (ui.value > 85 && ui.value <= 92) {
				return $('#timeline > ul > li.item8');
			}
			if (ui.value > 92) {
				return $('#timeline > ul > li.item9');
			}
		}
		
		$('#historySlider').slider({
			animate: true,
			slide: function(event, ui) {
				var currentTimeline = getTimelinePosition(ui);
				currentTimeline
					.stop().animate({ opacity: 1 }, 500)
					.siblings().stop().animate({ opacity: 0 }, 500);
			}
		});
			
		$('#timeline > ul > li:first').siblings().css({ opacity: 0 });
	},
	
	eventSubmit: function() {
		$('#eventDate').datepicker();
	}
	
}; // end the site object



// main onready init function
$(document).ready(function() {
	
	// lightbox
	site.lightboxContentImages();
	
	$(document.body).addClass('js');
	
	// carousel
	if($("body").hasClass("home")) {
		site.carousel.initWeatherCarousel();
	}
	
	/* site.buttonRollovers(); */
	
	// History slider
	site.historySlider();
	
	// Events Submit
	site.eventSubmit();
});

$(function(){
	$('#section-pages ul li:last').addClass('lastItem');
	$('ul#main-nav li li:not(:has(ul))').addClass('no-child');
	$('#main-nav li:last-child').addClass('item-last');
});

$(document).ready(function() {
    $("#columns a[href$='.pdf']").addClass("pdf");
    $("#columns a[href$='.xls'], #columns a[href$='.xlsx'], #columns a[href$='.csv']").addClass("xls");
    $("#columns a[href$='.doc'], #columns a[href$='.docx'], #columns a[href$='.txt'], #columns a[href$='.rtf']").addClass("txt");
    $("#columns a[href$='.zip'], #columns a[href$='.rar'], #columns a[href$='.tar'], #columns a[href$='.gzip']").addClass("zip"); 
    //Add external link icon to external links - 
    $('#columns a').filter(function() {
        //Compare the anchor tag's host name with location's host name
        return this.hostname && this.hostname !== location.hostname;
      }).addClass("external");
}); 

function formatText(index, panel) {
		  return index + "";
	    }
    
        $(function () {
        
            $('.anythingSlider').anythingSlider({
                easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 8000,                    // How long between slide transitions in AutoPlay mode
                startStopped: false,            // If autoPlay is on, this can force it to start stopped
                animationTime: 600,             // How long the slide transition takes
                hashTags: true,                 // Should links change the hashtag in the URL?
                buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "Go",             // Start text
		        stopText: "Stop",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
            
            $("#slide-jump").click(function(){
                $('.anythingSlider').anythingSlider(6);
            });
            
        });

