function submitForm(el, action, js) {
  if (eval(js) != false) {
    var form = getParentForm(el);
    if (form != null) {
      var node = document.createElement('input');
      node.setAttribute("type", "submit");
      if (action != null && action.length > 0) {
        node.setAttribute("name", "Action." + action);
      }
      node.setAttribute("style", "display: none;");
      form.appendChild(node);
      try {
        node.click();
      } catch (e) {
      }
      form.removeChild(node);
    }
  }
}

function getParentForm(el) {
  var tagName = el.tagName.toLowerCase();
  while (tagName != "form" && tagName != "body") {
    tagName = el.parentNode.tagName.toLowerCase();
    el = el.parentNode;
  }
  return (tagName == "form") ? el : null;
}
