$(document).ready(function() {
	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.news_tab_nav li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.news_tab_nav li").click(function() {

		$("ul.news_tab_nav li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	//cycle
	$('.home_hero').cycle({ 
    	fx:    'fade',  
    	speed:    1000, 
    	timeout:  7000,  
		pager:   '.bs-nav p',
		pagerAnchorBuilder: pagerFactory
	}); 
	function pagerFactory(idx, slide) {
		return '<a href="#"></a>';
	};
	//colorbox   
	//$("a[href*=interactive-map]").addClass("colorbox");  
	$(".sub_photos_wrap ul li").find("a").addClass("colorbox"); //Remove colorbox to links
	$(".sub_photos_wrap ul li").find("a").attr("rel", "slideshow_group"); //Add "rel" to create slideshow group
	$(".colorbox").colorbox();  
	//accordion   
	$( "#accordion" ).accordion({
			autoHeight: false, collapsible: true, active: false
		});
	//adjust column height accordion
	if ($("#accordion").length) { } 
	else {
		if ($(".page_content_wrap").length) {
			var leftcolumnheight = $(".sidebar_nav").height(); 
			var rightcolumnheight = $(".page_content_wrap").height(); 
			var photosidebar = $(".sub_photos").height(); 
			if ( leftcolumnheight < rightcolumnheight && rightcolumnheight < photosidebar) {
				$(".sidebar_nav").css("height", photosidebar );
				$(".page_content_wrap").css("height", photosidebar );
			}
			else if ( leftcolumnheight < rightcolumnheight) {
				$(".sidebar_nav").css("height", rightcolumnheight );
			}
			else if ( leftcolumnheight < photosidebar && rightcolumnheight < photosidebar) {
				$(".sidebar_nav").css("height", photosidebar );
				$(".page_content_wrap").css("height", photosidebar );
			}
		}
	}
	//go back
	$('a.back').click(function(){
	parent.history.back();
	return false;
	});
//EOF
});
