function resetForm(html_id) {

   var fDiv       = document.getElementById(html_id);
   var fInputs    = fDiv.getElementsByTagName('input');
   var l          = fInputs.length;

   for (var indx = 0; indx < l; indx++) {
      setInput(null, '', fInputs[indx]);
   }
}


function setInput(inputId, inputValue, inputObject) {

   if (inputObject) {
      var ajaxInput = inputObject;
   }
   else if (inputId) {
      var ajaxInput = document.getElementById(inputId);
   }

   var checkStr  = '';
   var status    = false;

   if (ajaxInput) {

       status = ajaxInput.disabled;
       ajaxInput.disabled = false;

       if (ajaxInput.type == 'text'  ||  ajaxInput.type == 'hidden') {
          ajaxInput.value = inputValue;
       }
       else if (ajaxInput.type == 'checkbox') {
          if (inputValue  &&  inputValue != 0) {
             ajaxInput.checked = true;
          }
          else {
             ajaxInput.checked = false;
          }
       }

       if (status) {
          ajaxInput.disabled = true;
       }
   }
}


function getSelectValue(select_id) {

   var value      = null;
   var htmlSelect = document.getElementById(select_id);
   var optionNr   = htmlSelect.selectedIndex;

   if (optionNr != -1) {
      value = htmlSelect.options[optionNr].value;
   }

   return value;
}


function removeOptions(select, set_default) {

   for (var i = select.options.length; i > 0; i--) {
      select.options[i-1] = null;
   }

   if (set_default) {
      select.options[0] = new Option('Loading...', 0);
   }
}
