function ajaxFunction(type, arg1, offset, cid){

	var ajaxRequest = null;  // The variable that makes Ajax possible!

   try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   } catch (e) {

   try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("This feature was disabled by your browser.");
				return false;
			}
		}
	}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState==4 || ajaxRequest.readyState=="complete"){
//          if (type == 'search')
	      var ajaxDisplay = document.getElementById('fuzzysearch');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
	        ajaxDisplay.className="visible";			
            if (ajaxRequest.responseText.length > 500)
			{
			  ajaxDisplay.style.height = '300px';
			  ajaxDisplay.style.width = '200px';			  
			  ajaxDisplay.style.overflow = 'auto';			  
			} else
			{
			  ajaxDisplay.style.height = '';
			  ajaxDisplay.style.background = '#FFFFFF';			  
			  ajaxDisplay.style.overflow = "visible";				  
			}			
      }
	}

    if (type == 'search'){
	  var rowsPerPage = 10;
      var queryString = "?searchText=" + document.getElementById('sSearch').value; 
//	  alert(queryString);
	  if (document.getElementById('sSearch').value.length >= 3)
	  {
        ajaxRequest.open("GET", "./includes/ajaxFunctions.php" + queryString, true);
	  ajaxRequest.send(null);	
	  }
 	}		
}

function closeSearch() {
	document.getElementById('fuzzysearch').className="hidden";
}
