// JavaScript Document
function validateNotEmpty( strValue ) {
   var strTemp = strValue;
   strTemp = trimAll(strTemp);
   if(strTemp.length > 0){
     return true;
   }  
   return false;
}
function trimAll( strValue ) {
 var objRegExp = /^(\s*)$/;

    //check for all spaces
    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }
    
   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}
function check_form(form)
{
	var pass = true;
	
	if (!form.market_value_of_home.value.length)
		pass = false;
	
	if (form.market_value_of_home.value != '0') {
		if (!form.outstanding_mortgage_principle_balance.value.length)
			pass = false;
		
		if (!form.mortgage_interest_rate.value.length)
			pass = false;
	}
	
	
	if (!form.personal_property_total_value.value.length)
		pass = false;
		
	if (!form.gross_household_income.value.length)
		pass = false;
		
	if (!form.annual_household_consumption.value.length)
		pass = false;
		
	if (!form.average_monthly_utility_bill.value.length)
		pass = false;
		
	if (!form.average_mpg_of_vehicles.value.length)
		pass = false;
		
	if (!form.average_annual_miles_driven.value.length)
		pass = false;
		
	if (pass)
		return true;
		
	alert('Tax estimator needs more data to complete its calculation. Please hit "tab" to move from one entry to another, hit "enter" when all finished entering all data.');
}