2
* Horde Form Sections Javascript Class
4
* Provides the javascript class for handling tabbed sections in Horde Forms.
6
* Copyright 2003-2005 Marko Djukic <marko@oblo.com>
8
* See the enclosed file COPYING for license information (LGPL). If you did not
9
* receive this file, see http://www.fsf.org/copyleft/lgpl.html.
11
* $Horde: horde/templates/javascript/form_sections.js,v 1.11.4.1 2005/01/03 12:25:46 jan Exp $
13
* @author Marko Djukic <marko@oblo.com>
14
* @version $Revision: 1.11.4.1 $
17
function Horde_Form_Sections(instanceName, openSection)
19
/* Set up this class instance for function calls from the page. */
20
this._instanceName = instanceName;
22
/* The currently showed section. */
25
this.toggle = function(sectionId)
27
/* Get the currently open section object. */
28
openSectionId = this._get();
29
if (document.getElementById('_section_' + openSectionId)) {
30
document.getElementById('_section_' + openSectionId).style.display = 'none';
31
document.getElementById('_tab_' + openSectionId).className = null;
34
/* Get the newly opened section object. */
35
if (document.getElementById('_section_' + sectionId)) {
36
document.getElementById('_section_' + sectionId).style.display = 'block';
37
document.getElementById('_tab_' + sectionId).className = 'activeTab';
40
/* Store the newly opened section. */
44
this._get = function()
46
return this._openSection;
49
this._set = function(sectionId)
51
var form = eval('document.' + this._instanceName);
52
if (typeof form != 'undefined') {
53
form.__formOpenSection.value = escape(sectionId);
55
this._openSection = sectionId;
58
this._set(openSection);