//RICERCA IN AJAX
var xmlhttp;

function CreateXMLhttpRequest()
{
	if (window.ActiveXObject)
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest)
	{
		xmlHttp = new XMLHttpRequest();
	}
}

//MOTORE DI RICERCA
function StartRequest(ajax_url)
{
	CreateXMLhttpRequest();
	xmlHttp.onreadystatechange= handleStateChange;
	xmlHttp.open("GET",ajax_url,true); //"cerca_ajax.php?cercato="+document.getElementById('cercato').value
	xmlHttp.send(null);
	document.getElementById('gruppo_ricerca').style.display = '';	//apre il div per la ricerca
}

//MOTORE DI RICERCA
function handleStateChange()
{
	var stringa;
	stringa="";
	if (xmlHttp.readyState==4)
	{
		if (xmlHttp.status == 200)
		{
			stringa=xmlHttp.responseText;

			document.getElementById('gruppo_ricerca').style.display = '';	//apre il div per la ricerca
			
			elemento = document.getElementById('gruppo_ricerca'); //scrive nel div ricerca
			elemento.innerHTML = stringa;

			for (indice=1;indice<fine_indice;indice++) {
			document.getElementById('s_'+indice).style.display ='none'; //chiude tutti i canali
			document.getElementById('link_'+indice).className ='canale';
			}

			
		}	
	}
}
