function showFiglio (codice,imgName) {
			
	altro_el = document.getElementById(codice).style; 
	//spanName = document.getElementById(imgName).style;
	
	if(altro_el.display == "") {
		altro_el.display = "none" ;
		//spanName.backgroundImage = "url(img/pallino.gif)" ;
		spanName.backgroundRepeat = "no-repeat" ;
	}else {
		altro_el.display = "" ;
		//spanName.backgroundImage = "url(img/pallino.gif)" ;
		spanName.backgroundRepeat = "no-repeat" ;
	}
}
function toggleDisplay(fO){

	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);
	
	
	if(ie5 || ns6){
		if (document.getElementById(fO).style.display=="none") {
		document.getElementById(fO).style.display="inline";
		}else{
		document.getElementById(fO).style.display="none";
		}
	}
	
	if(ie4){
		if (document.all[fO].style.display=="none") {
		document.all[fO].style.display="inline";
		}else{
		document.all[fO].style.display="none";
		}
	}	
}

function toggleDisplayRegistrati(fO){
	var ns4 = (document.layers);
	var ie4 = (document.all && !document.getElementById);
	var ie5 = (document.all && document.getElementById);
	var ns6 = (!document.all && document.getElementById);
	
	
	if(ie5 || ns6){
		
		if (fO == 4) {
		document.getElementById(1).style.display="none";
	  document.getElementById(2).style.display="none";
	  document.getElementById(6).style.display="none";
		} 
	document.getElementById(1).style.display="none";
	document.getElementById(2).style.display="none";
	document.getElementById(6).style.display="none";
	document.getElementById(fO).style.display="inline";
	
		/*if (document.getElementById(fO).style.display=="none") {
		document.getElementById(fO).style.display="inline";
		}else{
		document.getElementById(fO).style.display="none";
		}*/
	}
	
	if(ie4){
		if (document.all[fO].style.display=="none") {
		document.all[fO].style.display="inline";
		}else{
		document.all[fO].style.display="none";
		}
	}	
}

function popup(url_pagina,w,h,sw_scroll) {

	
	  /*w = 500;
	  h = 400;*/
	  l = (screen.width - w) / 2;
	  t = (screen.height - h) / 2;
	
	  wnd = window.open(url_pagina,"","fullscreen=0,channelmode=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+sw_scroll+", resizable=no, width="+w+", height="+h+", left="+l+", top="+t);
	  wnd.focus();		

}



function riportalocalita(id_regione,id_provincia,id_comune,regione,provincia,comune) {
	
	window.opener.document.form.id_regione.value=id_regione;
	window.opener.document.form.id_provincia.value=id_provincia;
	window.opener.document.form.id_comune.value=id_comune;
	window.opener.document.form.regione.value=regione;
	window.opener.document.form.provincia.value=provincia;
	window.opener.document.form.comune.value=comune;

self.close();
}

 

function riporta_data(data,campo){
 
 Arr = data.split("-")
 
 datavisYYYY  = Arr[0] ; 
 datavisMM  = Arr[1] ; 
 datavisGG  = Arr[2] ; 
 
 if(datavisMM.length == 1) datavisMM = "0" + datavisMM ;
 if(datavisGG.length == 1) datavisGG = "0" + datavisGG ;

 datavis = datavisGG + "-" + datavisMM + "-" + datavisYYYY ;
 data = datavisYYYY + datavisMM + datavisGG ;


 if(campo == "data_1") {
	window.opener.document.form.data_1.value=data ;
	window.opener.document.form.data_1_vis.value=datavis ;
}
 if(campo == "data_2") {
	window.opener.document.form.data_2.value=data ;
	window.opener.document.form.data_2_vis.value=datavis ;
}
 if(campo == "data_3") {
	window.opener.document.form.data_3.value=data ;
	window.opener.document.form.data_3_vis.value=datavis ;
} 

 if(campo == "premiazione_data") {
	window.opener.document.form.premiazione_data.value=data ;
	window.opener.document.form.premiazione_data_vis.value=datavis ;
} 

 if(campo == "data_in") {
	window.opener.document.form.data_in.value=data ;
	window.opener.document.form.data_in_vis.value=datavis ;
} 
 if(campo == "data_out") {
	window.opener.document.form.data_out.value=data ;
	window.opener.document.form.data_out_vis.value=datavis ;
} 
 if(campo == "data") {
	window.opener.document.form.data.value=data ;
	window.opener.document.form.data_vis.value=datavis ;
} 
 if(campo == "data_stop") {
	window.opener.document.form.data_stop.value=data ;
	window.opener.document.form.data_stop_vis.value=datavis ;
} 
 if(campo == "data_in_accredito") {
	window.opener.document.form.data_in_accredito.value=data ;
	window.opener.document.form.data_in_accredito_vis.value=datavis ;
} 
 if(campo == "data_out_accredito") {
	window.opener.document.form.data_out_accredito.value=data ;
	window.opener.document.form.data_out_accredito_vis.value=datavis ;
} 
self.close();	
}




function checkForm() { 	
		var swKO = 0 ;
		
 
		// sezione valida email
		var x = document.form_contatto.email.value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
		alert('Indirizzo email inesatto.');
		swKO = 1 ;	
		} 

		
		
		 
		// sezione campi obbligatori
		if (document.form_contatto.nome.value == "" ) {
		alert('Manca il nome.');
		swKO = 1 ;
		}
		if (document.form_contatto.cognome.value == "" ) {
		alert('Manca il cognome.');
		swKO = 1 ;
		}	
		if (document.form_contatto.messaggio.value == "" ) {
		alert('Manca il messaggio.');
		swKO = 1 ;
		}
		if (document.form_contatto.email.value == "" ) {
		alert('Manca l\' email.');
		swKO = 1 ;
		} 
 		if (document.form_contatto.azienda.value == "" ) {
		alert('Manca l\' azienda.');
		swKO = 1 ;
		}
		if (document.form_contatto.telefono.value == "" ) {
		alert('Manca il telefono.');
		swKO = 1 ;
		}
		
		 			
		if (swKO == 1) {
		return false ;	
		}  
		 


}

function checkFormRegistrati() { 	 
		var swKO = 0 ;
		
 
		// sezione valida email
		var x = document.form.email.value;
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (filter.test(x)) {
		//alert('YES! Correct email address');
		} else {
		alert('Indirizzo email inesatto.');
		swKO = 1 ;	
		} 

		// sezione campi obbligatori 
 		if (document.form.login.value == "" ) {
		alert('Manca il login.');
		swKO = 1 ;
		}
		if (document.form.passwd.value == "" ) {
		alert('Manca la password.');
		swKO = 1 ;
		}
		
 
		  
		// sezione stampa
		if (document.form.id_tipo_utente[1].checked == true) {
			
			if (document.form.testata_stampa.value == "" ) {
			alert('Manca il nome testata.');
			swKO = 1 ;
			}

			/*if (document.form.tessera_stampa.value == "" ) {
			alert('Manca la tessera giornalistica.');
			swKO = 1 ;
			}*/
						
		}
		 
	 
 
		// sezione espositori
		if (document.form.id_tipo_utente[2].checked == true) {
			
			if (document.form.soc_espositore.value == "" ) {
			alert('Manca il nome della società.');
			swKO = 1 ;
			}

			if (document.form.piva_espositore.value == "" ) {
			alert('Manca la partita iva.');
			swKO = 1 ;
			}
						
		}		
 
		// sezione operatori settore
		if (document.form.id_tipo_utente[3].checked == true) {
			
			if (document.form.soc_operatore.value == "" ) {
			alert('Manca il nome della società.');
			swKO = 1 ;
			}

			if (document.form.piva_operatore.value == "" ) {
			alert('Manca la partita iva.');
			swKO = 1 ;
			}

			if (document.form.ruolo_operatore.value == "" ) {
			alert('Manca il ruolo.');
			swKO = 1 ;
			}	 			
		}			
		
 
		 
		if (document.form.accetto[1].checked == true) {
		alert('Devi accettare la clausola al trattamento dei dati.');
		swKO = 1 ;
		}
 
		 			
		if (swKO == 1) {
		return false ;	
		}  
		 
 
}

function checkGbook() { 	 
		var swKO = 0 ;
		


		// sezione campi obbligatori 
 		if (document.form.nome.value == "" ) {
		//alert('Manca il login.');
		swKO = 1 ;
		}
		if (document.form.messaggio.value == "" ) {
		//alert('Manca la password.');
		swKO = 1 ;
		}
 
		 			
		if (swKO == 1) {
		return false ;	
		}  
		 
 
}

function multiSwitch(sw) {

	for (i=0;i<document.form.length;i++) {
		
		nome = eval('document.form.elements['+i+'].name');

		if (nome.substr(0,3) == 'UT_') { 
			if (sw == 1) {
				eval('document.form.'+nome+'[0].checked = true' );
			} else {
				eval('document.form.'+nome+'[1].checked = true' );
			}
		}
	}
}
