<!--
	function controllaForm (objForm) {
		var str_errori = '';
		var numEl = objForm.elements.length;
		
		for (x=0;x<numEl;x++) {
			if (objForm.elements[x].id == 'controlla') {
				if (objForm.elements[x].value == '') {
					str_errori += '\ncompilare il campo obbligatorio ' + objForm.elements[x].name;
				}
			}
			if (objForm.elements[x].name == 'email' && objForm.elements[x].value != '') {
				var valCampoMail = objForm.elements[x].value;
				if (valCampoMail.indexOf('@') == -1 || valCampoMail.indexOf('@') == '' ) {
					str_errori += '\nmail non corretta';
				} else {
					indice = valCampoMail.indexOf('@');
					if (valCampoMail.indexOf('.',indice) == -1) {
						str_errori += '\nmail non corretta';
					}
				}
			}
		}
		
		if (str_errori != '') {
			alert (str_errori);
			return false;
		}
		return true;
		
	}
	
	function checkLastDay (obj){
		var mm, gg, aaaa
		//distinguo le chiamata alla funzione
		// document.vSearch.gg / mm è la select dell'arrivo
		// document.vSearch.gg2 / mm2 è la select della partenza
		if (obj.name == 'gg' || obj.name == 'mm' || obj.name == 'aaaa') {
			gg = document.theForm.gg
			mm = document.theForm.mm
			aaaa = document.theForm.aaaa
		} else if (obj.name == 'gg2' || obj.name == 'mm2' || obj.name == 'aaaa2') {
			gg = document.theForm.gg2
			mm = document.theForm.mm2
			aaaa = document.theForm.aaaa2
		}

		
		if ( mm.value == 4 || mm.value == 6 || mm.value == 9 || mm.value == 11 ) {
			if (gg.value == 31) {gg.value = 30}
		} else if (mm.value == 2) {
			if (aaaa.value % 4 == 0) {
				if (gg.value >= 29) {gg.value = 29}
			} else {
				if (gg.value >= 29) {gg.value = 28}
			}
		}	
	
	}

	function cambiaData (obj) {
		checkLastDay (obj)
		
		//se cambio mese nella data di arrivo riporto lo stesso mese nella data di partenza
		if (obj.name == 'mm') {
			if (obj.value == 12) {
				document.theForm.mm2.value = 1;
			} else {
				document.theForm.mm2.value = obj.value;	
			}
		}
		if (obj.name == 'aaaa') {
			document.theForm.aaaa2.value = obj.value;
		}
		var a_year = document.theForm.aaaa.value;		//ottengo l'anno
		var a_month = document.theForm.mm.value;		//ottengo il mese
		var a_day = document.theForm.gg.value;			//ottengo il giorno
		var today = new Date(a_year + '/' + a_month + '/' + a_day);
		
		//var tomorrow = new Date();
		today.setDate(today.getDate()+1);
		document.theForm.gg2.value = today.getDate();
		document.theForm.mm2.value = today.getMonth()+1;
		document.theForm.aaaa2.value = today.getYear();
	}
	
	function controllaPrivacy () {
		alert ('non accettando non potrai inviarci richieste')
		return false;
	}

	function ricaricaPagina (obj,paramLocation) {
		var list = obj.options[obj.selectedIndex].value;
		location.href (paramLocation+'&pag='+list);
	}
	function submit () {
		document.selAnno.submit();
	}
	
	function goAway (destinazione,id_da_cancellare,pagina) {
		if (pagina == '') {pagina = 1};

		input_box = window.confirm("Cancellare la voce selezionata?");
		
		if (input_box==true) {
			location.href(destinazione+'?id='+id_da_cancellare+'&pag='+pagina+'&op=cancella')
		} else {
			return false;
		}

	}
	
	function torna (val) {
		location.href = val;
	}
	function via (val) {
		window.setTimeout("torna('"+val+"')", 1000);
	}
	
	function cambiaColore (obj) {
		
		if (obj.style.background != "rgb(165,167,200)" && obj.style.color != "rgb(255,255,255)") {
			obj.style.background = "rgb(165,167,200)";
			obj.style.color = "rgb(255,255,255)";
		} else {
			obj.style.background = "";
			obj.style.color = "";
		}
		
	}
	
	function testoInBold(obj) {
			var testo = prompt("inserisci il testo da formattare","");
			//obj.value = obj.value + testo.bold();
			if (testo!=null) {
			obj.value = obj.value + '<b>' + testo + '</b>'
			}
			obj.focus();
	}
	
	function creaLink(obj) {
		var testoPerLink = prompt("inserisci il testo da rendere linkabile","");
		var collegamento = prompt("inserisci il collegamento al sito (www.sito.xyz)","");
		collegamento = "http://" + collegamento;
			//obj.value = obj.value + testoPerLink.link(collegamento);
		if (testoPerLink!=null && collegamento!=null){
		obj.value = obj.value + '<a href="' + collegamento+'" target="_blank" style="text-decoration:underline; color:#FFFFFF;font-weight:bold;">' + '<b>' + testoPerLink + '</b>' + '</a>';
		}
		obj.focus();
	}
	
	function MailTo() {
		//non in uso
		var mail = prompt("inserisci l'indirizzo email","");
		document.all.body.value = document.all.body.value + mail.link("mailTo:" + mail);
	}
	
	function aggiungiFirma(obj,firma,str_link) {
		//testo = <%=replace(testo,"<br>",vbcrlf%>
		obj.value = obj.value + '\n\n'+ firma + '\n---------------------' + '\n' + str_link;
		obj.focus();
	}		

	function setSecureText(idTextBox){
		var obj=document.getElementById(idTextBox);
		var text=obj.value;
		text=text.replace('"','\"');
		text=text.replace("'","''");
		text=text.replace("\t","");
		text=text.replace("\r\n","<br />");
		alert(text);
		return text;
	}
//-->
