<!--

var autore;
var titolo;


function digita(autoreform,titoloform) {
    //Firefox da errore su sta riga qui!
	//autore=cerca.autore.value;
	//titolo=cerca.titolo.value;
	
	autore=autoreform;
	titolo=titoloform;
	
	//autore="verga";
	//titolo="il ";
	
	if (autore.length>=3 || titolo.length>=3)
	 //alert(autore);
	 caricamento();
}


function caricamento() {
	document.getElementById("caricamento").innerHTML = '<img width=15 src="immagini/attesa.gif" vspace="5" alt="caricamento..." align="middle"/> cogito...';
	sndReq();
}

function caricamento_vetrina() {
    document.getElementById("caricamento_vetrina").innerHTML = '<table width="100%"><tr><td><p align="left" ><img width=15 src="immagini/attesa.gif" vspace="5" alt="caricamento..." align="middle"/> cogito...</p></td></tr></table>';
	sndReq_vetrina();
}

function caricamento_top() {
	document.getElementById("caricamento_top").innerHTML = '<table width="100%"><tr><td><p align="left" ><img width=15 src="immagini/attesa.gif" vspace="5" alt="caricamento..." align="middle"/> cogito...</p></td></tr></table>';
	sndReq_top();
}

function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();
var http_vetrina = createRequestObject();
var http_top = createRequestObject();

function sndReq() {
	//alert(autore);
	http.open('get', 'ajaxserver_cerca.php?autore='+autore+'&titolo='+titolo+'&rand=' + escape(Math.random()));
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function handleResponse() {
	if(http.readyState == 4){
		var response = http.responseText;
		//alert(response);
		document.getElementById("caricamento").innerHTML = response;
	}
}

function sndReq_vetrina() {
	//alert(autore);
	//alert("vetrina");
	http_vetrina.open('get', 'http://www.nopress.it/libribooks/ajaxserver_vetrina.php?rand=' + escape(Math.random()));
	http_vetrina.onreadystatechange = handleResponse_vetrina;
	http_vetrina.send(null);
}

function handleResponse_vetrina() {
	if(http_vetrina.readyState == 4){
		var response = http_vetrina.responseText;
		//alert(response);
		document.getElementById("caricamento_vetrina").innerHTML = response;
	}
}

function sndReq_top() {
	//alert("qui");
	http_top.open('get', 'http://www.nopress.it/libribooks/ajaxserver_top.php?rand=' + escape(Math.random()));
	http_top.onreadystatechange = handleResponse_top;
	http_top.send(null);
}

function handleResponse_top() {
	if(http_top.readyState == 4){
		var response = http_top.responseText;
		//alert(response);
		document.getElementById("caricamento_top").innerHTML = response;
	}
}


//-->