
function TextSize(change) {
    if (change == 0) {
        now = 0.75;
    }
    else {
        var now = document.body.style.fontSize;
        now = (now == '') ? 0.75 : parseFloat(now);
        now += change / 10;
    }
    if (now >= 0.5 && now <= 1.5) {
        document.body.style.fontSize = now + 'em';
    }
}

function getDocumentCheckboxes() {
    return $('#document-list .document-selection:checkbox');
}

function selectDeselect(checked) {
    var checkboxes = getDocumentCheckboxes();
    checkboxes.each(function() {
        this.checked = checked;
    });
    $('.select-deselect:checkbox').each(function() {
        this.checked = checked;
    });
}

function getSelectedDocuments() {
    var checkboxes = getDocumentCheckboxes();
    return checkboxes.filter(function(index) {
        return this.checked;
    }).map(function() {
        return this.value;
    }).get();
}

function printSelectedDocuments() {
    var selectedDocuments = getSelectedDocuments();
    if (selectedDocuments.length === 0) {
        return false;
    }
    var paramValue = selectedDocuments.join(',');
    window.open("print.aspx?ids=" + paramValue);
}

function emailSelectedDocuments() {
    var selectedDocuments = getSelectedDocuments();
    if (selectedDocuments.length === 0) {
        return false;
    }
    var paramValue = selectedDocuments.join(',');
    window.location.href = "email.aspx?ids=" + paramValue;
}

function HideShow(lnkHide, lnkShow, id_container, hide_from) {
    try {
        document.getElementById(lnkShow).style.display = 'block';
        document.getElementById(lnkHide).style.display = 'none';
        var items = document.getElementById(id_container).getElementsByTagName('li');
        for (var i = items.length - 1; i >= hide_from; i--)
            items[i].style.display = hide_from ? 'none' : 'block';
        return true;
    } catch (e) {
        return false;
    }
}