<!--
/* closure 
http://simon.incutio.com/archive/2004/05/26/addLoadEvent */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
//-->

<!-- 

	/* carica pagina da menu select */
	
	function caricaPagina(qualeMenu) {
		percorsoMenu = document.getElementById(qualeMenu);
		paginaURL = percorsoMenu.options[percorsoMenu.selectedIndex].value;
		if (paginaURL) location.href = paginaURL;
	}

//-->

<!-- 

	/* 'pulisciCampo()' */ 
	
	function pulisciCampo(theText) { 
		if (theText.value == theText.defaultValue) { 
			theText.value = "" 
		}
	}

//-->

<!--

	/* 'ctrlVal()' */ 
	
var l_object = new Object();
function ctrlVal(obj, val) {
	var value = obj.value;
	if(val == undefined){
		if(value == ''){
			obj.value = l_object.value;
		}
	} else{
		if(value == val){
			obj.value = '';
		}
		l_object.value = val;
	}
}
//-->

<!-- 

	/* 'cercaCon()' */ 
	function Ricerca() { 
		var site = "nuoveschiavitu.it"; 
		var termine = document.ricerca.cerca.value; 
		location.href = "http://www.google.it/search?as_q=" + termine + "&num=10&hl=it&ie=UTF-8&btnG=Cerca+con+Google&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_occt=any&as_dt=i&as_sitesearch=" + site; 
	}

//-->

<!-- 

	/* 'aggiungiZebra()' */ 
	
	// bug in IE 
	function hasClass(obj) { 
		var result = false; 
		if (obj.getAttributeNode("class") != null) { 
			result = obj.getAttributeNode("class").value; 
		} 
		return result; 
	}

	function aggiungiZebra(id) { 
		var even = false; 
		// colori di default 
		var evenColor = arguments[1] ? arguments[1] : "#fff"; 
		var oddColor = arguments[2] ? arguments[2] : "#eee"; 
		// riferimento alla tabella desiderata 
		var table = document.getElementById(id); 
		if (! table) { return; } 
		var tbodies = table.getElementsByTagName("tbody"); 
		for (var h = 0; h < tbodies.length; h++) { 
			var trs = tbodies[h].getElementsByTagName("tr"); 
			for (var i = 0; i < trs.length; i++) { 
				// evita le colonne o le righe che hanno 
				// gią un riempimento di colore 
				if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) { 
					var tds = trs[i].getElementsByTagName("td"); 
					for (var j = 0; j < tds.length; j++) { 
						var mytd = tds[j]; 
						// evita le celle che hanno 
						// gią una classe o stile assegnati 
						if (! hasClass(mytd) && ! mytd.style.backgroundColor) { 
							mytd.style.backgroundColor = even ? evenColor : oddColor; 
						} 
					} 
				} 
				even =  ! even; 
			} 
		} 
	}

//-->

<!-- 

	/* 'linkStampa()' */ 

	function linkStampa() {
		urlFinestra = window.location.href.slice(28);
		window.open("/stampa.php?qualeUrl="+urlFinestra,"newwin","width=402,height=500,top=100,left=100,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes")
	}

	function linkStampaScheda() {
		urlFinestra = window.location.href.slice(28);
		window.open("/stampa_scheda.php?qualeUrl="+urlFinestra,"newwin2","width=402,height=500,top=100,left=100,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes")
	}

	function linkStampaEvidenza() {
		urlFinestra = window.location.href.slice(28);
		window.open("/stampa_evidenza.php?qualeUrl="+urlFinestra,"newwin3","width=402,height=500,top=100,left=100,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes")
	}
	
	function linkStampaProgetto() {
		urlFinestra = window.location.href.slice(28);
		window.open("/stampa_progetto.php?qualeUrl="+urlFinestra,"newwin4","width=402,height=500,top=100,left=100,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes")
	}

	function linkStampaOpinione() {
		urlFinestra = window.location.href.slice(28);
		window.open("/stampa_opinione.php?qualeUrl="+urlFinestra,"newwin5","width=402,height=500,top=100,left=100,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,status=yes,location=yes")
	}
	
//-->

<!-- 
	//	target '_blank' ai link esterni
	function cambiaLinkEsterni(seHTTP, tranneQuestoHTTP) {
		var totLink = document.links.length; //alert("totLink: "+totLink); // totale link da controllare
		// controllo ogni link
		for (var i=0;i<totLink;i++) { 
			// document.links[i].setAttribute("title",document.links[i].href); aggiungo tooltip
			// procedo solo se contiene "HTTP://"
			if(document.links[i].getAttribute("href").lastIndexOf(seHTTP) != -1) {
				var ifIP = document.links[i].getAttribute("href"); // l'URL completo da controllare
				ifIP = ifIP.replace("http://", "") // tolgo "HTTP://"
				ifIP = ifIP.replace(ifIP.slice(ifIP.indexOf("/")), ""); // tengo solo fino al primo "/"
				ifIP = ifIP.split(".", 10); // elimino i "." e metto le sottostringhe in un array
				var ifIPOk= "";
				for (u=0;u<ifIP.length;u++) {
					ifIPOk = ifIPOk+ifIP[u]; // concateno i singoli pezzi in un'unica stringa (senza i punti)
				}
				var IPRegExpObj = /\d{4,}/; // pattern per controllare se ci sono piu' di 4 numeri... (num IP)
				// se ci sono pił di 4 numeri e se 
				// nella stringa non compare il dominio di questo sito
				if (ifIPOk.match(IPRegExpObj) || document.links[i].getAttribute("href").lastIndexOf(tranneQuestoHTTP) == -1) {
					// e se non e' un link 'javascript' o un'ancora "#"
					// allora cambio lo stile al link
					if (document.links[i].getAttribute("href").lastIndexOf("javascript:") == -1 || document.links[i].getAttribute("href") != "#") {
						document.links[i].setAttribute("target","_blank"); // apri in una nuova finestra
					}
				}
			}
		}
	}
	
	window.onload = function () {
		// se il browser supporta gli oggetti DOM
		if (document.getElementById) {
			cambiaLinkEsterni('http://','nuoveschiavitu.it'); // 'http://','nuoveschiavitu.' ('nuoveschiavitu_' temp)
		}
	}
//-->

