// For /Offers/OffersDefautTemplate.aspx

$(document).ready(function () {
    
    $("a.coupon-wrapper").click(function () {
        $("div.error").css("display", "none");
        $("div.check-box-empty", this).toggleClass("check-box");
        $("div.toSelect", this).toggleClass("hide");
        $("div.select-all-wrapper input.chkbox-select-all").removeAttr("checked");

        return false;
    });
    $("div.select-all-wrapper input.chkbox-select-all").attr('style', 'position: absolute; top: 0; right: 0;');
    $("div.select-all-wrapper input.chkbox-select-all").click(function () {
        if ($(this).attr("checked").toString() == "true") {
            $("a.coupon-wrapper").each(function () {
                if ($("div.check-box-empty", this).hasClass("check-box") == false) {
                    toggle(null, $(this).attr("rel"));
                }
            });

            $("div.check-box-empty").addClass('check-box');
            $("div.toSelect").addClass('hide');
        }
        else {
            $("a.coupon-wrapper").each(function () {
                if ($("div.check-box-empty", this).hasClass("check-box") == true) {
                    toggle(null, $(this).attr("rel"));
                }
            });

            $("div.check-box-empty").removeClass('check-box');
            $("div.toSelect").removeClass('hide');
        }
    });
});

