function fnValidateFeeReceiptStudent() {
	var himsValidator = [new hims_ctl_val('ctl00_CP_OrganizationDropDownList', "Organization", "T", "", "", "", 20),
		new hims_ctl_val('ctl00_CP_BatchDropDownList', "Batch", "T", "", "", "", 20),
		new hims_ctl_val('ctl00_CP_StudentIdNoTextBox', "ID No", "T", "", "", "", 20),
		new hims_ctl_val('ctl00_CP_PayTypeDropDownList', "Pay Type", "T", "", "", "", 20)];
	if (fnDoValidate(himsValidator) && $("#ctl00_CP_IsStopApplicationAccessCheckBox").is(":checked"))
	    return confirm('Students application access is stopped do you still want to continue?');
	else if (fnDoValidate(himsValidator))
	    return confirm('Are you sure you Want to Save?');
	else
	    return false;
}
function fnValidateFeeReceiptEmployee() {
	var himsValidator = [new hims_ctl_val('ctl00_CP_OrganizationDropDownList', "Organization", "T", "", "", "", 20),
		new hims_ctl_val('ctl00_CP_BatchDropDownList', "Batch", "T", "", "", "", 20),
		new hims_ctl_val('ctl00_CP_EmployeeIdNoTextBox', "ID No", "T", "", "", "", 20),
		new hims_ctl_val('ctl00_CP_PayTypeDropDownList', "Pay Type", "T", "", "", "", 20)];
	if (fnDoValidate(himsValidator))
		return confirm('Are you sure you Want to Save?');
	else
		return false;
}
function GetValueFromChild() {
	location.reload(true);
}
function EditVal() {
	var left = (screen.width / 2) - (1000 / 2);
	var top = (screen.height / 2) - (500 / 2);
	if (popwindow == null) {
		popwindow = window.open('../../Pages/FeeManagement/AddStudent.aspx', '', 'height=600,width=1000,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes' + ', top=' + top + ', left=' + left);
	}
	else {
		popwindow.close();
		popwindow = window.open('../../Pages/FeeManagement/AddStudent.aspx', '', 'height=600,width=1000,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes' + ', top=' + top + ', left=' + left);
	}
}
function StudentwiseFee() {
	var left = (screen.width / 2) - (1000 / 2);
	var top = (screen.height / 2) - (500 / 2);
	if (popwindow == null) {
		popwindow = window.open('../../Pages/FeeManagement/StudentwiseFee.aspx?MasterPage=Dialog"', '', 'height=600,width=1000,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes' + ', top=' + top + ', left=' + left);
	}
	else {
		popwindow.close();
		popwindow = window.open('../../Pages/FeeManagement/StudentwiseFee.aspx?MasterPage=Dialog"', '', 'height=600,width=1000,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes' + ', top=' + top + ', left=' + left);
	}
}
function funcsum() {
	var table = document.getElementById('ctl00_CP_FeeListGridView');
	var sum = 0;
	var PayableAmount = 0;
	var PendingAmount = 0;
	var flag = 0;
	var location = 0;
	for (var i = 0; i < table.rows.length; i++) {
		if (!isNaN(table.rows[i].cells[2].innerText)) {
			PendingAmount = parseFloat(table.rows[i].cells[1].all[0].value);
			PayableAmount = parseFloat(table.rows[i].cells[2].all[0].value);
			if (PayableAmount > PendingAmount) {
				flag = 1;
				location = i;
				break;
			}
		}
	}
	if (flag == 1) {
		alert("Amount should be less than Pending Amount");
		table.rows[location].cells[2].all[0].value = "";
	}
	for (var i = 0; i < table.rows.length; i++) {
		if (!isNaN(table.rows[i].cells[2].innerText)) {
			PayableAmount = parseFloat(table.rows[i].cells[2].all[0].value);
			if (!isNaN(PayableAmount))
				sum = (parseFloat(sum) + PayableAmount).toString();
		}
	}
	document.getElementById('ctl00_CP_TotalPayableAmountTextBox').innerText = sum;
}
function isNumberKey(evt) {
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}