
  var search = new function() {

    var thisObj = this;

    /*
    @public
    */
    this.init = function() {
      $('children').observe('change', handleChildrenChange);
      $('children').observe('keyup', handleChildrenChange);
    }

    /*
    @private
    */
    function handleChildrenChange() {

      var noChildren = this.getValue();

      if(noChildren > 0) {
        $('childAges').show();
      }
      else {
        $('childAges').hide();
      }

      for(var i = 0, k = this.options.length-1; i < k; i++) {

        if(i < noChildren) {
          $$('#childAges .fieldWithLabel')[i].show();
        }
        else {
          $$('#childAges .fieldWithLabel')[i].hide();
        }
      }
    }
  }

  Event.observe(window, 'load', search.init);
