﻿function gridCheckboxDeleteClicked(cssCheckbox, cssPre, cssPost, cssButton) {
    var showDeleteButton = false;
    $('.' + cssCheckbox + ' input').each(function(i) {
        if (this.checked == true) { showDeleteButton = true; }
    });
    if (showDeleteButton == true) {
        $('.' + cssPre + '').hide()
        $('.' + cssPost + '').show()
        $('.' + cssButton + '').show()
    } else {
        $('.' + cssPre + '').show()
        $('.' + cssPost + '').hide()
        $('.' + cssButton + '').hide()
    }
}

function checkboxConfirmClicked(checkbox, buttonToToggle) {
    if ($('.' + checkbox + ' input')[0].checked == true) {
        $('.' + buttonToToggle).show();
    } else {
        $('.' + buttonToToggle).hide();
    }
}

function setCheckbox(checkbox, state) {
    $('.' + checkbox + ' input')[0].checked = state;
}

function checkSurveySendConditions() {
    if ($('.checkboxConditionsSubscribers input')[0].checked == true) {
        $('.submitContainer .buttonSubmit').removeClass('disabled');
        $('.submitContainer .buttonSubmit').removeAttr('disabled');
    } else {
        $('.submitContainer .buttonSubmit').addClass('disabled');
        $('.submitContainer .buttonSubmit').attr('disabled', 'disabled');
    }
}
