People-search.js
var http_request = false;
function searchExtended() { document.getElementById("alphaTable").style.display='none'; if(document.getElementById("extendedPeopleSearchTerm").value==) document.getElementById("alphaTable").style.display='inline';
var poststr = "peopleSearchTerm=" + encodeURI( document.getElementById('extendedPeopleSearchTerm').value ); makePOSTRequest('/people/people_search.php?extended', poststr, false );
}
function search() { var poststr = "peopleSearchTerm=" + encodeURI( document.getElementById('shortPeopleSearchTerm').value ); makePOSTRequest('/people/people_search.php', poststr, true); }
function makePOSTRequest(url, parameters, short) {
// Mozilla, Safari
if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/html'); }
// IE
} else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } }
if (!http_request) { alert('Cannot create XMLHTTP request'); return false; }
if(short)
http_request.onreadystatechange = updatePageShort
else http_request.onreadystatechange = updatePageExtended
http_request.open('POST', url, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters);
}
function updatePageShort() {
if (http_request.readyState == 4) { if (http_request.status == 200) {
var results = document.getElementById( "shortSearchResults" ); results.innerHTML = http_request.responseText;
} }
}
function updatePageExtended() {
if (http_request.readyState == 4) { if (http_request.status == 200) {
var results = document.getElementById( "extendedSearchResults" ); results.innerHTML = http_request.responseText;
} }
}