// AJAX

var XMLHTTP;

function getXMLHTTP() {
	try { return new ActiveXObject("Msxml2.XMLHTTP");} catch(e) {};
	try { return new ActiveXObject("Microsoft.XMLHTTP");} catch(e) {};
	try { return new XMLHttpRequest;} catch(e) {};
	alert ("AJAX non supportato");
	return null
}

function caricaScheda(id_autore) {
	XMLHTTP = getXMLHTTP();
	if (!XMLHTTP) return;
	XMLHTTP.onreadystatechange = scheda_onExecuteResponse;
	XMLHTTP.open("GET","ajax/box_dettaglio_autore.php?id_autore="+id_autore,true);
	XMLHTTP.send(null);
}


function caricaRicerca(testo) {
	XMLHTTP = getXMLHTTP();
	if (!XMLHTTP) return;
	XMLHTTP.onreadystatechange = ricerca_onExecuteResponse;
	XMLHTTP.open("POST","ajax/ricerca.php?testo="+testo,true);
	XMLHTTP.send(null);
}

function scheda_onExecuteResponse() {
	if (XMLHTTP.readyState == 4) {
		if (XMLHTTP.status == 200) {
				//alert(XMLHTTP.responseText);
				document.getElementById('dettaglio_autori').innerHTML = XMLHTTP.responseText
		} else {
			alert (XMLHTTP.statusText)
		}
	}
}

function ricerca_onExecuteResponse() {
	if (XMLHTTP.readyState == 4) {
		if (XMLHTTP.status == 200) {
				document.getElementById('content').innerHTML = XMLHTTP.responseText
		} else {
			alert (XMLHTTP.statusText)
		}
	}
}