// JavaScript Document

//ACQUISTA PRODOTTO
function acquista(prodotto){
	var quantita = 1;
	ordinecampione = 0;
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=carrello&prodotto='+prodotto+'&quantita='+quantita,acquistaDataHTML);
}
function acquistaDataHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	
	vResult = converti_in_array(obj);
	var vScroll = getPageScroll();
	/*initOverlayCart('cart_window');
	if(navigator.userAgent.indexOf("MSIE")!=-1){
	showOverlayCart('cart_window',coordsXY[1]-80+vScroll[1],coordsXY[0]-160,200);
	}else{
	showOverlayCart('cart_window',coordsXY[1]-80,coordsXY[0]-160,200);
	}*/
	//initOverlayTrasparentShadow('cart_window');
	showOverlayShadow('trasparentdiv');
	/*document.getElementById('overlayshadow').onclick = function(){
		hideOverPage('cart_window');
	}
	ShowMessageCart(vResult[1],vResult[2],vResult[3]);*/
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	//personalizzazione1(vResult[4]);
	document.getElementById('num_prodotti_carrello').innerHTML=vResult[2];
	Carrello();
}

function setcarrello(prodotto,quantita){
	var quantita = (quantita)?quantita:1;
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=carrello&prodotto='+prodotto+'&quantita='+quantita,carrelloDataHTML);
}
function carrelloDataHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	
	vResult = converti_in_array(obj);
	var vScroll = getPageScroll();
	/*initOverlayCart('cart_window');
	if(navigator.userAgent.indexOf("MSIE")!=-1){
	showOverlayCart('cart_window',coordsXY[1]-80+vScroll[1],coordsXY[0]-160,200);
	}else{
	showOverlayCart('cart_window',coordsXY[1]-80,coordsXY[0]-160,200);
	}*/
	//initOverlayTrasparentShadow('cart_window');
	showOverlayShadow('trasparentdiv');
	/*document.getElementById('overlayshadow').onclick = function(){
		hideOverPage('cart_window');
	}
	ShowMessageCart(vResult[1],vResult[2],vResult[3]);*/
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	
//	personalizzazione1(vResult[4]);

	Carrello();

	document.getElementById('num_prodotti_carrello').innerHTML=vResult[2];
}
function ShowMessage(message){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=messaggio&message='+message,ShowMessageHTML);
}
function ShowMessageHTML(){
	document.getElementById('content_cart_window').innerHTML=this.req.responseText;
}

function ShowMessageCart(message,totprod,toteuro){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=riepilogocarrello&message='+message+'&totprod='+totprod+'&toteuro='+toteuro,ShowMessageCartHTML);
}
function ShowMessageCartHTML(){
	document.getElementById('content_cart_window').innerHTML=this.req.responseText;
}
//VISUALIZZA ELENCO PRODOTTI NEL CARRELLO
function elencoProdottiCart(){
	if(!prodotticartwindow){
		var vScroll = getPageScroll();
		initOverlayCart('prodotticart_window');
		if(navigator.userAgent.indexOf("MSIE")!=-1){
		showOverlayCart('prodotticart_window',coordsXY[1]+10+vScroll[1],coordsXY[0]-150);
		}else{
		showOverlayCart('prodotticart_window',coordsXY[1]+10,coordsXY[0]-150);
		}
		document.getElementById('prodotticart_window').style.display='none';
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=elencoprodotticarrello',elencoProdottiCartHTML);
		prodotticartwindow=true;
	}
}
function elencoProdottiCartHTML(){
	try{
	document.getElementById('content_prodotticart_window').innerHTML=this.req.responseText;
	}catch(e){}
}
//VISUALIZZA CARRELLO
function Carrello(overlay){
	if(!overlay){
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	}
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=carrello',CarrelloHTML);
}

function CarrelloHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	try{
		stopLoading()
	}catch(e){}
	centerOverlay();
}
//CONTROLLO CARRELLO
function ControlloCarrello(){
	try{
	document.getElementById('action_row').src='images/loading.gif';
	}catch(e){}

	AyaxRequest('ajax_request.php', 'POST', 'filetocall=controllocarrello',ControlloCarrelloHTML);
}
function ControlloCarrelloHTML(){
	//alert(this.req.responseText);
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==1){
		ControlloCaricatura();
		//ControlloPartecipazione();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}

}
//CONTROLLO PARTECIPAZIONE
function ControlloPartecipazione(){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=controllopartecipazione',ControlloPartecipazioneHTML);
}
function ControlloPartecipazioneHTML(){
	//alert(this.req.responseText);
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==1){
		//AnteprimaOrdine();
		ControlloCaricatura();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}

function setpartecipazione(codice,scegli){
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	var strscegli = '';
	if(scegli)
		strscegli = '&scegli=1';
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=partecipazione&codice='+codice+strscegli,setpartecipazioneHTML);
}
function setpartecipazioneHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	try{
		stopLoading()
	}catch(e){}
	centerOverlay();
}
function PartecipazioneDetail(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=dettagliopartecipazione&id='+id,PartecipazioneDetailHTML);
}
function PartecipazioneDetailHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	centerOverlay();
}
function ModificaPartecipazione(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=partecipazione&id='+id,setpartecipazioneHTML);
}
function addpartecipazione(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=dettagliopartecipazione&add='+id,addpartecipazione_resutl);	
}
function addpartecipazione_resutl(){
	//alert(this.req.responseText);
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult.result==1){
		Carrello(false);
	}
}

function ScegliPartecipazone(){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=sceglipartecipazione&ricerca'+ricercapartecipazioni+'&pagina='+paginapartecipazioni,ScegliPartecipazoneHTML);	
}
function ScegliPartecipazoneHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	centerOverlay();
}
function ChangePagePartecipazioni(pagina){
	var ricercapartecipazioni = pagina;
	ScegliPartecipazone();
}
//--------------------

//CONTROLLO CARICATURA
function ControlloCaricatura(){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=controllocaricatura',ControlloCaricaturaHTML);
}
function ControlloCaricaturaHTML(){
	//alert(this.req.responseText);
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==1){
		AnteprimaOrdine();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}
function Caricatura(idordine){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=caricatura&ordine='+idordine,CaricaturaHTML);
}
function CaricaturaHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	centerOverlay();
}
function ModificaCaricatura(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=caricatura&id='+id,CaricaturaHTML);
}

function CaricaturaDetail(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=dettagliocaricatura&id='+id,CaricaturaDetailHTML);
}
function CaricaturaDetailHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	centerOverlay();
}

function sendCaricatura(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=dettagliocaricatura&send='+id,CaricaturaDetailHTML);
}

//ANTEPRIMA ORDINE
function AnteprimaOrdine(){
	try{
	document.getElementById('action_row').src='images/loading.gif';
	}catch(e){}
	
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=anteprimaordine&caricatura='+caricatura_ordine+'&ordinecampione='+ordinecampione,AnteprimaOrdineHTML);
}
function AnteprimaOrdineHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==0){
		Profilo(true);	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}
//TOTALE RIEPILOGO ORDINE
function totaleriepilogoordine(){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=totaleriepilogoordine&delivery='+deliverytype+'&paytype='+paytype,totaleriepilogoordineHTML);
}
function totaleriepilogoordineHTML(){
	document.getElementById('totaleriepilogoordine').innerHTML=this.req.responseText;
}
//RIEPILOGO ORDINE
function RiepilogoOrdine(){
	try{
	document.getElementById('action_row').src='images/loading.gif';
	}catch(e){}
	
	if(ordinecampione == 1 && totbombonierecampione == 0){
				try{
					document.getElementById('action_row').src='include/css/images/arrow.gif';
				}catch(e){}
				
			alert("Specificare il numero di bomboniere di cui avresti bisogno!");
			return false;
	}
	
	if(paytype!=0/* && deliverytype!=0*/){
		if(document.getElementById('estero').value==1){
			alert("ATTENZIONE!\nCome indicato l'indirizzo di spedizione risiede fuori dal territorio nazionale.\r\nIndicare nelle note relative all'ordine l'indirizzo completo di spedizione.");	
		}
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=riepilogoordine&paytype='+paytype+'&deliverytype='+deliverytype+'&ordinecampione='+ordinecampione+'&totbombonierecampione='+totbombonierecampione,RiepilogoOrdineHTML);
	}else{
		/*if(paytype==0 && deliverytype==0){
			alert("Specificare la modalita\' di pagamento e di spedizione!");
			return false;
		}
		if(deliverytype==0){
			alert("Specificare la modalita\' di spedizione!");
			return false;
		}*/
		try{
			document.getElementById('action_row').src='include/css/images/arrow.gif';
		}catch(e){}
		if(paytype==0){
			alert("Specificare la modalita\' di pagamento!");
			return false;
		}
	}
}
function RiepilogoOrdineHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==0){
		Profilo();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}
//ORDINE CONCLUSO
function ConcludiOrdine(idordine){
	try{
	document.getElementById('action_row').src='images/loading.gif';
	}catch(e){}
		initOverlay('overlay_center');
		showOverlay('overlay_center');
		showOverlayShadow('trasparentdiv');
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=concludiordine&idordine='+idordine,ConcludiOrdineHTML);
}
function ConcludiOrdineHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==0){
		Profilo();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}
//LOGIN
function Profilo(ordine){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	qs=(ordine)?"&ordine=true":"";
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=login'+qs,ProfiloHTML);
}
function ProfiloHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}

//REGISTRAZIONE
function Registrazione(){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=dati',RegistrazioneHTML);
}
function RegistrazioneHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
function ModificaDati(){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=dati&editprofile=true',ModificaDatiHTML);
}
function ModificaDatiHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==0){
		Profilo();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}
//ORDINI
function Ordini(){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=ordini',OrdiniHTML);
}
function OrdiniHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==0){
		Profilo();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}

//ORDINE DETTAGLIO
function OrdineDettaglio(idordine){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=ordini&idordine='+idordine,OrdineDettaglioHTML);
}
function OrdineDettaglioHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	if(vResult[0]==0){
		Profilo();	
	}else{
		document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
	}
}
//RECUPERO PASSWORD
function RecuperoPassword(){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=recuperopassword',RecuperoPasswordHTML);
}
function RecuperoPasswordHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
//PREFERITI
//ACQUISTA PRODOTTO
function setpreferito(prodotto){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=preferiti&prodotto='+prodotto,preferitoDataHTML);
}
function preferitoDataHTML(){
	obj=PHP_Unserialize(this.req.responseText);
	vResult = converti_in_array(obj);
	var vScroll = getPageScroll();
	initOverlayCart('cart_window');
	if(navigator.userAgent.indexOf("MSIE")!=-1){
	showOverlayCart('cart_window',coordsXY[1]-80+vScroll[1],coordsXY[0]-160,200);
	}else{
	showOverlayCart('cart_window',coordsXY[1]-80,coordsXY[0]-160,200);
	}
	//initOverlayTrasparentShadow('cart_window');
	showOverlayShadow('trasparentdiv');
	document.getElementById('overlayshadow').onclick = function(){
		hideOverPage('cart_window');
	}
	ShowMessagePreferito(vResult[1],vResult[2]);
}
function ShowMessagePreferito(message,totprod){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=riepilogopreferito&message='+message+'&totprod='+totprod,ShowMessagePreferitoHTML);
}
function ShowMessagePreferitoHTML(){
	document.getElementById('content_cart_window').innerHTML=this.req.responseText;
}

function Preferiti(){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=preferiti',PreferitiHTML);
}
function PreferitiHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	try{
		stopLoading()
	}catch(e){}
		centerOverlay();
}

//QUERY COMUNI
function getSelect(what,value,stile){
	if(what=='provincia'){
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=query_comuni&what='+what+'&value='+value+'&class='+stile, SelectProvincia_html);
	}
	if(what=='citta'){
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=query_comuni&what='+what+'&value='+value+'&class='+stile, SelectCitta_html);
	}
	if(what=='cap'){
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=query_comuni&what='+what+'&value='+value+'&class='+stile, SelectCAP_html);
	}
}
function SelectProvincia_html(){
	document.getElementById('provincia_container').innerHTML=this.req.responseText;
	document.getElementById('citta').value='';
	document.getElementById('citta').disabled=true;
	document.getElementById('cap').disabled=true;
	document.getElementById('cap').value='';
}
function SelectCitta_html(){
	document.getElementById('citta').disabled=false;
	document.getElementById('cap').disabled=false;
	document.getElementById('cap').value='';
	document.getElementById('citta_container').innerHTML=this.req.responseText;
}
function SelectCAP_html(){
	document.getElementById('cap').disabled=false;
	document.getElementById('cap').value=this.req.responseText;
}
function Design(){
	if(!cancelladesign){
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=design',DesignHTML);
	}
}
function DesignHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
function SetDesign(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=design&setdesign='+id,SetDesignHTML);
}
function SetDesignHTML(){
	vResult=PHP_Unserialize(this.req.responseText);
	/*document.getElementById('design').style.backgroundImage='url('+vResult.designimg+')';
	document.getElementById('design').innerHTML=document.getElementById('design').innerHTML.replace('Scegli il Design','');
	document.getElementById('deletedesign').style.display='';*/
	vCatalogo["design"]=vResult.designid;
	Collezioni(vResult.designid);
}

function Collezioni(){
	if(!cancellacollezione){
		if(vCatalogo["design"]!=0){
			AyaxRequest('ajax_request.php', 'POST', 'filetocall=collezioni&design='+vCatalogo["design"],CollezioniHTML);
		}else{
			Design();	
		}
	}
}
function CollezioniHTML(){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
//PERSONALIZZAZIONE
function personalizzazione1(prodotto){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=personalizzazione1&prodotto='+prodotto,personalizzazione1HTML);
}
function personalizzazione1HTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
function personalizzazione2(prodotto,confezione,id){
	if(id){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=personalizzazione2&prodotto='+prodotto+'&confezione='+confezione+'&id='+id,personalizzazione2HTML);
	}else{
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=personalizzazione2&prodotto='+prodotto+'&confezione='+confezione,personalizzazione2HTML);
	}
}
function personalizzazione2HTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
function buonoacquisto(design){
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=buonoacquisto&design='+design,buonoacquistoHTML);
}
function buonoacquistoHTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
function richiedipreventivo(codprodpreventivo){
	var strcodprod=(codprodpreventivo)?'&codprod='+codprodpreventivo:'';
	try{
	hideOverPage('overlay_center');
	}catch(e){}
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=richiedipreventivo'+strcodprod,richiedipreventivo_HTML);
}
function richiedipreventivo_HTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}

function banner(url){
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=banner&url='+url,banner_result);
}
function show_banner(){
	try{
	document.getElementById('bannerbottom').style.display='';
	changeOpac(0, 'bannerbottom');
	opacity('bannerbottom', 0, 100, 2000);
	}catch(e){}
}

function banner_result(){

	vResult=converti_in_array(PHP_Unserialize(this.req.responseText));
	
	if(vResult.show){
		var objBody = document.getElementsByTagName("body").item(0);
		var objOverlayParent = document.createElement("div");
		objOverlayParent.setAttribute('id','bannerbottom');
		objBody.appendChild(objOverlayParent);
		
		var objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','bannerbottomshadow');

		objOverlayParent.appendChild(objOverlay);
		
		var objOverlay = document.createElement("div");
		objOverlay.setAttribute('id','bannerbottomcontainer');

		objOverlayParent.appendChild(objOverlay);
		objOverlay.innerHTML=stripslashes(vResult.contenuto);
		
		if(vResult.ritardo>0){
			setTimeout('show_banner();',vResult.ritardo);
		}else{
			show_banner();	
		}
	}
}

function ordinacampione(codiceprodotto,confezione){
	//alert(codiceprodotto);
	if(!confezione || confezione=='-'){
		initOverlay('overlay_center');
		showOverlay('overlay_center');
		showOverlayShadow('trasparentdiv');
		var pers = (confezione=='-')?'0':'1';
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=ordinacampione&prod='+codiceprodotto+'&pers='+pers,ordinacampione_HTML);
	}else{
		AyaxRequest('ajax_request.php', 'POST', 'filetocall=ordinacampione&prod='+codiceprodotto+'&conf='+confezione,ordinacampione_result);
	}
}
function ordinacampione_HTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
		centerOverlay();
}
function ordinacampione_result(){
	vResult=PHP_Unserialize(this.req.responseText);
	if(vResult.risultato == 1){
		ordinecampione = 1;
		try{
		hideOverPage('overlay_center');
		}catch(e){}
		initOverlay('overlay_center');
		showOverlay('overlay_center');
		showOverlayShadow('trasparentdiv');
		AnteprimaOrdine();
	}
}

function confezionedettaglio(codiceprodotto){
	initOverlay('overlay_center');
	showOverlay('overlay_center');
	showOverlayShadow('trasparentdiv');
	AyaxRequest('ajax_request.php', 'POST', 'filetocall=confezione_dettaglio&prod='+codiceprodotto,confezionedettaglio_HTML);
}

function confezionedettaglio_HTML(){
	document.getElementById('overlay_center').innerHTML=this.req.responseText;
	centerOverlay();
}
