function hide_block() {
    for(var i=0; i<arguments.length; i++) {
        element = document.getElementById(arguments[i]);
        if (element) { element.style.display = 'none'; }
    }
}

function show_block() {
    for(var i=0; i<arguments.length; i++) {
        element = document.getElementById(arguments[i]);
        if (element) { element.style.display = 'block'; }
    }
}

function submitAction(action_desc, question) {
    if (!question) {
        question = 'Вы действительно хотите';
    }
    if (!action_desc) {
        action_desc = 'выполнить данное действие';
    }
    question = question + ' ' + action_desc + '?';

    if (confirm(question)) {
        return true;
    }

    return false;
}

function confirmFeedbackAction(form, action, attention) {
    if (attention) {
        alert('Данное действие отменить будет невозможно!');
    }
    submit = submitAction(action);
    if (submit) {
        form.confirm.value='yes';
    }
    return submit;
}

function is_blank(str) {
    if(/\S+/.test(str))
    {
        return false;
    } else {
        return true;
    }
}

function check_form(the_form, form_fields, form_fields_names) {
    alert_string = "";
    focus_element = null;

    nom = 0;
    for (i = 0; i < form_fields.length; i++) {
        if (("checkbox" == the_form[form_fields[i]].type && false == the_form[form_fields[i]].checked) ||
        is_blank(the_form[form_fields[i]].value))
        {
            alert_string += ++nom + ". " + form_fields_names[i] + "\n";
            if (null == focus_element) focus_element = the_form[form_fields[i]];
        }
    }

    if ("" != alert_string) {
        alert(alert_string);
        focus_element.focus();
        return false;
    }

    return true;
}
