I got problem, with JavaScript i really don't work,but now i need some script.

So, i need to calculate 3 different values.
Weight - size - Total Cost

I use 2 different function to calculate theses values, but now i don't understand how i need to calculate last value - Total cost.
Formula is:
if((info_from_mysql < weight) or info_from_mysql < size)
Total Cost = Info_from_mysql_table;

So maybe someone has any mind how to do it?

By the way i use this function to calculate weight and size:

function UpdateWeight() {
  var sum = 0;
  var gn, elem;
  for (i=0; i<7; i++) {
    gn = 'order'+i;
    elem = document.getElementById(gn);
    if (elem.checked == true) { sum += Number(elem.value); }
  document.getElementById('weight').value = sum.toFixed(2);
Thank you for help.