
/*
 * Further extends the standard form validation class to check for multiple weeks/stations (which
 * isn't valid)
 */
 
var FormCompleteMonthly = new Class({

    Extends: FormComplete,
    
    
 
    /**
     * Extends the base _check_valid() method to add checks for multiple weeks/stations.
     * If more than one station is selected there may only be one week selected.
     *
     * @return boolean
     */
    _check_valid: function() {

        // if the base validation fails, we can skip our checks and return
        // false immediately
        if(!this.parent()) {
            return false;
        }

        // check the number of periods selected hasn't surpassed the limit
        var int_count = $('period').getElements('option[selected]').length;
        
        if(int_count > this.options.int_max_periods) {
            //$('button_submit').addClass('button_disabled').setProperty('disabled', true);
            //$('form_report').getElement('.invalid_input_message').setStyle('display', 'block');
            return false;
        }
        //else {
        //    $('button_submit').removeClass('button_disabled').setProperty('disabled', false);
        //    $('form_report').getElement('.invalid_input_message').setStyle('display', 'none');
        //}
        
        // all checks passed - valid!
        return true;
    }

});