	// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Left(str, n_chars)
{
	var str_ret = new String();
	str_ret = str;
	
	return str_ret.substring( 0, n_chars );
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Right(str, n_chars)
{
	var str_ret = new String();
	str_ret = str;

	return str_ret.substr(str_ret.length - n_chars, 
						  n_chars);
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 



// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function dammi_elemento_superiore(elemento)
{
	if (is_IE() == true)
	{
		return elemento.parentElement;
	}
	else
	{
		return elemento.parentNode;
	}
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

function cambia_puntatore_mouse(oggetto)
{
    var stile_cursore_puntatore = "";
    
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
        stringa_per_manina = 'hand';
    }
    else
    {
        stringa_per_manina = 'pointer';
    }


	var attrbs = oggetto.attributes;
	var attrb_style = attrbs['style'];

	if ( attrb_style == null ) attrb_style = document.createAttribute("style");

	// attrb_style.value = "";
	// nnm.setNamedItem(namedItem);
	
    oggetto.style.cursor = stringa_per_manina ;
}

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

function porta_menu_sx_a_default()
{
	window.open("menu_sx_home.htm", 'sotto_sx');
}

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

function dammi_valore_parametro_da_url(url, nome_parametro)
{
   	var url_diviso = new Array(2);
	var url_in_string_Obj = new String();
		
	url_in_string_Obj = url;
		    	
   	url_diviso = url_in_string_Obj.split("?");

	var insieme_parametri_totali = new String();

	if (( url_diviso[1] == "") || (url_diviso[1] == null) )  return -1;

	insieme_parametri_totali = url_diviso[1];
		
	var insieme_parametri_in_array = new Array();
	insieme_parametri_in_array = insieme_parametri_totali.split("&");
	var p_a_elemento = 0;
				
	var str_tmp = new String();
	var dati_nome_valore_tmp = new Array(2);
	
	while ( p_a_elemento < insieme_parametri_in_array.length )
	{
		str_tmp = insieme_parametri_in_array [p_a_elemento];
		dati_nome_valore_tmp = str_tmp.split("="); 

		if (dati_nome_valore_tmp[0] == nome_parametro)
		{
			return dati_nome_valore_tmp[1]; 
		}

		p_a_elemento ++;
	}


	return null;	
}


// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

function is_IE()
{
	if (navigator.userAgent.indexOf('MSIE') == -1) 
	{	
		return false;
	}
	else
	{
		return true;
	}
}


// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Espandi(Nome_d){	
	
	var Div = null;
	
	//alert('A');

	var visualizzo = "";
	var path_immagine = "";
	var alias_per_visualizza = "";
	
	// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  
	if (navigator.appName == 'Microsoft Internet Explorer')
    {
        alias_per_visualizza = 'block';
        Div = document.all[Nome_d +"_CONTENITORE"];
    }
    else
    {
        alias_per_visualizza = '';
        Div = document.getElementById( Nome_d +"_CONTENITORE" );
    }
	// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  
	
	if (Div != null)	
	{
		// currentStyle
		//if (Div.currentStyle.display == "none")	
			
		if (Div.style.display == "none")	
		{
			visualizzo		= alias_per_visualizza ;
			path_immagine	= "images/DOWN__.png";
		}
		else
		{
			visualizzo		= "none";
			path_immagine	= "images/NEXT_finale.png";
		}
			
		while (1==1)
		{
			if ( (Div.id != null) && (Div.tagName == "DIV") && (Div.id != "") )			
			{		
				if (pos_ultimo_UnderScore != -1)
				{
					var pos_ultimo_UnderScore = Div.id.lastIndexOf( "_", Div.id.length ); 
 
					var Nome_generico_div = Left(Div.id, pos_ultimo_UnderScore ); 
					
					var Top_o_Contenitore = Div.id.substr( pos_ultimo_UnderScore + 1,
														   Div.id.length - pos_ultimo_UnderScore + 1 ); 

					if (Top_o_Contenitore== "CONTENITORE")
					{	
						if (Div.innerHTML != "")
						{
							Div.style.display = visualizzo;				

							// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  
							if (navigator.appName == 'Microsoft Internet Explorer')
    						{
								if ( document.all[ Nome_generico_div  + "_imma" ] != null )
								{
									document.all[ Nome_generico_div  + "_imma" ].src = path_immagine;
								}
    						}
    						else
    						{
    							if (document.getElementById( Nome_generico_div  + "_imma"  )!= null) 
    							{
	    							document.getElementById( Nome_generico_div  + "_imma"  ).src = path_immagine;
	    						}
    						}
							// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

						}
					}
	
					if (Top_o_Contenitore == "TOP") { }
				}
			}			
			
			if (visualizzo != "none")
			{
				// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  
				if (navigator.appName == 'Microsoft Internet Explorer')
    			{
					Div = Div.parentElement; // dammi_elemento_superiore(Div);
    			}
    			else
    			{
					Div = Div.parentNode; 
    			}
				// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  
		
				if (Div.tagName == "BODY") break;	
			}
			else
			{
				break;			
			}
		}	
	}			
			
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function imposta_attributo ( OBJ_Elemento_da_impostare_paf,
							 nome_proprietà_paf,
							 valore_proprietà_paf )
{	
	var attrbs = OBJ_Elemento_da_impostare_paf.attributes;
	
	if (nome_proprietà_paf == "style")
	{
	}
	
	if (attrbs[nome_proprietà_paf] == null)
	{
		var nuovo_attrb = document.createAttribute(nome_proprietà_paf);	
		attrbs.setNamedItem( nuovo_attrb );
	}

	attrbs[nome_proprietà_paf].value = valore_proprietà_paf;
	
	
	return OBJ_Elemento_da_impostare_paf;
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Stampa_Oggetto( OBJ_Elemento_da_stampare_paf )
{	
	if ( OBJ_Elemento_da_stampare_paf != null)
	{
		document.writeln( OBJ_Elemento_da_stampare_paf.outerHTML );
	}	
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function A_sin_ele_a_LISTA( OBJ_Elemento_lista_paf,
							Label_elemento_paf,
							Link_elemento_paf)
{
	var OBJ_singolo_elemento = Crea_elemento_lista(Label_elemento_paf, Link_elemento_paf);
	
	//alert( "singolo elemento creato: " + OBJ_singolo_elemento );
	//Crea_elemento("li", null);
	//OBJ_singolo_elemento.innerHTML = "<a href='"+ 
	//								 Link_elemento_paf + "'>"+
	//								 Label_elemento_paf + "</a>";
	//
	
	OBJ_Elemento_lista_paf.appendChild(OBJ_singolo_elemento);

	return OBJ_Elemento_lista_paf;
}			
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Imposta_rientro( OBJ_elemento_da_impostare_paf, 
						  liv_di_rientro_da_0_a_tot_paf)
{	
	var valore_rientro = 20*liv_di_rientro_da_0_a_tot_paf;
	valore_rientro += "px";

  	OBJ_elemento_da_impostare_paf.style.marginLeft = valore_rientro;						  



	
	return OBJ_elemento_da_impostare_paf;
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Add_OBJ_a_OBJ( OBJ_elemento_da_aggiungere_paf, 
						OBJ_Gruppo_paf, 
						liv_di_rientro_da_0_a_tot_paf)
{	
	var Elemento_da_aggiungere_N_spostato = OBJ_elemento_da_aggiungere_paf;
	var contenitore_body = false;

	if ( OBJ_Gruppo_paf == null)
	{
		OBJ_Gruppo_paf = document.body;
		contenitore_body= true;
	}
	// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  
	if ( liv_di_rientro_da_0_a_tot_paf > 0 )
	{
		OBJ_elemento_da_aggiungere_paf = Imposta_rientro( OBJ_elemento_da_aggiungere_paf, liv_di_rientro_da_0_a_tot_paf );
	}
	// -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  

	var ID_oggetto_contenitore = OBJ_Gruppo_paf.id.substr(0, OBJ_Gruppo_paf.id.length - "_TOP".length); 
	var oggetto_contenitore = null;
	
	ID_oggetto_contenitore += "_CONTENITORE";

	
	//alert("Attributes: " + OBJ_Gruppo_paf.attributes );
	//alert("1");
	
	/*		
	var i= 0;
	var singolo_attr = null;
	while (i < OBJ_Gruppo_paf.attributes.length)
	{
		singolo_attr = OBJ_Gruppo_paf.attributes.item(i).nodeName; //attributeName ; 

		document.writeln("<p>" + singolo_attr +"</p>");
		
		i++;
	}
	*/

	
	var Insieme_Childrens =  OBJ_Gruppo_paf.children;
	
	if (contenitore_body== false)
	{
		if (Insieme_Childrens == null)
		{
			Insieme_Childrens =  OBJ_Gruppo_paf.childNodes;		
		}
		
		if (Insieme_Childrens == null) 
		{
			//alert("esco dalla funzione");
			return OBJ_Gruppo_paf;
		}
		else
		{
			for (i = 0; i < Insieme_Childrens.length; i++) 
			{
				if ( (Insieme_Childrens.item(i).tagName == "DIV") &&
						(Insieme_Childrens.item(i).id == ID_oggetto_contenitore) )
				{
					//alert("trovato oggetto contenitore");
					oggetto_contenitore = Insieme_Childrens.item(i);
				
					break;
				} 
			}
		}
	}
	else
	{
		oggetto_contenitore = OBJ_Gruppo_paf;
	}
	
	if (oggetto_contenitore != null)
	{
		try
		{
			oggetto_contenitore.appendChild( OBJ_elemento_da_aggiungere_paf );
		}
		catch(e)
		{
			clipboardData.setData("Text",OBJ_elemento_da_aggiungere_paf);
		}

		return OBJ_Gruppo_paf;
	}
	else
	{
		alert( "Inesistente->\n" + ID_oggetto_contenitore );
	}
	
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Crea_spazio()
{	
	var riga_vuota = Crea_elemento("p", "M0");
	
	riga_vuota.innerHTML = "&nbsp";

	return riga_vuota;
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Crea_elemento(tag, class_style_da_usare_o_NULL )
{	
	var Elemento = document.createElement(tag);

	if (class_style_da_usare_o_NULL!= null)
	{
		Elemento = imposta_attributo(Elemento, "class", class_style_da_usare_o_NULL );
	}

	return Elemento;
}

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Crea_elemento_lista( Label, link_pagina_or_NULL_paf )
{	
	// -    --    --    --    --    --    --    --    --    --    --    --    --    --    -
	var Elemento_P =document.createElement("li");
	var attrbs_Elemento_P  = Elemento_P.attributes;
	var Attr_CLASS_CONTENITORE	= document.createAttribute("class");
	var HTML_dell_elemento = "";
	// -    --    --    --    --    --    --    --    --    --    --    --    --    --    -
	
	if ( (link_pagina_or_NULL_paf != null) && (link_pagina_or_NULL_paf != "") )
	{
		Attr_CLASS_CONTENITORE.value = "articolo_incontro";
		attrbs_Elemento_P.setNamedItem( Attr_CLASS_CONTENITORE );		

		var Elemento_A = document.createElement("a");
		imposta_attributo(Elemento_A,"target","sotto_dx");
		imposta_attributo(Elemento_A,"class","articolo_incontro");
		imposta_attributo(Elemento_A,"href", link_pagina_or_NULL_paf );
		
		// teoricamente era meglio usare innerText.... così i caratteri speciali
		// sarebbero stati convertiti... ma il FireFox non riconosce la proprietà
		// il Chrome e l'Explorer si....
	
		Elemento_A.innerHTML = "<span>" + Label +"</span>";


		Elemento_P.appendChild(Elemento_A);
	}
	else
	{
		Attr_CLASS_CONTENITORE.value = "Nessun_art_class";
		attrbs_Elemento_P.setNamedItem( Attr_CLASS_CONTENITORE );		

		Elemento_P.innerHTML = "<span>" + Label+"</span>";
		//Elemento_P.innerText = Label;
	}
	
	// -    --    --    --    --    --    --    --    --    --    --    --    --    --    -
	
	return Elemento_P;
}

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

function F_inutile(var_passata_inutile)
{	
}

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Mouse_sopra(elemento)
{
	elemento.style.color = "#FF00FF";
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
function Mouse_esterno(elemento)
{
	elemento.style.color = ""; //"#FFFF00";
}
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

function Crea_gruppo(ID_gruppo_paf, Testo_N_incontro_paf, Titolo_Incontro_or_null, scritta_style_class_paf_or_NULL, link_collegato_o_NULL_paf, Link_target_or_NULL)
{	
	// -     --     --     --     --     --     --     --     --     --     --     --     -
	var possibile_già_esistente = document.all[ID_gruppo_paf + "_TOP"];
	
	if (possibile_già_esistente == null) 
	{
		possibile_già_esistente = document.getElementById( ID_gruppo_paf + "_TOP" );
	}
	
	if (possibile_già_esistente != null) 
	{
		alert ("Gruppo [" + ID_gruppo_paf + "]\n" + "già esistente");

		return null;
	}
	// -     --     --     --     --     --     --     --     --     --     --     --     -

	var Elemento_DIV_TOP = document.createElement("DIV");
	var insieme_attributi_TOP = Elemento_DIV_TOP.attributes;
	var insieme_attributi_top = Elemento_DIV_TOP.attributes;
	
	var Attr_ID_TOP = document.createAttribute("id");
	var Attr_CLASS_TOP = document.createAttribute("class");

	Attr_ID_TOP.value = ID_gruppo_paf + "_TOP";
	Attr_CLASS_TOP.value = "IDiv";

	insieme_attributi_TOP.setNamedItem( Attr_ID_TOP);		
	insieme_attributi_TOP.setNamedItem( Attr_CLASS_TOP );		

	var Elemento_DIV_CONTENITORE = document.createElement("DIV");
	var insieme_attributi_CONTENITORE = Elemento_DIV_CONTENITORE.attributes;
	var Attr_ID_CONTENITORE		= document.createAttribute("id");
	var Attr_CLASS_CONTENITORE	= document.createAttribute("class");

	Attr_ID_CONTENITORE.value = ID_gruppo_paf + "_CONTENITORE";
	Attr_CLASS_CONTENITORE.value = "IDiv";

	insieme_attributi_CONTENITORE.setNamedItem( Attr_ID_CONTENITORE );		
	insieme_attributi_CONTENITORE.setNamedItem( Attr_CLASS_CONTENITORE );		

	var HTML_del_gruppo = "";

	if (scritta_style_class_paf_or_NULL == null) scritta_style_class_paf_or_NULL = "";


	if (Testo_N_incontro_paf != "")
	{
		/*
		var elemento_paragrafo = Crea_elemento("p", null);

		elemento_paragrafo = imposta_attributo ( elemento_paragrafo, 
												 "onmouseover", 
												 "F_inutile('var_passata_inutile'); cambia_puntatore_mouse(this)" );
		elemento_paragrafo = imposta_attributo ( elemento_paragrafo, 
												 "class", 
												 scritta_style_class_paf_or_NULL );
		*/
		// -  --  --  --  --  --  --  --  --  --  --  --  --  --  --  -

		var DIV_freccina = Crea_elemento("div", null);
		//DIV_freccina.style.float = "left";
		//DIV_freccina.style['float'] = "left";
		//DIV_freccina.styleFloat = "left";

		DIV_freccina = imposta_attributo( DIV_freccina, "class",  "IDiv_freccina" );
		
		Elemento_DIV_TOP.appendChild( DIV_freccina );

		// -  --  --  --  --  --  --  --  --  --  --  --  --  --  --  -

		var DIV_Testo_titolo = Crea_elemento("div", null);
		// DIV_Testo_titolo.innerHTML = "<p>Titolo di default</p>";
		// DIV_Testo_titolo.style['FLOAT'] = "left;";
		// DIV_Testo_titolo.style.width = "30%;"; 
		
		Elemento_DIV_TOP.appendChild( DIV_Testo_titolo );

		// -  --  --  --  --  --  --  --  --  --  --  --  --  --  --  -

		var immagine_freccia = Crea_elemento("img", "imgc");
		
		immagine_freccia = imposta_attributo( immagine_freccia, "id",  ID_gruppo_paf + "_imma" );
		immagine_freccia = imposta_attributo( immagine_freccia, "src", "images/NEXT_finale.png" );
		immagine_freccia = imposta_attributo( immagine_freccia, "onmouseover", "'cambia_puntatore_mouse(this);'" );
		immagine_freccia = imposta_attributo( immagine_freccia, "onclick", "Espandi('" + ID_gruppo_paf +"');" );

		immagine_freccia = imposta_attributo( immagine_freccia, "onmouseover", 
							      "cambia_puntatore_mouse(this)" );

		
		immagine_freccia.style.marginTop = "5px"

		DIV_freccina.appendChild( immagine_freccia );

		// -  --  --  --  --  --  --  --  --  --  --  --  --  --  --  -

		if (link_collegato_o_NULL_paf != null)
		{
			var ancora = Crea_elemento("a", null);
			ancora = imposta_attributo(ancora, "target", Link_target_or_NULL); 
			ancora = imposta_attributo(ancora, "onclick", "Espandi('" + ID_gruppo_paf +"');" );
			ancora = imposta_attributo(ancora, "href", link_collegato_o_NULL_paf);
			ancora = imposta_attributo(ancora, "class", scritta_style_class_paf_or_NULL );

			//ancora.innerText = Testo_N_incontro_paf;
			ancora.innerHTML = Testo_N_incontro_paf;
			

			//DIV_Testo_titolo.innerHTML += ancora.outerHTML;
			DIV_Testo_titolo.appendChild( ancora );

			if ((Titolo_Incontro_or_null != null) && (Titolo_Incontro_or_null != ""))
			{
				// serve a mettere sotto a INCONTRO 1 il titolino per avere
				// INCONTRO 1
				// TitoLinoGinoPino				 
				var br_obj = Crea_elemento("br", null);
				DIV_Testo_titolo.appendChild( br_obj );



				var Tito_Lino_Gino_Pino = Crea_elemento("a", null);
				
				Tito_Lino_Gino_Pino = imposta_attributo(
												Tito_Lino_Gino_Pino, 
												"target", Link_target_or_NULL); 
				//Tito_Lino_Gino_Pino = imposta_attributo(Tito_Lino_Gino_Pino, 
				//								"onclick", 
				//								"Espandi('" + ID_gruppo_paf +"');" );
				Tito_Lino_Gino_Pino = imposta_attributo(
												Tito_Lino_Gino_Pino, 
												"href", link_collegato_o_NULL_paf);
				Tito_Lino_Gino_Pino = imposta_attributo(
												Tito_Lino_Gino_Pino, 
												"class", "Tito_Lino_Gino_Pino" );
		
				Tito_Lino_Gino_Pino.innerHTML = "def tit";
				//alert("Titolo_Incontro_or_null\n" + Titolo_Incontro_or_null );
				      
				Tito_Lino_Gino_Pino.innerHTML = Titolo_Incontro_or_null
				//Tito_Lino_Gino_Pino.innerText = Titolo_Incontro_or_null;

				DIV_Testo_titolo.appendChild( Tito_Lino_Gino_Pino );
			}
		}
		else
		{
			var span = Crea_elemento("span", null);
			
			span = imposta_attributo( span, 
									  "class", 
									  scritta_style_class_paf_or_NULL );
									  
			span = imposta_attributo( span, 
									  "onclick", 
									  "Espandi('" + ID_gruppo_paf + "')" );

			span = imposta_attributo( span, "onmouseover", 
								      "cambia_puntatore_mouse(this)" );

			//span.innerText = Testo_N_incontro_paf;
			span.innerHTML = Testo_N_incontro_paf;


			DIV_Testo_titolo.appendChild( span );
		}

	
			
		Elemento_DIV_CONTENITORE.style.display = "none";

		// -    --    --    --    --    --    --    --    --    --    --    --    --    --    -

		//if (elemento_paragrafo != null)
		//{
		//	Elemento_DIV_TOP.appendChild( elemento_paragrafo );
		//}
		// -    --    --    --    --    --    --    --    --    --    --    --    --    --    -
	}
	else
	{
	
	}
	
	Elemento_DIV_TOP.appendChild( Elemento_DIV_CONTENITORE );

	return Elemento_DIV_TOP; 
}

// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 




