var xmlHttp;


function getEmployees() {

  var name = document.getElementById("employee_name").value;
  var department = document.getElementById("employee_department").value;

  if ((name.length==1) && (department.length > 0)) {
    document.getElementById("employee_department").value = "";
  }
  else if (department.length > 0) {
    document.getElementById("employee_name").value = "";
  }
  
  xmlHttp=GetXmlHttpObject();
  
  var url="/ajreflector.asp";
  url=url+"?q=employees";  
  url=url+"&name="+name;
  url=url+"&department="+department;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=showEmployees;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);

}

function showEmployees() { 
  if (xmlHttp.readyState==4) { 
    document.getElementById("staff").innerHTML=xmlHttp.responseText;
  }
}





function showMarkStatus() {
	
    var whse = document.getElementById("whse_code").value;	
    var mark = document.getElementById("mark").value;

  if (mark.length < 2 || whse.length==0) { 
    document.getElementById("txtStatus").innerHTML="";
    return;
  }
  
  xmlHttp=GetXmlHttpObject();
  
  if (xmlHttp==null) {
    document.getElementById("txtHint").innerHTML="";
    return;
  } 
  
  var url="/ajreflector.asp";
  url=url+"?q=markstatus";  
  url=url+"&whse_code="+whse;
  url=url+"&mark="+mark;
  url=url+"&sid="+Math.random();
  xmlHttp.onreadystatechange=markStatus;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
} 


function markStatus() { 
  if (xmlHttp.readyState==4) { 
    document.getElementById("txtStatus").innerHTML=xmlHttp.responseText;
  }
}


function GetXmlHttpObject() {

  var xmlHttp=null;

  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e) {
    try {
      // IE 6+    	
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      // IE 5+
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlHttp;
}