function numbersAndDecimalOnly(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode == 46)
		return true;
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}

function numbersOnly(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}

function checkEmptyValue(fieldId, textId)
{
	if (isControlEmpty(fieldId))
	{
		document.getElementById(textId).style.display = "";
		return false;
	}
	else 
	{
		document.getElementById(textId).style.display = "none";
		return true;
	}
}

function checkEmptyValueNoStyle(fieldId)
{
	if (isControlEmpty(fieldId))
		return false;
	else 
		return true;
}

function isControlEmpty(checkControlId)
{
	var theControl;
	theControl = document.getElementById(checkControlId);
	return (theControl.value == '');
}

function focusInvalid(fieldId)
{
	document.getElementById(fieldId).focus();
}

function formatMeasurement(str, dec, bNeg) 
{ // auto-correct input - force numeric data based on params. 
 var cDec = '.'; // decimal point symbol 
 var bDec = false; var val = ""; 
 var strf = ""; var neg = ""; var i = 0; 

 if (str == "") return parseFloat ("0").toFixed (dec); 

 if (bNeg && str.charAt (i) == '-') { neg = '-'; i++; } 

 for (i; i < str.length; i++) 
 { 
  val = str.charAt (i); 
  if (val == cDec) 
  { 
   if (!bDec) { strf += val; bDec = true; } 
  } 
  else if (val >= '0' && val <= '9') 
   strf += val; 
 } 
 strf = (strf == "" ? 0 : neg + strf); 
 return parseFloat (strf).toFixed (dec); 
}

