window.onload = function() {
	//OPERAZIONI ESEGUITE AL CARICAMENTO DELLA PAGINA
	MM_preloadImages('icaro/img/nav_contattaci_1.gif','icaro/img/nav_piscina_1.gif','icaro/img/nav_ristorante_1.gif','icaro/img/nav_discoteca_0.gif','icaro/img/nav_aviosuperficie_0.gif','icaro/img/nav_calcio5_1.gif','icaro/img/nav_parcogiochi_1.gif','icaro/img/nav_eventi_1.gif','icaro/img/nav_contatti_1.gif');
	if (document.getElementById('hint')) {
		SetHint(0);
		SetHintFunctions();
	}
}

function SetHintFunctions() {
	//IMPOSTA PER OGNI CAMPO DEL MODULO LA VISUALIZZAZIONE DEL SUGGERIMENTO IN CASO DI SELEZIONE / DESELEZIONE
	document.getElementById('Nome').onfocus = function() {SetHint(1);}
	document.getElementById('Nome').onblur = function() {SetHint(0);}
	
	document.getElementById('Cognome').onfocus = function() {SetHint(2);}
	document.getElementById('Cognome').onblur = function() {SetHint(0);}
	
	document.getElementById('Indirizzo').onfocus = function() {SetHint(3);}
	document.getElementById('Indirizzo').onblur = function() {SetHint(0);}
	
	document.getElementById('Citta').onfocus = function() {SetHint(4);}
	document.getElementById('Citta').onblur = function() {SetHint(0);}
	
	document.getElementById('Prov').onfocus = function() {SetHint(5);}
	document.getElementById('Prov').onblur = function() {SetHint(0);}
	
	document.getElementById('Telefono').onfocus = function() {SetHint(6);}
	document.getElementById('Telefono').onblur = function() {SetHint(0);}
	
	document.getElementById('Email').onfocus = function() {SetHint(8);}
	document.getElementById('Email').onblur = function() {SetHint(0);}
	
	document.getElementById('Password1').onfocus = function() {SetHint(7);}
	document.getElementById('Password1').onblur = function() {SetHint(0);}
	
	document.getElementById('Password2').onfocus = function() {SetHint(7);}
	document.getElementById('Password2').onblur = function() {SetHint(0);}
}

function SetHint(n) {
	//VISUALIZZA IL SUGGERIMENTO PER IL CAMPO SELEZIONATO NEL MODULO
	var Obj = document.getElementById('hint');
	var hint;
	switch (n) {
		case 0:
			hint = 'Selezionare un campo per avere suggerimenti sui dati da immettere';
			break;
		case 1:
		case 2:
		case 4:
			hint = 'Massimo 50 caratteri, consentiti caratteri alfabetici, apice singolo (\'), trattino (-) e spazio';
			break;
		case 3:
			hint = 'Massimo 100 caratteri, consentiti caratteri alfabetici, virgola (,), apice singolo (\'), trattino (-), slash (/), punto (.) e spazio';
			break;
		case 5:
			hint = '2 caratteri alfabetici';
			break;
		case 6:
			hint = 'Da 3 a 8 cifre';
			break;
		case 7:
			hint = 'Da 6 e 15 caratteri, esclusi maggiore (>), minore (<), doppi apici (") e punto esclamativo (!)';
			break;
		case 8:
			hint = 'Indirizzo di posta elettronica valido';
			break;
	}
	Obj.innerHTML = hint;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}