/*-----------------------------------------------*/
/*------------ INIZIALIZZO OGGETTO --------------*/
/*-----------------------------------------------*/

var xmlHttp;

function createXMLHttpRequest(){

	if (window.XMLHttpRequest) {
	   xmlHttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // IE
	   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	   alert('Impossibile continuare: il tuo browser non supporta XMLHttpRequest');
	}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*------------ IMMAGINE PRELOAD -----------------*/
/*-----------------------------------------------*/

Immagine_Preload = ""
Immagine_Preload = Immagine_Preload + "<center><span style='FONT-SIZE: 9px;COLOR: #000000;	FONT-FAMILY: Trebuchet MS, Verdana ;'>loading ...</span></center>"

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/




/*-----------------------------------------------*/
/*------------ CARICAMENTO MENU -----------------*/
/*-----------------------------------------------*/

function CaricaMenu(
					Id_Pagina,
					Id_Pagina_2,
					Id_Pagina_3,
					Id_Pagina_4,
					Lang,
					UrlPagina,
					Id_Categoria,
					Id_Categoria_2,
					Id_Categoria_3,
					Id_Categoria_4,
					Id_Prodotto,
					TitoloPaginaNew,
					Id_News,
					Id_Categoria_News
){

		createXMLHttpRequest();

		document.title = TitoloPaginaNew;

		document.getElementById("id_pagina_controllo").value = Id_Pagina;
		document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
		document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
		document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

		var Id_Categoria ;
		var Id_Categoria_2 ;
		var Id_Categoria_3 ;
		var Id_Categoria_4 ;
		var Id_Prodotto ;

		if (document.getElementById("id_categoria") !=null) {
			document.getElementById("id_categoria").value = Id_Categoria;
			document.getElementById("id_categoria_2").value = Id_Categoria_2;
			document.getElementById("id_categoria_3").value = Id_Categoria_3;
			document.getElementById("id_categoria_4").value = Id_Categoria_4;
			document.getElementById("id_prodotto").value = Id_Prodotto;
		}

		document.getElementById("id_news").value = Id_News;
		document.getElementById("id_categoria_news").value = Id_Categoria_News;
		
		document.getElementById("Lingua").value = Lang;

		xmlHttp.onreadystatechange = handleStateChangeMenu;
		xmlHttp.open("GET", "menu.asp"+UrlPagina, true);
		xmlHttp.send(null);
}

function handleStateChangeMenu(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare il menu di navigazione ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){
				document.getElementById("Menu_1").innerHTML = xmlHttp.responseText;

				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU ALLORA CARICO LA PAGINA
				//---------------------------------------------------------------
				Id_Pagina = document.getElementById("id_pagina_controllo").value;
				Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
				Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
				Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
				Id_News = document.getElementById("id_news").value;
				Id_Categoria_News = document.getElementById("id_categoria_news").value;
				
				TitoloPaginaNew = document.title;
				Lang = document.getElementById("Lingua").value;

				var Id_Categoria = "";
				var Id_Categoria_2 = "";
				var Id_Categoria_3 = "";
				var Id_Categoria_4 = "";
				var Id_Prodotto = "";

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				UrlPagina = ""
				UrlPagina = UrlPagina + "?id_pagina="+Id_Pagina
				UrlPagina = UrlPagina + "&id_pagina_2="+Id_Pagina_2
				UrlPagina = UrlPagina + "&id_pagina_3="+Id_Pagina_3
				UrlPagina = UrlPagina + "&id_pagina_4="+Id_Pagina_4
				UrlPagina = UrlPagina + "&Lang="+Lang+"&id_email="+document.getElementById("id_email").value
				UrlPagina = UrlPagina + "&id_categoria="+Id_Categoria
				UrlPagina = UrlPagina + "&id_categoria_2="+Id_Categoria_2
				UrlPagina = UrlPagina + "&id_categoria_3="+Id_Categoria_3
				UrlPagina = UrlPagina + "&id_categoria_4="+Id_Categoria_4
				UrlPagina = UrlPagina + "&id_prodotto="+Id_Prodotto
				UrlPagina = UrlPagina + "&id_categoria_news="+Id_Categoria_News
				UrlPagina = UrlPagina + "&id_news="+Id_News


				if (document.getElementById("tabella_origine") !=null) {
					UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
				}
				
				
				CaricaMenu_2(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);
				
/*
				CaricaPagina(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);
*/
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Menu_1").innerHTML = Messaggio;
			}
		
		}else{
				
			document.getElementById("Menu_1").innerHTML = Immagine_Preload
			
		}


}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/




/*-----------------------------------------------*/
/*------------ CARICAMENTO MENU -----------------*/
/*-----------------------------------------------*/

function CaricaMenu_NoImage(
					Id_Pagina,
					Id_Pagina_2,
					Id_Pagina_3,
					Id_Pagina_4,
					Lang,
					UrlPagina,
					Id_Categoria,
					Id_Categoria_2,
					Id_Categoria_3,
					Id_Categoria_4,
					Id_Prodotto,
					TitoloPaginaNew,
					Id_News,
					Id_Categoria_News
){

		createXMLHttpRequest();

		document.title = TitoloPaginaNew;

		document.getElementById("id_pagina_controllo").value = Id_Pagina;
		document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
		document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
		document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

		var Id_Categoria = "";
		var Id_Categoria_2 = "";
		var Id_Categoria_3 = "";
		var Id_Categoria_4 = "";
		var Id_Prodotto = "";

		if (document.getElementById("id_categoria") !=null) {
			document.getElementById("id_categoria").value = Id_Categoria;
			document.getElementById("id_categoria_2").value = Id_Categoria_2;
			document.getElementById("id_categoria_3").value = Id_Categoria_3;
			document.getElementById("id_categoria_4").value = Id_Categoria_4;
			document.getElementById("id_prodotto").value = Id_Prodotto;
		}

		document.getElementById("id_news").value = Id_News;
		document.getElementById("id_categoria_news").value = Id_Categoria_News;
		
		document.getElementById("Lingua").value = Lang;
		
		xmlHttp.onreadystatechange = handleStateChangeMenu_NoImage;
		xmlHttp.open("GET", "menu.asp"+UrlPagina, true);
		xmlHttp.send(null);
}

function handleStateChangeMenu_NoImage(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare il menu di navigazione ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){
				document.getElementById("Menu_1").innerHTML = xmlHttp.responseText;

				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU ALLORA CARICO LA PAGINA
				//---------------------------------------------------------------
				Id_Pagina = document.getElementById("id_pagina_controllo").value;
				Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
				Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
				Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
				Id_News = document.getElementById("id_news").value;
				Id_Categoria_News = document.getElementById("id_categoria_news").value;
				
				TitoloPaginaNew = document.title;
				Lang = document.getElementById("Lingua").value;

				var Id_Categoria = "";
				var Id_Categoria_2 = "";
				var Id_Categoria_3 = "";
				var Id_Categoria_4 = "";
				var Id_Prodotto = "";

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				UrlPagina = ""
				UrlPagina = UrlPagina + "?id_pagina="+Id_Pagina
				UrlPagina = UrlPagina + "&id_pagina_2="+Id_Pagina_2
				UrlPagina = UrlPagina + "&id_pagina_3="+Id_Pagina_3
				UrlPagina = UrlPagina + "&id_pagina_4="+Id_Pagina_4
				UrlPagina = UrlPagina + "&Lang="+Lang+"&id_email="+document.getElementById("id_email").value
				UrlPagina = UrlPagina + "&id_categoria="+Id_Categoria
				UrlPagina = UrlPagina + "&id_categoria_2="+Id_Categoria_2
				UrlPagina = UrlPagina + "&id_categoria_3="+Id_Categoria_3
				UrlPagina = UrlPagina + "&id_categoria_4="+Id_Categoria_4
				UrlPagina = UrlPagina + "&id_prodotto="+Id_Prodotto
				UrlPagina = UrlPagina + "&id_categoria_news="+Id_Categoria_News
				UrlPagina = UrlPagina + "&id_news="+Id_News


				if (document.getElementById("tabella_origine") !=null) {
					UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
				}
	
				CaricaMenu_2_NoImage(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);

				
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Menu_1").innerHTML = Messaggio;
			}
		
		}else{
				
			document.getElementById("Menu_1").innerHTML = Immagine_Preload
			
		}


}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/



/*-----------------------------------------------*/
/*------ CARICAMENTO MENU SECONDO LIVELLO -------*/
/*-----------------------------------------------*/

function CaricaMenu_2(
					Id_Pagina,
					Id_Pagina_2,
					Id_Pagina_3,
					Id_Pagina_4,
					Lang,
					UrlPagina,
					Id_Categoria,
					Id_Categoria_2,
					Id_Categoria_3,
					Id_Categoria_4,
					Id_Prodotto,
					TitoloPaginaNew,
					Id_News,
					Id_Categoria_News
){

		createXMLHttpRequest();

		document.title = TitoloPaginaNew;

		document.getElementById("id_pagina_controllo").value = Id_Pagina;
		document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
		document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
		document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

		var Id_Categoria ;
		var Id_Categoria_2 ;
		var Id_Categoria_3 ;
		var Id_Categoria_4 ;
		var Id_Prodotto ;

		if (document.getElementById("id_categoria") !=null) {
			document.getElementById("id_categoria").value = Id_Categoria;
			document.getElementById("id_categoria_2").value = Id_Categoria_2;
			document.getElementById("id_categoria_3").value = Id_Categoria_3;
			document.getElementById("id_categoria_4").value = Id_Categoria_4;
			document.getElementById("id_prodotto").value = Id_Prodotto;
		}

		document.getElementById("id_news").value = Id_News;
		document.getElementById("id_categoria_news").value = Id_Categoria_News;
		
		document.getElementById("Lingua").value = Lang;
		
		xmlHttp.onreadystatechange = handleStateChangeMenu_2;
		xmlHttp.open("GET", "menu_2.asp"+UrlPagina, true);
		xmlHttp.send(null);
}

function handleStateChangeMenu_2(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare il menu di navigazione ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){
				document.getElementById("Menu_2").innerHTML = xmlHttp.responseText;

				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU ALLORA CARICO LA PAGINA
				//---------------------------------------------------------------
				Id_Pagina = document.getElementById("id_pagina_controllo").value;
				Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
				Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
				Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
				Id_News = document.getElementById("id_news").value;
				Id_Categoria_News = document.getElementById("id_categoria_news").value;
				
				TitoloPaginaNew = document.title;
				Lang = document.getElementById("Lingua").value;

				var Id_Categoria ;
				var Id_Categoria_2 ;
				var Id_Categoria_3 ;
				var Id_Categoria_4 ;
				var Id_Prodotto ;

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				UrlPagina = ""
				UrlPagina = UrlPagina + "?id_pagina="+Id_Pagina
				UrlPagina = UrlPagina + "&id_pagina_2="+Id_Pagina_2
				UrlPagina = UrlPagina + "&id_pagina_3="+Id_Pagina_3
				UrlPagina = UrlPagina + "&id_pagina_4="+Id_Pagina_4
				UrlPagina = UrlPagina + "&Lang="+Lang+"&id_email="+document.getElementById("id_email").value
				UrlPagina = UrlPagina + "&id_categoria="+Id_Categoria
				UrlPagina = UrlPagina + "&id_categoria_2="+Id_Categoria_2
				UrlPagina = UrlPagina + "&id_categoria_3="+Id_Categoria_3
				UrlPagina = UrlPagina + "&id_categoria_4="+Id_Categoria_4
				UrlPagina = UrlPagina + "&id_prodotto="+Id_Prodotto
				UrlPagina = UrlPagina + "&id_categoria_news="+Id_Categoria_News
				UrlPagina = UrlPagina + "&id_news="+Id_News


				if (document.getElementById("tabella_origine") !=null) {
					UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
				}

				CaricaPagina(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);
				
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Menu_2").innerHTML = Messaggio;
			}
		
		}else{
				
			document.getElementById("Menu_2").innerHTML = Immagine_Preload
			
		}


}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/




/*-----------------------------------------------*/
/*------ CARICAMENTO MENU SECONDO LIVELLO -------*/
/*-----------------------------------------------*/

function CaricaMenu_2_NoPagina(
					Id_Pagina,
					Id_Pagina_2,
					Id_Pagina_3,
					Id_Pagina_4,
					Lang,
					UrlPagina,
					Id_Categoria,
					Id_Categoria_2,
					Id_Categoria_3,
					Id_Categoria_4,
					Id_Prodotto,
					TitoloPaginaNew,
					Id_News,
					Id_Categoria_News
){

		createXMLHttpRequest();

		document.title = TitoloPaginaNew;

		document.getElementById("id_pagina_controllo").value = Id_Pagina;
		document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
		document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
		document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

		var Id_Categoria = "";
		var Id_Categoria_2 = "";
		var Id_Categoria_3 = "";
		var Id_Categoria_4 = "";
		var Id_Prodotto = "";

		if (document.getElementById("id_categoria") !=null) {
			document.getElementById("id_categoria").value = Id_Categoria;
			document.getElementById("id_categoria_2").value = Id_Categoria_2;
			document.getElementById("id_categoria_3").value = Id_Categoria_3;
			document.getElementById("id_categoria_4").value = Id_Categoria_4;
			document.getElementById("id_prodotto").value = Id_Prodotto;
		}

		document.getElementById("id_news").value = Id_News;
		document.getElementById("id_categoria_news").value = Id_Categoria_News;
		
		document.getElementById("Lingua").value = Lang;
		
		xmlHttp.onreadystatechange = handleStateChangeMenu_2_NoPagina;
		xmlHttp.open("GET", "menu_2.asp"+UrlPagina, true);
		xmlHttp.send(null);
}

function handleStateChangeMenu_2_NoPagina(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare il menu di navigazione ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){

				document.getElementById("Menu_2").innerHTML = xmlHttp.responseText;

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Menu_2").innerHTML = Messaggio;
			}
		
		}else{
				
			document.getElementById("Menu_2").innerHTML = Immagine_Preload
			
		}


}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*------ CARICAMENTO MENU SECONDO LIVELLO -------*/
/*------ SENZA CAMBIO PAGINA --------------------*/
/*-----------------------------------------------*/

function CaricaMenu_2_NoImage_No_Pagina(
					Id_Pagina,
					Id_Pagina_2,
					Id_Pagina_3,
					Id_Pagina_4,
					Lang,
					UrlPagina,
					Id_Categoria,
					Id_Categoria_2,
					Id_Categoria_3,
					Id_Categoria_4,
					Id_Prodotto,
					TitoloPaginaNew,
					Id_News,
					Id_Categoria_News
){

		createXMLHttpRequest();

		document.title = TitoloPaginaNew;

		document.getElementById("id_pagina_controllo").value = Id_Pagina;
		document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
		document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
		document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

		if (document.getElementById("id_categoria") !=null) {
			document.getElementById("id_categoria").value = Id_Categoria;
			document.getElementById("id_categoria_2").value = Id_Categoria_2;
			document.getElementById("id_categoria_3").value = Id_Categoria_3;
			document.getElementById("id_categoria_4").value = Id_Categoria_4;
			document.getElementById("id_prodotto").value = Id_Prodotto;
		}

		document.getElementById("id_news").value = Id_News;
		document.getElementById("id_categoria_news").value = Id_Categoria_News;
		
		document.getElementById("Lingua").value = Lang;
		
		xmlHttp.onreadystatechange = handleStateChangeMenu_2_NoImage_No_Pagina;
		xmlHttp.open("GET", "menu_2.asp"+UrlPagina, true);
		xmlHttp.send(null);
}

function handleStateChangeMenu_2_NoImage_No_Pagina(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare il menu di navigazione ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){

				document.getElementById("Menu_2").innerHTML = xmlHttp.responseText;

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Menu_2").innerHTML = Messaggio;
			}
		
		}else{
				
			document.getElementById("Menu_2").innerHTML = Immagine_Preload
			
		}


}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------ CARICAMENTO MENU SECONDO LIVELLO -------*/
/*------ SENZA CAMBIO FOTO PER PAGINA -----------*/
/*-----------------------------------------------*/

function CaricaMenu_2_NoImage(
					Id_Pagina,
					Id_Pagina_2,
					Id_Pagina_3,
					Id_Pagina_4,
					Lang,
					UrlPagina,
					Id_Categoria,
					Id_Categoria_2,
					Id_Categoria_3,
					Id_Categoria_4,
					Id_Prodotto,
					TitoloPaginaNew,
					Id_News,
					Id_Categoria_News
){

//alert(UrlPagina);

		createXMLHttpRequest();

		document.title = TitoloPaginaNew;

		document.getElementById("id_pagina_controllo").value = Id_Pagina;
		document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
		document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
		document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

		if (document.getElementById("id_categoria") !=null) {
			document.getElementById("id_categoria").value = Id_Categoria;
			document.getElementById("id_categoria_2").value = Id_Categoria_2;
			document.getElementById("id_categoria_3").value = Id_Categoria_3;
			document.getElementById("id_categoria_4").value = Id_Categoria_4;
			document.getElementById("id_prodotto").value = Id_Prodotto;
		}

		document.getElementById("id_news").value = Id_News;
		document.getElementById("id_categoria_news").value = Id_Categoria_News;
		
		document.getElementById("Lingua").value = Lang;
		
		xmlHttp.onreadystatechange = handleStateChangeMenu_2_NoImage;
		xmlHttp.open("GET", "menu_2.asp"+UrlPagina, true);
		xmlHttp.send(null);
}

function handleStateChangeMenu_2_NoImage(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare il menu di navigazione ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

		if (xmlHttp.readyState==4){

			if (xmlHttp.status == 200){
				document.getElementById("Menu_2").innerHTML = xmlHttp.responseText;

				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU ALLORA CARICO LA PAGINA
				//---------------------------------------------------------------
				Id_Pagina = document.getElementById("id_pagina_controllo").value;
				Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
				Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
				Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
				Id_News = document.getElementById("id_news").value;
				Id_Categoria_News = document.getElementById("id_categoria_news").value;
				
				TitoloPaginaNew = document.title;
				Lang = document.getElementById("Lingua").value;

				var Id_Categoria = "";
				var Id_Categoria_2 = "";
				var Id_Categoria_3 = "";
				var Id_Categoria_4 = "";
				var Id_Prodotto = "";

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				UrlPagina = ""
				UrlPagina = UrlPagina + "?id_pagina="+Id_Pagina
				UrlPagina = UrlPagina + "&id_pagina_2="+Id_Pagina_2
				UrlPagina = UrlPagina + "&id_pagina_3="+Id_Pagina_3
				UrlPagina = UrlPagina + "&id_pagina_4="+Id_Pagina_4
				UrlPagina = UrlPagina + "&Lang="+Lang+"&id_email="+document.getElementById("id_email").value
				UrlPagina = UrlPagina + "&id_categoria="+Id_Categoria
				UrlPagina = UrlPagina + "&id_categoria_2="+Id_Categoria_2
				UrlPagina = UrlPagina + "&id_categoria_3="+Id_Categoria_3
				UrlPagina = UrlPagina + "&id_categoria_4="+Id_Categoria_4
				UrlPagina = UrlPagina + "&id_prodotto="+Id_Prodotto
				UrlPagina = UrlPagina + "&id_categoria_news="+Id_Categoria_News
				UrlPagina = UrlPagina + "&id_news="+Id_News


				if (document.getElementById("tabella_origine") !=null) {
					UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
				}
	
				CaricaPaginaNoImage(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);
				
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

			}else{

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Menu_2").innerHTML = Messaggio;

			}
		
		}else{
				
			document.getElementById("Menu_2").innerHTML = Immagine_Preload
			
		}


}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ CARICAMENTO PAGINA ---------------*/
/*-----------------------------------------------*/

function CaricaPagina(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
					  ){

	createXMLHttpRequest();

	if (document.getElementById("id_categoria") !=null) {
		document.getElementById("id_categoria").value = Id_Categoria;
		document.getElementById("id_categoria_2").value = Id_Categoria_2;
		document.getElementById("id_categoria_3").value = Id_Categoria_3;
		document.getElementById("id_categoria_4").value = Id_Categoria_4;
		document.getElementById("id_prodotto").value = Id_Prodotto;
	}

	document.title = TitoloPaginaNew;
	document.getElementById("id_pagina_controllo").value = Id_Pagina;
	document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
	document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
	document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

	document.getElementById("id_news").value = Id_News;
	document.getElementById("id_categoria_news").value = Id_Categoria_News;


	document.getElementById("Lingua").value = Lang;

	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open("GET", "content.asp"+UrlPagina, true);
	xmlHttp.send(null);

}

function handleStateChange(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
				document.getElementById("Contenuto_Pagina").innerHTML = xmlHttp.responseText;

				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE LA PAGINA ALLORA CARICO LE FOTO
				//---------------------------------------------------------------

					if (document.getElementById("Immagini_Pagina_Ajax") != null){
						
						var Id_Immagine_Ajax;
						
						Larghezza = document.getElementById("larghezza_immagine").value;
						Altezza = document.getElementById("altezza_immagine").value;

						if (document.getElementById("id_pagina_controllo").value != '') {
							Id_Padre = document.getElementById("id_pagina_controllo").value;
							Tabella_Padre = "Pagine";
						}

						if (document.getElementById("id_pagina_controllo_2").value != '') {
							Id_Padre = document.getElementById("id_pagina_controllo_2").value;
							Tabella_Padre = "Pagine_2";
						}

						if (document.getElementById("id_pagina_controllo_3").value != '') {
							Id_Padre = document.getElementById("id_pagina_controllo_3").value;
							Tabella_Padre = "Pagine_2";
						}

						if (document.getElementById("id_pagina_controllo_4").value != '') {
							Id_Padre = document.getElementById("id_pagina_controllo_4").value;
							Tabella_Padre = "Pagine_2";
						}
												
						Tipo_File_Ajax = document.getElementById("tipo_file_ajax").value;
						
						Id_Pagina = document.getElementById("id_pagina_controllo").value;
						Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
						Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
						Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;

						UrlPagina = ""
						UrlPagina = UrlPagina + "?id_pagina="+Id_Pagina
						UrlPagina = UrlPagina + "&id_pagina_2="+Id_Pagina_2
						UrlPagina = UrlPagina + "&id_pagina_3="+Id_Pagina_3
						UrlPagina = UrlPagina + "&id_pagina_4="+Id_Pagina_4
						UrlPagina = UrlPagina + "&Lang="+Lang
		
						TitoloPaginaNew = document.title;
						Lang = document.getElementById("Lingua").value;

				var Id_Categoria = "";
				var Id_Categoria_2 = "";
				var Id_Categoria_3 = "";
				var Id_Categoria_4 = "";
				var Id_Prodotto = "";

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				//------------------------------------------------------------------------------------------
				//------------------------------------------------------------------------------------------
				//------------------------------------------------------------------------------------------

				CaricaImmagini(
								Id_Pagina,
								Id_Pagina_2,
								Id_Pagina_3,
								Id_Pagina_4,
								Lang,
								UrlPagina,
								TitoloPaginaNew,
								Larghezza,
								Altezza,
								Tipo_File_Ajax,
								Tabella_Padre,
								Id_Padre,
								Id_Immagine_Ajax
								);


					}

				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

				//------------------------------------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU DI PRIMO LIVELLO CARICO IL BOX DELLE NEWSLETTER 
				// --- SOLO SE PRESENTE IL DIV 'Top_Newsletter' --------------------------------------------
				// --- SE NON PRESENTE ALLORA CARICO SUBITO IL BOX DELLE NEWS SUL DIV 'News_Home'
				//------------------------------------------------------------------------------------------

				if (document.getElementById("Top_Newsletter") != null) {

						CaricaIscrizioneNewsletter(
							  Id_Pagina,
							  Id_Pagina_2,
							  Id_Pagina_3,
							  Id_Pagina_4,
							  Lang,
							  UrlPagina,
							  Id_Categoria,
							  Id_Categoria_2,
							  Id_Categoria_3,
							  Id_Categoria_4,
							  Id_Prodotto,
							  TitoloPaginaNew,
							  Id_News,
							  Id_Categoria_News
						);

				}else{

					if (document.getElementById("News_Home") != null) {

							CaricaNews(
								  Id_Pagina,
								  Id_Pagina_2,
								  Id_Pagina_3,
								  Id_Pagina_4,
								  Lang,
								  UrlPagina,
								  Id_Categoria,
								  Id_Categoria_2,
								  Id_Categoria_3,
								  Id_Categoria_4,
								  Id_Prodotto,
								  TitoloPaginaNew,
								  Id_News,
								  Id_Categoria_News
							);
					}

				}

				//------------------------------------------------------------------------------------------
				//------------------------------------------------------------------------------------------
				//------------------------------------------------------------------------------------------
				//------------------------------------------------------------------------------------------

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Contenuto_Pagina").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Contenuto_Pagina").innerHTML = Immagine_Preload
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*--------------------------------------------------------*/
/*-------- DESTINAZIONE ALTERNATIVA SELEZIONATA ----------*/
/*--------------------------------------------------------*/

function Seleziona_Destinazione_Alt(id_destinazione){
	
	document.getElementById("id_destinazione_alternativa").value = '';
	
	if (id_destinazione!=''){

		document.getElementById("id_destinazione_alternativa").value = id_destinazione;

		}else{
			
		document.getElementById("id_destinazione_alternativa").value = '';
		
	}
	

}

/*--------------------------------------------------------*/
/*--------------------------------------------------------*/
/*--------------------------------------------------------*/



/*-----------------------------------------------*/
/*---------- ISCRIZIONE AREA RISERVATA ----------*/
/*---------- SEMPLIFICATA -----------------------*/
/*-----------------------------------------------*/

function Conferma_Iscrizione_Area_Riservata_Simple(UrlPagina){

azione = document.getElementById("azione").value;

if (document.getElementById("id_utente_accesso")!=null){
	id_utente = document.getElementById("id_utente_accesso").value;
}else{
	id_utente = document.getElementById("id_utente_modifica").value;
}

tipologia_operazione = document.getElementById("tipologia_operazione").value;

ragionesociale = document.getElementById("ragionesociale_iscrizione").value;
id_nazione = document.getElementById("id_nazione_iscrizione").value;
indirizzo = document.getElementById("indirizzo_iscrizione").value;
cap = document.getElementById("cap_iscrizione").value;
citta = document.getElementById("citta_iscrizione").value;
id_provincia = document.getElementById("id_provincia_iscrizione").value;

telefono = document.getElementById("telefono_iscrizione").value;
fax = document.getElementById("fax_iscrizione").value;
nome = document.getElementById("nome_iscrizione").value;
cognome = document.getElementById("cognome_iscrizione").value;

username = document.getElementById("username_form_iscrizione").value;
password = document.getElementById("password_form_iscrizione").value;
password_2 = document.getElementById("password_form_iscrizione_2").value;

newsletter = document.getElementById("newsletter_iscrizione").value;

/*
if (indirizzo == ''   ){
	alert("Inserire indirizzo!");
	document.getElementById("indirizzo_iscrizione").focus();
	return false;
}

if (cap == ''   ){
	alert("Inserire cap!");
	document.getElementById("cap_iscrizione").focus();
	return false;
}

if (citta == ''   ){
	alert("Inserire la cittā !");
	document.getElementById("citta_iscrizione").focus();
	return false;
}

if (telefono == ''   ){
	alert("Inserire il telefono !");
	document.getElementById("telefono_iscrizione").focus();
	return false;
}
*/

if (nome == ''   ){
	alert("Inserire il nome!");
	document.getElementById("nome_iscrizione").focus();
	return false;
}

if (cognome == ''   ){
	alert("Inserire il cognome!");
	document.getElementById("cognome_iscrizione").focus();
	return false;
}

if (username == ''   ){
	alert("Inserire indirizzo email - login!");
	document.getElementById("username_form_iscrizione").focus();
	return false;
}


		if (username != ''   ){
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			//   if(!i.test(what)) { alert("L'indirizzo email inserito non e' valido!"); return false}   
			   if(!i.test(username)) {
			   alert("L'indirizzo email inserito non e' valido!");
			   document.getElementById("username_form_iscrizione").focus();
			   return false;
			}
		}

if (tipologia_operazione!='2'){
				
				if (password == ''   ){
					alert("Inserire la password!");
					document.getElementById("password_form_iscrizione").focus();
					return false;
				}
				
				if (password_2 == ''   ){
					alert("Confermare la password!");
					document.getElementById("password_form_iscrizione_2").focus();
					return false;
				}
				
				if (password == username   ){
					alert("Login e Password non possono essere uguali!");
					document.getElementById("password_form_iscrizione").focus();
					return false;
				}
				
						var password_len = password;
						var Lunghezza_Password=password_len.length;
							if (Lunghezza_Password < 6   ){
								alert("La password deve contenere almeno 6 caratteri!");
							document.getElementById("password_form_iscrizione_2").focus();
							return false;
							}
				
				
				if (password != password_2   ){
					alert("Password errata !\n'Password' deve essere uguale a 'Conferma password'");
					document.getElementById("password_form_iscrizione_2").focus();
					return false;
				}

				
				//------------------------------------------------
				//------------------------------------------------
				//------------------------------------------------
				
				if (document.getElementById("lista_username")!=null){
					
					// CONTROLLO SE LA LOGIN SELEZIONATA ESISTE GIA'
					d = document.getElementById("lista_username").value.split(",");
				
					var agree_username=false;
					var j;
					for(j=0;j<d.length-1;j++){
						if (d[j]==document.getElementById("username_form_iscrizione").value){
							agree_username=true;
						}else{
							agree_username=false;
						}
					}
				
						if (agree_username==true) {
							alert("La login inserita č gia' utilizzata, selezionarne un'altra!");
							document.getElementById("username_form_iscrizione").value="";
							document.getElementById("username_form_iscrizione").focus();
						}	
				
				}
				
				if (document.getElementById("lista_password")!=null){
					
					// CONTROLLO SE LA LOGIN SELEZIONATA ESISTE GIA'
					d = document.getElementById("lista_password").value.split(",");
				
					var agree_password=false;
					var j;
					for(j=0;j<d.length-1;j++){
						if (d[j]==document.getElementById("password_form_iscrizione").value){
							agree_password=true;
						}else{
							agree_password=false;
						}
					}
				
						if (agree_password==true) {
							alert("La password inserita č gia' utilizzata, selezionarne un'altra!");
							document.getElementById("password_form_iscrizione").value="";
							document.getElementById("password_form_iscrizione_2").value="";
							document.getElementById("password_form_iscrizione").focus();
						}	
				
				}
				//------------------------------------------------
				//------------------------------------------------
				//------------------------------------------------

}else{
	
	agree_username = false ;
	agree_password = false ;
	
	}

//------------------------------------------------
// CONTROLLARE CHE SIA SELEZIONATA ALMENO -------- 
// UNA SPECIALITA --------------------------------
//------------------------------------------------

if (document.getElementById("lista_specialita").value == ''   ){
	alert("Selezionare almeno una specialitā !");
	return false;
}

//------------------------------------------------
//------------------------------------------------
//------------------------------------------------

	if ((agree_username == false)&&(agree_password == false)) {

		if (document.getElementById("consenso").checked != true) {
			alert("Per poter continuare e' neccessario acconsentire il trattamento dei dati personali!");
			document.getElementById("consenso").focus();
			return false;
		}
		
			UrlPagina = "?id_pagina=901&Lang="+document.getElementById("Lingua").value
		
			var	postData = "id="+id_utente
			postData = postData + "&abilita=1"
			postData = postData + "&id_categoria=1"
			postData = postData + "&id_nazione="+id_nazione
			postData = postData + "&ragionesociale="+ragionesociale
			postData = postData + "&indirizzo="+indirizzo
			postData = postData + "&cap="+cap
			postData = postData + "&citta="+citta
			postData = postData + "&id_provincia="+id_provincia
			postData = postData + "&telefono="+telefono
			postData = postData + "&fax="+fax
			postData = postData + "&nome="+nome
			postData = postData + "&cognome="+cognome
			postData = postData + "&email="+username
			postData = postData + "&username="+username
			postData = postData + "&password="+password
			postData = postData + "&newsletter="+newsletter

			postData = postData + "&azione="+azione
			postData = postData + "&tipologia_operazione="+tipologia_operazione
			postData = postData + "&provenienza=no-outlook"

			/**** AGGIUNGO LA LISTA DELLE SPECILITA SELEZIONATE *****/
			postData = postData +document.getElementById("lista_specialita").value
			/********************************************************/

			postData = postData.replace(/ /g,"%20");

			var agree=confirm("Confermare i dati inseriti e procedere con l'invio della richiesta ?");
			
			if (agree == true){

				xmlHttp.open("POST", "iscrizione_simple.asp"+UrlPagina, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", postData.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.onreadystatechange = handleStateChangeNoImageArea;
				xmlHttp.send(postData);
		
			}
			
	}
	
	
	
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


















/*-----------------------------------------------*/
/*---------- ISCRIZIONE AREA RISERVATA ----------*/
/*-----------------------------------------------*/

function Conferma_Iscrizione_Area_Riservata(UrlPagina){

azione = document.getElementById("azione").value;
id_destinazione  = document.getElementById("id_destinazione_modifica").value;
tipologia_operazione = document.getElementById("tipologia_operazione").value;
note_carrello =  document.getElementById("note_carrello").value;
modalita_pagamento =  document.getElementById("modalita_pagamento").value;
id_destinazione_alternativa = document.getElementById("id_destinazione_alternativa").value;



if (document.getElementById("id_utente_accesso")!=null){
	id_utente = document.getElementById("id_utente_accesso").value;
}else{
	id_utente = document.getElementById("id_utente_modifica").value;
}

// FORZATI ENTRAMBI A "1" SU POSTDATA
// abilita = document.getElementById("abilita").value;
// id_categoria = document.getElementById("id_categoria_utente").value;

ragionesociale = document.getElementById("ragionesociale_iscrizione").value;
id_nazione = document.getElementById("id_nazione_iscrizione").value;
indirizzo = document.getElementById("indirizzo_iscrizione").value;
cap = document.getElementById("cap_iscrizione").value;
citta = document.getElementById("citta_iscrizione").value;
id_provincia = document.getElementById("id_provincia_iscrizione").value;
nazionalita_alternativa = document.getElementById("nazione_alternativa_iscrizione").value;
piva = document.getElementById("piva_iscrizione").value;
cod_fisc = document.getElementById("cod_fisc_iscrizione").value;
telefono = document.getElementById("telefono_iscrizione").value;
fax = document.getElementById("fax_iscrizione").value;
nome = document.getElementById("nome_iscrizione").value;
cognome = document.getElementById("cognome_iscrizione").value;
sito = document.getElementById("sito_iscrizione").value;
username = document.getElementById("username_form_iscrizione").value;
password = document.getElementById("password_form_iscrizione").value;
password_2 = document.getElementById("password_form_iscrizione_2").value;
newsletter = document.getElementById("newsletter_iscrizione").value;
note = document.getElementById("note_iscrizione").value;

lun_m_da = document.getElementById("lun_m_da").value;
lun_m_a = document.getElementById("lun_m_a").value;
lun_p_da = document.getElementById("lun_p_da").value;
lun_p_a = document.getElementById("lun_p_a").value;

mar_m_da = document.getElementById("mar_m_da").value;
mar_m_a = document.getElementById("mar_m_a").value;
mar_p_da = document.getElementById("mar_p_da").value;
mar_p_a = document.getElementById("mar_p_a").value;

mer_m_da = document.getElementById("mer_m_da").value;
mer_m_a = document.getElementById("mer_m_a").value;
mer_p_da = document.getElementById("mer_p_da").value;
mer_p_a = document.getElementById("mer_p_a").value;

gio_m_da = document.getElementById("gio_m_da").value;
gio_m_a = document.getElementById("gio_m_a").value;
gio_p_da = document.getElementById("gio_p_da").value;
gio_p_a = document.getElementById("gio_p_a").value;

ven_m_da = document.getElementById("ven_m_da").value;
ven_m_a = document.getElementById("ven_m_a").value;
ven_p_da = document.getElementById("ven_p_da").value;
ven_p_a = document.getElementById("ven_p_a").value;



/*---------------------------------------------------*/
/*-------- DATI PER DIVERSA DETINAZIONE -------------*/
/*---------------------------------------------------*/

ragionesociale_destinazione = document.getElementById("ragionesociale_destinazione").value;
id_nazione_destinazione = document.getElementById("id_nazione_destinazione").value;
indirizzo_destinazione = document.getElementById("indirizzo_destinazione").value;
cap_destinazione = document.getElementById("cap_destinazione").value;
citta_destinazione = document.getElementById("citta_destinazione").value;
id_provincia_destinazione = document.getElementById("id_provincia_destinazione").value;
nazionalita_alternativa_destinazione = document.getElementById("nazione_alternativa_destinazione").value;
telefono_destinazione = document.getElementById("telefono_destinazione").value;
fax_destinazione = document.getElementById("fax_destinazione").value;
nome_destinazione = document.getElementById("nome_destinazione").value;
cognome_destinazione = document.getElementById("cognome_destinazione").value;
sito_destinazione = document.getElementById("sito_destinazione").value;
note_destinazione = document.getElementById("note_destinazione").value;

lun_m_da_destinazione = document.getElementById("lun_m_da_destinazione").value;
lun_m_a_destinazione = document.getElementById("lun_m_a_destinazione").value;
lun_p_da_destinazione = document.getElementById("lun_p_da_destinazione").value;
lun_p_a_destinazione = document.getElementById("lun_p_a_destinazione").value;

mar_m_da_destinazione = document.getElementById("mar_m_da_destinazione").value;
mar_m_a_destinazione = document.getElementById("mar_m_a_destinazione").value;
mar_p_da_destinazione = document.getElementById("mar_p_da_destinazione").value;
mar_p_a_destinazione = document.getElementById("mar_p_a_destinazione").value;

mer_m_da_destinazione = document.getElementById("mer_m_da_destinazione").value;
mer_m_a_destinazione = document.getElementById("mer_m_a_destinazione").value;
mer_p_da_destinazione = document.getElementById("mer_p_da_destinazione").value;
mer_p_a_destinazione = document.getElementById("mer_p_a_destinazione").value;

gio_m_da_destinazione = document.getElementById("gio_m_da_destinazione").value;
gio_m_a_destinazione = document.getElementById("gio_m_a_destinazione").value;
gio_p_da_destinazione = document.getElementById("gio_p_da_destinazione").value;
gio_p_a_destinazione = document.getElementById("gio_p_a_destinazione").value;

ven_m_da_destinazione = document.getElementById("ven_m_da_destinazione").value;
ven_m_a_destinazione = document.getElementById("ven_m_a_destinazione").value;
ven_p_da_destinazione = document.getElementById("ven_p_da_destinazione").value;
ven_p_a_destinazione = document.getElementById("ven_p_a_destinazione").value;

/*---------------------------------------------------*/
/*---------------------------------------------------*/
/*---------------------------------------------------*/



/*if (ragionesociale == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire la ragione sociale!");
	document.getElementById("ragionesociale_iscrizione").focus();
	return false;
}*/

if (indirizzo == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire indirizzo!");
	document.getElementById("indirizzo_iscrizione").focus();
	return false;
}

if (cap == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire cap!");
	document.getElementById("cap_iscrizione").focus();
	return false;
}

if (citta == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire la cittā !");
	document.getElementById("citta_iscrizione").focus();
	return false;
}
/*
if ((cod_fisc == '' )&&(piva == '' )){
	alert("Inserire il codice fiscale o la partita iva!");
		VisualizzaStep("Step_1_Sel");
		EvidenziaStep("Step_1");
	document.getElementById("piva_iscrizione").focus();
	return false;
}

if ((cod_fisc != '' )&&(piva != '' )){
		VisualizzaStep("Step_1_Sel");
		EvidenziaStep("Step_1");
	alert("Inserire il codice fiscale o la partita iva!");
	document.getElementById("piva_iscrizione").focus();
	return false;
}
*/
//if ((piva != '' )||(cod_fisc != '' )){

		if (piva != '' ){
		
			if (!IsNumber(piva)){
				VisualizzaStep("Step_1_Sel");
				EvidenziaStep("Step_1");
				alert("La partita iva non e' corretta!");
				document.getElementById("piva_iscrizione").focus();
				return false;
			}

				var k=piva;
				k=k+"x";
				var n=k.indexOf("x");
				if ( n!=11 ){
					VisualizzaStep("Step_1_Sel");
					EvidenziaStep("Step_1");
					alert("La partita iva non e' corretta, controllarne la lunghezza!");
					document.getElementById("piva_iscrizione").focus();		
					return false;
				}				
		
		}


		if (cod_fisc != '' ){
		
				var k2=cod_fisc;
				k2=k2+"y";
				var n2=k2.indexOf("y");
				if ( n2!=16 ){
					VisualizzaStep("Step_1_Sel");
					EvidenziaStep("Step_1");
					alert("Il codice fiscale non e' corretto, controllarne la lunghezza!");
					document.getElementById("cod_fisc").focus();		
					return false;
				}				

		}

//}


if (telefono == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire il telefono !");
	document.getElementById("telefono_iscrizione").focus();
	return false;
}

if (nome == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire il nome!");
	document.getElementById("nome_iscrizione").focus();
	return false;
}

if (cognome == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire il cognome!");
	document.getElementById("cognome_iscrizione").focus();
	return false;
}



if (username == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Inserire indirizzo email - login!");
	document.getElementById("username_form_iscrizione").focus();
	return false;
}


		if (username != ''   ){
				VisualizzaStep("Step_1_Sel");
				EvidenziaStep("Step_1");  
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			//   if(!i.test(what)) { alert("L'indirizzo email inserito non e' valido!"); return false}   
			   if(!i.test(username)) {
			   alert("L'indirizzo email inserito non e' valido!");
			   document.getElementById("username_form_iscrizione").focus();
			   return false;
			}
		}

if (tipologia_operazione!='2'){
				
				if (password == ''   ){
					VisualizzaStep("Step_1_Sel");
					EvidenziaStep("Step_1");
					alert("Inserire la password!");
					document.getElementById("password_form_iscrizione").focus();
					return false;
				}
				
				if (password_2 == ''   ){
					VisualizzaStep("Step_1_Sel");
					EvidenziaStep("Step_1");
					alert("Confermare la password!");
					document.getElementById("password_form_iscrizione_2").focus();
					return false;
				}
				
				if (password == username   ){
					VisualizzaStep("Step_1_Sel");
					EvidenziaStep("Step_1");
					alert("Login e Password non possono essere uguali!");
					document.getElementById("password_form_iscrizione").focus();
					return false;
				}
				
						var password_len = password;
						var Lunghezza_Password=password_len.length;
							if (Lunghezza_Password < 6   ){
								VisualizzaStep("Step_1_Sel");
								EvidenziaStep("Step_1");
								alert("La password deve contenere almeno 6 caratteri!");
							document.getElementById("password_form_iscrizione_2").focus();
							return false;
							}
				
				
				if (password != password_2   ){
					VisualizzaStep("Step_1_Sel");
					EvidenziaStep("Step_1");
					alert("Password errata !\n'Password' deve essere uguale a 'Conferma password'");
					document.getElementById("password_form_iscrizione_2").focus();
					return false;
				}

				
				//------------------------------------------------
				//------------------------------------------------
				//------------------------------------------------
				
				if (document.getElementById("lista_username")!=null){
					
					// CONTROLLO SE LA LOGIN SELEZIONATA ESISTE GIA'
					d = document.getElementById("lista_username").value.split(",");
				
					var agree_username=false;
					var j;
					for(j=0;j<d.length-1;j++){
						if (d[j]==document.getElementById("username_form_iscrizione").value){
							agree_username=true;
						}else{
							agree_username=false;
						}
					}
				
						if (agree_username==true) {
							VisualizzaStep("Step_1_Sel");
							EvidenziaStep("Step_1");
							alert("La login inserita č gia' utilizzata, selezionarne un'altra!");
							document.getElementById("username_form_iscrizione").value="";
							document.getElementById("username_form_iscrizione").focus();
						}	
				
				}
				
				if (document.getElementById("lista_password")!=null){
					
					// CONTROLLO SE LA LOGIN SELEZIONATA ESISTE GIA'
					d = document.getElementById("lista_password").value.split(",");
				
					var agree_password=false;
					var j;
					for(j=0;j<d.length-1;j++){
						if (d[j]==document.getElementById("password_form_iscrizione").value){
							agree_password=true;
						}else{
							agree_password=false;
						}
					}
				
						if (agree_password==true) {
							VisualizzaStep("Step_1_Sel");
							EvidenziaStep("Step_1");
							alert("La password inserita č gia' utilizzata, selezionarne un'altra!");
							document.getElementById("password_form_iscrizione").value="";
							document.getElementById("password_form_iscrizione_2").value="";
							document.getElementById("password_form_iscrizione").focus();
						}	
				
				}
				//------------------------------------------------
				//------------------------------------------------
				//------------------------------------------------

}else{
	
	agree_username = false ;
	agree_password = false ;
	
	}

//------------------------------------------------
// CONTROLLARE CHE SIA SELEZIONATA ALMENO -------- 
// UNA SPECIALITA --------------------------------
//------------------------------------------------

if (document.getElementById("lista_specialita").value == ''   ){
	VisualizzaStep("Step_1_Sel");
	EvidenziaStep("Step_1");
	alert("Selezionare almeno una specialitā !");
	return false;
}

//------------------------------------------------
//------------------------------------------------
//------------------------------------------------

	if ((agree_username == false)&&(agree_password == false)) {

		if (document.getElementById("consenso").checked != true) {
			VisualizzaStep("Step_1_Sel");
			EvidenziaStep("Step_1");
			alert("Per poter continuare e' neccessario acconsentire il trattamento dei dati personali!");
			document.getElementById("consenso").focus();
			return false;
		}
		
			UrlPagina = "?id_pagina=901&Lang="+document.getElementById("Lingua").value
		
			var	postData = "id="+id_utente
			postData = postData + "&abilita=1"
			postData = postData + "&id_categoria=1"
			postData = postData + "&id_nazione="+id_nazione
			postData = postData + "&ragionesociale="+ragionesociale
			postData = postData + "&indirizzo="+indirizzo
			postData = postData + "&cap="+cap
			postData = postData + "&citta="+citta
			postData = postData + "&id_provincia="+id_provincia
			postData = postData + "&nazione_alternativa="+nazionalita_alternativa
			postData = postData + "&piva="+piva
			postData = postData + "&cod_fisc="+cod_fisc
			postData = postData + "&telefono="+telefono
			postData = postData + "&fax="+fax
			postData = postData + "&nome="+nome
			postData = postData + "&cognome="+cognome
			postData = postData + "&sito="+sito
			postData = postData + "&email="+username
			postData = postData + "&username="+username
			postData = postData + "&password="+password
			postData = postData + "&newsletter="+newsletter
			postData = postData + "&note="+note

			postData = postData + "&azione="+azione
			postData = postData + "&tipologia_operazione="+tipologia_operazione
			
			postData = postData + "&lun_m_da="+lun_m_da
			postData = postData + "&lun_m_a="+lun_m_a
			postData = postData + "&lun_p_da="+lun_p_da
			postData = postData + "&lun_p_a="+lun_p_a

			postData = postData + "&mar_m_da="+mar_m_da
			postData = postData + "&mar_m_a="+mar_m_a
			postData = postData + "&mar_p_da="+mar_p_da
			postData = postData + "&mar_p_a="+mar_p_a

			postData = postData + "&mer_m_da="+mer_m_da
			postData = postData + "&mer_m_a="+mer_m_a
			postData = postData + "&mer_p_da="+mer_p_da
			postData = postData + "&mer_p_a="+mer_p_a

			postData = postData + "&gio_m_da="+gio_m_da
			postData = postData + "&gio_m_a="+gio_m_a
			postData = postData + "&gio_p_da="+gio_p_da
			postData = postData + "&gio_p_a="+gio_p_a

			postData = postData + "&ven_m_da="+ven_m_da
			postData = postData + "&ven_m_a="+ven_m_a
			postData = postData + "&ven_p_da="+ven_p_da
			postData = postData + "&ven_p_a="+ven_p_a

			/**** AGGIUNGO LA LISTA DELLE SPECILITA SELEZIONATE *****/
			postData = postData +document.getElementById("lista_specialita").value
			/********************************************************/

			/**** ID DELLE DESTINAZIONE ALTERNATIVA ***********************/
			/**** SE = '' ALLORA PRENDO I DATI PRINCIPALI DELL'UTENTE *****/
			postData = postData + "&id_destinazione_alternativa="+id_destinazione_alternativa
			/********************************************************/
			
			postData = postData + "&id_destinazione="+id_destinazione
			postData = postData + "&id_nazione_destinazione="+id_nazione_destinazione
			postData = postData + "&ragionesociale_destinazione="+ragionesociale_destinazione
			postData = postData + "&indirizzo_destinazione="+indirizzo_destinazione
			postData = postData + "&cap_destinazione="+cap_destinazione
			postData = postData + "&citta_destinazione="+citta_destinazione
			postData = postData + "&id_provincia_destinazione="+id_provincia_destinazione
			postData = postData + "&nazione_alternativa_destinazione="+nazionalita_alternativa_destinazione
			postData = postData + "&telefono_destinazione="+telefono_destinazione
			postData = postData + "&fax_destinazione="+fax_destinazione
			postData = postData + "&nome_destinazione="+nome_destinazione
			postData = postData + "&cognome_destinazione="+cognome_destinazione
			postData = postData + "&sito_destinazione="+sito_destinazione
			postData = postData + "&note_destinazione="+note_destinazione

			postData = postData + "&lun_m_da_destinazione="+lun_m_da_destinazione
			postData = postData + "&lun_m_a_destinazione="+lun_m_a_destinazione
			postData = postData + "&lun_p_da_destinazione="+lun_p_da_destinazione
			postData = postData + "&lun_p_a_destinazione="+lun_p_a_destinazione

			postData = postData + "&mar_m_da_destinazione="+mar_m_da_destinazione
			postData = postData + "&mar_m_a_destinazione="+mar_m_a_destinazione
			postData = postData + "&mar_p_da_destinazione="+mar_p_da_destinazione
			postData = postData + "&mar_p_a_destinazione="+mar_p_a_destinazione

			postData = postData + "&mer_m_da_destinazione="+mer_m_da_destinazione
			postData = postData + "&mer_m_a_destinazione="+mer_m_a_destinazione
			postData = postData + "&mer_p_da_destinazione="+mer_p_da_destinazione
			postData = postData + "&mer_p_a_destinazione="+mer_p_a_destinazione

			postData = postData + "&gio_m_da_destinazione="+gio_m_da_destinazione
			postData = postData + "&gio_m_a_destinazione="+gio_m_a_destinazione
			postData = postData + "&gio_p_da_destinazione="+gio_p_da_destinazione
			postData = postData + "&gio_p_a_destinazione="+gio_p_a_destinazione

			postData = postData + "&ven_m_da_destinazione="+ven_m_da_destinazione
			postData = postData + "&ven_m_a_destinazione="+ven_m_a_destinazione
			postData = postData + "&ven_p_da_destinazione="+ven_p_da_destinazione
			postData = postData + "&ven_p_a_destinazione="+ven_p_a_destinazione

			postData = postData + "&provenienza=no-outlook"

			if (document.getElementById("Step")!=null){
				postData = postData + "&Step="+document.getElementById("Step").value
			}

			/**** NOTE CARRELLO UTENTE NON REGISTRATO **********************/
			postData = postData + "&note_carrello="+note_carrello
			/**************************************************************/

			postData = postData + "&modalita_pagamento="+modalita_pagamento

			postData = postData.replace(/ /g,"%20");

			var agree=confirm("Confermare i dati inseriti e procedere con l'invio della richiesta ?");
			
			if (agree == true){

				/*---- DATI PER PAYPAL --------*/
				
				if (document.getElementById("modalita_pagamento").value=='1'){
					
					postData_Pay_Pal = ""
					postData_Pay_Pal = postData_Pay_Pal + "?cmd="+document.getElementById("cmd").value;
					postData_Pay_Pal = postData_Pay_Pal + "&business="+document.getElementById("business").value;
					postData_Pay_Pal = postData_Pay_Pal + "&item_name="+document.getElementById("item_name").value;
					postData_Pay_Pal = postData_Pay_Pal + "&currency_code="+document.getElementById("currency_code").value;
					postData_Pay_Pal = postData_Pay_Pal + "&amount="+document.getElementById("amount").value;
					postData_Pay_Pal = postData_Pay_Pal.replace(/ /g,"%20");
	
					window.open('https://www.paypal.com/it/cgi-bin/webscr/'+postData_Pay_Pal+'','PayPal','');
				}
				
				/*-----------------------------*/

				xmlHttp.open("POST", "iscrizione.asp"+UrlPagina, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", postData.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.onreadystatechange = handleStateChangeNoImageArea;
				xmlHttp.send(postData);
		
			}
			
	}
	
	
	
}


function handleStateChangeNoImageArea(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
			
				document.getElementById("Contenuto_Pagina").innerHTML = xmlHttp.responseText;
				
//				if (document.getElementById("Step")!=null){

					Visualizza_Carrello_Aggiornato_No_Loggato();
//				}

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Contenuto_Pagina").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Contenuto_Pagina").innerHTML = Immagine_Preload;
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/










/*-----------------------------------------------*/
/*- ACCESSO DA INDEX.ASP ------------------------*/
/*- utente registrato con login e password ------*/
/*-----------------------------------------------*/

function Check_Accedi_Area_Interna(){

if (document.getElementById("username").value == ''   ){
	alert("Inserire indirizzo email !");
	document.getElementById("username").focus();
	return false;
}

		if (document.getElementById("username").value != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(document.getElementById("username").value)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   document.getElementById("username").focus();
			   return false;
			}
		}

if (document.getElementById("password").value == ''   ){
	alert("Inserire la password !");
	document.getElementById("password").focus();
	return false;
}





//------------------------------------------------
//------------------------------------------------
//------------------------------------------------

if (document.getElementById("campo_tot") != null){
	
	d = document.getElementById("campo_tot").value.split(",");

	var agree_accesso=false;
	var j;
	for(j=0;j<d.length-1;j++){

		if ( d[j] == (  document.getElementById("username").value + "|" + document.getElementById("password").value  )){
			agree_accesso=true;
		}
		
	}

			if (agree_accesso==false) {
				
				document.getElementById("username").value = "" ;
				document.getElementById("password").value = "" ;
				
				alert("Accesso negato !\nLogin o password errati.");
				
			}

}

//------------------------------------------------
//------------------------------------------------
//------------------------------------------------

	if (agree_accesso == true){
		
		UrlPagina = "?id_pagina=100"
		UrlPagina = UrlPagina + "&SessionContr="+document.getElementById("id_session_accesso").value
		UrlPagina = UrlPagina + "&Lang="+document.getElementById("Lingua").value
		
		postData = "username="+document.getElementById("username").value
		postData = postData + "&password="+document.getElementById("password").value
		
		postData = postData.replace(" ","%20");
		
		xmlHttp.open("POST", "content.asp"+UrlPagina, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", postData.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.onreadystatechange = handleStateChangeAccessoInterna;
		xmlHttp.send(postData);
		
	}
	
}


function handleStateChangeAccessoInterna(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

Caricamento = "";
Caricamento = Caricamento + "<table border='0' cellpadding='0' cellspacing='0' style='margin-top:8px; width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Caricamento = Caricamento + "  <tr><td>"
Caricamento = Caricamento + "<center>loading ...</center>"
Caricamento = Caricamento + "  </td></tr>"
Caricamento = Caricamento + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				

				document.getElementById("Contenuto_Pagina").innerHTML = xmlHttp.responseText;
				
			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Contenuto_Pagina").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Contenuto_Pagina").innerHTML = Caricamento
		}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/








function Check_Accedi_Area_Semplice(){
			
username = document.getElementById("username").value;
password = document.getElementById("password").value;

if (username == ''   ){
	alert("Inserire indirizzo email !");
	document.getElementById("username").focus();
	return false;
}

		if (username != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(username)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   document.getElementById("username").focus();
			   return false;
			}
		}


if (password == ''   ){
	alert("Inserire password !");
	document.getElementById("password").focus();
	return false;
}


//------------------------------------------------
//------------------------------------------------
//------------------------------------------------

if (document.getElementById("campo_tot") != null){
	
	d = document.getElementById("campo_tot").value.split(",");

	var agree_accesso=false;
	var j;
	for(j=0;j<d.length-1;j++){
		if ( d[j] == (  document.getElementById("username").value + "|" + document.getElementById("password").value  )){
			agree_accesso=true;
		}
	}

			if (agree_accesso==false) {

				document.getElementById("username").value = "" ;
				document.getElementById("password").value = "" ;
				alert("Accesso negato !\nLogin o Password errati.");
				
			}

}

//------------------------------------------------
//------------------------------------------------
//------------------------------------------------

	if (agree_accesso == true){
	
				UrlPagina = "?id_pagina=100"
				UrlPagina = UrlPagina + "&SessionContr="+document.getElementById("id_session_accesso").value
				UrlPagina = UrlPagina + "&Lang="+document.getElementById("Lingua").value
				
				postData = "username="+document.getElementById("username").value
				postData = postData + "&password="+document.getElementById("password").value
				
				postData = postData.replace(" ","%20");
				
				xmlHttp.open("POST", "login.asp"+UrlPagina, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", postData.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.onreadystatechange = handleStateChangeAccesso;
				xmlHttp.send(postData);

	}
	
}















function Check_Accedi_Area(){
			
username = document.getElementById("username").value;
password = document.getElementById("password").value;

if (username == ''   ){
	alert("Inserire indirizzo email !");
	document.getElementById("username").focus();
	return false;
}

		if (username != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(username)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   document.getElementById("username").focus();
			   return false;
			}
		}


if (password == ''   ){
	alert("Inserire password !");
	document.getElementById("password").focus();
	return false;
}

if (document.getElementById("articoli_carrello_count").value < 1) {

	// ARTICOLI NON PRESENTI IN CARRELLO
	
				UrlPagina = "?id_pagina=100"
				UrlPagina = UrlPagina + "&SessionContr="+document.getElementById("id_session_accesso").value
				UrlPagina = UrlPagina + "&Lang="+document.getElementById("Lingua").value
			
				postData = "username="+document.getElementById("username").value
				postData = postData + "&password="+document.getElementById("password").value
				postData = postData + "&articoli_carrello_count="+document.getElementById("articoli_carrello_count").value
				
				postData = postData.replace(" ","%20");

				xmlHttp.open("POST", "login.asp"+UrlPagina, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", postData.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.onreadystatechange = handleStateChangeAccesso;
				xmlHttp.send(postData);
}else{
	
	// ARTICOLI PRESENTI IN CARRELLO
	
				UrlPagina = "?id_pagina=100"
				UrlPagina = UrlPagina + "&SessionContr="+document.getElementById("id_session_accesso").value
				UrlPagina = UrlPagina + "&Lang="+document.getElementById("Lingua").value
			
				postData = "username="+document.getElementById("username").value
				postData = postData + "&password="+document.getElementById("password").value
				postData = postData + "&articoli_carrello_count="+document.getElementById("articoli_carrello_count").value
			
				postData = postData.replace(" ","%20");
	
				xmlHttp.open("POST", "login.asp"+UrlPagina, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", postData.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.onreadystatechange = handleStateChangeAccesso;
				xmlHttp.send(postData);
	
	}	

}



function Check_Accedi_Area_Pop_Up(){

username = document.getElementById("username_pop").value;
password = document.getElementById("password_pop").value;

if (username == ''   ){
	alert("Inserire indirizzo email !");
	document.getElementById("username_pop").focus();
	return false;
}

		if (username != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(username)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   document.getElementById("username_pop").focus();
			   return false;
			}
		}


if (password == ''   ){
	alert("Inserire password !");
	document.getElementById("password_pop").focus();
	return false;
}

	UrlPagina = "?id_pagina=100"
	UrlPagina = UrlPagina + "&SessionContr="+document.getElementById("id_session_accesso").value
	UrlPagina = UrlPagina + "&Lang="+document.getElementById("Lingua").value

	postData = "username="+document.getElementById("username_pop").value
	postData = postData + "&password="+document.getElementById("password_pop").value

	postData = postData.replace(" ","%20");

	xmlHttp.open("POST", "login.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChangeAccesso;
	xmlHttp.send(postData);

}

function handleStateChangeAccesso(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

Caricamento = "";
Caricamento = Caricamento + "<table border='0' cellpadding='0' cellspacing='0' style='margin-top:8px; width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Caricamento = Caricamento + "  <tr><td>"
Caricamento = Caricamento + "<center>loading ...</center>"
Caricamento = Caricamento + "  </td></tr>"
Caricamento = Caricamento + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				

				document.getElementById("TabellaLogin").innerHTML = xmlHttp.responseText;
				
				// ACCESSO EFFETTUATO DA POP UP
				if (document.getElementById("controllo_pop_up")!=null){
					var ElementoNascosto = document.getElementById("Effettuare_Login_0");
					ElementoNascosto.style.display = "none"; 

					var ElementoNascosto = document.getElementById("Effettuare_Login");
					ElementoNascosto.style.display = "none"; 
				}

/*

				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU ALLORA CARICO LA PAGINA
				//---------------------------------------------------------------
				Id_Pagina = document.getElementById("id_pagina_controllo").value;
				Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
				Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
				Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
				Id_News = document.getElementById("id_news").value;
				Id_Categoria_News = document.getElementById("id_categoria_news").value;
				
				TitoloPaginaNew = document.title;
				Lang = document.getElementById("Lingua").value;

				var Id_Categoria = "";
				var Id_Categoria_2 = "";
				var Id_Categoria_3 = "";
				var Id_Categoria_4 = "";
				var Id_Prodotto = "";

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				UrlPagina = ""
				UrlPagina = UrlPagina + "?id_pagina="+Id_Pagina
				UrlPagina = UrlPagina + "&id_pagina_2="+Id_Pagina_2
				UrlPagina = UrlPagina + "&id_pagina_3="+Id_Pagina_3
				UrlPagina = UrlPagina + "&id_pagina_4="+Id_Pagina_4
				UrlPagina = UrlPagina + "&Lang="+Lang+"&id_email="+document.getElementById("id_email").value
				UrlPagina = UrlPagina + "&id_categoria="+Id_Categoria
				UrlPagina = UrlPagina + "&id_categoria_2="+Id_Categoria_2
				UrlPagina = UrlPagina + "&id_categoria_3="+Id_Categoria_3
				UrlPagina = UrlPagina + "&id_categoria_4="+Id_Categoria_4
				UrlPagina = UrlPagina + "&id_prodotto="+Id_Prodotto
				UrlPagina = UrlPagina + "&id_categoria_news="+Id_Categoria_News
				UrlPagina = UrlPagina + "&id_news="+Id_News


				if (document.getElementById("tabella_origine") !=null) {
					UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
				}


				CaricaPaginaNoImage(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);

*/
				
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("TabellaLogin").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("TabellaLogin").innerHTML = Caricamento
		}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/






/*-----------------------------------------------*/
/*----------- LOGOUT ----------------------------*/
/*-----------------------------------------------*/
/*
function ApriPopUpInfo(
						  Id_Pagina,
						  Id_Pagina_2,
						  Id_Pagina_3,
						  Id_Pagina_4,
						  Lang,
						  UrlPagina,
						  Id_Categoria,
						  Id_Categoria_2,
						  Id_Categoria_3,
						  Id_Categoria_4,
						  Id_Prodotto,
						  TitoloPaginaNew,
						  Id_News,
						  Id_Categoria_News
					   ){
		
	
	if (document.getElementById("id_utente_accesso").value == ''){
		document.getElementById("DivInfoOpaco").style.display = 'block';
		document.getElementById("DivInfo").style.display = 'block';
	}else{

	document.title = TitoloPaginaNew ;
	

	var	postData = ""

		xmlHttp.open("POST", "content.asp"+UrlPagina, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", postData.length);
		xmlHttp.setRequestHeader("Connection", "close");
		xmlHttp.onreadystatechange = handleStateChangeNoImageCerca;
		xmlHttp.send(postData);


	}
	
}
*/


function ChiudiPopUpInfo(){
	
	
		document.getElementById("DivInfoOpaco").style.display = 'none';
		document.getElementById("DivInfo").style.display = 'none';
	
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*----------- LOGOUT ----------------------------*/
/*-----------------------------------------------*/

function Check_Logout(){

createXMLHttpRequest();

		UrlPagina = "?id_pagina=102"
		UrlPagina = UrlPagina + "&Lang="+document.getElementById("Lingua").value
		UrlPagina = UrlPagina + "&id_utente="
		
		xmlHttp.onreadystatechange = handleStateChangeLogout;
		xmlHttp.open("GET", "login.asp"+UrlPagina, true);
		xmlHttp.send(null);

}

function handleStateChangeLogout(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"

Caricamento = "";
Caricamento = Caricamento + "<table border='0' cellpadding='0' cellspacing='0' style='margin-top:8px; width:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Caricamento = Caricamento + "  <tr><td>"
Caricamento = Caricamento + "<center>loading ...</center>"
Caricamento = Caricamento + "  </td></tr>"
Caricamento = Caricamento + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				

				document.getElementById("TabellaLogin").innerHTML = xmlHttp.responseText;
				
				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU ALLORA CARICO LA PAGINA
				//---------------------------------------------------------------
/*				Id_Pagina = document.getElementById("id_pagina_controllo").value;*/
				Id_Pagina = ""
				Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
				Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
				Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
				Id_News = document.getElementById("id_news").value;
				Id_Categoria_News = document.getElementById("id_categoria_news").value;
				
				TitoloPaginaNew = document.getElementById("titolo_pagina_logout").value;
				Lang = document.getElementById("Lingua").value;

				var Id_Categoria = "";
				var Id_Categoria_2 = "";
				var Id_Categoria_3 = "";
				var Id_Categoria_4 = "";
				var Id_Prodotto = "";

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				UrlPagina = ""
				UrlPagina = UrlPagina + "?id_pagina="
				UrlPagina = UrlPagina + "&id_pagina_2="
				UrlPagina = UrlPagina + "&id_pagina_3="
				UrlPagina = UrlPagina + "&id_pagina_4="
				UrlPagina = UrlPagina + "&Lang="+Lang+"&id_email="+document.getElementById("id_email").value
				UrlPagina = UrlPagina + "&id_categoria="+Id_Categoria
				UrlPagina = UrlPagina + "&id_categoria_2="+Id_Categoria_2
				UrlPagina = UrlPagina + "&id_categoria_3="+Id_Categoria_3
				UrlPagina = UrlPagina + "&id_categoria_4="+Id_Categoria_4
				UrlPagina = UrlPagina + "&id_prodotto="+Id_Prodotto
				UrlPagina = UrlPagina + "&id_categoria_news="+Id_Categoria_News
				UrlPagina = UrlPagina + "&id_news="+Id_News


				if (document.getElementById("tabella_origine") !=null) {
					UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
				}


//				alert(UrlPagina);

	

//				CaricaPagina(
				CaricaPaginaNoImage(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);
				
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

				// ACCESSO EFFETTUATO DA POP UP
				if (document.getElementById("controllo_pop_up")!=null){
					var ElementoNascosto = document.getElementById("Effettuare_Login_0");
					ElementoNascosto.style.display = "none";
					
					var ElementoNascosto = document.getElementById("Effettuare_Login");
					ElementoNascosto.style.display = "none"; 
				}

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("TabellaLogin").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("TabellaLogin").innerHTML = Caricamento
		}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/








/*-------------------------------------------------------------------------------*/
/*------------ FUNZIONE PER CALCOLO POSIZIONAMENTO ZOOM IMMAGINE ----------------*/
/*-------------------------------------------------------------------------------*/

function getY(oElement){
  var iReturnValue = 0;
  while( oElement != null ) {
    iReturnValue += oElement.offsetTop;
    oElement = oElement.offsetParent;
  }
return iReturnValue;
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-------------------------------------------------------------------*/
/*------------ CARICAMENTO BOX ISCRIZIONE NEWSLETTER ----------------*/
/*-------------------------------------------------------------------*/

function CaricaIscrizioneNewsletter(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
					  ){

	createXMLHttpRequest();

	document.title = TitoloPaginaNew;
	document.getElementById("id_pagina_controllo").value = Id_Pagina;
	document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
	document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
	document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

	document.getElementById("id_news").value = Id_News;
	document.getElementById("id_categoria_news").value = Id_Categoria_News;


	document.getElementById("Lingua").value = Lang;

	xmlHttp.onreadystatechange = handleStateChangeBoxNewsletter;
	xmlHttp.open("GET", "top_newsletter.asp"+UrlPagina, true);
	xmlHttp.send(null);

}

function handleStateChangeBoxNewsletter(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				

				document.getElementById("Top_Newsletter").innerHTML = xmlHttp.responseText;


				//----------------------------------------------------------------
				// --- SE PRESENTE DIV NEWSLETTER CARICO LE NEWS DELLA PAGINA DOPO
				//----------------------------------------------------------------

				if (document.getElementById("News_Home") !=null) {

						Id_Pagina = document.getElementById("id_pagina_controllo").value;
						Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
						Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
						Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
						Id_News = document.getElementById("id_news").value;
						Id_Categoria_News = document.getElementById("id_categoria_news").value;
						
						TitoloPaginaNew = document.title;
						Lang = document.getElementById("Lingua").value;
		
						var Id_Categoria = "";
						var Id_Categoria_2 = "";
						var Id_Categoria_3 = "";
						var Id_Categoria_4 = "";
						var Id_Prodotto = "";
		
						if (document.getElementById("id_categoria") !=null) {
							Id_Categoria = document.getElementById("id_categoria").value;
							Id_Categoria_2 = document.getElementById("id_categoria_2").value;
							Id_Categoria_3 = document.getElementById("id_categoria_3").value;
							Id_Categoria_4 = document.getElementById("id_categoria_4").value;
							Id_Prodotto = document.getElementById("id_prodotto").value;
						}
		
						UrlPagina = ""
						UrlPagina = UrlPagina + "?id_pagina="+Id_Pagina
						UrlPagina = UrlPagina + "&id_pagina_2="+Id_Pagina_2
						UrlPagina = UrlPagina + "&id_pagina_3="+Id_Pagina_3
						UrlPagina = UrlPagina + "&id_pagina_4="+Id_Pagina_4
						UrlPagina = UrlPagina + "&Lang="+Lang+"&id_email="+document.getElementById("id_email").value
						UrlPagina = UrlPagina + "&id_categoria="+Id_Categoria
						UrlPagina = UrlPagina + "&id_categoria_2="+Id_Categoria_2
						UrlPagina = UrlPagina + "&id_categoria_3="+Id_Categoria_3
						UrlPagina = UrlPagina + "&id_categoria_4="+Id_Categoria_4
						UrlPagina = UrlPagina + "&id_prodotto="+Id_Prodotto
						UrlPagina = UrlPagina + "&id_categoria_news="+Id_Categoria_News
						UrlPagina = UrlPagina + "&id_news="+Id_News
		
		
						if (document.getElementById("tabella_origine") !=null) {
							UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
						}
						
						CaricaNews(
							  Id_Pagina,
							  Id_Pagina_2,
							  Id_Pagina_3,
							  Id_Pagina_4,
							  Lang,
							  UrlPagina,
							  Id_Categoria,
							  Id_Categoria_2,
							  Id_Categoria_3,
							  Id_Categoria_4,
							  Id_Prodotto,
							  TitoloPaginaNew,
							  Id_News,
							  Id_Categoria_News
						);

				}

				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------




			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Top_Newsletter").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Top_Newsletter").innerHTML = Immagine_Preload
		}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*--------------------------------------------------------------*/
/*------------ CARICAMENTO PAGINA SENZA IMMAGINI ---------------*/
/*--------------------------------------------------------------*/

function CaricaPaginaNoImage(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
					  ){

	createXMLHttpRequest();

	document.title = TitoloPaginaNew;
	document.getElementById("id_pagina_controllo").value = Id_Pagina;
	document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
	document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
	document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

	document.getElementById("id_news").value = Id_News;
	document.getElementById("id_categoria_news").value = Id_Categoria_News;


	document.getElementById("Lingua").value = Lang;

	xmlHttp.onreadystatechange = handleStateChangeNoImage;
	xmlHttp.open("GET", "content.asp"+UrlPagina, true);
	xmlHttp.send(null);

}

function handleStateChangeNoImage(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
			
				document.getElementById("Contenuto_Pagina").innerHTML = xmlHttp.responseText;

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Contenuto_Pagina").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Contenuto_Pagina").innerHTML = Immagine_Preload;
		}

}

/*----------------------------------------------------------*/
/*----------------------------------------------------------*/
/*----------------------------------------------------------*/


/*--------------------------------------------------------------*/
/*------------ CARICAMENTO PAGINA PRODOTTI ---------------------*/
/*--------------------------------------------------------------*/

function CaricaPaginaProdotti(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
					  ){

	createXMLHttpRequest();

	document.title = TitoloPaginaNew;
	document.getElementById("id_pagina_controllo").value = Id_Pagina;
	document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
	document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
	document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

	document.getElementById("id_news").value = Id_News;
	document.getElementById("id_categoria_news").value = Id_Categoria_News;


	document.getElementById("Lingua").value = Lang;

	xmlHttp.onreadystatechange = handleStateChangeProdotti;
	xmlHttp.open("GET", "lista_prodotti.asp"+UrlPagina, true);
	xmlHttp.send(null);

}

function handleStateChangeProdotti(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
			
				document.getElementById("Content_Prodotti").innerHTML = xmlHttp.responseText;

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Content_Prodotti").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Content_Prodotti").innerHTML = Immagine_Preload;
		}

}

/*----------------------------------------------------------*/
/*----------------------------------------------------------*/
/*----------------------------------------------------------*/

/*----------------------------------------------------------*/
/*------ CANCELLAZIONE PAGINA DESTINAZIONI -----------------*/
/*----------------------------------------------------------*/

function CaricaPaginaDestinazioni(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
					  ){

	createXMLHttpRequest();

	document.title = TitoloPaginaNew;
	document.getElementById("id_pagina_controllo").value = Id_Pagina;
	document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
	document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
	document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

	document.getElementById("id_news").value = Id_News;
	document.getElementById("id_categoria_news").value = Id_Categoria_News;


	document.getElementById("Lingua").value = Lang;

			xmlHttp.onreadystatechange = handleStateChangeDestinazioni;
			xmlHttp.open("GET", "content.asp"+UrlPagina, true);
			xmlHttp.send(null);

}

function handleStateChangeDestinazioni(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
			
				document.getElementById("Contenuto_Pagina").innerHTML = xmlHttp.responseText;

					VisualizzaStep("Step_3_Sel");
					EvidenziaStep("Step_3");

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Contenuto_Pagina").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Contenuto_Pagina").innerHTML = Immagine_Preload;
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*----------------------------------------------------------*/
/*------ CANCELLAZIONE PAGINA DESTINAZIONI -----------------*/
/*----------------------------------------------------------*/

function CaricaPaginaCancellaDestinazioni(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
					  ){

	createXMLHttpRequest();

	document.title = TitoloPaginaNew;
	document.getElementById("id_pagina_controllo").value = Id_Pagina;
	document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
	document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
	document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

	document.getElementById("id_news").value = Id_News;
	document.getElementById("id_categoria_news").value = Id_Categoria_News;


	document.getElementById("Lingua").value = Lang;

		var agree=confirm("Eliminare la destinazione selezionata ?");
		
		if (agree == true){

				xmlHttp.onreadystatechange = handleStateChangeDestinazioni;
				xmlHttp.open("GET", "iscrizione.asp"+UrlPagina, true);
				xmlHttp.send(null);
		}
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*--------------------------------------------------------*/
/*------------ CARICAMENTO IMMAGINI PAGINA ---------------*/
/*--------------------------------------------------------*/

function CaricaImmagini(
						Id_Pagina,
						Id_Pagina_2,
						Id_Pagina_3,
						Id_Pagina_4,
						Lang,
						UrlPagina,
						TitoloPaginaNew,
						Larghezza,
						Altezza,
						Tipo_File_Ajax,
						Tabella_Padre,
						Id_Padre,
						Id_Immagine_Ajax
						){

if (Larghezza==''){
	Larghezza = document.getElementById("larghezza_immagine").value;
}

if (Altezza==''){
	Altezza = document.getElementById("altezza_immagine").value;
}


		Immagine = "";
		Immagine = Immagine + "<iframe "
		Immagine = Immagine + "src='immagini.asp?id_padre="+Id_Padre+"&Tabella_Padre="+Tabella_Padre+"&Larghezza="+Larghezza+"&Altezza="+Altezza+"&Tipo_File_Ajax="+Tipo_File_Ajax+"&Id_Immagine_Ajax="+Id_Immagine_Ajax+"' "
		Immagine = Immagine + "width='"+Larghezza+"' Height='"+Altezza+"' "
		Immagine = Immagine + "scrolling='no' frameborder='0'>"
		Immagine = Immagine + "</iframe>"
	
		document.getElementById("Immagini_Pagina_Ajax").innerHTML = Immagine

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*--------------------------------------------------------*/
/*------------ CARICAMENTO NEWS HOME PAGE ----------------*/
/*--------------------------------------------------------*/

function CaricaNews(
						Id_Pagina,
						Id_Pagina_2,
						Id_Pagina_3,
						Id_Pagina_4,
						Lang,
						UrlPagina,
						TitoloPaginaNew,
						Larghezza,
						Altezza,
						Tipo_File_Ajax,
						Tabella_Padre,
						Id_Padre,
						Id_Immagine_Ajax
						){

	createXMLHttpRequest();

//	document.title = TitoloPaginaNew;
	document.getElementById("id_pagina_controllo").value = Id_Pagina;
	document.getElementById("id_pagina_controllo_2").value = Id_Pagina_2;
	document.getElementById("id_pagina_controllo_3").value = Id_Pagina_3;
	document.getElementById("id_pagina_controllo_4").value = Id_Pagina_4;

	document.getElementById("id_news").value = Id_News;
	document.getElementById("id_categoria_news").value = Id_Categoria_News;


	document.getElementById("Lingua").value = Lang;

	xmlHttp.onreadystatechange = handleStateChangeCaricaNews;
	xmlHttp.open("GET", "news.asp"+UrlPagina, true);
	xmlHttp.send(null);

}

function handleStateChangeCaricaNews(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
			
				document.getElementById("News_Home").innerHTML = xmlHttp.responseText;

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("News_Home").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("News_Home").innerHTML = Immagine_Preload;
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ MOTORE DI RICERCA ----------------*/
/*-----------------------------------------------*/

function Cerca_Libera(UrlPagina,TitoloPagina){

if (document.getElementById("cerca").value == ''   ){
	alert("Inserire chiave di ricerca !");
	document.getElementById("cerca").focus();
	return false;
}

	document.title = TitoloPagina;

	var postData = "cerca="+document.getElementById("cerca").value;	
	postData = postData.replace(/ /g,"%20");

	document.getElementById("cerca").value = "";

	xmlHttp.open("POST", "content.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChangeNoImageCerca;
	xmlHttp.send(postData);

}


function Cerca_Specialita(UrlPagina){

	var postData = "id_specialita="+document.getElementById("id_specialita").value;	

//alert(postData);

	xmlHttp.open("POST", "content.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChangeNoImageCerca;
	xmlHttp.send(postData);

}

function handleStateChangeNoImageCerca(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
			
				document.getElementById("Contenuto_Pagina").innerHTML = xmlHttp.responseText;



				//---------------------------------------------------------------
				// --- QUANDO FINISCO DI CARICARE IL MENU ALLORA CARICO LA PAGINA
				//---------------------------------------------------------------
				Id_Pagina = document.getElementById("id_pagina_controllo").value;
				Id_Pagina_2 = document.getElementById("id_pagina_controllo_2").value;
				Id_Pagina_3 = document.getElementById("id_pagina_controllo_3").value;
				Id_Pagina_4 = document.getElementById("id_pagina_controllo_4").value;
				Id_News = document.getElementById("id_news").value;
				Id_Categoria_News = document.getElementById("id_categoria_news").value;
				
				TitoloPaginaNew = document.title;
				Lang = document.getElementById("Lingua").value;

				var Id_Categoria = "";
				var Id_Categoria_2 = "";
				var Id_Categoria_3 = "";
				var Id_Categoria_4 = "";
				var Id_Prodotto = "";

				if (document.getElementById("id_categoria") !=null) {
					Id_Categoria = document.getElementById("id_categoria").value;
					Id_Categoria_2 = document.getElementById("id_categoria_2").value;
					Id_Categoria_3 = document.getElementById("id_categoria_3").value;
					Id_Categoria_4 = document.getElementById("id_categoria_4").value;
					Id_Prodotto = document.getElementById("id_prodotto").value;
				}

				UrlPagina = ""
				UrlPagina = UrlPagina + "?id_pagina="
				UrlPagina = UrlPagina + "&id_pagina_2="
				UrlPagina = UrlPagina + "&id_pagina_3="
				UrlPagina = UrlPagina + "&id_pagina_4="
				UrlPagina = UrlPagina + "&Lang="+Lang
				UrlPagina = UrlPagina + "&id_categoria="
				UrlPagina = UrlPagina + "&id_categoria_2="
				UrlPagina = UrlPagina + "&id_categoria_3="
				UrlPagina = UrlPagina + "&id_categoria_4="
				UrlPagina = UrlPagina + "&id_prodotto="
				UrlPagina = UrlPagina + "&id_categoria_news="
				UrlPagina = UrlPagina + "&id_news="


				if (document.getElementById("tabella_origine") !=null) {
					UrlPagina = UrlPagina + "&tabella_origine="+document.getElementById("tabella_origine").value
				}


				CaricaMenu_2_NoImage_No_Pagina(
					  Id_Pagina,
					  Id_Pagina_2,
					  Id_Pagina_3,
					  Id_Pagina_4,
					  Lang,
					  UrlPagina,
					  Id_Categoria,
					  Id_Categoria_2,
					  Id_Categoria_3,
					  Id_Categoria_4,
					  Id_Prodotto,
					  TitoloPaginaNew,
					  Id_News,
					  Id_Categoria_News
				);

		
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Contenuto_Pagina").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Contenuto_Pagina").innerHTML = Immagine_Preload;
		}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ MOTORE DI RICERCA ----------------*/
/*-----------------------------------------------*/

function Cerca_Prodotto(UrlPagina,TitoloPagina){

	document.title = TitoloPagina;

	var postData = ""
	postData = postData + "cerca_gen="+document.getElementById("cerca_gen").value;
	postData = postData + "&marca="+document.getElementById("marca").value;

//  alert(postData);

	UrlPagina = UrlPagina + "&visualizza_risultati=1"
	
/*	
	alert(postData);
*/

	postData = postData.replace(/ /g,"%20");

	xmlHttp.open("POST", "content.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChangeNoImageCerca;
	xmlHttp.send(postData);

}

function handleStateChangeNoImageCerca(){

Messaggio = "";
Messaggio = Messaggio + "<table border='0' cellpadding='0' cellspacing='0' style='width:100%; height:100%; FONT-SIZE: 11px;COLOR: #000000; FONT-FAMILY: Trebuchet MS, Verdana;'>"
Messaggio = Messaggio + "  <tr><td  style='padding-top:25px;'>"
Messaggio = Messaggio + "<center>Impossibile caricare la pagina richiesta ....</center>"
Messaggio = Messaggio + "  </td></tr>"
Messaggio = Messaggio + "</table>"


		// if xmlHttp shows "loaded"
		if (xmlHttp.readyState == 4){

			if (xmlHttp.status == 200){				
			
				document.getElementById("Contenuto_Pagina").innerHTML = xmlHttp.responseText;

					if ((document.getElementById("Step_2") != null)&&(document.getElementById("Step_2_Sel") != null)){
							VisualizzaStep("Step_2_Sel");
							EvidenziaStep("Step_2");
					}
	
				//---------------------------------------------------------------
				//---------------------------------------------------------------
				//---------------------------------------------------------------

			}else{	

				// INTERCETTO ERRORE E VISUALIZZO
				handleErrFullPage(xmlHttp.responseText);
				//-------------------------------
				
				document.getElementById("Contenuto_Pagina").innerHTML = Messaggio;
			}
		
		}else{
				document.getElementById("Contenuto_Pagina").innerHTML = Immagine_Preload;
		}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*--------------------------------------------------------*/
/*------------ ZOOM FOTOGALLERY --------------------------*/
/*--------------------------------------------------------*/

function CambiaImmagine(
						Elemento,
						Immagine_New,
						Id_Immagine
						){

document.getElementById(Elemento).src = Immagine_New;

	Div_Zoom = ""
	Div_Zoom = Div_Zoom + "<img "
	Div_Zoom = Div_Zoom + "style=cursor:pointer;margin-top:10px;margin-right:10px; "
	Div_Zoom = Div_Zoom + "src=BANNER/zoom.jpg "
	Div_Zoom = Div_Zoom + " onClick=\""
	Div_Zoom = Div_Zoom + "document.getElementById(\'Foto_"+Id_Immagine+"\').style.display = \'block\'"
	Div_Zoom = Div_Zoom + " \">"

document.getElementById("Zoom_Immagine_Photogallery").innerHTML = Div_Zoom
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*--------------------------------------------------------*/
/*------------ ZOOM FOTOGALLERY --------------------------*/
/*--------------------------------------------------------*/

function VisualizzaStep(Elemento){

	for(i=1; i < 5; i++){
	
		var Nome_Elemento = "";
	
		Nome_Elemento = "Step_"+i+"_Sel" ;
	
			if (document.getElementById(Nome_Elemento) !=null) {
				document.getElementById(Nome_Elemento).style.display = 'none';
			}
	}
	
	document.getElementById(Elemento).style.display = 'block';
	
	if (Elemento == 'Step_3_Sel') {
		xmlHttp.onreadystatechange = handleStateChangeNoImageEvidenziaStep_3;
		xmlHttp.open("GET", "content.asp?id_pagina="+document.getElementById("id_pagina_accesso_area").value+"&id_utente="+document.getElementById("id_utente_accesso").value, true);
		xmlHttp.send(null);
	}
	
}

function EvidenziaStep(Elemento){

  for(i=1; i < 5; i++){

		var Nome_Elemento = "";

		Nome_Elemento = "Step_"+i ;

			if (document.getElementById(Nome_Elemento) !=null) {
				document.getElementById(Nome_Elemento).style.background = '#E8E8E8';
				document.getElementById(Nome_Elemento).style.color = '#333333';
			}
  }

//	alert(Elemento);

	document.getElementById(Elemento).style.background = '#8D9297';
	document.getElementById(Elemento).style.color = '#FFFFFF';

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*--------------------------------------------------------*/
/*--------- CAMBIAMENTO COLORE SETTORE -------------------*/
/*--------------------------------------------------------*/

function EvidenziaSettore(
						Elemento_Da_Colorare
						){


	if (document.getElementById("settore_"+Elemento_Da_Colorare) != null) {
	
		document.getElementById("settore_"+Elemento_Da_Colorare).style.backgroundColor = '#D9EAFA' ;
		document.getElementById("settore_"+Elemento_Da_Colorare).style.border = '1px solid #FFFFFF' ;
	
			if (Elemento_Da_Colorare != document.getElementById("id_settore_selezionato").value) {
				
						document.getElementById("settore_"+document.getElementById("id_settore_selezionato").value).style.backgroundColor = '#B6D9FF' ;
						document.getElementById("settore_"+document.getElementById("id_settore_selezionato").value).style.border = '1px solid #B6D9FF' ;
	
			}
			
		document.getElementById("id_settore_selezionato").value = Elemento_Da_Colorare ;
	
	}

}

/*--------------------------------------------------------*/
/*--------------------------------------------------------*/
/*--------------------------------------------------------*/

/*--------------------------------------------------------*/
/*--------- CAMBIAMENTO COLORE SETTORE -------------------*/
/*--------------------------------------------------------*/

function EvidenziaProdotto(
						Elemento_Da_Colorare
						){


	if (document.getElementById("prodotto_"+Elemento_Da_Colorare) != null) {
	
		document.getElementById("prodotto_"+Elemento_Da_Colorare).style.backgroundColor = '#D9EAFA' ;
		document.getElementById("prodotto_"+Elemento_Da_Colorare).style.border = '1px solid #FFFFFF' ;
	
			if (Elemento_Da_Colorare != document.getElementById("id_prodotto_selezionato").value) {
				
				if (document.getElementById("prodotto_"+document.getElementById("id_prodotto_selezionato").value) != null) {
						document.getElementById("prodotto_"+document.getElementById("id_prodotto_selezionato").value).style.backgroundColor = '#B6D9FF' ;
						document.getElementById("prodotto_"+document.getElementById("id_prodotto_selezionato").value).style.border = '1px solid #B6D9FF' ;
				}
	
			}
			
		document.getElementById("id_prodotto_selezionato").value = Elemento_Da_Colorare ;
	
	}

}

/*--------------------------------------------------------*/
/*--------------------------------------------------------*/
/*--------------------------------------------------------*/

/*--------------------------------------------------------*/
/*--------- CAMBIAMENTO COLORE MENU ----------------------*/
/*--------------------------------------------------------*/

function CambiaColoreElementoMenu(
						Elemento_Da_Colorare
						){


	if ((document.getElementById("Elemento_Menu_"+Elemento_Da_Colorare) != null) && (document.getElementById("Elemento_Menu_"+Elemento_Da_Colorare+"_Sfondo") != null)) {
	
		document.getElementById("Elemento_Menu_"+Elemento_Da_Colorare).style.color = '#333333' ;
		document.getElementById("Elemento_Menu_"+Elemento_Da_Colorare+"_Sfondo").style.backgroundColor = '#333333' ;
	
			if (Elemento_Da_Colorare != document.getElementById("id_elemento_menu_selezionato").value) {
				
						document.getElementById("Elemento_Menu_"+document.getElementById("id_elemento_menu_selezionato").value).style.color = '#69831E' ;
						document.getElementById("Elemento_Menu_"+document.getElementById("id_elemento_menu_selezionato").value+"_Sfondo").style.backgroundColor = '#F2FFE5' ;
	
			}
			
		document.getElementById("id_elemento_menu_selezionato").value = Elemento_Da_Colorare ;
	
	}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*--------------------------------------------------------*/
/*--------- CAMBIAMENTO BANNER TOP HOME ------------------*/
/*--------------------------------------------------------*/
/*
function CaricaDivTop(Lingua){


  for(i=1; i < 7; i++){
		var Nome_Elemento = "";
		Nome_Elemento = "Div_Home_Top_"+i ;

			if (document.getElementById(Nome_Elemento) !=null) {
				document.getElementById(Nome_Elemento).style.display = 'none';
			}
  }

	document.getElementById("Div_Home_Top"+Lingua).style.display = 'block';

}*/

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ ISCRIZIONE NEWSLETTER 1 ----------*/
/*-----------------------------------------------*/

function Controllo_Indirizzo_Email(){

f = document.forms.form4;
b = document.form4;

if (f.email.value == ''   ){
	alert("Inserire indirizzo email !");
	f.email.focus();
	return false;
}



		if (f.email.value != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(f.email.value)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   f.email.focus();
			   return false;
			}
		}


	if (document.getElementById("lista_email")!=null){
		
		// CONTROLLO SE LA LOGIN SELEZIONATA ESISTE GIA'
		d = document.getElementById("lista_email").value.split(",");
	
		var agree_email=false;
		var j;
		for(j=-1;j<d.length-1;j++){
			if (d[j]==document.getElementById("email").value){
				agree_email=true;
			}
		}
	
	}

	if (document.getElementById("radiobutton_iscriviti").checked == true){
		radiobutton = 'iscriviti';
	}else{
		radiobutton = 'cancellati';
	}

		if (radiobutton=='iscriviti') {
		
				if (agree_email==true) {
					alert("Indirizzo email inserito gia' presente !");
					document.getElementById("email").value="";
					document.getElementById("email").focus();
				}
	
		}



}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*-------- MI RICAVO LA LISTA DELLE -------------*/
/*-------- SPECILITA SELEZIONATE ----------------*/
/*-----------------------------------------------*/
function Crea_Lista_Specialita(Specialita){

var NomeElemento = "id_specialita_"+Specialita;

var Lista_Specialita_Completa = document.getElementById("lista_specialita").value;

//alert(NomeElemento + " >> " + document.getElementById(NomeElemento));

	if (document.getElementById(NomeElemento) != null){

		if (document.getElementById(NomeElemento).checked == true) {
			
			Lista_Specialita_Completa = Lista_Specialita_Completa + "&" + NomeElemento + "=" + document.getElementById(NomeElemento).value;



		}else{
		
			Lista_Specialita_Completa = Lista_Specialita_Completa.replace("&" + NomeElemento + "=" + document.getElementById(NomeElemento).value,"");
			
		}

	document.getElementById("lista_specialita").value = Lista_Specialita_Completa;

	}

}
/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/

/*-----------------------------------------------*/
/*------------ ISCRIZIONE NEWSLETTER 2 ----------*/
/*-----------------------------------------------*/

function Check_Iscrivi_Newsletter(UrlPagina){

f = document.forms.form4;
b = document.form4;

if (f.email.value == ''   ){
	alert("Inserire indirizzo email !");
	f.email.focus();
	return false;
}

		if (f.email.value != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(f.email.value)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   f.email.focus();
			   return false;
			}
		}

	if (document.getElementById("radiobutton_iscriviti").checked == true){
		radiobutton = 'iscriviti';
	}else{
		radiobutton = 'cancellati';
	}

//------------------------------------------------
//------------------------------------------------
//------------------------------------------------

if (radiobutton == 'iscriviti'){

	if (document.getElementById("lista_email")!=null){
		
		// CONTROLLO SE LA LOGIN SELEZIONATA ESISTE GIA'
		d = document.getElementById("lista_email").value.split(",");
	
		var agree_email=false;
		var j;
		for(j=-1;j<d.length-1;j++){
			if (d[j]==document.getElementById("email").value){
				agree_email=true;
			}
		}
	
	}
	
	if (f.lista_specialita.value == ''   ){
		alert("Selezionare specialita di appartenenza !");
		return false;
	}
	
}
//------------------------------------------------
//------------------------------------------------
//------------------------------------------------


	var postData = ""
	postData = postData + "nome="+document.getElementById("nome").value
	postData = postData +"&cognome="+document.getElementById("cognome").value
	postData = postData +"&email="+document.getElementById("email").value
	postData = postData +"&id_categoria="+document.getElementById("id_categoria_email").value
	postData = postData +"&radiobutton="+radiobutton

	/**** AGGIUNGO LA LISTA DELLE SPECILITA SELEZIONATE *****/
	postData = postData +document.getElementById("lista_specialita").value
	/********************************************************/

	postData = postData.replace(/ /g,"%20");

//alert(postData);

	if (radiobutton=='iscriviti') {
	
			if (agree_email==true) {
				alert("Indirizzo email inserito gia' presente !");
				document.getElementById("email").value="";
				document.getElementById("email").focus();
			}else{
				xmlHttp.open("POST", "content.asp"+UrlPagina, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", postData.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.onreadystatechange = handleStateChangeNoImage;
				xmlHttp.send(postData);

			}
	
	}
	
	
	
	
	
	
	if (radiobutton=='cancellati') {
	
			if (agree_email==false) {
				alert("Indirizzo email non presente nella mailling list !");
				document.getElementById("email").value="";
				document.getElementById("email").focus();
			}else{
				xmlHttp.open("POST", "content.asp"+UrlPagina, true);
				xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				xmlHttp.setRequestHeader("Content-length", postData.length);
				xmlHttp.setRequestHeader("Connection", "close");
				xmlHttp.onreadystatechange = handleStateChangeNoImage;
				xmlHttp.send(postData);

			}
	
	}
	
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


//-------------------------------------------------------------
// SELEZIONA // DESELEZIONA TUTTE LE SPECILITA
//-------------------------------------------------------------
function Seleziona_Tutte(){

f = document.forms.form4;
b = document.form4;

	if (document.getElementById("seleziona_tutte").checked == true){
			
			  for(i=0; i < document.form4.elements.length; i++){
				    if(document.form4.elements[i].type=="checkbox"){

						if (document.form4.elements[i].name!='consenso'){
	
							document.form4.elements[i].checked = true;
							var Nome_Campo = document.form4.elements[i].name
							Nome_Campo = Nome_Campo.replace("id_specialita_","");
							Crea_Lista_Specialita(Nome_Campo);

						}

				    }
				}
	
	}else{
	
			  for(i=0; i < document.form4.elements.length; i++){
				    if(document.form4.elements[i].type=="checkbox") {

						if (document.form4.elements[i].name!='consenso'){
						   document.form4.elements[i].checked = false;
						}

				    }
				}	

			document.getElementById("lista_specialita").value = "" ;
	
	}

//alert(document.getElementById("lista_specialita").value);

}
//-------------------------------------
//-------------------------------------
//-------------------------------------

/*-----------------------------------------------*/
/*------------ ISCRIZIONE NEWSLETTER ------------*/
/*-----------------------------------------------*/

function Check_Richiesta(UrlPagina){

f = document.forms.form44;
b = document.form44;

if (f.nome.value == ''   ){
	alert("Inserire il nome !");
	f.nome.focus();
	return false;
}

if (f.cognome.value == ''   ){
	alert("Inserire il cognome !");
	f.cognome.focus();
	return false;
}

if (f.email.value == ''   ){
	alert("Inserire indirizzo email !");
	f.email.focus();
	return false;
}

		if (f.email.value != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(f.email.value)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   f.email.focus();
			   return false;
			}
		}

if (f.data_arrivo.value == ''   ){
	alert("Inserire la data di arrivo !");
	f.data_arrivo.focus();
	return false;
}

if (f.data_partenza.value == ''   ){
	alert("Inserire la data di partenza !");
	f.data_partenza.focus();
	return false;
}

	postData = "data_richiesta="+document.getElementById("data_richiesta").value
	postData = postData + "&nome="+document.getElementById("nome").value
	postData = postData + "&cognome="+document.getElementById("cognome").value
	postData = postData + "&email="+document.getElementById("email").value
	postData = postData + "&telefono="+document.getElementById("telefono").value
	postData = postData + "&struttura="+document.getElementById("struttura").value
	postData = postData + "&data_arrivo="+document.getElementById("data_arrivo").value
	postData = postData + "&data_partenza="+document.getElementById("data_partenza").value
	postData = postData + "&struttura="+document.getElementById("struttura").value
	postData = postData + "&richiesta="+document.getElementById("richiesta").value

	postData = postData.replace(/ /g,"%20");

	xmlHttp.open("POST", "content.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.send(postData);

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*------------ CHECK GUESTBOOK ------------------*/
/*-----------------------------------------------*/

function Check_Guestbook(UrlPagina){

f = document.forms.form4;
b = document.form4;

if (f.email.value == ''   ){
	alert("Inserire indirizzo email !");
	f.email.focus();
	return false;
}

		if (f.email.value != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(f.email.value)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   f.email.focus();
			   return false;
			}
		}

if (f.nome.value == ''   ){
	alert("Inserire il nome !");
	f.nome.focus();
	return false;
}

if (f.cognome.value == ''   ){
	alert("Inserire il cognome !");
	f.cognome.focus();
	return false;
}

if (f.messaggio.value == ''   ){
	alert("Inserire il messaggio !");
	f.messaggio.focus();
	return false;
}

	var postData = "nome="+document.getElementById("nome").value+"&cognome="+document.getElementById("cognome").value+"&email="+document.getElementById("email").value+"&messaggio="+document.getElementById("messaggio").value+"&conferma=1"

	postData = "nome="+document.getElementById("nome").value
	postData = postData +"&cognome="+document.getElementById("cognome").value
	postData = postData +"&email="+document.getElementById("email").value
	postData = postData +"&messaggio="+document.getElementById("messaggio").value
	postData = postData +"&conferma=1"
	postData = postData.replace(/ /g,"%20");

	xmlHttp.open("POST", "content.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.send(postData);

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/









/*-----------------------------------------------*/
/*---- CONTROLLO MODULO SEMPLIFICATO ------------*/
/*-----------------------------------------------*/

function Check_Send_Modulo_1(UrlPagina){

f = document.forms.form4;
b = document.form4;

if (f.nome.value == ''   ){
	alert("Inserire il nome !");
	f.nome.focus();
	return false;
}

if (f.cognome.value == ''   ){
	alert("Inserire il cognome !");
	f.cognome.focus();
	return false;
}

if (f.email.value == ''   ){
	alert("Inserire indirizzo email !");
	f.email.focus();
	return false;
}

		if (f.email.value != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(f.email.value)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   f.email.focus();
			   return false;
			}
		}


	postData = "data="+document.getElementById("data").value
	postData = postData + "&nome="+document.getElementById("nome").value
	postData = postData + "&cognome="+document.getElementById("cognome").value
	postData = postData + "&societa="+document.getElementById("societa").value
	postData = postData + "&ruolo="+document.getElementById("ruolo").value
	postData = postData + "&telefono="+document.getElementById("telefono").value
	postData = postData + "&fax="+document.getElementById("fax").value
	postData = postData + "&email="+document.getElementById("email").value
	postData = postData + "&richiesta="+document.getElementById("richiesta").value
	postData = postData.replace(/ /g,"%20");

	xmlHttp.open("POST", "content.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.send(postData);

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/







/*-----------------------------------------------*/
/*- CONTROLLO MODULO SEMPLIFICATO COMPLESSO -----*/
/*-----------------------------------------------*/

function Check_Send_Modulo_2(UrlPagina){

f = document.forms.form4;
b = document.form4;

if (f.nome.value == ''   ){
	alert("Inserire il nome !");
	f.nome.focus();
	return false;
}

if (f.cognome.value == ''   ){
	alert("Inserire il cognome !");
	f.cognome.focus();
	return false;
}

if (f.email.value == ''   ){
	alert("Inserire indirizzo email !");
	f.email.focus();
	return false;
}

		if (f.email.value != ''   ){		   
			   var i=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			   if(!i.test(f.email.value)) {
			   alert("L'indirizzo email inserito non e' valido !");
			   f.email.focus();
			   return false;
			}
		}

	postData = "data="+document.getElementById("data").value
	postData = postData + "&nome="+document.getElementById("nome").value
	postData = postData + "&cognome="+document.getElementById("cognome").value
	postData = postData + "&societa="+document.getElementById("societa").value
	postData = postData + "&indirizzo="+document.getElementById("indirizzo").value
	postData = postData + "&citta="+document.getElementById("citta").value
	postData = postData + "&cap="+document.getElementById("cap").value
	postData = postData + "&provincia="+document.getElementById("provincia").value
	postData = postData + "&nazione="+document.getElementById("nazione").value
	postData = postData + "&telefono="+document.getElementById("telefono").value
	postData = postData + "&fax="+document.getElementById("fax").value
	postData = postData + "&email="+document.getElementById("email").value
	postData = postData + "&richiesta="+document.getElementById("richiesta").value
	postData = postData.replace(/ /g,"%20");

	xmlHttp.open("POST", "content.asp"+UrlPagina, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postData.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.send(postData);

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/




/*-----------------------------------------------*/
/*---- CAMBIO ETICHETTA MOTORE DI RICERCA -------*/
/*-----------------------------------------------*/

function Cambia_Etichetta(Lingua) {

switch (Lingua) 

		{ 

			case "_1" : 
			document.getElementById("Etichetta_Cerca").innerHTML = "<strong>CERCA DOCUMENTO</strong>" 
			break; 
	
			case "_2" : 
			document.getElementById("Etichetta_Cerca").innerHTML = "<strong>SEARCH DOCUMENT</strong>" 
			break; 
	
			case "_3" :
			document.getElementById("Etichetta_Cerca").innerHTML = "<strong>RECHERCHE DOCUMENT</strong>"
			break; 

		}
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*--- APERTURA POP-UP ---------------------------*/
/*-----------------------------------------------*/

function apriFinestra(page,larghezza,altezza)
{
   winOpened=window.open(page,"","height="+altezza+",width="+larghezza+",scrollbars=yes,toolbar=no");
}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/


/*-----------------------------------------------*/
/*--- GESTIONE E VISUALIZZAZIONE ERRORI ---------*/
/*-----------------------------------------------*/

function handleErrFullPage(strIn) {	

        var errorWin;

        // Create new window and display error
        try {
			errorWin = window.open('', 'errorWin');
			errorWin.document.body.innerHTML = strIn;
        }
        // If pop-up gets blocked, inform user
        catch(e) {
			alert(strIn);
		}

}

/*-----------------------------------------------*/
/*-----------------------------------------------*/
/*-----------------------------------------------*/