function galleriaimg(idc,c1,n,pagina,nn,w,h) {
	window.open("http://www.sardegnadigitallibrary.it/index.php?xsl=625&slide=1&s=17&v=9&c="+idc+"&c1="+c1+"&pagina="+pagina+"&nn="+nn+"&n="+n,"","width="+w+",height="+h+",top=60,left=60,status=no,menubar=no,toolbar=no,scrollbar=no");
	return false;
}

function temporizza(idc,pictemp,c1,numnews){
	window.location.href = "http://www.sardegnadigitallibrary.it/index.php?xsl=625&s=17&v=9&c="+idc+"&slide=1&na=1&pic="+pictemp+"&c1="+c1+"&n="+numnews;
}


function visualizza(par) {
	for (var i=1; i<6; i++) {
		if (par == i)
			document.getElementById('div'+i).style.display='block';
		else
			document.getElementById('div'+i).style.display='none';
	}
	return false;
}
function CambiaComuni(cmp,tab,meteo) {
	document.location.replace('/index.php?xsl=1&s=1&v=9&c=1&nodesc=3&n=10&meteo='+meteo+'&prov='+cmp.options[cmp.options.selectedIndex].value+'&tab='+tab+'#organizza')
}

function PopupCentrataNg(posizione,notizia,w,h,ng) {
	window.open("http://www.sardegnaagricoltura.it/index.php?xsl=467&s=14&v=9&c=3611&notizia="+notizia+"&pic="+posizione+"&ng="+ng,"","width="+w+",height="+h+",top=60,left=60,status=no,menubar=no,toolbar=no,scrollbar=no");
return false;
}

function PopupCentrata(posizione,notizia,w,h) {
	window.open("http://www.sardegnaagricoltura.it/index.php?xsl=467&s=14&v=9&c=3611&notizia="+notizia+"&pic="+posizione,"","width="+w+",height="+h+",top=60,left=60,status=no,menubar=no,toolbar=no,scrollbar=no");
return false;
}

function temporizza(immagine,news,ng){
	window.location.href = "http://www.sardegnaagricoltura.it/index.php?xsl=467&s=14&v=9&c=3611&slide=1&notizia="+news+"&pic="+immagine+"&ng="+ng;
}			

function sendmail(subject){
	window.location.href = "mailto:?subject="+escape(subject)+"&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)";
		}
	}
}
addEvent(window,'load',intercetta);
/*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'èn cookie memorizzato.
	// Altrimenti la lunghezza del document.cookie sarebbe zero.
	if (document.cookie.length > 0) {
		// Poi controlliamo se il nome del cookie èonservato nell'oggetto
		// "document.cookie"della pagina
		
		// Siccome èossibile inserire piùun cookie su una
		// singola pagina, èossibile che il nostro cookie
		// non sia presente, anche se l'oggetto "document.cookie"
		// non èolo un testo vuoto.
		// Se il nome del nostro cookie non èresente, verr� emorizzato 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.
}
