﻿function xmlRequest(url, remoteGetContent, sync, method, params) 
{
	this.url = url;
	this.sync = true;
	if(typeof sync!= "undefined")
	{
		this.sync = sync;
    }
	this.method = "GET";
	if(typeof method!= "undefined")
	{
		this.method = method;
	}
	this.params = null;
	if(typeof params!= "undefined")
	{
		this.params = params;
	}
	this.page_currentxmlhttpobject = this.jb();
	this.setContent(remoteGetContent);
}
xmlRequest.isIE = true;

function jb()
{
  var A=null;
  try
  {
    A=new ActiveXObject("Msxml2.XMLHTTP");
	isIE = true;
  }
  catch(e) 
  {
    try
    {
      A=new ActiveXObject("Microsoft.XMLHTTP");
	  isIE = true;
    }
    catch(oc)
    {
      A=null;
    }
  }
  if ( !A && typeof XMLHttpRequest != "undefined" )
  {
    A=new XMLHttpRequest();
	isIE = false;
  }
  return A;
}
xmlRequest.prototype.jb = jb;

function setContent(remoteGetContent) 
{
  if(isIE)
  {
        var callurl = this.url;
        if(callurl.indexOf('?') > 0)
        {
          callurl += "&";
        }
        else
        {
          callurl += "?";
        }
        callurl += "xtcn_forgetme=" + Math.random();
        this.page_currentxmlhttpobject.open(this.method,callurl,this.sync);
  }
  else
  {
        this.page_currentxmlhttpobject.open(this.method,this.url,this.sync);
  }
  
  this.page_currentxmlhttpobject.onreadystatechange = remoteGetContent;
  if(this.method=="POST")
  	this.page_currentxmlhttpobject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  this.page_currentxmlhttpobject.send(this.params);
}
xmlRequest.prototype.setContent = setContent; 


