// SCRIPT PER GESTIONE MAPPA LOCALI
// Date: Maggio 2006
// Author: Emilio Di Donato
// Copyright: www.casertamusica.com

//alert("versione 4");
freezeStatus = false;
idAreaBloccata = 'NO';

/* Funzione di DEBUG. Inserire nella pagina da debuggare la seguente form:
 * <form name="pippo">
 * <input type="text" name="pluto" value="debug box" size="200">
 * </form>
 * E quindi invocare con mostra("messaggio")
 */
function mostra(val){
//document.pippo.pluto.value=document.pippo.pluto.value + "*" + val;
}

function Freeze(id){
		//mostra("[Frz:" + id + ",Blk:" + idAreaBloccata);
		//mostra("1");
		if (id == idAreaBloccata) {
		unFreeze(); // Prima sblocca un eventuale Freeze attivo
		}
		else
		{
		unFreeze();
		//mostra("2");
		idAreaBloccata = id; 
		if(document.getElementById){
			//mostra("3");
			freezeStatus = false; //Altrimenti lo Show non viene effettuato
			Show(id);
			var el = document.getElementById("okButton");
			el.style.display = "block";
			el=document.getElementById("boxTesto");
			el.className = "box_canarino"; //cambia stile
			freezeStatus = true;
			//mostra("4");
		}
		}
		//mostra("Frz:" + id + ",Blk:" + idAreaBloccata+"]"); 
}

function unFreeze(){
	//mostra("UNfrz:" + idAreaBloccata);
	if(idAreaBloccata!="NO"){
		//mostra("A");
		freezeStatus = false;
		Hide(idAreaBloccata);
		//mostra("B");
		idAreaBloccata = 'NO';
		//mostra("C");
	}
	//document.getElementById("okButton").style.display = "none";
}
	
function Show(id){ // Utilizzata per visualizzare o nascondere il testo 
	if (!freezeStatus){
		//mostra('Show:' + id);
		if(document.getElementById){
			var el=document.getElementById(id);
			el.style.display = "block";
			el=document.getElementById("boxTesto");
			el.className = "box_plain";
		}
	} else {/*mostra('Show FAILED');*/}
}

function Hide(id){ // Utilizzata per visualizzare o nascondere il testo
	if (!freezeStatus){
		//mostra('Hide:' + id);
		if(document.getElementById){
			var el=document.getElementById(id);
			el.style.display = "none";
			el = document.getElementById("okButton");
			el.style.display = "none";
			el=document.getElementById("boxTesto");
			el.className = "";
		}
	}else {/*mostra('Hide FAILED');*/}
}

