$(document).ready(function () {
    if ($("a.fancylink").length > 0)
        $("a.fancylink").colorbox({
            iframe: true,
            innerWidth: "70%",
            innerHeight: 300
        });
    $("#cboxClose").click(function () {
        parent.location.reload();
    });
    //check box validation to update status
    $(".update_btn_table").click(function () {
        var selectedGroups = '';
        if ($(this).attr("id") == "submitNotPaid") {
            if ($(".ListAll:checked").size() == 0) {
                jAlert(msgSelectItem);
                return false;
            }
            var status = 'Active';
            $("input[name='checkNotPaidOrderIDs[]']:checked").each(function () {
                selectedGroups += $(this).val() + ":";
            });
            var affiliateUserID = $('#affiliateUserID').val();
            var thishref = $("a.fancylink").attr("href");
            thishref += "orderIDs/" + selectedGroups + "/affiliateUserID/" + affiliateUserID + "/status/" + status + "/";
        } else {
            var status = 'Deleted';
            if ($(".PaidListAll:checked").size() == 0) {
                jAlert(msgSelectItem);
                return false;
            }
            $("input[name='transactionIDs[]']:checked").each(function () {
                selectedGroups += $(this).val() + ":";
            });
            var affiliateUserID = $('#affiliateUserID').val();
            var thishref = $("a.fancylink").attr("href");
            thishref += "transactionIDs/" + selectedGroups + "/affiliateUserID/" + affiliateUserID + "/status/" + status + "/";
        }
        $("a.fancylink").attr("href", thishref);
        $("a.fancylink").trigger('click');
        return false;
    });
});