
var Shuffler = new Class({

  initialize: function() {
    var checks = $('shuffle_books').getElements('input[type=checkbox]');
    checks.each(function(el) {
      var vol = el.id.substr(0, 2);
      el.addEvent('click', function(e) {
        this.checkBook(vol);
      }.bind(this));
    }, this);
  },
  
  checkBook: function(vol) {
    var el = $(vol + 'chk');
    var rads = $('shuffle_books').getElements('input[name=' + vol + 'sel]');
    if(el.checked == true) {
      rads.each(function(ra) {
        ra.setProperty('disabled', '');
      });
    } else {
      rads.each(function(ra) {
        ra.setProperty('disabled', 'disabled');
      });
    }
  },
  
  shuffle: function() {
    $('shuffle_out').addClass('loading');
    var qs = $('form1').toQueryString();
    var url = 'shuffler.php?o=x&' + qs;
  }
  
});

var myApp;
window.addEvent('domready', function() { myApp = new Shuffler(); });