﻿$(function() {
  
  var pg = window.location.pathname
  var tabanchor;
  var myFile = document.location.toString();
  if (myFile.match('#')) { tabanchor = '#' + myFile.split('#')[1];}


  $("ul.tabs li").click(function() {
	  $("ul.tabs li").removeClass("active");
	  $(this).addClass("active");
	  $(".tab_content").hide();
	  var activeTab = $(this).find("a").attr("href");
	  $(activeTab).show();
	  
	  var tsk = $(activeTab).attr("rel")
	  if(tsk) eval(tsk)
	
    return false;
  });
  
  $(".tab_content").hide();

  if(typeof seltab != 'undefined') {
    $("a[href='#tab_"+seltab+"']").click()
  } else if ($("a[href='" + tabanchor + "']").length>0){
    $("a[href='" + tabanchor + "']").click();
  
  } else {
    $("ul.tabs li:first").addClass("active").show();
    $(".tab_content:first").show(); 
  }
  
});
