﻿$(document).ready(function () {
    var checkedItems = 0;
    $('.chkCompare').attr('checked', false);
    $('.chkCompare').bind('click', function () {
        if (this.checked)
            checkedItems++;
        else
            checkedItems--;

        if (checkedItems >= 2 && checkedItems <= 5) {
            $('.compareButton').css('background-position', '0 -24px'); //Here's where you put the JS call to the .net button. (do server side check too)
        }
        else {
            $('.compareButton').css('background-position', '0 0');
            $('.compareButton').attr('href', 'javascript:void(0);'); //Here's where you take it away.
        }
    });
});
