/* This script and many more are available free online at

The JavaScript Source!! http://javascript.internet.com

Created by: Jim Stiles | www.jdstiles.com */

function ShowMenu(num, menu, max)

        {

                //starting at one, loop through until the number chosen by the user

                for(i = 1; i <= num; i++){

                        //add number onto end of menu

                        var menu2 = menu + i;

                        //change visibility to block, or 'visible'

                        document.getElementById(menu2).style.display = 'block';

                }

                //make a number one more than the number inputed

                var num2 = num;

                num2++;

                //hide it if the viewer selects a number lower

                //this will hide every number between the selected number and the maximum

                //ex.  if 3 is selected, hide the <div> cells for 4, 5, and 6

                //loop until max is reached

                while(num2 <= max){

                        var menu3 = menu + num2;

                        //hide 

                        document.getElementById(menu3).style.display = 'none';

                        //add one to loop

                        num2=num2+1;

                }

        }



function oneMenu(num, menu, max)

{

                //num is selected value, menu is the name of the div, max is the number of divs

                for(i = 1; i <= max; i++){

                        //add number onto end of menu

                        var menu_div = menu + i;



                        //if current show

                        if(i == num) {

                                document.getElementById(menu_div).style.display = 'block';

                        } else {

                                //if not, hide

                                document.getElementById(menu_div).style.display = 'none';

                        }

                }







        }



// State lists

var states = new Array();



states['United States'] = new Array('Select your state','Alaska','Alabama','Arkansas','Arizona','California','Colorado','Connecticut','Washington DC','Delaware','Florida','Georgia','Hawaii','Iowa','Idaho','Illinois','Indiana','Kansas','Kentucky','Louisiana','Massachusets','Maryland','Maine','Michigan','Minnesota','Missouri','Mississippi','Montana','North Carolina','North Dakota','Nebraska','New Hampshire','New Jersey','New Mexico','Nevada','New York','Ohio','Oklahoma','Oregon','Pennsylvania','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Virginia','Vermont','Washington','Wisconsin','West Virginia','Wyoming');

states['Canada'] = new Array('Newfoundland and Labrador','Prince Edward Island','Nova Scotia','New Brunswick','Quebec','Ontario','Manitoba','Saskatchewan','Alberta','British Columbia','Yukon','NW Territories and Nunavut');



// City lists

var cities = new Array();



cities['Canada'] = new Array();

cities['Canada']['Newfoundland and Labrador']          = new Array('.000015');

cities['Canada']['Prince Edward Island']          = new Array('.000192');

cities['Canada']['Nova Scotia']          = new Array('.000549');

cities['Canada']['New Brunswick']          = new Array('.000366');

cities['Canada']['Quebec']          = new Array('.000006');

cities['Canada']['Ontario']          = new Array('.00018');

cities['Canada']['Manitoba']          = new Array('.00001');

cities['Canada']['Saskatchewan']          = new Array('.00081');

cities['Canada']['Alberta']          = new Array('.00093');

cities['Canada']['British Columbia']          = new Array('.00002');

cities['Canada']['Yukon']          = new Array('.00008');

cities['Canada']['NW Territories and Nunavut']          = new Array('.00008');



cities['United States'] = new Array();

cities['United States']['Alaska'] = new Array('.000388288');

cities['United States']['Alabama'] = new Array('.00075068');

cities['United States']['Arkansas'] = new Array('.000606063');

cities['United States']['Arizona'] = new Array('.00059458');

cities['United States']['California'] = new Array('.000323351');

cities['United States']['Colorado'] = new Array('.000354245');

cities['United States']['Connecticut'] = new Array('.00037615');

cities['United States']['Washington DC'] = new Array('.000494558');

cities['United States']['Delaware'] = new Array('.000494558');

cities['United States']['Florida'] = new Array('.000573469');

cities['United States']['Georgia'] = new Array('.00075068');

cities['United States']['Hawaii'] = new Array('.000714993');

cities['United States']['Iowa'] = new Array('.000821075');

cities['United States']['Idaho'] = new Array('.000407274');

cities['United States']['Illinois'] = new Array('.000763551');

cities['United States']['Indiana'] = new Array('.000697048');

cities['United States']['Kansas'] = new Array('.000889315');

cities['United States']['Kentucky'] = new Array('.00068478');

cities['United States']['Louisiana'] = new Array('.000606063');

cities['United States']['Massachusets'] = new Array('.00037615');

cities['United States']['Maryland'] = new Array('.000595803');

cities['United States']['Maine'] = new Array('.00037615');

cities['United States']['Michigan'] = new Array('.000699923');

cities['United States']['Minnesota'] = new Array('.000821075');

cities['United States']['Missouri'] = new Array('.000859685');

cities['United States']['Mississippi'] = new Array('.000632302');

cities['United States']['Montana'] = new Array('.000407274');

cities['United States']['North Carolina'] = new Array('.000507211');

cities['United States']['North Dakota'] = new Array('.000821075');

cities['United States']['Nebraska'] = new Array('.000821075');

cities['United States']['New Hampshire'] = new Array('.00037615');

cities['United States']['New Jersey'] = new Array('.000494558');

cities['United States']['New Mexico'] = new Array('.00067263');

cities['United States']['Nevada'] = new Array('.000500927');

cities['United States']['New York'] = new Array('.000428449');

cities['United States']['Ohio'] = new Array('.000697048');

cities['United States']['Oklahoma'] = new Array('.00075068');

cities['United States']['Oregon'] = new Array('.000407274');

cities['United States']['Pennsylvania'] = new Array('.000595803');

cities['United States']['Rhode Island'] = new Array('.00037615');

cities['United States']['South Carolina'] = new Array('.000507211');

cities['United States']['South Dakota'] = new Array('.000821075');

cities['United States']['Tennessee'] = new Array('.00068478');

cities['United States']['Texas'] = new Array('.000604231');

cities['United States']['Utah'] = new Array('.000407274');

cities['United States']['Virginia'] = new Array('.000602129');

cities['United States']['Vermont'] = new Array('.00037615');

cities['United States']['Washington'] = new Array('.000407274');

cities['United States']['Wisconsin'] = new Array('.000821628');

cities['United States']['West Virginia'] = new Array('.000697048');

cities['United States']['Wyoming'] = new Array('.00038076');





function setStates() {

  cntrySel = document.getElementById('country');

  stateList = states[cntrySel.value];

  changeSelect('state', stateList, stateList);

  setCities();

}



function setCities() {

  cntrySel = document.getElementById('country');

  stateSel = document.getElementById('state');

  cityList = cities[cntrySel.value][stateSel.value];

  changeSelect('state_rate', cityList, cityList);

}



function changeSelect(fieldID, newOptions, newValues) {

  selectField = document.getElementById(fieldID);

  selectField.options.length = 0;

  for (i=0; i<newOptions.length; i++) {

    selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);

  }

}





// State lists

var num_beds = new Array();



num_beds['Single Family House'] = new Array('1','2','3','4','5','6','7','8','9','10');

num_beds['Townhouse or Rowhouse'] = new Array('1','2','3','4','5','6','7','8','9','10');

num_beds['Mid-sized Apartment Building'] = new Array('1','2','3','4','5','6','7','8','9','10');

num_beds['Large Apartment Building'] = new Array('1','2','3','4','5','6','7','8','9','10');



// City lists

var living_rate = new Array();



living_rate['Single Family House'] = new Array();

living_rate['Single Family House']['1']          = new Array('10004.7');

living_rate['Single Family House']['2']          = new Array('10004.7');

living_rate['Single Family House']['3']          = new Array('12056.9');

living_rate['Single Family House']['4']          = new Array('15391.8');

living_rate['Single Family House']['5']          = new Array('20907.2');

living_rate['Single Family House']['6']          = new Array('20907.2');

living_rate['Single Family House']['7']          = new Array('20907.2');

living_rate['Single Family House']['8']          = new Array('20907.2');

living_rate['Single Family House']['8']          = new Array('20907.2');

living_rate['Single Family House']['10']          = new Array('20907.2');



living_rate['Townhouse or Rowhouse'] = new Array();

living_rate['Townhouse or Rowhouse']['1']          = new Array('10004.7');

living_rate['Townhouse or Rowhouse']['2']          = new Array('10004.7');

living_rate['Townhouse or Rowhouse']['3']          = new Array('12954.7');

living_rate['Townhouse or Rowhouse']['4']          = new Array('17828.8');

living_rate['Townhouse or Rowhouse']['5']          = new Array('17828.8');

living_rate['Townhouse or Rowhouse']['6']          = new Array('17828.8');

living_rate['Townhouse or Rowhouse']['7']          = new Array('17828.8');

living_rate['Townhouse or Rowhouse']['8']          = new Array('17828.8');

living_rate['Townhouse or Rowhouse']['8']          = new Array('17828.8');

living_rate['Townhouse or Rowhouse']['10']          = new Array('17828.8');



living_rate['Mid-sized Apartment Building'] = new Array();

living_rate['Mid-sized Apartment Building']['1']          = new Array('5692.6');

living_rate['Mid-sized Apartment Building']['2']          = new Array('7385');

living_rate['Mid-sized Apartment Building']['3']          = new Array('11308.2');

living_rate['Mid-sized Apartment Building']['4']          = new Array('11308.2');

living_rate['Mid-sized Apartment Building']['5']          = new Array('11308.2');

living_rate['Mid-sized Apartment Building']['6']          = new Array('11308.2');

living_rate['Mid-sized Apartment Building']['7']          = new Array('11308.2');

living_rate['Mid-sized Apartment Building']['8']          = new Array('11308.2');

living_rate['Mid-sized Apartment Building']['8']          = new Array('11308.2');

living_rate['Mid-sized Apartment Building']['10']          = new Array('11308.2');



living_rate['Large Apartment Building'] = new Array();

living_rate['Large Apartment Building']['1']          = new Array('5320.6');

living_rate['Large Apartment Building']['2']          = new Array('7648.3');

living_rate['Large Apartment Building']['3']          = new Array('9776.5');

living_rate['Large Apartment Building']['4']          = new Array('9776.5');

living_rate['Large Apartment Building']['5']          = new Array('9776.5');

living_rate['Large Apartment Building']['6']          = new Array('9776.5');

living_rate['Large Apartment Building']['7']          = new Array('9776.5');

living_rate['Large Apartment Building']['8']          = new Array('9776.5');

living_rate['Large Apartment Building']['8']          = new Array('9776.5');

living_rate['Large Apartment Building']['10']          = new Array('9776.5');





function setNum_beds() {

  resSel = document.getElementById('res_type');

  num_bedsList = num_beds[resSel.value];

  changeSelection('num_beds', num_bedsList, num_bedsList);

  setLiving_rate();

}



function setLiving_rate() {

  resSel = document.getElementById('res_type');

  bedsSel = document.getElementById('num_beds');

  living_rateList = living_rate[resSel.value][bedsSel.value];

  changeSelection('living_rate', living_rateList, living_rateList);

}



function changeSelection(fieldID, newOptions, newValues) {

  selectField = document.getElementById(fieldID);

  selectField.options.length = 0;

  for (i=0; i<newOptions.length; i++) {

    selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);

  }

}



// Multiple onload function created by: Simon Willison

// http://simonwillison.net/2004/May/26/addLoadEvent/

function addLoadEvent(func) {

  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      if (oldonload) {

        oldonload();

      }

      func();

    }

  }

}



addLoadEvent(function() {

  setStates();

});





function startCalc(){

  interval = setInterval("calc()",1);

}

function calc(){

  one = getRadioValue('ind_hous');

  two = document.getElementById('liv_path').value;

  three = document.autoSumForm.state_rate.value;

  four = document.getElementById('num_house').value;

  five = document.autoSumForm.living_rate.value;

  six = document.autoSumForm.elec.value;

  seven = document.getElementById('elec_per').value;

  eight = document.autoSumForm.oil.value;

  nine = document.getElementById('oil_per').value;

  ten = document.autoSumForm.gas.value;

  eleven = document.getElementById('gas_per').value;

  twelve = document.autoSumForm.propane.value;

  thirteen = document.getElementById('propane_per').value;

  fourteen = document.autoSumForm.renewables.value;

  fifteen = document.getElementById('diet').value;

  sixteen = document.getElementById('organic').value;

  seventeen = document.getElementById('recycle').value;

  eighteen = document.getElementById('compost').value;

  d_one = document.getElementById('drive_path').value;

  d_two = document.getElementById('numdrivers').value;

  d_three = document.getElementById('epa_drivers').value;

  d_four = document.getElementById('vehtype1').value;

  d_five = document.getElementById('vehtype2').value;

  d_six = document.getElementById('vehtype3').value;

  d_seven = document.getElementById('vehtype4').value;

  d_eight = document.getElementById('vehtype5').value;

  d_nine = document.getElementById('vehtype6').value;

  d_ten = document.getElementById('numdrivers2').value;

  d_eleven = document.autoSumForm.veh_mpg1.value;

  d_twelve = document.autoSumForm.veh_mpg2.value;

  d_thirteen = document.autoSumForm.veh_mpg3.value;

  d_fourteen = document.autoSumForm.veh_mpg4.value;

  d_fifteen = document.autoSumForm.veh_mpg5.value;

  d_sixteen = document.autoSumForm.veh_mpg6.value;

  d_seventeen = document.autoSumForm.veh_miles1.value;

  d_eighteen = document.autoSumForm.veh_miles2.value;

  d_nineteen = document.autoSumForm.veh_miles3.value;

  d_twenty = document.autoSumForm.veh_miles4.value;

  d_twentyone = document.autoSumForm.veh_miles5.value;

  d_twentytwo = document.autoSumForm.veh_miles6.value;

  f_one = document.getElementById('air_path').value;

  f_two = document.getElementById('air_est').value;

  f_three = document.getElementById('air_radio1').value;

  f_four = document.getElementById('air_radio2').value;

  f_five = document.getElementById('air_radio3').value;

  f_six = document.getElementById('air_radio4').value;

  f_seven = document.getElementById('air_radio5').value;

  f_eight = document.getElementById('air_radio6').value;

  f_nine = document.getElementById('air_flight').value;

  f_ten = document.autoSumForm.short1.value;

  f_eleven = document.autoSumForm.medium1.value;

  f_twelve = document.autoSumForm.long1.value;

  f_thirteen = document.autoSumForm.ext1.value;

  f_fourteen = document.autoSumForm.short2.value;

  f_fifteen = document.autoSumForm.medium2.value;

  f_sixteen = document.autoSumForm.long2.value;

  f_seventeen = document.autoSumForm.ext2.value;

  f_eighteen = document.autoSumForm.short3.value;

  f_nineteen = document.autoSumForm.medium3.value;

  f_twenty = document.autoSumForm.long3.value;

  f_twentyone = document.autoSumForm.ext3.value;

  f_twentytwo = document.autoSumForm.short4.value;

  f_twentythree = document.autoSumForm.medium4.value;

  f_twentyfour = document.autoSumForm.long4.value;

  f_twentyfive = document.autoSumForm.ext4.value;

  f_twentysix = document.autoSumForm.short5.value;

  f_twentyseven = document.autoSumForm.medium5.value;

  f_twentyeight = document.autoSumForm.long5.value;

  f_twentynine = document.autoSumForm.ext5.value;

  f_thirty = document.autoSumForm.short6.value;

  f_thirtyone = document.autoSumForm.medium6.value;

  f_thirtytwo = document.autoSumForm.long6.value;

  f_thirtythree = document.autoSumForm.ext6.value;

  lSum = document.autoSumForm.liv_sum.value;

  dSum = document.autoSumForm.drive_sum.value;

  fSum = document.autoSumForm.fly_sum.value;

  

//------------------ Living Calcs --------------------------------

if (one == 1 && two == 1)

{

   document.autoSumForm.liv_sum.value = Number(4 + ((fifteen * 3.6) * (sixteen * 1)) + ((.48 * seventeen * 1) * (eighteen * 1))).toFixed(1);

}

else if (one == 2 && two == 1)

{

  document.autoSumForm.liv_sum.value = Number((four * 1) * (4 + ((fifteen * 3.6) * (sixteen * 1)) + ((.48 * seventeen * 1) * (eighteen * 1)))).toFixed(1);

}

else if (one == 1 && two == 2)

{

  document.autoSumForm.liv_sum.value = Number(((five * 1) * (three * 1))/(four * 1) + ((fifteen * 3.6) * (sixteen * 1)) + ((.48 * seventeen * 1) * (eighteen * 1))).toFixed(1);

}

else if (one == 2 && two == 2)

{

   document.autoSumForm.liv_sum.value = Number(((five * 1) * (three * 1)) + ((fifteen * 3.6) * ((sixteen * 1)) + ((.48 * seventeen * 1) * (eighteen * 1))) * (four * 1)).toFixed(1);

}

else if (one == 1 && two == 3)

{

  document.autoSumForm.liv_sum.value = Number((((six * 1) * 1.072 * (seven * 1) * (three * 1) * ( 1 - (fourteen * .01))) + ((ten * 1) * .005914 * (eleven * 1)) + ((eight * 1) * .010159 * (nine * 1)) + ((twelve * 1) * .005760 * (thirteen * 1))) / (four * 1) + ((fifteen * 3.6) * (sixteen * 1)) + ((.48 * seventeen * 1) * (eighteen * 1))).toFixed(1);

}

else if (one == 2 && two == 3)

{

  document.autoSumForm.liv_sum.value = Number(((six * 1) * 1.072 * (seven * 1) * (three * 1) * ( 1 - (fourteen * .01))) + ((ten * 1) * .005914 * (eleven * 1)) + ((eight * 1) * .010159 * (nine * 1)) + ((twelve * 1) * .005760 * (thirteen * 1))  + ((fifteen * 3.6) * (sixteen * 1)) * (four * 1) + ((.48 * seventeen * 1) * (eighteen * 1)) * (four * 1)).toFixed(1);

}

else

{

document.autoSumForm.liv_sum.value = 0;

}

//------------------ Driving Calcs --------------------------------

if (d_one == 1)

{

document.autoSumForm.drive_sum.value = Number((d_two * 5.5)).toFixed(1);

}

else if (d_one == 2 && d_three == 1)

{

document.autoSumForm.drive_sum.value = Number((d_four * 1)).toFixed(1);

}

else if (d_one == 2 && d_three == 2)

{

document.autoSumForm.drive_sum.value = Number((d_four * 1) + (d_five * 1)).toFixed(1);

}

else if (d_one == 2 && d_three == 3)

{

document.autoSumForm.drive_sum.value = Number((d_four * 1) + (d_five * 1) + (d_six * 1)).toFixed(1);

}

else if (d_one == 2 && d_three == 4)

{

document.autoSumForm.drive_sum.value = Number((d_four * 1) + (d_five * 1) + (d_six * 1) + (d_seven * 1)).toFixed(1);

}

else if (d_one == 2 && d_three == 5)

{

document.autoSumForm.drive_sum.value = Number((d_four * 1) + (d_five * 1) + (d_six * 1) + (d_seven * 1) + (d_eight * 1)).toFixed(1);

}

else if (d_one == 2 && d_three == 6)

{

document.autoSumForm.drive_sum.value = Number((d_four * 1) + (d_five * 1) + (d_six * 1) + (d_seven * 1) + (d_eight * 1) + (d_nine * 1)).toFixed(1);

}

else if (d_one == 3 && d_ten == 1)

{

document.autoSumForm.drive_sum.value = Number(1 + ((d_seventeen * 1)/(d_eleven * 1) * 24.6920 / 2205) - 1).toFixed(1);

}

else if (d_one == 3 && d_ten == 2)

{

document.autoSumForm.drive_sum.value = Number(((d_seventeen * 1)/(d_eleven * 1) * 24.6920 / 2205) + ((d_eighteen * 1)/(d_twelve * 1) * 24.6920 / 2205)).toFixed(1);

}

else if (d_one == 3 && d_ten == 3)

{

document.autoSumForm.drive_sum.value = Number(((d_seventeen * 1)/(d_eleven * 1) * 24.6920 / 2205) + ((d_eighteen * 1)/(d_twelve * 1) * 24.6920 / 2205) + ((d_nineteen * 1)/(d_thirteen * 1) * 24.6920 / 2205)).toFixed(1);

}

else if (d_one == 3 && d_ten == 4)

{

document.autoSumForm.drive_sum.value = Number(((d_seventeen * 1)/(d_eleven * 1) * 24.6920 / 2205) + ((d_eighteen * 1)/(d_twelve * 1) * 24.6920 / 2205) + ((d_nineteen * 1)/(d_thirteen * 1) * 24.6920 / 2205) + ((d_twenty * 1)/(d_fourteen * 1) * 24.6920 / 2205)).toFixed(1);

}

else if (d_one == 3 && d_ten == 5)

{

document.autoSumForm.drive_sum.value = Number(((d_seventeen * 1)/(d_eleven * 1) * 24.6920 / 2205) + ((d_eighteen * 1)/(d_twelve * 1) * 24.6920 / 2205) + ((d_nineteen * 1)/(d_thirteen * 1) * 24.6920 / 2205) + ((d_twenty * 1)/(d_fourteen * 1) * 24.6920 / 2205) + ((d_twentyone * 1)/(d_fifteen * 1) * 24.6920 / 2205)).toFixed(1);

}

else if (d_one == 3 && d_ten == 6)

{

document.autoSumForm.drive_sum.value = Number(((d_seventeen * 1)/(d_eleven * 1) * 24.6920 / 2205) + ((d_eighteen * 1)/(d_twelve * 1) * 24.6920 / 2205) + ((d_nineteen * 1)/(d_thirteen * 1) * 24.6920 / 2205) + ((d_twenty * 1)/(d_fourteen * 1) * 24.6920 / 2205) + ((d_twentyone * 1)/(d_fifteen * 1) * 24.6920 / 2205) + ((d_twentytwo * 1)/(d_sixteen * 1) * 24.6920 / 2205)).toFixed(1);

}

else

{

document.autoSumForm.drive_sum.value = 0;

}

//------------------ Flying Calcs --------------------------------

if (f_one == 1 && f_two == 1)

{

document.autoSumForm.fly_sum.value = Number((f_three * 1)).toFixed(1);

}

else if (f_one == 1 && f_two == 2)

{

document.autoSumForm.fly_sum.value = Number((f_three * 1) + (f_four * 1)).toFixed(1);

}

else if (f_one == 1 && f_two == 3)

{

document.autoSumForm.fly_sum.value = Number((f_three * 1) + (f_four * 1) + (f_five * 1)).toFixed(1);

}

else if (f_one == 1 && f_two == 4)

{

document.autoSumForm.fly_sum.value = Number((f_three * 1) + (f_four * 1) + (f_five * 1) + (f_six * 1)).toFixed(1);

}

else if (f_one == 1 && f_two == 5)

{

document.autoSumForm.fly_sum.value = Number((f_three * 1) + (f_four * 1) + (f_five * 1) + (f_six * 1) + (f_seven * 1)).toFixed(1);

}

else if (f_one == 1 && f_two == 6)

{

document.autoSumForm.fly_sum.value = Number((f_three * 1) + (f_four * 1) + (f_five * 1) + (f_six * 1) + (f_seven * 1) + (f_eight * 1)).toFixed(1);

}

else if (f_one == 2 && f_nine == 1)

{

document.autoSumForm.fly_sum.value = Number((f_ten * .439) + (f_eleven * 1.095) + (f_twelve * 2.387) + (f_thirteen * 4.775)).toFixed(1);

}

else if (f_one == 2 && f_nine == 2)

{

document.autoSumForm.fly_sum.value = Number((f_ten * .439) + (f_eleven * 1.095) + (f_twelve * 2.387) + (f_thirteen * 4.775) + (f_fourteen * .439) + (f_fifteen * 1.095) + (f_sixteen * 2.387) + (f_seventeen * 4.775)).toFixed(1);

}

else if (f_one == 2 && f_nine == 3)

{

document.autoSumForm.fly_sum.value = Number((f_ten * .439) + (f_eleven * 1.095) + (f_twelve * 2.387) + (f_thirteen * 4.775) + (f_fourteen * .439) + (f_fifteen * 1.095) + (f_sixteen * 2.387) + (f_seventeen * 4.775) + (f_eighteen * .439) + (f_nineteen * 1.095) + (f_twenty * 2.387) + (f_twentyone * 4.775)).toFixed(1);

}

else if (f_one == 2 && f_nine == 4)

{

document.autoSumForm.fly_sum.value = Number((f_ten * .439) + (f_eleven * 1.095) + (f_twelve * 2.387) + (f_thirteen * 4.775) + (f_fourteen * .439) + (f_fifteen * 1.095) + (f_sixteen * 2.387) + (f_seventeen * 4.775) + (f_eighteen * .439) + (f_nineteen * 1.095) + (f_twenty * 2.387) + (f_twentyone * 4.775) + (f_twentytwo * .439) + (f_twentythree * 1.095) + (f_twentyfour * 2.387) + (f_twentyfive * 4.775)).toFixed(1);

}

else if (f_one == 2 && f_nine == 5)

{

document.autoSumForm.fly_sum.value = Number((f_ten * .439) + (f_eleven * 1.095) + (f_twelve * 2.387) + (f_thirteen * 4.775) + (f_fourteen * .439) + (f_fifteen * 1.095) + (f_sixteen * 2.387) + (f_seventeen * 4.775) + (f_eighteen * .439) + (f_nineteen * 1.095) + (f_twenty * 2.387) + (f_twentyone * 4.775) + (f_twentytwo * .439) + (f_twentythree * 1.095) + (f_twentyfour * 2.387) + (f_twentyfive * 4.775) +(f_twentysix * .439) + (f_twentyseven * 1.095) + (f_twentyeight * 2.387) + (f_twentynine * 4.775)).toFixed(1);

}

else if (f_one == 2 && f_nine == 6)

{

document.autoSumForm.fly_sum.value = Number((f_ten * .439) + (f_eleven * 1.095) + (f_twelve * 2.387) + (f_thirteen * 4.775) + (f_fourteen * .439) + (f_fifteen * 1.095) + (f_sixteen * 2.387) + (f_seventeen * 4.775) + (f_eighteen * .439) + (f_nineteen * 1.095) + (f_twenty * 2.387) + (f_twentyone * 4.775) +( f_twentytwo * .439) + (f_twentythree * 1.095) + (f_twentyfour * 2.387) + (f_twentyfive * 4.775) +(f_twentysix * .439) + (f_twentyseven * 1.095) + (f_twentyeight * 2.387) + (f_twentynine * 4.775) +(f_thirty * .439) + (f_thirtyone * 1.095) + (f_thirtytwo * 2.387) + (f_thirtythree * 4.775)).toFixed(1);

}

else

{

document.autoSumForm.fly_sum.value = 0;

}

document.autoSumForm.total.value = Number((lSum * 1) + (dSum * 1) + (fSum * 1)).toFixed(0);

}



function stopCalc(){

  clearInterval(interval);

}

function getRadioValue(ind_hous)

{

for(i=0;i<document.autoSumForm[ind_hous].length;i++)

{

if (document.autoSumForm[ind_hous][i].checked == true)

return document.autoSumForm[ind_hous][i].value;

}

}



function changeWidth1() {

document.autoSumForm.graph1.cols = document.autoSumForm.liv_sum.value;

}



function changeWidth2() {

document.autoSumForm.graph2.cols = document.autoSumForm.drive_sum.value;

}



function changeWidth3() {

document.autoSumForm.graph3.cols = document.autoSumForm.fly_sum.value;

}


