function Orologio(){
	
	var TodayDate = new Date();
	var Giorni = new Array("Domenica","Lunedi","Martedi","Mercoledi","Giovedi","Venerdi","Sabato");
	var Mesi = new Array("gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre");
	GiornoCorrente = TodayDate.getDay();
	Giorno = Giorni[GiornoCorrente];	
	MeseCorrente = TodayDate.getMonth();
	Mese = Mesi[MeseCorrente];
	Data   = TodayDate.getDate();
	Anno   = TodayDate.getFullYear();
	Ore    = TodayDate.getHours();
	if (Ore < 10){Ore = "0"+Ore;}
	Minuti = TodayDate.getMinutes();
	if (Minuti < 10){Minuti = "0"+Minuti;}
	Secondi = TodayDate.getSeconds();
	if (Secondi < 10){Secondi = "0"+Secondi;}
	Datario = Giorno+" "+Data+" "+Mese+" "+Anno+" "+Ore+":"+Minuti+":"+Secondi;
	Calendario.innerHTML = Datario;
	setTimeout("Orologio()", 1000)
}

function submitGoogle(){
	
	var key = document.frmSearch.key.value;	
	if (key != ''){
		document.frmSearch.q.value = 'site:http://www.filosofiapolitica.net ' + key;
		return true;	
	}
	else {
		return false;
	}		
}	

function openWindow(fileName){
	params = 'scrollbars=yes,resizable=no,width=850,height=600,status=no,location=no,toolbar=no';
	window.open(fileName, 'printView', params);
}

function contatore(val){
	max=2000
	if (val.text.value.length > max) {
		val.text.value = val.text.value.substring(0,max)
		rest = 0
	} 
	else {
		rest = max - val.text.value.length
	}
	val.num.value = rest
}

function LunghezzaMax(campo){ 
	if (campo.value.length>2000) { 
		alert("Inserire al massimo 2000 caratteri nella textarea."); 
		campo.value=campo.value.substring(0, 2000); 
	}
}

function invia(key, controlCode){
	
	document.frmCommenti.code.value = key;
	
	if (document.frmCommenti.Utente.value == ''){
		alert("Attenzione:\nE' necessario specificare un nome e un cognome.");
		document.frmCommenti.Utente.focus(); 
		return false;
	}
	if (document.frmCommenti.EMail.value == ''){
		alert("Attenzione:\nE' necessario specificare un'email valida.");
		document.frmCommenti.EMail.focus(); 
		return false; 
	}
	if (document.frmCommenti.Commento.value == ''){
		alert("Attenzione:\nNon si possono lasciare commenti vuoti.");
		document.frmCommenti.Commento.focus(); 
		return false; 
	}

	if (document.frmCommenti.codiceControllo.value != controlCode){
		alert("Attenzione:\nCodice di controllo non valido.");
		document.frmCommenti.codiceControllo.focus(); 
		return false;
	}	
	
return true;		
}

function trim(stringa) {
	while (stringa.substring(0,1) == ' '){
		stringa = stringa.substring(1, stringa.length);
	}
	while (stringa.substring(stringa.length-1, stringa.length) == ' '){
		stringa = stringa.substring(0,stringa.length-1);
	}
	return stringa;
}

function startPhotoGallery(fileName){
	params = 'scrollbars=no,resizable=no,width=700,height=550,status=no,location=no,toolbar=no';
	window.open(fileName, 'photoGallery', params);
}