﻿function AskRemote(url,onSuccessMethod, onFailureMethod ,param)
{
    j$.ajax({
        url: url,
        type: "GET",       
        success: function (response) {
            response = response || "no response text";
           
            onSuccessMethod(response, param);
        },
        error: function (err) {
            onFailureMethod(err);
        }

    });
}
function AskRemoteSynchro(url,onSuccessMethod, onFailureMethod ,param)
{
    j$.ajax({
        url: url,
        type: "GET",
        async: false,
        success: function (response) {
            response = response || "no response text";
            
            onSuccessMethod(response, param);
        },
        error: function (err) {
            onFailureMethod(err);
        }

    });
}

function AddToSelection(evtsrc, FamiId, ProdId) {
    AskRemote('/Ajax/Selection/AddProduct.aspx?FamiId=' + FamiId + '&ProdId=' + ProdId, UpdateSelectionOk, UdpateSelectionFailed);
    tab.ShowBottomPanel('liSelection');
}

function AddToSelectionCompare(evtsrc, FamiId, ProdId) {
    AskRemote('/Ajax/Selection/AddProductCompare.aspx?FamiId=' + FamiId + '&ProdId=' + ProdId, UpdateSelectionOk, UdpateSelectionFailed);
    tab.ShowBottomPanel('liSelection');
}

function RemoveFromSelection(evtsrc, FamiId, ProdId) {
    AskRemote('/Ajax/Selection/RemoveProduct.aspx?FamiId=' + FamiId + '&ProdId=' + ProdId, UpdateSelectionOk, UdpateSelectionFailed);
    tab.ShowBottomPanel('liSelection');
}
