1var _sync_queue = Array();
2function plugin_freesync_sync() {
3    var call = _sync_queue.shift();
4    if(!call) return;
5    var ajax = new sack(DOKU_BASE+'lib/exe/ajax.php');
6    ajax_qsearch.sack.AjaxFailedAlert = '';
7    ajax_qsearch.sack.encodeURIString = true;
8
9    var el = document.getElementById(call[0]);
10    if(!el) return;
11    el.innerHTML = 'start';
12
13    // define callback
14    ajax.onCompletion = function(){
15        var data = this.response;
16        if(data === ''){ return; }
17	el.innerHTML = data;
18
19	window.setTimeout("plugin_freesync_sync()", 100);
20    };
21
22    ajax.runAJAX(call[1]);
23}
24
25function plugin_freesync_diff(id, profile) {
26    var ajax = new sack(DOKU_BASE+'lib/exe/ajax.php');
27    ajax_qsearch.sack.AjaxFailedAlert = '';
28    ajax_qsearch.sack.encodeURIString = true;
29
30    ajax.onCompletion = function(){
31        var data = this.response;
32        if(data === ''){ return; }
33
34	diff_window=window.open ("about:blank", "diffwindow","scrollbars=1,status=1,width=600,height=350");
35	diff_window.document.write('<html><head>'+
36				    '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'+
37				    '</head><body>'
38
39	);
40	diff_window.document.write(data);
41	diff_window.document.write('</body></html>');
42	var cssNode = diff_window.document.createElement('link');
43	cssNode.setAttribute('rel', 'stylesheet');
44	cssNode.setAttribute('type', 'text/css');
45	cssNode.setAttribute('href', DOKU_BASE+'lib/exe/css.php?t=default');
46	diff_window.document.getElementsByTagName('head')[0].appendChild(cssNode);
47
48    };
49
50    ajax.runAJAX('call=_freesync_diff&id='+id+"&profile="+profile);
51}