/*
THIS LICENSE HEADER MUST REMAIN INTACT FOR LEGAL USE!
Pagefusion; Pagefusion Core Platform
Description: A powerful, easy-to-use, and highly customizable content management system.
Copyright (C), 2008 Pagefusion.com, All Rights Reserved.
Author: Chris Davis, chris@pagefusion.com
Support portal: www.pagefusion.com

Filename: /components/tabs/tabs.js
Description: (see schema.xml for a detailed description)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
*/

// toggle
function toggle_tab(tab_id, pane_id, total_tabs) {
	
	var tab_num = total_tabs+1;
	
	// unset all other tabs
	for (i=1; i<tab_num; i++) {
		var object = document.getElementById('tab' + i);
		var tabClass = object.className;
		tabClass = tabClass.replace(/tab-current/gi, 'tab');
		object.className = tabClass;
	} // for
	
	// unset all other panes
	for (i=1; i<tab_num; i++) {
		var object = document.getElementById('pane' + i);
		var tabClass = object.className;
		tabClass = tabClass.replace(/pane_on/gi, 'pane_off');
		object.className = tabClass;
	} // for
	
	// enable tab
	var object = document.getElementById(tab_id);
	object.className = 'tab-current';
	
	// enable pane
	var object = document.getElementById(pane_id);
	object.className = 'pane_on';
} // function
