// Pressure Converter 
PressureConverter = Class.create();

PressureConverter.prototype = {
	initialize : function(unit, value){
		this.uv = new Array(); 
		this.uv = {
			"Pa" : 1, // ref unit
			"bar" : 0.00001,
			"atmosphere" : 0.00000987,
			"mmHg" : 0.0075,
			"mmH2O" : 0.10197,
			"mH2O" : 0.00010197,
			"kg_per_cm2" : 0.000010197,
			"psf" : 0.0209,
			"psi" : 0.0001450326,
			"inHg" : 0.0002953,
			"inH2O" : 0.0040186,
			"ftH2O" : 0.00033488
		}
		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
