// Valid External Links
function externalLinks() { 
	$('a[rel^=external]').each(function() {
	$(this).attr('target', '_blank');
	});
};

// Apply Lightbox Dynamically
function applyLightbox() {
	$('#tabs a img').parent().attr("rel", "shadowbox[projects]");
    $('li.cloned a').attr("rel", "");
}

function activateSlider() {
	$('#slider2').anythingSlider({
		resizeContents      : false,     // If true, solitary images/objects in the panel will expand to fit the viewport
		autoPlay            : false,    // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
		buildNavigation     : false,      // If true, buildsa list of anchor links to link to each panel
		forwardText         : "Next", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
		backText            : "Previous" // Link text used to move the slider back (hidden by CSS, replace with arrow image)
	});
}

function projectTabs() {
	$('#tabs .tab_content').hide();
	$('#tabs .tab_content:first').show();
	$('#tabs ul li:first').addClass('active'); 
	$('.tabControls ul li a').click(function(){
		$('#tabs ul li').removeClass('active');
		//$(this).parent().addClass('active');
		$(this).parent().parent().find('a').removeClass('selected');
		$(this).addClass('selected');
		var currentTab = $(this).attr('href');
		$('#tabs .tab_content').hide();
		$(currentTab).fadeIn();
		return false;
	});
}

$(document).ready(function() {
	externalLinks();
	//activateSlider();
	projectTabs();
	applyLightbox();
	Shadowbox.init();
});

