//<SCRIPT>

function Validate()
{
	var bRet;
	var price1 = document.getElementById("PRICE1");
	var price2 = document.getElementById("PRICE2");
	var acres1 = document.getElementById("ACRES1");
	var acres2 = document.getElementById("ACRES2");
	var zip1 = document.getElementById("ZIP1");
	var zip2 = document.getElementById("ZIP2");
	var zip3 = document.getElementById("ZIP3");
	var zip4 = document.getElementById("ZIP4");
	
	// verify required fields
	if (price1.value == "" && price2.value == "")
		return warnInvalid(price1, "Price is a required field");
	
	// verify acres fields
	if (ValidateAcres(acres1) == false)
		return warnInvalid(acres1, "Acres must be in the format:   #####.##");
	if (ValidateAcres(acres2) == false)
		return warnInvalid(acres2, "Acres must be in the format:   #####.##");
		
	// validate numerics
	bRet = checkNumeric(price1, 1, 1);
	if (bRet == false)
		return false;
	bRet = checkNumeric(price2, 1, 1);
	if (bRet == false)
		return false;
	bRet = checkNumeric(acres1, 2, 1);
	if (bRet == false)
		return false;
	bRet = checkNumeric(acres2, 2, 1);
	if (bRet == false)
		return false;
	bRet = checkNumeric(zip1, 1, 1);
	if (bRet == false)
		return false;
	bRet = checkNumeric(zip2, 1, 1);
	if (bRet == false)
		return false;
	bRet = checkNumeric(zip3, 1, 1);
	if (bRet == false)
		return false;
	bRet = checkNumeric(zip4, 1, 1);
	if (bRet == false)
		return false;

	// validate ranges
	bRet = checkRange(price1, price2, 1);
	if (bRet == false)
		return false;
	bRet = checkRange(acres1, acres2, 1);
	if (bRet == false)
		return false;

	// if we got this far, we were successful
	return true;
}



function ValidateAcres(acresControl)
{
	var aV = acresControl.value.split(".");
	var iVI,iVD;
	if (aV.length==2)
	{
		iVI = aV[0].length;
		iVD = aV[1].length;
	}
	else
	{
		iVI = aV[0].length;
		iVD = 0;					
	}
	if ((iVI > 5) || (iVD > 2))
	{
		return false;
	}
	return true;
}