﻿// JScript File
function first()
	{	
	 if (document.forms[0].boxstudnum.value < 1)
		alert("You need to enter the number of students.");
	 else
	     calculatepage();
	}


function cent(amount) 
{
    return (amount == Math.floor(amount)) ? amount + '.00' : ((amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

function calculatepage()
{
var a = 0;
var b = 0;
var c = 0;
var d = 0;
var e = 0;
var f = 0;
var g = 0;
var h = 0;
var i = 0;
var j = 0;
var k = 0;
var l = 0;
var m = 0;
var n = 0;
var o = 0;
var p = 0;
var q = 0;
var r = 0;
var s = 0;
var t = 0;
var u = 0;
var v = 0;
var w = 0;
var x = 0;
var y = 0;
var z = 0;
var aa = 0;
var bb = 0;
var cc = 0;
var dd = 0;
var ee = 0;
var othera = 0;
var otherb = 0;
var otherc = 0;
var studnum = 0;
var studnum = window.document.forms[0].boxstudnum.value
var a = window.document.forms[0].boxa.value
var b = window.document.forms[0].boxb.value
var c = window.document.forms[0].boxc.value
var d = window.document.forms[0].boxd.value
var e = window.document.forms[0].boxe.value
var f = window.document.forms[0].boxf.value
var g = window.document.forms[0].boxg.value
var h = window.document.forms[0].boxh.value
var i = window.document.forms[0].boxi.value
var j = window.document.forms[0].boxj.value
var k = window.document.forms[0].boxk.value
var l = window.document.forms[0].boxl.value
var m = window.document.forms[0].boxm.value
var n = window.document.forms[0].boxn.value
var o = window.document.forms[0].boxo.value
var p = window.document.forms[0].boxp.value
var q = window.document.forms[0].boxq.value
var r = window.document.forms[0].boxr.value
var s = window.document.forms[0].boxs.value
var t = window.document.forms[0].boxt.value
var u = window.document.forms[0].boxu.value
var v = window.document.forms[0].boxv.value
var w = window.document.forms[0].boxw.value
var x = window.document.forms[0].boxx.value
var y = window.document.forms[0].boxy.value
var z = window.document.forms[0].boxz.value
var aa = window.document.forms[0].boxaa.value
var bb = window.document.forms[0].boxbb.value
var cc = window.document.forms[0].boxcc.value
var dd = window.document.forms[0].boxdd.value
var ee = window.document.forms[0].boxee.value
var othera = window.document.forms[0].boxother1.value
var otherb = window.document.forms[0].boxother2.value
var otherc = window.document.forms[0].boxother3.value
var a = a * 1
var b = b * 1
var c = c * 1
var d = d * 1
var e = e * 1
var f = f * 1
var g = g * 1
var h = h * 1
var i = i * 1
var j = j * 1
var k = k * 1
var l = l * 1
var m = m * 1
var n = n * 1
var o = o * 1
var p = p * 1
var q = q * 1
var r = r * 1
var s = s * 1
var t = t * 1
var u = u * 1
var v = v * 1
var w = w * 1
var x = x * 1
var y = y * 1
var z = z * 1
var aa = aa * 1
var bb = bb * 1
var cc = cc * 1
var dd = dd * 1
var ee = ee * 1
var studnum = studnum * 1
var othera = othera * 1
var otherb = otherb * 1
var otherc = otherc * 1
var totalone = a + b + c + d;
var totaltwo = e + f + g + h + i + j;
var totalthree = k + l + m + n;
var totalfour = o + p + q + r + s + t;
var totalfive = u + v + w + x + y + z;
var totalsix = aa + bb + cc + dd + ee;
var othertotal = othera + otherb + otherc;
var grandtotal = totalone + totaltwo + totalthree + totalfour + totalfive + totalsix + othertotal;
var studcost = grandtotal / studnum;
window.document.forms[0].boxtotalone.value = cent(totalone);
window.document.forms[0].boxtotaltwo.value = cent(totaltwo);
window.document.forms[0].boxtotalthree.value = cent(totalthree);
window.document.forms[0].boxtotalfour.value = cent(totalfour);
window.document.forms[0].boxtotalfive.value = cent(totalfive);
window.document.forms[0].boxtotalsix.value = cent(totalsix);
window.document.forms[0].boxothertotal.value = cent(othertotal);
window.document.forms[0].boxgrandtotal.value = cent(grandtotal);
window.document.forms[0].boxstudcost.value = cent(studcost);
}

