jQuery(function () {
    var tabContainers = $('div.tabs > div');
    var tabName = "";
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
      hash = hashes[i].split('=');
      if (hash[0]=="tabName")
      {
    	  tabName = "#" + hash[1];
    	  //break;
      }
    }
    jQuery('div.tabs ul.tabNavigation a').click(function () {
        tabContainers.hide().filter(this.hash).show();

        jQuery('div.tabs ul.tabNavigation a').removeClass('selected');
        jQuery(this).addClass('selected');

        return false;
    }).filter(function (index) {
        if (tabName == "")
            return index == 0;
        else
        	return tabName == $(this).attr("href");
    }).click();
});
