function handleDivTag(divtag){
	   var divtag;
	   return divtag;
	}
	
   function createRequestObject() {
        var req;
        if(window.XMLHttpRequest){
            req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        } else {
            alert("There was a problem creating the XMLHttpRequest object");
        }
        return req;
    }
    
    // Make the XMLHttpRequest object
    var http = createRequestObject();
	var divhandler = new handleDivTag(null);
    
    function sendRequest(more,divtag) {
		if (divtag  == "location_div") {
			document.getElementById(divtag).innerHTML = "Searching...";
			http.open("get", "location_ajax.php?"+more);
		}
        http.onreadystatechange = handleResponse;
		divhandler.divtag = divtag;
        http.send(null);
    }
    
    function sendRequest2(more,divtag) {
		if (divtag  == "location_div") {
			document.getElementById(divtag).innerHTML = "Searching...";
			http.open("get", "location_ajax2.php?"+more);
		}
        http.onreadystatechange = handleResponse;
		divhandler.divtag = divtag;
        http.send(null);
    }

    function handleResponse() {
        if(http.readyState == 4 && http.status == 200){
            var response = http.responseText;
            if(response) {
                document.getElementById(divhandler.divtag).innerHTML = response;
            }
        }
    }
	function search_state2() {
		var more = "location=state&name="+document.getElementById("state").value;
		sendRequest2(more, "location_div");
	}
	function search_state() {
		var more = "location=state&name="+document.getElementById("state").value;
		sendRequest(more, "location_div");
	}
	function search_category() {
		var more = "location=category&name="+document.getElementById("category").value;
		sendRequest(more, "location_div");
	}