// update the property list once it has been retrieved
function postcode_Change(responseText, status) {
	if (status == 200) {
		document.getElementById('postcode_footprint').innerHTML = responseText;
	} else {
		document.getElementById('postcode_footprint').innerHTML = "A problem has occurred.";
	}
}


// request list of properties with given postcode
function postcodeFootprint() {
	if (document.getElementById("post_code_lookup").value != '') {
		document.getElementById('postcode_footprint').innerHTML="Loading...";
		document.getElementById('postcode_footprint').style.display = 'inline';
		var data = "action=post_code_footprint&pc=" + document.getElementById("post_code_lookup").value;
		getAjax().query("ajax_query.php", postcode_Change, data, "GET");
	}
}


// check for enter being pressed on the post code field, prevent it from submitting the form and run the lookup instead
function checkEnter(e) {
	if(e && e.which) {
		e = e;
		characterCode = e.which;
	} else {
		e = event;
		characterCode = e.keyCode;
	}	 
	if(characterCode == 13) {
		postcodeFootprint();
		return false;
	} else {
		return true;
	} 
}
