function ajax(url, vars, callbackFunction){
  var xhr = null;
  try{
    // Firefox, Opera 8.0+, Safari
    xhr = new XMLHttpRequest();
  }catch (e){
    //Internet Explorer
    try{
      xhr = new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  if(xhr == null){
    alert ("Browser does not support HTTP Request");
    return;
  }
  xhr.open("POST", url, true);
  xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xhr.onreadystatechange = function(){
    if (xhr.readyState == 4 && xhr.status == 200){
      if (xhr.responseText){
          callbackFunction(xhr.responseText);
      }
    }
  };
  xhr.send(vars);
}

function removeChildNodes(ctrl) {
    while (ctrl.childNodes[0]) {
        ctrl.removeChild(ctrl.childNodes[0]);
    }
}
