jQuery.fn.safeMailTo = function() {
	return this.each(function(){
 
		var mailtoHref = $(this).attr('href');
		mailtoHref = mailtoHref.replace(mailtoHref,"mailto:" + mailtoHref);
		mailtoHref = mailtoHref.replace("[at]","@");
		mailtoHref = mailtoHref.replace("[dot]",".");
 
		var mailtoText = $(this).text();
		mailtoText = mailtoText.replace("[at]","@");
		mailtoText = mailtoText.replace("[dot]",".");
		$(this).text(mailtoText);
 
		var mailtoTitle = mailtoHref.replace("mailto:","Email: ");
		$(this).attr('title',mailtoTitle);
 
		$(this).click(function(){
			window.location.href = mailtoHref;
			return false;
		});
	});
};


$(document).ready(function(){
	
		
	/*
	----------------------------------------------------------
	03. TABS
	---------------------------------------------------------- */
	$(".tab-content").hide(); // hide all tab content
	$("ul.tabs li:first").addClass("active").show(); // activate first tab
	$(".tab-content:first").show(); // show first tab content
	$("div.tab-content ul li:first").addClass("first");

	$("ul.tabs li:not('.subscribe')").click(function() {
		$("ul.tabs li").removeClass("active"); // remove any "active" class
		$(this).addClass("active"); // add "active" class to selected tab
		$(".tab-content").hide(); // hide any open tab content
		var activeTab = $(this).find("a").attr("href"); // find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn("normal"); // fade in the active ID content
		return false;
	});	
	
	$(".tab-filter-select").change(function() {
		var filterValue = $(this).val(); 
		var filterValueSelector = '';
		if (filterValue == "all") { 
			//show all items 
			//$(".filter-section").show(); 
			$(this).parent().parent().find(".filter-section").show(); 
		} else { 
			if (filterValue != "all") { filterValueSelector = '.filter-section-' + filterValue }		 
			//$(".filter-section").hide(); 
			$(this).parent().parent().find(".filter-section").hide(); 
			//$(filterValueSelector).show(); 
			$(this).parent().parent().find(filterValueSelector).eq(0).show(); 
		}		 
	});

	// Mailto Plugin
	$("a[rel='email']").safeMailTo();

	
			
		
});
// END ON READY





