Pet Ownership Calculator

1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtHouseholdsDogs').value = x1 + x2; totalDogs.value = 0; totalDogs.value = parseInt(totalDogs.value); totalDogs.value = parseInt(totalDogs.value) + numDogs; // Add comma to output var total = totalDogs.value; var nStr = total + ''; nStr = nStr.replace( /\,/g, ""); var x = nStr.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtDogs').value = x1 + x2; // Cats var numHouseholdsCats = Math.round(numHouseholds * 0.304); var numCats = Math.round(numHouseholds * 0.638); var totalHouseholdsCats = document.getElementById('txtHouseholdsCats'); var totalCats = document.getElementById('txtCats'); totalHouseholdsCats.value = 0; totalHouseholdsCats.value = parseInt(totalHouseholdsCats.value); totalHouseholdsCats.value = parseInt(totalHouseholdsCats.value) + numHouseholdsCats; // Add comma to output var total = totalHouseholdsCats.value; var nStr = total + ''; nStr = nStr.replace( /\,/g, ""); var x = nStr.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtHouseholdsCats').value = x1 + x2; totalCats.value = 0; totalCats.value = parseInt(totalCats.value); totalCats.value = parseInt(totalCats.value) + numCats; // Add comma to output var total = totalCats.value; var nStr = total + ''; nStr = nStr.replace( /\,/g, ""); var x = nStr.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtCats').value = x1 + x2; // Birds var numHouseholdsBirds = Math.round(numHouseholds * 0.031); var numBirds = Math.round(numHouseholds * 0.071); var totalHouseholdsBirds = document.getElementById('txtHouseholdsBirds'); var totalBirds = document.getElementById('txtBirds'); totalHouseholdsBirds.value = 0; totalHouseholdsBirds.value = parseInt(totalHouseholdsBirds.value); totalHouseholdsBirds.value = parseInt(totalHouseholdsBirds.value) + numHouseholdsBirds; // Add comma to output var total = totalHouseholdsBirds.value; var nStr = total + ''; nStr = nStr.replace( /\,/g, ""); var x = nStr.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtHouseholdsBirds').value = x1 + x2; totalBirds.value = 0; totalBirds.value = parseInt(totalBirds.value); totalBirds.value = parseInt(totalBirds.value) + numBirds; // Add comma to output var total = totalBirds.value; var nStr = total + ''; nStr = nStr.replace( /\,/g, ""); var x = nStr.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtBirds').value = x1 + x2; // Horses var numHouseholdsHorses = Math.round(numHouseholds * 0.015); var numHorses = Math.round(numHouseholds * 0.041); var totalHouseholdsHorses = document.getElementById('txtHouseholdsHorses'); var totalHorses = document.getElementById('txtHorses'); totalHouseholdsHorses.value = 0; totalHouseholdsHorses.value = parseInt(totalHouseholdsHorses.value); totalHouseholdsHorses.value = parseInt(totalHouseholdsHorses.value) + numHouseholdsHorses; // Add comma to output var total = totalHouseholdsHorses.value; var nStr = total + ''; nStr = nStr.replace( /\,/g, ""); var x = nStr.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtHouseholdsHorses').value = x1 + x2; totalHorses.value = 0; totalHorses.value = parseInt(totalHorses.value); totalHorses.value = parseInt(totalHorses.value) + numHorses; // Add comma to output var total = totalHorses.value; var nStr = total + ''; nStr = nStr.replace( /\,/g, ""); var x = nStr.split( '.' ); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while ( rgx.test(x1) ) { x1 = x1.replace( rgx, '$1' + ',' + '$2' ); } document.getElementById('txtHorses').value = x1 + x2; // Make result table visible document.getElementById("tblContent").style.visibility = 'visible'; document.getElementById("tblClear").style.visibility = 'visible' document.getElementById("tblFooter").style.visibility = 'visible' } else { alert("Please enter a number in the box") document.getElementById('txtPopulation').value = ''; } } //-->

Estimate the number of pet owning households and number of pets in your community by entering the community population* in the box below. 

See the formulas section for information on how these numbers are calculated.

What is your community population*?

     
 
  Number of Pet Owning Households Pet Population
Dogs
Cats
Birds
Horses
Clear all data
 
* Number of people in your community; not the number of households