add: if (debug) XRai.debug("Save: connecting to server"); 
context: XRai.save = function() {   if (!XRai.hasChanged()) {      Message.show("notice","Nothing to save");      return;   }   if (XRai.noSave) {      Message.show("error","Assessments cannot be saved (a *major* error occured before)\n",-1);      return;   }   if (!XRai.loaded) {      Message.show("error","Assessments cannot be saved (document not completly loaded)\n",-1);      return;   }   if (XRai.saveForm != null) {      Message.show("warning","Another save of assessments is being processed");      return;   }   var saving_div = document.getElementById("saving_div");   var saving_message = document.getElementById("saving_message");   var saving_iframe = document.getElementById("assessing");   if (!saving_iframe) {      alert("Hmmm. Bug! Can't retrieve the iframe 'assessing' for assessing");      return;   }   var bdy = saving_iframe.contentDocument.getElementsByTagName("body");   if (!bdy || !bdy[0]) {      Message.show("error","Assessments cannot be saved (cannot find the assessment frame)\n",-1);      return;   }      // Prepare the frame   setSavingMessage("Preparing assessments");   saving_div.style.visibility = "visible";  // Static information   XRai.saveForm = document.createElement("form");   XRai.saveForm.style.display = "none";//    XRai.saveForm.setAttribute("target","xrai-assessing");   XRai.saveForm.setAttribute("action",base_url + "/assess.php");   XRai.saveForm.setAttribute("method","post");   XRai.saveForm.appendChild(createHiddenInput("id_pool",id_pool));   XRai.saveForm.appendChild(createHiddenInput("collection",xrai_collection));   XRai.saveForm.appendChild(createHiddenInput("file",xrai_file));   XRai.saveForm.appendChild(createHiddenInput("aversion",aversion));   XRai.saveForm.appendChild(createHiddenInput("docstatus",docStatus));   // Add history   XRai.addHistory("SAVE");   for(var i = 0; i < XRai.history.length; i++) {      var x = XRai.history[i];      XRai.saveForm.appendChild(createHiddenInput("hist[]",x[0]+","+x[1]+","+ (x[2] ? XRai.getPath(x[2]) : "") + "," + (x[3] ? XRai.getPath(x[3]) : "")));   }   // Add assessments   XRai.toSave = new Array();   var xraij = document.getElementsByTagNameNS(xrains,xraiatag);   for(var n = 0; n < xraij.length; n++) {      var res = xraij[n];      res.value = XRai.getAValue(res);      if ((typeof res.saved != "undefined") && (res.saved == res.value)) {         if (debug) XRai.debug("Skipping " + res + "\n");      } else {         XRai.toSave.push(res);         var s = (typeof res.saved != "undefined" ? 1 : 0) + "," + XRai.getAValue(res) + ",";         if (res.passage) s += XRai.getPath(res.passage.start) + "," + XRai.getPath(res.passage.end);         else s += XRai.getPath(res.parentNode) + ",";         if (debug) XRai.debug("Adding " + s + " (" + res.saved + "/" + res.value + ")\n");         XRai.saveForm.appendChild(createHiddenInput("a[]",s));      }      }  // Add passages  for(var p = XRai.firstPassage; p; p = p.next) {      if (p.saved != Passage.VALIDATED) {         var s = (typeof p.saved != "undefined" ? 1 : 0) + ","                  + (p.validated ?  Passage.VALIDATED : Passage.UNVALIDATED) + ",";         s += XRai.getPath(p.start) + "," + XRai.getPath(p.end);         if (debug) XRai.debug("Adding " + s + " (" + p.getPaths() + ")\n");         XRai.saveForm.appendChild(createHiddenInput("a[]",s));      }   }      // Add BEP   XRai.saveForm.appendChild(createHiddenInput("BEP",XRai.getPath(XRai.BEPElement.parentNode)));   for(var p = XRai.firstOldPassage; p; p = p.next) {      if (p.saved != Passage.OLDVALIDATED) {         var s = (typeof p.saved != "undefined" ? 1 : 0) + "," + Passage.OLDVALIDATED + ",";         s += XRai.getPath(p.start) + "," + XRai.getPath(p.end);         if (debug) XRai.debug("Adding " + s + " (" + p.getPaths() + ")\n");         XRai.saveForm.appendChild(createHiddenInput("a[]",s));      }   }  // Add to remove   for(var i = 0; i < XRai.assessmentsToRemove.length; i++) {      var s = "";      res = XRai.assessmentsToRemove[i];      if (res.isPassage) s += XRai.getPath(res.start) + "," + XRai.getPath(res.end);      else s += XRai.getPath(res.parent) + ",";      XRai.saveForm.appendChild(createHiddenInput("r[]",s));   }  // Submit   bdy[0].appendChild(XRai.saveForm);   setSavingMessage("Connecting to server...");   XRai.saveForm.submit();}
meta: 8632	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8632/1def994488dc13efee426faa5e7003e65c3aee91/article.js/clean/trunk/js/article.js