//my definition of an ajax handler
function  ajaxConfig ( argCommand, argContainer, argQueryString, argNextFunction, argASynch, argPassResponseToNextFunction  ) {
     //httpXML
     var obj = new Object();
     
     //There is a front of house controller and a back of house controller.  These need to be seperate because of the authentication layer.
     // I also want to keep box tracker functionality seperate from cairn apps functionality
     
     var loc = window.location.pathname;
     obj.controller = '/controller.html';  //back of house
     
     obj.container = argContainer; 
     obj.command = argCommand;
     obj.queryString = argQueryString; 
     obj.nextFunction = argNextFunction;
     obj.aSynch = argASynch; 
     obj.passResponseToNextFunction = argPassResponseToNextFunction ? true : false; 
     obj.method = "POST"; 
     //Build post values
     obj.post = "command="+obj.command;
     if (obj.queryString) {
          obj.post = obj.post + "&" + obj.queryString;     
     }

     return obj; 
     
}

//-------------------------------------
function runQuery( aHandler) {
      //build the browser agnostic XMLHTTPRequest object
	 objAjax = getXMLHTTPReqObject();
	 objAjax.onreadystatechange = function ( ) {
	      if (objAjax.readyState == 4){
                if (aHandler.container) {     //will populate a container if there isone
                     document.getElementById(aHandler.container).innerHTML = objAjax.responseText; 
                }

                if (aHandler.nextFunction) {  //will run a function if there  is one
                     aHandler.nextFunction(); 
                }
	      }
	 }

      
	 objAjax.open (aHandler.method, aHandler.controller, aHandler.aSynch);
      objAjax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      objAjax.send(aHandler.post);
 }

