function sceltocat(m){
// *** crea le liste per il catalogo
listautor=xmlcat.getElementsByTagName("autore"); 
listlibcat=xmlcat.getElementsByTagName("libro"); 
listcateg=xmlcateg.getElementsByTagName("categ"); 
if(m==1){
// *** se si è scelto di interrogare il catalogo per autore
str=stricat+"<table border=1 frame=hsides cellspacing=0 cellPadding=2 borderColor='#00eeaa'><tr><td style='color:#ccffee' align=center >nel catalogo sono presenti<br><b>" + listautor.length + " autori</b>";
for(i=0;i<listautor.length;i++){
str=str + "<tr><td style='color:00ffcc; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='listacatalog(" + m + "," + i + ") ' >" + listautor.item(i).attributes.getNamedItem('nome').text;+ "<br>";}
str=str + "</table>";
tab1.innerHTML=str;return;}
if(m==3){
// *** se si è scelto di interrogare il catalogo per titolo del libro
str=stricat+"<table border=1 frame=hsides cellspacing=0 cellPadding=2 borderColor='#00eeaa'><tr><td style='color:#ccffee' align=center >nel catalogo sono presenti<br><b>" + listlibcat.length + " libri</b>";
for(i=0;i<listlibcat.length;i++){
str=str + "<tr><td style='color:00ffcc; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='listacatalog(" + m + "," + i + ") ' >" + listlibcat.item(i).attributes.getNamedItem('titolo').text;+ "<br>";}
str=str + "</table>";
tab1.innerHTML=str;return;}
if(m==2){
// *** se si è scelto di interrogare il catalogo per categoria 
str=stricat+"<table border=1 frame=hsides cellspacing=0 cellPadding=2 borderColor='#00eeaa'><tr><td style='color:#ccffee' align=center >nel catalogo sono presenti<br><b>" + listcateg.length + " categorie di libri</b>";
for(i=0;i<listcateg.length;i++){
str=str + "<tr><td style='color:00ffcc; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='listacatalog(" + m + "," + i + ") ' >" + listcateg.item(i).attributes.getNamedItem('nome').text;+ "<br>";}
str=str + "</table>";
tab1.innerHTML=str;return;}
if(m==4){// *** se si è scelto di consultare il catalogo intero
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table border=1 frame=hsides borderColor='#00eeaa' cellspacing=0 cellPadding=2 style='position:absolute;top:10%;left:0%;width:104%'>";
for(i=0;i<listautor.length;i++){
listlibcat=listautor.item(i).getElementsByTagName("libro");
for(j=0;j<listlibcat.length;j++){
str=str + "<tr><td width=105%><font color='#0000aa'>Titolo <b><br><center> " + listlibcat.item(j).attributes.getNamedItem('titolo').text + " </b></center>";
str=str+"<hr align=center width=70% color='#0000aa'>autore <b> " + listautor.item(i).attributes.getNamedItem('nome').text + "</b>";
str=str+"<br>categoria <b> " + listlibcat.item(j).attributes.getNamedItem('categoria').text + " </b>";
str=str+"<br> il testo contiene <b> " + listlibcat.item(j).attributes.getNamedItem('numcap').text + " </b> capitoli, <b> " + listlibcat.item(j).attributes.getNamedItem('numpar').text + " </b> paragrafi, <b> " + listlibcat.item(j).attributes.getNamedItem('numarg').text + " </b> argomenti, <b> " + listlibcat.item(j).attributes.getNamedItem('numfig').text + " </b> figure";
str=str+"<br> pubblicato il <b> " + listlibcat.item(j).attributes.getNamedItem('datap').text + " </b>;  ultimo aggiornamento il <b> " + listlibcat.item(j).attributes.getNamedItem('dataua').text;
}}str=str + "</table><hr color='#0000aa'><br>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2=str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)'>expand</button>");
}}

function listacatalog(m,n){
// *** a secondo della scelta fatta prepara il catalogo corrispondente
listautor=xmlcat.getElementsByTagName("autore"); 
listlibcat=xmlcat.getElementsByTagName("libro"); 
listcateg=xmlcateg.getElementsByTagName("categ"); 
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table border=1 frame=hsides borderColor='#00eeaa' cellspacing=0 cellPadding=2 style='position:absolute;top:10%;left:0%;width:104%'>";
if(m==1){str=str + "<tr><td width=105%><font color='#0000aa'>Autore <b><br><center>" 
str=str+listautor.item(n).attributes.getNamedItem('nome').text + "</b></center>";
listlibcat=listautor.item(n).getElementsByTagName("libro");
for(i=0;i<listlibcat.length;i++){
str=str+"<hr align=center width=70% color='#0000aa'>titolo <b> " + listlibcat.item(i).attributes.getNamedItem('titolo').text + " </b><br>"
str=str+"categoria <b> " + listlibcat.item(i).attributes.getNamedItem('categoria').text + " </b><br>"
//str=str+"figure <b> " + listlibcat.item(i).attributes.getNamedItem('numfig').text + " </b><br>"
str=str+"il testo contiene <b> " + listlibcat.item(i).attributes.getNamedItem('numcap').text + " </b> capitoli, <b> " + listlibcat.item(i).attributes.getNamedItem('numpar').text + " </b> paragrafi, <b> " + listlibcat.item(i).attributes.getNamedItem('numarg').text + " </b> argomenti, <b> " + listlibcat.item(i).attributes.getNamedItem('numfig').text + " </b> figure";
str=str+"<br> pubblicato il <b> " + listlibcat.item(i).attributes.getNamedItem('datap').text + " </b>;  ultimo aggiornamento il <b> " + listlibcat.item(i).attributes.getNamedItem('dataua').text + "</b>";
}}
if(m==3){titsc=listlibcat.item(n).attributes.getNamedItem('titolo').text;
str=str + "<tr><td width=105%><font color='#0000aa'>Titolo <b><br><center> " + titsc + " </b></center>";
for(i=0;i<listautor.length;i++){
listlibcat=listautor.item(i).getElementsByTagName("libro");
for(j=0;j<listlibcat.length;j++){
if(listlibcat.item(j).attributes.getNamedItem('titolo').text==titsc){
str=str+"<hr align=center width=70% color='#0000aa'>autore <b> " + listautor.item(i).attributes.getNamedItem('nome').text + "</b>";
str=str+"<br>categoria <b> " + listlibcat.item(j).attributes.getNamedItem('categoria').text + " </b>";
str=str+"<br> il testo contiene <b> " + listlibcat.item(j).attributes.getNamedItem('numcap').text + " </b> capitoli, <b> " + listlibcat.item(j).attributes.getNamedItem('numpar').text + " </b> paragrafi, <b> " + listlibcat.item(j).attributes.getNamedItem('numarg').text + " </b> argomenti, <b> " + listlibcat.item(j).attributes.getNamedItem('numfig').text + " </b> figure";
str=str+"<br> pubblicato il <b> " + listlibcat.item(j).attributes.getNamedItem('datap').text + " </b>;  ultimo aggiornamento il <b> " + listlibcat.item(j).attributes.getNamedItem('dataua').text + "</b>";
}}}}
if(m==2){var ccateg=listcateg.item(n).attributes.getNamedItem('nome').text;
str=str + "<tr><td width=105%><font color='#0000aa'>Categoria <b><br><center> " + ccateg + " </b></center>";
for(i=0;i<listautor.length;i++){
listlibcat=listautor.item(i).getElementsByTagName("libro");
for(j=0;j<listlibcat.length;j++){if(listlibcat.item(j).attributes.getNamedItem('categoria').text==ccateg){
str=str+"<hr align=center width=70% color='#0000aa'>autore <b> " + listautor.item(i).attributes.getNamedItem('nome').text + " </b><br>"
str=str+"titolo <b> " + listlibcat.item(j).attributes.getNamedItem('titolo').text + " </b><br>"
str=str+"il testo contiene <b> " + listlibcat.item(j).attributes.getNamedItem('numcap').text + " </b> capitoli, <b> " + listlibcat.item(j).attributes.getNamedItem('numpar').text + " </b> paragrafi, <b> " + listlibcat.item(j).attributes.getNamedItem('numarg').text + " </b> argomenti, <b> " + listlibcat.item(j).attributes.getNamedItem('numfig').text + " </b> figure";
str=str+"<br> pubblicato il <b> " + listlibcat.item(j).attributes.getNamedItem('datap').text + " </b>;  ultimo aggiornamento il <b> " + listlibcat.item(j).attributes.getNamedItem('dataua').text + "</b>";
}}}}
str=str + "</table><hr color='#0000aa'><br>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2=str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)'>expand</button>");
}

function capitolo(){  
//alert(fil + filestr);alert(fil + filearg);
// *** visualizza: il titolo del libro, la select dei capitoli, 
// *** visualizza la tabella: autore, scheda tecnica, web-master
listcap=xmldom.getElementsByTagName("capitolo"); //lista dei capitoli
numcap=listcap.length; // alert(numcap);  // numero dei capitoli
listlibro=xmldom.getElementsByTagName("libro");
autore=listlibro.item(0).attributes.getNamedItem('autore').text; // ? ---
//alert(titlib + "\n" + autore);
/*
str="<table cellPadding=0 border=1 frame=hsides borderColor='#00eeaa' cellspacing=0 style='position:absolute;left=0%;top=0%;width=100%'>"
for(i=0;i<listcap.length;i++){
str=str + "<tr><td style=" + String.fromCharCode(34) + "color:00ffcc; background-color:'#0000aa'" + String.fromCharCode(34) + " onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='titoli(" + i + "); prefazc(" + i + ")'  title='" + listcap.item(i).attributes.getNamedItem('tit').text + "'> " + listcap.item(i).attributes.getNamedItem('titolo').text + " ";}
str=str + "</table></table>"; 
str=str+"<table style='position:absolute;top:80%;left:10%;font-size:9pt'><tr><td style='color:red' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='autore()'  title='ing.prof Pellegrino ANTONACCI'> AUTORE <td><a href='mailto:simbolo@tin.it' title='Ing.prof. Pellegrino ANTONACCI'> il web-master</a></table>"; 
tab0.innerHTML=str;background='css/sfondorig1.jpg'
*/
str="<fieldset background='vertical2.jpg'  id=visualiz style='top=9%; width:100%;left:10%'>";
str=str + "<legend align=center id=legend style='color:ccffee'><center>Seleziona uno dei " + numcap + " capitoli del libro<br><font style='color:ffffcc'>" + listlib.item(ricscelta.value).attributes.getNamedItem("titolo").text + "</legend>";
str=str+"<center><select style='font-size:7pt; font-weight:bold' name='sceltac' onchange='titoli(sceltac.value); prefazc(sceltac.value)' ><option style='background-color=ddeeff' value='' selected></option>";
//str=str+"<center><select name='sceltac' onchange='alert" + "'ciac'" + "'><option style='background-color=ddeeff' value='' selected></option>";
for(i=0;i<numcap;i++){str=str+"<option style='color:0000aa; background-color=ddeeff' value=" + i + ">" + listcap.item(i).attributes.getNamedItem('titolo').text.toUpperCase() + "</option>";}
str=str+"</select>";
//str=str+"<table style='position:absolute;top:70%;left:10%'><tr><td style='color:ccffee; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='ccffee'" + String.fromCharCode(34) + " onclick='autore()'  title='ing.prof Pellegrino ANTONACCI'> autore<td style='background-color:0000aa'><a href='mailto:simbolo@tin.it' title='Ing.prof. Pellegrino ANTONACCI'> il web-master</a></table>"; 
str=str+"<table border=1 frame=vsides borderColor='#00eeaa' cellspacing=0 style='position:absolute;top:70%;left:10%'><tr><td style='color:ccffee; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='ccffee'" + String.fromCharCode(34) + " onclick='aut()'  title='" + autore + "'>&#160;&#160;autore&#160;&#160;<td style='color:ccffee; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='ccffee'" + String.fromCharCode(34) + " onclick='caratteristiche()' title='visualizza il numero delle figure, degli argomenti, dei paragrafi e dei capitoli'>";
str=str+"&#160;&#160;Caratteristiche del libro&#160;&#160;<td style='background-color:0000aa'><a href='mailto:simbolo@tin.it' title='Ing.prof. Pellegrino ANTONACCI'>&#160;&#160;il web-master&#160;&#160;</a></table>"; 
tab0.innerHTML=str;
presental();}     

function aut(){
// *** visualizza la presentazione dell'autore e l'elenco delle sue pubblicità
listdoc=xmldoc.getElementsByTagName("autore");
listpresdoc=xmldoc.getElementsByTagName("scheda");
for(i=0;i<listdoc.length;i++){
if(listdoc.item(i).attributes.getNamedItem('nome').text == autore){
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table border=1 frame=hsides borderColor='#00eeaa' cellspacing=0 cellPadding=2 style='position:absolute;top:0%;left:0%;width:104%'>";
str=str + "<tr><td width=105%><font color='#0000aa'><b><center>" + listdoc.item(i).attributes.getNamedItem('nome').text  + "</b></center><br><font size=2pt>" + listpresdoc.item(i).text;
str=str + "</table>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2=str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)'>expand</button>");
listargdoc=listdoc.item(i).getElementsByTagName("pagpub");// lista delle pagine pubblicitarie dell'autore
numargdoc=listargdoc.length; //}}
str="<table border=1 frame=hsides cellspacing=0 cellPadding=5 borderColor='#00eeaa'><tr><td style='color:#ccffee' align=center >autore<br><b>" + listdoc.item(i).attributes.getNamedItem('nome').text + "</b>";
//for(j=0;j<numargdoc;j++){str=str + "<tr><td style='color:#0000aa' onmouseover=" + String.fromCharCode(34) + " this.style.color='#00CCFF'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.color='#0000aa'" + String.fromCharCode(34) + "  onclick='argdoc(" + j + ") ' title='" + listargdoc.item(j).attributes.getNamedItem('titolo').text + "' >" + listargdoc.item(j).attributes.getNamedItem('titolo').text + "<br>"}
for(j=0;j<numargdoc;j++){str=str + "<tr><td style='font-size:15; color:00ffcc; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='argdoc(" + j + ") ' title='" + listargdoc.item(j).attributes.getNamedItem('titolo').text + "' >" + listargdoc.item(j).attributes.getNamedItem('titolo').text + "<br>"}
str=str + "</table>"; tab1.innerHTML=str;}}}//}

function argdoc(n){
// *** visualizza il titolo e il contenuto della pagina pubblicitaria puntata
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table background='css/sfondorig1.jpg' border=1 cellPadding=2 style='position:absolute;top:5%;left:0%;width:104%;zindex:1'>";
str=str + "<tr><td width=75%><font color='#0000aa'><b><center>" + listargdoc.item(n).attributes.getNamedItem('titolo').text + "</center></b><br><br>" + listargdoc.item(n).text + "</table>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2=str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)'>expand</button>");
}

function caratteristiche(){
// *** crea e visualizza la scheda informativa del testo
data1="";data2=""; nca=""; npa=""; nar="";str="";
listautor=xmlcat.getElementsByTagName("autore");
for(i=0;i<listautor.length;i++){
//alert("-" + listcat.item(i).attributes.getNamedItem('nome').text + "-" + autore);
if(listautor.item(i).attributes.getNamedItem('nome').text == autore){
listlib=listautor.item(i).getElementsByTagName('libro');
for(j=0;j<listlib.length;j++){//alert("-" + listlib.item(j).attributes.getNamedItem('titolo').text + "-" + titlib);
if(listlib.item(j).attributes.getNamedItem('titolo').text == titlib){
nca=listlib.item(j).attributes.getNamedItem('numcap').text;
npa=listlib.item(j).attributes.getNamedItem('numpar').text;
nar=listlib.item(j).attributes.getNamedItem('numarg').text;
data1=listlib.item(j).attributes.getNamedItem('datap').text;
data2=listlib.item(j).attributes.getNamedItem('dataua').text;
str = "titolo: \t\t" + titlib + "\n autore: \t\t" + autore + "\n categoria: \t\t" + listlib.item(j).attributes.getNamedItem('categoria').text + "\n il testo contiene: " + listlib.item(j).attributes.getNamedItem('numfig').text + " figure, " + nca + " capitoli, " + npa + " paragrafi, " + nar + " argomenti \n data di pubblicazione " + data1 + " ultimo aggiornamento il " + data2;
alert(str);return;}}}}
}

function presental(){ 	
// *** visualizza la presentazione del libro e la tabella per l'indice
listpresentaz=xmldom.getElementsByTagName("presentazione"); //crea la lista con il solo elemento di presentazione del libro
//str="<head><style>body{color='red' aling='justify'; marginLeft=2%; width=96%}</style></head>";
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table background='css/sfondorig1.jpg' border=1 width=100%><tr><td><font color='#0000aa'><b><center>" + listlibro.item(0).attributes.getNamedItem('titolo').text + "</b><br><br></center><br>" + listpresentaz.item(0).text;
str=str + "</table>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2="<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>" + str
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)'>expand</button>");
str="<table style='position:absolute;top:5%;left:0%;width:104%;zindex:1' cellSpacing=0 cellPadding=5 border=1 frame=hsides borderColor='#00eeaa'>";
//str=str + "<tr><td style='font-size:9pt; color:#ccffee' align=center onclick='indice2()'  title='indice completo del testo'><b>* INDICE generale *</b><br>";
str=str + "<tr><td style='font-size:15; color:00ffcc; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='indice2()'  title='indice completo del testo'><b>* INDICE generale *</b><br>";

str=str + "</table>"; tab1.innerHTML=str;
}

function indice2(){
/*var d; d = new Date(); s = d.getSeconds();
str="<table style='position:absolute;top:5%;left:0%;width:104%;zindex:1' cellSpacing=0 cellPadding=5 border=1 frame=hsides borderColor='#00eeaa'>";
str=str + "<tr><td style='color:#cccccc'>ATTENDERE";
str=str + "</table>"; tab1.innerHTML=str;
//do {d = new Date(); ss = d.getSeconds();}while(ss != 5);
//if(ss == 5){a=indice();}
*/
alert("dare l'OK per la costruzione dell'indice e attendere"); a=indice();
}

function indice(){
carar();
listcap=xmldom.getElementsByTagName("capitolo"); 
numcap=listcap.length;
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table background='css/sfondorig1.jpg' border=1 width=100%><tr><td><font color='#0000aa'><b><center>INDICE ANALITICO DEL TESTO <br><br>" + listlibro.item(0).attributes.getNamedItem('titolo').text + "</center><font style='font-size:9pt'></center><br>N.B. per accedere ai contenuti occorre scegliere dalla SELECT in alto il capitolo corrispondente";
for(i=0;i<numcap;i++){
//str=str + "<li onclick='alert(" + i + ")' > *** " + listcap.item(i).attributes.getNamedItem('tit').text.toLowerCase() + ": " + listcap.item(i).attributes.getNamedItem('titolo').text.toUpperCase();
str=str + "<br><br> &#8226; " + listcap.item(i).attributes.getNamedItem('tit').text.toLowerCase() + ": " + listcap.item(i).attributes.getNamedItem('titolo').text.toUpperCase();
listpar=listcap.item(i).getElementsByTagName("paragrafo"); 
numpar=listpar.length;
for(j=0;j<numpar;j++){
//str=str + "&#160;&#160;&#160;&#160;<li onclick='alert(" + j + ")'> " + listpar.item(j).attributes.getNamedItem('tit').text.toLowerCase() + listpar.item(j).attributes.getNamedItem('titolo').text.toUpperCase();
str=str + "<br><br> &#160;&#160;&#160;&#160;&#187; " + listpar.item(j).attributes.getNamedItem('tit').text.toLowerCase() + ": - " + listpar.item(j).attributes.getNamedItem('titolo').text.toUpperCase() + "<br>";
listarg=listpar.item(j).getElementsByTagName("argomento");
numargg=listarg.length;
for(k=0;k<numargg;k++){
argom[k] = listarg.item(k).attributes.getNamedItem('tit').text;
//str=str + ">&#160;&#160;&#160;&#160;<ol><li onclick='alert(" + k + ")' title='" + listarg.item(k).attributes.getNamedItem('tit').text + "' " + listarg.item(k).attributes.getNamedItem('titolo').text.toUpperCase() + "<br>";
str=str + "&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;" + (k+1) + ": - <B>" + listarg.item(k).attributes.getNamedItem('titolo').text.toUpperCase() + "<br>";
}}}
//str=str + "<br><font size=+2 color='#0000aa'><b><center><br><br><table border=1><tr><td bgColor='#cccccc'>ATTENDERE <BR><BR> E' IN CORSO LA PREPARAZIONE DELL'INDICE</table>";
str=str + "</ol></ul></table>";
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
str2= str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)' title='se il testo contiene simboli tag essi saranno interpretati dal browser e la visualizzazione del testo non sarà corretta'><b>expand</b></button>");
}

function titoli(pp){ 
// *** visualizza l'elenco dei paragrafi contenuti nel capitolo scelto (sccap)
sccap=pp;// memorizza la scelta del capitolo 
//str="<table border=1 width=100% background='vertical2.jpg'>";
str="<table style='position:absolute;top:5%;left:0%;width:104%;zindex:1' cellSpacing=0 cellPadding=5 border=1 frame=hsides borderColor='#00eeaa'>";
str=str + "<tr><td style='color:#ccffee' align=center onclick='prefazc(" + pp + ")'  title='" + listcap.item(pp).attributes.getNamedItem('tit').text + "'><b>" + listcap.item(pp).attributes.getNamedItem('titolo').text + "</b><br>";
//str=str + "<tr><td style='color:#0000aa' align=center onclick='prefazc(" + pp + ")'><b>" + "Capitolo " +  (pp+1) + "°" + "</b>";
listpar=listcap.item(pp).getElementsByTagName("paragrafo"); // lista dei paragrafi presenti nel capitolo relativo al puntatore pp
numpar=listpar.length;
for(i=0;i<numpar;i++){
str=str + "<tr><td style='line-height:1;letter-spacing:+1;font-size:10;font-family:" + String.fromCharCode(34) + "Arial" + String.fromCharCode(34) + "; color:00ffbb; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " onclick='prefazp(" + i + ")' title='" + listpar.item(i).attributes.getNamedItem('tit').text + "' ><b>" + listpar.item(i).attributes.getNamedItem('titolo').text.toUpperCase() + "<br>";}
//for(i=0;i<numpar;i++){str=str + "<tr><td onclick='prefazp(" + i + ")' title='" + listpar.item(i).attributes.getNamedItem('tit').text + "' >" + "Paragrafo " + (pp+1) + "." + (i+1) + "<br>";}
str=str + "<tr><td style='color:#ccffee' align=center onclick='presental()'>prefazione del libro e <br><center>INDICE generale</td></tr>";
str=str + "</table>"; tab1.innerHTML=str;
}

function prefazc(p){ 
// *** visualizza la prefazione relativa al capitolo scelto (puntato da p)
listdescrc=xmldom.getElementsByTagName("descrizionec"); //lista delle descrizioni dei capitoli
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table cellPadding=2 style='position:absolute;top:5%;left:0%;width:104%;zindex:1' background='css/sfondorig1.jpg' border=1 width=100%><tr><td><font color='#0000aa'><b><center><br><font size=5pt>" + listcap.item(p).attributes.getNamedItem('titolo').text + "</b></center></font><br>" + listdescrc.item(p).text;
str=str + "</table>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2="<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>" + str
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)'>expand</button>");
titoli(p);
}

function prefazp(n){k=n;  
// *** visualizza la prefazione relativa al paragrafo puntato
// *** prepara la lista degli argomenti del paragrafo e ne visualizza l'elenco
//listdescrp=xmldom.getElementsByTagName("descrizionep"); //lista delle descrizioni dei paragrafi
listdescrp=listcap.item(sccap).getElementsByTagName("descrizionep"); //lista delle descrizioni dei paragrafi
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table background='css/sfondorig1.jpg' border=1 cellPadding=2 style='position:absolute;top:5%;left:0%;width:104%'>";
//str=str + "<tr><td width=75%><font color='#0000aa'><b>" + listpar.item(n).attributes.getNamedItem('titolo').text + "</b><br>" + listdescrp.item(n).text + "</table>"; 
str=str + "<tr><td width=105%><font color='#0000aa'><b><center>" + listpar.item(n).attributes.getNamedItem('titolo').text  + "</b></center><br>" + listdescrp.item(n).text;
//str=str + "<tr><td width=105%><font color='#0000aa'><b>" + listpar.item(n).attributes.getNamedItem('titolo').text + "</b><br>";
listarg=listpar.item(n).getElementsByTagName("argomento");// lista degli argomenti contenuti nel paragrafo relativo al puntatore n;
str=str + "</table>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2=str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)'>expand</button>");
numarg=listarg.length;
//if(listarg.item(0).text != ""){//avendo messo gli argomenti sul file xml degli argomenti, questo controllo è saltato
str="<table border=1 cellSpacing=0 cellPadding=5 frame=hsides borderColor='#00eeaa'><tr><td style='color:#ccffee' align=center onclick='prefazp(k)' title='" + listpar.item(n).attributes.getNamedItem('tit').text + "'><b>" + listpar.item(n).attributes.getNamedItem('titolo').text + "</b>";
//----------------------------------------
for(j=0;j<numarg;j++){argom[j] = listarg.item(j).attributes.getNamedItem('tit').text;
str=str + "<tr><td style='line-height:1;letter-spacing:+1;font-size:10;font-family:" + String.fromCharCode(34) + "Arial" + String.fromCharCode(34) + "; color:00ffcc; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + "  onclick='arg(" + j + ")' title='" + listarg.item(j).attributes.getNamedItem('tit').text + "' ><b>" + listarg.item(j).attributes.getNamedItem('titolo').text.toUpperCase() + "<br>"}
//td  style='color:#0000aa' onmouseover=" + String.fromCharCode(34) + " this.style.color='#00CCFF'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.color='#cccccc'" + String.fromCharCode(34) + "  
str=str + "<tr><td style='color:#ccffee' align=center onclick='titoli(sccap); prefazc(sccap)'>torna al capitolo</td></tr>";
str=str + "</table>"; tab1.innerHTML=str;}//} 

function arg(n){
// *** visualizza il titolo e il contenuto dell'argomento puntato
if(pass != "ambangiolfaro"){ 
pass = showModalDialog("pass.htm","canc","dialogHeight:10; dialogWidth=20");
//if(pass != "ambangiolfaro"){return;}
if(pass != "ambangiolfaro"){return;}
else{cararg.style.visibility="visible"; alert("è in corso il caricamento dei dati\n\n attendere, prego");
carar();}}
//----------
listarg=nvar.getElementsByTagName("argomento");
numargg=listarg.length;//alert("sono stati caricati " + numargg + " argomenti");
for(j=0;j<numargg;j++){if(listarg.item(j).attributes.getNamedItem('tit').text == argom[n])
{argo=listarg.item(j).text;//alert(argo);
//---------
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table background='css/sfondorig1.jpg' border=1 cellPadding=2 style='position:absolute;top:5%;left:0%;width:104%;zindex:1'>";
//str=str + "<tr><td width=75% style='color:#0000aa'><font color='#0000aa'><b><center>" + listarg.item(n).attributes.getNamedItem('titolo').text + "</center></b><br><br>" + listarg.item(n).text + "</table>"; 
str=str + "<tr><td width=75%><font color='#0000aa'><b><center>" + listarg.item(j).attributes.getNamedItem('titolo').text + "</center></b><br><br>" + argo + "</table>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2= str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
//tabx.document.write("<textarea id=magic style='visibility:visible'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)' title='se il testo contiene simboli tag essi saranno interpretati dal browser e la visualizzazione del testo non sarà corretta'><b>expand</b></button>");
}}}

function carar(){nvar.async="false";//alert(parent.aa.value + filearg);
//nvar.load("xmlarg.xml");
//*** nvar.load(parent.aa.value + filearg);
fil="http://www.servizinterattivi.it/mybook/";nvar.load(fil + filearg);
cararg.style.visibility="hidden";}

function test(){ /* if (parent.aa.value == "Null"){alert("errore")}*/}

function trova(stringa){var re="";var ris=-1;var numar=0;
stringa=stringa.toLowerCase();
if(stringa == ""){alert("manca il testo da ricercare");return;}
if(pass != "ambangiolfaro"){ 
pass = showModalDialog("pass.htm","canc","dialogHeight:10; dialogWidth=20");
if(pass != "ambangiolfaro"){return;}
else{cararg.style.visibility="visible";alert("è in corso il caricamento dei dati\n\n attendere, prego");
carar();}}
listarg=nvar.getElementsByTagName("argomento");
numargg=listarg.length;
str="<body background='/images/sfondo.jpg' ><table border=1 cellspacing=0 frame=hsides borderColor='#00eeaa' cellPadding=5 style='position:absolute;top:0%;left:0%;width:104%;height:75%'>";
//for(i=0;i<numcap;i++){listpar=listcap.item(i).getElementsByTagName("paragrafo");numpar=listpar.length; 
//for(j=0;j<numpar;j++){listarg=listpar.item(j).getElementsByTagName("argomento");numarg=listarg.length; 
//for(k=0;k<numargg;k++){ris=listarg.item(k).text.indexOf(stringa);
for(k=0;k<numargg;k++){ris=listarg.item(k).text.toLowerCase().indexOf(stringa);
if(ris != -1){numar=numar+1; 
//str=str + "<tr><td id=" + i + "," + j + "," + k + " width=75% onclick='visualiz(this.id)'> Argomento " + (i+1) + "." + (j+1) + "." + (k+1);
str=str + "<tr><td style='color:00ffcc; background-color:0000aa' onmouseover=" + String.fromCharCode(34) + "this.style.backgroundColor='#ccffdd'; this.style.color='#000000'" + String.fromCharCode(34) + " onmouseout=" + String.fromCharCode(34) + "this.style.backgroundColor='#0000aa'; this.style.color='00ffcc'" + String.fromCharCode(34) + " id='" + listarg.item(k).attributes.getNamedItem('tit').text + "' width=75% onclick='visualiz(this.id)'>" + listarg.item(k).attributes.getNamedItem('tit').text;
}}
str=str + "</table>"; 
tab1.innerHTML=str;
alert("sono stati trovati \n\n" + numar + " argomenti");}

function visualiz(pp){
for(j=0;j<numargg;j++){if(listarg.item(j).attributes.getNamedItem('tit').text == pp)
{argo=listarg.item(j).text;
//---------
str="<body style='SCROLLBAR-HIGHLIGHT-COLOR: white;SCROLLBAR-SHADOW-COLOR: #aaccff;SCROLLBAR-ARROW-COLOR: #aaccff;SCROLLBAR-BASE-COLOR: #6666bb;scrollbar-3d-light-color: black;scrollbar-dark-shadow-color: black;ScrollBar-Track-Color:#aaccff' background='css/sfondorig1.jpg'><table background='css/sfondorig1.jpg' border=1 cellPadding=2 style='position:absolute;top:5%;left:0%;width:104%;zindex:1'>";
//str=str + "<tr><td width=75%><font color='#0000aa'><b><center>" + listarg.item(j).attributes.getNamedItem('titolo').text + "</center></b><br><br>" + listarg.item(j).text + "</table>"; 
str=str + "<tr><td width=75%><font color='#0000aa'><b><center>" + listarg.item(j).attributes.getNamedItem('titolo').text + "</center></b><br><br>" + argo + "</table>"; 
tabx.document.close();tabx.document.writeln("");tabx.document.writeln(str);
//str2=str + "<button style='position:absolute;top:0;left:0;zindex:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.close()'>chiudi</button>";
//tabx.document.write("<textarea id=magic style='visibility:hidden'>" + str2 + "</textarea>");
//  tabx.document.write("<button style='position:absolute;top:0;left:0;background-color:" + String.fromCharCode(34) + "#ccddff" + String.fromCharCode(34) + "' onclick='window.open().document.writeln(magic.value)' title='se il testo contiene simboli tag essi saranno interpretati dal browser e la visualizzazione del testo non sarà corretta'><b>expand</b></button>");
}}}