// JavaScript Document

// Before you reuse this script you may want to have your head examined
	// 
	// Copyright 1999 InsideDHTML.com, LLC.  
	
	function doBlink() {
	  // Blink, Blink, Blink...
	  var blink = document.all.tags("BLINK")
	  for (var i=0; i < blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
	}
	
	function startBlink() {
	  // Make sure it is IE4
	 
	  if (document.all)
		setInterval("doBlink()",800)
	}
	
// Fine BLINK



function Bg(stato,rif) {
	if(stato=='on') {
	rif.style.background='#1180AC';
	rif.style.color='#FFF';
	} else if(stato=='off') {
	rif.style.background='#FFF';
	rif.style.color='#2A597C';
	}
}

function evidenziaMenu(rif,stato) {
	var ogg = document.getElementById(rif);
	var voce = ogg.getElementsByTagName('img');
	if(stato==1) {
		voce[0].src='images/freccia_menu_bianca.gif';
		ogg.style.background='#1180AC';

	} else if(stato!=1) {
		voce[0].src='images/freccia_menu.gif';
		ogg.style.background='#244F6E url(images/bg_menu_categorie.jpg) top left repeat-y';

	}
}

function cambiaImmagine(rif,sorgente) {
	document.getElementById(rif).setAttribute('src',sorgente);
}


function cambiaFontSize(rif) {
	var ogg = document.getElementById(rif);
	var voce = ogg.getElementsByTagName('span');
	for(i=0;i<voce.length;i++) {
		voce[i].style.fontSize='11px';
		voce[i].style.fontFamily='Verdana';
		voce[i].style.visibility='visible';
		}
}

function SottolineaTitolo(id,status) {
	var rif= document.getElementById(id);
	if(status==1) {
		rif.style.background='#ECF1F7';
	} else if(status==0) {
		rif.style.background='none';
	}
}

function SottolineaVai(id,status) {
	var rif= document.getElementById(id);
	if(status==1) {
		rif.style.textDecoration='underline';
	} else if(status==0) {
		rif.style.textDecoration='none';
	}
}

function evidenzia(ogg,stato) {
	var ogg;
	var voce = ogg.getElementsByTagName('img');
	if(stato==1) {
		voce[0].src='images/freccia_menu_bianca.gif';
		ogg.style.background='#1180AC';
	} else if(stato!=1) {
		voce[0].src='images/freccia_menu.gif';
		ogg.style.background='#244F6E url(images/bg_menu_categorie.jpg) top left repeat-y';

	}
}

function SottolineaNews(ogg,stato) {
	var ogg;
	var voce = ogg.getElementsByTagName('b');
	if(stato==1) {
		voce[0].style.textDecoration='underline';
	} else if(stato!=1) {
		voce[0].style.textDecoration='none';
	}

}

function StileMenuSotto(rif) {
	var list = document.getElementById(rif).getElementsByTagName('a');
	for(i=1;i<list.length;i++) {
		list[i].style.borderLeft='1px solid #9DB0B9';
	}
	 document.getElementById(rif).style.visibility='visible';
}



function aggiungiCampi(selectObj) {
	// get the index of the selected option
 	var idx = selectObj.selectedIndex;
	 // get the value of the selected option
	 var which = selectObj.options[idx].value;
	// use the selected option value to retrieve the list of items from the countryLists array
 	cList = valueLists[which];

	var list = document.getElementById('riga').getElementsByTagName('td');
	var top = document.getElementById('riga');
	while (list.length > 0) {
		for(i=0;i<list.length;i++) {
		top.removeChild(list[i]);
		}
 	}

	for (var i=0; i<cList.length; i++) {
		 var testo = cList[i];
		 var b1 = document.getElementById('riga');
		var b2 = document.createElement('td');
		 var c1 = document.createTextNode(testo);
		 b2.appendChild(c1);
		 b1.appendChild(b2);
	}





}

function disabilitaCampo(selectObj) {

	// get the index of the selected option
	// trova il numero di lista dell'opzione selezionata
 	var idx = selectObj.selectedIndex;

	// get the value of the selected option
	// trova il valore dell'opzione selezionata
	var which = selectObj.options[idx].value;
	if (idx==4) {
		// fornisce l'attributo disabled="disabled" al select
		document.getElementById('localita').disabled='disabled';
	} else if (idx!=4) {
		// toglie l'attributo disabled="disabled" al select
		document.getElementById('localita').removeAttribute("disabled");
	}


}


function apri(m){
			document.getElementById(m).style.display = "inline";
		}

	function chiudi(m){
			document.getElementById(m).style.display = "none";
		}
