// JavaScript Document

$(function(){

//CUSTOM SCROLLBAR
	$('.makeScroll').jScrollPane({scrollbarWidth:14,dragMinHeight:75});

//FOOTER NAVIGATION FUNCTIONALITY
	$('#footerNav li.click:has(ul)').hover(function() {
		$(this).css('backgroundPosition','-149px 0px');
	}, function() {
	});
	$('#footerNav li.click').hover(function() {
		$('li.click ul:visible').not(this).hide();
		$('#footerNav li.click').not(this).css('backgroundPosition','0px 0px');
		$('ul', this).show();
	}, function() {
		$('ul', this).parent('li').css('backgroundPosition','0px 0px').end().hide();
	});
	$('#footerNav').mouseleave(function(){
		$('#footerNav li ul').hide();
	});
	
//LEFT NAVIGATION HIGHLIGHTS CURRENT PAGE
	function filterPath(pathString) {
		return pathString.replace(/^\//,'').replace(/\/(index\.\w{3,4})?$/,'')
	}
	$('ul#leftNav li a').filter(function() {
		return filterPath(this.pathname) == filterPath(location.pathname);
	}).addClass('active');

//OPEN EXTERNAL LINKS IN NEW WINDOW
	$('a').filter(function(){
		if (this.hostname && this.hostname !== location.hostname){
			$(this).click(function() {
				window.open(this.href);
				return false;
			});
		}
	});

//FIRESTATION GALLERY
	$('div#firestation_thumbs a[class]').click(function() {
		$("div#firestation_gallery div").hide();
		$("div#firestation_gallery div#" + $(this).attr("class")).show().fadeTo(500,1.0);
		$('div#firestation_thumbs a').fadeTo('fast',1.0);
		$(this).fadeTo(500,0.5);
	});

	$('h2').supersleight({shim: '/imageassets/x.gif'});

});

