/**
 *    $Id: AirnorwayRule.js,v 1.6 2006/10/20 14:25:59 hack Exp $
 *    @version $Revision: 1.6 $ $Date: 2006/10/20 14:25:59 $
 *    @author  Claus Brøndby Reimer / 2M business applications a|s
 *    Copyright 2003,2004 WorldTicket A/S
 */

/** Rules For DAT says that there must be as many of infants and childs as adults
 *
 * @author  Claus Brøndby Reimer / 2M business applications a|s
 */
function AirnorwayRule() {
        this.ADULT = 0;
        this.INFANT = 1;
        this.CHILD = 2;
        this.SENIOR = 3;
        this.TEEN = 4;
}

AirnorwayRule.prototype = new Rule();

AirnorwayRule.prototype.apply = function() {
    var adult = this.handlers[this.ADULT];
    var child = this.handlers[this.CHILD];
    var infant = this.handlers[this.INFANT];
    var senior = this.handlers[this.SENIOR];
    var teen = this.handlers[this.TEEN];

    infant.setMax(adult.getValue() + senior.getValue() + teen.getValue());

}

AirnorwayRule.prototype.init = function() {
    for (var a = 0; a < this.handlers.length; a++) {
        this.handlers[a].setMax(10);
    }

    this.apply();
}

