function SetElement(inputName, value) {
  el = document.getElementById(inputName);
  if (el) {
    if (
      el.getAttribute("type") == "text" &&
      el.getAttribute("data-original-type") == "number"
    ) {
      let raw = value.toString().replace(/[^\d]/g, "");
      if (raw) {
        el.value = raw.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
      } else el.value = "";
      el.setSelectionRange(el.value.length, el.value.length);
    } else {
      el.value = value;
    }

    el.classList.add("K_Dirty_Input");
  }
}

function SetGlobalVariable(variables) {
  // variables is an array of arrays
  for (var i = 0; i < variables.length; i++) {
    document
      .getElementById("Form")
      .setAttribute(variables[i][0], variables[i][1]);
  }
}
