// APERTURA POPUP CENTRATA /////////////////////////////////////////////////////

function centra(url, width, height)
   {
   if (document.all)
      {
      var x = window.screenLeft;
      var y = window.screenTop;
      var w = window.document.body.offsetWidth;
      var h = window.document.body.offsetHeight;
      }
  else
   {
   var x = window.screenX;
   var y = window.screenY;
   var w = window.outerWidth;
   var h = window.outerHeight;
   }
  var cntx = x + Math.round((w - width) / 2);
  var cnty = y + Math.round((h - height) / 2);
  window.open (url, null, 'left=' + cntx + ',top=' + cnty + ',width=' + 
width + ',height=' + height);
}
////////////////////////////////////////////////////////////////////////////////


// PER VALIDARE LA DATA ////////////////////////////////////////////////////////
function validaData(visite_modifica)
 {
 var ReData = new RegExp();
 ReData=/\d{1,2}\/\d{1,2}\/\d{2,4}$/;

 if(!ReData.test(visite_modifica.data.value))
 { alert("Formato data inserita non valida. (GG/MM/AAAA)");
  return false;
 }
else {
return true;
}
}
////////////////////////////////////////////////////////////////////////////////


// PER RISPONDERE AGLI EVENTI (generico) ///////////////////////////////////////
function ok()
 {
alert('Richiesta effettuata.');
}
////////////////////////////////////////////////////////////////////////////////

// CONTROLLA GUESTBOOK CAMPI ///////////////////////////////////////////////////

function controllaguest()
   {
   if (guest.nome.value == '' || guest.citta.value == '')
      {
alert('Non hai compilato uno o piu\' campi obbligatori');
        if (guest.nome.value == '')
				  {
					guest.nome.focus();
					}
				else if (guest.citta.value == '')
				  {
					guest.citta.focus();
					}
return false;
      }
		else if (guest.msg.value == 'Messaggio')
      {
alert('Non hai compilato uno o piu\' campi obbligatori');
         if (guest.msg.value == '' || guest.msg.value == 'Messaggio')
				  {
					guest.msg.focus();
					}
return false;
      }
}
function messaggio()
 {
  if (guest.msg.value == 'Messaggio')
  {
	guest.msg.value=('');
}
}
////////////////////////////////////////////////////////////////////////////////

// AVVISO CANCELLAZIONE (GENERICA) /////////////////////////////////////////////
function avvisoDelete() {
  return(confirm('Sei sicuro di voler eseguire l\'operazione?'));
}
////////////////////////////////////////////////////////////////////////////////

// AVVISO USCITA ///////////////////////////////////////////////////////////////
function avvisoExit() {
  var exit = window.confirm('Sei sicuro di voler uscire dall\'area riservata?');
	if (exit) {
	  location.href='login.asp'
	}
		else {
		  return false;
		}
}
////////////////////////////////////////////////////////////////////////////////
