/*********************************************************************************************
**********************************************************************************************
**********************************************************************************************
**********************************************************************************************
CONTROLLO INVIO FORM CONTATTI
**********************************************************************************************
**********************************************************************************************
**********************************************************************************************
*********************************************************************************************/	
function verificaFormCurriculum()
{

	if(document.infoForm.nome.value=='')
	{
		alert('Il campo "nome" e obbligatorio!');
		document.infoForm.nome.focus();
		return false;
	}
	
	if(document.infoForm.cognome.value=='')
	{
		alert('Il campo "cognome" e obbligatorio!');
		document.infoForm.cognome.focus();
		return false;
	}
	
	if(document.infoForm.email.value=='')
	{
		alert('Il campo "email" e obbligatorio!');
		document.infoForm.email.focus();
		return false;
	}
	
	
	EmailAddr = document.infoForm.email.value;
   	Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	

		if (!Filtro.test(EmailAddr))
		  
      		{
      			alert('Inserire E-mail valida');
				document.infoForm.email.focus();
				 return false;
      		}
	
	if(document.infoForm.telefono.value=='')
	{
		alert('Il campo "telefono" e obbligatorio!');
		document.infoForm.telefono.focus();
		return false;
	}
	
	if(document.infoForm.info_testo.value=='')
	{
		alert('Il campo "testo" e obbligatorio!');
		document.infoForm.info_testo.focus();
		return false;
	}
	
	return true;
}


/************************************************************************
gallery form
************************************************************************/
function validazioneGallery()
{
		
}


/************************************************************************
adm controllo sul tipologia di pagina e relativi campi disabilitati/abilitati
************************************************************************/
function caricaform(tipopagina)
{
	/*
			for (i=1;i<=10;i++)
			{
			document.getElementById('img'+[i]).disabled  = true;
			document.getElementById('img'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('img'+[i]).style.border='1px solid #ffffff';
			
			document.getElementById('articolo_did'+[i]).disabled  = true;
			document.getElementById('articolo_did'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_did'+[i]).style.border='1px solid #ffffff';
			}
			
			document.getElementById('dettagligoogle').disabled  = true;
			document.getElementById('dettagligoogle').style.backgroundColor='#8ADBD9';
			document.getElementById('dettagligoogle').style.border='1px solid #ffffff';
			
			closeObject('articolo_sottotitolo');
			openObject('articolo_sottotitolo_no');
			
			document.getElementById('articolo_sottotitolo_no').disabled  = true;
			document.getElementById('articolo_sottotitolo_no').style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_sottotitolo_no').style.border='1px solid #ffffff';
			
			
			document.getElementById('cerca').disabled  = true;
			document.getElementById('cerca').style.backgroundColor='#8ADBD9';
			document.getElementById('cerca').style.border='1px solid #ffffff';
			
			document.getElementById('mapZoom').disabled  = true;
			document.getElementById('mapZoom').style.backgroundColor='#8ADBD9';
			document.getElementById('mapZoom').style.border='1px solid #ffffff';
			
			document.getElementById('markerPointLng').disabled  = true;
			document.getElementById('markerPointLng').style.backgroundColor='#8ADBD9';
			document.getElementById('markerPointLng').style.border='1px solid #ffffff';
			
			document.getElementById('markerPointLat').disabled  = true;
			document.getElementById('markerPointLat').style.backgroundColor='#8ADBD9';
			document.getElementById('markerPointLat').style.border='1px solid #ffffff';
			
			document.getElementById('pdf').disabled  = true;
			document.getElementById('pdf').style.backgroundColor='#8ADBD9';
			document.getElementById('pdf').style.border='1px solid #ffffff';
			

			
			document.getElementById('articolo_sottotitolo').disabled  = false;
			document.getElementById('articolo_sottotitolo').style.backgroundColor='#ffffff';
			document.getElementById('articolo_sottotitolo').style.border='1px solid #cccccc';
			
			document.getElementById('articolo_top').disabled  = true;
			document.getElementById('articolo_top').style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_top').style.border='1px solid #ffffff';
				
			document.getElementById('articolo_random').disabled  = true;
			document.getElementById('articolo_random').style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_random').style.border='1px solid #ffffff';
			
	
			for (i=1;i<=10;i++)
			{
			document.getElementById('img'+[i]).disabled  = false;
			document.getElementById('img'+[i]).style.backgroundColor='#ffffff';
			document.getElementById('img'+[i]).style.border='1px solid #cccccc';
			
			document.getElementById('articolo_did'+[i]).disabled  = false;
			document.getElementById('articolo_did'+[i]).style.backgroundColor='#ffffff';
			document.getElementById('articolo_did'+[i]).style.border='1px solid #cccccc';
			}
	
			*/
	
	
	/*  caso pagina articolo o elenco e poi pagina */
	if(tipopagina == 110 || tipopagina == 120)
	{
		
		
			var PrintDiv =  document.getElementById('tipopagina');
            PrintDiv.innerHTML = '<b>Pagina con lista articoli e relativa paginazione. Dopo il click di scelta cantiere, dettaglio. </b> (<a href="../../_img/esempio/110.jpg" target=_blank>Vedi esempio</a>)';
		
		
			
			document.getElementById('articolo_sottotitolo').disabled  = true;
			document.getElementById('articolo_sottotitolo').style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_sottotitolo').style.border='1px solid #ffffff';

			
	}
	
	/*  caso form contatto */
	if(tipopagina == 130)
	{
			var PrintDiv =  document.getElementById('tipopagina');
            PrintDiv.innerHTML = '<b>Pagina Form contatto.</b> (<a href="../../_img/esempio/130.jpg" target=_blank>Vedi esempio</a>)';	
			
			
			document.getElementById('articolo_sottotitolo').disabled  = true;
			document.getElementById('articolo_sottotitolo').style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_sottotitolo').style.border='1px solid #ffffff';
			
			document.getElementById('pdf').disabled  = true;
			document.getElementById('pdf').style.backgroundColor='#8ADBD9';
			document.getElementById('pdf').style.border='1px solid #ffffff';
			
			
			for (i=1;i<=10;i++)
			{
			document.getElementById('img'+[i]).disabled  = true;
			document.getElementById('img'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('img'+[i]).style.border='1px solid #ffffff';
			
			document.getElementById('articolo_did'+[i]).disabled  = true;
			document.getElementById('articolo_did'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_did'+[i]).style.border='1px solid #ffffff';
			}
			
	}
	
	/*  caso cantieri */
	if(tipopagina == 140)
	{
			
			var PrintDiv =  document.getElementById('tipopagina');
            PrintDiv.innerHTML = '<b>Pagina con lista cantieri e relativa paginazione. Dopo il click di scelta cantiere, dettaglio con galleria immagini (Inserimento successivo).</b> (<a href="../../_img/esempio/140.jpg" target=_blank>Vedi esempio</a>)';

			
			
			
			for (i=2;i<=10;i++)
			{
				
			document.getElementById('img'+[i]).disabled  = true;
			document.getElementById('img'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('img'+[i]).style.border='1px solid #ffffff';
			
			document.getElementById('articolo_did'+[i]).disabled  = true;
			document.getElementById('articolo_did'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_did'+[i]).style.border='1px solid #ffffff';
			}
	
	}
	
	
	/*  caso form curriculum  */
	if(tipopagina == 170)
	{
	
		
		var PrintDiv =  document.getElementById('tipopagina');
            PrintDiv.innerHTML = '<b>Pagina Form invio curriculum o altri file.</b> (<a href="../../_img/esempio/170.jpg" target=_blank>Vedi esempio</a>)';
		
		
		
			document.getElementById('articolo_sottotitolo').disabled  = true;
			document.getElementById('articolo_sottotitolo').style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_sottotitolo').style.border='1px solid #ffffff';
			
			document.getElementById('cerca').disabled  = true;
			document.getElementById('cerca').style.backgroundColor='#8ADBD9';
			document.getElementById('cerca').style.border='1px solid #ffffff';
			
			document.getElementById('markerPointLat').disabled  = true;
			document.getElementById('markerPointLat').style.backgroundColor='#8ADBD9';
			document.getElementById('markerPointLat').style.border='1px solid #ffffff';
			
			document.getElementById('markerPointLng').disabled  = true;
			document.getElementById('markerPointLng').style.backgroundColor='#8ADBD9';
			document.getElementById('markerPointLng').style.border='1px solid #ffffff';
			
			document.getElementById('dettagligoogle').disabled  = true;
			document.getElementById('dettagligoogle').style.backgroundColor='#8ADBD9';
			document.getElementById('dettagligoogle').style.border='1px solid #ffffff';
			
			document.getElementById('mapZoom').disabled  = true;
			document.getElementById('mapZoom').style.backgroundColor='#8ADBD9';
			document.getElementById('mapZoom').style.border='1px solid #ffffff';
		
			document.getElementById('pdf').disabled  = true;
			document.getElementById('pdf').style.backgroundColor='#8ADBD9';
			document.getElementById('pdf').style.border='1px solid #ffffff';
			
			
			
			for (i=1;i<=10;i++)
			{
			document.getElementById('img'+[i]).disabled  = true;
			document.getElementById('img'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('img'+[i]).style.border='1px solid #ffffff';
			
			document.getElementById('articolo_did'+[i]).disabled  = true;
			document.getElementById('articolo_did'+[i]).style.backgroundColor='#8ADBD9';
			document.getElementById('articolo_did'+[i]).style.border='1px solid #ffffff';
			}
			
			
	}
	
	
	

}
/************************************************************************
adm validazione form inserimento modifica
************************************************************************/
function validazione()
{
	closeObject('preloader');
	if(document.form.articolo_titolo.value=='')
	{
		alert('Il campo "articolo_titolo" e obbligatorio!');
		document.form.articolo_titolo.focus();
		return false;
	}
	
	
	
	return true;
}

/*********************************************************************************************
**********************************************************************************************
**********************************************************************************************
**********************************************************************************************
CONTROLLO ELIMINAZIONE RECORD
**********************************************************************************************
**********************************************************************************************
**********************************************************************************************
*********************************************************************************************/				
//onclick="return functionConferma();"

			function functionConfermaElimina()
			{
			action = confirm ('Confermi eliminazione? Operazione non annullabile!')
			if(action==false){return false;}
			else{return true;}			
			}	
			
//eliminazione immagini da pannello di controlllo			
function eliminaImgPresente(campoOld,numero)
		  {
		 
		  	action = confirm ('Confermi eliminazione? Operazione non annullabile!')
			if(action==false){return false;}
			else{
			
			document.form.elements[campoOld].value = '';
			closeObject('imgView_'+numero);
			closeObject('imgViewHref_'+numero);
			//return true;
			}	
		  }			
