function CCbUpdateSelect(Url, bAsync)
{
  this.Url = Url;
  this.responseText = "";
  this.bReady = false;
  this.bAsync = bAsync;

  if (window.XMLHttpRequest)  {
    this.CallBackObj = new XMLHttpRequest();
    this.bReady = true;
  } else {
    if (window.ActiveXObject) {
      try {
        this.CallBackObj = new ActiveXObject("Msxml2.XMLHTTP");
        this.bReady = true;
      }
      catch (e) {
        try {
          this.CallBackObj = new ActiveXObject("Microsoft.XMLHTTP");
          this.bReady = true;
        }
        catch (e) {
          return;
        }
      }
    }
  }
}

CCbUpdateSelect.prototype.StateChanged = function(oSelect)
{
  if (this.CallBackObj.readyState != 4 || this.CallBackObj.status != 200) {
    return;
  }

  // alert(this.CallBackObj.responseText);
	var XmlDoc = this.CallBackObj.responseXML;
	var Root = XmlDoc.getElementsByTagName("com.ivengi.ccbupdateselect").item(0);

	oSelect.options.length = 0;
	var OptionCount = 0;
  var bIndex = false;
  var Index = "";

  for (var iRoot = 0; iRoot < Root.childNodes.length; iRoot++) {
    var Node = Root.childNodes[iRoot];
    if (Node.nodeName != "#text") {
      var Key = "";
      var Value = "";
      for (var iNode = 0; iNode < Node.childNodes.length; iNode++) {
        var NodeElement = Node.childNodes[iNode];
        if (NodeElement.nodeName != "#text") {
          if (NodeElement.nodeName == "key") {
            Key = NodeElement.childNodes[0].nodeValue;
          }
          if (NodeElement.nodeName == "value") {
            Value = NodeElement.childNodes[0].nodeValue;
          }
        }
      }

      if (Key != "Index") {
        oSelect.options[OptionCount] = new Option(unescape(Value.replace(/\+/g," ")), unescape(Key.replace(/\+/g," ")));
        OptionCount++;
      } else {
        bIndex = true;
        Index = Value;
      }
    }
  }

  if (OptionCount == 0) {
    oSelect.options[OptionCount] = new Option("---", "");
  }

  if (bIndex) {
    for ( var iIndex = 0; iIndex < oSelect.options.length; iIndex++) {
      if (oSelect.options[iIndex].value == Index) {
        oSelect.selectedIndex = iIndex;
      }
    }
  }
}

CCbUpdateSelect.prototype.Get = function(oSelect, UrlSuffix)
{
  this.CallBackObj.open('GET', this.Url + UrlSuffix, this.bAsync);

	if (this.bAsync) {
  	var _this = this; // set the var so we can scope the callback
  	this.CallBackObj.onreadystatechange = function() {_this.StateChanged(oSelect)};
  }
	this.CallBackObj.send(null);

	if (!this.bAsync) {
	  this.StateChanged(oSelect);
	}
}