function stringatoarray (campo, separatore) {
	var stringa=document.getElementById(campo).value;
	if (stringa.lastIndexOf(separatore)==stringa.length -1) {stringa= stringa.slice(0, stringa.length -1)};
	var array=stringa.split(separatore);
	return array;
}

function stringarray(stringa, separatore) {
	if (stringa.lastIndexOf(separatore)==stringa.length -1) {stringa= stringa.slice(0, stringa.length -1)};
	var array=stringa.split(separatore);
	return array;
}
function cambia_e_invia(id,valore) {
	var form = document.getElementById(id);
	form.action = valore;
	form.submit();
}

function disabilita_abilita(idbottone){
	var buttons = document.getElementsByTagName("button");
	for (i=0;i<buttons.length; i++) {
		buttons[i].disabled=true;
	}
	document.getElementById(idbottone).disabled=false;
}

function salva_e_invia(id, valore, form,aggiungi){
	var el = document.getElementById(id);
	var form=document.getElementById(form);
	if (aggiungi) {
		el.value=parseInt(el.value)+parseInt(valore);
	} else {el.value=valore;}
	form.submit();
}

function chk_e_invia(id,valore) {
	if(confirm("Confermi l'eliminazione?")) {
		var form = document.getElementById(id);
		form.action = valore;
		form.submit();
	}
}

function cambia_stile(id,nome_classe) {
	document.getElementById(id).className=nome_classe;
}

function abilitasubmit(){
	if (document.getElementById('si').checked==true) {document.getElementById('invia').disabled=false}
}

function abilita_submit(id,modo){
	document.getElementById(id).disabled=modo;
}
function vedo_non_vedo(id){
	var el = document.getElementById(id);
	if (el.style.display=='block'){el.style.display ='none';}
	else{el.style.display='block';}
}