function ricarica(pagina) {

	document.prodotti.pagina.value=pagina
	document.prodotti.submit()
}

function apri(section) 
{
	/*location.href="#top"*/
	if (controllo(section)) 
	{
		chiuditabella(section);
	}	
	else
	{
		apritabella(section);	
	}
}

function apritabella(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return;
	tbody.style.display = "";

}

function chiuditabella(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return;
	tbody.style.display = "none";
}

function controllo(section)
{
	var tbody = document.getElementById(section);
	if (tbody == null) return 0;
	return (tbody.style.display == "");
}


/* parte dedicata al codice AJAX PER UN CARICAMENTO NORMALE*/

function Richiesta(pagina,responsediv){

 
	 url  = pagina +"&rand="+escape(Math.random())
	 var xmlHttpReq = false;
    var self = this;
    // Xhr per Mozilla/Safari/Ie7
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // per tutte le altre versioni di IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
			// Quando pronta, visualizzo la risposta del form
            updatepage1(self.xmlHttpReq.responseText,responsediv);
        }
		else{
			// In attesa della risposta del form visualizzo il msg di attesa
			updatepage1('<img src="images/preload4.gif">',responsediv);

		}
    }
     self.xmlHttpReq.open('GET', url, true);
    self.xmlHttpReq.send(null);
}


function updatepage1(str,responsediv){
    document.getElementById(responsediv).innerHTML = str;
}
/* FINE parte dedicata al codice AJAX PER UN CARICAMENTO NORMALE*/




