function directory() {
  var http;  
  try{
    http = new XMLHttpRequest();
    http.overrideMimeType('text/xml');
  } catch (e) {
    try{
     http = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
     try{
       http = new ActiveXObject("Microsoft.XMLHTTP");
     } catch (e){
       alert("It seems as if your browser does not support AJAX.");
       return false;
     }
   }
 } 
  
  if(document.getElementById("do_id").checked) {
	var action = "add";
  } else {
	var action = "remove";
  }
  var url = "directory.php";
  var paramString = "do_id=" + document.getElementById("do_id").value 
  + "&sid=" + document.getElementById("sid").value
  + "&do=" + action;
  //alert(paramString);
  http.onreadystatechange = function() {
	if(http.readyState == 4 && http.status == 200) {
	  alert(http.responseText);
	}
  }
  
  http.open("POST", url, true);
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", paramString.length);
  http.setRequestHeader("Connection", "close");  
  http.send(paramString);
}