/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Kiran Pai | http://www.codecoffee.com/ */

var Electricunits= new Array("Kwh");
var Pelletunits = new Array("Bag", "Ton");
var Gasunits = new Array("Therm", "MCF");
var Oilunits = new Array("Gal");
var Propaneunits = new Array("Gal");
var Keroseneunits = new Array("Gal");

function set_unit() {
  var select_htype = document.woodcalc.htype;
  var select_unit = document.woodcalc.unitmeasure;
  var selected_htype = select_htype.options[select_htype.selectedIndex].value;

  select_unit.options.length=0;
  if (selected_htype == "Electric"){
    for(var i=0; i<Electricunits.length; i++)
    select_unit.options[select_unit.options.length] = new Option(Electricunits[i]);
  }
  if (selected_htype == "Pellets"){
    for(var i=0; i<Pelletunits.length; i++)
    select_unit.options[select_unit.options.length] = new Option(Pelletunits[i]);
  }
  if (selected_htype == "Gas"){
    for(var i=0; i<Gasunits.length; i++)
    select_unit.options[select_unit.options.length] = new Option(Gasunits[i]);
  }
  if (selected_htype == "Heating Oil"){
    for(var i=0; i<Oilunits.length; i++)
    select_unit.options[select_unit.options.length] = new Option(Oilunits[i]);
  }
  if (selected_htype == "Propane"){
    for(var i=0; i<Propaneunits.length; i++)
    select_unit.options[select_unit.options.length] = new Option(Propaneunits[i]);
  }
  if (selected_htype == "Kerosene"){
    for(var i=0; i<Keroseneunits.length; i++)
    select_unit.options[select_unit.options.length] = new Option(Keroseneunits[i]);
  }
}
