function gotopage (pPagina)
	{
	document.ricerca.method="post";
	document.ricerca.action=pPagina;
	document.ricerca.submit();
	}

$(function(){

	$("#dialog_errore").dialog({
			bgiframe: true,
			height: 140

		});
	
});

$(function(){

	$("#dialog_messaggio").dialog({
			bgiframe: true,
			height: 140
		});
	
});

$(document).ready(function(){
		$('.ajax').ajaxContent({
			target:'#div_banner'
		});
});

$(document).ready(function(){
   $("#iscrizione").click(function(){
		nomecognome = $("#nomecognome").val();
		nomecognome = encodeURI(nomecognome);
		nomecognome = nomecognome.replace(/'/g,"''");
		$.ajax({
		   type: "POST",
		   url: "/registra_newsletter.asp",
		   data: "nomecognome=" + nomecognome + "&email=" + $("#email").val(),
			success: function(msg){
			   if (msg == "ERRORE_NEWSLETTER_INCOMPLETA")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Non ti abbiamo potuto registrare.<br/><br/>Non tutti i dati sono stati inseriti correttamente</p>');
					$('#errore').dialog('open');
					}
				
				if (msg == "EMAIL_GIA_PRESENTE")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Non ti abbiamo potuto registrare.<br/><br/>Email inserita &egrave; gi&agrave; presente in archivio</p>');
					$('#errore').dialog('open');
					}
				if (msg == "NEWSLETTER_OK")
					{
			     	$('#dialog-newsletter').dialog('destroy');
					$(function(){
						$("#dialog-login").dialog({
								bgiframe: true,
								height: 700,
								width: 430
							});
					});
					$("#dialog-login").load("/registrati.asp?newsletter=ok&referrer=" + $("#referrer").val() + "&nomecognome=" + nomecognome + "&email=" + $("#email").val());
					$('#dialog-login').dialog('open');
					}

		   }

		 });
	 });
 }); 


$(document).ready(function(){
   $("#accedi").click(function(){
		$.ajax({
		   type: "POST",
		   url: "/invia-login.asp",
		   data: "username=" + $("#username").val() + "&password=" + $("#password").val() ,
		   success: function(msg){
			   if (msg == "OK")
					{
				    $('#dialog-login2').dialog('destroy');
					$(function(){
						$("#dialog-login2").dialog({
								bgiframe: true,
								height: 330,
								width: 340
							});
					});
					$("#dialog-login2").load("/login-entrato.asp");
				    $('#dialog-login2').dialog('open');
					$('#cambia-login').load('/login-entrato.asp');
					
					document.getElementById('login-btn').style.display = 'none';
					document.getElementById('iscrizione-btn').style.display = 'none';
	
					document.getElementById('scheda-personale-btn').style.display = 'block';
					document.getElementById('logout-btn').style.display = 'block';
					
					
					}
			   if (msg == "KO")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Username o Password sono errati</p>');
					$('#errore').dialog('open');
					}
		   }

		 });
	 });
 }); 


$(document).ready(function(){
   $("#invia-bacheca").click(function(){
	
		commento = $("#eBann").val();
		commento = encodeURI(commento);
		commento = commento.replace(/'/g,"''");
		$.ajax({
		   type: "POST",
		   url: "/invia-scrivi-bacheca.asp",
		   data: "tipo=" + $("#tipo2").val() + "&id=" + $("#id").val() + "&commento=" + commento ,
		   success: function(msg){
			   if (msg == "OK")
					{
					$(function(){
						$("#dialog-bacheca").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#agg-commenti-ajax').load('/commenti.asp?id=' + $("#id_locale").val() + "&tipo=" + $("#tipo2").val());
					}
			   if (msg == "KO")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Il tuo commento non &egrave; stato inserito. Riprova</p>');
					$('#errore').dialog('open');
					}
		   }

		 });
	 });
 }); 


$(document).ready(function(){
   $("#btn-frequenta").click(function(){
		$.ajax({
		   type: "POST",
		   url: "/frequenta_exe.asp",
		   data: "tipo=" + $("#tipo").val() + "&idL=" + $("#id_locale").val() ,
		   success: function(msg){
			   if (msg == "OK")
					{
				    $('#dialog-login-entra').dialog('destroy');
					$(function(){
						$("#dialog-frequenta").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#dialog-frequenta').attr('innerHTML','<p>Inserimento eseguito con successo</p>');
					$('#dialog-frequenta').dialog('open');
					
					}
			   if (msg == "REGISTRATI")
					$(function(){
						$('#dialog-login-entra').dialog('destroy');
						$("#dialog-login-entra").dialog({
							bgiframe: true,
							height: 350,
							width: 350
						});
					});
				   $("#dialog-login-entra").load("/login-form.asp");
				   $('#dialog-login-entra').dialog('open');

				if (msg == "KO")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Sono occorsi degli errori. Riprova</p>');
					$('#errore').dialog('open');
					}
		   }

		 });
	 });
 }); 



$(document).ready(function(){
   $("#invia-sondaggio").click(function(){
		   $.ajax({
		   type: "POST",
		   url: "/sondaggio-exe.asp",
		   data: "domanda=" + $("#domanda").val() + "&rispostasondaggio=" + $(".rispostasondaggio:checked").val() ,
		   success: function(msg){
				if (msg == "OK")
					{
				    $(function(){
					$('#dialog-sondaggio-ris').dialog('destroy');
					$("#dialog-sondaggio-ris").dialog({
							bgiframe: true,
							height: 500,
							width: 300
						});
					});
				   $("#dialog-sondaggio-ris").load("/risultati.asp?grazie=ok");
				   $("#dialog-sondaggio-ris").dialog('open');
					
					}
				if (msg == "KO")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Voto non inserito. Riprova</p>');
					$('#errore').dialog('open');
					}
				if (msg == "GIA_VOTATO")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Non puoi votare lo stesso sondaggio pi&ugrave; di una volta al giorno</p>');
					$('#errore').dialog('open');
					}	
		   }

		 });
	 });
 }); 




$(document).ready(function(){
   $(".partecipa-evento").click(function(){
		$.ajax({
		   type: "POST",
		   url: "/frequenta_exe.asp",
		   data: "tipo=" + $("#tipo").val() + "&idL=" + $("#id_locale").val() ,
		   success: function(msg){
			   if (msg == "OK")
					{
				    $('#dialog-login-entra').dialog('destroy');
					$(function(){
						$("#dialog-frequenta").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#dialog-frequenta').attr('innerHTML','<p>Inserimento eseguito con successo</p>');
					$('#dialog-frequenta').dialog('open');
					
					}
			   if (msg == "REGISTRATI")
					$(function(){
						$('#dialog-login-entra').dialog('destroy');
						$("#dialog-login-entra").dialog({
							bgiframe: true,
							height: 350,
							width: 350
						});
					});
				   $("#dialog-login-entra").load("/login-form.asp");
				   $('#dialog-login-entra').dialog('open');

				if (msg == "KO")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Sono occorsi degli errori. Riprova</p>');
					$('#errore').dialog('open');
					}
		   }

		 });
	 });
 }); 


$(document).ready(function(){
   $("#invia-email-locale").click(function(){
		messaggio = $("#messaggio6").val();
		messaggio = encodeURI(messaggio);
		messaggio = messaggio.replace(/'/g,"''");
		nome = $("#nome6").val();
		nome = encodeURI(nome);
		nome = nome.replace(/'/g,"''");
	$.ajax({
		   type: "POST",
		   url: "/invia-scrivi-al-locale.asp",
		   data: "id=" + $("#id_locale").val() + "&email=" + $("#email6").val() + "&nome=" + nome + "&messaggio=" + messaggio,
		   success: function(msg){
			   if (msg == "OK")
					{
				    
					$('#dialog-invia-mess').dialog('destroy')
					$(function(){
						$("#dialog-invia-mess").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#dialog-invia-mess').attr('innerHTML','<p>Messaggio inviato correttamente</p>');
					$('#dialog-invia-mess').dialog('open');
					
					}
			   if (msg == "REGISTRATI")
				   $('#dialog-login-entra').dialog('destroy');
						$(function(){
						$("#dialog-login-entra").dialog({
							bgiframe: true,
							height: 350,
							width: 350
						});
					});
				   $("#dialog-login-entra").load("/login-form.asp");
				   $('#dialog-login-entra').dialog('open');

				if (msg == "KO" || msg == "DESTINATARIO NON PRESENTE")
					{
					$('#dialog-login-entra').dialog('destroy');
					$(function(){
						
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Sono occorsi degli errori. Riprova</p>');
					$('#errore').dialog('open');
					$('#dialog-login-entra').dialog('destroy');
					}
				if (msg == "CAMPI_OBBLIGATORI")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Tutti i campi sono obbligatori</p>');
					$('#errore').dialog('open');
					}
		   }

		 });
	 });
 }); 




$(document).ready(function(){
	 $("#btn-invita").click(function(){
		$(function(){
			$('#dialog-amici').dialog('destroy');
			$("#dialog-amici").dialog({
				bgiframe: true,
				height: 400,
				width: 410
			});
		});
	   $("#dialog-amici").load("/amici.asp");
	   $("#dialog-amici").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#risultati-sondaggio").click(function(){
		$(function(){
			$('#dialog-sondaggio-ris').dialog('destroy');
			$("#dialog-sondaggio-ris").dialog({
				bgiframe: true,
				height: 500,
				width: 300
			});
		});
	   $("#dialog-sondaggio-ris").load("/risultati.asp");
	   $("#dialog-sondaggio-ris").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#iscrizione_utente").click(function(){
		$(function(){
			$('#dialog-login').dialog('destroy');
			$("#dialog-login").dialog({
				bgiframe: true,
				height: 700,
				width: 410
			});
		});
	   $("#dialog-login").load("/registrati.asp");
	   $("#dialog-login").dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#iscrizione_utente11").click(function(){
		$(function(){
			$('#dialog-login').dialog('destroy');
			$("#dialog-login").dialog({
				bgiframe: true,
				height: 700,
				width: 410
			});
		});
	   $("#dialog-login").load("/registrati.asp");
	   $("#dialog-login").dialog('open');
	 });
 }); 




$(document).ready(function(){
	 $("#iscrizione_utente_tk").click(function(){
		$(function(){
			$('#dialog-login').dialog('destroy');
			$("#dialog-login").dialog({
				bgiframe: true,
				height: 700,
				width: 410
			});
		});
	   $("#dialog-login").load("/registrati_tk.asp");
	   $("#dialog-login").dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#iscrizione_utente11_tk").click(function(){
		$(function(){
			$('#dialog-login').dialog('destroy');
			$("#dialog-login").dialog({
				bgiframe: true,
				height: 700,
				width: 410
			});
		});
	   $("#dialog-login").load("/registrati_tk.asp");
	   $("#dialog-login").dialog('open');
	 });
 }); 


 
$(document).ready(function(){
	 $("#ricorda-password").click(function(){
		$(function(){
			$('#ricorda-pass').dialog('destroy');
			$("#ricorda-pass").dialog({
				bgiframe: true,
				height: 200,
				width: 400
			});
		});
	   $("#ricorda-pass").load("/recupera-password.asp");
	   $("#ricorda-pass").dialog('open');
	 });
 }); 



$(document).ready(function(){
	 $("#testa-login").click(function(){
		$(function(){
			$('#dialog-login-entra').dialog('destroy');
			$("#dialog-login-entra").dialog({
				bgiframe: true,
				height: 350,
				width: 350
			});
		});
	   $("#dialog-login-entra").load("/login-form.asp");
	   $("#dialog-login-entra").dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#testa-iscriviti").click(function(){
   	    $('#dialog-login').dialog('destroy');
		$(function(){
			$("#dialog-login").dialog({
				bgiframe: true,
				height: 700,
				width: 410
			});
		});
	   $("#dialog-login").load("/registrati.asp");
	   $("#dialog-login").dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#accedi_bacheca").click(function(){
		$(function(){
			$('#dialog-login-entra').dialog('destroy');
			$("#dialog-login-entra").dialog({
				bgiframe: true,
				height: 350,
				width: 350
			});
		});
	   $("#dialog-login-entra").load("/login-form.asp");
	   $("#dialog-login-entra").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $('#registrati_bacheca').dialog('destroy');
	 $("#registrati_bacheca").click(function(){
		$(function(){
			$("#dialog-login").dialog({
				bgiframe: true,
				height: 700,
				width: 410
			});
		});
	   $("#dialog-login").load("/registrati.asp");
	   $("#dialog-login").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#btn-login").click(function(){
		$('#dialog-login-entra').dialog('destroy');
		$(function(){
			$("#dialog-login-entra").dialog({
				bgiframe: true,
				height: 350,
				width: 360
			});
		});
	   $("#dialog-login-entra").load("/login-form.asp");
	   $("#dialog-login-entra").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#btn-login2").click(function(){
		$('#dialog-login-entra').dialog('destroy');
		$(function(){
			$("#dialog-login-entra").dialog({
				bgiframe: true,
				height: 350,
				width: 360
			});
		});
	   $("#dialog-login-entra").load("/login-form.asp?invia=ok");
	   $("#dialog-login-entra").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#dialog_link_telefono").click(function(){
		$(function(){
			$("#dialog-telefono").dialog({
				bgiframe: true,
				height: 150,
				width: 400
			});
		});
	   $("#dialog-telefono").load("/telefono.asp?id=" + $("#id_locale").val());
	   $("#dialog-telefono").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#dialog_link_www").click(function(){
		$(function(){
			$("#dialog-www").dialog({
				bgiframe: true,
				height: 150,
				width: 600
			});
		});
	   $("#dialog-www").load("/www.asp?id=" + $("#id_locale").val());
	   $("#dialog-www").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#dialog_link_email").click(function(){
		$(function(){
			$("#dialog-email").dialog({
				bgiframe: true,
				height: 150,
				width: 600
			});
		});
	   $("#dialog-email").load("/email.asp?id=" + $("#id_locale").val());
	   $("#dialog-email").dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#dialog_link_telefono_ev").click(function(){
		$(function(){
			$("#dialog-telefono").dialog({
				bgiframe: true,
				height: 150,
				width: 400
			});
		});
	   $("#dialog-telefono").load("/telefono.asp?id=" + $("#id_locale_ok").val());
	   $("#dialog-telefono").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#dialog_link_www_ev").click(function(){
		$(function(){
			$("#dialog-www").dialog({
				bgiframe: true,
				height: 150,
				width: 600
			});
		});
	   $("#dialog-www").load("/www.asp?id=" + $("#id_locale_ok").val());
	   $("#dialog-www").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#dialog_link_email_ev").click(function(){
		$(function(){
			$("#dialog-email").dialog({
				bgiframe: true,
				height: 150,
				width: 600
			});
		});
	   $("#dialog-email").load("/email.asp?id=" + $("#id_locale_ok").val());
	   $("#dialog-email").dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#dialog_link_telefono_ev2").click(function(){
		$(function(){
			$("#dialog-telefono").dialog({
				bgiframe: true,
				height: 150,
				width: 400
			});
		});
	   $("#dialog-telefono").load("/telefono2.asp?id=" + $("#locale_tel_ok").val());
	   $("#dialog-telefono").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#dialog_link_www_ev2").click(function(){
		$(function(){
			$("#dialog-www").dialog({
				bgiframe: true,
				height: 150,
				width: 600
			});
		});
	   $("#dialog-www").load("/www2.asp?id=" + $("#locale_www_ok").val());
	   $("#dialog-www").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#dialog_link_email_ev2").click(function(){
		$(function(){
			$("#dialog-email").dialog({
				bgiframe: true,
				height: 150,
				width: 600
			});
		});
	   $("#dialog-email").load("/email2.asp?id=" + $("#locale_email_ok").val());
	   $("#dialog-email").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#modifica-articolo").click(function(){
		$(function(){
			$('#dialog-modifica-articolo').dialog('destroy');
			$("#dialog-modifica-articolo").dialog({
				bgiframe: true,
				height: 400,
				width: 400
			});
		});
	   $("#dialog-modifica-articolo").load("/modifica-articolo.asp");
	   $("#dialog-modifica-articolo").dialog('open');
	 });
 });


$(document).ready(function(){
	 $("#segnala-evento").click(function(){
		$(function(){
			$('#dialog-segnala-evento').dialog('destroy');
			$("#dialog-segnala-evento").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $("#dialog-segnala-evento").load("/segnala-evento.asp?id=" + $("#id_locale").val());
	   $("#dialog-segnala-evento").dialog('open');
	 });
 });

$(document).ready(function(){
	 $("#modifica-utente").click(function(){
		$(function(){
			$('#dialog-modifica').dialog('destroy');
			$("#dialog-modifica").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $("#dialog-modifica").load("/modifica-dati.asp?id=" + $("#id_locale").val());
	   $("#dialog-modifica").dialog('open');
	 });
 });


$(document).ready(function(){
	 $("#modifica-tag-locale-locale").click(function(){
		$(function(){
			$('#dialog-tag').dialog('destroy');
			$("#dialog-tag").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $('#dialog-tag').dialog('option', 'title', 'TAG tipologia di locale');
	   $("#dialog-tag").load("/tag.asp?id=" + $("#id_locale").val() + "&tipo=locale-locale");
	   $("#dialog-tag").dialog('open');
	 });
	$("#modifica-tag-locale-evento").click(function(){
		$(function(){
			$('#dialog-tag').dialog('destroy');
			$("#dialog-tag").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $('#dialog-tag').dialog('option', 'title', 'TAG tipologia di evento');
	   $("#dialog-tag").load("/tag.asp?id=" + $("#id_locale").val() + "&tipo=locale-evento");
	   $("#dialog-tag").dialog('open');
	 });
	$("#modifica-tag-locale-serata").click(function(){
		$(function(){
			$('#dialog-tag').dialog('destroy');
			$("#dialog-tag").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $('#dialog-tag').dialog('option', 'title', 'TAG tipologia di serata');
	   $("#dialog-tag").load("/tag.asp?id=" + $("#id_locale").val() + "&tipo=locale-serata");
	   $("#dialog-tag").dialog('open');
	 });
	$("#modifica-tag-evento-evento").click(function(){
		$(function(){
			$('#dialog-tag').dialog('destroy');
			$("#dialog-tag").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $('#dialog-tag').dialog('option', 'title', 'TAG tipologia di evento');
	   $("#dialog-tag").load("/tag.asp?id=" + $("#id_locale").val() + "&tipo=evento-evento");
	   $("#dialog-tag").dialog('open');
	 });
	$("#modifica-tag-evento-serata").click(function(){
		$(function(){
			$('#dialog-tag').dialog('destroy');
			$("#dialog-tag").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $('#dialog-tag').dialog('option', 'title', 'TAG tipologia di serata');
	   $("#dialog-tag").load("/tag.asp?id=" + $("#id_locale").val() + "&tipo=evento-serata");
	   $("#dialog-tag").dialog('open');
	 });

 });


$(document).ready(function(){
	 $('#dialog-vota').dialog('destroy');   
	 $("#vota-locale").click(function(){
		$(function(){
			$("#dialog-vota").dialog({
				bgiframe: true,
				height: 250,
				width: 409
			});
		});
	   $('#dialog-vota').dialog('option', 'title', 'VOTA IL LOCALE');
	   $("#dialog-vota").load("/vota.asp?id=" + $("#id_locale").val() + "&tipo=locale");
	   $("#dialog-vota").dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#vota-evento").click(function(){
		$('#dialog-vota').dialog('destroy');  
		$(function(){
			$("#dialog-vota").dialog({
				bgiframe: true,
				height: 250,
				width: 409
			});
		});
	   $('#dialog-vota').dialog('option', 'title', 'VOTA IL LOCALE');
	   $("#dialog-vota").load("/vota.asp?id=" + $("#id_locale").val() + "&tipo=locale");
	   $("#dialog-vota").dialog('open');
	 });
 }); 

$(document).ready(function(){
	 $("#invia-messaggio").click(function(){
		$(function(){
			$('#dialog-messaggio').dialog('destroy');
			$("#dialog-messaggio").dialog({
				bgiframe: true,
				height: 400,
				width: 420
			});
		});
	   $("#dialog-messaggio").load("/invia-messaggio.asp");
	   $("#dialog-messaggio").dialog('open');
	 });
 });


$(document).ready(function(){
	 $("#segnala-evento-ut").click(function(){
		$(function(){
			$('#dialog-segnala-evento-ut').dialog('destroy');
			$("#dialog-segnala-evento-ut").dialog({
				bgiframe: true,
				height: 650,
				width: 400
			});
		});
	   $("#dialog-segnala-evento-ut").load("/segnala-evento-ut.asp");
	   $("#dialog-segnala-evento-ut").dialog('open');
	 });
 });

$(document).ready(function(){
	 $("#segnala-locale-ut").click(function(){
		$(function(){
			$('#dialog-segnala-locale-ut').dialog('destroy');
			$("#dialog-segnala-locale-ut").dialog({
				bgiframe: true,
				height: 520,
				width: 400
			});
		});
	   $("#dialog-segnala-locale-ut").load("/segnala-locale-ut.asp");
	   $("#dialog-segnala-locale-ut").dialog('open');
	 });
 });

$(document).ready(function(){
	 $("#segnala-serata-ut").click(function(){
		$(function(){
			$('#dialog-segnala-serata-ut').dialog('destroy');
			$("#dialog-segnala-serata-ut").dialog({
				bgiframe: true,
				height: 350,
				width: 400
			});
		});
	   $("#dialog-segnala-serata-ut").load("/segnala-serata-ut.asp");
	   $("#dialog-segnala-serata-ut").dialog('open');
	 });
 });

$(document).ready(function(){
	 $("#cambia-foto").click(function(){
		$(function(){
			$('#dialog-foto').dialog('destroy');
			$("#dialog-foto").dialog({
				bgiframe: true,
				height: 350,
				width: 400
			});
		});
	   $("#dialog-foto").load("/modifica-foto.asp");
	   $("#dialog-foto").dialog('open');
	 });
 });


$(document).ready(function(){
	 $("#inserisci-foto1-evento").click(function(){
		$(function(){
			$('#dialog-foto').dialog('destroy');
			$("#dialog-foto").dialog({
				bgiframe: true,
				height: 350,
				width: 400
			});
		});
	   $('#dialog-foto').dialog('option', 'title', 'INSERISCI FOTO');
	   $("#dialog-foto").load("/inserisci-foto-eventi.asp?id=1");
	   $("#dialog-foto").dialog('open');
	 });
 });

$(document).ready(function(){
	 $("#inserisci-foto2-evento").click(function(){
		$(function(){
			$('#dialog-foto').dialog('destroy');
			$("#dialog-foto").dialog({
				bgiframe: true,
				height: 350,
				width: 400
			});
		});
	   $('#dialog-foto').dialog('option', 'title', 'INSERISCI LOCANDINA (1)');
	   $("#dialog-foto").load("/inserisci-foto-eventi2.asp?id=2");
	   $("#dialog-foto").dialog('open');
	 });
 });

$(document).ready(function(){
	 $("#inserisci-foto3-evento").click(function(){
		$(function(){
			$('#dialog-foto').dialog('destroy');
			$("#dialog-foto").dialog({
				bgiframe: true,
				height: 350,
				width: 400
			});
		});
	   $('#dialog-foto').dialog('option', 'title', 'INSERISCI LOCANDINA (2)');
	   $("#dialog-foto").load("/inserisci-foto-eventi2.asp?id=3");
	   $("#dialog-foto").dialog('open');
	 });
 });


$(document).ready(function(){
	 $("#inserisci-foto4-evento").click(function(){
		$(function(){
			$('#dialog-foto').dialog('destroy');
			$("#dialog-foto").dialog({
				bgiframe: true,
				height: 350,
				width: 400
			});
		});
	   $('#dialog-foto').dialog('option', 'title', 'INSERISCI LOCANDINA (3)');
	   $("#dialog-foto").load("/inserisci-foto-eventi2.asp?id=4");
	   $("#dialog-foto").dialog('open');
	 });
 });


$(document).ready(function(){
	 $("#inserisci-foto5-evento").click(function(){
		$(function(){
			$('#dialog-foto').dialog('destroy');
			$("#dialog-foto").dialog({
				bgiframe: true,
				height: 350,
				width: 400
			});
		});
	   $('#dialog-foto').dialog('option', 'title', 'INSERISCI LOCANDINA (4)');
	   $("#dialog-foto").load("/inserisci-foto-eventi2.asp?id=5");
	   $("#dialog-foto").dialog('open');
	 });
 });


$(document).ready(function(){
	 $("#loading").ajaxStart(function(){
		$(function(){

			$("#loading").dialog({
					bgiframe: true,
					height: 140
				});
			
			});
	   $(this).attr('innerHTML','Loading.....');
	   $(this).show();
	   $(this).dialog('open');
	 });
 }); 


$(document).ready(function(){
	 $("#loading").ajaxStop(function(){
	   $(this).hide();
	   $(this).dialog('close');
	 });
 });  


function cancella(tipo,id)
{
		$.ajax({
		   type: "POST",
		   url: "/cancella-exe.asp",
		   data: "tipo=" + tipo + "&id=" + id + "&idUtente=" +  $("#id_locale").val() ,
		   success: function(msg){
				 if (msg == "OK")
					{
				    $('#dialog-cancella').dialog('destroy');
					$(function(){
						$("#dialog-cancella").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#dialog-cancella').attr('innerHTML','<p>Eliminato dai tuoi preferiti</p>');
					$('#dialog-cancella').dialog('open');
					document.getElementById(tipo + id).style.display = 'none';
					}
				if (msg == "KO")
					{
					$(function(){
						$("#errore").dialog({
								bgiframe: true,
								height: 140
							});
					});
					$('#errore').attr('innerHTML','<p>Attenzione! Sono occorsi degli errori. Riprova</p>');
					$('#errore').dialog('open');
					}
		   }

		 });




}


function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

//Contador de caracteres.
function Contar(entrada,salida,texto,caracteres) {
  var entradaObj=getObject(entrada);
  var salidaObj=getObject(salida);
  var longitud=caracteres + entradaObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<span class="disable"> '+texto+' </span>';
    entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}



function changeFotoTitolo(id,foto,titolo)
{
immagine = window.document.getElementById(id)
immagine.src = foto
immagine.alt = titolo
}


function changeLocandinaTitolo(id,foto,locandina,titolo)
{
immagine = window.document.getElementById(id)
immagine.src = foto
immagine.alt = titolo
document.getElementById("link1").setAttribute('href',locandina);
}

function svuota(ID)
	{
	var text = document.getElementById(ID);
	if (text.value == "Nome e Cognome" | text.value == "Indirizzo e-mail" | text.value == "Username" | text.value == "Password" | text.value == "Sesso" | text.value == "Citt&agrave;" | text.value == "Data di nascita" | text.value == "WWW" | text.value == "Cellulare" | text.value == "Oggetto" | text.value == "Titolo" | text.value == "Data" | text.value == "Nome Locale (se non inserito nuovo)" | text.value == "Nome Locale" | text.value == "Nome Serata" | text.value == "Et&agrave;" | text.value == "Sesso" | text.value == "Foto" | text.value == "cerca" | text.value == "data da" | text.value == "data a" | text.value == "Cittą" | text.value == "Via" | text.value == "Cap" | text.value == "Provincia" | text.value == "Citt" )
	text.value = "";		
	else
	text.value = text.value
	}

function popola(ID)
	{
	var text = document.getElementById(ID);

	if (ID == "nomecognome" & text.value == "")
	text.value = "Nome e Cognome";
	if (ID == "email" & text.value == "")
	text.value = "Indirizzo e-mail";	
	if (ID == "username" & text.value == "")
	text.value = "Indirizzo e-mail";	
	if (ID == "password" & text.value == "")
	text.value = "Password";	



	if (ID == "sesso" & text.value == "")
	text.value = "Sesso";
	if (ID == "citta" & text.value == "")
	text.value = "Cittą";
	if (ID == "nascita" & text.value == "")
	text.value = "Data di nascita";
	if (ID == "www" & text.value == "")
	text.value = "WWW";
	if (ID == "telefonoR" & text.value == "")
	text.value = "Cellulare";
	if (ID == "nomecognomeR" & text.value == "")
	text.value = "Nome e Cognome";
	if (ID == "emailR" & text.value == "")
	text.value = "Indirizzo e-mail";	
	if (ID == "passwordR" & text.value == "")
	text.value = "Password";	

	if (ID == "username2" & text.value == "")
	text.value = "Indirizzo e-mail";	
	if (ID == "password2" & text.value == "")
	text.value = "Password";

	if (ID == "emailR2" & text.value == "")
	text.value = "Indirizzo e-mail";	

	if (ID == "email3" & text.value == "")
	text.value = "Indirizzo e-mail";	
	if (ID == "oggetto3" & text.value == "")
	text.value = "Oggetto";

	if (ID == "titolo5" & text.value == "")
	text.value = "Titolo";
	if (ID == "data5" & text.value == "")
	text.value = "Data";
	if (ID == "oggetto5" & text.value == "")
	text.value = "Oggetto";
	if (ID == "locale_nome5" & text.value == "")
	text.value = "Nome Locale (se non inserito nuovo)";


	if (ID == "nome6" & text.value == "")
	text.value = "Nome e Cognome";
	if (ID == "email6" & text.value == "")
	text.value = "Indirizzo e-mail";
	if (ID == "locale_nome6" & text.value == "")
	text.value = "Nome Locale";

	

	if (ID == "locale_nome9" & text.value == "")
	text.value = "Nome Locale";

	if (ID == "serata10" & text.value == "")
	text.value = "Nome Serata";


	if (ID == "username9" & text.value == "")
	text.value = "Indirizzo e-mail";	
	if (ID == "password9" & text.value == "")
	text.value = "Password";



	if (ID == "eta10" & text.value == "")
	text.value = "Data di nascita";
	if (ID == "telefono10" & text.value == "")
	text.value = "Cellulare";
	if (ID == "email10" & text.value == "")
	text.value = "Indirizzo e-mail";
	if (ID == "www10" & text.value == "")
	text.value = "WWW";
	if (ID == "pass10" & text.value == "")
	text.value = "Password";

	if (ID == "titolo" & text.value == "")
	text.value = "cerca";
	if (ID == "data_da" & text.value == "")
	text.value = "data da";
	if (ID == "data_a" & text.value == "")
	text.value = "data a";

	if (ID == "via" & text.value == "")
	text.value = "Via";
	if (ID == "provincia" & text.value == "")
	text.value = "Provincia";
	
	if (ID == "cap" & text.value == "")
	text.value = "Cap";

	if (ID == "nomecognomeS" & text.value == "")
	text.value = "Nome e Cognome";

	if (ID == "viaS" & text.value == "")
	text.value = "Via";
	if (ID == "cittaS" & text.value == "")
	text.value = "Cittą";
	if (ID == "provinciaS" & text.value == "")
	text.value = "Provincia";
	if (ID == "capS" & text.value == "")
	text.value = "Cap";
}

function svuotaTXT(ID)
	{
	var text = document.getElementById(ID);
	if (text.innerHTML == "Messaggio" | text.innerHTML == "Descrizione" | text.innerHTML == "Evento")
	text.innerHTML = "";		
	else
	text.innerHTML = text.innerHTML
	}

function popolaTXT(ID)
	{
	var text = document.getElementById(ID);

	if (ID == "messaggio3" & text.innerHTML == "")
	text.innerHTML = "Messaggio";
	if (ID == "messaggio4" & text.innerHTML == "")
	text.innerHTML = "Evento";
	if (ID == "messaggio5" & text.innerHTML == "")
	text.innerHTML = "Messaggio";
	if (ID == "messaggio6" & text.innerHTML == "")
	text.innerHTML = "Messaggio";
	if (ID == "messaggio9" & text.innerHTML == "")
	text.innerHTML = "Descrizione";
	if (ID == "messaggio10" & text.innerHTML == "")
	text.innerHTML = "Descrizione";


	}

function toggleBox(id)
{
if (document.getElementById(id).className == "desc-locale")
	{
	document.getElementById(id).className = "desc-locale-tutto";
	}
else
	{
	document.getElementById(id).className = "desc-locale";
	}
}


function openwindow(page)
{
	nase= 'RADIO LINEA';
	w='510';
	h='145';
	st='0';
	res='0';
	l='100';
	t='100';
	str="width="+w+",height="+h+",status="+st+",resizable="+res+",left="+l+",top="+t;
	w=window.open(page,name,str);
	w.focus();
}




