// this must be called after jquery.js and jquery-ui-tabs.js
// this function looks for ul.jp_tabbedNav, and applies tabs to it
// if there is a querystring value of tab=something, it uses that for the active tab
function getQueryValue() {
	var objURL = new Object();
	window.location.search.replace (
	new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
	function( $0, $1, $2, $3 ){
		objURL[ $1 ] = $3;
	}
	);
	for (var strKey in objURL){ 
		if (strKey == "tab") {
			var queryvalue;
			queryvalue = objURL[ strKey ];
			return queryvalue;
		}
	}
}
$(function() {
	if (getQueryValue()) {
		var tab = getQueryValue();
		var $tabs = $('a', '.jp_tabbedNav'); // #foo is a ul containing the tabs
		var selected = $tabs.index( $tabs.filter('[href$=#' + tab + ']')[0] );
		$('.jp_tabbedNav').tabs({ selected: selected });
		$('.jp_tabbedNav').tabs('select', '#' + tab);
	} else {
		$('.jp_tabbedNav').tabs();
	}
});

$(function() {
	if (getQueryValue()) {
		var tab = getQueryValue();
		var $tabs = $('a', '.jpTabbedNav'); // #foo is a ul containing the tabs
		var selected = $tabs.index( $tabs.filter('[href$=#' + tab + ']')[0] );
		$('.jpTabbedNav').tabs({ selected: selected });
		$('.jpTabbedNav').tabs('select', '#' + tab);
	} else {
		$('.jpTabbedNav').tabs();
	}
});