/* 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 ')'
(7,2): run-time error CSS1019: Unexpected token, found ')'
(9,10): run-time error CSS1031: Expected selector, found 'RefresqueGridKendo('
(9,10): run-time error CSS1025: Expected comma or open brace, found 'RefresqueGridKendo('
(14,10): run-time error CSS1031: Expected selector, found 'ConfigureComboAjax('
(14,10): run-time error CSS1025: Expected comma or open brace, found 'ConfigureComboAjax('
(37,10): run-time error CSS1031: Expected selector, found 'EstablezcaFormatoDeFechasALasValidaciones('
(37,10): run-time error CSS1025: Expected comma or open brace, found 'EstablezcaFormatoDeFechasALasValidaciones('
(51,10): run-time error CSS1031: Expected selector, found 'SerializadorDeFormulariosEnJson('
(51,10): run-time error CSS1025: Expected comma or open brace, found 'SerializadorDeFormulariosEnJson('
(70,10): run-time error CSS1031: Expected selector, found 'MuestreMensajeSiAplica('
(70,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreMensajeSiAplica('
(77,10): run-time error CSS1031: Expected selector, found 'MuestreMensaje('
(77,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreMensaje('
(89,10): run-time error CSS1031: Expected selector, found 'MuestreAdvertencia('
(89,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreAdvertencia('
(100,10): run-time error CSS1031: Expected selector, found 'MuestreError('
(100,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreError('
(111,10): run-time error CSS1031: Expected selector, found 'MuestreMensajeYRedireccione('
(111,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreMensajeYRedireccione('
(130,10): run-time error CSS1031: Expected selector, found 'MuestreConfirmacion('
(130,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreConfirmacion('
(149,10): run-time error CSS1031: Expected selector, found 'EscribaErrorDeAjaxEnConsola('
(149,10): run-time error CSS1025: Expected comma or open brace, found 'EscribaErrorDeAjaxEnConsola('
(154,10): run-time error CSS1031: Expected selector, found 'ActualiceTabla('
(154,10): run-time error CSS1025: Expected comma or open brace, found 'ActualiceTabla('
(159,10): run-time error CSS1031: Expected selector, found 'EditeColumnaDeTabla('
(159,10): run-time error CSS1025: Expected comma or open brace, found 'EditeColumnaDeTabla('
(166,10): run-time error CSS1031: Expected selector, found 'ObtengaValorDeColumnaTabla('
(166,10): run-time error CSS1025: Expected comma or open brace, found 'ObtengaValorDeColumnaTabla('
(171,10): run-time error CSS1031: Expected selector, found 'ElimineFilaDeTabla('
(171,10): run-time error CSS1025: Expected comma or open brace, found 'ElimineFilaDeTabla('
(176,10): run-time error CSS1031: Expected selector, found 'InicialiceValidacionesDeFormularioDinamico('
(176,10): run-time error CSS1025: Expected comma or open brace, found 'InicialiceValidacionesDeFormularioDinamico('
(184,10): run-time error CSS1031: Expected selector, found 'ObtengaBotonesParaListar('
(184,10): run-time error CSS1025: Expected comma or open brace, found 'ObtengaBotonesParaListar('
(192,10): run-time error CSS1031: Expected selector, found 'InicialiceCalendario('
(192,10): run-time error CSS1025: Expected comma or open brace, found 'InicialiceCalendario('
(200,10): run-time error CSS1031: Expected selector, found 'InicialiceCalendarioConEventoDeSeleccion('
(200,10): run-time error CSS1025: Expected comma or open brace, found 'InicialiceCalendarioConEventoDeSeleccion('
(208,1): run-time error CSS1019: Unexpected token, found '$'
(208,2): run-time error CSS1019: Unexpected token, found '('
(208,11): run-time error CSS1031: Expected selector, found ')'
(208,11): run-time error CSS1025: Expected comma or open brace, found ')'
(214,2): run-time error CSS1019: Unexpected token, found ')'
(216,10): run-time error CSS1031: Expected selector, found 'RefresqueGridKendo('
(216,10): run-time error CSS1025: Expected comma or open brace, found 'RefresqueGridKendo('
(221,10): run-time error CSS1031: Expected selector, found 'ConfigureComboAjax('
(221,10): run-time error CSS1025: Expected comma or open brace, found 'ConfigureComboAjax('
(244,10): run-time error CSS1031: Expected selector, found 'EstablezcaFormatoDeFechasALasValidaciones('
(244,10): run-time error CSS1025: Expected comma or open brace, found 'EstablezcaFormatoDeFechasALasValidaciones('
(258,10): run-time error CSS1031: Expected selector, found 'SerializadorDeFormulariosEnJson('
(258,10): run-time error CSS1025: Expected comma or open brace, found 'SerializadorDeFormulariosEnJson('
(277,10): run-time error CSS1031: Expected selector, found 'MuestreMensajeSiAplica('
(277,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreMensajeSiAplica('
(284,10): run-time error CSS1031: Expected selector, found 'MuestreMensaje('
(284,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreMensaje('
(296,10): run-time error CSS1031: Expected selector, found 'MuestreAdvertencia('
(296,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreAdvertencia('
(307,10): run-time error CSS1031: Expected selector, found 'MuestreError('
(307,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreError('
(318,10): run-time error CSS1031: Expected selector, found 'MuestreMensajeYRedireccione('
(318,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreMensajeYRedireccione('
(337,10): run-time error CSS1031: Expected selector, found 'MuestreConfirmacion('
(337,10): run-time error CSS1025: Expected comma or open brace, found 'MuestreConfirmacion('
(356,10): run-time error CSS1031: Expected selector, found 'EscribaErrorDeAjaxEnConsola('
(356,10): run-time error CSS1025: Expected comma or open brace, found 'EscribaErrorDeAjaxEnConsola('
(361,10): run-time error CSS1031: Expected selector, found 'ActualiceTabla('
(361,10): run-time error CSS1025: Expected comma or open brace, found 'ActualiceTabla('
(366,10): run-time error CSS1031: Expected selector, found 'EditeColumnaDeTabla('
(366,10): run-time error CSS1025: Expected comma or open brace, found 'EditeColumnaDeTabla('
(373,10): run-time error CSS1031: Expected selector, found 'ObtengaValorDeColumnaTabla('
(373,10): run-time error CSS1025: Expected comma or open brace, found 'ObtengaValorDeColumnaTabla('
(378,10): run-time error CSS1031: Expected selector, found 'ElimineFilaDeTabla('
(378,10): run-time error CSS1025: Expected comma or open brace, found 'ElimineFilaDeTabla('
(383,10): run-time error CSS1031: Expected selector, found 'InicialiceValidacionesDeFormularioDinamico('
(383,10): run-time error CSS1025: Expected comma or open brace, found 'InicialiceValidacionesDeFormularioDinamico('
(391,10): run-time error CSS1031: Expected selector, found 'ObtengaBotonesParaListar('
(391,10): run-time error CSS1025: Expected comma or open brace, found 'ObtengaBotonesParaListar('
(399,10): run-time error CSS1031: Expected selector, found 'InicialiceCalendario('
(399,10): run-time error CSS1025: Expected comma or open brace, found 'InicialiceCalendario('
(407,10): run-time error CSS1031: Expected selector, found 'InicialiceCalendarioConEventoDeSeleccion('
(407,10): run-time error CSS1025: Expected comma or open brace, found 'InicialiceCalendarioConEventoDeSeleccion('
(415,10): run-time error CSS1031: Expected selector, found 'LimpieMensajeDeError('
(415,10): run-time error CSS1025: Expected comma or open brace, found 'LimpieMensajeDeError('
(420,10): run-time error CSS1031: Expected selector, found 'EscribeMensajeDeError('
(420,10): run-time error CSS1025: Expected comma or open brace, found 'EscribeMensajeDeError('
(425,10): run-time error CSS1031: Expected selector, found 'HagaVisibleLaValidacion('
(425,10): run-time error CSS1025: Expected comma or open brace, found 'HagaVisibleLaValidacion('
(436,10): run-time error CSS1031: Expected selector, found 'HagaInvisibleLaValidacion('
(436,10): run-time error CSS1025: Expected comma or open brace, found 'HagaInvisibleLaValidacion('
(446,10): run-time error CSS1031: Expected selector, found 'LimpieMensajeDeError('
(446,10): run-time error CSS1025: Expected comma or open brace, found 'LimpieMensajeDeError('
(451,10): run-time error CSS1031: Expected selector, found 'EscribeMensajeDeError('
(451,10): run-time error CSS1025: Expected comma or open brace, found 'EscribeMensajeDeError('
(456,10): run-time error CSS1031: Expected selector, found 'HagaVisibleLaValidacion('
(456,10): run-time error CSS1025: Expected comma or open brace, found 'HagaVisibleLaValidacion('
(467,10): run-time error CSS1031: Expected selector, found 'HagaInvisibleLaValidacion('
(467,10): run-time error CSS1025: Expected comma or open brace, found 'HagaInvisibleLaValidacion('
(477,1): run-time error CSS1019: Unexpected token, found '$'
(477,2): run-time error CSS1019: Unexpected token, found '('
(477,11): run-time error CSS1031: Expected selector, found ')'
(477,11): run-time error CSS1025: Expected comma or open brace, found ')'
(485,2): run-time error CSS1019: Unexpected token, found ')'
(487,10): run-time error CSS1031: Expected selector, found 'ajaxindicatorstop('
(487,10): run-time error CSS1025: Expected comma or open brace, found 'ajaxindicatorstop('
(492,10): run-time error CSS1031: Expected selector, found 'ajaxindicatorstart('
(492,10): run-time error CSS1025: Expected comma or open brace, found 'ajaxindicatorstart('
(534,1): run-time error CSS1019: Unexpected token, found '$'
(534,2): run-time error CSS1019: Unexpected token, found '('
(534,11): run-time error CSS1031: Expected selector, found ')'
(534,11): run-time error CSS1025: Expected comma or open brace, found ')'
(542,2): run-time error CSS1019: Unexpected token, found ')'
(544,10): run-time error CSS1031: Expected selector, found 'ajaxindicatorstop('
(544,10): run-time error CSS1025: Expected comma or open brace, found 'ajaxindicatorstop('
(549,10): run-time error CSS1031: Expected selector, found 'ajaxindicatorstart('
(549,10): run-time error CSS1025: Expected comma or open brace, found 'ajaxindicatorstart('
(591,10): run-time error CSS1031: Expected selector, found 'InicialiceLaTablaDeHistoricos('
(591,10): run-time error CSS1025: Expected comma or open brace, found 'InicialiceLaTablaDeHistoricos('
 */
$(document).ready(function () {
    //Funcion necesaria para serializar formularios en json
    SerializadorDeFormulariosEnJson();
    MuestreMensajeSiAplica();
    EstablezcaFormatoDeFechasALasValidaciones();

});

function RefresqueGridKendo(elNombreDelGrid) {
    var grid = $("#" + elNombreDelGrid).data("kendoGrid");
    grid.dataSource.read();
}

function ConfigureComboAjax(elIdDelControl, elMetodoEnElController) {
    $("#" + elIdDelControl).select2({
        ajax: {
            url: elMetodoEnElController,
            dataType: 'json',
            delay: 400,
            casesensitive: false,
            allowClear: true,
            data: function (params) {
                return {
                    elCriterioDeBusqueda: params.term, // search term
                    page: params.page
                };
            },
            processResults: function (data) {
                return {
                    results: data.items
                };
            },
        }
    });
}

function EstablezcaFormatoDeFechasALasValidaciones() {
    $.validator.addMethod(
        "date",
        function (value, element) {
            var bits = value.match(/([0-9]+)/gi), str;
            if (!bits)
                return this.optional(element) || false;
            str = bits[1] + '/' + bits[0] + '/' + bits[2];
            return this.optional(element) || !/Invalid|NaN/.test(new Date(str));
        },
        "Please enter a date in the format dd/mm/yyyy"
    );
}

function SerializadorDeFormulariosEnJson() {
    $.fn.serializeObject = function () {
        var o = {};
        var a = this.serializeArray();
        $.each(a, function () {
            if (o[this.name]) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    };
}


function MuestreMensajeSiAplica() {
    if ($('#MostrarMensaje').val() === "True") {
        MuestreMensaje($('#Mensaje').val());
        $('#MostrarMensaje').val('False');
    }
}

function MuestreMensaje(elMensaje) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        confirmButtonColor: "#1AB394",
        type: "success"
    });
}

function MuestreAdvertencia(elMensaje) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        type: "warning"
    });
}

function MuestreError(elMensaje) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: '',
        text: elMensaje,
        type: "error"
    });
}

function MuestreMensajeYRedireccione(elMensaje, laUrlADireccionar) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        type: "success",
        showCancelButton: false,
        confirmButtonText: "Ok",
        confirmButtonColor: "#1AB394",
        cancelButtonText: "No",
        closeOnConfirm: false
    },
        function () {
            window.location.href = laUrlADireccionar;
        });
}

function MuestreConfirmacion(elMensaje, laFuncionAInvocar, losParametros) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Si",
        cancelButtonText: "No",
        closeOnConfirm: false
    },
        function () {
            laFuncionAInvocar(losParametros);
        });
}

function EscribaErrorDeAjaxEnConsola(elRequest) {
    console.log(elRequest.statusText);
    console.log(elRequest.responseText);
}

function ActualiceTabla(elIdDeLaTabla) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    laTabla.draw(true);
}

function EditeColumnaDeTabla(elIdDeLaTabla, laColumnaAEditar, elNuevoValor) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    var lasColumnas = laTabla.row(laFilaSeleccionada).data()
    lasColumnas[laColumnaAEditar] = elNuevoValor;
    laTabla.row(laFilaSeleccionada).data(lasColumnas);
}

function ObtengaValorDeColumnaTabla(elIdDeLaTabla, elNumeroDeColumna, laFila) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    var lasColumnas = laTabla.row(laFila).data();
    return lasColumnas[elNumeroDeColumna];
}
function ElimineFilaDeTabla(elIdDeLaTabla) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    laTabla.row(laFilaSeleccionada).remove().draw(false);
}

function InicialiceValidacionesDeFormularioDinamico(elIdDelFormulario) {
    //get the relevant form
    var elFormulario = $('#' + elIdDelFormulario);
    // delete validator in case someone called form.validate()
    $(elFormulario).removeData("validator");
    $.validator.unobtrusive.parse(elFormulario);
}

function ObtengaBotonesParaListar() {
    var elContenedorInicio = '<div class="btn-group btn-group-xs" role="group">';
    var elBotonEliminar = '<button type="button" onclick="ElimineItemDeLista()" class="btn btn-light"><i class="fa fa-trash" style="color:red"></i></button>';
    var elBotonEditar = '<button type="button" onclick="EditeItemDeLista()" class="btn btn-light"><i class="fa fa-edit text-success"></i></button>'
    var elContenedorCierre = '</div>';
    return elContenedorInicio + elBotonEditar + elBotonEliminar + elContenedorCierre;
}

function InicialiceCalendario(elIdDelDiv, elIdDelcampo) {   
    $('#' + elIdDelDiv + ' .input-group.date').datepicker({
        format: "dd/mm/yyyy", todayBtn: "linked", keyboardNavigation: false, forceParse: false, calendarWeeks: true, autoclose: true
    }).on('changeDate', function (e) {
        $('#' + elIdDelcampo).valid();
    });  
}

function InicialiceCalendarioConEventoDeSeleccion(elIdDelDiv, elIdDelCampo, laFuncionAInvocar) {
    $('#' + elIdDelDiv + ' .input-group.date').datepicker({
        format: "dd/mm/yyyy", todayBtn: "linked", keyboardNavigation: false, forceParse: false, calendarWeeks: true, autoclose: true
    }).on('changeDate', function (e) {
        $('#' + elIdDelCampo).valid();
        laFuncionAInvocar();
    });
}
$(document).ready(function () {
    //Funcion necesaria para serializar formularios en json
    SerializadorDeFormulariosEnJson();
    MuestreMensajeSiAplica();
    EstablezcaFormatoDeFechasALasValidaciones();

});

function RefresqueGridKendo(elNombreDelGrid) {
    var grid = $("#" + elNombreDelGrid).data("kendoGrid");
    grid.dataSource.read();
}

function ConfigureComboAjax(elIdDelControl, elMetodoEnElController) {
    $("#" + elIdDelControl).select2({
        ajax: {
            url: elMetodoEnElController,
            dataType: 'json',
            delay: 400,
            casesensitive: false,
            allowClear: true,
            data: function (params) {
                return {
                    elCriterioDeBusqueda: params.term, // search term
                    page: params.page
                };
            },
            processResults: function (data) {
                return {
                    results: data.items
                };
            },
        }
    });
}

function EstablezcaFormatoDeFechasALasValidaciones() {
    $.validator.addMethod(
        "date",
        function (value, element) {
            var bits = value.match(/([0-9]+)/gi), str;
            if (!bits)
                return this.optional(element) || false;
            str = bits[1] + '/' + bits[0] + '/' + bits[2];
            return this.optional(element) || !/Invalid|NaN/.test(new Date(str));
        },
        "Please enter a date in the format dd/mm/yyyy"
    );
}

function SerializadorDeFormulariosEnJson() {
    $.fn.serializeObject = function () {
        var o = {};
        var a = this.serializeArray();
        $.each(a, function () {
            if (o[this.name]) {
                if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                }
                o[this.name].push(this.value || '');
            } else {
                o[this.name] = this.value || '';
            }
        });
        return o;
    };
}


function MuestreMensajeSiAplica() {
    if ($('#MostrarMensaje').val() === "True") {
        MuestreMensaje($('#Mensaje').val());
        $('#MostrarMensaje').val('False');
    }
}

function MuestreMensaje(elMensaje) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        confirmButtonColor: "#1AB394",
        type: "success"
    });
}

function MuestreAdvertencia(elMensaje) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        type: "warning"
    });
}

function MuestreError(elMensaje) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: '',
        text: elMensaje,
        type: "error"
    });
}

function MuestreMensajeYRedireccione(elMensaje, laUrlADireccionar) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        type: "success",
        showCancelButton: false,
        confirmButtonText: "Ok",
        confirmButtonColor: "#1AB394",
        cancelButtonText: "No",
        closeOnConfirm: false
    },
        function () {
            window.location.href = laUrlADireccionar;
        });
}

function MuestreConfirmacion(elMensaje, laFuncionAInvocar, losParametros) {
    if (elMensaje.length > 300) {
        elMensaje = elMensaje.substring(0, 300) + '...';
    }
    swal({
        title: elMensaje,
        text: "",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Si",
        cancelButtonText: "No",
        closeOnConfirm: false
    },
        function () {
            laFuncionAInvocar(losParametros);
        });
}

function EscribaErrorDeAjaxEnConsola(elRequest) {
    console.log(elRequest.statusText);
    console.log(elRequest.responseText);
}

function ActualiceTabla(elIdDeLaTabla) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    laTabla.draw(true);
}

function EditeColumnaDeTabla(elIdDeLaTabla, laColumnaAEditar, elNuevoValor) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    var lasColumnas = laTabla.row(laFilaSeleccionada).data()
    lasColumnas[laColumnaAEditar] = elNuevoValor;
    laTabla.row(laFilaSeleccionada).data(lasColumnas);
}

function ObtengaValorDeColumnaTabla(elIdDeLaTabla, elNumeroDeColumna, laFila) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    var lasColumnas = laTabla.row(laFila).data();
    return lasColumnas[elNumeroDeColumna];
}
function ElimineFilaDeTabla(elIdDeLaTabla) {
    var laTabla = $('#' + elIdDeLaTabla).DataTable();
    laTabla.row(laFilaSeleccionada).remove().draw(false);
}

function InicialiceValidacionesDeFormularioDinamico(elIdDelFormulario) {
    //get the relevant form
    var elFormulario = $('#' + elIdDelFormulario);
    // delete validator in case someone called form.validate()
    $(elFormulario).removeData("validator");
    $.validator.unobtrusive.parse(elFormulario);
}

function ObtengaBotonesParaListar() {
    var elContenedorInicio = '<div class="btn-group btn-group-xs" role="group">';
    var elBotonEliminar = '<button type="button" onclick="ElimineItemDeLista()" class="btn btn-light"><i class="fa fa-trash" style="color:red"></i></button>';
    var elBotonEditar = '<button type="button" onclick="EditeItemDeLista()" class="btn btn-light"><i class="fa fa-edit text-success"></i></button>'
    var elContenedorCierre = '</div>';
    return elContenedorInicio + elBotonEditar + elBotonEliminar + elContenedorCierre;
}

function InicialiceCalendario(elIdDelDiv, elIdDelcampo) {   
    $('#' + elIdDelDiv + ' .input-group.date').datepicker({
        format: "dd/mm/yyyy", todayBtn: "linked", keyboardNavigation: false, forceParse: false, calendarWeeks: true, autoclose: true
    }).on('changeDate', function (e) {
        $('#' + elIdDelcampo).valid();
    });  
}

function InicialiceCalendarioConEventoDeSeleccion(elIdDelDiv, elIdDelCampo, laFuncionAInvocar) {
    $('#' + elIdDelDiv + ' .input-group.date').datepicker({
        format: "dd/mm/yyyy", todayBtn: "linked", keyboardNavigation: false, forceParse: false, calendarWeeks: true, autoclose: true
    }).on('changeDate', function (e) {
        $('#' + elIdDelCampo).valid();
        laFuncionAInvocar();
    });
}
function LimpieMensajeDeError(idMsgError, idDelControl) {
    $("#" + idMsgError).text("");
    HagaInvisibleLaValidacion(idMsgError, idDelControl);
}

function EscribeMensajeDeError(idMsgError, idDelControl, mensaje) {
    $("#" + idMsgError).text(mensaje);
    HagaVisibleLaValidacion(idMsgError, idDelControl);
}

function HagaVisibleLaValidacion(IdMsgError, IdInput) {

    if (IdInput != undefined) {
        $("#" + IdInput).addClass("input-validation-error");
        $("#" + IdInput).removeClass("valid");
    }

    $("#" + IdMsgError).removeClass("field-validation-valid");
    $("#" + IdMsgError).addClass("field-validation-error");
}

function HagaInvisibleLaValidacion(IdMsgError, IdInput) {

    if (IdInput != undefined) {
        $("#" + IdInput).removeClass("input-validation-error");
        $("#" + IdInput).addClass("valid");
    }

    $("#" + IdMsgError).addClass("field-validation-valid");
    $("#" + IdMsgError).removeClass("field-validation-error");
}
function LimpieMensajeDeError(idMsgError, idDelControl) {
    $("#" + idMsgError).text("");
    HagaInvisibleLaValidacion(idMsgError, idDelControl);
}

function EscribeMensajeDeError(idMsgError, idDelControl, mensaje) {
    $("#" + idMsgError).text(mensaje);
    HagaVisibleLaValidacion(idMsgError, idDelControl);
}

function HagaVisibleLaValidacion(IdMsgError, IdInput) {

    if (IdInput != undefined) {
        $("#" + IdInput).addClass("input-validation-error");
        $("#" + IdInput).removeClass("valid");
    }

    $("#" + IdMsgError).removeClass("field-validation-valid");
    $("#" + IdMsgError).addClass("field-validation-error");
}

function HagaInvisibleLaValidacion(IdMsgError, IdInput) {

    if (IdInput != undefined) {
        $("#" + IdInput).removeClass("input-validation-error");
        $("#" + IdInput).addClass("valid");
    }

    $("#" + IdMsgError).addClass("field-validation-valid");
    $("#" + IdMsgError).removeClass("field-validation-error");
}
$(document).ready(function () {
    jQuery(document).ajaxStart(function () {
        //show ajax indicator
       ajaxindicatorstart();
    }).ajaxStop(function () {
        //hide ajax indicator
      ajaxindicatorstop();
    });
});

function ajaxindicatorstop() {
        jQuery('#resultLoading .bg').height('100%');
        jQuery('#resultLoading').fadeOut(300);
        jQuery('body').css('cursor', 'default');
}
function ajaxindicatorstart() {
        jQuery('#resultLoading').css({
            'width': '100%',
            'height': '100%',
            'position': 'fixed',
            'z-index': '10000000',
            'top': '0',
            'left': '0',
            'right': '0',
            'bottom': '0',
            'margin': 'auto'
        });

        jQuery('#resultLoading .bg').css({
            'background': '#000000',
            'opacity': '0.7',
            'width': '100%',
            'height': '100%',
            'position': 'absolute',
            'top': '0'
        });

        jQuery('#resultLoading>div:first').css({
            'width': '250px',
            'height': '75px',
            'text-align': 'center',
            'position': 'fixed',
            'top': '0',
            'left': '0',
            'right': '0',
            'bottom': '0',
            'margin': 'auto',
            'font-size': '16px',
            'z-index': '10',
            'color': '#ffffff'

        });

        jQuery('#resultLoading .bg').height('100%');
        jQuery('#resultLoading').fadeIn(300);
        jQuery('body').css('cursor', 'wait');
    }
$(document).ready(function () {
    jQuery(document).ajaxStart(function () {
        //show ajax indicator
       ajaxindicatorstart();
    }).ajaxStop(function () {
        //hide ajax indicator
      ajaxindicatorstop();
    });
});

function ajaxindicatorstop() {
        jQuery('#resultLoading .bg').height('100%');
        jQuery('#resultLoading').fadeOut(300);
        jQuery('body').css('cursor', 'default');
}
function ajaxindicatorstart() {
        jQuery('#resultLoading').css({
            'width': '100%',
            'height': '100%',
            'position': 'fixed',
            'z-index': '10000000',
            'top': '0',
            'left': '0',
            'right': '0',
            'bottom': '0',
            'margin': 'auto'
        });

        jQuery('#resultLoading .bg').css({
            'background': '#000000',
            'opacity': '0.7',
            'width': '100%',
            'height': '100%',
            'position': 'absolute',
            'top': '0'
        });

        jQuery('#resultLoading>div:first').css({
            'width': '250px',
            'height': '75px',
            'text-align': 'center',
            'position': 'fixed',
            'top': '0',
            'left': '0',
            'right': '0',
            'bottom': '0',
            'margin': 'auto',
            'font-size': '16px',
            'z-index': '10',
            'color': '#ffffff'

        });

        jQuery('#resultLoading .bg').height('100%');
        jQuery('#resultLoading').fadeIn(300);
        jQuery('body').css('cursor', 'wait');
    }
function InicialiceLaTablaDeHistoricos(elId, mostrarPaginar, mostrarBusqueda) {
    $('#' + elId).DataTable({
        "paging": mostrarPaginar,
        "searching": mostrarBusqueda,
        "scrollX": true,
        "scrollY": 300,
        language: {
            "url": urlDeIdiomaParaElGrid
        }
    });
}

