function clearField(obj) {
 if (obj.defaultValue==obj.value) obj.value = '';

}
function searchNeighbor(objectID) 
{
	// fisieru' php trebuie pus la un loc cu fieru' html care solicita aceasta functie
	var inputForm;
	inputForm = document.getElementById("frmsearchNeighbor");
	//alegeDestinatieSelectata(this.options[this.selectedIndex].value+'&destinatia='+<?=$destinatie_id?>
	if (inputForm.age_range_start.options[inputForm.age_range_start.selectedIndex].value > inputForm.age_range_end.options[inputForm.age_range_end.selectedIndex].value){ alert ('Age range start must be smaller than range end'); inputForm.age_range_start.focus(); return false }
	if (inputForm.city.value!="" && inputForm.selState.options[inputForm.selState.selectedIndex].value=="Any") { alert("Please select a state also"); inputForm.selState.focus(); return false; }
	requestedData='age_range_start='+inputForm.age_range_start.options[inputForm.age_range_start.selectedIndex].value+'&age_range_end='+inputForm.age_range_end.options[inputForm.age_range_end.selectedIndex].value+'&gender='+inputForm.selGender.options[inputForm.selGender.selectedIndex].value+'&city='+inputForm.city.value+'&state='+inputForm.selState.options[inputForm.selState.selectedIndex].value+'&radius='+inputForm.selRadius.options[inputForm.selRadius.selectedIndex].value+'&username='+inputForm.username.value+'&order_by='+inputForm.order_by.options[inputForm.order_by.selectedIndex].value+'&images_only='+inputForm.images_only.checked;
//	alert(requestedData);
//	alert(objectID);
    fetchData('searchresultsneighbor.php', requestedData,objectID);
}

function filterData(pageRequest, objectID)
{
 	   var object = document.getElementById (objectID);
//	   alert(pageRequest.responseText);
		if (pageRequest.readyState == 0)
		{
			object.innerHTML += '<p>Searching… </p>';

		}
        if (pageRequest.readyState == 4 && (pageRequest.status==200 || window.location.href.indexOf ("http")==-1)) 
		{
				
				if (pageRequest.responseText != '') 
				{
					object.innerHTML = pageRequest.responseText;
				}
		}
}

