// JavaScript Document
<!--
	function popup(url,windowname,width,height,features){ 
	width=(width)?width:screen.width/2; 
	height=(height)?height:screen.height/2; 
	var screenX = (screen.width/2 - width/2); 
	var screenY = (screen.height/2 - height/2); 
	var features= "width=" + width + ",height=" + height +",scrollbars=yes,status=no"; 
	features += ",screenX=" + screenX + ",left=" + screenX; 
	features += ",screenY=" + screenY + ",top=" + screenY; 
	
	var mywin=window.open(url, windowname, features); 
	if (mywin) 
	mywin.focus(); 
	return mywin; 
	} 
	
	function confirmaEliminar(missatge,adreca){
	var m = window.confirm(missatge)
	if (m==true){
	window.location = adreca
	}
}
function arrodonir(quantitat, decimals) {
	var quantitat = parseFloat(quantitat);
	var decimals = parseFloat(decimals);
	decimals = (!decimals ? 2 : decimals);
	elevat = Math.pow(10, decimals);
	valor = Math.round(quantitat * elevat) / elevat;
	return valor;
	//return Math.round(quantitat);
}

function calcular_mitjana_r(){
	sumatori_notes = 0;
	num_criteris = document.getElementById('total_treball_criteris').value;
	str_retorn = '';
	k = 0;
	for (i=0;i<=num_criteris;i++) {
		k++;
		id_av = document.getElementById('id_nota_criteri_'+i).value;
		id_percentatge = document.getElementById('p_criteri_'+i).value;		
		id_percentatge = parseFloat(id_percentatge/100);			
		id_av = parseFloat(id_percentatge*id_av);		
		if (!(isNaN(id_av))) sumatori_notes = parseFloat(parseFloat(sumatori_notes) + parseFloat(id_av));
		str_retorn += 'nota: '+id_av+'; sumatori: '+sumatori_notes+';\n';
	}
	/*alert(str_retorn);*/
	/*
	sumatori_notes = sumatori_notes.toFixed(2);
	sumatori_notes = arrodonir(sumatori_notes,1);
	document.getElementById('i_nota_criteri').value = sumatori_notes;	*/
}

-->
