/////////////////////////////////
//Custom Javascript Functions

	$(document).ready(function() {
	 
		//Default Action
		$(".tab_content").hide(); //Hide all content
		$("ul.tabs li:first").addClass("active").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
		
		//On Click Event
		$("ul.tabs li").click(function() {
			$("ul.tabs 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 rel attribute value to identify the active tab + content
			$(activeTab).show(); //Fade in the active content
			return false;
		});
		
		// DIV TOGGLE
		$(".toggleContainer").hide(); 
		$(".toggleTrigger").click(function(){
			$(this).toggleClass("active").next().slideToggle("fast");
			//$(this).animate( { backgroundColor: "#e9f1f0" }, 600 ).next().slideToggle("slow");
			//$(this).parents('div.toggle-holder').animate( { backgroundColor: '#e9f1f0' }, 600 );
			return false;
		});
	 
	});
	
	$(window).load(function() {
	var total = $('#banner-slider img').length;
	var rand = Math.floor(Math.random()*total);
	$('#banner-slider').nivoSlider({
		effect:'fade',
		slices:40,
		animSpeed:200,
		pauseTime:7000,
		startSlide:rand, //Set starting Slide (0 index)
		directionNav:true, //Next and Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left and right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
});
