/**
 * ********************************************************
 *  JAVASCRIPT STYLE FUNCTIONS (DHTML)
 *
 * Most CSS attributes are represented as properties in the Style object. 
 * For non-hyphenated attributes, the property is identical, while for 
 * hyphenated attributes, drop the hyphen and capitalize the first letter 
 * following the hyphen.
 *
 * Examples:
 * color = color
 * padding = padding
 * background-color = backgroundColor
 * border-top-width = borderTopWidth
 */  

function toggleVis(ref, label_hid, label_vis)
{
    if (getStyle(ref, 'visibility') == 'hidden') {
        setStyle(ref, 'visibility', 'visible');
        setStyle(ref, 'display', 'block');
        if (label_vis != undefined) {
            ref += 'ToggleSwitch';
            setLabel(ref, label_vis);
        } 
    } else {
        setStyle(ref, 'visibility', 'hidden');
        setStyle(ref, 'display', 'none');
        if (label_hid != undefined) {
            ref += 'ToggleSwitch';
            setLabel(ref, label_hid);
        } 
    }
}

function setLabel(ref, label)
{
    var obj = getObj(ref); 
    if (obj) {
        if (obj.childNodes[0]) {
            obj.childNodes[0].nodeValue = label;
        } else if (obj.value) {
            obj.value = label;
        } else if (obj.innerHTML) {
            obj.innerHTML = label;
        }
    }
}
