// Flow Converter 
FlowConverter = Class.create();

FlowConverter.prototype = { 
	initialize : function(unit, value){
		this.uv = new Array(); 
		this.uv = {
			"cubic_meters_per_second" : 1, // ref unit
			"cubic_meters_per_minute" : 60,
			"cubic_meters_per_hour" : 3600,
			"liters_per_second" : 1000,
			"liters_per_minute" : 60000,
			"liters_per_hour" : 3600000,
			"us_gallons_per_day" : 22800000,
			"us_gallons_per_minute" : 15852,
			"cubic_feet_per_minute" : 2118.9,
			"imp_gallons_per_day" : 19000000,
			"imp_gallons_per_minute" : 13200
		}
		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";
		Box.ajaxReq('/docs/scripts/conv.js',false);
		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