- JsHttpRequest.request= function(submit) {
- JsHttpRequest.query(
- 'POST '+window.location.toString(), // backend
+// Main functions for asynchronus form submitions
+// Trigger is the source of request and can have following forms:
+// - input object - all form values are also submited
+// - arbitrary string - POST var trigger with value 1 is added to request;
+// if form parameter exists also form values are submited, otherwise
+// request is directed to current location
+//
+ JsHttpRequest.request= function(trigger, form) {
+ var mark = document.getElementById('ajaxmark');
+ if(mark) mark.style.visibility = 'visible';
+ if (trigger.tagName=='A') {
+ var content = {};
+ var upload = 0;
+ var url = trigger.href;
+ if (trigger.id) content[trigger.id] = 1;
+ } else {
+ var submitObj = typeof(trigger) == "string" ?
+ document.getElementsByName(trigger)[0] : trigger;
+
+ form = form || (submitObj && submitObj.form);
+
+ var upload = form && form.enctype=='multipart/form-data';
+
+ var url = form ? form.action :
+ window.location.toString();