// GPA CALCULATORfunction setFocus() {        document.GPA.CGPA.focus();        return;}function compute(obj) { if (obj.TTD.value=="0" && obj.cach.selectedIndex=="0" &&obj.cbch.selectedIndex=="0" && obj.ccch.selectedIndex=="0" &&obj.cdch.selectedIndex=="0" && obj.cech.selectedIndex=="0" && obj.cech.selectedIndex=="0" )    {alert ("You must enter credit hours in at least one place") } else{obj.result.value=(eval(obj.TTD.value)*eval(obj.CGPA.value)+eval(obj.cach.selectedIndex)*eval(obj.cagr.selectedIndex)+eval(obj.cbch.selectedIndex)*eval(obj.cbgr.selectedIndex)+eval(obj.ccch.selectedIndex)*eval(obj.ccgr.selectedIndex)+eval(obj.cdch.selectedIndex)*eval(obj.cdgr.selectedIndex)+eval(obj.cech.selectedIndex)*eval(obj.cegr.selectedIndex)+eval(obj.cfch.selectedIndex)*eval(obj.cfgr.selectedIndex))/(eval(obj.TTD.value)+eval(obj.cach.selectedIndex)+eval(obj.cbch.selectedIndex)+eval(obj.ccch.selectedIndex)+eval(obj.cdch.selectedIndex)+eval(obj.cech.selectedIndex)+eval(obj.cfch.selectedIndex))}}function compute2(obj){if (obj.CGPA3.value<= obj.CGPA.value){alert ("your desired grade has to be higher than your current standing")}else if (obj.PGPA.value<=obj.CGPA3.value || obj.PGPA.value>4){alert ("Your predicted performance has to be better than your cumalitive desired performance and less than 4")} else{obj.result2.value=Math.ceil(eval((eval(obj.CGPA3.value)-eval(obj.CGPA.value))*eval(obj.TTD.value/(eval(obj.PGPA.value)-eval(obj.CGPA3.value)))))+" hours"}}function compute3(obj){if (obj.CGPA3B.value>4){alert ("your desired grade can't be greater than 4.0")}else if (obj.PGPAB.value>20){alert ("Twenty hours is the maximum load")} else{obj.result3.value=eval(obj.CGPA3B.value)+(eval(obj.CGPA3B.value)-eval(obj.CGPA.value))*eval(obj.TTD.value)/eval(obj.PGPAB.value)}}function round2d(n){ return(Math.round(100*n)/100);}function gpacalc(){//define valid grades and their valuesvar gr = new Array(); var cr = new Array();var ingr = new Array();var incr = new Array();// define valid grades and their valuesvar grcount = 26; gr[1] = "A"; cr[1] = 4; gr[2] = "A-";cr[2] = 3.70;gr[3] = "B+";cr[3] = 3.30;gr[4] = "B";cr[4] = 3;gr[5] = "B-";cr[5] = 2.70;gr[6] = "C+";cr[6] = 2.33;gr[7] = "C";cr[7] = 2;gr[8] = "C-"cr[8] = 1.67gr[9] = "D+";cr[9] = 1.33;gr[10] = "D";cr[10] = 1;gr[11] = "D-";cr[11] = 0.67;gr[12] = "F";cr[12] = 0;//For lower case lettersgr[13]  = "a";cr[13] = 4; gr[14] = "a-";cr[14] = 3.70;gr[15] = "b+";cr[15] = 3.30;gr[16] = "b";cr[16] = 3;gr[17] = "b-";cr[17] = 2.70;gr[18] = "c+";cr[18] = 2.33;gr[19] = "c";cr[19] = 2;gr[20] = "c-"cr[20] = 1.67gr[21] = "d+";cr[21] = 1.33;gr[22] = "d";cr[22] = 1;gr[23] = "d-";cr[23] = 0.67;gr[24] = "f";cr[24] = 0;// retrieve user inputingr[0] = document.GPACalcForm.GR1.value;ingr[1] = document.GPACalcForm.GR2.value;ingr[2] = document.GPACalcForm.GR3.value;ingr[3] = document.GPACalcForm.GR4.value;ingr[4] = document.GPACalcForm.GR5.value;ingr[5] = document.GPACalcForm.GR6.value;incr[0] = document.GPACalcForm.CR1.value;incr[1] = document.GPACalcForm.CR2.value;incr[2] = document.GPACalcForm.CR3.value;incr[3] = document.GPACalcForm.CR4.value;incr[4] = document.GPACalcForm.CR5.value;incr[5] = document.GPACalcForm.CR6.value;// Calculate GPAvar allgr =0;var allcr = 0;var gpa = 0;var resultcurgpa = 0;for (var x = 0; x < 6; x++)        {        if (ingr[x] == "")         break;//      if (isNaN(parseInt(incr[x]))) alert("Error- You did not enter a numeric credits value for Class If the class is worth 0 credits then enter the number 0 in the field.");         var validgrcheck = 0;        for (var xx = 0; xx < grcount; xx++)                {                if (ingr[x] == gr[xx])                        {                        allgr = allgr + (parseInt(incr[x],10) * cr[xx]);                        allcr = allcr + parseInt(incr[x],10);                        validgrcheck = 1;                        break;                        }                }        if (validgrcheck == 0)                {                alert("Error- Could not recognize the grade entered for Class " + eval(x + 1) + ". Please use standard college grades in the form of a a- b+ ...f.");                return 0;                }        }// this if-check prevents a divide by zero errorif (allcr == 0)    {       alert("Error- You did not enter any credit values! GPA = N/A");       return 0;    }gpa = round2d(allgr / allcr);resultcurgpa = eval(gpa);document.GPACalcForm.resultcurgpa.value = resultcurgpa;return 0;}function cumCalc(){//define valid grades and their valuesvar gr = new Array(); var cr = new Array();var ingr = new Array();var incr = new Array();// define valid grades and their valuesvar grcount = 26; gr[1] = "A"; cr[1] = 4; gr[2] = "A-";cr[2] = 3.70;gr[3] = "B+";cr[3] = 3.30;gr[4] = "B";cr[4] = 3;gr[5] = "B-";cr[5] = 2.70;gr[6] = "C+";cr[6] = 2.33;gr[7] = "C";cr[7] = 2;gr[8] = "C-"cr[8] = 1.67gr[9] = "D+";cr[9] = 1.33;gr[10] = "D";cr[10] = 1;gr[11] = "D-";cr[11] = 0.67;gr[12] = "F";cr[12] = 0;gr[13]  = "a";cr[13] = 4; gr[14] = "a-";cr[14] = 3.70;gr[15] = "b+";cr[15] = 3.30;gr[16] = "b";cr[16] = 3;gr[17] = "b-";cr[17] = 2.70;gr[18] = "c+";cr[18] = 2.33;gr[19] = "c";cr[19] = 2;gr[20] = "c-"cr[20] = 1.67gr[21] = "d+";cr[21] = 1.33;gr[22] = "d";cr[22] = 1;gr[23] = "d-";cr[23] = 0.67;gr[24] = "f";cr[24] = 0;// retrieve user inputingr[0] = document.GPACalcForm.GR1.value;ingr[1] = document.GPACalcForm.GR2.value;ingr[2] = document.GPACalcForm.GR3.value;ingr[3] = document.GPACalcForm.GR4.value;ingr[4] = document.GPACalcForm.GR5.value;ingr[5] = document.GPACalcForm.GR6.value;incr[0] = document.GPACalcForm.CR1.value;incr[1] = document.GPACalcForm.CR2.value;incr[2] = document.GPACalcForm.CR3.value;incr[3] = document.GPACalcForm.CR4.value;incr[4] = document.GPACalcForm.CR5.value;incr[5] = document.GPACalcForm.CR6.value;// Calculate GPAvar allgr =0;var allcr = 0;var gpa = 0;for (var x = 0; x < 6; x++)        {        if (ingr[x] == "") break;//      if (isNaN(parseInt(incr[x]))) alert("Error- You did not enter a numeric credits value for Class If the class is worth 0 credits then enter the number 0 in the field.");         var validgrcheck = 0;        for (var xx = 0; xx < grcount; xx++)                {                if (ingr[x] == gr[xx])                        {                        allgr = allgr + (parseInt(incr[x],10) * cr[xx]);                        allcr = allcr + parseInt(incr[x],10);                        validgrcheck = 1;                        break;                        }                }        if (validgrcheck == 0)                {                alert("Error- Could not recognize the grade entered for Class " + eval(x + 1) + ". Please use standard college grades in the form of a a- b+ ...f.");                return 0;                }        }// this if-check prevents a divide by zero errorif (allcr == 0)        {        alert("Error- You did not enter any credit values! GPA = N/A");        return 0;        }gpa = allgr / allcr;// set variablesvar cumGPAnum = 0;var cumCredTotal = 0;// retrieve user inputcumGPAnum = parseFloat(document.GPACalcForm.cumGPA.value);cumCredTotal = parseFloat(document.GPACalcForm.cumCredits.value);if (document.GPACalcForm.cumGPA.value == "")    {  alert("You need to enter your previous cumulative gpa in order to calculate your new one.");            return 0;   }   if (document.GPACalcForm.cumCredits.value == "")    {  alert("You need to enter the total number of credits you earned prior to this semester.");            return 0;   }   if (document.GPACalcForm.cumGPA.value == gpa)    {  if (confirm("Are you sure you are entering your previous cumulative GPA, and not your new semester GPA?" +                  " Hit OK if your sure, otherwise hit Cancel to change your values."))      {}      else            return 0;   }// find total pointsvar points = 0;points = (cumGPAnum * cumCredTotal);// Add semester values to cumulativepoints = points + allgr;var credits = 0;credits = cumCredTotal + allcr;// Calculate new cumulative gpavar newCum = 0;newCum = round2d(points / credits);var resultcumgpa;resultcumgpa = eval(newCum);document.GPACalcForm.resultcumgpa.value = resultcumgpa;return 0;}function validateForm(form) {   if (form.cumGPA.value == "")    {  alert("You need to enter your previous cumulative gpa in order to calculate your new one.");            return false;   }   if (form.cumCredits.value == "")    {  alert("You need to enter the total number of credits you earned prior to this semester.");            return false;   }   if (form.cumGPA.value == form.gpa.value)    {  confirm("Are you sure you are entering your cumulative gpa, and not your new semester gpa?");   }     else    {  return true;   }}//-->