
var tab_active = 1;
var num_tabs = 0;

//###########################################
function toggle_tab( tab_clicked ) {

  // Make current active tab (and corresponding panel) inactive
	document.getElementById('tab_' + tab_active).className = "tabbed_tab";
	document.getElementById('panel_' + tab_active).className = "tabbed_panel";

  // Make clicked tab (and corresponding panel) active
	document.getElementById('tab_' + tab_clicked).className = "tabbed_tab tab_active";
	document.getElementById('panel_' + tab_clicked).className = "tabbed_panel panel_active";
  tab_active = tab_clicked;

  // Remove backgrounds from tab just above clicked tab + last tab
	for (t=1; t <= num_tabs; t++) {
    if ( (t == (0+tab_clicked-1)) || (t == num_tabs) ) {
      document.getElementById('tab_' + t).className = document.getElementById('tab_' + t).className + " tabbed_tab_no_bg";
    }
    else {
      document.getElementById('tab_' + t).className = document.getElementById('tab_' + t).className.replace(" tabbed_tab_no_bg", "");
    }
  }


}
//###########################################

