﻿/*
	Represents the logic and control of the Vehicles selections on the Numbers Tab
	Mod Log:	080802 	[DA]	Commented out references to the Hvy Vehicles as requested by client
*/
var NumVehSelection=Class.create(
{
    initialize: function(NumCars,NumMB) //NumHvyVeh, removed 080802 [DA]
    {
        this.NumCars=NumCars;
        //this.NumHvyVeh=NumHvyVeh; //080802 [DA] See note
        this.NumMB=NumMB;
        this.observer=null;
        this.TotalPoweredVehicles=0;
    }, //end initialise
    setObserver: function(observer)
    {
        this.observer=observer;
    }, //end setObserver
   	resetCombos: function()
    {
        this.NumCars.selectedIndex=0;
       // this.NumHvyVeh.selectedIndex=0;  //080802 [DA] See note
        this.NumMB.selectedIndex=0;
        this.TotalPoweredVehicles=0;
    }, //end resetCombos
    OnChange: function(sender)
    {
    	this.setTotalPowerVeh();
    	this.observer.setObservableEvent(sender);
    },
    setTotalPowerVeh: function()
    {
    	//Note the use of parseInt - otherwise it concatenates into 3 string!!
    	//$F = combo.value - see prototype documentation
    	this.TotalPoweredVehicles = parseInt($F(this.NumCars));
    	//this.TotalPoweredVehicles += parseInt($F(this.NumHvyVeh));  //080802 [DA] See note
    	this.TotalPoweredVehicles += parseInt($F(this.NumMB));
    },
    getTotalPowerVeh: function()
    {
    	return this.TotalPoweredVehicles;
    },
    getCars: function()
    {
    	return $F(this.NumCars);
    },
    getHvyVehs: function()
    {
    	return $F(this.NumHvyVeh);
    },
    getMB: function()
    {
    	return $F(this.NumMB);
    },
    disable: function()
    {
        Form.Element.disable($(this.NumCars));
       // Form.Element.disable($(this.NumHvyVeh));  //080802 [DA] See note
        Form.Element.disable($(this.NumMB));
    },
    enable: function()
    {
        Form.Element.enable($(this.NumCars));
      //  Form.Element.enable($(this.NumHvyVeh));  //080802 [DA] See note
        Form.Element.enable($(this.NumMB));
    }
});