
/** Makes the asynchronous call to get the current weather. */
function searchLocal() {
    createXMLHttpRequest();
    if (xmlHttp != null) {
        xmlHttp.onreadystatechange = handleSearchLocalCallStateChange;
        var search_str = document.getElementById("search_str").value;        
        xmlHttp.open("GET", ("/search_local.php?search_str=" + search_str), true);
        if (window.ActiveXObject) {
            xmlHttp.send();
        } else {
            xmlHttp.send(null);
        }
    }	
}

/** 
 * Call back function called when state changes for searchLocal call.
 * If state is 200, then update the search_local element with response text.
 */
function handleSearchLocalCallStateChange() {
    var local_results = document.getElementById("local_results");
    if (xmlHttp.readyState == 4) {
        if (xmlHttp.status == 200) {
            var text = xmlHttp.responseText;
            var local_results = document.getElementById("local_results");
            if ((local_results != null) && (text != null)) {
                local_results.innerHTML = text;
            }
        }
    }
}


