//  FUNZIONE DI CONTROLLO SU FRAME DA PARTE DELLE PAGINE BARRA
function selBarra () {
	if  (window.name !== "barra_navigazione") {
		if  (sFr == 2) {
			frame1 = sSection  + "_tendina_1.htm";
			frame2 = sSection + "_testo_1_1.htm";
			destin = sSection  + ".asp?tendina=" + frame1 + "&amp;testo=" + frame2;
			window.parent.location.assign (destin);
		}
		if  (sFr == 1) {
			frame2 = sSection + "_testo_1.htm";
			destin = sSection  + ".asp?testo=" + frame2;
			window.location.assign (destin);
		}
	}
}


//  FUNZIONE DI CONTROLLO SELEZIONE TENDINA (se pFr=2) O SULLA BARRA (se pFr=1)
function selSezione () {
// verifica che non sia una nuova finestra
	if  ( (window.name !== "testo") && (window.name !== "tendina") &&  (window.name !== "barra_navigazione") &&  (window.name !== "inferiore")  ) {
		if  (pFr == 2) {
			frame1 = pSection  + "_tendina_" +  pB + ".htm";
			frame2 = pSection + "_testo_" +  pB + "_" + sT + ".htm";
			destin = pSection  + ".asp?tendina=" + frame1 + "&amp;testo=" + frame2;
			window.parent.location.assign (destin);
		 }
		if  (pFr == 1) {
			frame2 = pSection + "_testo_" +  pB + ".htm";
			destin = pSection  + ".asp?testo=" + frame2;
			window.parent.location.assign (destin);
		}
	}
	else
	selSezione_1 ();
}

function selSezione_1 () {
	// verifica se la chiamata è fatta da pagina a 2 frames (pFr ==1  da pagina testo) o da pagina a 3 frames (pFr ==2  da pagina di tendina)
	if  (pFr == 1) {selSezione_2a ();}
	if  (pFr == 2) {selSezione_2b ();}	
}

function selSezione_2a () {
	//  se il nome della finestra non è inferiore, occore ricaricare tutto
	if  (window.name !== "inferiore") {
		frame2 = pSection + "_testo_" +  pB + ".htm";
		destin = pSection  + ".asp?testo=" + frame2;
		window.parent.location.assign (destin);
	}
	if  (window.parent.frames(0).sSection ) {
		if  (window.parent.frames(0).sSection !== pSection) {
			// richiamato da pagina di testo su struttura a 2 frames
			frame2 = pSection + "_testo_" + pB + ".htm";
			destin = pSection  + ".asp?testo=" + frame2;
			window.parent.location.assign (destin);
		}
		else  
			selSezione_3 ();
		}	
	else {window.setTimeout("selSezione_2a ()",300);}	
	}	


function selSezione_2b () {
	//  se il nome della finestra non è tendina, occore ricaricare tutto
	if  (window.name !== "tendina") {
		frame1 = pSection  + "_tendina_" +  pB + ".htm";
		frame2 = pSection + "_testo_" + pB + "_1.htm";
		destin = pSection  + ".asp?tendina=" + frame1 + "&amp;testo=" + frame2;
		window.parent.location.assign (destin);
	}
	if  (window.parent.frames(0).sSection ) {
		if  (window.parent.frames(0).sSection !== pSection) {
			// richiamato da pagina di tendina su struttura a 3 frames
			frame1 = pSection  + "_tendina_" +  pB + ".htm";
			frame2 = pSection + "_testo_" + pB + "_1.htm";
			destin = pSection  + ".asp?tendina=" + frame1 + "&amp;testo=" + frame2;
			window.parent.location.assign (destin);
		}
		else  
		selSezione_3 ();
	}
	else {window.setTimeout("selSezione_2b ()",300);}	
}	

function selSezione_3 () {
      nB = ""
      if  (window.parent.frames(0).sB && window.parent.frames(0).B1) {
	if  (window.parent.frames(0).sB !== pB) {
		nB = window.parent.frames(0).nBT
		if ( (nB>=1) && (pB !== 1)  ) { window.parent.frames(0).B1.className = "vocebarra";}
		if ( (nB>=1) && (pB == 1)  ) { window.parent.frames(0).B1.className = "voceselezionata";}
		if ( (nB>=2) && (pB !== 2)  ) { window.parent.frames(0).B2.className = "vocebarra";}
		if ( (nB>=2) && (pB == 2)  ) { window.parent.frames(0).B2.className = "voceselezionata";}
		if ( (nB>=3) && (pB !== 3)  ) { window.parent.frames(0).B3.className = "vocebarra";}
		if ( (nB>=3) && (pB == 3)  ) { window.parent.frames(0).B3.className = "voceselezionata";}
		if ( (nB>=4) && (pB !== 4)  ) { window.parent.frames(0).B4.className = "vocebarra";}
		if ( (nB>=4) && (pB == 4)  ) { window.parent.frames(0).B4.className = "voceselezionata";}
		if ( (nB>=5) && (pB !== 5)  ) { window.parent.frames(0).B5.className = "vocebarra";}
		if ( (nB>=5) && (pB == 5)  ) { window.parent.frames(0).B5.className = "voceselezionata";}
		if ( (nB>=6) && (pB !== 6)  ) { window.parent.frames(0).B6.className = "vocebarra";}
		if ( (nB>=6) && (pB == 6)  ) { window.parent.frames(0).B6.className = "voceselezionata";}
		if ( (nB>=7) && (pB !== 7)  ) { window.parent.frames(0).B7.className = "vocebarra";}
		if ( (nB>=7) && (pB == 7)  ) { window.parent.frames(0).B7.className = "voceselezionata";}
	}
      }
      else {window.setTimeout("selSezione_3 ()",300);}	
}	


//  FUNZIONE DI CONTROLLO SELEZIONE SULLA BARRA (se pFr=2)
function selTendina () {
// verifica che non sia una nuova finestra
	if  ( (window.name !== "testo") && (window.name !== "tendina") &&  (window.name !== "barra_navigazione")  ) {
		if  (pFr == 2) {	frame1 = pSection  + "_tendina_" +  pTendina + ".htm";
			frame2 = pSection + "_testo_" +  pTendina + "_" + pT + ".htm";
			destin = pSection  + ".asp?tendina=" + frame1 + "&amp;testo=" + frame2;
			window.parent.location.assign (destin);	}
		if  (pFr == 1) {	frame2 = pSection + "_testo_" +  pB + ".htm";
			destin = pSection  + ".asp?testo=" + frame2;
			window.parent.location.assign (destin);	}
	}
	else 
	selTendina1 ();
}

function selTendina1 () {
	if  (window.parent.frames(0).sSection ) {
       		if  (window.parent.frames(0).sSection !== pSection) {
			if  (pFr == 2) {	frame1 = pSection  + "_tendina_" +  pTendina + ".htm";
				frame2 = pSection + "_testo_" + pTendina + "_" + pT + ".htm";
				destin = pSection  + ".asp?tendina=" + frame1 + "&amp;testo=" + frame2;
				window.parent.location.assign (destin);	 }
			if  (pFr == 1) {	frame2 = pSection + "_testo_" + pB + ".htm";
				destin = pSection  + ".asp?testo=" + frame2;
				window.parent.location.assign (destin);	 }
	 	}
		 else
		 selTendina2 ();
	}
	else {window.setTimeout("selTendina1 ()",300);}	
}	

function selTendina2 () {
      nT = ""
      if  (window.parent.frames(1).sT && window.parent.frames(1).T1 ) {
	if   (window.parent.frames(1).sT !== pT) { 
		nT = window.parent.frames(1).nTT
		if ( (nT>=1) && (pT !== 1))  {  window.parent.frames(1).T1.className = "vocetendina";}
		if ( (nT>=1) && (pT == 1))  { window.parent.frames(1).T1.className = "vocetselezionata";
					 window.parent.frames(1).sT = 1;}
		if ( (nT>=2) && (pT !== 2))  {  window.parent.frames(1).T2.className = "vocetendina";}
		if ( (nT>=2) && (pT == 2))  { window.parent.frames(1).T2.className = "vocetselezionata";
					 window.parent.frames(1).sT = 2;}
		if ( (nT>=3) && (pT !== 3))  {  window.parent.frames(1).T3.className = "vocetendina";}
		if ( (nT>=3) && (pT == 3))  { window.parent.frames(1).T3.className = "vocetselezionata";
					 window.parent.frames(1).sT = 3;}
		if ( (nT>=4) && (pT !== 4))  {  window.parent.frames(1).T4.className = "vocetendina";}
		if ( (nT>=4) && (pT == 4))  { window.parent.frames(1).T4.className = "vocetselezionata";
					 window.parent.frames(1).sT = 4;}
		if ( (nT>=5) && (pT !== 5))  {  window.parent.frames(1).T5.className = "vocetendina";}
		if ( (nT>=5) && (pT == 5))  { window.parent.frames(1).T5.className = "vocetselezionata";
					 window.parent.frames(1).sT = 5;}
		if ( (nT>=6) && (pT !== 6))  {  window.parent.frames(1).T6.className = "vocetendina";}
		if ( (nT>=6) && (pT == 6))  { window.parent.frames(1).T6.className = "vocetselezionata";
					 window.parent.frames(1).sT = 6;}
		if ( (nT>=7) && (pT !== 7))  {  window.parent.frames(1).T7.className = "vocetendina";}
		if ( (nT>=7) && (pT == 7))  { window.parent.frames(1).T7.className = "vocetselezionata";
					 window.parent.frames(1).sT = 7;}
		if ( (nT>=8) && (pT !== 8))  {  window.parent.frames(1).T8.className = "vocetendina";}
		if ( (nT>=8) && (pT == 8))  { window.parent.frames(1).T8.className = "vocetselezionata";
					 window.parent.frames(1).sT = 8;}
		if ( (nT>=9) && (pT !== 9))  {  window.parent.frames(1).T9.className = "vocetendina";}
		if ( (nT>=9) && (pT == 9))  { window.parent.frames(1).T9.className = "vocetselezionata";
					 window.parent.frames(1).sT = 9;}
		if ( (nT>=10) && (pT !== 10))  {  window.parent.frames(1).T10.className = "vocetendina";}
		if ( (nT>=10) && (pT == 10))  { window.parent.frames(1).T10.className = "vocetselezionata";
					 window.parent.frames(1).sT = 10;}
		if ( (nT>=11) && (pT !== 11))  {  window.parent.frames(1).T11.className = "vocetendina";}
		if ( (nT>=11) && (pT == 11))  { window.parent.frames(1).T11.className = "vocetselezionata";
					 window.parent.frames(1).sT = 11;}
		if ( (nT>=12) && (pT !== 12))  {  window.parent.frames(1).T12.className = "vocetendina";}
		if ( (nT>=12) && (pT == 12))  { window.parent.frames(1).T12.className = "vocetselezionata";
					 window.parent.frames(1).sT = 12;}
		if ( (nT>=13) && (pT !== 13))  {  window.parent.frames(1).T13.className = "vocetendina";}
		if ( (nT>=13) && (pT == 13))  { window.parent.frames(1).T13.className = "vocetselezionata";
					 window.parent.frames(1).sT = 13;}
		if ( (nT>=14) && (pT !== 14))  {  window.parent.frames(1).T14.className = "vocetendina";}
		if ( (nT>=14) && (pT == 14))  { window.parent.frames(1).T14.className = "vocetselezionata";
					 window.parent.frames(1).sT = 14;}
		if ( (nT>=15) && (pT !== 15))  {  window.parent.frames(1).T15.className = "vocetendina";}
		if ( (nT>=15) && (pT == 15))  { window.parent.frames(1).T15.className = "vocetselezionata";
					 window.parent.frames(1).sT = 15;}
		if ( (nT>=16) && (pT !== 16))  {  window.parent.frames(1).T16.className = "vocetendina";}
		if ( (nT>=16) && (pT == 16))  { window.parent.frames(1).T16.className = "vocetselezionata";
					 window.parent.frames(1).sT = 16;}
		if ( (nT>=17) && (pT !== 17))  {  window.parent.frames(1).T17.className = "vocetendina";}
		if ( (nT>=17) && (pT == 17))  { window.parent.frames(1).T17.className = "vocetselezionata";
					 window.parent.frames(1).sT = 17;}
		if ( (nT>=18) && (pT !== 18))  {  window.parent.frames(1).T18.className = "vocetendina";}
		if ( (nT>=18) && (pT == 18))  { window.parent.frames(1).T18.className = "vocetselezionata";
					 window.parent.frames(1).sT = 18;}
		if ( (nT>=19) && (pT !== 19))  {  window.parent.frames(1).T19.className = "vocetendina";}
		if ( (nT>=19) && (pT == 19))  { window.parent.frames(1).T19.className = "vocetselezionata";
					 window.parent.frames(1).sT = 19;}
		if ( (nT>=20) && (pT !== 20))  {  window.parent.frames(1).T20.className = "vocetendina";}
		if ( (nT>=20) && (pT == 20))  { window.parent.frames(1).T20.className = "vocetselezionata";
					 window.parent.frames(1).sT = 20;}
		if ( (nT>=21) && (pT !== 21))  {  window.parent.frames(1).T21.className = "vocetendina";}
		if ( (nT>=21) && (pT == 21))  { window.parent.frames(1).T21.className = "vocetselezionata";
					 window.parent.frames(1).sT = 21;}
		if ( (nT>=22) && (pT !== 22))  {  window.parent.frames(1).T22.className = "vocetendina";}
		if ( (nT>=22) && (pT == 22))  { window.parent.frames(1).T22.className = "vocetselezionata";
					 window.parent.frames(1).sT = 22;}
	}
      }
      else {window.setTimeout("selTendina2 ()",300);}	
}	