function FormHelper() {
}

FormHelper.prototype.createForm = function (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.
FormHelper.prototype.addField = function (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);
  }
}

FormHelper.prototype.getElementValue = function (name,form)
{
	var formObject = document.forms[form];
	var els = formObject.elements;
	return getValue(els[name]);
}

FormHelper.prototype.setElementValue = function (name, value, form)
{
	var formObject = document.forms[form];
	var els = formObject.elements;
	setValue(els[name],value);
}



var _formHelper = new FormHelper;












