

    function ui__hide_ctrl(id){
        var ctrl = document.getElementById(id);
        if(ctrl)
            ctrl.style.display = 'none';
    }

    function ui__unhide_ctrl(id){
        var ctrl = document.getElementById(id);
        if(ctrl)
            ctrl.style.display = '';
    }
    
    function ui__disable_ctrl(id){
        var ctrl = document.getElementById(id);
        if(ctrl)
            ctrl.disabled = true;    
    }
    
    function ui__enable_ctrl(id){
        var ctrl = document.getElementById(id);
        if(ctrl)
            ctrl.disabled = false;    
    }
    
    function ui__set_ctrl_enabled_state(id, enable){
        var ctrl = document.getElementById(id);
        if(ctrl)
            ctrl.disabled = !enable;
    }
    
    function ui__switch_ctrl_enabled_state(id){
        var ctrl = document.getElementById(id);
        if(ctrl)
            ctrl.disabled = !ctrl.disabled;
    }
    
    function ui__get_ctrl_absolute_left(id) {
        // Get an object left position from the upper left viewport corner
        // Tested with relative and nested objects
        o = document.getElementById(id)
        oLeft = o.offsetLeft            // Get left position from the parent object
        while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
            oParent = o.offsetParent    // Get parent object reference
            oLeft += oParent.offsetLeft // Add parent left position
            o = oParent
        }
        // Return left postion
        return oLeft
    }

    function ui__get_ctrl_absolute_top(id) {
        // Get an object top position from the upper left viewport corner
        // Tested with relative and nested objects
        o = document.getElementById(id)
        oTop = o.offsetTop            // Get top position from the parent object
        while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
            oParent = o.offsetParent  // Get parent object reference
            oTop += oParent.offsetTop // Add parent top position
            o = oParent
        }
        // Return top position
        return oTop
    }

