<!-- BEGIN site/js/ajax.tt -->
<script type="text/javascript">
// contains functions using 'ajax' var which requires interpolated var (c.query.url)
// rest of js moved to js/ajax.js

   var ajax = [];
    
   function do_ajax() {
      var args = do_ajax.arguments;
      for( var i=0; i<args[0].length;i++ ) {
        args[0][i] = fnsplit(args[0][i]);
      }
      var l = ajax.length;
      ajax[l]= new pjx(args,"do_ajax",args[2]);
      ajax[l].url = '[% c.query.url(absolute=1) %]/ajax?' + ajax[l].url;
      ajax[l].send2perl();
      jsdebug();
   }
    
   handleReturn = function() {
      for( var k=0; k<ajax.length; k++ ) {
         if (ajax[k].r==null) {
            ajax.splice(k--,1);
            continue;
         }
         if ( ajax[k].r.readyState== 4) {
            ajax[k].readyState4();
            ajax.splice(k--,1);
            continue;
         }
      }
   };
    
   function jsdebug(){
      var tmp = document.getElementById('pjxdebugrequest').innerHTML = "<br><pre>";
      for( var i=0; i < ajax.length; i++ ) {
         tmp += '<a href= '+ ajax[i].url +' target=_blank>' + decodeURI(ajax[i].url) + ' <\/a><br>';
      }
      document.getElementById('pjxdebugrequest').innerHTML = tmp + "<\/pre>";
   }
</script>
<!-- END site/js/ajax.tt -->

<script type="text/javascript" src="/js/ajax.js"></script>