function createForm(formAction, formName){
  var formMethod = "post";
  if (document.getElementById) {
    var form = document.createElement('form');
      if (document.all) { // what follows should work with NN6 but doesn't in M14
        form.method = formMethod;
        form.name = formName;
        form.action = formAction;
        form.target = '_top';
      }
      else if (document.getElementById) { // so here is the NN6 workaround
        form.setAttribute('method', formMethod);
        form.setAttribute('name', formName);
        form.setAttribute('action', formAction);
        form.target = '_top';
      }
    document.body.appendChild(form);
  }
  return form;
}

// This function adds input field to the given form of given type 
// with the given name and value.
function addField(form, fieldType, fieldName, fieldValue) {
  if (document.getElementById) {
    var input = document.createElement('input');
      if (document.all) { // what follows should work with NN6 but doesn't in M14
        input.type = fieldType;
        input.name = fieldName;
        input.value = fieldValue;
      }
      else if (document.getElementById) { // so here is the NN6 workaround
        input.setAttribute('type', fieldType);
        input.setAttribute('name', fieldName);
        input.setAttribute('value', fieldValue);
      }
    form.appendChild(input);
  }
}




















