//**********************************************************************************************************************
/**
* COMPANY: Zipline Interactive
* EMAIL: infon@gozipline.com
* PHONE: 509-321-2849
* DESCRIPTION: This document contains programming required for the website templates.  Requires the jQuery library.
*/
//***********************************************************************************************************************

var old_src = '';
var new_src = '';

//***********************************************************************************************************************
//ON DOCUMENT READY FUNCTIONS
//***********************************************************************************************************************
$(function() {
	
	/************************************************************************
	/ Feature social media tabs
	/************************************************************************/
	
	$('.feature-content').eq(0).show();

	// Click on a social media tab
	$('.feature-tab').click(function(){
		
		if($(this).hasClass('off')) {
			
			// The next item to show
			var index = $('.feature-tab').index(this);
			
			// Change the previously selected tab to off
			var old_item 	= $('.feature-tab.on');
			var old_src 	= old_item.attr('src');
			var new_src 	= old_src.replace('on','off'); 
			
			old_item.attr('src',new_src);
			old_item.addClass('off');
			old_item.removeClass('on');
			
			
			// Change the clicked item
			var new_item 	= $('.feature-tab').eq(index);
			var old_src 	= new_item.attr('src');
			var new_src 	= old_src.replace('off','on');
			
			new_item.attr('src',new_src);
			new_item.addClass('on');
			new_item.removeClass('off');
			
			// Hide old content
			$('.feature-content').hide();
			
			// Show new content
			$('.feature-content').eq(index).show();
		
		}
		
	});
	
	$('#nav ul li a img').hover(function(){
	
		old_src = $(this).attr('src');
		new_src = $(this).attr('src').replace('off','on');
		$(this).attr('src',new_src);
	
	},function(){
	
		$(this).attr('src',old_src);
	
	});

});


