addEvent(window,'load',intercetta);
function sendmail(subject){
	window.location.href = "mailto:?subject="+escape(subject)+"&amp;body="+escape(window.location);
	return false;
}
function intercetta() {
	for (var i=0; i<document.links.length; i++) {
		if (document.links[i].rel=="blank") {
			document.links[i].target="_blank";
			document.links[i].title = document.links[i].title+" (apertura in nuova finestra)";
		}
	}
}
/*window.onload = intercetta;*/
function addEvent(obj, evType, fn){ 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} else if (obj.attachEvent){ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else { 
		return false; 
	} 
}
function openPopUp(url, larghezza, altezza){
	var location=url;
	if (location!=''){
		var DispWin;
		DispWin=window.open(location, '','toolbar=no, "NewWin", status=yes,resizable=yes,,scrollbars=yes, width='+larghezza+', height='+altezza+',  top=1, left=1');
		DispWin.focus();
	}
	return false;
}

function stoperror(){return true;}

window.onerror=stoperror;

function getCookie(NameOfCookie){
	// Prima controlliamo se c'è un cookie memorizzato.
	// Altrimenti la lunghezza del document.cookie sarebbe zero.
	if (document.cookie.length > 0) {
		// Poi controlliamo se il nome del cookie è conservato nell'oggetto
		// "document.cookie"della pagina
		
		// Siccome è possibile inserire più di un cookie su una
		// singola pagina, è possibile che il nostro cookie
		// non sia presente, anche se l'oggetto "document.cookie"
		// non è solo un testo vuoto.
		// Se il nome del nostro cookie non è presente, verrà memorizzato il valore -1
		// nella variabile chiamata "begin".
		
		begin = document.cookie.indexOf(NameOfCookie+"=");
		if (begin != -1) {
			// Il nostro cookie e' presente.
			// Il valore memorizzato nel cookie viene rimandato dalla funzione.
			begin += NameOfCookie.length+1;
			end = document.cookie.indexOf(";", begin);
			if (end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(begin, end)); 
		}
	}
	return null;
	// Il nostro cookie non era presente.
	// Il valore "null" viene rimandato dalla funzione.
}
function s3d_openPopUp(url, larghezza, altezza){
	if (url!=''){
		var DispWin;
		var winl = (screen.width-larghezza)/2;
		var wint = (screen.height-altezza)/2;
		if (winl < 0) winl = 0;
		if (wint < 0) wint = 0;
		DispWin=window.open(url, '','toolbar=no,"NewWin",status=yes,resizable=yes,scrollbars=no,width='+larghezza+',height='+altezza+',top='+wint+',left='+winl);
		DispWin.focus();
	}
	return false;
}
function Check_s3d(url,idcat) {
	s3d_openPopUp("http://www.sardegna3d.it/xml/check_s3d.php?idcat="+idcat+"&url="+escape(url),530,100);
	return false;
}

