// <![CDATA[
function createXmlHttpRequest(handler) {
	var xmlhttp = null;
	// informazioni sul nome del browser
	var browserUtente = navigator.userAgent.toUpperCase();
	// browser standard con supporto nativo non importa il tipo di browser
	if (typeof (XMLHttpRequest) === "function"
			|| typeof (XMLHttpRequest) === "object") {
		xmlhttp = new XMLHttpRequest();
		// browser Internet Explorer è necessario filtrare la versione 4
	} else if (window.ActiveXObject && browserUtente.indexOf("MSIE 4") < 0) {
		// la versione 6 di IE ha un nome differente per il tipo di oggetto
		// ActiveX
		if (browserUtente.indexOf("MSIE 5") < 0) {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			// le versioni 5 e 5.5 invece sfruttano lo stesso nome
		} else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	xmlhttp.onreadystatechange = handler;
	return xmlhttp;
}

function getParametroQueryString(parametro) {
	var url = window.location.toString();
	// controllo il parametro con la & all'inizio e l'= alla fine
	parametroTemp = "&" + parametro + "=";
	// prendo la posizione del parametro passato nella URL
	var indice = url.indexOf(parametroTemp);
	// se non esiste nell'URL
	if (indice == -1 || parametro == "") {
		// controllo il parametro con il ? all'inizio e l'= alla fine
		parametroTemp = "?" + parametro + "=";
		// prendo la posizione del parametro passato nella URL
		indice = url.indexOf(parametroTemp);
		if (indice == -1 || parametroTemp == "") {
			return null;
		}
	}
	// prendo la posizione dell'eventuale prima &
	var indice2 = url.indexOf('&', indice + 1);
	// se non ci sono &
	if (indice2 == -1) {
		// prendo la posizione dell'eventuale #
		var indice2 = url.indexOf('#', indice);
		// se non ci sono # indice2 è uguale alla lunghezza della URL
		if (indice2 == -1) {
			indice2 = url.length;
		}
	}
	// restituisco la parte di URL relativa al parametro cercato
	var valore = unescape(url.substring(indice + parametroTemp.length, indice2));
	return valore;
}

function nRossa(arrayTag) {
	for (i = 0; i <= 11; i++) {
		var nodo = document.getElementById("nRossa" + i)
		stringa = nodo.firstChild.nodeValue;
		stringa = stringa.split("n");
		while (nodo.firstChild) {
			nodo.removeChild(nodo.firstChild);
		}
		for (x = 0; x < stringa.length; x++) {
			nodo.appendChild(document.createTextNode(stringa[x]));
			if (x < stringa.length - 1) {
				var span = document.createElement("span");
				span.className = "coloreAcceso";
				span.appendChild(document.createTextNode("n"));
				nodo.appendChild(span);
			}
		}
	}
}

// ]]>
