filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
function copyright() {
	searchWin = window.open('http://www.valtnet.com/diritto_autore','Copyright','scrollbars=yes,resizable=yes,width=330,height=500,status=no,location=no,toolbar=no');
}
function apri_immagine(str,w,h,didascalia) {
	w+=10;
	h+=10;
	if(typeof didascalia=="undefined" || didascalia=="") didascalia="";
	 else {
	 	didascalia=urlencode(didascalia);
		h=h+40;
	}
	finestra = window.open('visualizza_foto.php?foto='+str+'&didascalia='+didascalia,Math.round(1000*Math.random()).toString(),'scrollbars=no,resizable=no,width='+w+',height='+h+',status=no,location=no,toolbar=no');
}
function mostra(div){
	if(document.getElementById(div)!==null) {
		if(document.getElementById(div).style.display=="block") document.getElementById(div).style.display="none";
		 else document.getElementById(div).style.display="block";
	}
}
function privacy() {
	finestra = window.open('privacy.php','Privacy','scrollbars=yes,resizable=no,width=497,height=242,status=no,location=no,toolbar=no');
}

function urlencode(CODE){

var plaintext = CODE;

	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()’‘";					
	var HEX = "0123456789ABCDEF";
	
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	// VALORE CODIFICATO
	return encoded;
}