function getVolume() {

	heightUnit = document.calculatorForm.heightUnit.options[document.calculatorForm.heightUnit.selectedIndex].value;
	widthUnit = document.calculatorForm.widthUnit.options[document.calculatorForm.widthUnit.selectedIndex].value;
	depthUnit = document.calculatorForm.depthUnit.options[document.calculatorForm.depthUnit.selectedIndex].value;

	height	= document.calculatorForm.heightItem.value;
	width		= document.calculatorForm.widthItem.value;
	depth		= document.calculatorForm.depthItem.value;

	isNumeric = true;

	if (validateNumeric(height) && validateNumeric(width)){
		if (depth != 0 || null != depth) {
			isNumeric = (validateNumeric(depth));
		}
	} else {
		isNumeric = false;
	}
	
	if (!isNumeric) {
		alert ('Please only enter in only valid numbers.');
	} else {
		meterToFeet	= 0.3048;
		feetToMeter = 3.2808399;
		inchesToFeet = 0.0833333333;
		
		if (heightUnit== 1) {
			heightFeet = feetToMeter*height;
			heightMeter = height;
		} else if (heightUnit== 2){
			heightFeet = height;
			heightMeter = meterToFeet*height;		
		} else {
			heightFeet = inchesToFeet*height;
			heightMeter = inchesToFeet*meterToFeet*height;		
		}
		
		if (widthUnit== 1) {
			widthFeet = feetToMeter*width;
			widthMeter = width;
		} else if (widthUnit== 2) {
			widthFeet = width;
			widthMeter = meterToFeet*width;		
		} else {
			widthFeet = inchesToFeet*width;
			widthMeter = inchesToFeet*meterToFeet*width;		
		}	
		
		if (depth == 0 || null == depth) {
			measuredFeet = heightFeet * widthFeet;
			measuredMeter = heightMeter * widthMeter;
			superscript = '2';
			document.getElementById("calculator-yards").innerHTML = '';
		} else {
			if (depthUnit== 1) {
				depthFeet = feetToMeter*depth;
				depthMeter = depth;
			} else if (depthUnit== 2) {
				depthFeet = depth;
				depthMeter = meterToFeet*depth;		
			} else {
				depthFeet = inchesToFeet*depth;
				depthMeter = inchesToFeet*meterToFeet*depth;		
			}
			measuredFeet = heightFeet * widthFeet * depthFeet;
			measuredMeter = heightMeter * widthMeter * depthMeter;
			measuredYards = measuredFeet/27;
			superscript = '3';
			document.getElementById("calculator-yards").innerHTML = '&nbsp;&nbsp;/&nbsp;&nbsp;'+Math.ceil(measuredYards*100)/100+' yards<sup>'+superscript+'</sup>';
		}
		
		document.getElementById("calculator-feet").innerHTML = Math.ceil(measuredFeet*100)/100+' feet<sup>'+superscript+'</sup>';
		document.getElementById("calculator-meters").innerHTML = '&nbsp;&nbsp;/&nbsp;&nbsp;'+Math.ceil(measuredMeter*100)/100+' meters<sup>'+superscript+'</sup>';
	}
}

function validateNumeric(sVal)
{ 
//Input for Numeric values. Handles negatives, and comma formatted values. Also handles a single decimal point
//Matches: 	[5,000], [-5,000], [100.044] (http://www.regexlib.com)
 var regex=/^(\d|-)?(\d|,)*\.?\d*$/;
 
	// do the comparison, if we have a match write thank you or else the email is invalid
	if (regex.test(sVal))
	{
      return true;
	}
	else
	{
      return false;
	}
}