﻿

function deleteAll(panelId, lijst){
    $.ajax({ url: 'artikellijsthandler.axd', data: 'delete=all&lijst=' + lijst });
    $('#' + panelId).fadeOut();
    $('#' + panelId).attr('display', 'none');
    return false;
}

function deleteSingle(panelId, id, lijst) {
    $.ajax({ url: 'artikellijsthandler.axd', data: 'delete=' + id + '&lijst=' + lijst });
    $('#' + lijst + '_' + id).hide();
    //debugger;
    if ($('ul.' + lijst + ' > li:visible ').length == 0) {
        $('#' + panelId).fadeOut();
        $('#' + panelId).attr('display', 'none');
        
    }
    
    return false; 
}
         
function artikelLijst_itemLoadCallback(carousel, state, lijst){
    // Since we get all URLs in one file, we simply add all items
    // at once and set the size accordingly.
    debugger;
    if (state != 'init')
        return;
    
    $.get('artikellijsthandler.axd',  {action: 'get', lijst: lijst},  function(data) {
       loadCarousel_itemAddCallBackData(carousel, carousel.first, carousel.last, eval(data), lijst );
    });

}

function artikellijst_getItemHTML(recordID, recordNavigationUrl, recordHint, recordImageUrl, lijst) {

        
    return '<div id="' + lijst + '_' + recordID +  ' class="b2tooltip" title="v' + lijst + '_' + recordID + '"><a class="jcaroussel-delete-single" href="#" onclick="javascript:deleteSingle("' + recordID + '","' + lijst + '");return false;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br />' +
    '<table><tr align="center" valign="middle"><td><a href="' + recordNavigationUrl+ '"><img src="' + recordImageUrl + '" /><a/></td></tr></table><div class="v' + lijst + '_' + recordID + '" style="display:none" >' + recordHint + '</div></div>';
}


function loadCarousel_itemAddCallBackData(carousel, first, last, data, lijst) {

 
    
    for (i = 0; i < data.length; i++) {
        carousel.add(i+1, artikellijst_getItemHTML(data[i].ID,data[i].NavigationUrl, data[i].Hint, data[i].ImageUrl , lijst));
    }
    carousel.size(data.length);
}