/* Minification failed. Returning unminified contents.
(1,1): run-time error CSS1019: Unexpected token, found '$'
(1,2): run-time error CSS1019: Unexpected token, found '('
(1,12): run-time error CSS1031: Expected selector, found '('
(1,12): run-time error CSS1025: Expected comma or open brace, found '('
(4,2): run-time error CSS1019: Unexpected token, found ')'
(7,10): run-time error CSS1031: Expected selector, found 'list_filterEvent('
(7,10): run-time error CSS1025: Expected comma or open brace, found 'list_filterEvent('
(15,10): run-time error CSS1031: Expected selector, found 'list_eventChange('
(15,10): run-time error CSS1025: Expected comma or open brace, found 'list_eventChange('
(23,10): run-time error CSS1031: Expected selector, found 'list_FilterClick('
(23,10): run-time error CSS1025: Expected comma or open brace, found 'list_FilterClick('
(30,10): run-time error CSS1031: Expected selector, found 'list_PagerClick('
(30,10): run-time error CSS1025: Expected comma or open brace, found 'list_PagerClick('
(36,10): run-time error CSS1031: Expected selector, found 'get_Filters('
(36,10): run-time error CSS1025: Expected comma or open brace, found 'get_Filters('
(69,10): run-time error CSS1031: Expected selector, found 'show_data_list('
(69,10): run-time error CSS1025: Expected comma or open brace, found 'show_data_list('
 */
$(function () {
    //handle events here

});

//called on change of filter event or click search from DOM ready
function list_filterEvent(index) {
    if ($('.list_data_cp').length) {
        document.getElementById("hfCurrentPageIndex").value = 1;        
        $('#form_list_data_cp').submit();
    }
}

//called from partial views
function list_eventChange() {    
    $('.bPage').off().on('click', function (event) {
        //alert("J");
        event.preventDefault();
        list_PagerClick(this.id);
    });
}
//called from eventChange filters
function list_FilterClick(index) {
    if ($('.list_data_cp').length) {
        document.getElementById("hfCurrentPageIndex").value = 1;
        show_data_list(false)
    }
}
//called from eventChange pager
function list_PagerClick(index) {
    //alert(index);
    document.getElementById("hfCurrentPageIndex").value = index;
    show_data_list(false)
}
//call to get Filters
function get_Filters() {
    var sTemp = "";
    if ($('.item_list').length) {
        var artcomm1 = "";
        var artcomm2 = "";
        var artcomm3 = "";
        var artcomm4 = "";
        var artcomm5 = "";
        if ($('.div_Artcomm1').length) {
            artcomm1 = $('#filters_sArtcomm1').val();
        }
        if ($('.div_Artcomm2').length) {
            artcomm2 = $('#filters_sArtcomm2').val();
        }
        if ($('.div_Artcomm3').length) {
            artcomm3 = $('#filters_sArtcomm3').val();
        }
        if ($('.div_Artcomm4').length) {
            artcomm4 = $('#filters_sArtcomm4').val();
        }
        if ($('.div_Artcomm5').length) {
            artcomm5 = $('#filters_sArtcomm5').val();
        }
        sTemp = {
            "Artcomm1": artcomm1,
            "Artcomm2": artcomm2,
            "Artcomm3": artcomm3,
            "Artcomm4": artcomm4,
            "Artcomm5": artcomm5
        };        
    }
    return JSON.stringify(sTemp);;
}
function show_data_list(bInit) {
    var page = 1;
    var filter = "";
    var sort = "";
    var search = "";
    var url = $('#controller_url').val();
    var category = $('#category_urlkey').attr("data-id");
    if (bInit) {
        page = 1;
        filter = "";
        sort = "";        
    } else {
        page = $('#hfCurrentPageIndex').val();
        filter = get_Filters();
        sort = "";
        search = "";
    }
    $.ajax({
        url: url,
        type: "post",
        data: { currentPage: page, filter: filter, sorting: sort, searchText: search, category: category },
        success: function (result) {
            //$("#content_placeholder_div").remove();
            $("#data_content_holder").html(result);
        },
        complete: function () {
            // unblock when remote call returns     
            //setTimeout($.unblockUI, 10);
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert(xhr.status);
            alert(thrownError);
        }
    });
}

