/* 
    In order to use ajaxLoader, you need to do 2 things:
    
    1. Define a state change handler that accepts an XMLHttpRequest object as
    its first parameter -- this is the callback in which you actually get to do
    stuff with the server response, e.g.:

        function handleStateChange(req) {
          if (req.readyState == 4 && req.status == 200) {
            el = document.getElementById("output");
            el.innerHTML = req.responseText;
          }
        }

    2. Call ajaxLoader as the onload handler of your document's body tag,
    passing in handleStateChange as the second param, e.g.: 

    <html>
        <head>
            <title="Simple Ajax Example"/>
            <!-- ... define/load ajaxLoader and handleStateChange ... -->
        </head>
        <body onload="ajaxLoader('something.epl', handleStateChange)">
            Text retrieved from server will go here:
            <div id="output"></div>
        </body>
    </html>
*/

function ajaxLoader(url, stateChangeHandler, arg1, arg2, arg3, arg4, arg5) {
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
        stateChangeHandler(x, arg1, arg2, arg3, arg4, arg5);
    };
    x.open("GET", url, true);
    x.send(null);
  }
}


