function CallBackObject(url,container)
{
  this.URL=url;
  this.parserName = null;
  this.Container=container;
  this.completed = false;
  this.XmlHttp = this.GetHttpObject();
  var cntr=document.getElementById(container);
  if (cntr) cntr.innerHTML = "<table width=400 height=325 align=center valign=middle><tr><td align=center><img src=images/loading11.gif></td></tr></table>";  
}

CallBackObject.prototype.GetHttpObject = function()
{ 
  var xmlhttp;
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
      this.parserName = 'Native';
    } catch (e) {
      xmlhttp = false;
    }
  } else if (window.ActiveXObject) { // IE
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      this.parserName = 'ActiveX';
  }
  return xmlhttp;
}

CallBackObject.prototype.DoCallBack = function(){
  if( this.XmlHttp )
  {
    if( this.XmlHttp.readyState == 4 || this.XmlHttp.readyState == 0 )
    {
      var oThis = this;
      this.XmlHttp.open("GET", this.URL, true);
      this.XmlHttp.onreadystatechange = function(){ oThis.ReadyStateChange(); };
      this.XmlHttp.send(null);
    }
  }
}

CallBackObject.prototype.ReadyStateChange = function()
{
  var cnt=document.getElementById(this.Container);
  if (this.XmlHttp.readyState == 4) { // Complete
    if (this.XmlHttp.status == 200 && this.XmlHttp.statusText == "OK" ) { // OK response
		//this.processResponse(this.XmlHttp.responseText);
		  if (cnt) cnt.innerHTML = this.XmlHttp.responseText;
    } else {
		//alert("Problem with server response:\n " + this.XmlHttp.statusText);
		//this.processResponse("Problem with server response:\n " + this.XmlHttp.statusText);
		if (cnt) cnt.innerHTML = "<img src='images/home_mainPic.jpg'  align=absmiddle><br>Problem with server response:\n " + this.URL + ":" + this.XmlHttp.statusText;
    }
  }
}

CallBackObject.prototype.dispose = function ()
{
	if (this.XmlHttp != null)
	{
		this.XmlHttp.onreadystatechange = new function() {};//stop IE memory leak.  Not sure why can't set to null;
		this.XmlHttp.abort();
		this.XmlHttp = null;
		this.URL=null;
		this.completed = null;
  	    this.Container=null;
	}
}

CallBackObject.prototype.OnComplete = function()
{
  // Complete
  this.completed = true;
  this.dispose();
}

CallBackObject.prototype.processResponse = function(txt)
{
  var cnt=document.getElementById(this.Container);
  if (cnt) cnt.innerHTML = txt;  
    alert(cnt.innerText);
  this.OnComplete();
}
