// global variables to keep track of the request
// and the function to call when done
var ajaxreq=false, ajaxCallback;
// ajaxRequest: Sets up a request
function ajaxRequest(filename,mod,param) {
var mode=(mod==null)?"GET":"POST";
   try {
    // Firefox / IE7 / Others
    ajaxreq= new XMLHttpRequest();
   } catch (error) {
    try {
      // IE 5 / IE 6
      ajaxreq = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (error) {
      return false;
    }
   }
   if( (filename.indexOf('xmltipus=23'))>0 ){
   ajaxreq.open(mode,filename,false);
   }else{
    ajaxreq.open(mode,filename,true);
   }
   ajaxreq.onreadystatechange = ajaxResponse;
   if(mode=="POST"){
      ajaxreq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
      ajaxreq.send(param);
   } else {
      ajaxreq.send(null);
   }
}
// ajaxResponse: Waits for response and calls a function
function ajaxResponse() {

   if (ajaxreq.readyState !=4) return;
   if (ajaxreq.status==200) {
      // if the request succeeded...
      if (ajaxCallback) ajaxCallback(ajaxreq.responseXML);
   } else alert("Request failed: " + ajaxreq.statusText);
   return true;
}


