// JavaScript Document

$(document).ready(function() {

//Default Action
$(".tab_content").hide(); //Hide all content
if(location.hash != "") {
var target = location.hash.split("#")[1]
$(location.hash).show(); //Show first tab content
$("ul.work_tabs li:has(a[rel="+target+"])").addClass("active_port_cat").show();;
} else {
$("ul.work_tabs li:first").addClass("active_port_cat").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
}

//On Click Event
$("ul.work_tabs li").click(function() {
$("ul.work_tabs li").removeClass("active_port_cat"); //Remove any "active" class
$(this).addClass("active_port_cat"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content

var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
activeTab = activeTab.split("#"); //bugfixed by droope :)
$("#"+activeTab[activeTab.length-1]).fadeIn(); //Fade in the active ID content
return false;
});

});
