// This file contains intellectual property and artistic creations 
// by Dennis Sandow and is copyright 2000-2010 by the author. 
// For use only on websites maintained by Dennis Sandow, or with
// specific permission.  Do not remove this notice.

var CB=new Array(), derivedCells=0; combos=new Array(0,0);
for (rgy=1; rgy<12; rgy++){
  combos[rgy]=combos[rgy-1]+rgy-1;  // 4=3+4-1=6
};
function AQ(arg){
  azq=new Array(); azq=(arg+'|||||||').split('|');
  mneBas=azq[0];
  CB[mneBas] = arg.replace(/\|*$/,'');
  if ( azq[12] ) Mesage[mneBas]= azq[12].replace(/_/g,'&nbsp;')

  yearRang= azq[7]?(1+parseInt(azq[7]) - parseInt(azq[6]?azq[6]:azq[7]) ):0
  if ( mneList.indexOf(','+mneBas) < 0 ) derivedCells += yearRang;
  if ( azq[2].indexOf('-S') < 0) derivedCells += yearRang;
  if ( azq[2].indexOf('P') < 0) derivedCells += (combos[yearRang]*2); //Val+Rk
  if ( azq[2].indexOf('C') < 0) derivedCells += combos[yearRang]; 
  if ( azq[2].indexOf('c') < 0) derivedCells += combos[yearRang];
  if ( azq[2].indexOf('v') < 0) derivedCells += combos[yearRang]; 
  if ( azq[2].indexOf('a') < 0) derivedCells += (combos[yearRang]*2); 
 
  return mneBas+(azq[1]?'!'+azq[1]:'')+'|';
};

var GenEqRatioMessage = 'This is the factor that puts all the towns on an equal tax footing, regardless of how old their last assessment was._ An Equalization Ratio of .85 means that a house with an Assessed Value of $850,000 is probably worth $1,000,000 in the open market.<p>Towns with an Equalization Ratio close to 100% are newly assessed._ Their Assessed Values are close to true market values._ Towns with an Equalization Ratio down near .50 probably have not been reassessed for ten years._ Their houses are worth twice the Assessed Value.';

var GenSchoolMessage = 'This is the tax levy that appears in the town-issued <b>Calendar Year</b> tax bill._ Schools actually budget on a July-June <b>Fiscal Year</b> basis and the Fiscal Year budget is the budget approved by voters in the April School Budget Referendum.<p>This Calendar Year tax levy includes one-half of each of the overlapping Fiscal Year tax levies, and also includes school district debt service, which is NOT part of the annual school budget, but carries over from the original bond referenda approoved in years past._ Therefore, it is not possible to relate the (Calendar Year tax levy) values here to the actual (Fiscal Year operating-only) school budget.<p>An evaluation of the actual fiscal year budgets and tax levy requirement, and the debt service component CAN NOT be made from this data._ Obtain specific budget detail from the district office(s).';

// 0 Mnemonic.  Root key for the arrays
// 1 blank=simplelist; I=More items +D only; D=D only // returns as !a
// 2 (display on Main page)'-S'(noSort&noRank)+'-V'(noValue)+'-R'(noRank){Rank is displayed by default if Sort. If Sort is permitted, then rank will be silently calculated, but there is no checkbox to enable its display in the report)+P(ercentchg)+[C(changerank)|c(change(rank)value)|v(changevalue)|a(average)]'
// 3 Display for row on page [>(indent)][<B>(bold)][<A>(for alpha sort only on town name)]HtmlLineDescriptor (bunching adds '--')
// 4 Col head - Default is Years added to field 3;  or take the field literally
// 5 future
// 6 bunch n-n
// 7 year suffix for final year.  Null means make the entry with no suffix
// 8 Sort(A[lpha]|U|(D)) 
// 9 Justify(L|C|(R)) Rank defaults to center
// 10 postOp percents default to '%.1'
// 11 future
// 12 Message

var DisplayList=''+
AQ('Towns||-V-R defaultSort|Alphabetic List of Towns|Towns||||A|L')+
AQ('MuniCd|D|-S|>Municipality Code|Municipality<br>Code||||U|C|')+
AQ('isMorris|D|-S|>Morris County ?|In<br>Morris<br>County|||||C|')+

'DEMOGRAPHIC|'+
AQ('SqMi|||Area (sq mi)|Area<br>(Sq Mi)||||||2|'+
'|Precisely, this is the area inside the municipal boundaries._ It will include lakes and other water, wetlands, in addition to solid land.')+
AQ('PctLandArea|||Land Area Percentage|Land Area<br>Percentage||||||%.1|'+
'|Percentage of land within the municipal boundaries._ Deducts for major bodies of water, but not for minor ponds and lakes.')+
AQ('Popu||PC|Population|||0-5|6|||,|'+
  '|The NJ Department of Labor makes an annual <b>estimate</b> of how much the population changes each year._ All NJ State Government reports use this same estimate, for consistency among departments._ The methodology is based on "housing starts".')+
AQ('PopPerSqmi|||Population per Square Mile|Population<br>per SqMi.||0-5|6|||,|'+
  '|Normalized for land area only.')+
AQ('HousingUnits|||2000 Housing Units|Housing<br>Units||||||,|'+
  '|Census definition.')+
AQ('MedIncome|||>1999 Median Household Income|1999<br>Median<br>Household<br>Income||||||$,|'+
  '|From the 2000 Census, which collected extensive statistical data from one household out of every six._ Use this entry for comparison among towns, but recognize that it is not an adequate measure of the current median eight years later.<p>Median means "half above and half below"._ "Median Income" is generally lower than "Average Income"._ A few very high income households will inflate the average, but they don\'t change the median.<p>In Long Hill, in 1999, the Median Household Income was $84,532, while the Average Household Income was $117,555._ I don\'t show the "average" on this page, because I don\'t believe it is meaningful for analysis.')+
AQ('CollGrad|||>1999 Adults with 4-year College|1999<br>Percent<br>College<br>Graduate||||||%|'+
  '|From the 2000 Census, which collected extensive statistical data from one household out of every six.')+
AQ('NJmagPvtSectJob|I||>NJ Mag. Private Sector Jobs|Private<br>Sector<br>Jobs|||3|||0|'+
  '|Private Sector Jobs from the New Jersey Magazine Best Places to Live study._ Source and quality of the data unknown.<p>Reported and used in the 2005 list, from 2003 data._ That\'s all we have.')+
 AQ('NJmagRatioPvtSectJob|||>Private Sector Jobs per 1000 Pop.|Private<br>Sector<br>Jobs Per<br>1000 Pop.|||3|||0|'+
  '|Private Sector Jobs from the New Jersey Magazine Best Places to Live study, related to the population._ This could be a measure of the commercialization/business climate in a community.<p>Source and quality of the data unknown.<p>Reported and used in the 2005 list, from 2003 data._ That\'s all we have.')+
AQ('NJmagBestPlaces||-Rc|NJ Magazine Best Places to Live|Best Places||6|8|U|C||'+
  '|In early 2006 & 2008, New Jersey Magazine published studies conducted by Monmouth University\'s Polling Institute._ The ranking considered eight categories best representing the quality of life in New Jersey: property taxes, home values, population growth, land development, employment, crime rate, school performance, and proximity to services.<p>The description of the methodology is sketchy, and the weighting of each factor is unknown._ The notes say that "household income was not considered, and home values were measured by their rate of increase over five years rather than by current prices._ To compare land development, towns with relatively slower growth and more open space were rated more favorably. Towns with lower unemployment and crime rates also scored higher.<p><font color=red><b>If you notice that some towns moved over 200 ranking positions in the space of 2 years, you might question whether the methodology is realistic.</b></font>_ However, some of their published  data is useful, and is included here to provide additional insight.<p><i>They may publish this annually, and I will look for more years.</i>')+

'ASSESSED VALUATION|'+
AQ('TotalAsses||-S|Total (raw) TAXABLE Real Prop. Assmt|Total Real<br>Prop. Assmt.||0-6|7|||$-,|'+
  '|This number is the basis for computing the annual tax rate WITHIN each town._ It represents the market value of all the taxable real properties AT THE TIME OF THE LAST ASSESSMENT._ All properties in a town are "assessed" as of the same date.<p>Do NOT attempt to compare different towns based on this value._ Towns that have not reassessed for ten years will have a disproportionately low "Assessed Value" compared with towns which have assessed recently.<p>All public buildings, schools, community services buildings, churches,  some disabled veteran\'s houses, parkland (federal, state, county, municipal) and tax-exempt open space (cemeteries, private conservation foundations, etc.) are TAX-EXEMPT, and are invisible in this total.')+
AQ('ResAsses|D|-S|Residential Assessment|Res. Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('FarmhouseAsses|D|-S|Farmhouse Assessment|Farmhouse<br>Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('ApartAsses|D|-S|Apartment Assessment|Apartment<br>Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('PctRes||C|>% Residential Assessment|% Res<br>Assessment||0-6|7|||%.1|'+
  '|The percentage of the Total Taxable Assessed Valuation that represents residential, farmhouse and apartment house properties._ The remainder would be commercial, industrial, vacant land and farmland assessments.<p>Simplistically, if 80 % of the Assessed Value comes from residential properties, then 80% of the taxes will be paid by homeowners and landlords.<p>In later calculations, we will NORMALIZE tax payments using this value.')+
AQ('CommerAsses|D|-S|Commercial Assessment|Commercial<br>Assmt.||0-6|7|||$-,|'+
  '|The percentage of the Total Taxable Assessed Valuation that represents commercial and industrial properties._ The remainder would be residential, farm or vacant land assessments.')+
AQ('IndusAsses|D|-S|Industrial Assessment|Industrial<br>Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('PctComml|I|C|>% Commercial/Industrial Assessment|% Coml/Ind<br>Assessment||0-6|7|||%.1|'+
  '|')+
AQ('VacantAsses|D|-S|Vacant Land Assessment|Vacant Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('FarmlandAsses|D|-S|Farmland Assessment|Farmland<br>Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('PctVac|I|C|>% Vacant & Farmland Assessment|% Vacant<br>Assessment||0-6|7|||%.1|'+
  '|The percentage of the Total Taxable Assessed Valuation that represents vacant and farmland properties._ The remainder would be commercial, industrial or residential.<p>CAUTION:  This is NOT a proxy for the amount of vacant land in the town, for 2 reasons<ul><li>FarmLAND is assessed at a rediculously low rate._ Think on the order of $100/per acre._So 1000 acres of farmland will have a lower assessment than the land on a one acre residential lot.<li>All public parkland (federal, state, county, municipal) and tax-exempt open space (cemeteries, private conservation foundations, etc.) are TAX-EXEMPT, and are invisible in this analysis.</ul>')+
AQ('LandAsses|D|-S|Land Assessment|Land<br>Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('PctLand|I|C|>% Land Assessment|% Land<br>Assmt.||0-6|7|||%.1|'+
  '|')+
AQ('ImprAsses|D|-S|Improvement Assessment|Improvement<br>Assmt.||0-6|7|||$-,|'+
  '|')+
AQ('PctImpr|I|C|>% Improvement Assessment|% Imprvmt<br>Assmt.||0-6|7|||%.1|'+
  '|')+
AQ('PersPropAssess|D||Personal Property Assessment|Pers Prop.<br>Assmt.||0-6|7|||$,|'+
  '|')+

'EQUALIZED VALUATION|'+
AQ('CoEqRatio|I|-R|County Equalization Ratio|County<br>Eqlzn Ratio||0-6|7|||2|'+
  '|'+GenEqRatioMessage+'<p>These Ratios are developed and published in the second half of the prior year, but are applied to calculate this year\'s taxes._ The Ratios themselves are a three year moving average, so they represent the "difference" between assessment and market value averaged over the 3 year period ending the previous July.<p>As a result, this Equalization Ratio is always about two years behind the market._ It\'s crude, but it\s the best we\'ve got for putting all towns on an equal footing.')+
AQ('CoEqAssess|D|PC|County Equalized Assessment|County<br>Eqlzd Assmt.||0-6|7|||$,|'+
  '|The County Equalized Assessment based on the raw taxable assessment frozen this year and the Equalization Ratio computed in the prior year._ Used only to prorate county taxes to the towns._ <b>The source calculation is defective._ These data are shown only for reconciliation purposes.</b>_ Use the corrected version below for other purposes.')+
AQ('CorrectCoEqlAssess|D|PC|Corrected County Equalized Assmt|Adj. County<br>Eqlzd. Assmt.||0-6|7|||$,|'+
  '|The County Equalized Assessment recomputed to eliminate minor double-counting and precision inconsistencies in the official County report._ Although not an official published number, this is a more precise statement, for some purposes.')+
AQ('NJTEqRatio|D|-R|State YearEnd Equalization Ratio|State YE<br>Eqlzn Ratio||0-6|7|||2|'+
  '|'+GenEqRatioMessage+'<p>These Ratios are developed and published in the second half of this year._ The county and state will apply these ratios to most tax calculations in the following year._ In fact, they should exactly "lead" the County Equalization Ratios by one year.<p>The Ratios themselves are a three year moving average, so they represent the "difference" between assessment and market value averaged over the 3 year period ending this July._ <p>This ratio is not used for anything until next year, but we will use it for derivative calculations, because it allows CONSISTENT calculations using both the raw assessment and the Equalization Ratio developed in the same year.')+
AQ('LGSEqAssess|D|PC|NJ LGS Consistent Year Eqlzd Assmt|LGS Consistent<br>Eqlzd Assmt.||0-6|7|||$,|'+
  '|<font color=red>The NJ Treasury Equalized Assessment, issued late in the year, based on the current year raw taxable assessment, and current mid-year Equalization Ratio._ The LGS report has a math error._ Coerce it in the next line to match the Treasury Report, which is not imported.</font>')+
AQ('NJTEqAssess||PC|NJTreasury Consistent Year Eqlzd Assmt|Consistent<br>Eqlzd Assmt.||0-6|7|||$,|'+
  '|The NJ Treasury Equalized Assessment, issued late in the year, based on the current year raw taxable assessment, and current mid-year Equalization Ratio._ Used as the "best value" in this page, for derivative computations not involving actual tax collection.')+

AQ('EqVllPerPop||PC|>Equalized Valuation per capita|Eq. Val.<br>per capita||0-6|7|||$,|'+
  '|The NJ Treasury Equalized Assessment, issued late in the year based on the current year raw taxable assessment and current mid-year Equalization Ratio._ Divided by the State Labor Department population estimate, based on housing starts and construction permits, since the last census.')+
AQ('EqVllPerSqmi||PC|>Equalized Valuation per Square Mile|Eq. Val.<br>per SqMi.||0-6|7|||$,|'+
  '|The NJ Treasury Equalized Assessment, issued late in the year based on the current year raw taxable assessment and current mid-year Equalization Ratio._ Divided by the official area of the town, normalized to land area only.')+
AQ('NJmagMedianResSale||PC|NJ Magazine Median Residential Sale|Median<br>Res. Sale||05|7|||$,|'+
  '|Median Residential Sale Price from the New Jersey Magazine Best Places to Live study._ Source and quality of the data unknown.')+

'COUNTY TAXES|'+
AQ('CountyTax|I||County Tax|County<br>Tax||0-6|7|||$,|'+
  '|')+
AQ('CountyOSTax|I||County Open Space Tax|County<br>Open Space<br>Tax||0-6|7|||$-,|'+
  '|')+
AQ('CountyTotTax||PC|All County Taxes|All<br>County Taxes||0-6|7|||$,|'+
  '|The sum of the county tax and the county Open Space Tax._ The total county tax levy is collected from each town in proportion to their Equalized Valuations.<p><i>For comparison purposes, this total EXCLUDES the "County Library Tax" in three Somerset County towns with no local Library (Warren, Watchung and Green Brook.)_ We include that tax in the "Municipal Tax Total" for equitable comparison with the other towns, which all have municipal libraries funded through the municipal tax.</i>')+
AQ('PctCnty|I|v|>All County Tax as % of Total|County Taxes<br>as % of<br>Total||0-6|7|U||%.1|'+
  '|The percentage of the total tax bill that represents the county taxes taxes (except the library tax in Somerset County towns.)_ If this percentage increases over time, that indicates that the county taxes are growing faster than the school or municipal taxes.')+
AQ('PctOfCounty|D|C|>Town&#146;s Share of Morris County Taxes|% of<br>Morris County||0-6|7|||%.1|'+
  '|This town\'s share of the total Morris County tax levy._ Towns outside of Morris County are excluded._ If the percentage share grew over time, it means that town is growing faster (Equalized Assessment), and therefore, picks up a larger share of the total county tax levy.')+
AQ('CountyLibTax|I|-SP|County Library Tax|County<br>Library Tax||0-6|7|||$-,|'+
  '|For comparison purposes, the County Library Tax in three Somerset County towns with no local Library (Warren, Watchung and Green Brook) is included in the "Municipal Tax Total".')+

'MUNICIPAL TAXES|'+
AQ('MuniTax||P|Municipal Operating Budget Tax|Municipal<br>Oper. Tax||0-6|7|||$,|'+
  '|The annual municipal operating budget tax levy, excluding the municipal Open Space Tax  and any local special taxing districts (Solid Waste, Fire).')+
AQ('MuniTaxPerPop|I|PC|>Muni Operating Tax per Capita|Muni Oper<br>Tax per<br>Capita||0-6|7|U||$,|'+
  '|')+
AQ('NrmMuniTaxPerPop||PC|>Muni Operating Tax per Capita Normalized|Muni Oper Tax<br>per Capita<br>Normalized||0-6|7|U||$,|'+
  '|See the "% Residential" discussion._ If 80% of the Assessments are Residential, then the homeowners and landlords pay 80% of the taxes, and the commercial and industrial owners pay the other 20% of the taxes.<p>This NORMALIZED value measures the cost per capita of the municipal operating budget taxes paid by the residential properties only.')+
AQ('MuniOSTax|I||Municipal Open Space Tax|Municipal<br>Open Space<br>Tax||0-6|7|||$-,|'+
  '|')+
AQ('MuniOtherTax|I|-S|Municipal Fire/Solid Waste Tax|Other<br>Municipal<br>Tax|||4|||$-,|'+
  '|Six Towns in the survey have separate Fire or Solid Waste taxes that are billed based on assessment._ The state only published these tax levies for 2004._ Other years are estimated, but not shown.  These estimates ARE silently included in the Total Municipal Taxes.')+
AQ('MuniTotTax||PC|All Muni Taxes|All Muni<br>Taxes||0-6|7|||$,|'+
  '|The sum of the municipal tax, the municipal Open Space Tax, and an estimate (based on 2004) of tax levied by any local special taxing districts (Solid Waste, Fire)._ <p><i>For comparison purposes, this total also includes the "County Library Tax" in three Somerset County towns with no local Library (Warren, Watchung and Green Brook.)')+
AQ('AllMuniTaxPerPop|I|PC|>All Municipal Taxes per Capita|All<br>Muni Taxes<br>per Capita||0-6|7|U||$,|'+
  '|')+
AQ('NrmAllMuniTaxPerPop||PC|>All Muni Taxes per Capita Normalized|All<br>Muni Taxes<br>per Capita<br>Normalized||0-6|7|U||$,|'+
  '|See the "% Residential" discussion._ If 80% of the Assessments are Residential, then the homeowners and landlords pay 80% of the taxes, and the commercial and industrial owners pay the other 20% of the taxes.<p>This NORMALIZED value measures the cost per capita of all the municipal taxes paid by the residential properties only.')+
AQ('PctMuni|I|v|>All Municipal Taxes as % of Total|All Muni<br>Taxes as %<br>of Total||0-6|7|U||%.1|'+
  '|The sum of all municipal taxes as a percentage of the total tax bill._ If this percentage increases over time, that indicates that the municipal taxes are growing faster than the county or school taxes.')+

'SCHOOL TAXES|'+
AQ('DFG||-R|School DFG|School<br>DFG||||A|C||'+
  '|The <b>D</b>istrict <b>F</b>actor <b>G</b>rouping is a classification system that the state uses '+
    'to allocate state aid to the school districts._ '+
    'The stated goal is to distribute state aid to the districts which have the largest socioeconomic needs._ '+
    'All the school districts in the state are crunched through a formula that considers '+
    '<ul><li>Percent of population with no high school diploma<li>Percent with some college'+
    '<li>Occupation<li>Population density<li>Income<li>Unemployment<li>Poverty</ul>'+
    'Then the results are divided into 8 strata, with "A" being the districts which need the MOST aid '+
    'and "J" being the districts which need the LEAST._ '+
    'The 2-letter DFGs are the result of the state combining some bands over time.<p>DFG is a useful measure of the general socio-economic health of a community, although it looses its value if the municipality is part of a Regional School District.')+
//  District Factor Groups http://www.state.nj.us/njded/finance/sf/dfg90.shtml
AQ('SchType|I|-R|School System Type|School<br>Type||||A|C||'+
  '|This code shows the type of school system, for comparison of districts with comparable scope._ The values are:'+
  '<ul><li>L12 - Local district includes High School;'+
  '<li>R12 - ALL students go to a Regional School District._ There is no local school tax._ All taxing is done by the Regional District;'+
  '<li>L8R12 - Grade 9-12 students attend a Regional High School, and the RHS district taxes separately;'+
  '<li>L8T12 (and L6T12) - Grade 9-12 students attend High School in a different town, or attend a RHS, as TUITION students._ The tuition cost is included in the tax of the Local School District;'+
  '<li>T12 - ALL students go to a different school district as TUITION students._ The tuition cost is included in the tax of the Local School District.'+
  '</ul>')+
AQ('LocalSchTax|I|P|Local School Tax|Lcl School<br>Tax||0-6|7|||$,|'+
  '|'+GenSchoolMessage)+
AQ('LocalSchlTaxPerPop|I|PC|>Local School Tax per Capita|Local<br>School Tax<br>per Capita||0-6|7|U||$-,|'+
  '|')+
AQ('RegSchTax|I|P|Regional School Tax|Reg. School<br>Tax||0-6|7|U||$-,|'+
  '|'+GenSchoolMessage)+
AQ('RegSchlTaxPerPop|I|PC|>Regional School Tax per Capita|Regional<br>School Tax<br>per Capita||0-6|7|U||$-,|'+
  '|')+
AQ('OtherSchTax|I|-S|Other School Tax|||0-6|7|||$-,|'+
  '|Summit has an alternate scheme where the School Debt is issued by, and paid off through taxation by, the municipal government._ In all other districts, school debt service is included in the relevant school district taxes.')+
AQ('TotSchTax||PC|All School Taxes|All<br>School<br>Taxes||0-6|7|U||$,|'+
  '|The sum of the local, regional and other school taxes._  This is more useful than comparing local district taxes, because of the variety of regional and tuition arrangements in this table._ See note at "School Type"<p>'+GenSchoolMessage)+
AQ('SchTaxPerPop||PC|>School Taxes per Capita| Total<br>School Taxes<br>per Capita||0-6|7|U||$,|'+
  '|')+
AQ('PctSch|I|v|>School Taxes as % of Total|School Taxes<br>as % of<br>Total||0-6|7|U||%.1|'+
  '|The percentage of the total tax bill that represents all the school taxes._ If this percentage increases over time, that indicates that the school taxes are growing faster than the county or municipal taxes._ When comparing school taxes, be sensitive to the DFG._ Districts with lower-lettered DFGs get more state aid, so local school taxes are reduced, and this lowers the school tax percentage (and raises the percentage for muni and county taxes.')+

'TOTAL TAXES|'+
AQ('TotTaxLevy||PC|<B>All Taxes|All Taxes||0-6|7|U||$,|'+
  '|')+
AQ('TotTaxPerPop|I|PC|>All Taxes per Capita|All Taxes<br>per Capita||0-6|7|U||$,|'+
  '|')+
AQ('NrmTotTaxPerPop||PC|>All Taxes per Capita Normalized|All Taxes<br>per Capita<br>Normalized||0-6|7|U||$,|'+
  '|')+
AQ('NJmagMedPropTax||PC|>NJ Mag. Median Property Tax|Median<br>Property<br>Tax||5|7|||$,|'+
  '|Median Residential Property Tax, from the New Jersey Magazine "Best Places to Live" study._ Source and quality of the data unknown.')+

AQ('SenCredit|D|P|Senior Credit|Senior<br>Credit||0-6|7|U||$,|'+
  '|')+
AQ('PctSenCredit|I|C|% Senior Credit|% Senior<br>Credit||0-6|7|U||%.2|'+
  '|')+
AQ('VetCredit|D|P|Veterans Credit|Veterans<br>Credit||0-6|7|U||$,|'+
  '|')+
AQ('PctVetCredit|I|C|% Veterans Credit|% Veterans<br>Credit||0-6|7|U||%.2|'+
  '|')+

'POLICE|'+
AQ('Police||PC|Police Officers|Police Ofcrs||0-6|7|D|||'+
  '|This is the reported year-end count of sworn police officers._ It does not include dispatchers, auxiliary officers or clerical personnel.')+
AQ('ResPerPolice|I|-R|>Residents per Police Officer|Res. per<br>Police Ofcr||0-6|7|||,|'+
  '|')+
AQ('NrmResPerPolice||C|>Residents per Police Officer Normalized|Res. per<br>Police Ofcr<br>Normalized||0-6|7|||,|'+
  '|See the "% Residential" discussion._ If 80% of the Assessments are Residential, then the homeowners and landlords pay 80% of the taxes, and the commercial and industrial owners pay the other 20% of the taxes.<p>This NORMALIZED value <b>crudely</b> estimates the number of residents who support each police officer (proportionate to the residential percentage of assessments and taxes.)')+
AQ('PolicParity|I|-S|>LHPD Parity|LHTPD for<br>Parity|||||C|1|'+
  '|Number of officers in LHTPD to achieve the same "Residents per Officer" efficiency')+
AQ('CrimeRate||PCa|Crime Rate|||0-6|7|U||1|'+
  '|The <b>Crime Rate</b> is "so many" reportable crimes per 1000 population._ Beware of he "Tyranny of Small Numbers".\s  For example, if Long Hill (8777 population) had an additional 9 reportable crimes - one every 6 weeks - our crime rate would increase by one full point, which would move us down in the list by (typically) 4 positions.<p>Please read a further discussion on the Police <a href=pochiefc.htm>Chief\'s Corner</a> webpage.')+
//AQ('CrimeRatAvg||a|Average Crime Rate|Average<br>Crime Rate||0-6|7|U||1|'+
//  '|A simple average of Crime Rate indices._ Possibly useful for cancelling wide variations in towns with smaller population.')+
'';

Mesage['Popu00'] = 'From the U.S. Census. Some late corrections noted by town.';
// Mesage['Popu'] = ('The NJ Department of Labor makes an annual <b>estimate</b> of how much the population changes each year._ All NJ State Government reports use this same estimate, for consistency among departments._ The methodology is based on "housing starts".').replace(/_/g,'&nbsp;');

// DFG2 and SchType2 are used in main at the town piston-set
Mesage['DFG2'] = Mesage['DFG']+('<p>The DFG "I/J" preset selects the towns in the two highest categories, "I" and "J"._ It also selects Morris Township, which would be in this grouping, except for the fact that it shares a Regional School District with Morristown._ The averaging of the two communities pulls the DFG for the regional district down a notch (to "GH") and then that DFG is applied to each community.').replace(/_/g,'&nbsp;'); 

Mesage['SchType2'] = ('This presets only the towns which have a local K-8 school district, and send their 9-12 grade students to a regional high school, <b>which taxes separately</b>._ Tuition high school arrangements (ex.: Green Brook at WHRHS) are not included.').replace(/_/g,'&nbsp;'); 

function derivedValsSpecific(argdv4,yr2Adv4,from){
  if(argdv4 == 'Popu'){
    if ( typeof ma[argdv4+yr2Adv4]['Wharton'] == udf ) {
      for (twn4a in ma['Towns'] ) ma[argdv4+yr2Adv4][twn4a] = QW(argdv4,Yr2(parseInt(yr2Adv4)-1),twn4a,310); 
    };
  } else

  if (argdv4 == 'PopPerSqmi' ) {
    for (twn4b in ma['Towns'] ) ma['PopPerSqmi'+yr2Adv4][twn4b] = QW('Popu',yr2Adv4,twn4b,238)/ ( QW('SqMi','',twn4b,238)* QW('PctLandArea','',twn4b,238) ) ;
  } else

  if (argdv4 == 'NJmagRatioPvtSectJob' ) {
    for (twn4c in ma['Towns'] ) ma['NJmagRatioPvtSectJob03'][twn4c] = 1000 * QW('NJmagPvtSectJob','03',twn4c,781)/ QW('Popu','03',twn4c,781);
  } else

  if (argdv4 == 'TotalAsses' ) {
    for (twn4d in ma['Towns'] ) ma['TotalAsses'+yr2Adv4][twn4d] = QW('ResAsses',yr2Adv4,twn4d,322) + QW('FarmhouseAsses',yr2Adv4,twn4d,322) + QW('ApartAsses',yr2Adv4,twn4d,322) + QW('CommerAsses',yr2Adv4,twn4d,322) + QW('IndusAsses',yr2Adv4,twn4d,322) + QW('VacantAsses',yr2Adv4,twn4d,322) + QW('FarmlandAsses',yr2Adv4,twn4d,322);
  } else

  if (argdv4 == 'PctRes' ) {
    for (twn4e in ma['Towns'] ) ma['PctRes'+yr2Adv4][twn4e] = ( QW('ResAsses',yr2Adv4,twn4e,327) + QW('FarmhouseAsses',yr2Adv4,twn4e,327) + QW('ApartAsses',yr2Adv4,twn4e,327) )/ QW('TotalAsses',yr2Adv4,twn4e,327) ;
  } else

  if (argdv4 == 'PctVac' ) {
    for (twn4f in ma['Towns'] ) ma['PctVac'+yr2Adv4][twn4f] = ( QW('VacantAsses',yr2Adv4,twn4f,327) + QW('FarmlandAsses',yr2Adv4,twn4f,327) )/ QW('TotalAsses',yr2Adv4,twn4f,327) ;
  } else

  if (argdv4 == 'PctComml' ) {
    for (twn4g in ma['Towns'] ) ma['PctComml'+yr2Adv4][twn4g] = ( QW('CommerAsses',yr2Adv4,twn4g,327) + QW('IndusAsses',yr2Adv4,twn4g,327) )/ QW('TotalAsses',yr2Adv4,twn4g,327) ;
  } else

  if (argdv4 == 'PctLand' ) {
    for (twn4h in ma['Towns'] ) ma['PctLand'+yr2Adv4][twn4h] = QW('LandAsses',yr2Adv4,twn4h,327) / QW('TotalAsses',yr2Adv4,twn4h,327) ;
  } else

  if (argdv4 == 'PctImpr' ) {
    for (twn4i in ma['Towns'] ) ma['PctImpr'+yr2Adv4][twn4i] = QW('ImprAsses',yr2Adv4,twn4i,327)  / QW('TotalAsses',yr2Adv4,twn4i,327) ;
  } else

  if (argdv4 == 'CorrectCoEqlAssess' ) {
    for (twn4j in ma['Towns'] ) ma['CorrectCoEqlAssess'+yr2Adv4][twn4j] = 100*( QW('TotalAsses',yr2Adv4,twn4j,280) / QW('CoEqRatio',yr2Adv4,twn4j,280) )+ QW('PersPropAssess',yr2Adv4,twn4j,280);
  } else

  if (argdv4 == 'NJTEqAssess' ) {
    for (twn4k in ma['Towns'] ) ma['NJTEqAssess'+yr2Adv4][twn4k] = 100*( QW('TotalAsses',yr2Adv4,twn4k,285) / QW('NJTEqRatio',yr2Adv4,twn4k,285) )+ QW('PersPropAssess',yr2Adv4,twn4k,285);
  } else

  if (argdv4 == 'EqVllPerPop' ) {
    for (twn4l in ma['Towns'] ) ma['EqVllPerPop'+yr2Adv4][twn4l] = ( QW('NJTEqAssess',yr2Adv4,twn4l,287) / QW('Popu',yr2Adv4,twn4l,287) );
  } else

  if (argdv4 == 'EqVllPerSqmi' ) {
    for (twn4m in ma['Towns'] ) { 
      ma['EqVllPerSqmi'+yr2Adv4][twn4m] = ( QW('NJTEqAssess',yr2Adv4,twn4m,289) / (QW('SqMi','',twn4m,289)* QW('PctLandArea','',twn4m,289)) );
    };
  } else

  if (argdv4 == 'CountyTotTax' ) {
    if ( typeof ma['CountyTotTax'+yr2Adv4]['Total'] == udf ) 
      ma['CountyTotTax'+yr2Adv4]['Total']=0; 
    for (twn4n in ma['Towns'] ) {
      dotCTT = ma['CountyTotTax'+yr2Adv4][twn4n] = QW('CountyTax',yr2Adv4,twn4n,735)+ QW('CountyOSTax',yr2Adv4,twn4n,331);
      if ( QW('CountyLibTax',yr2Adv4,twn4n,290) )
        ma['CountyTotTax'+yr2Adv4][twn4n]+= '*See column headnote';
      if ( QW('isMorris','',twn4n,335) ) ma['CountyTotTax'+yr2Adv4]['Total'] += dotCTT;
    };
  } else

  if (argdv4 == 'PctOfCounty' ) {
    for (twn4o in ma['Towns'] ) {
      if ( QW('isMorris','',twn4o ,341) ) {
        ma['PctOfCounty'+yr2Adv4][twn4o] = QW('CountyTotTax',yr2Adv4,twn4o,342) / QW('CountyTotTax',yr2Adv4,'Total',342);
      } else ma['PctOfCounty'+yr2Adv4][twn4o] = "*Not Morris County";
    };
  } else

  if (argdv4 == 'CountyLibTax' ) { // This simply adds popup to the 3 towns.
    for (twn4p in ma['Towns'] ) {
      if ( QW('CountyLibTax',yr2Adv4,twn4p,741) ) {
        ma['CountyLibTax'+yr2Adv4][twn4p]+= '*See column headnote';
      };
    };
    return;
  } else

  if (argdv4 == 'MuniTaxPerPop' ) {
    for (twn4q in ma['Towns'] ) ma['MuniTaxPerPop'+yr2Adv4][twn4q] = QW('MuniTax',yr2Adv4,twn4q,317)/QW('Popu',yr2Adv4,twn4q,317);
  } else

  if (argdv4 == 'NrmMuniTaxPerPop' ) {
    for (twn4qa in ma['Towns'] ) ma['NrmMuniTaxPerPop'+yr2Adv4][twn4qa] = QW('MuniTaxPerPop',yr2Adv4,twn4qa,321)*QW('PctRes',yr2Adv4,twn4qa,321);
  } else

  if (argdv4 == 'MuniOtherTax' ) {
    for (twn4r in ma['Towns'] ) {
      ma['MuniOtherTax'+yr2Adv4][twn4r] = 0;
      if ( ! QW('MuniOtherTax04','',twn4r,747) ) continue;
      ma['MuniOtherTax'+yr2Adv4][twn4r] = QW('MuniOtherTax','04',twn4r,748) * QW('MuniTax',yr2Adv4,twn4r,748) / QW('MuniTax','04',twn4r,748)+'*See column headnote';
    };
  } else

  if (argdv4 == 'MuniTotTax' ) {
    for (twn4s in ma['Towns'] ) {
      ma['MuniTotTax'+yr2Adv4][twn4s] = QW('MuniTax',yr2Adv4,twn4s,751)+ QW('MuniOSTax',yr2Adv4,twn4s,751)+QW('MuniOtherTax',yr2Adv4,twn4s,751)+ QW('CountyLibTax',yr2Adv4,twn4s,751);
      if ( QW('CountyLibTax',yr2Adv4,twn4s,331) ) {
        ma['MuniTotTax'+yr2Adv4][twn4s]+= '*See column headnote';
      };
    };
  } else

  if (argdv4 == 'AllMuniTaxPerPop' ) {
    for (twn4t in ma['Towns'] ) ma['AllMuniTaxPerPop'+yr2Adv4][twn4t] = QW('MuniTotTax',yr2Adv4,twn4t)/QW('Popu',yr2Adv4,twn4t,752);
  } else

  if (argdv4 == 'NrmAllMuniTaxPerPop' ) {
    for (twn4u in ma['Towns'] ) ma['NrmAllMuniTaxPerPop'+yr2Adv4][twn4u] = QW('AllMuniTaxPerPop',yr2Adv4,twn4u,380)*QW('PctRes',yr2Adv4,twn4u,380);
  } else

  if (argdv4 == 'RegSchlTaxPerPop' ) {
    for (twn4v in ma['Towns'] ) ma['RegSchlTaxPerPop'+yr2Adv4][twn4v] = QW('RegSchTax',yr2Adv4,twn4v,755)/QW('Popu',yr2Adv4,twn4v,755);
  } else

  if (argdv4 == 'LocalSchlTaxPerPop' ) {
    for (twn4v in ma['Towns'] ) ma['LocalSchlTaxPerPop'+yr2Adv4][twn4v] = QW('LocalSchTax',yr2Adv4,twn4v,755)/QW('Popu',yr2Adv4,twn4v,755);
  } else

  if (argdv4 == 'TotSchTax' ) {
    for (twn4w in ma['Towns'] ) ma['TotSchTax'+yr2Adv4][twn4w] = QW('LocalSchTax',yr2Adv4,twn4w)+ QW('RegSchTax',yr2Adv4,twn4w,757)+QW('OtherSchTax',yr2Adv4,twn4w,757);
  } else

  if (argdv4 == 'SchTaxPerPop' ) {
    for (twn4x in ma['Towns'] ) ma['SchTaxPerPop'+yr2Adv4][twn4x] = QW('TotSchTax',yr2Adv4,twn4x,758)/QW('Popu',yr2Adv4,twn4x,758);
  } else

  if (argdv4 == 'TotTaxLevy' ) {
    for (twn4y in ma['Towns'] ) ma['TotTaxLevy'+yr2Adv4][twn4y] = QW('CountyTotTax',yr2Adv4,twn4y,399)+QW('MuniTotTax',yr2Adv4,twn4y,399)+ QW('TotSchTax',yr2Adv4,twn4y,399);
  } else

  if (argdv4 == 'TotTaxPerPop' ) {
    for (twn4z in ma['Towns'] ) ma['TotTaxPerPop'+yr2Adv4][twn4z] = QW('TotTaxLevy',yr2Adv4,twn4z,403)/QW('Popu',yr2Adv4,twn4z,403);
  } else

  if (argdv4 == 'NrmTotTaxPerPop' ) {
    for (twn4_a in ma['Towns'] ) ma['NrmTotTaxPerPop'+yr2Adv4][twn4_a] = QW('TotTaxPerPop',yr2Adv4,twn4_a,389)*QW('PctRes',yr2Adv4,twn4_a,389);
  } else

  if (argdv4 == 'PctMuni' ) {
    for (twn4_b in ma['Towns'] ) {
      ma['PctMuni'+yr2Adv4][twn4_b] = ( QW('MuniTotTax',yr2Adv4,twn4_b,411)/ QW('TotTaxLevy',yr2Adv4,twn4_b,411) );
      if ( QW('CountyLibTax',yr2Adv4,twn4_b,375) ) {
        ma['PctMuni'+yr2Adv4][twn4_b]+= '*Includes County Library Tax';
      };
    };
  } else

  if (argdv4 == 'PctSch' ) {
    for (twn4_c in ma['Towns'] ) ma['PctSch'+yr2Adv4][twn4_c] = QW('TotSchTax',yr2Adv4,twn4_c,415)/ QW('TotTaxLevy',yr2Adv4,twn4_c,415);
  } else

  if (argdv4 == 'PctCnty' ) {
    for (twn4_d in ma['Towns'] ) {
      ma['PctCnty'+yr2Adv4][twn4_d] = QW('CountyTotTax',yr2Adv4,twn4_d,411)/ QW('TotTaxLevy',yr2Adv4,twn4_d,411);
      if ( QW('CountyLibTax',yr2Adv4,twn4_d,388) ) {
        ma['PctCnty'+yr2Adv4][twn4_d]+= '*Excludes County Library Tax';
      };
    };
  } else

  if (argdv4 == 'PctSenCredit' ) {
    for (twn4_e in ma['Towns'] ) ma['PctSenCredit'+yr2Adv4][twn4_e] = QW('SenCredit',yr2Adv4,twn4_e,411)/ QW('TotTaxLevy',yr2Adv4,twn4_e,411);
  } else

  if (argdv4 == 'PctVetCredit' ) {
    for (twn4_f in ma['Towns'] ) ma['PctVetCredit'+yr2Adv4][twn4_f] = QW('VetCredit',yr2Adv4,twn4_f,411)/ QW('TotTaxLevy',yr2Adv4,twn4_f,411);
  } else

  if (argdv4 == 'ResPerPolice' ) {
    for (twn4_g in ma['Towns'] ) ma['ResPerPolice'+yr2Adv4][twn4_g] = ( QW('Police',yr2Adv4,twn4_g,777)?( QW('Popu',yr2Adv4,twn4_g,777)/QW('Police',yr2Adv4,twn4_g,777) ):'' )+ '*'+(ma['Police'+yr2Adv4][twn4_g]+'*').split('*')[1]; 
  } else

  if (argdv4 == 'NrmResPerPolice' ) {
    for (twn4_h in ma['Towns'] ) ma['NrmResPerPolice'+yr2Adv4][twn4_h]= ( QW('Police',yr2Adv4,twn4_h,339)?( QW('ResPerPolice',yr2Adv4,twn4_h,339)/QW('PctRes',yr2Adv4,twn4_h,339) ):'' )+'*'+(ma['Police'+yr2Adv4][twn4_h]+'*').split('*')[1];
  } else

  if (argdv4 == 'PolicParity' ) {
    for (twn4_i in ma['Towns'] ) ma['PolicParity'][twn4_i]= QW('NrmResPerPolice','07',twn4_i,796)?( QW('Popu','06','Long Hill',796)/QW('PctRes','07','Long Hill',796)/QW('NrmResPerPolice','07',twn4_i,796) ):''; 
  } else 
  
//  if (argdv4 == 'CrimeRatAvg' ) {
//    crYrs=8;
//    for (twn4_j in ma['Towns'] ) {
//      ma['CrimeRatAvg'][twn4_j]=0;
//      for (yr=0; yr<crYrs; yr++){
//        yr2=Yr2(yr);
//        ma['CrimeRatAvg'][twn4_j] += QW('CrimeRate',yr2,twn4_j,439); 
//      };
//      ma['CrimeRatAvg'][twn4_j] = QW('CrimeRatAvg','',twn4_j,781)/crYrs;
//    };
//  } else

//  if (argdv4 == '' ) {
//    for (twn4_ in ma['Towns'] ) ;
//  } else

  return false;  // if all the if/else fail
  
  return true; // normal exit if a hit was found
   
};

