var c=0,p=0;
var pagine = new Array();
pagine[c++]="";
pagine[c++]="gr2";
pagine[c++]="gr3";
pagine[c++]="gr4";
pagine[c++]="gr5"; //uno in pių per il contatore

// La funzione per cambiare i fogli di stile
function templateChange(){
	//controllo browser
	if(!document.styleSheets){
		var ss = getAllSheets() //Opera
	}else{
		var ss = document.styleSheets; //Dom
	}
	// disabilita tutti i fogli di stile con un titolo 
	// tranne quello passato per argomento alla funzione
	for( var x = 0; x < ss.length; x++ ) {
		if( ss[x].title ) {
			ss[x].disabled=true;
		}
		for( var y = 0; y < arguments.length; y++ ) {
			//controlla ogni titolo ...
			if(ss[x].title == arguments[y]){
				//e riabilita il foglio di stile se ha il titolo scelto
				ss[x].disabled=false;
			}
		}
	}
	if( !ss.length ) { 
		alert( 'Il tuo browser non č abilitato a cambiare i fogli di stile CSS' );
	}
}

// ---------------------------------------------------------------------------------

// Funzione per Opera
function getAllSheets(){
	if( document.getElementsByTagName ) {
		var Lt = document.getElementsByTagName('LINK');
		var St = document.getElementsByTagName('STYLE');
	} else {
		// browser minori - restituisce array vuoto
		return []; 
	}
	//per tutti i tag link ...
	for( var x = 0, os = []; Lt[x]; x++ ) {
		//controlla l'attributo rel per vedere se contiene 'style'
		if( Lt[x].rel ) {
			var rel = Lt[x].rel;
		} else if( Lt[x].getAttribute ) {
			var rel = Lt[x].getAttribute('rel');
		} else {
			var rel = '';
		}
		if(typeof(rel)=='string'&&rel.toLowerCase().indexOf('style')+1){
			//riempe la variabile os con i stylesheets linkati
			os[os.length] = Lt[x];
		}
	}
	//include anche tutti i tags style e restituisce l'array
	for( var x = 0; St[x]; x++ ) {
		os[os.length] = St[x];
	}
	return os;
}

// ---------------------------------------------------------------------------------

// Infine la funzione per gestire le select del documento
function temaChange(s){

if (p<0)p=0
	eval("p"+s+s);
   //p<0?p=c-1:p==c?p=0:null;
   //alert(pagine[p]);
if (pagine[p]=="gr5")
	{
	p=p-1
	}
else
	{
		templateChange(pagine[p]);
	}
	
}

// ---------------------------------------------------------------------------------

// funzione per gestire le descrizioni del flash estratto conto
function apri(numero)
{
if (numero==1)
{
document.getElementById("explain").innerHTML = "<strong>titolo:</strong><br/>descrizione 1";
}
if (numero==2)
{
document.getElementById("explain").innerHTML = "<strong>titolo2:</strong><br/>descrizione 2";
}
if (numero==1)
{
document.getElementById("explain").innerHTML = "<strong>titolo3:</strong><br/>descrizione 3";
}
if (numero==1)
{
document.getElementById("explain").innerHTML = "<strong>titolo4:</strong><br/>descrizione 4";
}
}

