+// Update the preview field synchronously.
+function synch_update (content_id, preview_id)
+{
+ var preview = document.getElementById (preview_id);
+
+ // Get the Wiki-markup content from the content textarea.
+ var content = document.getElementById (content_id).value;
+
+ // Send the Wiki-markup to the server to be turned into XHTML.
+ var http = document.all ?
+ new ActiveXObject ('Microsoft.XMLHTTP') : new XMLHttpRequest ();
+ if (http)
+ {
+ http.open ('POST', '/_bin/preview.cmo', false);
+ http.setRequestHeader ('Content-Type',
+ 'application/x-www-form-urlencoded');
+ http.send ('content=' + encodeURIComponent (content));
+
+ if (http.readyState == 4 && http.status == 200) {
+ var xhtml = http.responseText;
+ preview.innerHTML = xhtml;
+ }
+ }