function display_block_cast() {
		document.getElementById('casting').style.display = "block";
	}


function hide_block_cast() {
		document.getElementById('casting').style.display = "none";
	}

	
function display_block_news() {
		document.getElementById('newsletter').style.display = "block";
	}


function hide_block_news() {
		document.getElementById('newsletter').style.display = "none";
	}

	
function hide_all() {
		document.getElementById('casting').style.display = "none";
		document.getElementById('newsletter').style.display = "none";
	}

var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

function menu_hide ()	{
	if (event.srcElement.tagName == "div") {
        document.getElementById('menu_scae').style.display='none';
		document.getElementById('menu_formazione').style.display='none';
		document.getElementById('menu_competizioni').style.display='none';
    } else {
        
    }

}
	

//controllo form

function invia(){
  if(!document.frm.privacy.checked) 
  {
  	alert("Attenzione! E' necessario acconsentire al trattamento dei dati personali secondo quanto indicato nell'informativa.");
	return;
  }
  
    if(!Convalida()) 
  {
  	alert("Alcuni campi sono obbligatori. E' necessario compilare i campi evidenziati.");
	return;
  }
	document.frm.submit();
	return false;
}

function invia_en(){
  if(!document.frm.privacy.checked) 
  {
  	alert("You have to consent to the use of your personal data for the purposes indicated in the statement.");
	return;
  }
  
    if(!Convalida()) 
  {
  	alert("Some fields are mandatory. You have to compile them.");
	return;
  }
	document.frm.submit();
	return false;
}

function invia_newsletter(){
  if(!document.frm2.privacy.checked) 
  {
  	alert("Attenzione! E' necessario acconsentire al trattamento dei dati personali secondo quanto indicato nell'informativa.");
	return;
  }
  
    if(!Convalida_newsletter()) 
  {
  	alert("Alcuni campi sono obbligatori. E' necessario compilare i campi evidenziati.");
	return;
  }
	document.frm2.submit();
	return false;
}

function Convalida_newsletter()
{
	var input=document.frm2.getElementsByTagName("input");
	var sel=document.frm2.categoria;
	var validationOK=true;
	for(var i=0;i<input.length;i++){
		var inp=input[i];
		if(inp.className=="vuoto") inp.className="richiesto";
    	if(inp.className=="richiesto"){
		if(inp.value==""){
            inp.className="vuoto";   //input vuoto
            validationOK=false;
            }
		
		}

	}
	if(sel.className=="vuoto") sel.className="richiesto";
	if(sel.length>0 && sel.selectedIndex==0){
      sel.className="vuoto";  //select con indice a zero
      validationOK=false;
    }
	return(validationOK);
}

function Convalida()
{
	var input=document.frm.getElementsByTagName("input");
	var validationOK=true;
	for(var i=0;i<input.length;i++){
		var inp=input[i];
		if(inp.className=="vuoto") inp.className="richiesto";
    	if(inp.className=="richiesto"){
		if(inp.value==""){
            inp.className="vuoto";   //input vuoto
            validationOK=false;
            }
		
		}

	}

	return(validationOK);
}

function isEmail(str){
var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
return (!r1.test(str) && r2.test(str));
}

