* Fixed a multiselect bug in the mailbox view. Ctrl-click was selecting a message...
[citadel.git] / webcit / tiny_mce / utils / mctabs.js
blob284501ee9470f0598bef0c174073cf65c5c8e83d
1 /**
2 * $Id: mctabs.js 758 2008-03-30 13:53:29Z spocke $
4 * Moxiecode DHTML Tabs script.
6 * @author Moxiecode
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
8 */
10 function MCTabs() {
11 this.settings = [];
14 MCTabs.prototype.init = function(settings) {
15 this.settings = settings;
18 MCTabs.prototype.getParam = function(name, default_value) {
19 var value = null;
21 value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
23 // Fix bool values
24 if (value == "true" || value == "false")
25 return (value == "true");
27 return value;
30 MCTabs.prototype.displayTab = function(tab_id, panel_id) {
31 var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i;
33 panelElm= document.getElementById(panel_id);
34 panelContainerElm = panelElm ? panelElm.parentNode : null;
35 tabElm = document.getElementById(tab_id);
36 tabContainerElm = tabElm ? tabElm.parentNode : null;
37 selectionClass = this.getParam('selection_class', 'current');
39 if (tabElm && tabContainerElm) {
40 nodes = tabContainerElm.childNodes;
42 // Hide all other tabs
43 for (i = 0; i < nodes.length; i++) {
44 if (nodes[i].nodeName == "LI")
45 nodes[i].className = '';
48 // Show selected tab
49 tabElm.className = 'current';
52 if (panelElm && panelContainerElm) {
53 nodes = panelContainerElm.childNodes;
55 // Hide all other panels
56 for (i = 0; i < nodes.length; i++) {
57 if (nodes[i].nodeName == "DIV")
58 nodes[i].className = 'panel';
61 // Show selected panel
62 panelElm.className = 'current';
66 MCTabs.prototype.getAnchor = function() {
67 var pos, url = document.location.href;
69 if ((pos = url.lastIndexOf('#')) != -1)
70 return url.substring(pos + 1);
72 return "";
75 // Global instance
76 var mcTabs = new MCTabs();