function switchsearchtab(x) {
	$('tab_search_name').className="";
	$('tab_search_location').className="";
	$('tab_search_'+x).className="on";
	$('sch_loc').value = '';
	$('ajax_s').value = '';
	$('sch_loc').focus();
	searchtype = x;
    switch(x) {
		case 'location':
			$('agentsby').value='p';
			$('searchfor').innerHTML=$('searchfortext').value;
			if($('searchfor_eg'))$('searchfor_eg').innerHTML='e.g. "Bromley", or "BR1".';
			break;
		case 'name':
			$('agentsby').value='a';
			$('searchfor').innerHTML='Agent name:';
			if($('searchfor_eg'))$('searchfor_eg').innerHTML='e.g. "Foxtons".';
    }

}

function validateSearchBox()	{
	if($('ajax_s').value.length < 1)	{
		if($('sch_loc').value.length < 1)
			alert('Please enter name of place/agent')
		else			
			{
			alert('Please select a result from the list of matching places/agents');
			if($('result_auto_complete').style.display=='none'){ $('result_auto_complete').style.display = ''};
			}
		
		return false
	}
	return true
}
Event.observe("tab_search_location", "click", function(event){switchsearchtab('location')});
Event.observe("tab_search_name", "click", function(event){switchsearchtab('name')});
