	var keyPressDelay2 = null;
	
	function delay2(){
		if (keyPressDelay2){
			window.clearTimeout(keyPressDelay2);
		}
		keyPressDelay2 = window.setTimeout('doSearch2()', 800);
	}
	
	function activateSearch2() {
		if ($('searchform2')) {
			$('word2').value = ''; // Default text in the search box
			var o2 = document.createElement('div'); // Old search results div
			var n2 = document.createElement('div'); // New search results div
//			$('searchform2').onsubmit = function() { delay2();return false; };
			$('word2').onkeyup = function() { delay2();return false; };
			var s2 = $('search-results2');
			var f2 = $('searchform2');
			o2.id = 'old-search-results2';
			n2.id = 'current-search-results2';
			s2.appendChild(n2);
			s2.appendChild(o2);
			o2.style.display = 'none';
			n2.style.display = 'none';
			is_searching2 = false;
		}
	}
	
	function doSearch2() {
		// If we're already loading, don't do anything
		if (is_searching2) return false; 
		s2 = $F('word2');
		// Same if the search is blank
		if (s2 == '' || s2 == '') return false; 
		is_searching2 = true;
		c2 = $('current-search-results2');
		o2 = $('old-search-results2');
		$('boton2').value = "Searching..";
		o2.innerHTML = c2.innerHTML;
		c2.style.display = 'none';
		o2.style.display = 'block';
		// Setup the parameters and make the ajax call
		pars2 = 'word2=' + escape(s2);
		var myAjax2 = new Ajax.Request('ajax/search_business_by_city.php', 
			  {method: 'get', parameters: pars2, onComplete:doSearchResponse2});
	}
	
	function doSearchResponse2(response) {
		$('current-search-results2').innerHTML = response.responseText;
//		new Effect.BlindUp('old-search-results',{duration:.8});
//		new Effect.BlindDown('current-search-results',{duration:.8, afterFinish:resetForm});
		$('old-search-results2').style.display = 'none';
		new Effect.Appear('current-search-results2',{duration:.8, afterFinish:resetForm2});

	}
	
	function resetForm2() {
		$('boton2').value  = "Search";
		is_searching2 = false;
	}
	
	function focusS2() {
		if ($F('word2') == '') $('word2').value = '';
	}
	
	Event.observe(window, 'load', activateSearch2, false);