/*
 * Classe di gestione restorecart v1.0.0
 */

function restorecart(id,section,type)
{
	this.id=id;
	this.section=section;
	this.type=type;
	
	components.addItem(this); //aggiungo il controllo alla classe di gestrione della pagina
	
	this.reload=reload;
    this.carica_storico=carica_storico;
	
	function reload(){	
		$("#" + this.id + "_Body").load("ajax.php?component=restorecart&reload=1&id=" + this.id);
	}
    
    /*
	 * Carica Storico
	 */
	function carica_storico(){
		if (confirm("Caricare gli articoli dell'ultimo ordine inviato nel carrello?\n\n ATTENZIONE!\n\n Tutti gli articoli attualmente nel carrello saranno eliminati!")) {
			//$("#" + this.id + "_Body").html("<h2><img src='components/catalogue/img/wait.gif'/>Caricamento in corso attendere....</h2>");
            $.ajax({
				cache: false,
				method: "get",
				url: "ajax.php",
				data: "component=restorecart&carica_storico=1&idp=" + main_idp,
				success: function(html){
					location.href="index.php?idp=4";
				}
			});
		}
	}

}
