
// Intercept all clicks
/*
document.addEventListener("click", contentClick, false);

function contentClick(event) {
  if (event.originalTarget.nodeName == "A") {
    
      event.preventDefault();
      
      var cURL = event.originalTarget;

      show_url( cURL, fHandler, oTarget );
  }
}




// This intercepts all form submissions and processes them through
// Ajax, with the output target specified showing the content.
$(document).ready(function() { 

    var options = { 
        target:        '#outputdiv',   // target element(s) to be updated with server response 
        beforeSubmit:  function() { document.body.style.cursor = 'wait'; },  // pre-submit callback 
        success:       function() { document.body.style.cursor = 'default'; }  // post-submit callback 

    }; 
 
    // bind to the form's submit event 
    $('form').submit(function() { 
        $(this).ajaxSubmit(options); 
        return false; 
    }); 
}); 

*/



function show_url( cURL, fHandler, oTarget ) { 

    $.ajax({

      url: cURL,
      
      cache: false,
      
      beforeSend: function() { document.body.style.cursor = 'wait'; },

      complete:  function() { document.body.style.cursor = 'default'; },

      success: function(html){
         fHandler.apply(this,[html,oTarget]);
      }
    });

}


// A couple of examples on how to output your Ajax Data

function render_output(cText, oTarget) { 
     oTarget.innerHTML = cText;  
}