// Velocity Converter 
VelocityConverter = Class.create();

VelocityConverter.prototype = {

	initialize : function(unit, value){
		this.uv = new Array(); 
		this.uv = {
			"m_per_s" : 1, // ref unit
			"km_per_h" : 3600/1000,
			"ft_per_min" : 196.8504,
			"ft_per_s" : 3.2808,
			"yards_per_min" : 65.617,
			"mph" : 2.2369,
			"knots" : 1.9438
		}
		this.unit = unit; // unit to convert from
		this.value = value; // value to convert
		this.ref = 1 / this.uv[this.unit] * this.value;
	},
	cV : function(unitTo){ // returns value for singel unit
		return this.ref * this.uv[unitTo];
	},
	cVs : function(){ // returns values for all units
		var msg = this.value + " " + this.unit + " => \n";
		for (var i in this.uv) {
			msg += Conv.rounding(this.ref * this.uv[i]) + "  " + i + "\n";
		}  
		return msg;
	},
	c : function(){ // returns an array with calculated values for all units
		var vs = new Array();
		var n = 0;
		for (var i in this.uv) {
			vs[n] = new Array(i,this.ref * this.uv[i]);
			n++;
		}  
		return vs;
	}
}

// Copyright engineeringtoolbox.com