$(document).ready(function() {
	$('ul.tabs a').bind('click', function() {
		var tabregex = /tab=([^&]+)/i;
		var match = tabregex.exec(this.getAttribute('href'));
		var tab = match[1];
		var li = this.parentNode;
		while(li != null && li.nodeName != 'LI')
			li = li.parentNode;
			
		$('ul.tabs li').each(function () {
			var t = $(this);
			if(this == li)
				t.addClass('selected');
			else
				t.removeClass('selected');
		});
		
		$('div.tab').each(function() {
			var t = $(this);
			if(t.hasClass(tab)) {
				t.addClass('selected');
				t.removeClass('hide');
			} else {
				t.removeClass('selected');
				t.addClass('hide');
			}
		});
		
		return false;
	});
});


