function newXmlHttp(){
    var xmlhttp = false;
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){
            xmlhttp = false;
        }
    }
    if(!xmlhttp && document.createElement){
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}

var xmlhttp;
function findAmphur(obj){
    xmlhttp = newXmlHttp();
    var postString = "province="+obj.value+"&action=all";
    xmlhttp.open('POST', "GetAmphurServlet", false);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.setRequestHeader("Content-length", postString.length);
    xmlhttp.setRequestHeader("Accept-Charset","TIS-620");
    xmlhttp.send(postString);

    if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
        insertAmphur();
    }
}

function insertAmphur(){
    document.getElementById("amphur").innerHTML = xmlhttp.responseText;
}