/**
 * @author webmaster
 */

function show_category($category_name){
	
	// remove the 'active' class from all other links 
	$('#services_nav_list li').removeClass('active');
	
	// set current link to 'active'
	$('#'+ $category_name +'_link').addClass('active');
	
	// remove the 'active' class from all other thumb links 
	$('#services_nav_thumbs a').removeClass('active');
	
	// set current thumb link to 'active'
	$('#'+ $category_name + '_anchor').addClass('active');
			
	// Hide all services categories
	$('.services_category').hide();
			
	// Show currently selected category
	$('#' + $category_name + '_category').show();
	
}

jQuery(document).ready(function(){
	
	// Add the click event for each item in the text-based navigation
	$('#services_nav_list li').each(function(){
		$(this).click(function(){
			
			// get the category name from the id
			$category_name = $(this).attr('id');
			// remove the '_link' from the category name
			$category_name = $category_name.replace(/_link/, "");
			
			show_category($category_name);
			
		
		})
		
	});
	
	// Add the click event for each item in the thumbnail-based navigation
	$('#services_nav_thumbs a').each(function(){
		$(this).click(function(){
			
			// get the category name from the id
			$category_name = $(this).attr('id');
			
			// remove the '_anchor' from the category name
			$category_name = $category_name.replace(/_anchor/, "");
			
			show_category($category_name);
			
		
		})
		
	});
	
	
})
