/**
 * @author justin.perry
 * Tab <script>
 */
$(document).ready(function(){
	// Hide all tabs
	$('.tabs div.tab').hide();
	
	// Show default tab
	$('.tabs div.tab:first').show();
	
	// Set active default tab class
	$('.tabs .tabLink:first').addClass('active');
	
	// Class added for formatting items when JS enabled
	$('.tabs').addClass('jsOn');
	
	// Watch for click
	$('.tabLink').click(function(){
		
		// Remove active class from all links 
		$('.tabs .tabLink').removeClass('active');
		
		// Add active class to current link
		$(this).addClass('active');
		
		// Traverse clicked link, find parent, and hide all child tabs within that tabs div
		//$(this).parents('.tabs').children("div.tab").hide();
		$('.tabs div.tab').hide(); // Use this option for global hiding of child tabs
		
		// Assign selected href tab reference to variable
		var currentTab = $(this).attr('href');
		
		// Show selected tab
		$(currentTab).show();
		return false;
	});
});

/**
 * @author justin.perry
 * Toggle <div>
 */
$(document).ready(function(){	
	// Watch for click
	$("#advancedSearchToggle").click(function(event) {
	event.preventDefault();
	
	// Find current text of link so we can toggle it...
	var strLinkText = $(this).text().toString()
	var defaultText = "More Search Options"
	var toggledText = "Fewer Search Options"			
	
	// Check text then swap out
	if(strLinkText==toggledText){
		$(this).text(defaultText)
		$(this).removeClass('toggled')
		}
	else{
		$(this).text(toggledText)
		$(this).addClass('toggled')
	}
	
	// Show box
	$("#advancedSearch").slideToggle();
	});	
});
