pic1= new Image(100,25); pic1.src="/plugins/paf/loading.gif"; var id; /*Warning: Postcode Lookup Is Not Enabled in db *//*select id, field, org_fld, address1_fld, address2_fld, address3_fld, address4_fld, address5_fld, postcode_fld from paf_page_setup where page='' */ function getXmlHttpRequestObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support this lookup. Please upgrade."); } } var searchReq = getXmlHttpRequestObject(); function searchSuggest(lid) { id=lid; //alert('id='+id); //alert ("pp"+document.getElementById(id).previousSibling.previousSibling.id); //alert ("p"+document.getElementById(id).previousSibling.id); //alert ("ppp"+document.getElementById(id).previousSibling.previousSibling.previousSibling.id); try { search=document.getElementById(id).previousSibling.previousSibling.previousSibling.previousSibling.id; } catch(err) { search=document.getElementById(id).previousSibling.previousSibling.previousSibling.id; } if (searchReq.readyState == 4 || searchReq.readyState == 0) { var str = escape(document.getElementById(search).value); searchReq.open("GET", '/plugins/paf/ajax_getpaf.php?field='+search+'&postcode=' + str, true); searchReq.onreadystatechange = handleSearchSuggest; searchReq.send(null); } } function handleSearchSuggest() { var ss = document.getElementById(id); ss.innerHTML = ''; if (searchReq.readyState == 4) { ss.innerHTML = searchReq.responseText; } else { ss.innerHTML = ""; } } function searchAddress(lid) { id=lid; //alert('id='+id); building=document.getElementById('srch_building').value; depend=document.getElementById('srch_depend').value; though=document.getElementById('srch_though').value; locality=document.getElementById('srch_locality').value; org=document.getElementById('srch_org').value; post=document.getElementById('srch_town').value; //alert(search); if (searchReq.readyState == 4 || searchReq.readyState == 0) { var str = escape(document.getElementById(search).value); searchReq.open("GET", '/plugins/paf/ajax_getaddress.php?org='+org+ '&PostTown=' + post+ '&locality=' + locality+ '&though=' + though+ '&depend=' + depend+ '&building=' + buildingname, true); searchReq.onreadystatechange = handleSearchAddress; searchReq.send(null); } } function handleSearchAddress() { var ss = document.getElementById(id); ss.innerHTML = ''; if (searchReq.readyState == 4) { ss.innerHTML = searchReq.responseText; } else { ss.innerHTML = ""; } } function searchZip(strval) { if (searchReq.readyState == 4 || searchReq.readyState == 0) { if(strval!="") { var postcode = ""; var locality = ""; var str = strval.split("||"); if(str.length>0) { postcode = str[0]; locality = str[1]; } searchReq.open("GET", '/plugins/paf/ajax_getpaf.php?field='+search+'&postcode=' + postcode + "&locality=" + locality, true); searchReq.onreadystatechange = handleSearchZip; searchReq.send(null); } } } function handleSearchZip() { var ss = document.getElementById(id); ss.innerHTML = ''; if (searchReq.readyState == 4) { ss.innerHTML = searchReq.responseText; } else { ss.innerHTML = ""; } } function searchLocality(strval1) { if (searchReq.readyState == 4 || searchReq.readyState == 0) { if(strval1!="") { var postcode = ""; var locality = ""; var str = strval1.split("||"); if(str.length>0) { postcode = str[0]; locality = str[1]; thoroughfarekey = str[2]; thoroughfaredescriptorkey = str[3]; posttown = str[4]; nostreet = str[5]; } searchReq.open("GET", '/plugins/paf/ajax_getpaf.php?field='+search+'&postcode=' + postcode + "&locality=" + locality + "&though=" + thoroughfarekey + "&thoughdesc=" + thoroughfaredescriptorkey + "&town=" + posttown + "&nostreet=" + nostreet, true); searchReq.onreadystatechange = handleSearchLocality; searchReq.send(null); } } } function handleSearchLocality() { var ss = document.getElementById(id); ss.innerHTML = ''; if (searchReq.readyState == 4) { ss.innerHTML = searchReq.responseText; } else { ss.innerHTML = ""; } } function searchTown(strval2) { if (searchReq.readyState == 4 || searchReq.readyState == 0) { if(strval2!="") { var postcode = ""; var locality = ""; var str = strval2.split("||"); if(str.length>0) { postcode = str[0]; locality = str[1]; thoroughfarekey = str[2]; thoroughfaredescriptorkey = str[3]; posttown = str[4]; nostreet = str[5]; } searchReq.open("GET", '/plugins/paf/ajax_getpaf.php?field='+search+'&postcode=' + postcode + "&locality=" + locality + "&though=" + thoroughfarekey, true); searchReq.onreadystatechange = handleSearchTown; searchReq.send(null); } } } function handleSearchTown() { var ss = document.getElementById(id); ss.innerHTML = ''; if (searchReq.readyState == 4) { ss.innerHTML = searchReq.responseText; } else { ss.innerHTML = ""; } } function searchThough(strval3) { if(strval3!="") { var ss = document.getElementById(id); var str = strval3.split("||"); if(str.length>0) { // ss.innerHTML = '2**'; eval("copy_"+search + '(str)'); } } } function searchNostreet(strval4) { if(strval4!="") { var ss = document.getElementById(id); var str = strval4.split("||"); if(str.length>0) { //ss.innerHTML = '3**'; eval("copy_"+search + '(str)'); } } } function searchAll(strval5) { if(strval5!="") { var ss = document.getElementById(id); var str = strval5.split("||"); if(str.length>0) { //ss.innerHTML = '4**'; eval("copy_"+search + '(str)'); } } } function setSearch(value) { document.getElementById('txtSearch').value = value; document.getElementById(id).innerHTML = ''; } function isDefined(variable){ return (typeof(window[variable]) == 'undefined')? false : true; }