function F_hw(value,vis){
	var x = value;
	
	totale_euro_hw = prendiElementoDaId('fatttot').value;
	
	if (x == ''){
		risultato    = '<span class="suggerimento" >Inserisci l\'incidenza della vendita hardware sul tuo fatturato</span>';
		risultatoimg = '';
	}else{
		if (!isNaN(x)){ 
			risultato    = Math.round(prendiElementoDaId('fatttot').value*prendiElementoDaId('tot_hw').value/100)+' &euro;';
		}else{ 
			risultato    = '<span class="msg_errore" >  Valore non valido </span>';
			vis = 0;
		}
	}
	
	prendiElementoDaId('div_tot_hw').innerHTML = risultato;

}

function F_cat(value,cat,nome_cat,vis){
	var x = value;
	var totale_percentuali = 0;
	
	totale_euro_hw = prendiElementoDaId('fatttot').value*prendiElementoDaId('tot_hw').value/100;
	
	if(!isNaN(parseInt(prendiElementoDaId('tot_no').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_no').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_nb').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_nb').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_stampanti').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_stampanti').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_consumabili').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_consumabili').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_monitor').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_monitor').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_pc').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_pc').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_hd').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_hd').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_ram').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_ram').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_tv').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_tv').value);
	if(!isNaN(parseInt(prendiElementoDaId('tot_av').value)))
		totale_percentuali += parseInt(prendiElementoDaId('tot_av').value);
	
	//if(totale_percentuali > 100)
	//	alert('Attenzione! sommando le % indicate il totale  superiore al 100%');
	
	if (x == ''){
		risultato    = '<span class="suggerimento" >Inserisci l\'incidenza della vendita '+nome_cat+' sul fatturato hardware</span>';
		risultatoimg = '';
	}else{
		if (!isNaN(x)){ 
			tot_ = Math.round(totale_euro_hw*(value/100));
			risultato    = tot_+' &euro;';
		}else{ 
			risultato    = '<span class="msg_errore" >  Valore non valido </span>';
			vis = 0;
		}
	}
	
	prendiElementoDaId('div_tot_'+cat).innerHTML = risultato;
	
	if(x != '')
		prendiElementoDaId('div_percent_'+cat).style.display = 'block';
	
}


function F_cat_brand(value,cat,nome_cat,nome_brand,vis){
	var x = value;

	if (x == ''){
		risultato    = '<span class="suggerimento" >Inserisci l\'incidenza della vendita '+nome_cat+' '+nome_brand+'  sul fatturato '+nome_cat+'</span>';
		risultatoimg = '';
	}else{
		if (!isNaN(x)){ 
			tot_ = Math.round(totale_euro_hw*(value/100));
			risultato    = tot_+' &euro;';
		}else{ 
			risultato    = '<span class="msg_errore" >  Valore non valido </span>';
			vis = 0;
		}
	}
	
	prendiElementoDaId('div_brand_'+cat+nome_brand).innerHTML = risultato;
	
	if(vis == 1)
		prendiElementoDaId('div_brand_'+cat+nome_brand).innerHTML = '';
	
}
