﻿// JScript File

function FillDates(control, dateString) {
		control.SetDate(dateString);
}

function hidediv(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // NS4
			document.id.display = 'none';
		}
		else { // IE4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // NS4
			document.id.display = 'block';
		}
		else { // IE4
			document.all.id.style.display = 'none';
		}
	}
}

function WaitMessage(toHide, toShow) {
	hidediv(toHide);
	showdiv(toShow);
}

function onlyNumbers(e) {
	var keynum;
	var keychar;
	var numcheck;

	if(window.event) { // IE
		keynum = e.keyCode;
		}
	else if(e.which) { // Netscape/Firefox/Opera
		keynum = e.which;
		}
	keychar = String.fromCharCode(keynum);
	numcheck = /\d|\./;
	return numcheck.test(keychar);
}

function TotalPayAmount(txtTotalPayment) {
	var dTotal = 0.0;
	for (var i=0;i<theForm.length;i++) {
		if (theForm.elements[i].id.match("txtYear")) {
			var sYear = theForm.elements[i].value;
			for (var j=0;j<theForm.length;j++) {
				if (theForm.elements[j].id.match("chkSelect" + sYear)) {
					if (theForm.elements[j].checked) {
						for (var k=0;k<theForm.length;k++) {
							if (theForm.elements[k].id.match("txtAmount" + sYear)) {
								dTotal += theForm.elements[k].value;
							}
						}
					}
				}
			}
		}
	}
	var TPbox = document.getElementById(txtTotalPayment);
	var nf = new NumberFormat(dTotal);
	nf.setSeparators(false);
	nf.setPlaces(2);
	TPbox.value = nf.toFormatted();
}

function PostPayment() {
	var year = [];
	var roll = [];
	var amount = [];
	var transID;
}
