if(typeof(XMLHttpRequest)!='undefined'){
  var getXMLHttpObj = function(){ return new XMLHttpRequest(); }
} else {
  var getXMLHttpObj = function(){
    var activeXObjects = ['Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0',
    'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'];
    for(var i=0; i<activeXObjects.length; i++){
      try{
        return new ActiveXObject(activeXObjects[i]);
      }catch(err){}
    }
  }
}

var testobj = getXMLHttpObj();
if(typeof(testobj)=='undefined')
{
	window.location = sitepath + '/index.php?category=changeglobal&set=ajax&value=0';
}

var returnarray = Array();

function sendtoAJAX(data,sendtype,sendmethod,ls,addget)
{
  var oXml = getXMLHttpObj();
  if(sendmethod == 'POST')
  {
    oXml.open(sendmethod, ls + '/getAJAXdata.php?type=' + sendtype, true);
    oXml.setRequestHeader("Content-Type", "text/xml");
  }
  else
  {
    oXml.open(sendmethod, ls+ '/getAJAXdata.php?type=' + sendtype + addget, true);
  }
  oXml.onreadystatechange = function() {  processingFunction(oXml,sendtype);  };
  oXml.send(data);
  return;
}

function processingFunction(oXml,type)
{
  if(typeof(returnarray[type][oXml.readyState])!='undefined')
    if(oXml.readyState==4)
      returnarray[type][oXml.readyState](oXml.responseText);
    else
      returnarray[type][oXml.readyState]();
  return;
}
