// JavaScript Document

var urlAddress = "http://www.narconontop.org"; 
var pageName = "Centro Disintossicazione Droga e Alcool Narconon Gabbiano"; 

function addToFavorites() { 
if (window.external) { window.external.AddFavorite(urlAddress,pageName)} 
else { alert("Spiacenti ma il tuo browser non supporta questa funzione. Aggiungimi manualmente ai preferiti.");} 
} 



			function CheckMultiple1(frm, name) {
				for (var i=0; i < frm.length; i++)
				{
					fldObj = frm.elements[i];
					fldId = fldObj.id;
					if (fldId) {
						var fieldnamecheck=fldObj.id.indexOf(name);
						if (fieldnamecheck != -1) {
							if (fldObj.checked) {
								return true;
							}
						}
					}
				}
				return false;
			}
		function CheckForm1(f) {
			if (f.email.value == "") {
				alert("Inserisci il tuo indirizzo email.");
				f.email.focus();
				return false;
			}
		
			var fname = "CustomFields_2_1";
			var fld = document.getElementById(fname);
			if (fld.value == "") {
				alert("Inserisci un valore per il campo Nome");
				fld.focus();
				return false;
			}
		
			var fldcheck = CheckMultiple1(f, "CustomFields[3_1]");
			if (!fldcheck) {
				alert("Seleziona una opzione per il campo problema riguarda");
				return false;
			}
		
			var fname = "CustomFields_1_1";
			var fld = document.getElementById(fname);
			if (fld.selectedIndex == -1 || fld.selectedIndex == 0) {
				alert("Seleziona una opzione per il campo sostanza");
				fld.focus();
				return false;
			}
		
			var fname = "CustomFields_7_1";
			var fld = document.getElementById(fname);
		
			CheckNum = parseInt(fld.value);
			if(fld.value != "" && isNaN(CheckNum)) {
				alert("Inserisci un valore numerico nel campo telefono");
				fld.select();
				fld.focus();
				return false;
			}
		
				return true;
			};
		

			function CheckMultiple2(frm, name) {
				for (var i=0; i < frm.length; i++)
				{
					fldObj = frm.elements[i];
					fldId = fldObj.id;
					if (fldId) {
						var fieldnamecheck=fldObj.id.indexOf(name);
						if (fieldnamecheck != -1) {
							if (fldObj.checked) {
								return true;
							}
						}
					}
				}
				return false;
			}
		function CheckForm2(f) {
			if (f.email.value == "") {
				alert("Inserisci il tuo indirizzo email.");
				f.email.focus();
				return false;
			}
		
			var fname = "CustomFields_2_2";
			var fld = document.getElementById(fname);
			if (fld.value == "") {
				alert("Inserisci un valore per il campo Nome");
				fld.focus();
				return false;
			}
		
			var fldcheck = CheckMultiple2(f, "CustomFields[3_2]");
			if (!fldcheck) {
				alert("Seleziona una opzione per il campo problema riguarda");
				return false;
			}
		
			var fname = "CustomFields_1_2";
			var fld = document.getElementById(fname);
			if (fld.selectedIndex == -1 || fld.selectedIndex == 0) {
				alert("Seleziona una opzione per il campo sostanza");
				fld.focus();
				return false;
			}

			//Controllo che sia valorizzato almeno uno dei campi Telefono e Cellulare
			if (document.getElementById("CustomFields_8_2").value == ""){
				if (document.getElementById("CustomFields_7_2").value == ""){
					alert('E\' obbligatorio compilare almeno uno dei campi Telefono o Cellulare!');
					return false;
				}
			}	
					
			var fname = "CustomFields_8_2";
			var fld = document.getElementById(fname);
			
			CheckNum = parseInt(fld.value);
			if(fld.value != "" && isNaN(CheckNum)) {
				alert("Inserisci un valore numerico nel campo Cellulare");
				fld.select();
				fld.focus();
				return false;
			}
		
			var fname = "CustomFields_7_2";
			var fld = document.getElementById(fname);
		
			CheckNum = parseInt(fld.value);
			if(fld.value != "" && isNaN(CheckNum)) {
				alert("Inserisci un valore numerico nel campo telefono");
				fld.select();
				fld.focus();
				return false;
			}

			var fldcheck = CheckMultiple2(f, "CustomFields[9_2]");
			if (!fldcheck) {
				alert("E' necessario prestare il consenso al trattamento dei dati personali");
				return false;
			}
		
				return true;
			};
		

/* aggiunta dopo */

			function CheckMultiple14(frm, name) {
				for (var i=0; i < frm.length; i++)
				{
					fldObj = frm.elements[i];
					fldId = fldObj.id;
					if (fldId) {
						var fieldnamecheck=fldObj.id.indexOf(name);
						if (fieldnamecheck != -1) {
							if (fldObj.checked) {
								return true;
							}
						}
					}
				}
				return false;
			}
		function CheckForm14(f) {
			if (f.email.value == "") {
				alert("Inserisci il tuo indirizzo email.");
				f.email.focus();
				return false;
			}
		
			var fname = "CustomFields_2_14";
			var fld = document.getElementById(fname);
			if (fld.value == "") {
				alert("Inserisci un valore per il campo Nome");
				fld.focus();
				return false;
			}
		
			var fldcheck = CheckMultiple14(f, "CustomFields[3_14]");
			if (!fldcheck) {
				alert("Seleziona una opzione per il campo problema riguarda");
				return false;
			}
		
			var fname = "CustomFields_1_14";
			var fld = document.getElementById(fname);
			if (fld.selectedIndex == -1 || fld.selectedIndex == 0) {
				alert("Seleziona una opzione per il campo sostanza");
				fld.focus();
				return false;
			}
		
			var fname = "CustomFields_7_14";
			var fld = document.getElementById(fname);
		
			if (fld.value == ""){
				alert('E\' obbligatorio compilare il campo Telefono!');
				return false;
			}
				
				
			CheckNum = parseInt(fld.value);
			if(fld.value != "" && isNaN(CheckNum)) {
				alert("Inserisci un valore numerico nel campo telefono");
				fld.select();
				fld.focus();
				return false;
			}
		
				return true;
			};
		


document.onselectstart = function() {alert('I contenuti di questo sito sono protetti da copyright');return false;} // ie
/*	document.onmousedown = function() {return false;}*/
	document.oncontextmenu = function() {return false;} 
