		var blk = true;
		var sel_obj=null;
		var row_obj = null;
		var row_Width=575;
		var metaTag="";

		
		function test_null_row() {
			if (actual_obj.rows.length==1) {
				if (actual_obj.rows(0).id=="null_row") {
					actual_obj.deleteRow(0);
				}
			}
		}
		

		var obj_navigator = new Object();
		
		function add_gallery() {
		
			if (actual_obj.id!="tabella") return alert("Impossibile creare una sezione gallery in un sottoblocco!")
			test_null_row()
			var riga=tabella.insertRow();
			var cella=riga.insertCell();
			sz="<TABLE id=obj_gll cellspacing=0 cellpadding=0 width=100% ><TR><TD name='spazio'><img src='/images/ghost.gif' width='5' height='5'></TD></TR><TR><TD name='gallery' onclick='attiva_menu(this)'><TABLE cellspacing=0 cellpadding=0><TR><TD><IMG src='/images/ghost.gif' width=11 height=10></TD>"
			for (i=0; i<7; i++) {
				sz+="<TD><IMG src='fac_sim"+i+".gif' width=55 height=55 class='img'></TD><TD><IMG src='/images/ghost.gif' width=11 height=10></TD>"
			}
			sz+="</TR></TABLE></TD></TR><TR><TD name='spazio'><img src='/images/ghost.gif' width='5' height='10'></TD></TR></TABLE>"
			cella.innerHTML=sz
		}
		
		function mod_gallery() {
		
			var gll_obj=sel_obj.getElementsByTagName("IMG");
			var n_gll_obj=gll_obj.length;
			var sz="";
			for (i=0; i<n_gll_obj; i++) {
				if (gll_obj(i).name=="gll_obj") {
					sz+=gll_obj(i).copertina + "§" + gll_obj(i).title + "§" + gll_obj(i).immagine + "§"
				}
			}
			var obj_navigator = new Object();
			obj_navigator.Coll=sz
			var risposta=window.showModalDialog("/Gestione/Gestione_Gallery.htm",obj_navigator,"center:yes;help:no;resizable:no;status:no;dialogHeight:500px;dialogWidth:490px;scroll:yes;")
			if (risposta!="1") return;
			sz="<TABLE cellspacing=0 cellpadding=0><TR><TD><IMG src='/images/ghost.gif' width=11 height=10></TD>"
			if (obj_navigator.Coll=="") {
				for (i=0; i<7; i++) {
					sz+="<TD><IMG src='fac_sim"+i+".gif' width=55 height=55 class='img'></TD><TD><IMG src='/images/ghost.gif' width=11 height=10></TD>"
				}
			} else {
				var vect_gall=obj_navigator.Coll.split("§");
				n_vect_gall=vect_gall.length;
				var conta=0
				for (i=1; i<n_vect_gall; i=i+3) {
					sz+="<TD><IMG name='gll_obj' style='cursor:hand' onclick='apriFoto()' src='"+vect_gall[i-1]+"' title='"+vect_gall[i]+"' immagine='"+vect_gall[i+1]+"' copertina='"+vect_gall[i-1]+"' width=55 height=55 class='img'></TD><TD><IMG src='/images/ghost.gif' width=11 height=10></TD>"
					conta++
					if (conta==7) {
						sz+="</TR><TR><TD><IMG src='/images/ghost.gif' width=11 height=10></TD></TR><TR><TD><IMG src='/images/ghost.gif' width=5 height=10></TD>"
						conta=0
					}
				}
			}
			sz+="</TR></TABLE>"
			sel_obj.innerHTML=sz;
		}

		function add_titolo() {
		
			var obj_navigator = new Object();
			var bold="testo"
			var stile=""
			var allin=""
			obj_navigator.Txt="";
			obj_navigator.size=actual_obj.width;
			obj_navigator.fullFormat=true;
			var risposta=window.showModalDialog("/Gestione/Gestione_Titolo.htm",obj_navigator,"center:yes;help:no;resizable:no;status:no;dialogHeight:280px;dialogWidth:490px;scroll:yes;")
			if (risposta!="1") return;
			if (obj_navigator.bold) bold="testograss"
			if (obj_navigator.underline) stile="text-decoration:underline;"
			if (obj_navigator.italic) stile+="font-style: italic;";
			if (obj_navigator.blue) stile+="color: #14416B;";
			if (obj_navigator.center) allin="align=center";
			if (obj_navigator.right) allin="align=right";
			test_null_row()
			var riga=actual_obj.insertRow();
			var cella=riga.insertCell();
			var n_dim=actual_obj.offsetWidth
			var sz="<TABLE cellspacing=0 cellpadding=0 width="+n_dim+"><TR>"
			var sz_colspan=""
			if (obj_navigator.bullet) {
				sz+="<TD class='testomenulato'><IMG height=5 src='"+img_bllt+"' width=8></TD>"
				n_dim-=8;
				sz_colspan=" colspan=2 "
			}
			sz+="<TD class='"+bold+"' "+allin+" style='"+stile+"' onclick='attiva_menu(this)' width='"+n_dim+"' name='titolo'>"+obj_navigator.Txt+"</TD></TR>"
			sz+="<TR><TD " + sz_colspan + "><IMG src='ghost.gif' height=5px></TD></TR></TABLE>";
			cella.innerHTML=sz;
		}
		
		function mod_titolo() {
		
			var obj_navigator = new Object();
			var obj=sel_obj;
			var stile=""
			obj_navigator.Txt=obj.innerText;
			obj_navigator.size=obj.width;
			obj_navigator.fullFormat=true;
			if (obj.className=="testograss") obj_navigator.bold=true
			if (obj.style.textDecoration=="underline") obj_navigator.underline=true
			if (obj.style.fontStyle=="italic") obj_navigator.italic=true
			if (obj.style.color=="#14416b") obj_navigator.blue=true
			if (obj.align=="center") obj_navigator.center=true
			if (obj.align=="right") obj_navigator.right=true
			if (obj.cellIndex==1) obj_navigator.bullet=true
			var risposta=window.showModalDialog("/Gestione/Gestione_Titolo.htm",obj_navigator,"center:yes;help:no;resizable:no;status:no;dialogHeight:280px;dialogWidth:490px;scroll:yes;")
			if (risposta!="1") return;
			if (obj.cellIndex==1 && obj_navigator.bullet==false) {
				obj.parentElement.deleteCell(0);
				obj.width=parseInt(obj.width,10)+8;
				obj.parentElement.parentElement.children(1).children(0).collSpan=1;
			}
			if (obj.cellIndex==0 && obj_navigator.bullet==true) {
				var cella = obj.parentElement.insertCell(0);
				cella.className="testomenulato";
				cella.innerHTML="<IMG height=5 src='"+img_bllt+"' width=8>"
				obj.width=parseInt(obj.width,10)-8;
				obj.parentElement.parentElement.children(1).children(0).collSpan=2;
			}
			if (obj_navigator.bold) obj.className="testograss"
			else obj.className="testo"
			if (obj_navigator.underline) obj.style.textDecoration="underline"
			else obj.style.textDecoration="none"
			if (obj_navigator.italic) obj.style.fontStyle="italic"
			else obj.style.fontStyle="normal"
			if (obj_navigator.blue) obj.style.color="#14416B";
			else obj.style.color="";
			if (obj_navigator.center) obj.align="center"
			if (obj_navigator.right) obj.align="right"
			obj.innerText=obj_navigator.Txt;
		}

		function add_testo(width,height) {
		
			var obj_navigator = new Object();
			obj_navigator.Txt="";
			obj_navigator.metaTag=metaTag;
			if (!width) width=actual_obj.offsetWidth;
			var risposta=window.showModalDialog("/Gestione/Gestione_Body3.htm",obj_navigator,"center:yes;help:no;resizable:no;status:0;dialogHeight:500px;dialogWidth:"+(width+20)+"px;scroll:yes;")
			if (risposta!="1") return;
			metaTag=obj_navigator.metaTag;
			test_null_row()
			var riga=actual_obj.insertRow();
			var cella=riga.insertCell();
			cella.innerHTML="<TABLE cellspacing=0 cellpadding=0 width="+width+"><TR><TD width="+width+" class='testo' onclick='attiva_menu(this)' name='testo'>"+obj_navigator.Txt+"</TD></TR><TR><TD><IMG src='/ghost.gif' height=5px></TD></TR></TABLE>";
		}
		
		function mod_testo(width,height) {
		
			var obj_navigator = new Object();
			var obj=sel_obj;
			if (!width) width=actual_obj.offsetWidth;
			obj_navigator.Txt=obj.innerHTML;;
			obj_navigator.metaTag=metaTag;
			var risposta=window.showModalDialog("/Gestione/Gestione_Body3.htm",obj_navigator,"center:yes;help:no;resizable:no;status:no;dialogHeight:500px;dialogWidth:"+(width+20)+"px;scroll:yes;")
			if (risposta!="1") return;
			metaTag=obj_navigator.metaTag;
			obj.innerHTML=obj_navigator.Txt;
		}

		function add_rigaVuota() {
		
			test_null_row()
			var riga=actual_obj.insertRow();
			var cella=riga.insertCell();
			cella.innerHTML="<TABLE cellspacing=0 cellpadding=0 width="+actual_obj.width+"><TR><TD class=testo onclick='attiva_menu(this)' name='spazio'><img src='ghost.gif' width='5' height='5'></TD></TR></TABLE>";
		}

		function add_rigaSeparatore() {
		
			test_null_row()
			var riga=actual_obj.insertRow();
			var cella=riga.insertCell();
			var sep_size=actual_obj.width/4;
			cella.innerHTML="<TABLE cellspacing=0 cellpadding=0 width=90% align=center><TR><TD><img src='ghost.gif' width='5' height='5'></TD></TR><TR height=1><TD class=testo onclick='attiva_menu(this)' id='separatore' bgcolor='black'><img src='ghost.gif' height='1'></TD><TR><TD><img src='ghost.gif' width='5' height='10'></TD></TR></TR></TABLE>";
		}
		
		function add_allegato() {
		
			var obj_navigator = new Object();
			var risposta=window.showModalDialog("/Gestione/Gestione_Allegato.asp",obj_navigator,"center:yes;help:no;resizable:no;status:no;dialogHeight:350px;dialogWidth:490px;scroll:yes;")
			if (risposta!="1") return;
		}
		
		function apriFoto() {
			return;
		}
		
		function apriAllegato() {
			return;
		}
		
		function apriLink() {
			return;
		}
		
		function add_immagine() {
		
			var obj_navigator = new Object();
			var risposta=window.showModalDialog("/Gestione/Gestione_Immagini.asp",obj_navigator,"center:yes;help:no;resizable:no;status:no;dialogHeight:350px;dialogWidth:490px;scroll:yes;")
			if (risposta!="1") return;
		}
		
	
		/* Selezione voci di menų */
		
		function attiva_menu(obj, obj2) {
			if (!obj){
				obj=this
			}
			sel_obj = obj;
			// Annullo le voci di menu 
			var menu_rows=inp_Area.children(0).rows;
			var n_righe=menu_rows.length;
			for (i=0; i<n_righe; i++) {
				if (menu_rows(i).id) menu_rows(i).style.display="none"
			}
			
			// prendo la riga di documento 
			row_obj = sel_obj.parentElement.parentElement.parentElement.parentElement.parentElement;
			
			// se sono in sottoarea e clicco su un oggetto fuori, attivo l'intera pagina e esco 
			if (row_obj.parentElement.parentElement.id && row_obj.parentElement.parentElement!=actual_obj) return change_big_table();
			
			// se non sono sulla prima riga, abilito spostasų 
			if (row_obj.rowIndex>0) spostasu.style.display="block"
			// se non sono sull'ultima riga, abilito spostagių 
			if (row_obj.rowIndex<actual_obj.rows.length-1) spostagiu.style.display="block"
			// se sono in gallery abilito il menu
			switch (sel_obj.name) {
				case "titolo":
				case "testo":
					modifica.style.display="block";
					break;
				case "spazio":
				case "separore":
					lh5.style.display="block";
					lh10.style.display="block";
					lh15.style.display="block";
					break;
				case "gallery":
					addfoto.style.display="block";
					break;				
			}			// Sposto il menu nella zona in cui ho cliccato
			iSumOfScrollTop=0
			oTmpobjRe=obj
			while(oTmpobjRe.tagName!="BODY") {
				oTmpobjRe=oTmpobjRe.parentElement
				iSumOfScrollTop+=oTmpobjRe.scrollTop
			}
			inp_Area.style.top=event.y-5 + iSumOfScrollTop
			inp_Area.style.left=event.x-5;
			
			// Rendo visibile il menu
			inp_Area.style.display="block";
		}

		function scelta_menu(idx) {
			
			// Cancello il menu
			menu_sparisci()
			// In base al tipo di oggetto, attivo la funzione
			switch (sel_obj.name) {
				case "titolo":
					mod_titolo();
					break;
				case "testo":
					mod_testo();
					break;
				case "spazio":
					// Imposto l'altezza della riga vuota
					sel_obj.children(0).height=idx;
					break;
				case "separatore":	
					// Imposto l'altezza delle righe vuote sopra e sotto il separatore		
					sel_obj.parentElement.parentElement.rows(0).cell(0).children(0).height=idx;
					sel_obj.parentElement.parentElement.rows(2).cell(0).children(0).height=idx;
					break;
			}
		}
		
		/* Cancellazione di un oggetto */
		function menu_elimina() {
		
			if (!row_obj) return;
			var n_row=row_obj.rowIndex;
			row_obj=null;
				if (window.confirm('Confermi la cancellazione del blocco?')==false) return 
			actual_obj.deleteRow(n_row);
			// se sono sull'intera pagina e ho eliminato l'ultima riga rimasta, creo una riga temporanea vuota 
			if (actual_obj==tabella && actual_obj.rows.length==0) {
				var riga=actual_obj.insertRow();
				var cella=riga.insertCell();
				riga.id="null_row"
				cella.innerHTML="<img src='ghost.gif' width='5' height='5'>"
			}
		}

		// Spostamento della voce di menu
		function menu_sposta(idx) {
		
			// Cancello il menu
			menu_sparisci()
			if (!row_obj) return;
			var n_row=row_obj.rowIndex;
			var last_row=actual_obj.rows(n_row+idx)
			var sz=row_obj.children(0).innerHTML;
			row_obj.children(0).innerHTML=last_row.children(0).innerHTML;
			last_row.children(0).innerHTML=sz;
		} 
		
		// Spostamento della voce di menu
		function menu_spostal() {
		
			// Cancello il menu
			menu_sparisci()
			if (!row_obj) return;
			var riga=row_obj.children(0).children(0).children(0).children(0);
			var cella1=riga.children(0).cloneNode(true);
			var cella2=riga.children(2).cloneNode(true);
			riga.children(0).replaceNode(cella2)
			riga.children(2).replaceNode(cella1)
		} 

		// Cancellazione del menu
		function menu_sparisci() {
		
			inp_Area.style.display="none"
		}
		
		// Passaggio dalla pagina intera ad una sua sezione
		function change_table(obj) {
			if(!obj){
				obj=this
			}
			obj=obj.children(0)
			tabella.className="";
			obj.className="cont_mod"
			actual_obj=obj.rows(0).cells(0).children(0)
		}
		
		// Passaggio da sua sezione alla pagina intera
		function change_big_table() {
			
			tabella.className="cont_mod";
			actual_obj.parentElement.parentElement.parentElement.parentElement.className=""
			actual_obj=tabella;

		}

