/*
 * ZWPTabbedObject
 *
 * Javascript for tabbed objects.
 *
 * Copyright (C) 2007 Jason den Dulk. All rights reserved.
 *
 * GNU LGPL
 *
 * This code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This code 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
 * Lesser General Public License for more details.
 *
 * The GNU LGPL can be seen at http://www.gnu.org/licenses/lgpl.html
 *
 * The GNU LGPL can also be obtained from the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */



/*
 * zwp_tabbed
 *
 * zwp_tabbed is an object with each member being an array representing a tabbed
 * object identified by its ID.
 *
 * The elments of the array are arrays containing the ID of the label, followed
 * by the ID of the object who carries the 'current' class, followed by the
 * ID of the panel the label represents.
 */
 

var zwp_tabbed = new Object();


function zwp_tabbed_select(id, tid)
{
    var a = zwp_tabbed[id];
    
    for (var i in a)
    {
        if (a[i][0] == tid)
        {
            // Display it.
            
            var e = xGetElementById(a[i][0]);
            e.className = e.className.replace(/zwp-tabbed-current/, "") +
                          " zwp-tabbed-current";

            e = xGetElementById(a[i][1]);
            e.style.display = "";
        }
        else
        {
            // Hide it.
            
            var e = xGetElementById(a[i][0]);
            e.className = e.className.replace(/zwp-tabbed-current/, "");
            e = xGetElementById(a[i][1]);
            e.style.display = "none";
        }
    }
}