/*


// 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 load_modal_dialog( cURL, oTarget ) { 

    $("#" + oTarget).dialog({ 
        autoOpen: false,
        modal: true,
        height: 350,
        width: 450,
        overlay: { 
            opacity: 0.5, 
            background: "black" 
        } 
    });

    $("#" + oTarget).dialog("open");

    $.ajax({

      url: cURL,
      
      cache: false,

      success: function(html){
         document.getElementById(oTarget).innerHTML = html;
      }
    });

}


function show_url( cURL, fHandler, oTarget ) { 

    oTarget = document.getElementById(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;  
}


