function espandiSezione(id) {
	
	var stato;
	stato = document.getElementById(['sez_' + id]).style.display;
	
	if(stato == "") {
		document.getElementById(['sez_' + id]).style.display = "none";
		document.getElementById(["imgsez_" + id]).src='../layout/icons/expand.jpg';
	}
	else {
		document.getElementById(['sez_' + id]).style.display = "";
		document.getElementById(["imgsez_" + id]).src='../layout/icons/implode.gif';
	}
	
	
}
/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                                  LOGIN                                                                  *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function loginUtente() {
	var stato = document.getElementById(['statologin']).value;
	
	switch (stato) {
		case '0': //Login
			var userid = js_trim(document.getElementById(['userid']).value);
			return controllaCampiPieni(['userid']);

		break;

		case '2': //Password persa
			var mail = document.getElementById(['mail']).value;
			var ok = controllaCampiPieni(['mail']);
			return ok == true ? controllaMail(mail) : false;

		break;
		
	}
	
}

function abilitaMacroprofilo(id,nomecampo,macroProfilo,contagruppi) {

	var conta = 0;
	
	var controlla = document.getElementById([id]).checked;
	
	if(!controlla) {
		document.getElementById(['macroprofilo' + macroProfilo]).checked = false;
		document.getElementById(['txt_macroprofilo' + macroProfilo]).value = false;		
	}
	else {
		for(var x=1; x<contagruppi+1; x++) {
			if(document.getElementById([nomecampo + macroProfilo  + '_' + x]).checked){
				conta = conta+1;
			}
		}
		
		document.getElementById(['macroprofilo' + macroProfilo]).checked = parseInt(conta) == parseInt(contagruppi) ? true : false;
		document.getElementById(['txt_macroprofilo' + macroProfilo]).value = parseInt(conta) == parseInt(contagruppi) ? true : false;
	}
	
}

function abilitaGruppi(macroProfilo,nomecampo,contagruppi,valore) {

//	alert("macro: " + macroProfilo + " , contagruppi: " + contagruppi + " , valore: " + valore);
	for(var x=1; x<contagruppi+1; x++) {
		document.getElementById([nomecampo + macroProfilo  + '_' + x]).checked = valore;
		document.getElementById(['txt_' + nomecampo + macroProfilo  + '_' + x]).value = valore;		
	}
}


function abilitaMacroprofiloForm(id,nomecampo,idoggetto,macroProfilo,contagruppi) {

	var conta = 0;
	
	var controlla = document.getElementById([id]).checked;
	
	if(!controlla) {
		document.getElementById(['macroprofilo' + macroProfilo + "_" + idoggetto]).checked = false;
		document.getElementById(['txt_macroprofilo' + macroProfilo + "_" + idoggetto]).value = false;		
	}
	else {
		for(var x=1; x<contagruppi+1; x++) {
			if(!document.getElementById([nomecampo + macroProfilo  + '_' + x + "_" + idoggetto]).checked){
				conta = conta+1;
			}
		}
		conta > 0 ? document.getElementById(['macroprofilo' + macroProfilo + "_" + idoggetto]).checked = false : 	document.getElementById(['macroprofilo' + macroProfilo + "_" + idoggetto]).checked = true;
	}
	
}

function abilitaMacroprofiloPulsanti(id,nomecampo,idpulsante,macroProfilo,contagruppi) {

	var conta = 0;
	
	var controlla = document.getElementById([id]).checked;
	
	if(!controlla) {
		document.getElementById(['macroprofilo' + macroProfilo + "_" + idpulsante]).checked = false;
		document.getElementById(['txt_macroprofilo' + macroProfilo + "_" + idpulsante]).value = false;		
	}
	else {
		for(var x=1; x<contagruppi+1; x++) {
			if(!document.getElementById([nomecampo + macroProfilo  + '_' + x + "_" + idpulsante]).checked){
				conta = conta+1;
			}
		}
		conta > 0 ? document.getElementById(['macroprofilo' + macroProfilo + "_" + idpulsante]).checked = false : 	document.getElementById(['macroprofilo' + macroProfilo + "_" + idpulsante]).checked = true;
	}
	
}


function abilitaGruppiForm(idoggetto,nomecampo,macroProfilo,contagruppi,valore) {

//	alert("macro: " + macroProfilo + " , contagruppi: " + contagruppi + " , valore: " + valore);
	for(var x=1; x<contagruppi+1; x++) {
		document.getElementById([nomecampo + macroProfilo  + '_' + x + '_' + idoggetto]).checked = valore;
		document.getElementById(['txt_' + nomecampo + macroProfilo  + '_' + x + '_' + idoggetto]).value = valore;		
	}
}

function abilitaGruppiPulsanti(idpulsante,nomecampo,macroProfilo,contagruppi,valore) {

//	alert("macro: " + macroProfilo + " , contagruppi: " + contagruppi + " , valore: " + valore);
	for(var x=1; x<contagruppi+1; x++) {
		document.getElementById([nomecampo + macroProfilo  + '_' + x + '_' + idpulsante]).checked = valore;
		document.getElementById(['txt_' + nomecampo + macroProfilo  + '_' + x + '_' + idpulsante]).value = valore;		
	}
}


function abilitaPermessiSezione(valore) {
	valore == false ? document.getElementById(['div_permessi_elementi']).style.display = '' : document.getElementById(['div_permessi_elementi']).style.display = 'none';
}

function abilitaPosizione(valore) {
	valore == 0 ? document.getElementById(['div_posizione_elementi']).style.display = '' : document.getElementById(['div_posizione_elementi']).style.display = 'none';
}

function visibilita(nomeDiv, valore) {
	document.getElementById([nomeDiv]).style.display = valore ? '' : 'none';
}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                             ACCOUNT UTENTE                                                              *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function fotoaccount(elemento,campocontrollo) {
	var controllo = document.getElementById(['dv_' + elemento]).style.display;
	controllo == '' ? document.getElementById([campocontrollo]).value = 1 : document.getElementById([campocontrollo]).value = 0;
	document.getElementById(['file_' + elemento]).value = '';	
	document.getElementById(['desc_file_' + elemento]).value = '';	
}

// Setta password
function settaPwd(arrayCampi){


	var userid = document.getElementById(['userid']).value;
	var pwd1 = document.getElementById(['pwd1']).value;
	var pwd2 = document.getElementById(['pwd2']).value;
	var oldpwd = document.getElementById(['oldpwd1']).value;	
	contaFalse = 0;

	
	//Controllo che le 2 pwd non siano vuote e non contengano spazi vuoti
	if(js_trim(pwd1) == '' || js_trim(pwd2) == '') {
		alert(configPwd_NoPwd);
		contaFalse = contaFalse+1;
		return false;
	}
	
	//Confronto tra le due pwd
	if(js_trim(pwd1) != js_trim(pwd2)) {
		alert(accControlloPwd);
		contaFalse = contaFalse+1;
		return false;
	}

	//Lunghezza minima della pwd
	if(js_trim(pwd1).length < 8 ) {
		alert(configPwd_PwdLen);
		contaFalse = contaFalse+1;
		return false;
	}

	//Controllo che userid e pwd non siano gli stessi
	if(js_trim(pwd1) == userid) {
		alert(configPwd_UserPwd);
		contaFalse = contaFalse+1;
		return false;
	}

	//Old pwd c'è solo per la pwd scaduta. Per la pwd persa non c'è
	if(js_trim(oldpwd) != "") {
		//Controllo che pwd e oldpwd non siano gli stessi
		if(js_trim(oldpwd) == js_trim(pwd1)) {
			alert(configPwd_OldPwdPwd);
			contaFalse = contaFalse+1;
			return false;
		}
	}

	contaFalse = controllaCampiPieni(arrayCampi) ? contaFalse : contaFalse+1 ;
	
	return contaFalse > 0 ?  false : true;
}

// Elimina Account
function eliminaAccount() {
	if (!confirm(genEliminaAccount)) {
		return false;
	}
}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                                  FORMS                                                                  *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function abilitaSelectForm(idlivello) {
	if (idlivello == '') {
		document.getElementById('elencoForm').options[0].selected = true;
		document.getElementById('elencoForm').disabled = true;
	}
	else {
		document.getElementById('elencoForm').disabled = false;
		document.getElementById('elencoForm').options[0].selected = true;
	}
	
}

function mostraGruppi(url,idmacroprofilo,idazione,sid) {
	window.location.href = url+'?_idaz='+idazione+'&_idlivform='+idmacroprofilo+'&_sid='+sid;
}

function abilitaPermessiGruppo(url,idmacroprofilo,idgruppo,idazione,sid) {
	window.location.href = url+'?_idaz='+idazione+'&_idlivform='+idmacroprofilo+'&_idgruppoform='+idgruppo+'&_sid='+sid;
}

function azzeraSelectForm() {
		document.getElementById('elencoForm').disabled = false;
		document.getElementById('elencoForm').options[0].selected = true;
}


function apriPermessiFormUtente(url,livelloutente,idlivelloform,idform,idazione,sid) {
	if (livelloutente == '') {
		alert('Scegliere un livello utente');
		return false;
	}
	else {
		window.location.href = url+'?_idaz='+idazione+'&_idform='+idform+'&_idliv='+livelloutente+'&_idlivform='+idlivelloform+'&_sid='+sid;
		idform != '' ? document.getElementById('permessi_form').style.display = '' : document.getElementById('permessi_form').style.display = 'none'; 
		
	}
	
}



/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                          ELEMENTI & DOCUMENTI                                                           *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function fotoelemento(elemento,campocontrollo) {
	var controllo = document.getElementById(['dv_' + elemento]).style.display;
	controllo == '' ? document.getElementById([campocontrollo]).value = 1 : document.getElementById([campocontrollo]).value = 0;
	document.getElementById(['file_' + elemento]).value = '';	
}

function controlla_campo(nomeCampo) {
	if (js_trim(nomeCampo) == '') {
		alert(genCampiVuoti);
		return false;
	}
}

function controllaCampiPieni(arrayCampi) {
	var contaFalse = 0;
	arrayValori = arrayCampi;

	for(var x=0; x<arrayValori.length; x++) {
		nomeCampo = arrayValori[x];
		if (js_trim(document.getElementById([nomeCampo]).value) == '') {
			alert('Il campo ' + nomeCampo + ' è obbligatorio');
			document.getElementById([nomeCampo]).style.borderColor = "red";
			contaFalse = contaFalse+1;
		}
	}
	return contaFalse > 0 ?  false : true;
}



// Blocca/Sblocca upload allegati
function bloccasblocca(elemento,div) {
	var checkbox = document.getElementById(['txt_' + elemento]).value;
	checkbox == 'true' ? document.getElementById([div]).style.display = 'none' : document.getElementById([div]).style.display = '';
}

// Visualizza il template scelto
function apriTemplate(nomeselect,url) {
	var w = window.location.href(url+'&_idtmpl='+document.getElementById([nomeselect]).value);
	
}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                                 COMMENTI                                                                *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function controlla_commento(codice) {
	if (codice == '') {
		alert(genCampiVuoti);
		return false;
	}
}

// Gestione messaggi utenti
function controlla_messaggi(nome, messaggio, codice) {
	if (nome == '' || messaggio == '' || codice == '') {
		alert(genCampiVuoti);
		return false;
	}
}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                              COMPONENTI                                                             *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function controlla_componente() {
	
	nomecomponente = document.getElementById('nomecomponente').value;
	dircomponente = document.getElementById('filecaricato').value;
	fileupload = document.getElementById('zipcomponente').value;
	
	fileupload = dircomponente == '' ? fileupload : 'ok';
	
	if (nomecomponente == '' || fileupload == '') {
		alert(genCampiVuoti);
		return false;
	}

}

function settaValoreComponente(ciclo) {
	for(var x=0; x<ciclo; x++) {
		document.getElementById(['txt_macroprofilo' + x]).value = "false";
		if(document.getElementById(['pubblico']).checked) {		
			document.getElementById(['macroprofilo' + x]).checked = false;		
		}
	}
}

function spubblicaComponente(valore) {
	if(valore) {		
		document.getElementById(['pubblico']).checked = false;		
	}
}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                              CONFIGURAZIONI                                                             *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function controlla_config(arrayCampi) {
	
	var arrayValori = new Array();
	var contaFalse = 0;
	arrayValori = arrayCampi;

	for(var x=0; x<arrayValori.length; x++) {
		nomeCampo = arrayValori[x];
		if (js_trim(document.getElementById([nomeCampo]).value) == '') {
			alert('Il campo ' + nomeCampo + ' è obbligatorio');
			contaFalse = contaFalse+1;
		}
		
		if (js_trim(document.getElementById([nomeCampo]).id) == 'sitemail' || js_trim(document.getElementById([nomeCampo]).id) == 'maildeveloper') {
			if(!(controllaMail(document.getElementById([nomeCampo]).value))) {
				contaFalse = contaFalse+1;
			}
		}
	}
	
	return contaFalse > 0 ?  false : true;
}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                                GUESTBOOK                                                                *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function controlla_messaggiGuestbook() {
	
	nomeutente = document.getElementById('nomeutente').value;
	messaggioutente = document.getElementById('messaggioutente').value;
	mailutente = document.getElementById('mailutente').value;
	capcha_code = document.getElementById('capcha_code').value;	

	if (nomeutente == '' || messaggioutente == '' || capcha_code == '') {
		alert(genCampiVuoti);
		return false;
	}

	if(mailutente != '') {
		if(!(controllaMail(mailutente))){
			return false;
		}
	}

}

function controlla_mod_guestbook() {
	
	nomeutente = document.getElementById('nomeutente').value;
	messaggioutente = document.getElementById('messaggioutente').value;
	mailutente = document.getElementById('mailutente').value;

	if (nomeutente == '' || messaggioutente == '') {
		alert(genCampiVuoti);
		return false;
	}

	if(mailutente != '') {
		if(!(controllaMail(mailutente))){
			return false;
		}
	}

}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                               MAILING LIST                                                              *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function controllaMailing() {
	
	if(document.getElementById('nome').value == '' || document.getElementById('cognome').value == '' || document.getElementById('mail').value == '') {	
		alert(genCampiVuoti);
		return false;
	}

	if(!(controllaMail(document.getElementById('mail').value))){
		return false;
	}
}

function controllaRubrica(conta) {
	
	for (i=1; i<conta+1; i++) {
		if(document.getElementById(['nome' + i]).value == '' || document.getElementById(['cognome' + i]).value == '' || document.getElementById(['cognome' + i]).value == '') {
			alert(genCampiVuoti);
			return false;
		}

		if(document.getElementById(['mail' + i]).value != '') {
			if(!(controllaMail(document.getElementById(['mail' + i])))){
				return false;
			}
		}
	}	
}

//Invio mailinglist
function gestione_inviomailing(destinatari, oggetto) {
	if(destinatari == '' || oggetto == '') {
		alert(genCampiVuoti);
		return false;
	}
}

function popupDestinatari() {
	var w = window.open('rubrica.asp', '_blank', 'width=575, height=400, resizable, status, scrollbars');
}

function inserisciMail() {

	opener.document.getElementById('Adestinatari').value = document.getElementById('eledestA').value;
	opener.document.getElementById('CCdestinatari').value = document.getElementById('eledestCC').value;
	opener.document.getElementById('BCCdestinatari').value = document.getElementById('eledestBCC').value;		
	this.close();
	opener.document.getElementById('Adestinatari').focus();
}

function selezionaTutti(cont,valore) {

	var strA = '';
	var strCC = '';
	var strBCC = '';
	var nomeCheck = valore.name;
	var idCheck = valore.id;
	var valChek = '';
	var ynChek = valore.checked;
	
	//alert('nomeCheck: ' + nomeCheck + '\nidCheck: ' + idCheck + '\nvalChek: ' + valChek + '\nynChek: ' + ynChek);
		
	if(ynChek) {
		valChek = true;
	}
	else {
		valChek = false;
	}
		//Seleziono tutti i contatti
	switch (nomeCheck) {
		case 'A':
			// Svuoto l'array prima di riempirlo
			for(var i=0; i<arrDestinatariA.length; i++) {
				arrDestinatariA[i] = '';
			}
			arrDestinatariA.sort();			
		
			for(i=1; i<parseInt(cont)+1; i++) {
				arrDestinatariA.push(document.getElementById([nomeCheck + 'mail' + i]).value);
				document.getElementById([nomeCheck + 'mail' + i]).checked = valChek;
			}
			
			for(var i=0; i<arrDestinatariA.length; i++) {
				if(strA == '') {
					strA = strA + arrDestinatariA[i];
				}
				else {
					strA = strA + ',' + arrDestinatariA[i];		
				}
			}
			if(ynChek) {
				document.getElementById(['eledest' + nomeCheck]).value=strA;			
			}
			else {
				document.getElementById(['eledest' + nomeCheck]).value='';						
			}
		break;

		case 'CC':
			// Svuoto l'array prima di riempirlo
			for(var i=0; i<arrDestinatariCC.length; i++) {
				arrDestinatariCC[i] = '';
			}
			arrDestinatariCC.sort();			

			for(i=1; i<parseInt(cont)+1; i++) {
				arrDestinatariCC.push(document.getElementById([nomeCheck + 'mail' + i]).value);
				document.getElementById([nomeCheck + 'mail' + i]).checked = valChek;
			}
			
			for(var i=0; i<arrDestinatariCC.length; i++) {
				if(strCC == '') {
					strCC = strCC + arrDestinatariCC[i];
				}
				else {
					strCC = strCC + ',' + arrDestinatariCC[i];		
				}
			}
			if(ynChek) {
				document.getElementById(['eledest' + nomeCheck]).value=strCC;			
			}
			else {
				document.getElementById(['eledest' + nomeCheck]).value='';						
			}

		break;
		
		case 'BCC':
			// Svuoto l'array prima di riempirlo
			for(var i=0; i<arrDestinatariBCC.length; i++) {
				arrDestinatariBCC[i] = '';
			}
			arrDestinatariBCC.sort();			
		
			for(i=1; i<parseInt(cont)+1; i++) {
				arrDestinatariBCC.push(document.getElementById([nomeCheck + 'mail' + i]).value);
				document.getElementById([nomeCheck + 'mail' + i]).checked = valChek;
			}
			
			for(var i=0; i<arrDestinatariBCC.length; i++) {
				if(strBCC == '') {
					strBCC = strBCC + arrDestinatariBCC[i];
				}
				else {
					strBCC = strBCC + ',' + arrDestinatariBCC[i];		
				}
			}
			if(ynChek) {
				document.getElementById(['eledest' + nomeCheck]).value=strBCC;			
			}
			else {
				document.getElementById(['eledest' + nomeCheck]).value='';						
			}
		break;
	}
}

function aggiungiDestinatari(valore) {
	
	var strA = '';
	var strCC = '';
	var strBCC = '';
	var nomeCheck = valore.name;
	var idCheck = valore.id;
	var valChek = valore.value;
	var ynChek = valore.checked;
	
	//alert('nomeCheck: ' + nomeCheck + '\nidCheck: ' + idCheck + '\nvalChek: ' + valChek + '\nynChek: ' + ynChek);
	
	//Gli array sono definiti nella pagina rubrica.asp
	document.getElementById(['tutti' + nomeCheck]).checked = false;
	
	if(ynChek) {
		//Inserisco l'indirizzo nell'array
		switch (nomeCheck) {
			case 'A':
				arrDestinatariA.push(valChek);
			break;

			case 'CC':
				arrDestinatariCC.push(valChek);
			break;
			
			case 'BCC':
				arrDestinatariBCC.push(valChek);
			break;
		}
	}
	else {
		//Tolgo l'indirizzo dall'array
		switch (nomeCheck) {
			case 'A':
				for(var i=0; i<arrDestinatariA.length; i++) {
					if(arrDestinatariA[i] == valChek) {
						arrDestinatariA[i] = '';
					}
				}
				arrDestinatariA.sort();			
			break;

			case 'CC':
				for(var i=0; i<arrDestinatariCC.length; i++) {
					if(arrDestinatariCC[i] == valChek) {
						arrDestinatariCC[i] = '';
					}
				}
				arrDestinatariCC.sort();			
			break;
			
			case 'BCC':
				for(var i=0; i<arrDestinatariBCC.length; i++) {
					if(arrDestinatariBCC[i] == valChek) {
						arrDestinatariBCC[i] = '';
					}
				}
				arrDestinatariBCC.sort();			
			break;
		}		
	}

	//Separo gli elementi con le virgole e inserisco nel campo nascosto
	switch (nomeCheck) {
		case 'A':
			for(var i=0; i<arrDestinatariA.length; i++) {
				if(strA == '') {
					strA = strA + arrDestinatariA[i];
				}
				else {
					strA = strA + ',' + arrDestinatariA[i];		
				}
			}
			document.getElementById(['eledest' + nomeCheck]).value=strA;
		break;

		case 'CC':
			for(var i=0; i<arrDestinatariCC.length; i++) {
				if(strCC == '') {
					strCC = strCC + arrDestinatariCC[i];
				}
				else {
					strCC = strCC + ',' + arrDestinatariCC[i];		
				}
			}
			document.getElementById(['eledest' + nomeCheck]).value=strCC;
		break;
		
		case 'BCC':
			for(var i=0; i<arrDestinatariBCC.length; i++) {
				if(strBCC == '') {
					strBCC = strBCC + arrDestinatariBCC[i];
				}
				else {
					strBCC = strBCC + ',' + arrDestinatariBCC[i];		
				}
			}
			document.getElementById(['eledest' + nomeCheck]).value=strBCC;			
		break;
	}

}

                                                              

/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                                 GENERALI                                                                *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
// Imposta il valore dei campi hidden delle checkbox
function impostaValore(nomeCampo, valore) {
	document.getElementById(['txt_' + nomeCampo]).value=valore;
}

// Vedi/Nascondi div
function vedinascondi(elemento) {
	var check = document.getElementById([elemento]).style.visibility;
	check == 'visible' ? document.getElementById([elemento]).style.visibility = 'hidden' : document.getElementById([elemento]).style.visibility = 'visible';
}

// Elimina
function elimina() {
	if (!confirm(genProcediElimina)) {
		return false;
	}
}


/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                                COMPONENTI                                                               *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function checkAll(cont,valore) {

	var nomeCheck = valore.name;
	var idCheck = valore.id;
	var valChek = '';
	var ynChek = valore.checked;
	
	//alert('nomeCheck: ' + nomeCheck + '\nidCheck: ' + idCheck + '\nvalChek: ' + valChek + '\nynChek: ' + ynChek);
		
	if(ynChek) {
		valChek = true;
	}
	else {
		valChek = false;
	}
	//Seleziono tutti i contatti
	// Svuoto l'array prima di riempirlo
	for(i=1; i<parseInt(cont)+1; i++) {
		document.getElementById([nomeCheck + i]).checked = valChek;
		document.getElementById(['txt_' + nomeCheck + i]).value = valChek;				
	}
}

/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                       DA CONTROLLARE/IMPLEMENTARE                                                       *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
// Filtra sezioni
function filtraSezioni(url,idfilter,idaz,tc) {
	var w = window.location.replace(url + '?_idfilter=' + idfilter + '&_idaz=' + idaz + '&tc=' + tc);
}


// Elenco filtrato
function filtraElenco(url,idfilter,idel,idaz) {
	//alert(url);
	var w = window.location.replace(url + '?_idfilter=' + idfilter + '&_idel=' + idel + '&_idaz=' + idaz);
}


//Popup
function apriPostit(idelemento,idlayout,idazione,idallegato) {
	var w = window.open('../includes/div_popup.asp?_idel=' + idelemento + '&_idlay=' + idlayout + '&_idaz=' + idazione + '&_idall=' + idallegato, 'Descrizione', 'width:200 height:200');
	w.focus();
}


// Iscrizione utente
function iscrizione_utente(nome,cognome,email,cap,userid,pwd,pwd2){

	if(nome == '' || cognome == '' || email == '' || userid == '' || pwd == '' || pwd2 == '') {
		alert(genCampiVuoti);
		return false;
	}
	if(email != '' ){
		if(!(controllaMail(email))){
			return false;
		}
	}

	if(cap != '' ){
		if(!(controllaCap(cap))){
			return false;
		}
	}

	if(pwd2 != pwd) {
		alert(accControlloPwd);
		return false;
	}
}



/*
*******************************************************************************************************************************************
*                                                                                                                                         *
*                                                                SIMULAZIONE SELECT                                                                 *
*                                                                                                                                         *
*******************************************************************************************************************************************
*/
function apriValori() {
	
	var stato = document.getElementById("valori").style.display == "none" ? "" : "none";
	document.getElementById("valori").style.display = stato;
	document.getElementById("valori").style.width = "100%";	
    document.getElementById("vuoto").innerHTML = "";		
}

function selezionaValore(valore,nome,display) {
    document.getElementById("valori").style.display = "none";
    document.getElementById("vuoto").innerHTML = nome;	
    document.getElementById("padreelemento").value = valore;		
    document.getElementById("div_posizione_elementi").style.display = display;			
}



