//-------------------------------------------------------------------------------------
function scriviHtm( output )
// scrivo la funzione writeMenu su un file del mio PC per poterla testare
//-------------------------------------------------------------------------------------
{
 var fso = new ActiveXObject("Scripting.FileSystemObject");
 var a= fso.CreateTextFile( "C:\\WINDOWS\\Desktop\\OutMapp.htm", true);
	a.WriteLine(output);
	a.Close(); 
}
//------------------------------------------------------------------------------------
function Foglia( i, j )   // creo un item della mappa ( offerta )
//------------------------------------------------------------------------------------
{	var voce = 
"\n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"
+"\n			<A class='titsotto' HREF='" + tb_url[i][j] + "'>" 
+"&raquo;&nbsp;&nbsp;" + tb_voci[i][j] +" </A><br>";
	return voce ;
}
//------------------------------------------------------------------------------------
function Titolo( i )   // scrivo il titolo di un area 
//------------------------------------------------------------------------------------
{	var voce = 
"\n &nbsp; &nbsp; "
+"\n <A HREF='" + tb_url[i][1] + "'> <b>" + tb_voci[i][0] +"</b> </A><br> ";
	return voce ;
}
//------------------------------------------------------------------------------------
function DisegnaMappa( s ) 
//------------------------------------------------------------------------------------
{
 var i, out = "", half=0, start, stop ;

	while( half < tb_voci.length / 2 ) 
		half++;	
	if( half == 0 ) s = 0;

	if( s == 0 )
	{	start = 0;		stop = tb_voci.length - half ;
	}else
	{	start = half;	stop = tb_voci.length;
	}
	for( i = start; i < stop ; i++ ) 
	{	
		out = out + "\n <br> &nbsp; " + Titolo( i );

		for (var j = 2; j < tb_voci[i].length; j++)  
			out = out + Foglia( i, j );
	}
	return out;
}
