
var CalendarFilter = function (pCheckboxes, pWebservice) {
  var webservice = pWebservice;
  var checkboxes = pCheckboxes;
  var that  = this;
  var handle_checkbox = function (e) {
    var t = YAHOO.util.Event.getTarget(e);
    if (t.type == 'checkbox') {
      that.handle();
    }
  };
  this.handle = function () {
    var i = 0;
    var mask = 0;
    for (i=0; i<checkboxes.length; ++i) {
      if (checkboxes[i].checked) {
        mask += parseInt(checkboxes[i].value);
      }
    }
    webservice.filter(mask);
  };
  this.handle();
  this.subscribe_events = function() {
    YAHOO.util.Event.addListener('form.div', 'click', handle_checkbox);
  }
};