
TabControl = function(tabId, options) {

	var id = "#" + tabId;

	// For each link
	$$(id + ' div.tabs ul li a').each(function(a) {
		
		// Match the value of the href attribute that consistes of any number (not zero) of -_ or characters and then the end of string.
		var page = a.getAttribute('href').match(/[-_\w]+$/i)[0];

		if (page != options['current']) {
			$(page).hide()
		}

		else {
			$(a.parentNode).addClassName('on')
		}
		
		// i added this back in again. without it, first tab doesnt show
		// jeff w. added 6/15/07
		$(options).show()

		// Listen for a click on the link...
		Event.observe(a, 'click', function(e) {

			// Remove any active items
			$$(id + ' div.tabs ul li.on').each(function(e) {
				e.removeClassName('on');
			})

			// Everything that isn't our page hide
			$$(id + ' .PS_tab_page[id!='+page+']').each(function(e) { e.hide() });

			// Add active to our boy
			$(a.parentNode).addClassName('on');

			// Show the active
			$(page).show();

			Event.stop(e);

			});
		});
	}