function confirm_link(theLink, theMessage)
{
    var is_confirmed = confirm(theMessage);

    return is_confirmed;
} // end of the 'confirm_link()' function

function confirm_link_delete(theLink) {
    return confirm_link(theLink, 'Вы уверены, что хотите это удалить?');
}

function confirm_link_remove(theLink) {
    return confirm_link(theLink, 'Вы уверены, что хотите убрать из каталога этот предмет?');
}

function in_array(needle, haystack) {
    for (var i = 0; i <= haystack.length; i++) {
        if (needle == haystack[i]) return true;
    }
    
    return false;
}

function validate_email(email) {
    var regex = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
    
    return regex.test(email)
}

function update_checked(i) {
    if (document.getElementById(i).checked) {
        document.getElementById('l_' + i).style.fontWeight = 'bold';
    } else {
        document.getElementById('l_' + i).style.fontWeight = 'normal';
    }
}