Something like below should do the trick:
function total(){
var t11 = document.getElementsByClassName("FTw1"),
t12 = document.getElementsByClassName("FBw1"),
t13 = document.getElementsByClassName("FTp1"),
t14 = document.getElementsByClassName("FBp1"),
t15 = document.getElementsByClassName("FTt1"),
t16 = document.getElementsByClassName("FBt1"),
t21 = document.getElementsByClassName("FTw2"),
t22 = document.getElementsByClassName("FBw2"),
t23 = document.getElementsByClassName("FTp2"),
t24 = document.getElementsByClassName("FBp2"),
t25 = document.getElementsByClassName("FTt2"),
t26 = document.getElementsByClassName("FBt1"),
tperc = document.getElementsByClassName("perc"),
t1 = document.getElementById("FTw1").value,
t2 = document.getElementById("FBw1").value,
t3 = document.getElementById("FTp1").value,
t4 = document.getElementById("FBp1").value,
t5 = document.getElementById("FTt1").value,
t6 = document.getElementById("FBt1").value,
tt1 = document.getElementById("FTw2").value,
tt2 = document.getElementById("FBw2").value,
tt3 = document.getElementById("FTp2").value,
tt4 = document.getElementById("FBp2").value,
tt5 = document.getElementById("FTt2").value,
tt6 = document.getElementById("FBt2").value,
ttperc = document.getElementById("perc").value,
s11 = "FTw1",
s12 = "FBw1",
s13 = "FTp1",
s14 = "FBp1",
s15 = "FTt1";
s16 = "FBt1";
s21 = "FTw2",
s22 = "FBw2",
s23 = "FTp2",
s24 = "FBp2",
s25 = "FTt2";
s26 = "FBt2";
sperc = "perc";
sum(t11, t1, s11, 17);
sum(t12, t2, s12, 13);
sum(t13, t3, s13, 14);
sum(t14, t4, s14, 14);
sum(t15, t5, s15, 10);
sum(t16, t6, s16, 13);
sum(t21, tt1, s21, 17);
sum(t22, tt2, s22, 13);
sum(t23, tt3, s23, 14);
sum(t24, tt4, s24, 14);
sum(t25, tt5, s25, 10);
sum(t26, tt6, s26, 13);
sum(tperc, ttperc, sperc);
document.getElementById("perc").className = (document.getElementById("perc").value >= '66') ? 'highlight' : '';
}
function sum(c, t, s, p){
t = '0';
if(p == null || p == undefined) p = 0;
for(var i = 0; i < c.length; i++){
var a = c[i].value,
b = 1*a+1*t;
t = b;
document.getElementById(s).value = t;
document.getElementById(s).className = (t >= p) ? 'highlight' : '';
}
}
I just added a new argument to the sum() function that contains the 'highlight numbers' for each group. When you call the sum() function the number is just entered as the final argument.