/* 
	Return auto suggestions
	eSmart Technologies 2011
*/        
function hideit() {
	$('asearch_suggestions').hide();
}                          
Event.observe('inputString', 'blur', function() { 		
	setTimeout("hideit()", 500);
});	
function lookup(inputString,c,n,s) {
	if(inputString && c && inputString.length >= c) {
		new Ajax.Request("/modules/acom/rich2/rpc.php", {
			method: "post",
			parameters: {
				queryString: inputString, 
				c: c, 
				n: n, 
				s: s, 			
			},
			onSuccess: function(transport) {				
				if(transport.responseText) {								
					var data = transport.responseText;
					if(data) {
						$('asearch_suggestions').update(data);			
						$('asearch_suggestions').show();		
					}
				}
			},
			onFailure: function(){ 
				alert('Something went wrong...');
			}
		});				
	} else {	
		$('asearch_suggestions').hide(); // Hide the suggestions box	
	}
} 
