String.prototype.count=function(s1) {   
	return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;  
}  

//deal with subdirectory paths
var href = window.location.href;
var uri = href.replace(GBL_domain,'');
var subDirPrefix = '';
var slashCount = uri.count('/');
if (slashCount > 0) {
	subDirPrefix = '../';
}


function doUnitConversion() {
	//Validation
	if ($("#selectConversion option:selected").val() == 0) {
		alert("Please select a conversion");
		return false;
	}
	
	if (isNaN($("#convertUnits").val())) {
		alert("Please enter a valid number for Air Flow Rate.");
		return false;
	}
	
	$("#conversionResult").val(
							   ($("#selectConversion option:selected").val()) * ($("#convertUnits").val())
							   );
}


