function calculate_grade(e) {
	var studid = e.dataset.studid;
	var egrade = document.getElementById('grade'+studid);
	var grade = JSON.parse(egrade.dataset.grades);
	var val = e.value;
	for (var j = grade.length - 1; j >= 0; j--) {
		if(val >= parseInt(grade[j].min) && val <= parseInt(grade[j].max)) {
			egrade.value = grade[j].grade+' --- '+grade[j].description;
		}
		if(val > 100 || val < 0) {
			egrade.value = "Not Available";
		}
	}

}