/**
 * $Horde: horde/templates/javascript/quoteBlocks.js,v 1.5.10.1 2007/12/20 15:04:02 jan Exp $
 *
 * @package Horde
 */
function toggleQuoteBlock(id, lines)
{
    var block = document.getElementById('qb_' + id);
    var isVisible = block.style.display != 'none';

    isVisible ?
        block.style.display = 'none' :
        block.style.display = '';
    isVisible = !isVisible;

    text = document.createTextNode(isVisible ?
                                   '<?php echo _("[Hide Quoted Text]") ?>' :
                                   '<?php echo _("[Show Quoted Text -") ?> ' + lines + ' <?php echo _("lines]") ?>');
    link = document.createElement('A');
    link.href = '';
    link.className = 'widget';
    link.style.fontSize = '70%';
    link.onclick = function() {
        toggleQuoteBlock(id, lines);
        return false;
    }
    link.appendChild(text);

    var toggle = document.getElementById('qt_' + id);
    if (toggle.firstChild) {
        toggle.removeChild(toggle.firstChild);
    }
    toggle.appendChild(link);
}
