$(document).ready (function (){

	// Thanks to Jonathan Snook ( http://snook.ca/archives/javascript/jquery-bg-image-animations/ )
	//$('#navigation a, #tab-nav a')
	//	.not("#navigation .selected a")
	//	.css( {backgroundPosition: "0 0"} )
	//	.mouseover(function(){
	//		$(this).stop().animate({backgroundPosition:"(-138px 0)"}, {duration:500})
	//	})
	//	.mouseout(function(){
	//		$(this).stop().animate({backgroundPosition:"(-285px 0)"}, {duration:200, complete:function(){
	//			$(this).css({backgroundPosition: "0 0"})
	//		}})
	//	})
	//$("#navigation .selected a").animate({backgroundPosition:"(-138px 0)"});

	//hide submit buttons and submit form on drop down change
	$("#search_list .submit").hide();
	
	$("#search_list select").bind("change", function() {
	     this.form.submit();
	});
	
	//homepage rotating carousel
	$(".carousel").jCarouselLite({
		visible: 1,
		auto: 3500,
    	speed: 1200,
		easing: "easeOutElastic"
   	});
		

	//tabs
    $("div.tab").hide();
	//show the welcome page by default
	$("div.first-active").show();
	$("#tab-nav a").click(function(){
    	// hide anything that's open
		$("div.tab, .current-expanded").hide();
	    // show div
    	$(this.href.substring(this.href.indexOf("#"), this.href.length)).fadeToggle();
		// remove class from current selected
        $("#tab-nav li.selected").removeClass("selected"); 
		// add class to just clicked
		$(this).parent().addClass('selected');
				   
    return false;
	});	
	
	
	//if (GBrowserIsCompatible()) {
	// Initialize the map.
	//	map = new GMap2(document.getElementById("googlemap"));
	//	map.addControl(new GLargeMapControl());
	//	map.setCenter(new GLatLng(52.7115,-2.7554), 15);
		
	//	var point = (new GLatLng(52.7105,-2.7530));
	//	map.addOverlay(new GMarker(point));
	//	}
	

		
});

jQuery.fn.fadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle'}, speed, easing, callback);
}; 

$(document.body).unload(function() {
	if (GBrowserIsCompatible()) {
	GUnload();
	}
});