/* Minification failed. Returning unminified contents.
(1,1): run-time error CSS1019: Unexpected token, found '$'
(1,2): run-time error CSS1019: Unexpected token, found '('
(1,11): run-time error CSS1031: Expected selector, found ')'
(1,11): run-time error CSS1025: Expected comma or open brace, found ')'
(5,2): run-time error CSS1019: Unexpected token, found ')'
(7,10): run-time error CSS1031: Expected selector, found 'clearTable('
(7,10): run-time error CSS1025: Expected comma or open brace, found 'clearTable('
(12,10): run-time error CSS1031: Expected selector, found 'getCommentsByPeriod('
(12,10): run-time error CSS1025: Expected comma or open brace, found 'getCommentsByPeriod('
(23,10): run-time error CSS1031: Expected selector, found 'validateQty('
(23,10): run-time error CSS1025: Expected comma or open brace, found 'validateQty('
(31,10): run-time error CSS1031: Expected selector, found 'disAllowEmptyInComboBox('
(31,10): run-time error CSS1025: Expected comma or open brace, found 'disAllowEmptyInComboBox('
(40,10): run-time error CSS1031: Expected selector, found 'disAllowDeselectAll('
(40,10): run-time error CSS1025: Expected comma or open brace, found 'disAllowDeselectAll('
(46,10): run-time error CSS1031: Expected selector, found 'onlyNumberForValidateFields('
(46,10): run-time error CSS1025: Expected comma or open brace, found 'onlyNumberForValidateFields('
(62,21): run-time error CSS1031: Expected selector, found '='
(62,21): run-time error CSS1025: Expected comma or open brace, found '='
(65,15): run-time error CSS1031: Expected selector, found '='
(65,15): run-time error CSS1025: Expected comma or open brace, found '='
(67,18): run-time error CSS1031: Expected selector, found '='
(67,18): run-time error CSS1025: Expected comma or open brace, found '='
 */
$(document).ready(function () {
    $("#logOff").click(function () {
        $("#logOffPOST").submit();
    });
});

function clearTable(table) {
    table.clear();
    table.draw();
}

function getCommentsByPeriod(periodId, callback)
{
    $.ajax({
        url: '/Api/Comments/GetCommentsByPeriod?periodId=' + periodId,
        dataType: 'json',
        cache: false,
        type: 'GET',
        success: callback
    });
}

function validateQty(event) {
    var key = window.event ? event.keyCode : event.which;
    if (key < 48 || key > 57) {
        return false;
    }
    else return true;
};

function disAllowEmptyInComboBox(option, checked, select) {
    optionValue = $(option).val();
    if (select.val().length == 0) {
        if (!checked) {
            select.multiselect('select', [optionValue], true);
        }
    }
}

function disAllowDeselectAll(select)
{
    select.multiselect('select', select.find('option').val());
    select.multiselect('refresh');
}

function onlyNumberForValidateFields(e) {
    // Allow: backspace, delete, tab, escape, enter
    if ($.inArray(e.keyCode, [46, 8, 9, 27, 13]) !== -1 ||
        // Allow: Ctrl+A, Command+A
        (e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
        // Allow: home, end, left, right, down, up
        (e.keyCode >= 35 && e.keyCode <= 40)) {
        // let it happen, don't do anything
        return;
    }
    // Ensure that it is a number and stop the keypress
    if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
        e.preventDefault();
    }
}

globalLoadingButton = '<img src="/Content/images/loading_button.gif" width="20" height="20"/>';

//var globalErrorMessage = "Сталася помилка спробуйте, ще раз";
var barometer = barometer || {};

barometer.config = {
    typeData : {
        hostel: 1,
        hotelAndHostelAndTIC: 2,
        hotel: 3,
        regularAirport: 4,
        charterAirport: 5
    },

    userType: {
        hotel: "1",
        hostel: "2",
        operator: "3",
        TIC: "4",
        airport: "5",
        admin: "6"
    },

    bootstrapMultiselect: {
        selectAllText: 'Вибрати всі',
        allSelectedText: 'Обрані всі',
        nSelectedText: 'вибрано'
    }
}
