var i = 1;$(document).ready(function() {	$("img[src*=immagini/flag_ita.gif]").click(function() {		$.ajax({		  url: "lng.php?lng=1",		  async: false		 }).responseText;	});	$("img[src*=immagini/flag_eng.gif]").click(function() {		$.ajax({		  url: "lng.php?lng=2",		  async: false		 }).responseText;	});	$("img[src*=immagini/flag_ru.gif]").click(function() {		$.ajax({		  url: "lng.php?lng=2",		  async: false		 }).responseText;	});	//var $button = $("#contenitore_camere button[id='button_del']")	var $button = $('#contenitore_camere #camera #button_del');	$button.hide();	var $elem = $('#contenitore_camere #camera');	$elem.hide();	clonaCamera();	var $buttonPrenota = $('#inviaPrenotazione');	$buttonPrenota.click(function(){		document.prenotazioniCalcoloPrezzo.action = "prenotazione.php";		document.prenotazioniCalcoloPrezzo.submit();	});	$buttonPrenota.hide();});function checkInformativa (){	var radio = document.getElementById('informativa_si');	if (radio.checked){		document.richiesta.submit();	} else {		alert ('Attenzione per inviare i dati accettare il trattamento dei dati');	}}function checkInformativaENG (){	var radio = document.getElementById('informativa_si');	if (radio.checked){		document.richiesta.submit();	} else {		alert ('Attention to send data to accept the privacy');	}}function checkInformativaPrenotazione (){	var radio = document.getElementById('informativa_si');	if (radio.checked){		document.prenotazione_conferma.submit();	} else {		alert ('Attenzione per inviare i dati accettare il trattamento dei dati');	}}function checkInformativaPrenotazioneENG (){	var radio = document.getElementById('informativa_si');	if (radio.checked){		document.prenotazione_conferma.submit();	} else {		alert ('Attention to send data to accept the privacy');	}}function goPrenotazioniForm(){	var prenotazioni = document.getElementById('prenotazioni_offerte');	prenotazioni.submit();}function clonaCamera(){	var $elem = $("#camera").clone();	$elem.attr('id', $elem.attr('id')+(++i));	$elem.appendTo($('#contenitore_camere'));	$elem.show();	var $button = $elem.find('button');	if (i>2) {		$button.show();	}	$button.click(function(){		$elem.remove();		calcolaPrezzo();	});	calcolaPrezzo();}function changeCamera (eSelectRoom){	var id_cam = eSelectRoom.value;	var dad = eSelectRoom.parentNode.parentNode.parentNode.parentNode.parentNode;	//alert(dad.id);	var html = $.ajax({							async: false,							cache: false,							method: "get", url: "getLettiByCamera.php", data: "id_cam="+id_cam,							success: function(html){}						});	$("#"+dad.id+" select[id='letti']").empty();	$("#"+dad.id+" select[id='letti']").html(html.responseText);	var html = $.ajax({							async: false,							cache: false,							method: "get", url: "getNumeroPersoneByCamera.php", data: "id_cam="+id_cam,							success: function(html){}						});	$("#"+dad.id+" select[id='persone']").empty();	$("#"+dad.id+" select[id='persone']").html(html.responseText);	var id_con = document.getElementById('id_con').value;	var data = document.getElementById('data').value;	var giorni = document.getElementById('giorni').value;	var id_cam="0";	var n_per="0";	var $elem = $("#"+dad.id+" select[id='room']");	var $elem2 = $("#"+dad.id+" select[id='persone']");	id_cam = $elem[0].value;	n_per = $elem2[0].value;	var html = $.ajax({					async: false,					cache: false,					method: "get", url: "prenotazioniCalcoloPrezzo.php", data: "id_cam="+id_cam+"&n_per="+n_per+"&id_con="+id_con+"&giorni="+giorni+"&data="+data,					success: function(html){}					});	$("#"+dad.id+" div[id='prezzo']").html("&euro; "+html.responseText);	calcolaPrezzo();}function changePersone (eSelectPersone){	var dad = eSelectPersone.parentNode.parentNode.parentNode.parentNode.parentNode;	//alert(dad.id);	var id_con = document.getElementById('id_con').value;	var data = document.getElementById('data').value;	var giorni = document.getElementById('giorni').value;	var id_cam="0";	var n_per="0";	var $elem = $("#"+dad.id+" select[id='room']");	var $elem2 = $("#"+dad.id+" select[id='persone']");	id_cam = $elem[0].value;	n_per = $elem2[0].value;	var html = $.ajax({					async: false,					cache: false,					method: "get", url: "prenotazioniCalcoloPrezzo.php", data: "id_cam="+id_cam+"&n_per="+n_per+"&id_con="+id_con+"&giorni="+giorni+"&data="+data,					success: function(html){}					});	$("#"+dad.id+" div[id='prezzo']").html("&euro; "+html.responseText);	calcolaPrezzo();}function calcolaPrezzo(){	$('#info').html('<p>Ricalcolo...</p>');	$.post("prenotazioniCalcoloPrezzoTot.php", $("#prenotazioniCalcoloPrezzo").serialize(), function(data){		var result = data.split("-");		if (result[0]==0){			$('#info').html(result[1]);			$('#totale').html("--");			$('#inviaPrenotazione').hide();		} else {			$('#info').html("");			$('#totale').html("&euro; "+result[0]);			$('#inviaPrenotazione').show();		}	});}
