// scritta illuminante
function cBcOv(i) { 
 var ele = document.getElementById (i);
 ele.style.backgroundColor = "#016969";
}
function cBcOu(i) { 
 var ele = document.getElementById (i);
 ele.style.backgroundColor = "#02A4A4";
}
// loading
function wait() {
var menu1 = document.getElementById('menu1');
menu1.style.display = 'block';
}
// loading ok
function waitOk() {
var menu1 = parent.leftFrame.document.getElementById('menu1');
menu1.style.display = 'none';
}
// menù
function resetA() {
var pri = document.getElementById('pri');
var cir = document.getElementById('cir');
var qui = document.getElementById('qui');
var prm = document.getElementById('prm');
var cap = document.getElementById('cap'); 
 var aur = document.getElementById('aur');
 var pro = document.getElementById('pro');
var spettacoli = document.getElementById('spettacoli');
var spettacoli1 = document.getElementById('spettacoli1');
pri.style.display = 'none';
cir.style.display = 'none';
qui.style.display = 'none';
prm.style.display = 'none';
cap.style.display = 'none';
aur.style.display = 'none';
pro.style.display = 'none';
spettacoli.style.display = 'block';
spettacoli1.style.display = 'none';
}
function resetWait() {
resetA();
wait();
}
function spettacoli() { 
var pri = document.getElementById('pri');
var cir = document.getElementById('cir');
var qui = document.getElementById('qui');
var prm = document.getElementById('prm');
var cap = document.getElementById('cap');
var aur = document.getElementById('aur');
var pro = document.getElementById('pro');
var spettacoli = document.getElementById('spettacoli');
var spettacoli1 = document.getElementById('spettacoli1');
pri.style.display = 'block';
cir.style.display = 'block';
qui.style.display = 'block';
prm.style.display = 'block';
cap.style.display = 'block';
aur.style.display = 'block';
pro.style.display = 'block';
spettacoli.style.display = 'none';
spettacoli1.style.display = 'block';
}
// archivio mostra e nascondi 
function archivio(nomeDiv){
var spettArchivio = document.getElementById('spettArchivio');
var nomeDiv = document.getElementById(nomeDiv);
var arrDiv = spettArchivio.getElementsByTagName('div');
for(var i = 0; i < arrDiv.length; i++)
if (nomeDiv == arrDiv[i]){
arrDiv[i].style.display = 'block';
}
else{
arrDiv[i].style.display = 'none';
}
}

// animazione cammina cammina
function animCamm() {
window.open('immArchivio/cammina.html','cammina','width=650px,height=690px,resizable,scrollbars,top=0px,screenY=0px,left=180px,screenX=180px');
}

// tasto eventi lampeggiante
function rprEventi() {
var ele = document.getElementById ('eventi');
ele.style.backgroundColor = "#009393";
ele.style.borderTopColor =  "#00B0B0";
ele.style.borderRightColor = "#007D7D";
ele.style.borderBottomColor = "#007D7D";
ele.style.borderLeftColor = "#00B0B0";
}
function lampEventi() {
var ele = document.getElementById ('eventi');
ele.style.backgroundColor = "#0099AE";
ele.style.borderTopColor =  "#00A4BB";
ele.style.borderRightColor = "#008193";
ele.style.borderBottomColor = "#008193";
ele.style.borderLeftColor = "#00A4BB";
window.setTimeout(rprEventi,800)
}
function lampTastoEventi(){
window.setInterval(lampEventi, 2000)
}


// apri pagina eventi
function eventi(){
window.open('pagAsp/eventi.asp','eventi','width=398px,height=268px,top=145px,screenY=145px,left=200px,screenX=200px')
}



//mailing
//open mailing
function mailing(){
window.open('pagAsp/mailing.asp','mailing','width=418px,height=218px,top=145px,screenY=145px,left=180px,screenX=180px')
}


// verifica modulo mailing
function verificaMailing(){
var frmMailing = document.mailing.email.value;
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!email_reg_exp.test(frmMailing) || (frmMailing == "") || (frmMailing == undefined))
{
alert('inserire un indirizzo email valido! ');
document.mailing.email.select();
return false;
}
}

// verifica modulo posta
function verificaPosta(){
var frmMailing = document.posta.emailMitt.value;
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (frmMailing == ""){
alert('inserire il proprio indirizzo email per avere una risposta! '); 
document.posta.emailMitt.select();
return false
}
else if (!email_reg_exp.test(frmMailing)  || (frmMailing == undefined))
{
alert('inserire un indirizzo email valido! ');
document.posta.emailMitt.select();
return false;
}
}


//posta
function posta(ind){
var strInd = ind;
var url = '../pagAsp/posta.asp?nomeInd='+strInd;
window.open(url,'posta','width=418px,height=408px,top=145px,screenY=145px,left=200px,screenX=200px')
}


//minuscolo posta
function minuscoloPosta(){
var strEmail = document.posta.emailMitt.value;
var a = strEmail.toLowerCase();
document.posta.emailMitt.value = a;
}


//minuscolo mailing
function minuscoloMailing(){
var strEmail = document.mailing.email.value;
var a = strEmail.toLowerCase();
document.mailing.email.value = a;
}


//minuscolo areaRiservata
function minuscoloAreaRiservata(){
var strNome = document.areaRiservata.nomeUtente.value;
var a = strNome.toLowerCase();
document.areaRiservata.nomeUtente.value = a;
}

//stage
function stage(){
window.open('stage.html','stage','width=398px,height=596px,top=145px,screenY=145px,left=200px,screenX=200px')
}

//area riservata
function openAreaRiservata(){
window.open('pagAsp/areaRiservata.asp','areaRiservata','width=418px,height=245px,top=145px,screenY=145px,left=200px,screenX=200px')
}


// verifica areRiservata
function verificaAreaRiservata(){
var strErrore = 'compila correttamente i seguenti campi:\n'
var frmNomeUtente = document.areaRiservata.nomeUtente.value;
var frmPassWord = document.areaRiservata.passWord.value;
if ((frmNomeUtente =="") || (frmNomeUtente == undefined))
strErrore = strErrore + '\n- nome utente -\n'
if ((frmPassWord =="") || (frmPassWord == undefined))
strErrore = strErrore + '\n- password -'
if ((frmNomeUtente =="") || (frmNomeUtente == undefined) || (frmPassWord =="") || (frmPassWord == undefined)){
alert(strErrore);
return false;
}
}


//chiudi pagina
function chiudi(){
window.close();
}


// AreaRiservata
// visualizza livello alto
function vsLivelloA(){
var tastoTitAreaRis = document.getElementById('titAreaRis');
var tastoInviaMailing = document.getElementById('sendMailing');
var tastoGstMailing = document.getElementById('gstMailing');
var tastoGstCalendario = document.getElementById('gstCalendario');
tastoTitAreaRis.style.display = 'block';
tastoInviaMailing.style.display = 'block';
tastoGstMailing.style.display = 'block';
tastoGstCalendario.style.display = 'block';

}
//opener livello alto
function vsA(){
opener.vsLivelloA();
}
function livelloA(){
window.setTimeout(vsA,200);
window.setTimeout(chiudi,700);
}
// visualizza livello medio
function vsLivelloM(){
var tastoTitAreaRis = document.getElementById('titAreaRis');
var tastoInviaMailing = document.getElementById('sendMailing');
var tastoGstCalendario = document.getElementById('gstCalendario');
tastoTitAreaRis.style.display = 'block';
tastoInviaMailing.style.display = 'block';
tastoGstCalendario.style.display = 'block';
}
//opener livello medio
function vsM(){
opener.vsLivelloM();
}
function livelloM(){
window.setTimeout(vsM,200);
window.setTimeout(chiudi,700);
}
// visualizza livello basso
function vsLivelloB(){
var tastoTitAreaRis = document.getElementById('titAreaRis');
tastoTitAreaRis.style.display = 'block';
}
//opener livello basso
function vsB(){
opener.vsLivelloB();
}
function livelloB(){
window.setTimeout(vsB,200);
window.setTimeout(chiudi,700);
}
// oscura livelli
function osLivelli(){
var tastoTitAreaRis = document.getElementById('titAreaRis');
var tastoInviaMailing = document.getElementById('sendMailing');
var tastoGstMailing = document.getElementById('gstMailing');
var tastoGstCalendario = document.getElementById('gstCalendario');
tastoInviaMailing.style.display = 'none';
tastoGstMailing.style.display = 'none';
tastoGstCalendario.style.display = 'none';
tastoTitAreaRis.style.display = 'none';
}

// opener oscura livelli
function osL(){
opener.osLivelli();
}
function oscura(){
window.setTimeout(osL,200);
window.setTimeout(chiudi,700);
}

// onLoad areaRiservata
function onLoadAreaRiservata(){
window.focus();
document.areaRiservata.nomeUtente.select();
}

// chiudi pagina dopo un lasso di tempo
function chiudiTempo(){
window.setTimeout(chiudi,300);
}
function alertGstMailing(){
var strRet = 'Attenzione:\nQuesto comando cancella l\'indirizzo email\n    - Premi Ok per confermare il comando\n    - Premi Annulla per annullare';
confirm(strRet);
}
// Title: Timestamp picker
// Description: See the demo at url
// URL: http://us.geocities.com/tspicker/
// Script featured on: http://javascriptkit.com/script/script2/timestamp.shtml
// Version: 1.0
// Date: 12-05-2001 (mm-dd-yyyy)
// Author: Denis Gritcyuk <denis@softcomplex.com>; <tspicker@yahoo.com>
// Notes: Permission given to use this script in any kind of applications if
//    header lines are left unchanged. Feel free to contact the author
//    for feature requests and/or donations

function show_calendar(strGiorno, strMese, strAnno, strNomeForm) {
	var oggi = new Date();
	var strGiorno = strGiorno == null || strGiorno =="" ? oggi.getDate() : strGiorno;
	var strMese = strMese == null || strMese =="" ? (oggi.getMonth()+1) : strMese;
	var strAnno = strAnno == null || strAnno =="" ? oggi.getFullYear() : strAnno;
	var dt_datetime = new Date(strAnno, (strMese-1), strGiorno);
	var arr_months = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno",
		"Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"];
	var week_days = ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"];
	var n_weekstart = 1; // day week starts from (normally 0 or 1)
    var dt_prev_month = new Date(dt_datetime);
	dt_prev_month.setMonth(dt_datetime.getMonth()-1);
	var dt_next_month = new Date(dt_datetime);
	dt_next_month.setMonth(dt_datetime.getMonth()+1);
	var dt_firstday = new Date(dt_datetime);
	dt_firstday.setDate(1);
	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
	var dt_lastday = new Date(dt_next_month);
	dt_lastday.setDate(0);
	
	// html generation (feel free to tune it for your particular application)
	// print calendar header
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>inserisci data</title>\n"+
		"</head>\n"+
		"<body bgcolor=\"#408080\" onLoad=\"window.focus()\">\n"+
		"<table cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
		"<tr><td bgcolor=\"#005555\">\n"+
		"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
		"<tr>\n	<td bgcolor=\"#005555\"><a href=\"javascript:window.opener.show_calendar("+dt2dtstr(dt_prev_month)+",'"+strNomeForm+"'"+");\">"+
		"<img src=\"../immagini/varie/prev.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"mese precedente\"></a></td>\n"+
		"	<td bgcolor=\"#0055555\" colspan=\"5\">"+
		"<font color=\"white\" face=\"verdana\" size=\"2\">"
		+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+
		"	<td bgcolor=\"#005555\" align=\"right\"><a href=\"javascript:window.opener.show_calendar("+dt2dtstr(dt_next_month)+",'"+strNomeForm+"'"+");\">"+
		"<img src=\"../immagini/varie/next.gif\" width=\"16\" height=\"16\" border=\"0\""+
		" alt=\"mese successivo\"></a></td>\n</tr>\n"
	);

	var dt_current_day = new Date(dt_firstday);
	// print weekdays titles
	str_buffer += "<tr>\n";
	for (var n=0; n<7; n++)
		str_buffer += "	<td bgcolor=\"#408080\">"+
		"<font color=\"white\" face=\"verdana\" size=\"2\">"+
		week_days[(n_weekstart+n)%7]+"</font></td>\n";
	// print calendar table
	str_buffer += "</tr>\n";
	while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
		dt_current_day.getMonth() == dt_firstday.getMonth()) {
		// print row heder
		str_buffer += "<tr>\n";
		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
				if (dt_current_day.getDate() == dt_datetime.getDate() &&
					dt_current_day.getMonth() == dt_datetime.getMonth())
					// print current date
					str_buffer += "	<td bgcolor=\"#FFB6C1\" align=\"right\">";
				else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
					// weekend days
					str_buffer += "	<td bgcolor=\"#DBEAF5\" align=\"right\">";
				else
					// print working days of current month
					str_buffer += "	<td bgcolor=\"white\" align=\"right\">";

				if (dt_current_day.getMonth() == dt_datetime.getMonth())
					// print days of current month
					str_buffer += "<a href=\"javascript:window.opener.document."+strNomeForm+".giorno.value='"+(dt_current_day.getDate())+"'; window.opener.document."+strNomeForm+".mese.value='"+(dt_current_day.getMonth()+1)+"'; window.opener.document."+strNomeForm+".anno.value='"+(dt_current_day.getFullYear())+"'; window.close();\">"+
					"<font color=\"#000000\" face=\"verdana\" size=\"2\">";
				else 
					// print days of other months
					str_buffer += "<a href=\"javascript:window.opener.document."+strNomeForm+".giorno.value='"+(dt_current_day.getDate())+"'; window.opener.document."+strNomeForm+".mese.value='"+(dt_current_day.getMonth()+1)+"'; window.opener.document."+strNomeForm+".anno.value='"+(dt_current_day.getFullYear())+"'; window.close();\">"+
					"<font color=\"#CCCCCC\" face=\"verdana\" size=\"2\">";
				str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
				dt_current_day.setDate(dt_current_day.getDate()+1);
		}
		// print row footer
		str_buffer += "</tr>\n";
	}
	// print calendar footer
	str_buffer +=
		"</table>\n" +
		"</tr>\n</td>\n</table>\n" +
		"</body>\n" +
		"</html>\n";

	var vWinCal = window.open("", "Calendar", 
		"width=200,height=230,status=no,resizable=yes,top=200,screenY=200,left=300,screenX=300");
	vWinCal.opener = self;
	var calc_doc = vWinCal.document;
	calc_doc.write (str_buffer);
	calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format

function dt2dtstr (dt_datetime) {
	return (new String (
			dt_datetime.getDate()+","+(dt_datetime.getMonth()+1)+","+dt_datetime.getFullYear()));
}
// apri editor luoghi
function openEdtLuoghi(id){
window.open('edtLuoghi.asp?id='+id+'','editLuoghi','resizable=yes,width=362px,height=312px,top=90px,screenY=90px,left=150px,screenX=150px');
}
// url action editor luoghi
function urlAction(url) {
document.edtLuoghi.action = url;
}
// url action confirm editor luoghi
function urlActionConf(url) {
strConfirm = 'Attenzione:\nQuesto comando cancella dal database il record selezionato.	\n\n    - Premi Ok per confermare il comando	\n\n    - Premi Annulla per annullare	\n'
if (confirm(strConfirm) == true)
	{
	document.edtLuoghi.action = url;
	}
else
return false;
}
// editor  reload pagina base e chiudi se stessa
function relOpClose() {
opener.location.reload([true]);
window.setTimeout(chiudi,2000);
}
// url action editor calendario
function urlAction1(url) {
document.edtCalendario.action = url;
}
// url action confirm editor calendario
function urlActionConf1(url) {
strConfirm = 'Attenzione:\nQuesto comando cancella dal database il record selezionato.	\n\n    - Premi Ok per confermare il comando	\n\n    - Premi Annulla per annullare	\n'
if (confirm(strConfirm) == true) 
	{
	document.edtCalendario.action = url;
	}
else
return false;
}
// verifica moduli
function vrfModuli(f) 
{  
	var msg;
	var campiVuoti = "";
		for (var i = 0; i < f.length; i++) {
		var e = f.elements[i];
			if((e.type != 'submit')&&(e.ver))
				if(e.value =="")
				campiVuoti += "\n	" + e.name;
				}	
if (campiVuoti) {			
msg ='Attenzione: I campi obbligatori sotto elencati risultano vuoti!	\n'
msg+=campiVuoti
msg+='\n\n'
msg+='Compilali correttamente e rinvia il modulo.'
alert(msg);
return false;
}
else
return true;		
}