// Density Converter 

function DensityConverter(unit, value){
	this.uv = new Array(); 
	this.uv = {
		"kg/m3" : 1, // ref unit
		"g/cm3" : 0.001,
		"oz/in3" : 0.0005780,
		"oz/impgal" : 0.16036,
		"oz/usgal" : 0.13353,
		"lb/ft3" : 0.062428,
		"lb/in3" : 0.000036127,
		"lb/yd3" : 1.68555,
		"lb/impgal" : 0.010022,
		"lb/usgal" : 0.008345,
		"ton/yd3" : 0.0007525
	}
	this.unit = unit; // unit to convert from
	this.value = value; // value to convert
	this.ref = 1 / this.uv[this.unit] * this.value;
}

// returns value for singel unit
DensityConverter.prototype.cV = function(unitTo){
	return this.ref * this.uv[unitTo];
}
// returns values for all units
DensityConverter.prototype.cVs = function(){
	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;
}

// Copyright engineeringtoolbox.com
