function CallBackObject()
{
  this.XmlHttp = this.GetHttpObject();
}

CallBackObject.prototype.LoadingText = function(loadingText)
{ 
	this.LoadingText = loadingText;
}

CallBackObject.prototype.TargetElement = function(elementId)
{ 
	this.TargetElement = elementId;
}

CallBackObject.prototype.TargetPage = function(pageName)
{ 
	this.TargetPage = pageName;
}

CallBackObject.prototype.ErrorMessage = function(message)
{ 
	this.ErrorMessage = message;
}

 
CallBackObject.prototype.GetHttpObject = function()
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
 
CallBackObject.prototype.AbortCallBack = function()
{
  if( this.XmlHttp )
    this.XmlHttp.abort();
}
 
CallBackObject.prototype.OnLoading = function()
{
  // Loading
}
 
CallBackObject.prototype.OnLoaded = function()
{
  // Loaded
}
 
CallBackObject.prototype.OnInteractive = function()
{
  // Interactive
}
 
CallBackObject.prototype.OnComplete = function(responseText, responseXml)
{
  // Complete
}
 
CallBackObject.prototype.OnAbort = function()
{
  // Abort
}
 
CallBackObject.prototype.OnError = function(status, statusText)
{
  // Error
}

CallBackObject.prototype.DoCallBack = function(sku, lang)
{
  // CallBack
}
 
CallBackObject.prototype.ReadyStateChange = function()
{
  document.getElementById(this.TargetElement).innerHTML = this.LoadingText

  if( this.XmlHttp.readyState == 1 )
  {
    this.OnLoading();
  }
  else if( this.XmlHttp.readyState == 2 )
  {
    this.OnLoaded();
  }
  else if( this.XmlHttp.readyState == 3 )
  {
    this.OnInteractive();
  }
  else if( this.XmlHttp.readyState == 4 )
  {
    if( this.XmlHttp.status == 0 )
      this.OnAbort();
    //opera does appear to return a statusText, just going to check status.  
    //else if( this.XmlHttp.status == 200 && this.XmlHttp.statusText == "OK" )
    else if( this.XmlHttp.status == 200 )
      this.OnComplete(this.XmlHttp.responseText, this.XmlHttp.responseXML);
    else
      this.OnError(this.XmlHttp.status, this.XmlHttp.statusText, this.XmlHttp.responseText);   
  }
}
