
/*----------------------------------------------------------------------------\
|                        TabbedPane                                           |
|-----------------------------------------------------------------------------|
| Created:8-10-2007 |      Credit: Jesse        | Updated:  8-10-2007            |
|-----------------------------------------------------------------------------|
|     From: http://20bits.com/2007/05/23/dynamic-ajax-tabs-in-20-lines/            |
|-----------------------------------------------------------------------------|*/

function TabbedPane(pane, tabs, args) {
	for (id in tabs) {
		Event.observe(id, 'click', function(e) {
			if (typeof(args.onClick) == 'function')
				args.onClick(e);
			
			for (id in tabs) $(id).removeClassName('active');
			Event.element(e).addClassName('active');
			
			new Ajax.Updater(pane, tabs[Event.element(e).id], $H({
					asynchronous: true, 
					method: 'get'
				}).merge(args));
			Event.stop(e);
		});
	}
}