/*
 * ITR6_Calculations.js
 *
 * Created on 01/03/2018
 *
 * Copyright(c) 2014  TCS Company, Inc.  All Rights Reserved.
 * This software is the proprietary information of TCS Company.
 *
 */
var dpmCeasesMesg = '';
var doaCeasesMesg = '';

var FY_start_date = '01/04/2019';
var FY_end_date = '31/03/2020';

var slab0_end_date = '15/06/2019';

var slab1_start_date = '16/06/2019';
var slab1_end_date = '16/09/2019';

var slab2_start_date = '17/09/2019';
var slab2_end_date = '16/12/2019';//31/12/2019

var slab3_start_date = '17/12/2019';//01/01/2020
var slab3_end_date = '16/03/2020';

var slab4_start_date = '17/03/2020';

var Int_234A_Due_date_234A = '16/02/2021';
var Int_234A_IF_NO_dt = '15/02/2021';
var AY_start_date = '01/04/2020';

function calcITR6() {
	setTimeout(calcITR6Impl, 100);
}

function calcITR6Impl() {
	try {
		disableChapterVIA();
		if (document.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0].value == '04'||
				document.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0].value == '03'||
				document.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0].value == '21'||
				document.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0].value == '22'||
				document.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0].value == '20'||
				document.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0].value == '23'||
			document.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0].value == '30') {
			slab2_end_date = '31/12/2019';
			slab3_start_date = '01/01/2020';
		} else {
			slab2_end_date = '16/12/2019';
			slab3_start_date = '17/12/2019';

		}
		var cgosIncome = {};
		initCgOsInc(cgosIncome);
		importBaonLoad();
		calcDDTSurcharge();
		calcBBTSurcharge();
		calcBalSheet();
		populateHP_PTI();
		calcTradingTotal10IndAs();
		calculateManTradingIndAs();
		calculatePL();
		calPartABalSheetIndAs();
		calcManufacTotalAIndAs();
		calcManufacTotalDIndAs();
		calcManufacTotalEIndAs();
		calcManufacTotalEIndAs();
		calculateOpeningStkTotalIndAs();
		calcClosingStockTotalIndAs();
		calcTradingTotalAIndAs();
		calculateTradingCIndAs();
		calcTradingTotalDIndAs();
		calcTradingTotal6IndAs();
		calcTradingTotal9IndAs();
		calcTotSchTradingRevIndAs();
		calcTotSchTradingExpIndAs();
		calPartAPLSheetIndAs();
		calcPartAOI();
		scheduleHPCalcFor6();
		calculateSchDPM();
		calculateSchDOA();
		calcSchDEPFor6();
		calcSchDCGFor6();
		calcSchESRFor6();
		calc10AA();
		calcSchBPBalFor6();
		enableNRItables();
		setSecRespOnSave();
		calcSch112A();
		calcSch115Ad1();
		calculateFullVal50CLtcg();
		calculateFullVal50CStcg();
		calcSchCG(cgosIncome);
		scheduleCGA5a();
		scheduleCGA6a();
		scheduleCGB7();
		OSSubCal();
		var simap = calculateOS(cgosIncome);
		calculateCYLA(cgosIncome);
		var amt5BBC = simap['5BBC'];
		var amt5Ea = simap['5Ea'];
		populateSI(cgosIncome, simap);
		calcUD();
		cflOn115BA();
		calculateCFLTotalNormalPti();
		calcCFL_sumAll();
		cflFieldxiii();
		//calculateCYLA(cgosIncome);
		calcTotal80IA();
		calcTotal80IB();
		calcTotal80IC();
		calcScheduleSI();
		calculatePartBTI_first();
		caclDedSchVIA();
		calcTotSchEIDTAA();
		calcTotal80GDeductions('ded100PerWithoutQual', 3, 2, amt5BBC, amt5Ea);
		calcTotal80GDeductions('ded50WithoutQual', 3, 2, amt5BBC, amt5Ea);
		calcTotal80GDeductions('ded100Qual', 3, 2, amt5BBC, amt5Ea);
		calcTotal80GDeductions('ded50WithQual', 3, 2, amt5BBC, amt5Ea);
		caclDedSchVIA();
	//	enableGrossAmtTDS2();
		enableGrossAmtTDS1();
		//calcScheduleSI();
		calcTotalAmt('schEIMinorChild');
		calculateNetAgricultureIncomeforEI();
		calTotalEI();
		calcTotSchTradingRev();
		calcTaxPayableMAT();
		calcScheduleFSI();
		setPartAGen2CountryOfResidence();
		setPartAGen2ForiegnUltimate();
		calculatePartBTI_second();
		calcTotalDDTP('scheduleDDTP');
		calcDDTTotalTaxPay('scheduleDDT');
		calcTotalBBTP('scheduleBBTP');
		calcBBTTotalTaxPay('scheduleBBT');
		calculateTiTti(cgosIncome);
		disableMatCOn115();
		calcTotScheduleMATC('scheduleMATC');
		calculatePartBTTI_second(cgosIncome);
		populateMATC();
		disableMatCOn115();
		calculateTotalTaxIT('scheduleIt');
		calculateTCS();
		disableIntFinSerCntr();
		enableTable(
				'scheduleCGPost45.shortTermCapGainPost45.unutilizedCapgainFlag',
				'Y', 'scheduleStcgunUtilizedCapGain54');
		enableTable(
				'scheduleCGPost45.LongTermCapGainPost45.unutilizedCapgainFlag',
				'Y', 'scheduleLtcgunUtilizedCapGain54');
		calcTotalICDS();
		surchargeEditable();
		onChg115ba();
		validateTDS19Grtthen67();
		validateTDS29Grtthen67();
		calculateTotal80G();
		validateOsBbdaLottery();
		calcTotSchTradingExp();
		calculateManTrading();
		validate80GGA();
		calculatedon80GGA();
		calculatedon80GGATotalCash();
		calculatedon80GGAEligible();
		calculate80GGAEligAmt();
		calcTotal80GGA();
		// caclDedSchVIA();
		// scheduleSI115BEditable();
		calculateSchRA();
		calculateTotalDeductions();
		enable115AdP();
		disabledpit();
		dpitOnchangeForSHandAL();
	//	tpsaBasedOnOIFlag();
		fynstFlagOnchangeForPLManuTradandBS();
		enableShareTypeOthInSH();
		enableOthInAL();
		onStateChngPLOther();
		enableAL2();
		siDisable11();
		otherauditedSection();
		othergener();
		calcTotSchPL47i();
		calcTotSchPL47ii();
		calcTotSchPLINDAS47i();
		calcTotSchPLINDAS47ii();
		disableSch80();
		calculateScheduleDI();
		validateScheduleCFlXvii();
		schCgA3greyOff();
		disableScheduleFor115AD('Schedule115AD');
	} catch (e) {
		alert('error in calcITR6 =' + e.stack);
	}
}

function calculateTotalDeductions() {

	var tab1 = document.getElementById('schduleCGDedD1B');
	var noOfRows1 = tab1.rows.length;
	var sum1 = 0;
	var amt1 = 0;

	for (var i = 0; i < (noOfRows1 - 2); i++) {
		amt1 = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
						+ i + '].amtDeducted')[0].value;
		sum1 = eval(parseInt(sum1, 10) + parseInt(coalesce(amt1), 10));

	}

	var tab2 = document.getElementById('schduleCGDedD1C');
	var noOfRows2 = tab2.rows.length;
	var sum2 = 0;
	var amt2 = 0;

	for (var i = 0; i < (noOfRows2 - 2); i++) {
		amt2 = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54EC['
						+ i + '].amtDeducted')[0].value;
		sum2 = eval(parseInt(sum2, 10) + parseInt(coalesce(amt2), 10));
	}

/*	var tab3 = document.getElementById('schduleCGDedD1D');
	var noOfRows3 = tab3.rows.length;
	var sum3 = 0;
	var amt3 = 0;

	for (var i = 0; i < (noOfRows3 - 2); i++) {
		amt3 = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtls54EE['
						+ i + '].amtDeducted')[0].value;
		sum3 = eval(parseInt(sum3, 10) + parseInt(coalesce(amt3), 10));
	}*/
	var tab4 = document.getElementById('schduleCGDedD1E');
	var noOfRows4 = tab4.rows.length;
	var sum4 = 0;
	var amt4 = 0;

	for (var i = 0; i < (noOfRows4 - 2); i++) {
		amt4 = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
						+ i + '].amtDeducted')[0].value;
		sum4 = eval(parseInt(sum4, 10) + parseInt(coalesce(amt4), 10));
	}

	var tab5 = document.getElementById('schduleCGDedD1F');
	var noOfRows5 = tab5.rows.length;
	var sum5 = 0;
	var amt5 = 0;

	for (var i = 0; i < (noOfRows5 - 2); i++) {
		amt5 = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
						+ i + '].amtDeducted')[0].value;
		sum5 = eval(parseInt(sum5, 10) + parseInt(coalesce(amt5), 10));
	}

	document
			.getElementsByName('scheduleCGPost45.deducClaimInfo.totDeductClaim')[0].value = eval(parseInt(
			sum1, 10)
			+ parseInt(sum2, 10)
		//	+ parseInt(sum3, 10)
			+ parseInt(sum4, 10)
			+ parseInt(sum5, 10));

}

function populateRateLTCG()

{
	var tab = document.getElementById('scheduleLtcgDtaa');
	var noOfRows = tab.rows.length;
	var residentialSatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	for (var i = 0; i < (noOfRows - 2); i++) {
		var rateAsPerTreaty = parseFloat(coalesce(document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
						+ i + '].rateAsPerTreaty')[0].value));
		var rateAsPerITAct = parseFloat(coalesce(document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
						+ i + '].rateAsPerITAct')[0].value));
		var trcFlag = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
						+ i + '].taxResidCertFlag')[0].value;
		if (residentialSatus != 'NRI') {
			if (rateAsPerTreaty > rateAsPerITAct) {
				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].rateAsPerITAct')[0].value;
			} else {

				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].rateAsPerTreaty')[0].value;
			}
		} else if (residentialSatus == 'NRI' && trcFlag == 'Y') {
			if (rateAsPerTreaty > rateAsPerITAct) {
				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].rateAsPerITAct')[0].value;
			} else {

				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].rateAsPerTreaty')[0].value;
			}
		} else {
			document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
							+ i + '].applicableRate')[0].value = ''
		}
	}

}

function populateRateOS()

{
	var residentialSatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var tab = document.getElementById('scheduleOsNriIncTaxDtaa');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 2); i++) {

		var rateAsPerTreaty = parseFloat(document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].rateOfTax')[0].value);

		var rateAsPerITAct = parseFloat(document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].rateAsPerITAct')[0].value);
		var trcFlag = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].taxResidCertFlag')[0].value;
		if (residentialSatus != 'NRI') {
			if (rateAsPerTreaty > rateAsPerITAct) {
				document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].applicableRate')[0].value = rateAsPerITAct;
			}

			if (rateAsPerITAct > rateAsPerTreaty) {
				document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].applicableRate')[0].value = rateAsPerTreaty;
			}
			if (rateAsPerTreaty == rateAsPerITAct) {
				document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].applicableRate')[0].value = rateAsPerTreaty;
			}
		} else if (residentialSatus == 'NRI' && trcFlag == 'Y') {
			if (rateAsPerTreaty > rateAsPerITAct) {
				document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].applicableRate')[0].value = rateAsPerITAct;
			}

			if (rateAsPerITAct > rateAsPerTreaty) {
				document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].applicableRate')[0].value = rateAsPerTreaty;
			}
			if (rateAsPerTreaty == rateAsPerITAct) {
				document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].applicableRate')[0].value = rateAsPerTreaty;
			}
		} else {
			document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ i + '].applicableRate')[0].value = ''
		}

	}

}
function calcTotFullConTable() {
	var tab = document.getElementById('stcg10pctTab');

	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows / 16); i++) {

		if (parseInt(
				coalesce(document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
								+ i + '].fullConsidtnia')[0].value), 10) > parseInt(
				coalesce(document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
								+ i + '].fullConsidtnib')[0].value), 10)) {
			document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
							+ i + '].fullConsidtnic')[0].value = parseInt(
					coalesce(document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
									+ i + '].fullConsidtnia')[0].value), 10);

		} else {
			document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
							+ i + '].fullConsidtnic')[0].value = parseInt(
					coalesce(document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
									+ i + '].fullConsidtnib')[0].value), 10);

		}

	}
}

function scheduleCGB6a() {

	var tab = document.getElementById('stcg10pctTab');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows / 16); i++) {
		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
						+ i + '].fullConsideration')[0].value = eval(coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
				+ i + '].fullConsidtnii')
				+ coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
						+ i + '].fullConsidtnic'));
	}

}

function validateSchCGSTCGAmt() {
	var tab = document.getElementById('scheduleStcgDtaa');
	var rowCount = tab.rows.length - 2;

	var residentialStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	if (residentialStatus == 'NRI') {
		var totalAmtNotTaxUsDTAAStcgSumNri = 0;
		var totAmtStcgUnderDtaaSumNri = 0;
		for (var i = 0; i < rowCount; i++) {
			if (document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ i + '].taxResidCertFlag')[0].value == 'Y'
					&& (document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
									+ i + '].applicableRate')[0].value == '' || document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
									+ i + '].applicableRate')[0].value == 0)) {
				totalAmtNotTaxUsDTAAStcgSumNri = parseInt(
						coalesce(totalAmtNotTaxUsDTAAStcgSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
												+ i + '].amount')[0].value), 10);
			}
			if (document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ i + '].taxResidCertFlag')[0].value == 'Y'
					&& (document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
									+ i + '].applicableRate')[0].value != '' && document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
									+ i + '].applicableRate')[0].value != 0)) {
				totAmtStcgUnderDtaaSumNri = parseInt(
						coalesce(totAmtStcgUnderDtaaSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
												+ i + '].amount')[0].value), 10);
			}
		}

		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa.totAmtTaxChrgUsDTAAStcg')[0].value = totalAmtNotTaxUsDTAAStcgSumNri;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa.totalAmtTaxUsDTAAStcg')[0].value = totAmtStcgUnderDtaaSumNri;
	} else if (residentialStatus != 'NRI') {
		var totalAmtNotTaxUsDTAAStcgSumNri = 0;
		var totAmtStcgUnderDtaaSumNri = 0;
		for (var i = 0; i < rowCount; i++) {
			if (document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ i + '].applicableRate')[0].value == ''
					|| document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
									+ i + '].applicableRate')[0].value == 0) {
				totalAmtNotTaxUsDTAAStcgSumNri = parseInt(
						coalesce(totalAmtNotTaxUsDTAAStcgSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
												+ i + '].amount')[0].value), 10);

			}
			if (document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ i + '].applicableRate')[0].value != ''
					&& document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
									+ i + '].applicableRate')[0].value != 0) {
				totAmtStcgUnderDtaaSumNri = parseInt(
						coalesce(totAmtStcgUnderDtaaSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
												+ i + '].amount')[0].value), 10);
			}
		}
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa.totAmtTaxChrgUsDTAAStcg')[0].value = totalAmtNotTaxUsDTAAStcgSumNri;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa.totalAmtTaxUsDTAAStcg')[0].value = totAmtStcgUnderDtaaSumNri;
	}
}

function validateSchCGLTCGAmt() {
	var tab = document.getElementById('scheduleLtcgDtaa');
	var rowCount = tab.rows.length - 2;

	var residentialStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	if (residentialStatus == 'NRI') {
		var totalAmtNotTaxUsDTAALtcgSumNri = 0;
		var totAmtLtcgUnderDtaaSumNri = 0;
		for (var i = 0; i < rowCount; i++) {
			if (document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
							+ i + '].taxResidCertFlag')[0].value == 'Y'
					&& (document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
									+ i + '].applicableRate')[0].value == '' || document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
									+ i + '].applicableRate')[0].value == 0)) {
				totalAmtNotTaxUsDTAALtcgSumNri = parseInt(
						coalesce(totalAmtNotTaxUsDTAALtcgSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
												+ i + '].amount')[0].value), 10);
			}
			if (document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
							+ i + '].taxResidCertFlag')[0].value == 'Y'
					&& (document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
									+ i + '].applicableRate')[0].value != '' && document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
									+ i + '].applicableRate')[0].value != 0)) {
				totAmtLtcgUnderDtaaSumNri = parseInt(
						coalesce(totAmtLtcgUnderDtaaSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
												+ i + '].amount')[0].value), 10);
			}
		}

		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa.totAmtLtcgUnderDtaa')[0].value = totalAmtNotTaxUsDTAALtcgSumNri;
		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa.totalAmtNotTaxUsDTAALtcg')[0].value = totAmtLtcgUnderDtaaSumNri;
	} else if (residentialStatus != 'NRI') {
		var totalAmtNotTaxUsDTAALtcgSumNri = 0;
		var totAmtLtcgUnderDtaaSumNri = 0;
		for (var i = 0; i < rowCount; i++) {
			if (document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
							+ i + '].applicableRate')[0].value == ''
					|| document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
									+ i + '].applicableRate')[0].value == 0) {
				totalAmtNotTaxUsDTAALtcgSumNri = parseInt(
						coalesce(totalAmtNotTaxUsDTAALtcgSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
												+ i + '].amount')[0].value), 10);

			}
			if (document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
							+ i + '].applicableRate')[0].value != ''
					&& document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
									+ i + '].applicableRate')[0].value != 0) {
				totAmtLtcgUnderDtaaSumNri = parseInt(
						coalesce(totAmtLtcgUnderDtaaSumNri), 10)
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
												+ i + '].amount')[0].value), 10);
			}
		}
		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa.totAmtLtcgUnderDtaa')[0].value = totalAmtNotTaxUsDTAALtcgSumNri;
		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa.totalAmtNotTaxUsDTAALtcg')[0].value = totAmtLtcgUnderDtaaSumNri;
	}
}
function populateRateSTCG()

{
	var tab = document.getElementById('scheduleStcgDtaa');
	var noOfRows = tab.rows.length;
	var residentialSatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	for (var i = 0; i < (noOfRows - 2); i++) {

		var rateAsPerTreaty = parseFloat(coalesce(document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
						+ i + '].rateAsPerTreaty')[0].value));

		var rateAsPerITAct = parseFloat(coalesce(document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
						+ i + '].rateAsPerITAct')[0].value));

		var trcFlag = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
						+ i + '].taxResidCertFlag')[0].value;
		if (residentialSatus != 'NRI') {
			if (rateAsPerTreaty > rateAsPerITAct) {
				document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].rateAsPerITAct')[0].value;

			} else {

				document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].rateAsPerTreaty')[0].value;
			}
		} else if (residentialSatus == 'NRI' && trcFlag == 'Y') {

			if (rateAsPerTreaty > rateAsPerITAct) {
				document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].rateAsPerITAct')[0].value;



			} else {

				document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].applicableRate')[0].value = document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].rateAsPerTreaty')[0].value;

			

			}
		} else {
			document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ i + '].applicableRate')[0].value = ''
		}

	}

}

function calcTotFullConA(a, b, c) {

	var afield = document.getElementsByName(a)[0];
	var bfield = document.getElementsByName(b)[0];
	var cfield = document.getElementsByName(c)[0];

	if (parseInt(coalesce(afield.value), 10) > parseInt(coalesce(bfield.value),
			10)) {
		cfield.value = parseInt(coalesce(afield.value), 10);
	} else {
		cfield.value = parseInt(coalesce(bfield.value), 10);
	}

}

function genWarningMsgForNRI() {
	var resStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var bankDtlsFlg = document.getElementsByName('itr.scheduleBA.bankDtlsFlag')[0].value;

	if (resStatus == 'NRI' && bankDtlsFlg == 'N') {
		addErrorXHTML(
				'',
				'Currently refund will be credited to a bank account located in India and not to a bank account located in a foreign country.');
		j.setFieldError(
						'itr.scheduleBA.bankDtlsFlag',
						'Currently refund will be credited to a bank account located in India and not to a bank account located in a foreign country.');
	}
}

function initCgOsInc(cgosIncome) {
	cgosIncome.cgInc = {};
	cgosIncome.osInc = {};
	cgosIncome.cgInc.stcg = {};
	cgosIncome.cgInc.ltcg = {};
	cgosIncome.cgInc.ltcg.prctg10 = {};
	cgosIncome.cgInc.ltcg.prctg20 = {};
	cgosIncome.cgInc.stcg.prctg30 = {};
	cgosIncome.cgInc.stcg.prctgAr = {};
	cgosIncome.cgInc.stcg.prctg15 = {};
	cgosIncome.cgInc.stcg.prctg30.sec115AD = 0;
	cgosIncome.cgInc.stcg.prctg30.secPti = 0;
	cgosIncome.cgInc.stcg.prctgAr.stcgApp = 0;
	cgosIncome.cgInc.stcg.prctgAr.secPti = 0;
	cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii = 0;
	cgosIncome.cgInc.stcg.prctg15.secPti = 0;
	cgosIncome.cgInc.stcg.prctg15.sec111a = 0;
	cgosIncome.cgInc.ltcg.prctg20.sec112 = 0;
	cgosIncome.cgInc.ltcg.prctg20.sec11EA = 0; // Not active
	cgosIncome.cgInc.ltcg.prctg20.secPti = 0;
	cgosIncome.cgInc.ltcg.prctg10.secPti = 0;
	cgosIncome.cgInc.ltcg.prctg10.secPti112A = 0;//2020
	cgosIncome.cgInc.ltcg.prctg10.sec112A = 0;
	cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP = 0;
	cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2 = 0; // B6 of CG
	cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B = 0; // B6 of CG new
	cgosIncome.cgInc.ltcg.prctg10.sec115AC_1 = 0; // B6 of CG
	cgosIncome.cgInc.ltcg.prctg10.sec115AD_3 = 0; // B6 of CG
	cgosIncome.cgInc.ltcg.prctg10.secProviso = 0; // B4c + B5d CG
	cgosIncome.cgInc.ltcg.prctg10.sec115ACA_1 = 0; // Not active
	cgosIncome.cgInc.ltcg.prctg10.sec115E_b = 0; // Not active
	// 2019 changes
	cgosIncome.cgInc.ltcg.prctg10.sec112A = 0;
	cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP = 0;

	cgosIncome.osInc.sec115A_1_a_i = 0;
	cgosIncome.osInc.sec115A_1_a_ii = 0;
	cgosIncome.osInc.sec115A_1_a_iia = 0;
	cgosIncome.osInc.sec115A_1_a_iiaa = 0;
	cgosIncome.osInc.sec115A_1_a_iiab = 0;
	cgosIncome.osInc.sec115A_1_a_iii = 0;
	cgosIncome.osInc.sec115A_1_b_A = 0;
	cgosIncome.osInc.sec115A_1_b_B = 0;
	cgosIncome.osInc.sec115AC_1_a_b = 0;
	cgosIncome.osInc.sec115ACA_1_a = 0;
	cgosIncome.osInc.sec115AD_1_i = 0;
	cgosIncome.osInc.sec115BBA = 0;
	cgosIncome.osInc.sec115BBDA = 0;
	cgosIncome.osInc.sec115BBC = 0;
	cgosIncome.osInc.sec115BBE = 0;
	cgosIncome.osInc.sec115BBF = 0;
	cgosIncome.osInc.sec115BBG = 0;
	cgosIncome.osInc.sec115BB = 0;
	cgosIncome.osInc.sec115E_a = 0;
	cgosIncome.osInc.sec111 = 0;
	cgosIncome.bpNetInc = 0;
}

function initMapForSI(cgosIncome) {
	var simap = {
		"PTI_LTCG20P" : cgosIncome.cgInc.ltcg.prctg20.secPti,
		"5AC1c" : cgosIncome.cgInc.ltcg.prctg10.sec115AC_1,
		"5ACA1b" : cgosIncome.cgInc.ltcg.prctg10.sec115ACA_1,
		"5ADiii" : cgosIncome.cgInc.ltcg.prctg10.sec115AD_3,
		"5ADiiiP" : cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP,
		"5Eb" : cgosIncome.cgInc.ltcg.prctg10.sec115E_b,
		"PTI_LTCG10P" : cgosIncome.cgInc.ltcg.prctg10.secPti,
		"PTI_LTCG10P112A" : cgosIncome.cgInc.ltcg.prctg10.secPti112A,
		"5AD1biip" : cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii,
		"1A" : cgosIncome.cgInc.stcg.prctg15.sec111a,
		"5AB1b" : cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B,
		"PTI_STCG15P" : cgosIncome.cgInc.stcg.prctg15.secPti,
		"PTI_STCG30P" : cgosIncome.cgInc.stcg.prctg30.secPti,
		"2A" : cgosIncome.cgInc.ltcg.prctg10.sec112A

	};
	return simap;
}
function updateMapForSI(cgosIncome, simap) {
	simap["PTI_LTCG20P"] = cgosIncome.cgInc.ltcg.prctg20.secPti;
	simap["5AC1c"] = cgosIncome.cgInc.ltcg.prctg10.sec115AC_1;
	simap["5ACA1b"] = cgosIncome.cgInc.ltcg.prctg10.sec115ACA_1;
	simap["5AB1b"] = cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B;
	simap["5ADiii"] = cgosIncome.cgInc.ltcg.prctg10.sec115AD_3;
	simap["5ADiiiP"] = cgosIncome.cgInc.stcg.prctg15.sec115ADiiiP;
	simap["5Eb"] = cgosIncome.cgInc.ltcg.prctg10.sec115E_b;
	simap["PTI_LTCG10P"] = cgosIncome.cgInc.ltcg.prctg10.secPti;
	simap["PTI_LTCG10P112A"] = cgosIncome.cgInc.ltcg.prctg10.secPti112A;
	simap["5AD1biip"] = cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii;
	simap["1A"] = cgosIncome.cgInc.stcg.prctg15.sec111a;
	simap["PTI_STCG15P"] = cgosIncome.cgInc.stcg.prctg15.secPti;
	simap["PTI_STCG30P"] = cgosIncome.cgInc.stcg.prctg30.secPti;
	simap["2A"] = cgosIncome.cgInc.stcg.prctg15.sec112A;

}

function calPartABalSheetIndAs() {
	var authorised = coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.equityShareCapital.authorised');
	var totShareCapital = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.equity.equityShareCapital.totShareCapital')[0];
	var totalOtherResrv = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.totalOtherResrv')[0];
	var totResrNRetEar = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.totResrNRetEar')[0];
	var totalEquity = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.totalEquity')[0];
	var totalLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.bondsDebentures.total')[0];
	var total1 = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.termLoans.rupeeLoans.total')[0];
	var totalTermLoans = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.termLoans.totalTermLoans')[0];
	var totalLTBorrowings = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.totalLTBorrowings')[0];
	var totalProvisions = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.provisions.totalProvisions')[0];
	var totalOthNonCurrLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.otherNonCurLiabilites.totalOthNonCurrLiab')[0];
	var totalNonCurrLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.totalNonCurrLiab')[0];
	var totLoansRepaybleOnDemand = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.loansRepaybleOnDemand.totLoansRepaybleOnDemand')[0];
	var totalBorrowings = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.totalBorrowings')[0];
	var totOthFinancialLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.totOthFinancialLiab')[0];
	var tottalFinancialLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.tottalFinancialLiab')[0];
	var totalOthCurrLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.totalOthCurrLiab')[0];
	var totalProvosions = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.currentLiabilities.provosions.totalProvosions')[0];
	var totalCurrentLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.totalCurrentLiab')[0];
	var totalEquityLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.totalEquityLiab')[0];

	var netBlock = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.netBlock')[0];
	var invstPropNetBlock = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.invstPropNetBlock')[0];
	var goodWlNetBlock = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.goodWlNetBlock')[0];
	var othIntAstNetBlock = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.othIntAstNetBlock')[0];
	var bioAstNetBlock = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.bioAstNetBlock')[0];
	var total = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.total')[0];
	var totalNonCurrentInvst = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.totalNonCurrentInvst')[0];
	var totalTradeReceivbls = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.tradeReceivables.totalTradeReceivbls')[0];
	var totalLoans = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.loans.totalLoans')[0];
	var totalOthFinancialAsst = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherFinacialAssets.totalOthFinancialAsst')[0];
	var totalNonCurrAsst = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherNonCurrentAssets.totalNonCurrAsst')[0];
	var totalNonCurrntAsst = document
			.getElementsByName('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.totalNonCurrntAsst')[0];
	var totalInventories = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.inventories.totalInventories')[0];
	var totalinvestments = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.investments.total')[0];
	var totalCurrentInvst = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.investments.totalCurrentInvst')[0];
	var totalTradeReceivbls1 = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.tradeReceivables.totalTradeReceivbls')[0];
	var totalCashEquivalents = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.totalCashEquivalents')[0];
	var totalLoans1 = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.loans.totalLoans')[0];
	var totalFinancialAsst = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.totalFinancialAsst')[0];

	var totalOthCurAsset = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.otherCurrentAssets.total')[0];

	var totalCurrAsst = document
			.getElementsByName('partaBsIndAS.assets.currentAssets.financialAssets.otherCurrentAssets.totalCurrAsst')[0];
	var totalAssets = document.getElementsByName('partaBsIndAS.totalAssets')[0];

	// Total (Aii + Aiii)
	totShareCapital.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.equityShareCapital.issuedSubsPaidUp')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.equityShareCapital.subscribedNotFullyPaid'));
	if (totShareCapital.value > authorised) {
		addError(
				'',
				'Please recheck because in your case Issued Capital is more than Authorised Capital.',
				true);
	}
	// Total other reserves (ia + ib + ic + id)
	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.otherResrvDtls',
			'othersAmount', 'otherResrvDtls',
			'partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.othersTotal');

	totalOtherResrv.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.capRedempResr')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.debunRedResr')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.shareOptOSAmount')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.othersTotal'));

	// Total (Bie + ii) (Debit balance to be shown as ?ve figure)
	totResrNRetEar.value = eval(coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.totalOtherResrv')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.retainedEarngs'));
	// Total Equity (Aiv + Biii)
	totalEquity.value = (coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.equityShareCapital.totShareCapital') + coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.totResrNRetEar'));

	totalLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.bondsDebentures.foreignCurrency')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.bondsDebentures.rupee'));

	total1.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.termLoans.rupeeLoans.fromBanks')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.termLoans.rupeeLoans.fromOthers'));

	totalTermLoans.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.termLoans.foreignCurrency')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.termLoans.rupeeLoans.total'));

	totalLTBorrowings.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.bondsDebentures.total')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.termLoans.totalTermLoans')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.deferredPymtLiabilities')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.deposits')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.loansReltdParties')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.longTermMaturities')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.liabilityComp')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.otherLoans'));

	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.provisions.othersProvisions',
			'othersAmount',
			'othersProvisions1',
			'partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.provisions.othersTotal');
	totalProvisions.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.provisions.provEmpBenefits')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.provisions.othersTotal'));

	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.otherNonCurLiabilites.othersNonCurrLiab',
			'othersAmount',
			'othersNonCurrLiab',
			'partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.otherNonCurLiabilites.othersTotal');
	totalOthNonCurrLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.otherNonCurLiabilites.advances')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.otherNonCurLiabilites.othersTotal'));

	// Total Non-Current Liabilities (Ii + Ij + Ik + IIC + III + IVc)
	totalNonCurrLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.totalLTBorrowings')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.tradePayables')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.financialLiabilities.otherFinancialLiab')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.provisions.totalProvisions')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.defrdTaxCurrLiabilites')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.otherNonCurLiabilites.totalOthNonCurrLiab'));

	totLoansRepaybleOnDemand.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.loansRepaybleOnDemand.fromBanks')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.loansRepaybleOnDemand.frmOtherParties'));
	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.brwngOtherLoans',
			'othersAmount',
			'brwngOtherLoans',
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.othersTotal');

	totalBorrowings.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.loansRepaybleOnDemand.totLoansRepaybleOnDemand')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.loansFrmRelatedParties')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.deposits')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.othersTotal'));

	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.othPayables',
			'othersAmount',
			'othPayables',
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.othersTotal');
	// Total Other financial liabilities (a + b +c +d +e +f +g+ h)
	totOthFinancialLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.currMatOnLTDebt')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.currMatFinanceOblg')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.accrInterest')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.unpaidDividend')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.appMonyRecvdAllotSecurities')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.unpaidMatDeposits')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.unpaidMatureDebenture')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.othersTotal'));
	// Total Financial Liabilities (Ii + Iii + Iiii)
	tottalFinancialLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.totalBorrowings')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.financialLiabBorrowings.tradePayables')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.othFinancialLiabilities.totOthFinancialLiab'));

	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.otherAdvance',
			'othersAmount',
			'otherAdvance',
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.othersAdvTotal');
	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.others',
			'othersAmount',
			'others',
			'partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.othersTotal');
	totalOthCurrLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.revenueRecvdAdvance')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.othersAdvTotal')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.othersTotal'));
	calculateTotalInTable(
			'partaBsIndAS.equityAndLiablities.currentLiabilities.provosions.othersProvisions',
			'othersAmount', 'othersProvisions',
			'partaBsIndAS.equityAndLiablities.currentLiabilities.provosions.othersTotal');

	totalProvosions.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.currentLiabilities.provosions.provosionEmpBenft')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.currentLiabilities.provosions.othersTotal'));
	// Total Current liabilities (Iiv + IId + IIIc+ IV)
	totalCurrentLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.tottalFinancialLiab')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.otherCuurLiabilities.totalOthCurrLiab')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.currentLiabilities.provosions.totalProvosions')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.currTaxLiabilities'));
	// Total Equity and liabilities (1C + 2A +2B)
	totalEquityLiab.value = zeroOrMore(coalesceSetRet('partaBsIndAS.equityAndLiablities.equity.otherEquityReserv.totalEquity')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.nonCurrLiabilities.totalNonCurrLiab')
			+ coalesceSetRet('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.totalCurrentLiab'));

	// II ASSETS
	// Net block (a ? b - c)

	netBlock.value = zeroOrMore(eval(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.grossBlock')
			- (coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.depreciation') + coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.impairmentLosses'))));

	// Net block (a ? b - c)
	invstPropNetBlock.value = zeroOrMore(eval(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.invstPropGrossBlock')
			- (coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.invstPropDepreciation') + coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.invstPropImprLosses'))));

	// Net block (a ? b)
	goodWlNetBlock.value = zeroOrMore(eval(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.goodWlGrossBlock')
			- (coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.goodWlImprLosses'))));
	// Net block (a ? b - c)

	othIntAstNetBlock.value = zeroOrMore(eval(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.othIntAstGrossBlock')
			- (coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.othIntAstAmortisation') + coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.othIntAstImprLosses'))));
	// Net block (a ? b)

	bioAstNetBlock.value = zeroOrMore(eval(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.bioAstGrossBlock')
			- (coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.bioAstImprLosses'))));
	// Total (ia + ib)
	total.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.listedEquities')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.unListedEquities'));
	calculateTotalInTable(
			'partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.otherInvestment',
			'othersAmount',
			'otherInvestment',
			'partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.othersTotal');

	// Total non-current investments (ic + ii + iii + iv + v + vi + vii)
	totalNonCurrentInvst.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.total')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.invstPrfShares')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.invstGovtTrust')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.invstInDebenture')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.invstInMutualFunds')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.invstInPartnershpFirm')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.othersTotal'));
	// Total Trade receivables
	totalTradeReceivbls.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.financialAssets.tradeReceivables.securedConsGoods')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.tradeReceivables.unSecuredConsGoods')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.tradeReceivables.doubtful'));

	calculateTotalInTable(
			'partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.loans.otherLoans',
			'othersAmount',
			'otherLoans',
			'partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.loans.othersTotal');

	totalLoans.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.loans.securityDepsts')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.loans.loansRltdParties')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.loans.othersTotal'));

	totalOthFinancialAsst.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherFinacialAssets.bankDeposits')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherFinacialAssets.otherDeposits'));

	calculateTotalInTable(
			'partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherNonCurrentAssets.advancOthCapital.otherNonCurrAsst',
			'othersAmount',
			'otherNonCurrAsst',
			'partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherNonCurrentAssets.othersTotal');

	totalNonCurrAsst.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherNonCurrentAssets.capitalAdvanc')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherNonCurrentAssets.advancOthCapital')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherNonCurrentAssets.othersTotal'));
	// Total Non-current assets (Ad + B + Cd + Dc + Ed + F + Gc + HI + HII +
	// HIII + HIV + I + J)
	totalNonCurrntAsst.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.netBlock')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.capWrkProg')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.invstPropNetBlock')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.goodWlNetBlock')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.othIntAstNetBlock')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.intAstUndrDevlpmnt')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.bioAstNetBlock')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.investments.totalNonCurrentInvst')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.tradeReceivables.totalTradeReceivbls')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.loans.totalLoans')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherFinacialAssets.totalOthFinancialAsst')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherFinacialAssets.defrdTaxAsst')
			+ coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.otherNonCurrentAssets.totalNonCurrAsst'));

	// Total Inventories (i + ii + iii + iv + v + vi + vii)

	totalInventories.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.rawMaterials')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.workInProgress')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.finishedGoods')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.stockInTrade')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.storesSpares')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.looseTools')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.others'));
	// Total (ia + ib)
	totalinvestments.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.listedEquities')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.unListedEquities'));

	// Total Current investments (ic + ii +iii + iv + v + vi + vii)

	totalCurrentInvst.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.total')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.invstPrfShares')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.invstGovtTrust')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.invstInDebenture')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.invstInMutualFunds')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.invstInPartnershpFirm')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.otherInvestment'));
	// Total Trade receivables (i + ii + iii)
	totalTradeReceivbls1.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.tradeReceivables.securedConsGoods')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.tradeReceivables.unSecuredConsGoods')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.tradeReceivables.doubtful'));

	calculateTotalInTable(
			'partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.otherCashDtls',
			'othersAmount', 'otherCashDtls',
			'partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.othersTotal');

	// Total Cash and cash equivalents (i + ii+ iii + iv)

	totalCashEquivalents.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.balancesWithBanks')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.chequeDraftsInHand')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.cashOnHand')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.othersTotal'));

	calculateTotalInTable(
			'partaBsIndAS.assets.currentAssets.financialAssets.loans.otherLoans',
			'othersAmount', 'otherLoans1',
			'partaBsIndAS.assets.currentAssets.financialAssets.loans.othersTotal');

	// Total loans (i + ii + iii)
	totalLoans1.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.loans.securityDepsts')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.loans.loansRltdParties')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.loans.othersTotal'));
	// Total Financial Assets (I + II + III +IV + V + VI)
	totalFinancialAsst.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.investments.totalCurrentInvst')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.tradeReceivables.totalTradeReceivbls')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.totalCashEquivalents')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.cashEquivalents.bankBalanceOther')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.loans.totalLoans')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.otherFinancialAsst'));
	calculateTotalInTable(
			'partaBsIndAS.assets.currentAssets.financialAssets.othersCurrentAssts',
			'othersAmount',
			'othersCurrentAssts',
			'partaBsIndAS.assets.currentAssets.financialAssets.otherCurrentAssets.othersTotal');
	// Total
	totalOthCurAsset.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.otherCurrentAssets.advancOthCapital')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.otherCurrentAssets.othersTotal'));

	// Total Current assets (2A + 2B + 2C +2D)
	totalCurrAsst.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.currentAssets.inventories.totalInventories')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.totalFinancialAsst')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.currentTaxAsst')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.otherCurrentAssets.total'));

	// Total Assets (1 + 2)

	totalAssets.value = zeroOrMore(coalesceSetRet('partaBsIndAS.assets.nonCurrAssets.propertyPlantEquip.financialAssets.totalNonCurrntAsst')
			+ coalesceSetRet('partaBsIndAS.assets.currentAssets.financialAssets.otherCurrentAssets.totalCurrAsst'));

}

function calPartAPLSheetIndAs() {
	calculateManTradingIndAs();

	calculateTotalInTable('PartaPLIndAS.creditsToPL.othIncome.otherIncDtls',
			'amount', 'otherIncDtls',
			'PartaPLIndAS.creditsToPL.othIncome.miscOthIncome');
	calculateTotalInTable(
			'PartaPLIndAS.debitsToPL.debitPlAcnt.otherExpensesDtls', 'amount',
			'otherExpensesDtls',
			'PartaPLIndAS.debitsToPL.debitPlAcnt.otherExpenses');
	calculateTotalInTable(
			'PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.otherIncDtls',
			'amount', 'otherIncDtls1',
			'PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.othersTotal');
	calculateTotalInTable(
			'PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.otherIncDtls',
			'amount', 'otherIncDtls2',
			'PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.othersTotal');

	var totOthIncome = document
			.getElementsByName('PartaPLIndAS.creditsToPL.othIncome.totOthIncome')[0];
	var totalCreditsPL1314 = document
			.getElementsByName('PartaPLIndAS.creditsToPL.othIncome.totalCreditsPL1314')[0];
	var openingStock = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.openingStockDtls.openingStock')[0];
	var totEmployeeComp = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.totEmployeeComp')[0];
	var totInsurances = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.insurances.totInsurances')[0];
	var totalcommission = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.commissionExpdrDtls.total')[0];
	var totalroyalityDtls = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.royalityDtls.total')[0];
	var totalprofessionalConstDtls = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.professionalConstDtls.total')[0];
	var ratesTaxesPaystotExciseCustomsVAT = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.totExciseCustomsVAT')[0];
	var badDebt = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebt')[0];
	var InterestExpdr = document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.interestExpdrtDtls.InterestExpdr')[0];
	var totalNotPnL = document
			.getElementsByName('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.totalNotPnL')[0];

	// Total of other income (i + ii + iii + iv + v + vi + vii + viii + ix + x +
	// xic)
	totOthIncome.value = eval(coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.interestInc')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.dividends')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.profitOnSaleFixedAsset')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.profitOnInvChrSTT')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.profitOnOthInv')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.rentInc')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.comissions')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.profitOnCurrFluct')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.profitOnConIntoCapitalAsset')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.profitOnAgriIncome')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.miscOthIncome'));

	coalesceSetRet('PartaPLIndAS.creditsToPL.grossPLTrading');
	coalesceSetRet('partatrIndAs.revFromOperations.turnovrIntraday');
	document.getElementsByName('PartaPLIndAS.creditsToPL.grossPLTrading')[0].value = eval(parseInt(
			coalesceSetRet('partatrIndAs.revFromOperations.totalofMnfandTrading'),
			10)
			+ parseInt(
					coalesceSetRet('partatrIndAs.revFromOperations.incomIntraday'),
					10));

	// Total of credits to profit and loss account (13+14xii)
	totalCreditsPL1314.value = eval(coalesceSetRet('PartaPLIndAS.creditsToPL.grossPLTrading')
			+ coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.totOthIncome'));

	// Total compensation to employees (total of 22i to 22x)
	totEmployeeComp.value = zeroOrMore(coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.salsWages')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.bonus')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.medExpReimb')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.leaveEncash')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.leaveTravelBenft')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.contToSuperAnnFund')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.contToPF')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.contToGratFund')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.contToOthFund')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.othEmpBenftExpdr'));

	// Total expenditure on insurance (15i +15ii + 15iii + 15iv)

	totInsurances.value = zeroOrMore(coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.insurances.medInsur')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.insurances.lifeInsur')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.insurances.keyManInsur')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.insurances.othInsur'));

	// Total (i + ii)
	totalcommission.value = zeroOrMore(coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.commissionExpdrDtls.nonResOtherCompany')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.commissionExpdrDtls.others'));
	// Total (i + ii)

	totalroyalityDtls.value = zeroOrMore(coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.royalityDtls.nonResOtherCompany')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.royalityDtls.others'));
	// Total (i + ii)

	totalprofessionalConstDtls.value = zeroOrMore(coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.professionalConstDtls.nonResOtherCompany')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.professionalConstDtls.others'));
	// Total rates and taxes paid or payable(36i + 36ii + 36iii + 36iv + 36v +
	// 36vi + 36vii + 36viii +36ix)

	ratesTaxesPaystotExciseCustomsVAT.value = zeroOrMore(coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.unionExciseDuty')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.serviceTax')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.vATorSaleTax')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.cess')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.centralGoodServiceTax')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.stateGoodServiceTax')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.integratedGoodServiceTax')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.unionTerrGoodServiceTax')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.othDutyTaxCess'));
	// 47(i)

	var table = document.getElementById('badDebtAmtDtls');
	var rowCount = table.rows.length;
	var sumTotal = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal = eval(parseInt(sumTotal, 10)
				+ parseInt(
						coalesce(document
								.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
										+ i + '].amount')[0].value), 10));
	}
	// 47(ii)
	var tablebadDebtPLOthersIndAS = document
			.getElementById('badDebtPLOthersIndAS');
	var rowCountbadDebtPLOthersIndAS = tablebadDebtPLOthersIndAS.rows.length;
	var sumTotalbadDebtPLOthers47 = 0;
	for (var i = 0; i < rowCountbadDebtPLOthersIndAS - 3; i++) {
		sumTotalbadDebtPLOthers47 = eval(parseInt(sumTotalbadDebtPLOthers47, 10)
				+ parseInt(
						coalesce(document
								.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
										+ i + '].amount')[0].value), 10));
	}
	// Total Bad Debt (47i + 47ii + 47iii)
	coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebt');
	document
			.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebt')[0].value = eval(parseInt(
			sumTotal, 10)
			+ parseInt(sumTotalbadDebtPLOthers47, 10)
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.othersAmtLt1Lakh'));

	// 42 Profit before interest, depreciation and taxes [15 – (16 to 21 + 22xi
	// + 23v + 24 to 29 + 30iii + 31iii + 32iii + 33 to 43 + 44x + 45 + 46iii+
	// 47iv + 48 + 49)]
	coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.pBIDTA');
	document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.pBIDTA')[0].value = coalesceSetRet('PartaPLIndAS.creditsToPL.othIncome.totalCreditsPL1314')
			- ( // 4
			coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.freight')
					+ // 8 to 13
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.consumptionOfStores')
					+ // 8 to 13
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.powerFuel')
					+ // 8 to 13
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.rentExpdr')
					+ // 8 to 13
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.repairsBldg')
					+ // 8 to 13
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.repairMach')
					+ // 8 to 13
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.totEmployeeComp')
					+ // 14xi
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.insurances.totInsurances')
					+ // 15v
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.staffWelfareExp')
					+ // 16 to 21
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.entertainment')
					+ // 16 to 21
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.hospitality')
					+ // 16 to 21
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.conference')
					+ // 16 to 21
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.salePromoExp')
					+ // 16 to 21
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.advertisement')
					+ // 16 to 21
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.commissionExpdrDtls.total')
					+ // 22iii
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.royalityDtls.total')
					+ // 23iii
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.professionalConstDtls.total')
					+ // 24iii
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.hotelBoardLodge')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.travelExp')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.foreignTravelExp')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.conveyanceExp')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.telephoneExp')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.guestHouseExp')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.clubExp')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.festivalCelebExp')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.scholarship')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.gift')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.donation')
					+ // 25 to 35
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.totExciseCustomsVAT')
					+ // 36x
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.auditFee')
					+ // 37
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.otherExpenses')
					+ // 38iii(doubt)
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebt')
					+ // 39iv
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.provForBadDoubtDebt') + // 40
			coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.othProvisionsExpdr') // 41
			);

	// 43iii
	InterestExpdr.value = zeroOrMore(coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.interestExpdrtDtls.nonResOtherCompany')
			+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.interestExpdrtDtls.others'));

	// 45 Profit before taxes (42 ? 43iii ? 44)
	coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.pBT');
	document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.pBT')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.pBIDTA'), 10)
			- parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.interestExpdrtDtls.InterestExpdr'),
					10)
			- parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.depreciationAmort'),
					10));
	// 48
	coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.profitAfterTax');
	document
			.getElementsByName('PartaPLIndAS.debitsToPL.taxProvAppr.profitAfterTax')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.pBT'), 10)
			- parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.provForCurrTax'),
					10)
			- parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.provDefTax'),
					10));

	// 50
	coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.amtAvlAppr');
	document
			.getElementsByName('PartaPLIndAS.debitsToPL.taxProvAppr.amtAvlAppr')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.profitAfterTax'),
			10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.balBFPrevYr'),
					10));
	// 51v
	coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.totAppropriations');
	document
			.getElementsByName('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.totAppropriations')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.trfToReserves'),
			10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.proposedDividend'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.taxOnDividend'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.appropriationsCSR'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.anyOtherAppr'),
					10));
	// 52
	coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.partnerAccBalTrf');
	document
			.getElementsByName('PartaPLIndAS.debitsToPL.taxProvAppr.partnerAccBalTrf')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.amtAvlAppr'),
			10)
			- parseInt(
					coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.appropriations.totAppropriations'),
					10));
	// 53A

	coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.totalNotPnL');
	document
			.getElementsByName('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.totalNotPnL')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.changesInSurplus'),
			10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.reMesDefinedBenftPlans'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.equityOCI'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.fairValFVTPl'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.shareOfOtherComprInc'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.othersTotal'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.incomeTaxNotPnL'),
					10));

	// 53B
	coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.totalPnL');
	document
			.getElementsByName('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.totalPnL')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.exchangeDiff'),
			10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.debtsOCI'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.effecPortionGainnLoss'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.shareOCI'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.othersTotal'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.incomeTaxReclsPnL'),
					10));
	// 54 Total Comprehensive Income (48 + 53A +53B)
	coalesceSetRet('PartaPLIndAS.otherComprnsvInc.totalComprIncome');
	document
			.getElementsByName('PartaPLIndAS.otherComprnsvInc.totalComprIncome')[0].value = eval(parseInt(
			coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.profitAfterTax'),
			10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsNotReclsfdPnL.totalNotPnL'),
					10)
			+ parseInt(
					coalesceSetRet('PartaPLIndAS.otherComprnsvInc.itemsReclsfdPnL.totalPnL'),
					10));

	// ii Total presumptive income from goods carriage u/s 44AE [total of column
	// (5) of table at Point 63

	// 2020 removal field....
	/*
	 * var presumtiveInc44AERegIndAs =
	 * document.getElementById('presumtiveInc44AERegIndAs'); var
	 * rowCountpresumtiveInc44AERegIndAs =
	 * presumtiveInc44AERegIndAs.rows.length; var
	 * sumTotalpresumtiveInc44AERegIndAs=0; var sumTotalNoOfMonthsIndAs=0;
	 * for(var i=0;i<rowCountpresumtiveInc44AERegIndAs-2;i++){ var field3 =
	 * parseInt(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg[' +
	 * i + '].capacity')[0].value); var field4 =
	 * parseInt(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg[' +
	 * i + '].noOfMonths')[0].value); var field5 =
	 * parseInt(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg[' +
	 * i + '].income')[0].value);
	 * 
	 * if(field3<=12) {
	 * 
	 * if(field5 < (field4 * 7500)) {
	 * j.setFieldError('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg[' +
	 * i + '].income','If the Income is less than Rs. 7500 per month then It is
	 * mandatory to maintain books of accounts and have a tax audit under 44AB
	 * in Point 63 in Part A P&L IndAS'); addErrorXHTML(
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg[' +
	 * i + '].income')[0], 'If the Income is less than Rs. 7500 per month then
	 * It is mandatory to maintain books of accounts and have a tax audit under
	 * 44AB in Point 63 in Part A P&L IndAS', true); }
	 *  } else { if(field5 < (field3 * field4 * 1000)) {
	 * j.setFieldError('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg[' +
	 * i + '].income','If the Income is lower than Rs. 1000 per metric ton per
	 * month then It is mandatory to maintain books of accounts and have a tax
	 * audit under 44AB in Point 63 in Part A P&L IndAS'); addErrorXHTML(
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg[' +
	 * i + '].income')[0], 'If the Income is lower than Rs. 1000 per metric ton
	 * per month then It is mandatory to maintain books of accounts and have a
	 * tax audit under 44AB in Point 63 in Part A P&L IndAS', true); }
	 *  }
	 * 
	 * sumTotalpresumtiveInc44AERegIndAs =
	 * eval(parseInt(sumTotalpresumtiveInc44AERegIndAs,10) +
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg['+i+'].income')[0].value),10));
	 * sumTotalNoOfMonthsIndAs = eval(parseInt(sumTotalNoOfMonthsIndAs,10) +
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg['+i+'].noOfMonths')[0].value),10)); }
	 * 
	 * var totalPresumptive =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.totalPresumptive')[0];
	 * totalPresumptive.value = coalesce(totalPresumptive.value);
	 * totalPresumptive.value =parseInt(sumTotalpresumtiveInc44AERegIndAs,10) ;
	 * 
	 * 
	 * var totalNoOfMonthsIndAs =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm4')[0];
	 * totalNoOfMonthsIndAs.value = coalesce(totalNoOfMonthsIndAs.value);
	 * totalNoOfMonthsIndAs.value =parseInt(sumTotalNoOfMonthsIndAs,10) ;
	 * 
	 * var totalpresumtiveClm5IndAs =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm5')[0];
	 * totalpresumtiveClm5IndAs.value =
	 * coalesce(totalpresumtiveClm5IndAs.value); totalpresumtiveClm5IndAs.value
	 * =parseInt(sumTotalpresumtiveInc44AERegIndAs,10) ;
	 * if(sumTotalNoOfMonthsIndAs>120) {
	 * 
	 * j.setFieldError('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm4','Total
	 * of no. of months cannot exceed 120 in Point 63 in Part A P&L IndAS');
	 * addErrorXHTML(
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm4')[0],'Total
	 * of no. of months cannot exceed 120 in Point 63 in Part A P&L
	 * IndAS',true); }
	 */
	// IF REGULAR BOOKS OF ACCOUNT OF BUSINESS OR PROFESSION ARE NOT MAINTAINED,
	// furnish the following information for previous year 2018-19 in respect of
	// business or profession – (OTHER THAN COVERED U/S 44AE)
	/*
	 * var grossReceipts64iaBus =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.grossReceipts64ia')[0];
	 * grossReceipts64iaBus.value = coalesce(grossReceipts64iaBus.value);
	 * grossReceipts64iaBus.value= eval(
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.throughCheque')[0].value,10))+
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.anyOtherMode')[0].value,10)));
	 */

	/*
	 * var netProfitBus =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.netProfit')[0];
	 * netProfitBus.value = coalesce(netProfitBus.value); netProfitBus.value=
	 * eval(
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.grossReceipts64ib')[0].value,10))-
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.expenses')[0].value,10)));
	 */

	/*
	 * var grossReceipts64iaProf =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.grossReceipts64ia')[0];
	 * grossReceipts64iaProf.value = coalesce(grossReceipts64iaProf.value);
	 * grossReceipts64iaProf.value= eval(
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.throughCheque')[0].value,10))+
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.anyOtherMode')[0].value,10)));
	 * 
	 * 
	 * var netProfitProf =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.netProfit')[0];
	 * netProfitProf.value = coalesce(netProfitProf.value); netProfitProf.value=
	 * eval(
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.grossReceipts64ib')[0].value,10))-
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.expenses')[0].value,10)));
	 */

	/*
	 * var netProfit64iii =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.netProfit')[0];
	 * netProfit64iii.value = coalesce(netProfit64iii.value);
	 * netProfit64iii.value= eval(
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.netProfit')[0].value,10))+
	 * parseInt(coalesce(document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.netProfit')[0].value,10)));
	 */
	// Gross profit transferred from Trading Account

	calculatePL();
	calcTaxPayableMAT();
	calcSchBPBalFor6();

}

function convertPercentToDecimal(element) {

	var fieldVal = element.value;
	if (fieldVal.indexOf('%') != '-1') {
		fieldVal = fieldVal.substring(0, fieldVal.indexOf('%'));
		fieldVal = Math.round(fieldVal);
		element.value = fieldVal / 100;

	}

}

function calcDDTSurcharge() {

	var table = document.getElementById('scheduleDDT');
	var noOfRows = table.rows.length;

	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

		if (document.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value == 'Y') {

			document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].taxPayOnDividDeclarOrPaid.surcharge')[0].value = Math
					.round(eval(parseInt(
							coalesce(document
									.getElementsByName('scheduleDDT.ddt['
											+ i
											+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value),
							10) * 0.12));

		} else {

			document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].taxPayOnDividDeclarOrPaid.surcharge')[0].value = '';
		}
	}
}

function calcDDTEduCess(i) {

	document.getElementsByName('scheduleDDT.ddt[' + i
			+ '].taxPayOnDividDeclarOrPaid.educationCess')[0].value = Math
			.round(eval((eval(parseInt(
					coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value),
					10)) + eval(parseInt(
					coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].taxPayOnDividDeclarOrPaid.surcharge')[0].value),
					10)))) * 0.04);

}

function calcDDTTotalTaxPay(tableId) {
	var table = document.getElementById(tableId);
	var noOfRows = table.rows.length;
	calcAddLITPayUs115O(tableId);
	calcDDTSurcharge(tableId);
	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

		calcDDTEduCess(i);
		document.getElementsByName('scheduleDDT.ddt[' + i
				+ '].taxPayOnDividDeclarOrPaid.totDDTPayable')[0].value = eval(parseInt(
				coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].taxPayOnDividDeclarOrPaid.surcharge')[0].value),
				10))
				+ eval(parseInt(
						coalesce(document.getElementsByName('scheduleDDT.ddt['
								+ i
								+ '].taxPayOnDividDeclarOrPaid.educationCess')[0].value),
						10))
				+ eval(parseInt(
						coalesce(document
								.getElementsByName('scheduleDDT.ddt['
										+ i
										+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value),
						10));

	}
	calcDDTAddnalInc(tableId);
	calcDDTNetPay(tableId);
}

function calcAddLITPayUs115O(tableId) {
	var table = document.getElementById(tableId);
	var noOfRows = table.rows.length;
	var allInputTags = table.getElementsByTagName('select');
	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {
		coalesceSetRet('scheduleDDT.ddt['+ i + '].intPayUs115P');
		if (allInputTags[i].value != '2(22)(e)') {
			document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].amtAnyDividDeclarOrPaid')[0].value), 10))
					- eval(parseInt(coalesce(document
							.getElementsByName('scheduleDDT.ddt[' + i
									+ '].amtOfRedSection115O1A')[0].value), 10));
			if (document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value < 0) {
				document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value = parseInt(
						'0', 10);
			} else {
				if (checkFirstDateBefore(
						document.getElementsByName('scheduleDDT.ddt[' + i
								+ '].dateOfDeclareDividProfDomesComp')[0].value,
						'30/09/2014')) {
					document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value = Math
							.round(eval(parseInt(
									coalesce(document
											.getElementsByName('scheduleDDT.ddt['
													+ i
													+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value),
									10) * 0.15));
				} else {
					document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value = Math
							.round(eval(parseInt(
									coalesce(document
											.getElementsByName('scheduleDDT.ddt['
													+ i
													+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value),
									10) * 0.176470588235294));
				}
			}
		} else if (allInputTags[i].value == '2(22)(e)') {
			document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].amtAnyDividDeclarOrPaid')[0].value), 10))
					- eval(parseInt(coalesce(document
							.getElementsByName('scheduleDDT.ddt[' + i
									+ '].amtOfRedSection115O1A')[0].value), 10));

			if (document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value < 0) {
				document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value = parseInt(
						'0', 10);

			} else {

				document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value = Math
						.round(eval(parseInt(
								coalesce(document
										.getElementsByName('scheduleDDT.ddt['
												+ i
												+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115O')[0].value),
								10)) * 0.30);
			}
		}

	}
}

function calcDDTAddnalInc(tableId) {

	try {
		var table = document.getElementById(tableId);
		var noOfRows = table.rows.length;
		for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

			document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].addLITPlusIntrestPayable')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].taxPayOnDividDeclarOrPaid.totDDTPayable')[0].value),
					10))
					+ eval(parseInt(coalesce(document
							.getElementsByName('scheduleDDT.ddt[' + i
									+ '].intPayUs115P')[0].value), 10));

		}

		calcDDTNetPay('scheduleDDT');
	} catch (e) {
	}

}

function calcDDTNetPay(tableId) {
	try {
		var table = document.getElementById(tableId);
		var noOfRows = table.rows.length;

		var sum = 0;
		for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

			sum = sum
					+ eval(parseInt(coalesce(document
							.getElementsByName('scheduleDDT.ddt[' + i
									+ '].addLITPlusIntrestPayable')[0].value),
							10));

			document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].netPayableOrRefundable')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].addLITPlusIntrestPayable')[0].value), 10))
					- eval(parseInt(coalesce(document
							.getElementsByName('scheduleDDT.ddt[' + i
									+ '].taxAndInterestPaid')[0].value), 10));

			document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].netPayableOrRefundableDisp')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].addLITPlusIntrestPayable')[0].value), 10))
					- eval(parseInt(coalesce(document
							.getElementsByName('scheduleDDT.ddt[' + i
									+ '].taxAndInterestPaid')[0].value), 10));

			addBrackets('scheduleDDT.ddt[' + i + '].netPayableOrRefundableDisp');

			if (document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].netPayableOrRefundable')[0].value > 0
					&& document.getElementsByName('scheduleDDT.ddt[' + i
							+ '].netPayableOrRefundable')[0].value.length > 14) {
				addError(document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].netPayableOrRefundableDisp')[0],
						"Amount should be numeric,no decimal, not exceeding 14 Characters");
				j
						.setFieldError('scheduleDDT.ddt[' + i
								+ '].netPayableOrRefundableDisp',
								'Amount should be numeric,no decimal, not exceeding 14 Characters');
			}
		}
	} catch (e) {
	}

}

function calcTotalDDTP(tableId) {
	try {

		var mainTab = document.getElementById('scheduleDDT');
		var sum = 0;
		var mainTabRows = mainTab.rows.length;

		for (var i = 0; i < eval(parseInt(mainTabRows, 10) - 4); i++) {

			var innerTable = mainTab.rows[i + 3].getElementsByTagName("table")[0].rows.length;

			for (var j = 0; j < eval(parseInt(innerTable, 10) - 2); j++) {

				sum = sum
						+ eval(parseInt(coalesce(document
								.getElementsByName('scheduleDDT.ddt[' + i
										+ '].taxPayOnDividDeclarOrPaid[' + j
										+ '].amt')[0].value), 10));
				document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].totalOfDDT')[0].value = sum;
				document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].taxAndInterestPaid')[0].value = sum;
			}

			sum = 0;
		}

		calcDDTNetPay('scheduleDDT');
	} catch (e) {
		alert('Error in calcTotalDDTP' + e);
	}
}

function calcBBTSurcharge() {

	var table = document.getElementById('scheduleBBT');
	var noOfRows = table.rows.length;

	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {
		if (document.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value == 'Y') {

			document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].taxPayOnDividDeclarOrPaid.surcharge')[0].value = Math
					.round(eval(parseInt(
							coalesce(document
									.getElementsByName('scheduleBBT.bbt['
											+ i
											+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115QA')[0].value),
							10) * 0.12));
		} else {

			document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].taxPayOnDividDeclarOrPaid.surcharge')[0].value = '';
		}
	}

}

function calcBBTEduCess(i) {

	try {
		document.getElementsByName('scheduleBBT.bbt[' + i
				+ '].taxPayOnDividDeclarOrPaid.educationCess')[0].value = Math
				.round(eval((eval(parseInt(
						coalesce(document
								.getElementsByName('scheduleBBT.bbt['
										+ i
										+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115QA')[0].value),
						10)) + eval(parseInt(
						coalesce(document.getElementsByName('scheduleBBT.bbt['
								+ i + '].taxPayOnDividDeclarOrPaid.surcharge')[0].value),
						10)))) * 0.04);

	} catch (e) {
		alert('error calcBBTEduCess:' + e);
	}

}

function calcAddnalIncmSec115QA() {
	try {

		var table = document.getElementById('scheduleBBT');
		var noOfRows = table.rows.length;
		for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {
			document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115QA')[0].value = Math
					.round(eval(parseInt(coalesce(document
							.getElementsByName('scheduleBBT.bbt[' + i
									+ '].cmpDistIncm')[0].value), 10) * 0.20));

			if (document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115QA')[0].value < 0) {
				document.getElementsByName('scheduleBBT.bbt[' + i
						+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115QA')[0].value = parseInt(
						'0', 10);
			}

		}
	} catch (e) {
		alert('error calcAddnalIncmSec115QA:' + e);
	}
}

function calcBBTTotalTaxPay(tableId) {
	var table = document.getElementById(tableId);
	var noOfRows = table.rows.length;

	calcBBTDistInc(tableId);
	calcAddnalIncmSec115QA();
	calcBBTSurcharge();
	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

		calcBBTEduCess(i);

		document.getElementsByName('scheduleBBT.bbt[' + i
				+ '].taxPayOnDividDeclarOrPaid.totDDTPayable')[0].value = eval(parseInt(
				coalesce(document.getElementsByName('scheduleBBT.bbt[' + i
						+ '].taxPayOnDividDeclarOrPaid.surcharge')[0].value),
				10))
				+ eval(parseInt(
						coalesce(document.getElementsByName('scheduleBBT.bbt['
								+ i
								+ '].taxPayOnDividDeclarOrPaid.educationCess')[0].value),
						10))
				+ eval(parseInt(
						coalesce(document
								.getElementsByName('scheduleBBT.bbt['
										+ i
										+ '].taxPayOnDividDeclarOrPaid.addLITPayUs115QA')[0].value),
						10));

	}
	calcBBTAddnalInc(tableId);
	calcBBTNetPay(tableId);

}

function calcBBTAddnalInc(tableId) {

	try {
		var table = document.getElementById(tableId);
		var noOfRows = table.rows.length;

		for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

			document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].addLITPlusIntrestPayable')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleBBT.bbt[' + i
							+ '].taxPayOnDividDeclarOrPaid.totDDTPayable')[0].value),
					10))
					+ eval(parseInt(coalesce(document
							.getElementsByName('scheduleBBT.bbt[' + i
									+ '].intPayUs115QB')[0].value), 10));

		}

		calcBBTNetPay('scheduleBBT');
	} catch (e) {
	}

}
function calcBBTDistInc(tableId) {

	try {
		var table = document.getElementById(tableId);
		var noOfRows = table.rows.length;

		for (var i = 0; i < eval(parseInt(noOfRows, 10)); i++) {

			document
					.getElementsByName('scheduleBBT.bbt[' + i + '].cmpDistIncm')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleBBT.bbt[' + i
							+ '].cmpBuyBckShrAmt')[0].value), 10))
					- eval(parseInt(coalesce(document
							.getElementsByName('scheduleBBT.bbt[' + i
									+ '].cmpRecShrAmt')[0].value), 10));

		}

	} catch (e) {
	}

}

function calcBBTNetPay(tableId) {
	try {
		var table = document.getElementById(tableId);
		var noOfRows = table.rows.length;

		var sum = 0;
		for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

			sum = sum
					+ eval(parseInt(coalesce(document
							.getElementsByName('scheduleBBT.bbt[' + i
									+ '].addLITPlusIntrestPayable')[0].value),
							10));

			document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].netPayableOrRefundable')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleBBT.bbt[' + i
							+ '].addLITPlusIntrestPayable')[0].value), 10))
					- eval(parseInt(coalesce(document
							.getElementsByName('scheduleBBT.bbt[' + i
									+ '].taxAndInterestPaid')[0].value), 10));

			document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].netPayableOrRefundableDisp')[0].value = eval(parseInt(
					coalesce(document.getElementsByName('scheduleBBT.bbt[' + i
							+ '].addLITPlusIntrestPayable')[0].value), 10))
					- eval(parseInt(coalesce(document
							.getElementsByName('scheduleBBT.bbt[' + i
									+ '].taxAndInterestPaid')[0].value), 10));

			addBrackets('scheduleBBT.bbt[' + i + '].netPayableOrRefundableDisp');

			if (document.getElementsByName('scheduleBBT.bbt[' + i
					+ '].netPayableOrRefundable')[0].value > 0
					&& document.getElementsByName('scheduleBBT.bbt[' + i
							+ '].netPayableOrRefundable')[0].value.length > 14) {
				addError(document.getElementsByName('scheduleBBT.bbt[' + i
						+ '].netPayableOrRefundableDisp')[0],
						"Amount should be numeric,no decimal, not exceeding 14 Characters");
				j
						.setFieldError('scheduleBBT.bbt[' + i
								+ '].netPayableOrRefundableDisp',
								'Amount should be numeric,no decimal, not exceeding 14 Characters');
			}
		}
	} catch (e) {
	}

}

function calcTotalBBTP(tableId) {

	try {

		var mainTab = document.getElementById('scheduleBBT');
		var sum = 0;
		var mainTabRows = mainTab.rows.length;
		for (var i = 0; i < eval(parseInt(mainTabRows, 10)); i++) {

			var innerTable = mainTab.rows[i + 3].getElementsByTagName("table")[0].rows.length;

			for (var j = 0; j < eval(parseInt(innerTable, 10) - 2); j++) {
				sum = sum
						+ eval(parseInt(coalesce(document
								.getElementsByName('scheduleBBT.bbt[' + i
										+ '].taxPayOnDividDeclarOrPaid[' + j
										+ '].amt')[0].value), 10));

				document.getElementsByName('scheduleBBT.bbt[' + i
						+ '].totalOfBBT')[0].value = sum;
				document.getElementsByName('scheduleBBT.bbt[' + i
						+ '].taxAndInterestPaid')[0].value = sum;
			}

			sum = 0;
		}

		calcBBTNetPay('scheduleBBT');
	} catch (e) {
	}

}

function calculatePL() {
	try {

		// 1C

		var tableOthIncTableId = document.getElementById('othIncTableId');
		var rowCountOthIncTableId = tableOthIncTableId.rows.length;
		var sumTotalOthIncTableId = 0;
		for (var i = 0; i < rowCountOthIncTableId - 3; i++) {
			sumTotalOthIncTableId = eval(parseInt(sumTotalOthIncTableId, 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('partapl.creditsToPL.othIncome.otherIncDtls['
											+ i + '].amount')[0].value), 10));
		}

		coalesceSetRet('partapl.creditsToPL.othIncome.miscOthIncome');
		document
				.getElementsByName('partapl.creditsToPL.othIncome.miscOthIncome')[0].value = parseInt(
				sumTotalOthIncTableId, 10);

		// Total of other income (i + ii + iii +iv + v + vi + vii + viii + ix +
		// x + xic)
		coalesceSetRet('partapl.creditsToPL.othIncome.totOthIncome');
		document
				.getElementsByName('partapl.creditsToPL.othIncome.totOthIncome')[0].value = eval(parseInt(
				coalesceSetRet('partapl.creditsToPL.othIncome.rentInc'), 10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.comissions'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.dividends'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.interestInc'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.profitOnSaleFixedAsset'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.profitOnInvChrSTT'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.profitOnOthInv'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.profitOnCurrFluct'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.profitOnConIntoCapitalAsset'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.profitOnAgriIncome'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.miscOthIncome'),
						10));

		// 15 Total of credits to profit and loss account (13+14xii)
		coalesceSetRet('partapl.creditsToPL.othIncome.totalCreditsPL1314');
		document
				.getElementsByName('partapl.creditsToPL.othIncome.totalCreditsPL1314')[0].value = eval(parseInt(
				coalesceSetRet('partapl.creditsToPL.grossPLTrading'), 10)
				+ parseInt(
						coalesceSetRet('partapl.creditsToPL.othIncome.totOthIncome'),
						10));

		// 14xi
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.totEmployeeComp');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.employeeComp.totEmployeeComp')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.salsWages'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.bonus'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.medExpReimb'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.leaveEncash'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.leaveTravelBenft'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.contToSuperAnnFund'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.contToPF'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.contToGratFund'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.contToOthFund'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.othEmpBenftExpdr'),
						10));

		// 15e
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.insurances.totInsurances');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.insurances.totInsurances')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.insurances.medInsur'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.insurances.lifeInsur'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.insurances.keyManInsur'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.insurances.othInsur'),
						10));

		// 22iii
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.commissionExpdrDtls.total');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.commissionExpdrDtls.total')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.commissionExpdrDtls.nonResOtherCompany'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.commissionExpdrDtls.others'),
						10));

		// 23iii
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.royalityDtls.total');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.royalityDtls.total')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.royalityDtls.nonResOtherCompany'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.royalityDtls.others'),
						10));

		// 24iii
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.professionalConstDtls.total');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.professionalConstDtls.total')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.professionalConstDtls.nonResOtherCompany'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.professionalConstDtls.others'),
						10));

		// 36f
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.totExciseCustomsVAT');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.totExciseCustomsVAT')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.unionExciseDuty'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.serviceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.vaTorSaleTax'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.cess'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.centralGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.stateGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.integratedGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.unionTerrGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.othDutyTaxCess'),
						10));

		// 38e
		var tableOthExp = document.getElementById('othExpPLTableId');
		var rowCountOthExp = tableOthExp.rows.length;
		var sumTotalOthExp = 0;
		for (var i = 0; i < rowCountOthExp - 3; i++) {
			sumTotalOthExp = eval(parseInt(sumTotalOthExp, 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('partapl.debitsToPL.debitPlAcnt.otherExpensesDtls['
											+ i + '].amount')[0].value), 10));
		}

		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.otherExpenses');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.otherExpenses')[0].value = parseInt(
				sumTotalOthExp, 10);

		// 39vi
		var table = document.getElementById('badDebtPL');
		var rowCount = table.rows.length;
		var sumTotal = 0;
		for (var i = 0; i < rowCount - 2; i++) {
			sumTotal = eval(parseInt(sumTotal, 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
											+ i + '].amount')[0].value), 10));
		}

		var tablebadDebtPLOthers = document.getElementById('badDebtPLOthers');
		var rowCountbadDebtPLOthers = tablebadDebtPLOthers.rows.length;
		var sumTotalbadDebtPLOthers39 = 0;
		for (var i = 0; i < rowCountbadDebtPLOthers - 3; i++) {
			sumTotalbadDebtPLOthers39 = eval(parseInt(
					sumTotalbadDebtPLOthers39, 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
											+ i + '].amount')[0].value), 10));
		}
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebt');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebt')[0].value = eval(parseInt(
				sumTotal, 10)
				+ parseInt(sumTotalbadDebtPLOthers39, 10)
				+ coalesceSetRet('partapl.debitsToPL.debitPlAcnt.badDebtDtls.othersAmtLt1Lakh'));

		// 42
		// 4 -(5iv + 6 + 7viii + 8 to 13 + 14xi + 15v + 16 to 21+ 22iii + 23iii
		// + 24iii + 25 to 35 + 36vi + 37 + 38iii + 39vi + 40 + 41)
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.pbidta');
		document.getElementsByName('partapl.debitsToPL.debitPlAcnt.pbidta')[0].value = (coalesceSetRet('partapl.creditsToPL.othIncome.totalCreditsPL1314') - (coalesceSetRet('partapl.debitsToPL.debitPlAcnt.freight')
				+ // 8 to 13
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.consumptionOfStores')
				+ // 8 to 13
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.powerFuel')
				+ // 8 to 13
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.rentExpdr')
				+ // 8 to 13
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.repairsBldg')
				+ // 8 to 13
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.repairMach')
				+ // 8 to 13
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.employeeComp.totEmployeeComp')
				+ // 14xi
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.insurances.totInsurances')
				+ // 15v or 15e
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.staffWelfareExp')
				+ // 16 to 21
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.entertainment')
				+ // 16 to 21
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.hospitality')
				+ // 16 to 21
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.conference')
				+ // 16 to 21
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.salePromoExp')
				+ // 16 to 21
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.advertisement')
				+ // 16 to 21
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.commissionExpdrDtls.total')
				+ // 22iii
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.royalityDtls.total')
				+ // 23iii
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.professionalConstDtls.total')
				+ // 24iii
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.hotelBoardLodge')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.travelExp')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.foreignTravelExp')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.conveyanceExp')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.telephoneExp')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.guestHouseExp')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.clubExp')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.festivalCelebExp')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.scholarship')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.gift')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.donation')
				+ // 25 to 35
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.ratesTaxesPays.exciseCustomsVAT.totExciseCustomsVAT')
				+ // 36vi or 36f
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.auditFee')
				+ // 37
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.otherExpenses')
				+ // 38e
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebt')
				+ // 39vi
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.provForBadDoubtDebt') + // 40
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.othProvisionsExpdr')) // 41
		);

		// 43
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.interestExpdrtDtls.interestExpdr');
		document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.interestExpdrtDtls.interestExpdr')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.interestExpdrtDtls.nonResOtherCompany'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.interestExpdrtDtls.others'),
						10));

		// 45
		coalesceSetRet('partapl.debitsToPL.debitPlAcnt.pbt');
		document.getElementsByName('partapl.debitsToPL.debitPlAcnt.pbt')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.pbidta'), 10)
				- parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.interestExpdrtDtls.interestExpdr'),
						10)
				- parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.depreciationAmort'),
						10));

		// 48
		coalesceSetRet('partapl.debitsToPL.taxProvAppr.profitAfterTax');
		document
				.getElementsByName('partapl.debitsToPL.taxProvAppr.profitAfterTax')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.pbt'), 10)
				- parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.provForCurrTax'),
						10)
				- parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.provDefTax'),
						10));

		// 50
		coalesceSetRet('partapl.debitsToPL.taxProvAppr.amtAvlAppr');
		document.getElementsByName('partapl.debitsToPL.taxProvAppr.amtAvlAppr')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.taxProvAppr.profitAfterTax'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.balBFPrevYr'),
						10));

		// 51vi
		coalesceSetRet('partapl.debitsToPL.taxProvAppr.appropriations.totAppropriations');
		document
				.getElementsByName('partapl.debitsToPL.taxProvAppr.appropriations.totAppropriations')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.taxProvAppr.appropriations.trfToReserves'),
				10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.appropriations.proposedDividend'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.appropriations.taxOnDividendForEarYr'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.appropriations.appropriationsCSR'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.appropriations.anyOtherAppr'),
						10));

		// 52
		coalesceSetRet('partapl.debitsToPL.taxProvAppr.partnerAccBalTrf');
		document
				.getElementsByName('partapl.debitsToPL.taxProvAppr.partnerAccBalTrf')[0].value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.taxProvAppr.amtAvlAppr'), 10)
				- parseInt(
						coalesceSetRet('partapl.debitsToPL.taxProvAppr.appropriations.totAppropriations'),
						10));
		
		if(document.getElementsByName('scheduleMAT.profAfterTaxPLAcnt')[0].disabled==true){
			document.getElementsByName('scheduleMAT.profAfterTaxPLAcnt')[0].value = eval(parseInt(
					coalesceSetRet('partapl.debitsToPL.taxProvAppr.profitAfterTax'),
					10)
					+ parseInt(
							coalesceSetRet('PartaPLIndAS.debitsToPL.taxProvAppr.profitAfterTax'),
							10));
		}	
			disableMatOn115();


		var presumtiveInc44AEReg = document
				.getElementById('presumtiveInc44AEReg');
		var rowCountpresumtiveInc44AEReg = presumtiveInc44AEReg.rows.length;
		var sumTotalpresumtiveInc44AEReg = 0;
		var sumTotalNoOfMonths = 0;
		for (var i = 0; i < rowCountpresumtiveInc44AEReg - 2; i++) {
			var field3 = parseInt(document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
							+ i + '].capacity')[0].value);
			var field4 = parseInt(document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
							+ i + '].noOfMonths')[0].value);
			var field5 = parseInt(document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
							+ i + '].income')[0].value);

			if (field3 <= 12) {

				if (field5 < (field4 * 7500)) {
					j
							.setFieldError(
									'partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
											+ i + '].income',
									'If the Income is less than Rs. 7500 per month then It is mandatory to maintain books of accounts and have a tax audit under 44AB ');
					addErrorXHTML(
							document
									.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
											+ i + '].income')[0],
							'If the Income is less than Rs. 7500 per month then It is mandatory to maintain books of accounts and have a tax audit under 44AB ',
							true);
				}

			} else {
				if (field5 < (field3 * field4 * 1000)) {
					j
							.setFieldError(
									'partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
											+ i + '].income',
									'If the Income is lower than Rs. 1000 per metric ton per month then It is mandatory to maintain books of accounts and have a tax audit under 44AB ');
					addErrorXHTML(
							document
									.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
											+ i + '].income')[0],
							'If the Income is lower than Rs. 1000 per metric ton per month then It is mandatory to maintain books of accounts and have a tax audit under 44AB ',
							true);
				}

			}

			sumTotalpresumtiveInc44AEReg = eval(parseInt(
					sumTotalpresumtiveInc44AEReg, 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
											+ i + '].income')[0].value), 10));
			sumTotalNoOfMonths = eval(parseInt(sumTotalNoOfMonths, 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg['
											+ i + '].noOfMonths')[0].value), 10));
		}

		var totalPresumptive = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.totalPresumptive')[0];
		totalPresumptive.value = coalesce(totalPresumptive.value);
		totalPresumptive.value = parseInt(sumTotalpresumtiveInc44AEReg, 10);

		var totalNoOfMonths = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm4')[0];
		totalNoOfMonths.value = coalesce(totalNoOfMonths.value);
		totalNoOfMonths.value = parseInt(sumTotalNoOfMonths, 10);

		var totalpresumtiveClm5 = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm5')[0];
		totalpresumtiveClm5.value = coalesce(totalpresumtiveClm5.value);
		totalpresumtiveClm5.value = parseInt(sumTotalpresumtiveInc44AEReg, 10);
		if (sumTotalNoOfMonths > 120) {

			j
					.setFieldError(
							'partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm4',
							'Total of no. of months cannot exceed 120');
			addErrorXHTML(
					document
							.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AEReg.totalOfClm4')[0],
					'Total of no. of months cannot exceed 120', true);
		}

		calcTaxPayableMAT();

	} catch (e) {
		alert('error = ' + e.stack);
	}
}

function deleteRowTablebadDebtPL(tx, ty, tz) {
	deleteRowTable(tx, ty, tz);
	calculatePL();
}

function deleteRowTableOprtRev(tx, ty, tz) {
	deleteRowTable(tx, ty, tz);
	calculatePL();
}

function deleteRowTableOthExp(tx, ty, tz) {
	deleteRowTable(tx, ty, tz);
	calculatePL();
}

function deleteRowTableOthInc(tx, ty, tz) {
	deleteRowTable(tx, ty, tz);
	calculatePL();
}

function calcPartAOI() {
	try {
		// 5f
		coalesceSetRet('partaoi.noCredToPLAmt.totNoCredToPLAmt');
		document.getElementsByName('partaoi.noCredToPLAmt.totNoCredToPLAmt')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.noCredToPLAmt.section28Items'), 10)
				+ parseInt(
						coalesceSetRet('partaoi.noCredToPLAmt.proformaCreditsDue'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.noCredToPLAmt.prevYrEscalClaim'),
						10)
				+ parseInt(coalesceSetRet('partaoi.noCredToPLAmt.othItemInc'),
						10)
				+ parseInt(coalesceSetRet('partaoi.noCredToPLAmt.capReceipt'),
						10));

		// 6p
		coalesceSetRet('partaoi.amtDisallUs36.totAmtDisallUs36');
		document.getElementsByName('partaoi.amtDisallUs36.totAmtDisallUs36')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtDisallUs36.stkInsurPrem'), 10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.empHealthInsurPrem'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.empBonusCommSum'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.intOnBorrCap'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.zeroCoupBondDisc'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.recogPFContribAmt'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.appSuperAnnFundAmt'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.pensionScheme80CCD'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.appGratFundAmt'),
						10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs36.othFundAmt'),
						10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs36.esiAmt'), 10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.badDebtDoubtAmt'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.badDebtDoubtProvn'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.specResrvTranfr'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.famPlanPromoExp'),
						10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs36.securityAmt'),
						10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs36.marketLoss'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.anyOthDisallowance'),
						10));

		// 6qiii
		coalesceSetRet('partaoi.amtDisallUs36.noOfEmployeesEmployed.total');
		document
				.getElementsByName('partaoi.amtDisallUs36.noOfEmployeesEmployed.total')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtDisallUs36.noOfEmployeesEmployed.deployedInIndia'),
				10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs36.noOfEmployeesEmployed.deployedOutSideIndia'),
						10));

		// 7h
		coalesceSetRet('partaoi.amtDisallUs37.totAmtDisallUs37');
		document.getElementsByName('partaoi.amtDisallUs37.totAmtDisallUs37')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtDisallUs37.capitalExp'), 10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs37.personalExp'),
						10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs37.businessExp'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs37.politicPartyExp'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs37.lawVoilatPenalExp'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs37.othPenalFineExp'),
						10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs37.offenceExp'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs37.socialRespCSR'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs37.contigentLiability'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs37.othAmtNotAllowUs37'),
						10));

		// 8f
		coalesceSetRet('partaoi.amtDisallUs40.totAmtDisallUs40');
		document.getElementsByName('partaoi.amtDisallUs40.totAmtDisallUs40')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtDisallUs40.nonCompChapXVIIBAmt'), 10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40.nonCompChapXVIIBAmt40aia'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40.nonCompChapXVIIBAmt40aib'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40.nonCompChapXVIIBAmt40aiii'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40.taxAmtOnProfits'),
						10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs40.wtAmt'), 10)
				+ parseInt(coalesceSetRet('partaoi.amtDisallUs40.royaltyAmt'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40.intSalBonPartner'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40.anyOthDisallowance'),
						10));

		// 9f
		coalesceSetRet('partaoi.amtDisallUs40A.totAmtDisallUs40A');
		document.getElementsByName('partaoi.amtDisallUs40A.totAmtDisallUs40A')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtDisallUs40A.amtPaidUs40A2B'), 10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40A.amtGT20KCash'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40A.provPmtGrat'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40A.contToSetupTrust'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs40A.anyOthDisallowance'),
						10));

		// 10g
		coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.totAmtUs43B');
		document
				.getElementsByName('partaoi.amtDisallUs43BPyNowAll.amtUs43B.totAmtUs43B')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.taxDutyCesAmt'),
				10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.contToEmpPFSFGF'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.empBonusComm'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.intPayaleToFI'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.intPayaleToFISchBank'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.leaveEncashPayable'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisallUs43BPyNowAll.amtUs43B.railwayAsstsPyble'),
						10)

		);

		// 11g
		coalesceSetRet('partaoi.amtDisall43B.amtUs43B.totAmtUs43B');
		document.getElementsByName('partaoi.amtDisall43B.amtUs43B.totAmtUs43B')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtDisall43B.amtUs43B.taxDutyCesAmt'),
				10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisall43B.amtUs43B.contToEmpPFSFGF'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisall43B.amtUs43B.empBonusComm'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisall43B.amtUs43B.intPayaleToFI'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisall43B.amtUs43B.intPayaleToFIda'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisall43B.amtUs43B.intPayaleToFISchBank'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisall43B.amtUs43B.leaveEncashPayable'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtDisall43B.amtUs43B.railwayAsstsPyble'),
						10));

		// 12e
		coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.totExciseCustomsVAT');
		document
				.getElementsByName('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.totExciseCustomsVAT')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.unionExciseDuty'),
				10)
				+ parseInt(
						coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.serviceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.vaTorSaleTax'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.centralGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.stateGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.integratedGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.unionTerrGoodServiceTax'),
						10)
				+ parseInt(
						coalesceSetRet('partaoi.amtExciseCustomsVATOutstanding.exciseCustomsVAT.othDutyTaxCess'),
						10));

		// 13
		coalesceSetRet('partaoi.deemedProfUs33ABs');
		document.getElementsByName('partaoi.deemedProfUs33ABs')[0].value = eval(parseInt(
				coalesceSetRet('partaoi.deemedProfUs33AB'), 10)
				+ parseInt(coalesceSetRet('partaoi.deemedProfUs33ABA'), 10)
				+ parseInt(coalesceSetRet('partaoi.deemedProfUs33AC'), 10));

	} catch (e) {
		alert(e.stack);
	}
}

function calcUD() {
	try {
		var table = document.getElementById('scheduleUD');
		var rowCount = table.rows.length;
		var sumTotal = 0;
		for (var i = 0; i < rowCount - 5; i++) {
			if (document.getElementsByName('itrScheduleUD.scheduleUD[' + i
					+ '].amtBFUD')[0].value != '' ||document.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].amtBFUD3a')[0].value != ''
					|| document.getElementsByName('itrScheduleUD.scheduleUD['
							+ i + '].amtDepCurYr')[0].value != ''
					|| coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].amountBFUA')[0].value) != ''
					|| document.getElementsByName('itrScheduleUD.scheduleUD['
							+ i + '].amountASACYIncome')[0].value != '') {

				document.getElementsByName('itrScheduleUD.scheduleUD[' + i
						+ '].balCFNY')[0].value = eval(parseInt(
						coalesce(document
								.getElementsByName('itrScheduleUD.scheduleUD['
										+ i + '].amtBFUD')[0].value), 10)
						- parseInt(coalesce(document
								.getElementsByName('itrScheduleUD.scheduleUD['
										+ i + '].amtBFUD3a')[0].value), 10)
										- parseInt(coalesce(document
												.getElementsByName('itrScheduleUD.scheduleUD['
														+ i + '].amtDepCurYr')[0].value), 10));

				document.getElementsByName('itrScheduleUD.scheduleUD[' + i
						+ '].balOfAllowance')[0].value = eval(parseInt(
						coalesce(document
								.getElementsByName('itrScheduleUD.scheduleUD['
										+ i + '].amountBFUA')[0].value), 10)
						- parseInt(coalesce(document
								.getElementsByName('itrScheduleUD.scheduleUD['
										+ i + '].amountASACYIncome')[0].value),
								10));

				if (document.getElementsByName('itrScheduleUD.scheduleUD[' + i
						+ '].balCFNY')[0].value < 0) {
					document.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].balCFNY')[0].value = 0;

				}
				if (document.getElementsByName('itrScheduleUD.scheduleUD[' + i
						+ '].balOfAllowance')[0].value < 0) {
					document.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].balOfAllowance')[0].value = 0;

				}

			} else {
				document.getElementsByName('itrScheduleUD.scheduleUD[' + i
						+ '].balCFNY')[0].value = '';
			}
			sumTotal = eval(parseInt(sumTotal, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].balCFNY')[0].value), 10));

		}

		coalesceSetRet('itrScheduleUD.totalBalCFNY');
		calcTotalUD();
	} catch (e) {
		alert(e);
	}
}
function calcTotalUD() {
	try {
		var table = document.getElementById('scheduleUD');
		var rowCount = table.rows.length;
		var totalamtBFUD = 0;
		var totalamtBFUD3a = 0;
		var totalamtDepCurYr = 0;
		var totalbalCFNY = 0;
		var totalamountBFUA = 0;
		var totalamountASACYIncome = 0;
		var totalbalOfAllowance = 0;
		for (var i = 0; i < rowCount - 5; i++) {

			totalamtBFUD = eval(parseInt(totalamtBFUD, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].amtBFUD')[0].value), 10));
			totalamtBFUD3a = eval(parseInt(totalamtBFUD3a, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].amtBFUD3a')[0].value), 10));
			totalamtDepCurYr = eval(parseInt(totalamtDepCurYr, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].amtDepCurYr')[0].value), 10));
			totalbalCFNY = eval(parseInt(totalbalCFNY, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].balCFNY')[0].value), 10));
			totalamountBFUA = eval(parseInt(totalamountBFUA, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].amountBFUA')[0].value), 10));
			totalamountASACYIncome = eval(parseInt(totalamountASACYIncome, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].amountASACYIncome')[0].value), 10));
			totalbalOfAllowance = eval(parseInt(totalbalOfAllowance, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itrScheduleUD.scheduleUD[' + i
									+ '].balOfAllowance')[0].value), 10));

			if ((document.getElementsByName('itrScheduleUD.scheduleUD[' + i
					+ '].amtBFUD')[0].value) < (document
					.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].amtDepCurYr')[0].value)) {
				document.getElementsByName('itrScheduleUD.totalamtDepCurYr')[0].value = 0;
			}
		}

		var CurYrbalCFNY = parseInt(
				coalesce(document
						.getElementsByName('itrScheduleUD.scheduleUD.CurYrbalCFNY')[0].value),
				10);
		var CurYrbalOfAllowance = parseInt(
				coalesce(document
						.getElementsByName('itrScheduleUD.scheduleUD.CurYrbalOfAllowance')[0].value),
				10);

		document.getElementsByName('itrScheduleUD.totalamtBFUD')[0].value = parseInt(
				totalamtBFUD, 10);
		document.getElementsByName('itrScheduleUD.totalamtBFUD3a')[0].value = parseInt(
				totalamtBFUD3a, 10);
		document.getElementsByName('itrScheduleUD.totalamtDepCurYr')[0].value = parseInt(
				totalamtDepCurYr, 10);
		document.getElementsByName('itrScheduleUD.totalBalCFNY')[0].value = parseInt(
				totalbalCFNY, 10)
				+ parseInt(CurYrbalCFNY, 10);
		document.getElementsByName('itrScheduleUD.totalamountBFUA')[0].value = parseInt(
				totalamountBFUA, 10);
		document.getElementsByName('itrScheduleUD.amountASACYIncome')[0].value = parseInt(
				totalamountASACYIncome, 10);
		document.getElementsByName('itrScheduleUD.totalbalOfAllowance')[0].value = parseInt(
				totalbalOfAllowance, 10)
				+ parseInt(CurYrbalOfAllowance, 10);

		if (document.getElementsByName('itrScheduleUD.totalamtBFUD')[0].value < 0) {
			document.getElementsByName('itrScheduleUD.totalamtBFUD')[0].value = 0;
		}
		if (document.getElementsByName('itrScheduleUD.totalamtBFUD3a')[0].value < 0) {
			document.getElementsByName('itrScheduleUD.totalamtBFUD3a')[0].value = 0;
		}
		if (document.getElementsByName('itrScheduleUD.totalamtDepCurYr')[0].value < 0) {
			document.getElementsByName('itrScheduleUD.totalamtDepCurYr')[0].value = 0;
		}
		if (document.getElementsByName('itrScheduleUD.totalBalCFNY')[0].value < 0) {
			document.getElementsByName('itrScheduleUD.totalBalCFNY')[0].value = 0;
		}

		if (document.getElementsByName('itrScheduleUD.totalamountBFUA')[0].value < 0) {
			document.getElementsByName('itrScheduleUD.totalamountBFUA')[0].value = 0;
		}
		if (document.getElementsByName('itrScheduleUD.amountASACYIncome')[0].value < 0) {
			document.getElementsByName('itrScheduleUD.amountASACYIncome')[0].value = 0;
		}
		if (document.getElementsByName('itrScheduleUD.totalbalOfAllowance')[0].value < 0) {
			document.getElementsByName('itrScheduleUD.totalbalOfAllowance')[0].value = 0;
		}
	} catch (e) {
		alert(e.stack);
	}
}

function deleteRowTableScheduleUD(tx, ty, tz) {

	deleteRowTableUD(tx, ty, tz);
	calcUD();
}

function calc10AA() {
	try {
		var table = document.getElementById('taxDed10AAId');
		var rowCount = table.rows.length;
		var sumTotal = 0;
		for (var i = 0; i < rowCount - 4; i++) {
			sumTotal = eval(parseInt(sumTotal, 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('schedule10AA.deductSEZ.dedUs10Detail['
											+ i + '].dedFromUndertaking')[0].value),
							10));
		}
		coalesceSetRet('schedule10AA.deductSEZ.dedUs10Detail.totalDedUs10Sub');
document.getElementsByName('schedule10AA.deductSEZ.dedUs10Detail.totalDedUs10Sub')[0].value = parseInt(coalesce(sumTotal), 10);
document.getElementsByName('scheduleDI.deductionUnd10AA.TotalDedn10AAInvstmntDtls')[0].value = parseInt(coalesce(sumTotal),10);

	} catch (e) {
		alert(e.stack);
	}
}

function addRowToTable10AA(tx, ty, tz) {
	addRowToTable(tx, ty, tz);
	var table = document.getElementById('taxDed10AAId');
	var rowCount = table.rows.length;
	for (var i = 0; i < rowCount - 3; i++) {
		document.getElementsByName('schedule10AA.deductSEZ.dedUs10Detail[' + i
				+ '].dedFromUndertaking')[0].parentNode.previousSibling.previousSibling.previousSibling.previousSibling.innerHTML = 'Undertaking No.'
				+ eval(parseInt(i, 10) + 1);
	}
}

function deleteRowTableTaxDed10AAId(tx, ty, tz) {
	deleteRowTable(tx, ty, tz);
	calc10AA();
	var table = document.getElementById('taxDed10AAId');
	var rowCount = table.rows.length;
	for (var i = 0; i < rowCount - 3; i++) {
		document.getElementsByName('schedule10AA.deductSEZ.dedUs10Detail[' + i
				+ '].dedFromUndertaking')[0].parentNode.previousSibling.previousSibling.previousSibling.previousSibling.innerHTML = 'Undertaking No.'
				+ eval(parseInt(i, 10) + 1);
	}
}

function populatePincode(state, pin) {
	var stateId = document.getElementsByName(state)[0];
	var pinCode = document.getElementsByName(pin)[0];

	if (stateId.value != '99' && stateId.value != '-1') {
		pinCode.value = '';
	} else if (stateId.value == '99') {
		pinCode.value = '999999';
	}
}

function isCoOwned() {

	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);

	for (var i = 0; i < totHp; i++) {

		var tempName = 'scheduleHP.propertyDetails[' + i + '].propCoOwnedFlg';
		var val = document.getElementsByName(tempName)[0].value;
		var assessePercentShareProp = document
				.getElementsByName('scheduleHP.propertyDetails[' + i
						+ '].asseseeShareProperty')[0];
		if (val == 'YES') {
			$('#scheduleHP' + eval(parseInt(i) + 1)).find(':input').prop(
					'disabled', false);
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].coOwners[0].coOwnersSNo')[0].value = 1;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].asseseeShareProperty')[0].value = 100;
		}
	 else {
			$('#scheduleHP' + eval(parseInt(i) + 1))
					.find('[type=\"checkbox\"]').attr('checked', 'checked');
			deleteRowTable('scheduleHP' + eval(parseInt(i) + 1), 1, 1);
			$('#scheduleHP' + eval(parseInt(i) + 1)).find(':input').prop(
					'disabled', true);
			assessePercentShareProp.disabled = true;
			if (val == 'NO') {
				assessePercentShareProp.value = '100';
			} else {
				assessePercentShareProp.value = '0.0';
			}
		}
	}
}

function isLetOut() {

	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);
	for (var i = 0; i < totHp; i++) {
		var tempName = 'scheduleHP.propertyDetails[' + i + '].ifLetOut';
		var val = document.getElementsByName(tempName)[0].value;

		if (val == 'Y') {
			$('#scheduleHPTenant' + eval(parseInt(i) + 1)).find(':input').prop(
					'disabled', false);
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].coTenants[0].coTenantsSNo')[0].value = 1;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = false;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = false;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = false;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.incomeChargbleOwnHands')[0].disabled = true;

		} else if (val == 'D') {
			$('#scheduleHPTenant' + eval(parseInt(i) + 1)).find(
					'[type=\"checkbox\"]').attr('checked', 'checked');
			deleteRowTable('scheduleHPTenant' + eval(parseInt(i) + 1), 1, 1);
			$('#scheduleHPTenant' + eval(parseInt(i) + 1)).find(':input').prop(
					'disabled', true);
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = false;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = false;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = false;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.incomeChargbleOwnHands')[0].disabled = true;

		} else {
			$('#scheduleHPTenant' + eval(parseInt(i) + 1)).find(
					'[type=\"checkbox\"]').attr('checked', 'checked');
			deleteRowTable('scheduleHPTenant' + eval(parseInt(i) + 1), 1, 1);
			$('#scheduleHPTenant' + eval(parseInt(i) + 1)).find(':input').prop(
					'disabled', true);
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = true;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].value = '';
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = true;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].value = '';
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = true;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].value = '';
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.incomeChargbleOwnHands')[0].disabled = true;
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.incomeChargbleOwnHands')[0].value = '';
		}
	}
}

function addScheduleHP() {

	var mainTable = document.getElementById('scheduleHPMain').rows;
	var tobeInsertBefore = document.getElementById('scheduleHPAddRow');
	var flag = false;
	var totRow = document.getElementById('scheduleHPLast').cells[0].textContent;

	var iterate = eval(parseInt(totRow) - 1);
	for (var i = 0; i < mainTable.length; i++) {
		var cloneNode = mainTable[i].cloneNode(true);
		if (mainTable[i].id == 'scheduleHP1st') {
			flag = true;
			cloneNode.cells[0].innerHTML = totRow;
		}
		if (mainTable[i].id == 'coOwnerTr') {
			cloneNode.getElementsByTagName('table')[0].setAttribute('id',
					'scheduleHP' + totRow);
			cloneNode.getElementsByTagName('img')[0].setAttribute('onclick',
					'addRowToTableSchHp(' + '\'scheduleHP' + totRow
							+ '\',2,1,this);');
			cloneNode.getElementsByTagName('img')[1].setAttribute('onclick',
					'deleteRowTable(' + '\'scheduleHP' + totRow + '\',1,1)');

		}

		if (mainTable[i].id == 'coTenantTr') {
			cloneNode.getElementsByTagName('table')[0].setAttribute('id',
					'scheduleHPTenant' + totRow);
			cloneNode.getElementsByTagName('img')[0].setAttribute('onclick',
					'addRowToTableSchHpTenants(' + '\'scheduleHPTenant'
							+ totRow + '\',2,1,this);');
			cloneNode.getElementsByTagName('img')[1].setAttribute('onclick',
					'deleteRowTable(' + '\'scheduleHPTenant' + totRow
							+ '\',1,1)');
		}

		if (flag) {

			var cellsTot = cloneNode.cells;
			for (var j = 0; j < cellsTot.length; j++) {
				cloneNode.cells[j].innerHTML = cloneNode.cells[j].innerHTML
						.replace('1a', totRow + 'a')
						.replace('1b', totRow + 'b')
						.replace('1c', totRow + 'c')
						.replace('1d', totRow + 'd')
						.replace('1e', totRow + 'e')
						.replace('1f', totRow + 'f')
						.replace('1g', totRow + 'g')
						.replace('1h', totRow + 'h')
						.replace('1i', totRow + 'i')
						.replace('1j', totRow + 'j')
						.replace('1k', totRow + 'k').replace('property 1',
								'property ' + totRow).replace('property 1',
								'property ' + totRow);
			}

			var inputTags = cloneNode.getElementsByTagName('input');
			for (var a = 0; a < inputTags.length; a++) {
				inputTags[a].name = inputTags[a].name.replace('[0]', '['
						+ iterate + ']');
				if (inputTags[a].name.indexOf('coOwnersSNo') == '-1') {
					inputTags[a].value = '';
				}

				if (inputTags[a].name.indexOf('coTenantsSNo') == '-1') {
					inputTags[a].value = '';
				}
				inputTags[a].id = inputTags[a].name.replace(/([\.\[\]])/g, '_')
						.replace(/(__)/g, '_');

				var blurAttr = inputTags[a].getAttribute('onblur');
				if (blurAttr != null) {
					blurAttr = blurAttr + ";";
				} else {
					blurAttr = "";
				}
				inputTags[a].setAttribute('onblur', blurAttr
						+ 'j.blur(this,this.name,this.value);');
			}

			var selectTags = cloneNode.getElementsByTagName('select');
			for (var a = 0; a < selectTags.length; a++) {
				selectTags[a].name = selectTags[a].name.replace('[0]', '['
						+ iterate + ']');
				selectTags[a].value = '';
				var name = "scheduleHP.propertyDetails[" + iterate
						+ "].addressDetail.stateCode";
				var Countryname = "scheduleHP.propertyDetails[" + iterate
						+ "].addressDetail.country";
				if (selectTags[a].name == name) {
					if (selectTags[a].name.indexOf('stateCode') != '-1') {
						selectTags[a].onchange = function() {
							setCounrtyForStateNew('scheduleHP.propertyDetails['
									+ iterate + '].addressDetail.stateCode',
									'scheduleHP.propertyDetails[' + iterate
											+ '].addressDetail.country',
									'scheduleHP.propertyDetails[' + iterate
											+ '].addressDetail.pinCode',
									'scheduleHP.propertyDetails[' + iterate
											+ '].addressDetail.zipCode');
						};
					}
				} else if (selectTags[a].name == Countryname) {
					if (selectTags[a].name.indexOf('country') != '') {
						selectTags[a].onchange = function() {
							setStateForCountryNew('scheduleHP.propertyDetails['
									+ iterate + '].addressDetail.stateCode',
									'scheduleHP.propertyDetails[' + iterate
											+ '].addressDetail.country',
									'scheduleHP.propertyDetails[' + iterate
											+ '].addressDetail.pinCode',
									'scheduleHP.propertyDetails[' + iterate
											+ '].addressDetail.zipCode');
						};
					}
				}
				selectTags[a].id = selectTags[a].name.replace(/([\.\[\]])/g,
						'_').replace(/(__)/g, '_');

				var blurAttr = selectTags[a].getAttribute('onblur');
				if (blurAttr != null) {
					blurAttr = blurAttr + ";";
				} else {
					blurAttr = "";
				}
				selectTags[a].setAttribute('onblur', blurAttr
						+ 'j.blur(this,this.name,this.value);');
			}

			var textareaTags = cloneNode.getElementsByTagName('textarea');
			for (var a = 0; a < textareaTags.length; a++) {
				textareaTags[a].name = textareaTags[a].name.replace('[0]', '['
						+ iterate + ']');
				textareaTags[a].value = '';
				textareaTags[a].id = textareaTags[a].name.replace(
						/([\.\[\]])/g, '_').replace(/(__)/g, '_');

				var blurAttr = textareaTags[a].getAttribute('onblur');
				if (blurAttr != null) {
					blurAttr = blurAttr + ";";
				} else {
					blurAttr = "";
				}
				textareaTags[a].setAttribute('onblur', blurAttr
						+ 'j.blur(this,this.name,this.value);');
			}

			document.getElementById('scheduleHPMain')
					.getElementsByTagName('tr')[0].parentNode.insertBefore(
					cloneNode, tobeInsertBefore);
		}
		if (mainTable[i].id == 'scheduleHPEnd') {
			flag = false;
			break;
		}
	}
	var newVal = eval(parseInt(totRow) + 1);
	var newText = 'Total (';
	for (var k = 1; k < newVal; k++) {
		newText = newText + k + 'j +';
	}
	newText = newText + newVal + 'a)';

	document.getElementById('scheduleHPLast').cells[0].innerHTML = newVal;
	document.getElementById('scheduleHPLast').cells[2].innerHTML = newVal;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[0].innerHTML = newVal + 1;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[2].innerHTML = newVal + 1;

	if ($('#scheduleHPAddRow')[0].parentNode.children.length == 28) {
		$('#delHPButtonId').prop('disabled', true);
	} else if ($('#scheduleHPAddRow')[0].parentNode.children.length > 28) {
		$('#delHPButtonId').prop('disabled', false);
	}

	$('#scheduleHPTenant' + eval(parseInt(totRow))).find('[type=\"checkbox\"]')
			.attr('checked', 'checked');
	deleteRowTable('scheduleHPTenant' + eval(parseInt(totRow)), 1, 1);

	document.getElementsByName('scheduleHP.propertyDetails['
			+ (parseInt(totRow) - 1) + '].hpSno')[0].value = totRow;
	var table = document.getElementById('scheduleHPMain');
	modifyRow(table);
	var onchange1 = document.getElementsByName('scheduleHP.propertyDetails['
			+ (parseInt(totRow) - 1) + '].propCoOwnedFlg')[0]
			.getAttribute('onchange');
	var onchange2 = document.getElementsByName('scheduleHP.propertyDetails['
			+ (parseInt(totRow) - 1) + '].ifLetOut')[0]
			.getAttribute('onchange');
	onchange1 = onchange1.substring(0, onchange1.indexOf('('));
	onchange2 = onchange2.substring(0, onchange2.indexOf('('));
	window[onchange1]();
	window[onchange2]();
	checkMaxLengthLimit();
}

function delScheduleHPForITR6() {

	if ($('#scheduleHPAddRow')[0].parentNode.children.length > 27) {
		for (var i = 0; i < 23; i++) {
			$('#scheduleHPAddRow')[0].parentNode
					.deleteRow($('#scheduleHPAddRow')[0].parentNode.children.length - 7);
		}
		if ($('#scheduleHPAddRow')[0].parentNode.children.length == 29) {
			$('#delHPButtonId').prop('disabled', true);
		}
	} else if ($('#scheduleHPAddRow')[0].parentNode.children.length == 29) {
		$('#delHPButtonId').prop('disabled', true);
	}

	($('#scheduleHPLast')[0].children)[0].innerHTML = parseInt(($('#scheduleHPLast')[0].children)[0].innerHTML) - 1;

	var totRow = document.getElementById('scheduleHPLast').cells[0].textContent;

	var newVal = eval(parseInt(totRow));
	var newText = 'Total (';
	for (var k = 1; k < newVal; k++) {
		newText = newText + k + 'j +'; // j will be according to the html sl no
	}
	newText = newText + newVal + 'a )';
	document.getElementById('scheduleHPLast').cells[0].innerHTML = newVal;
	document.getElementById('scheduleHPLast').cells[2].innerHTML = newVal;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[0].innerHTML = newVal + 1;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[2].innerHTML = newVal + 1;

	var table = document.getElementById('scheduleHPMain');

	modifyRow(table);
	calcITR6();
}

function scheduleHPCalcFor6() {
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);
	var total = 0;
	var thirtyPercentOfBalanceTemp = 0;

	for (var i = 0; i < totHp; i++) {

		document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].rentdetails.totalUnrealizedAndTax')[0].value = eval(parseInt(document
				.getElementsByName('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.rentNotRealized')[0].value == "" ? 0
				: coalesceSetRet('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.rentNotRealized'))
				+ parseInt(document
						.getElementsByName('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.localTaxes')[0].value == "" ? 0
						: coalesceSetRet('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.localTaxes')));

		document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].rentdetails.balanceALV')[0].value = eval(parseInt(document
				.getElementsByName('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.annualLetableValue')[0].value == "" ? 0
				: coalesceSetRet('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.annualLetableValue'))
				- parseInt(document
						.getElementsByName('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.totalUnrealizedAndTax')[0].value == "" ? 0
						: coalesceSetRet('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.totalUnrealizedAndTax')));

		var incomeChargbleOwnHands = document
				.getElementsByName('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.incomeChargbleOwnHands')[0];
		setEditableFieldValue(
				incomeChargbleOwnHands,
				Math
						.round(eval(parseInt(document
								.getElementsByName('scheduleHP.propertyDetails['
										+ i + '].rentdetails.balanceALV')[0].value)
								* (parseFloat(document
										.getElementsByName('scheduleHP.propertyDetails['
												+ i + '].asseseeShareProperty')[0].value))
								/ 100)));

		thirtyPercentOfBalanceTemp = Math
				.round(eval(parseInt(document
						.getElementsByName('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.incomeChargbleOwnHands')[0].value == "" ? 0
						: document
								.getElementsByName('scheduleHP.propertyDetails['
										+ i
										+ '].rentdetails.incomeChargbleOwnHands')[0].value) * 0.3));
		if (parseInt(thirtyPercentOfBalanceTemp, 10) > 0) {
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.thirtyPercentOfBalance')[0].value = thirtyPercentOfBalanceTemp;
		} else {
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.thirtyPercentOfBalance')[0].value = parseInt(
					0, 10);
		}
		var section115ba= document.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;

		if(section115ba=='115BAB' )
		{
			
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.thirtyPercentOfBalance')[0].value = parseInt(
					0, 10);
		}
		if(section115ba=='115BAB' )
		{
			
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.intOnBorwCap')[0].value = parseInt(
					0, 10);
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.intOnBorwCap')[0].readOnly=true; 
			
		}else{
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].rentdetails.intOnBorwCap')[0].readOnly=false; 	
		}
		
		
		document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].rentdetails.totalDeduct')[0].value = eval(parseInt(document
				.getElementsByName('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.thirtyPercentOfBalance')[0].value == "" ? 0
				: document.getElementsByName('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.thirtyPercentOfBalance')[0].value)
				+ parseInt(document
						.getElementsByName('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.intOnBorwCap')[0].value == "" ? 0
						: coalesceSetRet('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.intOnBorwCap')));
		document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].rentdetails.incomeOfHP')[0].value = eval(parseInt(coalesceSetRet('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.incomeChargbleOwnHands') == "" ? 0
				: coalesceSetRet('scheduleHP.propertyDetails[' + i
						+ '].rentdetails.incomeChargbleOwnHands'))
				- parseInt(coalesceSetRet('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.totalDeduct') == "" ? 0
						: coalesceSetRet('scheduleHP.propertyDetails['
										+ i + '].rentdetails.totalDeduct'))
				+ parseInt(coalesceSetRet('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.arrears')[0] == "" ? 0
						: coalesceSetRet('scheduleHP.propertyDetails['
										+ i + '].rentdetails.arrears')));

		total = eval(parseInt(total)
				+ parseInt(document
						.getElementsByName('scheduleHP.propertyDetails[' + i
								+ '].rentdetails.incomeOfHP')[0].value));
	}

	document.getElementsByName('scheduleHP.totalIncomeChargeableUnHP')[0].value = eval(parseInt(document
			.getElementsByName('scheduleHP.passThroughIncome')[0].value == "" ? 0
			: document.getElementsByName('scheduleHP.passThroughIncome')[0].value)
			+ parseInt(total));

}

function calcSchBPBalFor6() {
	try {
		var profBfrTaxPL = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.profBfrTaxPL')[0];
		profBfrTaxPL.value = coalesce(profBfrTaxPL.value);
		var netPLFromSpecBus = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.netPLFromSpecBus')[0];
		netPLFromSpecBus.value = coalesce(netPLFromSpecBus.value);
		var netProfLossSpecifiedBus = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.netProfLossSpecifiedBus')[0];
		netProfLossSpecifiedBus.value = coalesce(netProfLossSpecifiedBus.value);
		var incRecCredPLOthHeadsHp = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.houseProperty')[0];
		incRecCredPLOthHeadsHp.value = coalesce(incRecCredPLOthHeadsHp.value);
		var incRecCredPLOthHeadsCg = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.capitalGains')[0];
		incRecCredPLOthHeadsCg.value = coalesce(incRecCredPLOthHeadsCg.value);
		var incRecCredPLOthHeadsOs = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.othSources')[0];
		incRecCredPLOthHeadsOs.value = coalesce(incRecCredPLOthHeadsOs.value);
		// var pLUs44sChapXIIG115B =
		// document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.pLUs44sChapXIIG115B')[0];
		// pLUs44sChapXIIG115B.value = coalesce(pLUs44sChapXIIG115B.value);
		var schSI115B = document
				.getElementsByName('scheduleSI.splCodeRateTax[1].splRateInc')[0];
		schSI115B.value = coalesce(schSI115B.value);

		// var pLUs44sChapXIIGOther =
		// document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.pLUs44sChapXIIGOther')[0];
		// pLUs44sChapXIIGOther.value = coalesce(pLUs44sChapXIIGOther.value);

		var firmus115BBF = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBF')[0];
		firmus115BBF.value = coalesce(firmus115BBF.value);
		var firmus115BBG = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBG')[0];
		firmus115BBG.value = coalesce(firmus115BBG.value);

		var firmShareInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.firmShareInc')[0];
		firmShareInc.value = coalesce(firmShareInc.value);
		var aopboiSharInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.aopboiSharInc')[0];
		aopboiSharInc.value = coalesce(aopboiSharInc.value);
		var othExempInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.othExempInc')[0];
		othExempInc.value = coalesce(othExempInc.value);

		var plUs44SChapXIIG = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG')[0];
		plUs44SChapXIIG.value = coalesce(plUs44SChapXIIG.value);
		// 4a Profit or loss included in 1, which is referred to in section
		// 44AD/44ADA/44AE/44B/44BB/44BBA/44DA
		var section44AEPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.section44AE')[0];
		section44AEPt4.value = coalesce(section44AEPt4.value);
		var section44BPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.section44B')[0];
		section44BPt4.value = coalesce(section44BPt4.value);
		var section44BBPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.section44BB')[0];
		section44BBPt4.value = coalesce(section44BBPt4.value);
		var section44BBAPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.section44BBA')[0];
		section44BBAPt4.value = coalesce(section44BBAPt4.value);
		var section44BBBPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.section44BBB')[0];
		section44BBBPt4.value = coalesce(section44BBBPt4.value);
		var section44DPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.section44D')[0];
		section44DPt4.value = coalesce(section44DPt4.value);
		var section44DAPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.section44DA')[0];
		section44DAPt4.value = coalesce(section44DAPt4.value);
		var sectionXIIGPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.sectionXIIG')[0];
		sectionXIIGPt4.value = coalesce(sectionXIIGPt4.value);
		var sectionOthr115BPt4 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG.sectionOthr115B')[0];
		sectionOthr115BPt4.value = coalesce(sectionOthr115BPt4.value);

		var plUs44SChapXIIG4b = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b')[0];
		plUs44SChapXIIG4b.value = coalesce(plUs44SChapXIIG4b.value);
		var plUs44SChapXIIG4c = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4c')[0];
		plUs44SChapXIIG4c.value = coalesce(plUs44SChapXIIG4c.value);
		var section7 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7')[0];
		section7.value = coalesce(section7.value);
		var section7a = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7a')[0];
		section7a.value = coalesce(section7a.value);
		var section7b1 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7b1')[0];
		section7b1.value = coalesce(section7b1.value);
		var section7b2 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7b2')[0];
		section7b2.value = coalesce(section7b2.value);
		var section8 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section8')[0];
		section8.value = coalesce(section8.value);

		var totExempInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.totExempIncPL')[0];
		totExempInc.value = coalesce(totExempInc.value);

		var balancePLOthThanSpecBus = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.balancePLOthThanSpecBus')[0];
		balancePLOthThanSpecBus.value = coalesce(balancePLOthThanSpecBus.value);
		var expDebToPLOthHeadsHouseProperty = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.houseProperty')[0];
		expDebToPLOthHeadsHouseProperty.value = coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.houseProperty');
		var expDebToPLOthHeadsCapitalGains = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.capitalGains')[0];
		expDebToPLOthHeadsCapitalGains.value = coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.capitalGains');
		var expDebToPLOthHeadsOthSources = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.othSources')[0];
		expDebToPLOthHeadsOthSources.value = coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.othSources');
		var expDebToPLExemptInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLExemptInc')[0];
		expDebToPLExemptInc.value = coalesce(expDebToPLExemptInc.value);
		var expDebTo115BBExemptInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.us115BBF')[0];
		expDebTo115BBExemptInc.value = coalesce(expDebTo115BBExemptInc.value);
		var expDebTo115BBGExemptInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.us115BBG')[0];
		expDebTo115BBGExemptInc.value = coalesce(expDebTo115BBGExemptInc.value);

		var totExpDebPL = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.totExpDebPL')[0];
		totExpDebPL.value = coalesce(totExpDebPL.value);
		var adjustedPLOthThanSpecBus = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.adjustedPLOthThanSpecBus')[0];
		adjustedPLOthThanSpecBus.value = coalesce(adjustedPLOthThanSpecBus.value);
		var depreciationDebPLCosAct = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationDebPLCosAct')[0];
		depreciationDebPLCosAct.value = coalesce(depreciationDebPLCosAct.value);

		var depreciationAllowUs321Ii = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321Ii')[0];
		depreciationAllowUs321Ii.value = coalesce(depreciationAllowUs321Ii.value);
		var depreciationAllowUs321I = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321I')[0];
		depreciationAllowUs321I.value = coalesce(depreciationAllowUs321I.value);
		var totDeprAllowITAct = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.totDeprAllowITAct')[0];
		totDeprAllowITAct.value = coalesce(totDeprAllowITAct.value);

		var adjustPLAfterDeprOthSpecInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.adjustPLAfterDeprOthSpecInc')[0];
		adjustPLAfterDeprOthSpecInc.value = coalesce(adjustPLAfterDeprOthSpecInc.value);
		var amtDebPLDisallowUs36 = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amtDebPLDisallowUs36')[0];
		amtDebPLDisallowUs36.value = coalesce(amtDebPLDisallowUs36.value);
		var amtDebPLDisallowUs37 = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amtDebPLDisallowUs37')[0];
		amtDebPLDisallowUs37.value = coalesce(amtDebPLDisallowUs37.value);
		var amtDebPLDisallowUs40 = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amtDebPLDisallowUs40')[0];
		amtDebPLDisallowUs40.value = coalesce(amtDebPLDisallowUs40.value);
		var amtDebPLDisallowUs40A = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amtDebPLDisallowUs40A')[0];
		amtDebPLDisallowUs40A.value = coalesce(amtDebPLDisallowUs40A.value);
		var amtDebPLDisallowUs43B = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amtDebPLDisallowUs43B')[0];
		amtDebPLDisallowUs43B.value = coalesce(amtDebPLDisallowUs43B.value);
		var interestDisAllowUs23SMEAct = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.interestDisAllowUs23SMEAct')[0];
		interestDisAllowUs23SMEAct.value = coalesce(interestDisAllowUs23SMEAct.value);
		var deemIncUs41 = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs41')[0];
		deemIncUs41.value = coalesce(deemIncUs41.value);
		var deemIncUs3380HHD80IA = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs3380HHD80IA')[0];
		deemIncUs3380HHD80IA.value = coalesce(deemIncUs3380HHD80IA.value);
		var deemIncUs43ca = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedIncomeUs43CA')[0];
		deemIncUs43ca.value = coalesce(deemIncUs43ca.value);
		var othItemDisallowUs28To44DA = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.othItemDisallowUs28To44DA')[0];
		othItemDisallowUs28To44DA.value = coalesce(othItemDisallowUs28To44DA.value);
		var anyOthIncNotInclInExpDisallowPL = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.anyOthIncNotInclInExpDisallowPL')[0];
		anyOthIncNotInclInExpDisallowPL.value = coalesce(anyOthIncNotInclInExpDisallowPL.value);

		var iCDSadjustDeviatStock = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.iCDSadjustDeviatStock')[0];
		iCDSadjustDeviatStock.value = coalesce(iCDSadjustDeviatStock.value);
		var profDeviatDueAcctMeth = document
				.getElementsByName('partaoi.profDeviatDueAcctMeth')[0];
		profDeviatDueAcctMeth.value = coalesce(profDeviatDueAcctMeth.value);
		var effectOnPL = document
				.getElementsByName('partaoi.methodOfValClgStk.effectOnPL')[0];

		var iCDSadjustDevStock = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.iCDSadjustDevStock')[0];
		iCDSadjustDevStock.value = coalesce(iCDSadjustDevStock.value);
		var profDeviationICDS = document
				.getElementsByName('partaoi.profDeviationICDS')[0];
		profDeviationICDS.value = coalesce(profDeviationICDS.value);
		var deviationUs145A = document
				.getElementsByName('partaoi.methodOfValClgStk.deviationUs145A')[0];

		var totAfterAddToPLDeprOthSpecInc = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.totAfterAddToPLDeprOthSpecInc')[0];
		totAfterAddToPLDeprOthSpecInc.value = coalesce(totAfterAddToPLDeprOthSpecInc.value);
		var deductUs321Iii = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deductUs321Iii')[0];
		deductUs321Iii.value = coalesce(deductUs321Iii.value);
		var amt32AC = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amt32AC')[0];
		amt32AC.value = coalesce(amt32AC.value);
		var deductUs32AD = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deductUs32AD')[0];
		deductUs32AD.value = coalesce(deductUs32AD.value);
		var debPLUs35ExcessAmt = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.debPLUs35ExcessAmt')[0];
		debPLUs35ExcessAmt.value = coalesce(debPLUs35ExcessAmt.value);
		var amtDisallUs40NowAllow = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amtDisallUs40NowAllow')[0];
		amtDisallUs40NowAllow.value = coalesce(amtDisallUs40NowAllow.value);
		var amtDisallUs43BNowAllow = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amtDisallUs43BNowAllow')[0];
		amtDisallUs43BNowAllow.value = coalesce(amtDisallUs43BNowAllow.value);

		var anyOthAmtAllDeduct = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.anyOthAmtAllDeduct')[0];
		anyOthAmtAllDeduct.value = coalesce(anyOthAmtAllDeduct.value);
		var totDeductionAmts = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.totDeductionAmts')[0];
		totDeductionAmts.value = coalesce(totDeductionAmts.value);
		var plAftAdjDedBusOthThanSpec = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.plAftAdjDedBusOthThanSpec')[0];
		plAftAdjDedBusOthThanSpec.value = coalesce(plAftAdjDedBusOthThanSpec.value);
		// 37 Profits and gains of business or profession deemed to be under
		var section44AE = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44AE')[0];
		section44AE.value = coalesce(section44AE.value);
		var section44B = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44B')[0];
		section44B.value = coalesce(section44B.value);
		var section44BB = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44BB')[0];
		section44BB.value = coalesce(section44BB.value);
		var section44BBA = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44BBA')[0];
		section44BBA.value = coalesce(section44BBA.value);
		var section44BBB = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44BBB')[0];
		section44BBB.value = coalesce(section44BBB.value);
		var section44D = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44D')[0];
		section44D.value = coalesce(section44D.value);
		var section44DA = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44DA')[0];
		section44DA.value = coalesce(section44DA.value);
		var chapterXIIG = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.chapterxiiG')[0];
		chapterXIIG.value = coalesce(chapterXIIG.value);
		var firstSchTActOthers = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.firstSchTActOthers')[0];
		firstSchTActOthers.value = coalesce(firstSchTActOthers.value);

		section44AEPt4.value = eval(parseInt(section44AE.value, 10));
		section44BPt4.value = eval(parseInt(section44B.value, 10));
		section44BBPt4.value = eval(parseInt(section44BB.value, 10));
		section44BBAPt4.value = eval(parseInt(section44BBA.value, 10));
		section44BBBPt4.value = eval(parseInt(section44BBB.value, 10));
		section44DPt4.value = eval(parseInt(section44D.value, 10));
		section44DAPt4.value = eval(parseInt(section44DA.value, 10));
		sectionXIIGPt4.value = eval(parseInt(chapterXIIG.value, 10));
		sectionOthr115BPt4.value = eval(parseInt(firstSchTActOthers.value, 10));

		var totDeemedProfitBusUs = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.totDeemedProfitBusUs')[0];
		totDeemedProfitBusUs.value = coalesce(totDeemedProfitBusUs.value);
		var netPLAftAdjBusOthThanSpec = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.netPLAftAdjBusOthThanSpec')[0];
		netPLAftAdjBusOthThanSpec.value = coalesce(netPLAftAdjBusOthThanSpec.value);

		var netPLBusOthThanSpec7A7B7C = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C')[0];
		netPLBusOthThanSpec7A7B7C.value = coalesce(netPLBusOthThanSpec7A7B7C.value);

		var netPLFrmSpecBus = document
				.getElementsByName('itr6ScheduleBP.specBusinessInc.netPLFrmSpecBus')[0];
		netPLFrmSpecBus.value = coalesce(netPLFrmSpecBus.value);
		var additionUs28To44DA = document
				.getElementsByName('itr6ScheduleBP.specBusinessInc.additionUs28To44DA')[0];
		additionUs28To44DA.value = coalesce(additionUs28To44DA.value);
		var deductUs28To44DA = document
				.getElementsByName('itr6ScheduleBP.specBusinessInc.deductUs28To44DA')[0];
		deductUs28To44DA.value = coalesce(deductUs28To44DA.value);
		var adjustedPLFrmSpecuBus = document
				.getElementsByName('itr6ScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus')[0];
		adjustedPLFrmSpecuBus.value = coalesce(adjustedPLFrmSpecuBus.value);

		var netPLFrmSpecifiedBus = document
				.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.netPLFrmSpecifiedBus')[0];
		netPLFrmSpecifiedBus.value = coalesce(netPLFrmSpecifiedBus.value);
		var addSec28To44DA = document
				.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.addSec28To44DA')[0];
		addSec28To44DA.value = coalesce(addSec28To44DA.value);
		var dedSec28To44DAOTDedSec35AD = document
				.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.dedSec28To44DAOTDedSec35AD')[0];
		dedSec28To44DAOTDedSec35AD.value = coalesce(dedSec28To44DAOTDedSec35AD.value);
		var profitLossSpecifiedBusiness = document
				.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.profitLossSpecifiedBusiness')[0];
		profitLossSpecifiedBusiness.value = coalesce(profitLossSpecifiedBusiness.value);

		var deductionUs35AD1 = document
				.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.deductionUs35AD1')[0];
		deductionUs35AD1.value = coalesce(deductionUs35AD1.value);
		var profitLossSpecifiedBusFinal = document
				.getElementsByName('itr6ScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal')[0];
		profitLossSpecifiedBusFinal.value = coalesce(profitLossSpecifiedBusFinal.value);
		var incChrgUnHdProftGain = document
				.getElementsByName('itr6ScheduleBP.incChrgUnHdProftGain')[0];
		incChrgUnHdProftGain.value = coalesce(incChrgUnHdProftGain.value);

		var financialStmtFlag = document
				.getElementsByName('partAGEN1.filingStatus.financialStmtFlag')[0].value;
		;

		var expDebToPLExemptIncDisAllwUs14A = document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.expDebToPLExemptIncDisAllwUs14A')[0];
		expDebToPLExemptIncDisAllwUs14A.value = coalesce(expDebToPLExemptIncDisAllwUs14A.value);

		expDebToPLExemptIncDisAllwUs14A.value = parseInt(
				coalesceSetRet('partaoi.expenditureDisallowed'), 10);

		anyOthIncNotInclInExpDisallowPL.value = eval(parseInt(
				coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.salaryExpDisallowPL'),
				10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.bonusExpDisallowPL'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.commissionExpDisallowPL'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.interestExpDisallowPL'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.othersExpDisallowPL'),
						10));

		deemIncUs3380HHD80IA.value = eval(parseInt(
				coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs32AC'),
				10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs32AD'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs33AB'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs33ABA'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs35ABA'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs35ABB'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs35AC'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs40A3A'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs33AC'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs72A'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs80HHD'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemIncUs80IA'),
						10));

		var tab = document.getElementById('scheduleBP1');
		var Count_SCH_BP = document.getElementsByName('Count_SCH_BP')[0];
		Count_SCH_BP.value = 0;

		for (var i = 0; i < tab.rows.length - 3; i++) {

			Count_SCH_BP.value = eval(parseInt(Count_SCH_BP.value, 10)
					+ parseInt(coalesce(document
							.getElementsByName('itr6ScheduleBP.otherExempt['
									+ i + '].totalAmount')[0].value), 10));

		}
		document
				.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.othExempInc')[0].value = addBPExmptInc('scheduleBP1');

		profBfrTaxPL.value = eval(parseInt(
				coalesceSetRet('partapl.debitsToPL.debitPlAcnt.pbt'), 10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.totalPresumptive'),
						10)
				+ parseInt(
						coalesceSetRet('partapl.debitsToPL.debitPlAcnt.netProfit'),
						10)
				+ parseInt(
						coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.pBT'),
						10));

		// 11. Depreciation and amoritisation debited to profit and loss
		// account. as from 42 of part A- P&L

		depreciationDebPLCosAct.value = zeroOrMore(coalesceSetRet('partapl.debitsToPL.debitPlAcnt.depreciationAmort')
				+ coalesceSetRet('PartaPLIndAS.debitsToPL.debitPlAcnt.depreciationAmort')
				+ coalesceSetRet('partama.openingInventory.openingStockdepOffactory')
				+ coalesceSetRet('partamaIndAs.openingInventory.openingStockdepOffactory'));

		// 12. Depreciation allowable under section 32(1)(ii) (column 6 of
		// Schedule-DEP)
		depreciationAllowUs321Ii.value = coalesce(document
				.getElementsByName('scheduleDEP.summaryFromDeprSch.totalDepreciation')[0].value);
		// 14. Amounts debited to the profit and loss account, to the extent
		// disallowable under section 36 (6p of Part-OI)
		amtDebPLDisallowUs36.value = coalesce(document
				.getElementsByName('partaoi.amtDisallUs36.totAmtDisallUs36')[0].value);
		// 15. Amounts debited to the profit and loss account, to the extent
		// disallowable under section 37 (7h of Part-OI)
		amtDebPLDisallowUs37.value = coalesce(document
				.getElementsByName('partaoi.amtDisallUs37.totAmtDisallUs37')[0].value);
		// 16. Amounts debited to the profit and loss account, to the extent
		// disallowable under section 40 (8Af of Part-OI)
		amtDebPLDisallowUs40.value = coalesce(document
				.getElementsByName('partaoi.amtDisallUs40.totAmtDisallUs40')[0].value);
		// 17. Amounts debited to the profit and loss account, to the extent
		// disallowable under section 40A (9f of Part-OI)
		amtDebPLDisallowUs40A.value = coalesce(document
				.getElementsByName('partaoi.amtDisallUs40A.totAmtDisallUs40A')[0].value);
		// 18. Any amount debited to profit and loss account of the previous
		// year but disallowable under section 43B (11g of Part-OI)
		amtDebPLDisallowUs43B.value = coalesce(document
				.getElementsByName('partaoi.amtDisall43B.amtUs43B.totAmtUs43B')[0].value);
		// 26. Amount of deduction under section 35 in excess of the amount
		// debited to profit and loss account (item vii(4) of Schedule ESR)
		debPLUs35ExcessAmt.value = coalesce(document
				.getElementsByName('scheduleESR.deductionUs35.totUs35.deductUs35.excessAmtOverDebPL')[0].value);
		// 27. Any amount disallowed under section 40 in any preceding previous
		// year but allowable during the previous year(8B of Part-OI)
		amtDisallUs40NowAllow.value = coalesce(document
				.getElementsByName('partaoi.amtDisallUs40.anyAmtOfSec40AllowPrevYr')[0].value);
		// 28. Any amount disallowed under section 43B in any preceding previous
		// year but allowable during the previous year(10 g of Part-OI)
		amtDisallUs43BNowAllow.value = coalesce(document
				.getElementsByName('partaoi.amtDisallUs43BPyNowAll.amtUs43B.totAmtUs43B')[0].value);
		// 35. Deductions under section - This field auto populates from item e
		// of Sch 10A.
		// section10A.value =
		// coalesce(document.getElementsByName('schedule10A.deductSEZ.dedUs10Detail.totalDedUs10Sub')[0].value);
		// 35. Deductions under section - This field auto populates from item e
		// of Sch 10AA.
		// section10AA.value =
		// coalesce(document.getElementsByName('schedule10AA.deductSEZ.dedUs10Detail.totalDedUs10Sub')[0].value);

		// 34. Deduction allowable under section 32(1)(iii)
		totDeemedProfitBusUs.value = eval(parseInt(chapterXIIG.value, 10))
				+ eval(parseInt(section44AE.value, 10))
				+ eval(parseInt(section44B.value, 10))
				+ eval(parseInt(section44BB.value, 10))
				+ eval(parseInt(section44BBA.value, 10))
				+ eval(parseInt(section44BBB.value, 10))
				+ eval(parseInt(section44D.value, 10))
				+ eval(parseInt(section44DA.value, 10))
				+ eval(parseInt(firstSchTActOthers.value, 10));
		// 37(ii)
		section44AE.value = coalescePath('partapl.debitsToPL.debitPlAcnt.totalPresumptive');

		// 4a
		plUs44SChapXIIG.value = eval(parseInt(section44AEPt4.value, 10))
				+ eval(parseInt(section44BPt4.value, 10))
				+ eval(parseInt(section44BBPt4.value, 10))
				+ eval(parseInt(section44BBAPt4.value, 10))
				+ eval(parseInt(section44BBBPt4.value, 10))
				+ eval(parseInt(section44DPt4.value, 10))
				+ eval(parseInt(section44DAPt4.value, 10))
				+ eval(parseInt(sectionXIIGPt4.value, 10))
				+ eval(parseInt(sectionOthr115BPt4.value, 10));

		// 4c

		plUs44SChapXIIG4c.value = eval(parseInt(section7.value, 10))
				+ eval(parseInt(section7a.value, 10))
				+ eval(parseInt(section7b1.value, 10))
				+ eval(parseInt(section7b2.value, 10))
				+ eval(parseInt(section8.value, 10));

		// 5. Income credited to Profit and Loss account (included in 1)which is
		// exempt
		totExempInc.value = eval(parseInt(firmShareInc.value, 10))
				+ eval(parseInt(aopboiSharInc.value, 10))
				+ eval(parseInt(Count_SCH_BP.value, 10));
		// 6. Balance ((1– 2a – 2b – 3a - 3b – 3c - 3d - 3e – 4a - 4b - 4c –
		// 5d))
		balancePLOthThanSpecBus.value = eval(parseInt(profBfrTaxPL.value, 10))
				- eval(parseInt(netPLFromSpecBus.value, 10))
				- eval(parseInt(netProfLossSpecifiedBus.value, 10))
				- eval(parseInt(incRecCredPLOthHeadsHp.value, 10))
				- eval(parseInt(incRecCredPLOthHeadsCg.value, 10))
				- eval(parseInt(incRecCredPLOthHeadsOs.value, 10))
				- eval(parseInt(totExempInc.value, 10))
				- eval(parseInt(firmus115BBF.value, 10))
				- eval(parseInt(firmus115BBG.value, 10))
				- eval(parseInt(plUs44SChapXIIG.value, 10))
				- eval(parseInt(plUs44SChapXIIG4b.value, 10))
				- eval(parseInt(plUs44SChapXIIG4c.value, 10));
		// 9. Total (7 + 8)
		totExpDebPL.value = eval(parseInt(
				expDebToPLOthHeadsHouseProperty.value, 10))
				+ eval(parseInt(expDebToPLOthHeadsCapitalGains.value, 10))
				+ eval(parseInt(expDebToPLOthHeadsOthSources.value, 10))
				+ eval(parseInt(expDebToPLExemptInc.value, 10))
				+ eval(parseInt(expDebTo115BBExemptInc.value, 10))
				+ eval(parseInt(expDebTo115BBGExemptInc.value, 10))
				+ eval(parseInt(expDebToPLExemptIncDisAllwUs14A.value, 10));
		// 10. Adjusted profit or loss (6+9)
		adjustedPLOthThanSpecBus.value = eval(parseInt(
				balancePLOthThanSpecBus.value, 10))
				+ eval(parseInt(totExpDebPL.value, 10));
		// 12. Depreciation allowable under Income-tax Act
		totDeprAllowITAct.value = eval(parseInt(depreciationAllowUs321Ii.value,
				10))
				+ eval(parseInt(depreciationAllowUs321I.value, 10));
		// 13. Profit or loss after adjustment for depreciation (10 +11 - 12iii)
		adjustPLAfterDeprOthSpecInc.value = eval(parseInt(
				adjustedPLOthThanSpecBus.value, 10))
				+ eval(parseInt(depreciationDebPLCosAct.value, 10))
				- eval(parseInt(totDeprAllowITAct.value, 10));
		// 24
		iCDSadjustDeviatStock.value = eval(coalesce(parseInt(
				profDeviatDueAcctMeth.value, 10)))
				+ eval(coalesce(parseInt(effectOnPL.value, 10)));
		
		deemIncUs41.value=coalesce(document
		.getElementsByName('partaoi.profTaxAmtUs41')[0].value);
		// 25. Total (14 + 15 + 16 + 17 + 18 + 19 + 20 + 21+22 +23+24 +25)
		totAfterAddToPLDeprOthSpecInc.value = 
				  eval(coalesce(parseInt(amtDebPLDisallowUs36.value, 10)))
				+ eval(coalesce(parseInt(deemIncUs43ca.value, 10)))
				+ eval(coalesce(parseInt(amtDebPLDisallowUs37.value, 10)))
				+ eval(coalesce(parseInt(amtDebPLDisallowUs40.value, 10)))
				+ eval(coalesce(parseInt(amtDebPLDisallowUs40A.value, 10)))
				+ eval(coalesce(parseInt(amtDebPLDisallowUs43B.value, 10)))
				+ eval(coalesce(parseInt(interestDisAllowUs23SMEAct.value, 10)))
				+ eval(coalesce(parseInt(deemIncUs41.value, 10)))
				+ eval(coalesce(parseInt(deemIncUs3380HHD80IA.value, 10)))
				+ eval(coalesce(parseInt(othItemDisallowUs28To44DA.value, 10)))
				+ eval(coalesce(parseInt(anyOthIncNotInclInExpDisallowPL.value, 10)))
				+ eval(parseInt(iCDSadjustDeviatStock.value, 10));

		// 34
		iCDSadjustDevStock.value = 
			      eval(coalesce(parseInt(profDeviationICDS.value, 10)))
				+ eval(coalesce(parseInt(deviationUs145A.value, 10)));

		// 35. Total (26 + 27+28 +29 + 30 + 31 + 32c +33 +34)
		totDeductionAmts.value =
				  eval(coalesce(parseInt(deductUs321Iii.value, 10)))
				+ eval(coalesce(parseInt(amt32AC.value, 10)))
				+ eval(coalesce(parseInt(debPLUs35ExcessAmt.value, 10)))
				+ eval(coalesce(parseInt(amtDisallUs40NowAllow.value, 10)))
				+ eval(coalesce(parseInt(amtDisallUs43BNowAllow.value, 10)))
				+ eval(coalesce(parseInt(anyOthAmtAllDeduct.value, 10)))
				+ eval(coalesce(parseInt(deductUs32AD.value, 10)))
				+ eval(coalesce(parseInt(iCDSadjustDevStock.value, 10)));
		// 36. Income (13 + 25 - 33)
		plAftAdjDedBusOthThanSpec.value = 
				  eval(coalesce(parseInt(adjustPLAfterDeprOthSpecInc.value, 10)))
				+ eval(coalesce(parseInt(totAfterAddToPLDeprOthSpecInc.value, 10)))
				- eval(coalesce(parseInt(totDeductionAmts.value, 10)));

		// 35. Profit or loss before deduction under section 10A/10AA/10B/10BA
		// (32 + 33xi)
		// profitLossBfrDeductUs10S.value =
		// eval(parseInt(plAftAdjDedBusOthThanSpec.value,10)) +
		// eval(parseInt(totDeemedProfitBusUs.value,10));

		// 38
		netPLAftAdjBusOthThanSpec.value = eval(parseInt(
				plAftAdjDedBusOthThanSpec.value, 10))
				+ eval(parseInt(totDeemedProfitBusUs.value, 10));

		// 38. Net profit or loss from speculative business as per profit or
		// loss account - auto populates from field 2A of Sch BP
		netPLFrmSpecBus.value = eval(parseInt(netPLFromSpecBus.value, 10));

		// 39

		var section7_38 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7')[0];
		section7_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section7');
		var section7A_38 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7A')[0];
		section7A_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section7A');
		var section7B_38 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7B')[0];
		section7B_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section7B');
		var section7B1A_38 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7B1A')[0];
		section7B1A_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section7B1A');
		var section8_38 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section8')[0];
		section8_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section8');
		var sectionOther_38 = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.sectionOther')[0];
		sectionOther_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.sectionOther');
		var BalanceOfIncomeDeemed = document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.BalanceOfIncomeDeemed')[0];
		BalanceOfIncomeDeemed.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.BalanceOfIncomeDeemed');

		sectionOther_38.value = parseInt(netPLAftAdjBusOthThanSpec.value, 10);
		netPLBusOthThanSpec7A7B7C.value = eval(parseInt(section7_38.value, 10))
				+ eval(parseInt(section7A_38.value, 10))
				+ eval(parseInt(section7B_38.value, 10))
				+ eval(parseInt(section7B1A_38.value, 10))
				+ eval(parseInt(section8_38.value, 10))
				+ eval(parseInt(sectionOther_38.value, 10));
		document.getElementsByName('scheduleEI.agriInc')[0].value = BalanceOfIncomeDeemed.value;

		// 40

		BalanceOfIncomeDeemed.value = zeroOrMore(eval(parseInt(
				plUs44SChapXIIG4c.value, 10))
				- (eval(parseInt(section7_38.value, 10))
						+ eval(parseInt(section7A_38.value, 10))
						+ eval(parseInt(section7B_38.value, 10))
						+ eval(parseInt(section7B1A_38.value, 10)) + eval(parseInt(
						section8_38.value, 10))));

		// B44. Computation of income from speculative business
		adjustedPLFrmSpecuBus.value = eval(parseInt(netPLFrmSpecBus.value, 10))
				+ eval(parseInt(additionUs28To44DA.value, 10))
				- eval(parseInt(deductUs28To44DA.value, 10));
		// 42. Net profit or loss from specified business as per profit or loss
		// account (populates from 2B of Sch BP)
		netPLFrmSpecifiedBus.value = eval(parseInt(
				netProfLossSpecifiedBus.value, 10));
		// 45. Profit or loss from specified business (42+43-44)
		profitLossSpecifiedBusiness.value = eval(parseInt(
				netPLFrmSpecifiedBus.value, 10))
				+ eval(parseInt(addSec28To44DA.value, 10))
				- eval(parseInt(dedSec28To44DAOTDedSec35AD.value, 10));
		// 47 Profit or loss from specified business (44-45) (enter nil if loss)
		profitLossSpecifiedBusFinal.value = eval(parseInt(
				profitLossSpecifiedBusiness.value, 10))
				- eval(parseInt(deductionUs35AD1.value, 10));
		
		
	
		var tempPLFrmSpecuBus = adjustedPLFrmSpecuBus.value;
		var tempSpecifiedBusFinal = profitLossSpecifiedBusFinal.value;

		if (parseInt(tempPLFrmSpecuBus, 10) < 0) {
			tempPLFrmSpecuBus = parseInt(0, 10);
		}
		if (parseInt(tempSpecifiedBusFinal, 10) < 0) {
			tempSpecifiedBusFinal = parseInt(0, 10);
		}

		// Income chargeable under the head ‘Profits and gains’ from business or
		// profession(A39 + B44 + C50)
		incChrgUnHdProftGain.value = eval(parseInt(
				netPLBusOthThanSpec7A7B7C.value, 10))
				+ eval(parseInt(tempPLFrmSpecuBus, 10))
				+ eval(parseInt(tempSpecifiedBusFinal, 10));

		
		var ntProfit115B = document
		.getElementsByName('itr6ScheduleBP.ntProfit115B')[0];
		ntProfit115B.value = coalesce(document
				.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b')[0].value);
		
		var lifeIns115B = document
		.getElementsByName('itr6ScheduleBP.lifeIns115B')[0];
		
		if (parseInt(document.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b')[0].value, 10) < 0) {

			lifeIns115B.value = 0;

		}else{
			lifeIns115B.value = coalesce(document
					.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b')[0].value);
			
		}
		setOffSchBP();

		// disable Profit after tax field in Sch MAT
		/*if (plUs44SChapXIIG4b.value > 0 || section44B.value > 0
				|| section44BB.value > 0 || section44BBA.value > 0
				|| section44BBB.value > 0)
		{
			document.getElementsByName('scheduleMAT.profAfterTaxPLAcnt')[0].disabled = false;
		} else {
			document.getElementsByName('scheduleMAT.profAfterTaxPLAcnt')[0].disabled = true;
		}
*/
	} catch (e) {
		alert(' error in calcSchBP() =  ' + e.stack);
	}

}

function setOffSchBP() {
	try {
		prefillSchBP();
		setOffBPBusLoss();
	} catch (e) {
		alert('error in setOffSchBP()=' + e.stack);
	}

}

function prefillSchBP() {
	try {
		// prefilling column :: Income from speculative business
		// Field (B40 of schedule BP)

		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.speculativeInc.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('itr6ScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus'));

		// prefilling column :: Income from specified business
		// Field (C46 of schedule BP)
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.specifiedInc.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('itr6ScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal'));

		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.profitgainInc.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b'));

		// populating losses Business loss set off
		// Field (A36 of schedule BP)
		coalescePath('itr6ScheduleBP.busSetoffCurYr.lossSetOffOnBusLoss');
		if (!isPostv('itr6ScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C')) {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.lossSetOffOnBusLoss')[0].value = Math
					.abs(coalescePath('itr6ScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C'));
		} else {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.lossSetOffOnBusLoss')[0].value = 0;
		}
	} catch (e) {
		alert('error in prefillSchBP()=' + e.stack);
	}
}

function setOffBPBusLoss() {
	try {
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.speculativeInc.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.specifiedInc.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.profitgainInc.busLossSetoff')[0].value = 0;

		/*
		 * Order of adjustment :- 1) Income from speculative business 2) Income
		 * from specified business
		 */

		var setOffRem = coalescePath('itr6ScheduleBP.busSetoffCurYr.lossSetOffOnBusLoss')
				- coalescePath('itr6ScheduleBP.busSetoffCurYr.speculativeInc.incOfCurYrUnderThatHead');

		// 1. Income from speculative business
		if (parseInt(setOffRem, 10) >= 0) {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.speculativeInc.busLossSetoff')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.speculativeInc.incOfCurYrUnderThatHead');

		} else {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.speculativeInc.busLossSetoff')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.lossSetOffOnBusLoss');
			setOffRem = 0;
		}

		// 2. Income from specified business
		var prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('itr6ScheduleBP.busSetoffCurYr.specifiedInc.incOfCurYrUnderThatHead');

		if (parseInt(setOffRem, 10) >= 0) {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.specifiedInc.busLossSetoff')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.specifiedInc.incOfCurYrUnderThatHead');
		} else {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.specifiedInc.busLossSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}
		// 3. Profit and gains from life insurance business u/s 115B
		var prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('itr6ScheduleBP.busSetoffCurYr.profitgainInc.incOfCurYrUnderThatHead');

		if (parseInt(setOffRem, 10) >= 0) {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.profitgainInc.busLossSetoff')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.profitgainInc.incOfCurYrUnderThatHead');
		} else {
			document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.profitgainInc.busLossSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}
		// Income from speculative business income remaining after set off
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.speculativeInc.incOfCurYrAfterSetOff')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.speculativeInc.incOfCurYrUnderThatHead')
				- coalescePath('itr6ScheduleBP.busSetoffCurYr.speculativeInc.busLossSetoff');

		// Income from specified business income remaining after set off
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.specifiedInc.incOfCurYrAfterSetOff')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.specifiedInc.incOfCurYrUnderThatHead')
				- coalescePath('itr6ScheduleBP.busSetoffCurYr.specifiedInc.busLossSetoff');
		// Profit and gains from life insurance business u/s 115B
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.profitgainInc.incOfCurYrAfterSetOff')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.profitgainInc.incOfCurYrUnderThatHead')
				- coalescePath('itr6ScheduleBP.busSetoffCurYr.profitgainInc.busLossSetoff');

		// total loss setoff
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.totLossSetOffOnBus')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.speculativeInc.busLossSetoff')
				+ coalescePath('itr6ScheduleBP.busSetoffCurYr.specifiedInc.busLossSetoff')
				+ coalescePath('itr6ScheduleBP.busSetoffCurYr.profitgainInc.busLossSetoff');

		// Loss remaining after set-off
		document
				.getElementsByName('itr6ScheduleBP.busSetoffCurYr.lossRemainSetOffOnBus')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.lossSetOffOnBusLoss')
				- coalescePath('itr6ScheduleBP.busSetoffCurYr.totLossSetOffOnBus');
	} catch (e) {
		alert('error in setOffBPBusLoss()=' + e.stack);
	}
}

function calcSchDEPFor6() {

	var deprBlockTot15Percent = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.plantMachinerySummary.deprBlockTot15Percent')[0];
	deprBlockTot15Percent.value = coalesce(deprBlockTot15Percent.value);
	var deprBlockTot30Percent = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.plantMachinerySummary.deprBlockTot30Percent')[0];
	deprBlockTot30Percent.value = coalesce(deprBlockTot30Percent.value);
	var deprBlockTot40Percent = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.plantMachinerySummary.deprBlockTot40Percent')[0];
	deprBlockTot40Percent.value = coalesce(deprBlockTot40Percent.value);
	var deprBlockTot45Percent = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.plantMachinerySummary.deprBlockTot45Percent')[0];
	deprBlockTot45Percent.value = coalesce(deprBlockTot45Percent.value);
	var totPlntMach = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.plantMachinerySummary.totPlntMach')[0];
	totPlntMach.value = coalesce(totPlntMach.value);
	var deprBlockTot5Percent = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.buildingSummary.deprBlockTot5Percent')[0];
	deprBlockTot5Percent.value = coalesce(deprBlockTot5Percent.value);
	var deprBlockTot10Percent = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.buildingSummary.deprBlockTot10Percent')[0];
	deprBlockTot10Percent.value = coalesce(deprBlockTot10Percent.value);
	var buildingDeprBlockTot100Percent = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.buildingSummary.deprBlockTot100Percent')[0];
	buildingDeprBlockTot100Percent.value = coalesce(buildingDeprBlockTot100Percent.value);
	var totBuildng = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.buildingSummary.totBuildng')[0];
	totBuildng.value = coalesce(totBuildng.value);
	var furnitureSummary = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.furnitureSummary')[0];
	furnitureSummary.value = coalesce(furnitureSummary.value);
	var intangibleAssetSummary = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.intangibleAssetSummary')[0];
	intangibleAssetSummary.value = coalesce(intangibleAssetSummary.value);
	var shipsSummary = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.shipsSummary')[0];
	shipsSummary.value = coalesce(shipsSummary.value);
	var profBfrTaxPL = document
			.getElementsByName('scheduleDEP.summaryFromDeprSch.totalDepreciation')[0];
	profBfrTaxPL.value = coalesce(profBfrTaxPL.value);

	// 15
	if (coalesce(parseInt(
			document
					.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.propAvgDepreciation')[0].value,
			10)) > 0) {

		deprBlockTot15Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.propAvgDepreciation')[0].value)
	} else {
		deprBlockTot15Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.netAgvDepreciation')[0].value)
	}
	if (coalesce(parseInt(
			document
					.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.propAvgDepreciation')[0].value,
			10)) > 0) {

		deprBlockTot30Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.propAvgDepreciation')[0].value)
	} else {
		deprBlockTot30Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.netAgvDepreciation')[0].value)
	}
	if (coalesce(parseInt(
			document
					.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.propAvgDepreciation')[0].value,
			10)) > 0) {

		deprBlockTot40Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.propAvgDepreciation')[0].value)
	} else {
		deprBlockTot40Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.netAgvDepreciation')[0].value)
	}
	if (coalesce(parseInt(
			document
					.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.propAvgDepreciation')[0].value,
			10)) > 0) {

		deprBlockTot45Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.propAvgDepreciation')[0].value)
	} else {
		deprBlockTot45Percent.value = coalesce(document
				.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.netAgvDepreciation')[0].value)
	}

	totPlntMach.value = eval(parseInt(deprBlockTot15Percent.value, 10))
			+ eval(parseInt(deprBlockTot30Percent.value, 10))
			+ eval(parseInt(deprBlockTot40Percent.value, 10))
			+ eval(parseInt(deprBlockTot45Percent.value, 10));

	if (coalesce(parseInt(
			document
					.getElementsByName('scheduleDOA.building.rate5.depreciationDetail.propDepreciationNetAgg')[0].value,
			10)) > 0) {
		deprBlockTot5Percent.value = coalesce(document
				.getElementsByName('scheduleDOA.building.rate5.depreciationDetail.propDepreciationNetAgg')[0].value);
	} else {
		deprBlockTot5Percent.value = coalesce(document
				.getElementsByName('scheduleDOA.building.rate5.depreciationDetail.depreciationNetAgg')[0].value);
	}
	if (coalesce(parseInt(
			document
					.getElementsByName('scheduleDOA.building.rate10.depreciationDetail.propDepreciationNetAgg')[0].value,
			10)) > 0) {
		deprBlockTot10Percent.value = coalesce(document
				.getElementsByName('scheduleDOA.building.rate10.depreciationDetail.propDepreciationNetAgg')[0].value);
	} else {
		deprBlockTot10Percent.value = coalesce(document
				.getElementsByName('scheduleDOA.building.rate10.depreciationDetail.depreciationNetAgg')[0].value);
	}
	if (coalesce(parseInt(
			document
					.getElementsByName('scheduleDOA.building.rate40.depreciationDetail.propDepreciationNetAgg')[0].value,
			10)) > 0) {
		buildingDeprBlockTot100Percent.value = coalesce(document
				.getElementsByName('scheduleDOA.building.rate40.depreciationDetail.propDepreciationNetAgg')[0].value);
	} else {
		buildingDeprBlockTot100Percent.value = coalesce(document
				.getElementsByName('scheduleDOA.building.rate40.depreciationDetail.depreciationNetAgg')[0].value);
	}

	totBuildng.value = eval(parseInt(deprBlockTot5Percent.value, 10))
			+ eval(parseInt(deprBlockTot10Percent.value, 10))
			+ eval(parseInt(buildingDeprBlockTot100Percent.value, 10));

	if (parseInt(
			document
					.getElementsByName('scheduleDOA.furnitureFittings.rate10.depreciationDetail.propDepreciationNetAgg')[0].value,
			10) > 0) {
		furnitureSummary.value = coalesce(document
				.getElementsByName('scheduleDOA.furnitureFittings.rate10.depreciationDetail.propDepreciationNetAgg')[0].value);
	} else {
		furnitureSummary.value = coalesce(document
				.getElementsByName('scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationNetAgg')[0].value);
	}

	if (parseInt(
			document
					.getElementsByName('scheduleDOA.intangibleAssets.rate25.depreciationDetail.propDepreciationNetAgg')[0].value,
			10) > 0) {
		intangibleAssetSummary.value = coalesce(document
				.getElementsByName('scheduleDOA.intangibleAssets.rate25.depreciationDetail.propDepreciationNetAgg')[0].value);
	} else {
		intangibleAssetSummary.value = coalesce(document
				.getElementsByName('scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationNetAgg')[0].value);
	}

	if (parseInt(
			document
					.getElementsByName('scheduleDOA.ships.rate20.depreciationDetail.propDepreciationNetAgg')[0].value,
			10) > 0) {
		shipsSummary.value = coalesce(document
				.getElementsByName('scheduleDOA.ships.rate20.depreciationDetail.propDepreciationNetAgg')[0].value);
	} else {
		shipsSummary.value = coalesce(document
				.getElementsByName('scheduleDOA.ships.rate20.depreciationDetail.depreciationNetAgg')[0].value);
	}
	profBfrTaxPL.value = eval(parseInt(totPlntMach.value, 10))
			+ eval(parseInt(totBuildng.value, 10))
			+ eval(parseInt(furnitureSummary.value, 10))
			+ eval(parseInt(intangibleAssetSummary.value, 10))
			+ eval(parseInt(shipsSummary.value, 10));

}

function calcSchDCGFor6() {

	var deprBlockTot15Percent = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.plantMachinerySummaryCG.deprBlockTot15Percent')[0];
	deprBlockTot15Percent.value = coalesce(deprBlockTot15Percent.value);
	var deprBlockTot30Percent = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.plantMachinerySummaryCG.deprBlockTot30Percent')[0];
	deprBlockTot30Percent.value = coalesce(deprBlockTot30Percent.value);
	var deprBlockTot40Percent = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.plantMachinerySummaryCG.deprBlockTot40Percent')[0];
	deprBlockTot40Percent.value = coalesce(deprBlockTot40Percent.value);
	var deprBlockTot45Percent = document
	.getElementsByName('scheduleDCG.summaryFromDeprSchCG.plantMachinerySummaryCG.deprBlockTot45Percent')[0];
deprBlockTot45Percent.value = coalesce(deprBlockTot45Percent.value);

	var totPlntMach = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.plantMachinerySummaryCG.totPlntMach')[0];
	totPlntMach.value = coalesce(totPlntMach.value);
	var deprBlockTot5Percent = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.buildingSummaryCG.deprBlockTot5Percent')[0];
	deprBlockTot5Percent.value = coalesce(deprBlockTot5Percent.value);
	var deprBlockTot10Percent = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.buildingSummaryCG.deprBlockTot10Percent')[0];
	deprBlockTot10Percent.value = coalesce(deprBlockTot10Percent.value);
	var buildingDeprBlockTot100Percent = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.buildingSummaryCG.deprBlockTot100Percent')[0];
	buildingDeprBlockTot100Percent.value = coalesce(buildingDeprBlockTot100Percent.value);
	var totBuildng = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.buildingSummaryCG.totBuildng')[0];
	totBuildng.value = coalesce(totBuildng.value);
	var furnitureSummary = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.furnitureSummary')[0];
	furnitureSummary.value = coalesce(furnitureSummary.value);
	var intangibleAssetSummary = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.intangibleAssetSummary')[0];
	intangibleAssetSummary.value = coalesce(intangibleAssetSummary.value);
	var shipsSummary = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.shipsSummary')[0];
	shipsSummary.value = coalesce(shipsSummary.value);
	var profBfrTaxPL = document
			.getElementsByName('scheduleDCG.summaryFromDeprSchCG.totalDepreciation')[0];
	profBfrTaxPL.value = coalesce(profBfrTaxPL.value);

	deprBlockTot15Percent.value = coalesce(document
			.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.capGainUs50')[0].value);
	deprBlockTot30Percent.value = coalesce(document
			.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.capGainUs50')[0].value);
	deprBlockTot40Percent.value = coalesce(document
			.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.capGainUs50')[0].value);
	deprBlockTot45Percent.value = coalesce(document
			.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.capGainUs50')[0].value);
	totPlntMach.value = eval(parseInt(deprBlockTot15Percent.value, 10))
			+ eval(parseInt(deprBlockTot30Percent.value, 10))
			+ eval(parseInt(deprBlockTot40Percent.value, 10))
			+ eval(parseInt(deprBlockTot45Percent.value, 10));

	deprBlockTot5Percent.value = coalesce(document
			.getElementsByName('scheduleDOA.building.rate5.depreciationDetail.capGainUs50')[0].value);
	deprBlockTot10Percent.value = coalesce(document
			.getElementsByName('scheduleDOA.building.rate10.depreciationDetail.capGainUs50')[0].value);
	buildingDeprBlockTot100Percent.value = coalesce(document
			.getElementsByName('scheduleDOA.building.rate40.depreciationDetail.capGainUs50')[0].value);
	totBuildng.value = eval(parseInt(deprBlockTot5Percent.value, 10))
			+ eval(parseInt(deprBlockTot10Percent.value, 10))
			+ eval(parseInt(buildingDeprBlockTot100Percent.value, 10));

	furnitureSummary.value = coalesce(document
			.getElementsByName('scheduleDOA.furnitureFittings.rate10.depreciationDetail.capGainUs50')[0].value);
	intangibleAssetSummary.value = coalesce(document
			.getElementsByName('scheduleDOA.intangibleAssets.rate25.depreciationDetail.capGainUs50')[0].value);
	shipsSummary.value = coalesce(document
			.getElementsByName('scheduleDOA.ships.rate20.depreciationDetail.capGainUs50')[0].value);

	profBfrTaxPL.value = eval(parseInt(totPlntMach.value, 10))
			+ eval(parseInt(totBuildng.value, 10))
			+ eval(parseInt(furnitureSummary.value, 10))
			+ eval(parseInt(intangibleAssetSummary.value, 10))
			+ eval(parseInt(shipsSummary.value, 10));
}

function calTotalProfitShareEI() {

	var table = document.getElementById('scheduleEI');
	var noOfRows = table.rows.length;

	var sum = 0;
	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 3); i++) {

		sum = sum
				+ eval(parseInt(
						coalesce(document
								.getElementsByName('scheduleEI.shareOfProfitFirmAOPDtls['
										+ i + '].amount')[0].value), 10));

	}

	document.getElementsByName('scheduleEI.totalShareIncAOP')[0].value = sum;
	calTotalEI();
}

// Calculate Total for Schedule EI
function calTotalEI() {

	document.getElementsByName('scheduleEI.totalExemptInc')[0].value = eval(parseInt(coalesce(
			document.getElementsByName('scheduleEI.interestInc')[0].value, 10)))
			+ eval(parseInt(coalesce(document
					.getElementsByName('scheduleEI.dividendInc')[0].value), 10))
			+ eval(parseInt(
					coalesce(document
							.getElementsByName('scheduleEI.netAgriIncOrOthrIncRule7')[0].value),
					10))
			+ eval(parseInt(
					coalesce(document
							.getElementsByName('scheduleEI.incChrgblAsPerDTAA')[0].value),
					10))
			+ eval(parseInt(
					coalesce(document
							.getElementsByName('scheduleEI.incNotChrgblToTax')[0].value),
					10))
			+ eval(parseInt(coalesce(document
					.getElementsByName('scheduleEI.others')[0].value), 10));

}

function calMatAdditions() {

	var deferedTax = document
			.getElementsByName('scheduleMAT.additions.itPaidInclDefTax')[0].value;
	var reserve = document
			.getElementsByName('scheduleMAT.additions.resvrNo33AC')[0].value;
	var provUncertainLiab = document
			.getElementsByName('scheduleMAT.additions.provUncertainLiab')[0].value;
	var provLossOfSubsComp = document
			.getElementsByName('scheduleMAT.additions.provLossOfSubsComp')[0].value;
	var dividendPaidOrProposed = document
			.getElementsByName('scheduleMAT.additions.dividendPaidOrProposed')[0].value;
	var expendExempIncUs10S = document
			.getElementsByName('scheduleMAT.additions.expendExempIncUs10S')[0].value;
	var depreciatAttribToRevalAsset = document
			.getElementsByName('scheduleMAT.additions.depreciatAttribToRevalAsset')[0].value;
	var addOthers = document.getElementsByName('scheduleMAT.additions.others')[0].value;
	var expAopBoi = document
			.getElementsByName('scheduleMAT.additions.expAopBoi')[0].value;
	var expClauseFb = document
			.getElementsByName('scheduleMAT.additions.expClauseFb')[0].value;
	var notLossClauseFc = document
			.getElementsByName('scheduleMAT.additions.notLossClauseFc')[0].value;
	var gainClauseK = document
			.getElementsByName('scheduleMAT.additions.gainClauseK')[0].value;
	var notLossUs115bbf = document
			.getElementsByName('scheduleMAT.additions.notLossUs115bbf')[0].value;

	var totalAddition = document
			.getElementsByName('scheduleMAT.additions.totAdditions')[0];

	var totalAdditionsTemp = eval(parseInt(coalesce(deferedTax), 10))
			+ eval(parseInt(coalesce(reserve), 10))
			+ eval(parseInt(coalesce(provUncertainLiab), 10))
			+ eval(parseInt(coalesce(provLossOfSubsComp), 10))
			+ eval(parseInt(coalesce(dividendPaidOrProposed), 10))
			+ eval(parseInt(coalesce(expendExempIncUs10S), 10))
			+ eval(parseInt(coalesce(depreciatAttribToRevalAsset), 10))
			+ eval(parseInt(coalesce(addOthers), 10))
			+ eval(parseInt(coalesce(expAopBoi), 10))
			+ eval(parseInt(coalesce(expClauseFb), 10))
			+ eval(parseInt(coalesce(notLossClauseFc), 10))
			+ eval(parseInt(coalesce(gainClauseK), 10))
			+ eval(parseInt(coalesce(notLossUs115bbf), 10));

	if (parseInt(totalAdditionsTemp, 10) > 0) {
		totalAddition.value = totalAdditionsTemp;
	} else {
		totalAddition.value = parseInt(0, 10);
	}

}

function calMATDeletions() {

	var amtWithdrawFromResvr = document
			.getElementsByName('scheduleMAT.deducts.amtWithdrawFromResvrIfCredPL')[0].value;
	var incExempIncUs10S = document
			.getElementsByName('scheduleMAT.deducts.incExempIncUs10S')[0].value;
	var amtRevalReserv = document
			.getElementsByName('scheduleMAT.deducts.amtWithdrawFromResvrIfCredPLNoAttrib')[0].value;
	var depreciat = document
			.getElementsByName('scheduleMAT.deducts.unAbsorbedDepreciat')[0].value;
	var profitIndstry = document
			.getElementsByName('scheduleMAT.deducts.proSickIndustryOrExcedAccumLos')[0].value;
	var deductOthrs = document.getElementsByName('scheduleMAT.deducts.others')[0].value;
	var shareIncAopBoi = document
			.getElementsByName('scheduleMAT.deducts.shareIncAopBoi')[0].value;
	var incClauseiid = document
			.getElementsByName('scheduleMAT.deducts.incClauseiid')[0].value;
	var notGainClauseiie = document
			.getElementsByName('scheduleMAT.deducts.notGainClauseiie')[0].value;
	var lossTrnsClauseiif = document
			.getElementsByName('scheduleMAT.deducts.lossTrnsClauseiif')[0].value;
	var lossTrnsClauseiig = document
			.getElementsByName('scheduleMAT.deducts.lossTrnsClauseiig')[0].value;

	var totalDeduction = document
			.getElementsByName('scheduleMAT.deducts.totDeducts')[0];

	var totalDeductionTemp = eval(parseInt(coalesce(amtWithdrawFromResvr), 10))
			+ eval(parseInt(coalesce(incExempIncUs10S), 10))
			+ eval(parseInt(coalesce(amtRevalReserv), 10))
			+ eval(parseInt(coalesce(depreciat), 10))
			+ eval(parseInt(coalesce(profitIndstry), 10))
			+ eval(parseInt(coalesce(deductOthrs), 10))
			+ eval(parseInt(coalesce(shareIncAopBoi), 10))
			+ eval(parseInt(coalesce(incClauseiid), 10))
			+ eval(parseInt(coalesce(notGainClauseiie), 10))
			+ eval(parseInt(coalesce(lossTrnsClauseiif), 10))
			+ eval(parseInt(coalesce(lossTrnsClauseiig), 10));

	if (parseInt(totalDeductionTemp, 10) > 0) {
		totalDeduction.value = totalDeductionTemp;
	} else {
		totalDeduction.value = parseInt(0, 10);
	}

}

function calcTaxPayableMAT() {

	calMatAdditions();
	calMATDeletions();
	var totalAddtion = document
			.getElementsByName('scheduleMAT.additions.totAdditions')[0].value;
	var totDeductions = document
			.getElementsByName('scheduleMAT.deducts.totDeducts')[0].value;

	var bookProfUs115JB = document
			.getElementsByName('scheduleMAT.bookProfUs115JB')[0];
	bookProfUs115JB.value = coalesce(bookProfUs115JB.value);
	var profAfterTaxPLAcnt = document
			.getElementsByName('scheduleMAT.profAfterTaxPLAcnt')[0];
	profAfterTaxPLAcnt.value = coalesce(profAfterTaxPLAcnt.value);
	var taxPayableUs115JB = document
			.getElementsByName('scheduleMAT.taxPayableUs115JB')[0];
	taxPayableUs115JB.value = coalesce(taxPayableUs115JB.value);

	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var residentSec90Flag = document
			.getElementsByName('partAGEN1.filingStatus.residentsec90')[0].value;
	var permanentEstbFlag = document
			.getElementsByName('partAGEN1.filingStatus.nripe')[0].value;
	var registrationFlag = document
			.getElementsByName('partAGEN1.filingStatus.registratedlaw')[0].value;
	var intFinancialServicesFlag = document
			.getElementsByName('partAGEN1.filingStatus.isifsc')[0].value;

	var totalAdditions = document
			.getElementsByName('scheduleMAT.additionsProfUs115JB.totalAdditions')[0];

	var totalAdditionsOfDeduc = document
			.getElementsByName('scheduleMAT.deductionsProfUs115JB.totalAdditions')[0];
	totalAdditionsOfDeduc.value = coalesce(totalAdditionsOfDeduc.value);
	var deemedTotalIncUs115JB = document
			.getElementsByName('scheduleMAT.deemedTotalIncUs115JB')[0];
	deemedTotalIncUs115JB.value = coalesce(deemedTotalIncUs115JB.value);

	var financialStmtFlag = document
			.getElementsByName('partAGEN1.filingStatus.financialStmtFlag')[0].value;
	if (financialStmtFlag == 'Y') {
		document.getElementsByName('scheduleMAT.financialStamentFlag')[0].value = 'Y';
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsCredited')[0].readOnly = false;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsDebited')[0].readOnly = false;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.oneFifthTransitionAmt')[0].readOnly = false;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.othersInclResidualAdjust')[0].readOnly = false;
		document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsCredited')[0].readOnly = false;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsDebited')[0].readOnly = false;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.oneFifthTransitionAmt')[0].readOnly = false;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.othersInclResidualAdjust')[0].readOnly = false;
	} else if (financialStmtFlag == 'N') {
		document.getElementsByName('scheduleMAT.financialStamentFlag')[0].value = 'N';
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsCredited')[0].readOnly = true;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsDebited')[0].readOnly = true;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.oneFifthTransitionAmt')[0].readOnly = true;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.othersInclResidualAdjust')[0].readOnly = true;
		
		document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsCredited')[0].readOnly = true;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsDebited')[0].readOnly = true;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.oneFifthTransitionAmt')[0].readOnly = true;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.othersInclResidualAdjust')[0].readOnly = true;

		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsCredited')[0].value = null;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsDebited')[0].value = null;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.oneFifthTransitionAmt')[0].value = null;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.othersInclResidualAdjust')[0].value = null;
		document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsCredited')[0].value = null;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsDebited')[0].value = null;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.oneFifthTransitionAmt')[0].value = null;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.othersInclResidualAdjust')[0].value = null;
	} else {

		document.getElementsByName('scheduleMAT.financialStamentFlag')[0].value = '';
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsCredited')[0].readOnly = true;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsDebited')[0].readOnly = true;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.oneFifthTransitionAmt')[0].readOnly = true;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.othersInclResidualAdjust')[0].readOnly = true;
		
		document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsCredited')[0].readOnly = true;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsDebited')[0].readOnly = true;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.oneFifthTransitionAmt')[0].readOnly = true;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.othersInclResidualAdjust')[0].readOnly = true;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsCredited')[0].value = null;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.amountsDebited')[0].value = null;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.oneFifthTransitionAmt')[0].value = null;
		document
				.getElementsByName('scheduleMAT.additionsProfUs115JB.othersInclResidualAdjust')[0].value = null;
		document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsCredited')[0].value = null;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.amountsDebited')[0].value = null;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.oneFifthTransitionAmt')[0].value = null;
document
		.getElementsByName('scheduleMAT.deductionsProfUs115JB.othersInclResidualAdjust')[0].value = null;
	}

	// Total additions (8a + 8b + 8c + 8d)
	totalAdditions.value = zeroOrMore(coalesceSetRet('scheduleMAT.additionsProfUs115JB.amountsCredited')
			+ coalesceSetRet('scheduleMAT.additionsProfUs115JB.amountsDebited')
			+ coalesceSetRet('scheduleMAT.additionsProfUs115JB.oneFifthTransitionAmt')
			+ coalesceSetRet('scheduleMAT.additionsProfUs115JB.othersInclResidualAdjust'));
	// Total deductions (8f + 8g + 8h + 8i)
	totalAdditionsOfDeduc.value = zeroOrMore(coalesceSetRet('scheduleMAT.deductionsProfUs115JB.amountsCredited')
			+ coalesceSetRet('scheduleMAT.deductionsProfUs115JB.amountsDebited')
			+ coalesceSetRet('scheduleMAT.deductionsProfUs115JB.oneFifthTransitionAmt')
			+ coalesceSetRet('scheduleMAT.deductionsProfUs115JB.othersInclResidualAdjust'));

	// (7 + 8e ? 8j)

	deemedTotalIncUs115JB.value = eval(coalesceSetRet('scheduleMAT.bookProfUs115JB')
			+ coalesceSetRet('scheduleMAT.additionsProfUs115JB.totalAdditions')
			- coalesceSetRet('scheduleMAT.deductionsProfUs115JB.totalAdditions'));

	var taxRate = 15;

	bookProfUs115JB.value = eval(parseInt(profAfterTaxPLAcnt.value, 10))
			+ eval(parseInt(coalesce(totalAddtion), 10))
			- eval(parseInt(coalesce(totDeductions), 10));

	/*if (domesticCompFlg == "N" && residentSec90Flag == "Y"
			&& permanentEstbFlag == "N") {

		taxRate = 0;

	} else if (domesticCompFlg == "N" && residentSec90Flag == "N"
			&& registrationFlag == "N") {

		taxRate = 0;

	} else*/ if (intFinancialServicesFlag == "Y") {

		taxRate = 9;

	}

	if (deemedTotalIncUs115JB.value > 0) {
		var taxPayableUs115JBTemp = Math.round((taxRate * eval(parseInt(
				deemedTotalIncUs115JB.value, 10))) / 100);

		if (parseInt(taxPayableUs115JBTemp, 10) > 0) {
			taxPayableUs115JB.value = taxPayableUs115JBTemp;
		} else {
			taxPayableUs115JB.value = parseInt(0, 10);
		}
	} else {
		taxPayableUs115JB.value = parseInt(0, 10);
	}

}

function calcTotScheduleMATC(tableId) {

	var tab = document.getElementById(tableId);
	var allInputTags = tab.getElementsByTagName('input');
	var totMatCredGross = parseInt('0', 10);
	var totMatCredSetOff = parseInt('0', 10);
	var totMatCredBF = parseInt('0', 10);
	var totMatCredUtilCurrYr = parseInt('0', 10);
	var totBalMATCredCF = parseInt('0', 10);
	var countBf = 0;

	for (var i = 0; i < allInputTags.length; i++) {

		if (allInputTags[i].name.match("matCredGross$")) {
			countBf++;
			if ((parseInt(coalesce(allInputTags[i].value), 10) - parseInt(
					coalesce(allInputTags[i + 1].value), 10)) > 0
					&& countBf < 13) {
				allInputTags[i + 2].value = parseInt(
						coalesce(allInputTags[i].value), 10)
						- parseInt(coalesce(allInputTags[i + 1].value), 10);
			} else {
				allInputTags[i + 2].value = parseInt('0', 10);
			}

			if (((parseInt(coalesce(allInputTags[i + 2].value), 10) - parseInt(
					coalesce(allInputTags[i + 3].value), 10))) > 0) {
				allInputTags[i + 4].value = parseInt(
						coalesce(allInputTags[i + 2].value), 10)
						- parseInt(coalesce(allInputTags[i + 3].value), 10);
			} else {
				allInputTags[i + 4].value = parseInt('0', 10);
			}
			totMatCredGross = eval(parseInt(totMatCredGross, 10)
					+ parseInt(coalesce(allInputTags[i].value), 10));
			totMatCredSetOff = eval(parseInt(totMatCredSetOff, 10)
					+ parseInt(coalesce(allInputTags[i + 1].value), 10));
			totMatCredBF = eval(parseInt(totMatCredBF, 10)
					+ parseInt(coalesce(allInputTags[i + 2].value), 10));
			totMatCredUtilCurrYr = eval(parseInt(totMatCredUtilCurrYr, 10)
					+ parseInt(coalesce(allInputTags[i + 3].value), 10));
			totBalMATCredCF = eval(parseInt(totBalMATCredCF, 10)
					+ parseInt(coalesce(allInputTags[i + 4].value), 10));

		}
	}
	totMatCredGross = totMatCredGross
			+ coalesceSetRet('scheduleMATC.mATCredGrossCurAY');
	var matCredGross201516 = document
			.getElementsByName('scheduleMATC.mATCredGrossCurAY')[0].value;
	document.getElementsByName('scheduleMATC.balMATCredCFCurAY')[0].value = matCredGross201516;
	document.getElementsByName('scheduleMATC.totMatCredGross')[0].value = totMatCredGross;
	document.getElementsByName('scheduleMATC.totMatCredSetOff')[0].value = totMatCredSetOff;
	document.getElementsByName('scheduleMATC.totMatCredBF')[0].value = totMatCredBF;
	document.getElementsByName('scheduleMATC.totMatCredUtilCurrYr')[0].value = totMatCredUtilCurrYr;
	document.getElementsByName('scheduleMATC.totBalMATCredCF')[0].value = eval(parseInt(
			totBalMATCredCF, 10)
			+ parseInt(coalesce(matCredGross201516, 10)));

	document.getElementsByName('scheduleMATC.amtTaxCredUs115JAA')[0].value = totMatCredUtilCurrYr;

	document.getElementsByName('scheduleMATC.amtMATLiabAllAssYrAvailSubseqYr')[0].value = eval(parseInt(
			totBalMATCredCF, 10)
			+ parseInt(coalesce(matCredGross201516, 10)));

}

function checkMATCValue(minValueName, maxValueName, type) {

	var minValue = minValueName.value;
	var maxValue = $('[name="' + maxValueName + '"]')[0].value;

	var taxValue = $('[name="scheduleMATC.amtOfTaxWithCred"]')[0].value;

	if (eval(minValue) > eval(maxValue) && type == 'GM') {

		minValueName.value = 0;

		addError(
				minValueName,
				'The amount set off cannot be greater than MAT credit available',
				true);

	}

	if (eval(minValue) > eval(maxValue) && type == 'GMC') {

		minValueName.value = 0;
		addError(
				minValueName,
				'The amount of credit utilized cannot be greater than amount of credit brought forward',
				true);

	}

	if (eval(minValue) > eval(taxValue) && type == 'GMC') {

		minValueName.value = 0;
		addError(
				minValueName,
				'The amount of credit utilized caanot be greater than amount of tax against which credit is available',
				true);

	}

	calcITR6();

}

function copySourceDestn(source, destination) {

	document.getElementsByName(destination)[0].value = document
			.getElementsByName(source)[0].value;
}

function calcTotal80IA() {

	var grossTotalIncome = coalesce(document
			.getElementsByName('partBTI.grossTotalIncome')[0].value);

	if (parseInt(grossTotalIncome, 10) < 0) {

		grossTotalIncome = '';

	}

	var table = document.getElementById('taxDed80IA4iID');
	var rowCount = table.rows.length;
	var sumTotal80IAa = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IAa = eval(parseInt(sumTotal80IAa, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IAa['
								+ i + ']'), 10));
	}

	var table = document.getElementById('taxDed80IA4iiID');
	var rowCount = table.rows.length;
	var sumTotal80IAb = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IAb = eval(parseInt(sumTotal80IAb, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IAb['
								+ i + ']'), 10));
	}

	var table = document.getElementById('taxDed80IA4iiiID');
	var rowCount = table.rows.length;
	var sumTotal80IAc = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IAc = eval(parseInt(sumTotal80IAc, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IAc['
								+ i + ']'), 10));
	}

	var table = document.getElementById('taxDed80IA4ivID');
	var rowCount = table.rows.length;
	var sumTotal80IAd = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IAd = eval(parseInt(sumTotal80IAd, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IAd['
								+ i + ']'), 10));
	}

	var table = document.getElementById('taxDed80IA4vID');
	var rowCount = table.rows.length;
	var sumTotal80IAe = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IAe = eval(parseInt(sumTotal80IAe, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IAe['
								+ i + ']'), 10));
	}

	document.getElementsByName('schedule80IA.totSchedule80IA')[0].value = sumTotal80IAa
			+ sumTotal80IAb + sumTotal80IAc + sumTotal80IAd + sumTotal80IAe;
}

function calcTotal80IB() {

	var grossTotalIncome = coalesce(document
			.getElementsByName('partBTI.grossTotalIncome')[0].value);

	if (parseInt(grossTotalIncome, 10) < 0) {

		grossTotalIncome = '';

	}

	var table = document.getElementById('deductJKLocUs80IB4');
	var rowCount = table.rows.length;
	var sumTotal80IBa = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBa = eval(parseInt(sumTotal80IBa, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBa['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductBackStatesUs80IB4');
	var rowCount = table.rows.length;
	var sumTotal80IBb = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBb = eval(parseInt(sumTotal80IBb, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBb['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductBackDisttUs80IB5');
	var rowCount = table.rows.length;
	var sumTotal80IBc = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBc = eval(parseInt(sumTotal80IBc, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBc['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductMultiplexUs80IB7A');
	var rowCount = table.rows.length;
	var sumTotal80IBd = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBd = eval(parseInt(sumTotal80IBd, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBd['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductConvCentUs80IB7B');
	var rowCount = table.rows.length;
	var sumTotal80IBe = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBe = eval(parseInt(sumTotal80IBe, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBe['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductConvCentUs80IB8A');
	var rowCount = table.rows.length;
	var sumTotal80IBf = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBf = eval(parseInt(sumTotal80IBf, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBf['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductMinOilUs80IB9');
	var rowCount = table.rows.length;
	var sumTotal80IBg = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBg = eval(parseInt(sumTotal80IBg, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBg['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductHousUs80IB10');
	var rowCount = table.rows.length;
	var sumTotal80IBh = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBh = eval(parseInt(sumTotal80IBh, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBh['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductColdChainUs80IB11');
	var rowCount = table.rows.length;
	var sumTotal80IBi = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBi = eval(parseInt(sumTotal80IBi, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBi['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductFruitVegUs80IB11A');
	var rowCount = table.rows.length;
	var sumTotal80IBj = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBj = eval(parseInt(sumTotal80IBj, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBj['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductFoodGrainUs80IB11A');
	var rowCount = table.rows.length;
	var sumTotal80IBk = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBk = eval(parseInt(sumTotal80IBk, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBk['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductRurHospUs80IB11B');
	var rowCount = table.rows.length;
	var sumTotal80IBl = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBl = eval(parseInt(sumTotal80IBl, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBl['
								+ i + ']'), 10));
	}

	var table = document.getElementById('deductHospAnyAreaUs80IB11C');
	var rowCount = table.rows.length;
	var sumTotal80IBm = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80IBm = eval(parseInt(sumTotal80IBm, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80IBm['
								+ i + ']'), 10));
	}

	document.getElementsByName('schedule80IB.totSchedule80IB')[0].value = sumTotal80IBa
			+ sumTotal80IBb
			+ sumTotal80IBc
			+ sumTotal80IBd
			+ sumTotal80IBe
			+ sumTotal80IBf
			+ sumTotal80IBg
			+ sumTotal80IBh
			+ sumTotal80IBi
			+ sumTotal80IBj + sumTotal80IBk + sumTotal80IBl + sumTotal80IBm;

}

function calcTotal80IC() {
	var grossTotalIncome = coalesce(document
			.getElementsByName('partBTI.grossTotalIncome')[0].value);

	if (parseInt(grossTotalIncome, 10) < 0) {

		grossTotalIncome = '';

	}

	var table = document.getElementById('deductInSikkim');
	var rowCount = table.rows.length;
	var sumTotal80ICa = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICa = eval(parseInt(sumTotal80ICa, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICa['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInHimachalP');
	var rowCount = table.rows.length;
	var sumTotal80ICb = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICb = eval(parseInt(sumTotal80ICb, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICb['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInUttaranchal');
	var rowCount = table.rows.length;
	var sumTotal80ICc = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICc = eval(parseInt(sumTotal80ICc, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICc['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInNorthEastAassam');
	var rowCount = table.rows.length;
	var sumTotal80ICda = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICda = eval(parseInt(sumTotal80ICda, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICda['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInNorthEastArunachalPradesh');
	var rowCount = table.rows.length;
	var sumTotal80ICdb = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICdb = eval(parseInt(sumTotal80ICdb, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICdb['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInNorthEastManipur');
	var rowCount = table.rows.length;
	var sumTotal80ICdc = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICdc = eval(parseInt(sumTotal80ICdc, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICdc['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInNorthEastMizoram');
	var rowCount = table.rows.length;
	var sumTotal80ICdd = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICdd = eval(parseInt(sumTotal80ICdd, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICdd['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInNorthEastMeghalaya');
	var rowCount = table.rows.length;
	var sumTotal80ICde = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICde = eval(parseInt(sumTotal80ICde, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICde['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInNorthEastNagaland');
	var rowCount = table.rows.length;
	var sumTotal80ICdf = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICdf = eval(parseInt(sumTotal80ICdf, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICdf['
								+ i + ']'), 10));
	}
	var table = document.getElementById('deductInNorthEastTripura');
	var rowCount = table.rows.length;
	var sumTotal80ICdg = 0;
	for (var i = 0; i < rowCount - 2; i++) {
		sumTotal80ICdg = eval(parseInt(sumTotal80ICdg, 10)
				+ parseInt(
						coalesceSetRet('schedule80.dedUs80Detail.dedFromUndertaking.80ICdg['
								+ i + ']'), 10));
	}

	var totDeductInNorthEast = $('[name="schedule80IC.deductInNorthEast.totDeductInNorthEast"]')[0];

	totDeductInNorthEast.value = sumTotal80ICda + sumTotal80ICdb
			+ sumTotal80ICdc + sumTotal80ICdd + sumTotal80ICde + sumTotal80ICdf
			+ sumTotal80ICdg;

	document.getElementsByName('schedule80IC.totSchedule80IC')[0].value = sumTotal80ICa
			+ sumTotal80ICb
			+ sumTotal80ICc
			+ sumTotal80ICda
			+ sumTotal80ICdb
			+ sumTotal80ICdc
			+ sumTotal80ICdd
			+ sumTotal80ICde
			+ sumTotal80ICdf
			+ sumTotal80ICdg;
}

function calcTotal80GDeductions(tableId, noOfRow, last, amt5BBC, amt5Ea) {
	try {

		var grossTotalIncome = coalesce(document
				.getElementsByName('partBTI.grossTotalIncome')[0].value);
		var incChrgable = coalesce(document
				.getElementsByName('partBTI.incChargeTaxSplRate111A112')[0].value);
		var ded10A = coalesce(document
				.getElementsByName('partBTI.deductionsUnder10Aor10AA')[0].value);
		if (parseInt(grossTotalIncome, 10) < 0) {

			grossTotalIncome = '0';

		}

		var residue50Perc;
		var qualifyingLimit;
		var scheduleVIA = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.totalChapVIADeductions')[0];
		scheduleVIA.value = coalesce(scheduleVIA.value);
		var schedule80G = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80G')[0];
		schedule80G.value = coalesce(schedule80G.value);
		var schedule80GGC = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80GGC')[0];
		schedule80GGC.value = coalesce(schedule80GGC.value);
		var usr80GGC = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80GGC')[0];
		usr80GGC.value = coalesce(usr80GGC.value);
		var deductionsSysTotal = 0;

		deductionsSysTotal = zeroOrMore(eval(parseInt(scheduleVIA.value, 10)
				- parseInt(schedule80G.value, 10)
				- parseInt(schedule80GGC.value, 10)
				+ parseInt(usr80GGC.value, 10)));

		if (parseInt(deductionsSysTotal, 10) > parseInt(grossTotalIncome, 10)) {

			deductionsSysTotal = grossTotalIncome;
		}

		var gtiLimit = eval(parseInt(coalesce(grossTotalIncome), 10)
				- parseInt(coalesce(incChrgable), 10)
				- parseInt(coalesce(ded10A), 10));

		if (gtiLimit < 0) {
			gtiLimit = 0;
		}
		var tab = document.getElementById(tableId);
		var allInputTags = tab.getElementsByTagName('input');

		if (tableId == 'ded100PerWithoutQual') {
			for (var i = 0; i < allInputTags.length; i++) {
				if (allInputTags[i].name.match("eligibleDonationAmt$")) {
					if (parseInt(allInputTags[i - 3].value, 10) > parseInt(
							2000, 10)) {
						allInputTags[i].value = coalesce(allInputTags[i - 2].value);
					} else {
						allInputTags[i].value = eval(parseInt(coalesce(allInputTags[i - 2].value))
								+ parseInt(coalesce(allInputTags[i - 3].value)));
					}
					if (parseInt(allInputTags[i].value, 10) > parseInt(
							gtiLimit, 10)) {
						allInputTags[i].value = gtiLimit;
					}
				}
			}
			calcTableTotEligAmt('ded100PerWithoutQual', qualifyingLimit,
					residue50Perc);
		}

		if (tableId == 'ded50WithoutQual') {
			for (var i = 0; i < allInputTags.length; i++) {
				if (allInputTags[i].name.match("eligibleDonationAmt$")) {

					if (parseInt(allInputTags[i - 3].value, 10) > parseInt(
							2000, 10)) {
						allInputTags[i].value = parseInt(
								Math
										.round(coalesce(allInputTags[i - 2].value) / 2),
								10);
					} else {
						allInputTags[i].value = eval(parseInt(
								Math
										.round(coalesce(allInputTags[i - 2].value) / 2),
								10)
								+ parseInt(
										Math
												.round(coalesce(allInputTags[i - 3].value) / 2),
										10));
					}
					if (parseInt(allInputTags[i].value, 10) > parseInt(
							gtiLimit, 10)) {
						allInputTags[i].value = gtiLimit;
					}

				}
			}
			calcTableTotEligAmt('ded50WithoutQual', qualifyingLimit,
					residue50Perc);
		}

		// Net Qualifyin Limit calculation

		var adjstGTI;
		if (grossTotalIncome == scheduleVIA.value) {
			adjstGTI = 0;
		} else {

			adjstGTI = eval(parseInt(grossTotalIncome, 10))
					- eval(parseInt(deductionsSysTotal, 10))
					- eval(incChrgable)
					/*+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[0].splRateInc')[0].value)*/
					+ parseInt(coalesce(amt5BBC));
		}

		qualifyingLimit = eval(parseInt(adjstGTI, 10) * parseFloat('0.10'));

		if (parseInt(qualifyingLimit, 10) < 0) {
			qualifyingLimit = '0';
		}
		var totEligAmtTableC = document
				.getElementsByName('schedule80G.don100PercentApprReqd.totEligibleDon100PercentApprReqd')[0];

		if (tableId == 'ded100Qual') {
			for (var i = 0; i < allInputTags.length; i++) {
				if (allInputTags[i].name.match("eligibleDonationAmt$")) {
					if (parseInt(allInputTags[i - 3].value, 10) > parseInt(
							2000, 10)) {
						allInputTags[i].value = parseInt(Math
								.round(coalesce(allInputTags[i - 2].value)), 10);

					} else {
						allInputTags[i].value = eval(parseInt(Math
								.round(coalesce(allInputTags[i - 2].value)), 10)
								+ parseInt(
										Math
												.round(coalesce(allInputTags[i - 3].value)),
										10));

					}
					if (parseInt(allInputTags[i].value, 10) > parseInt(
							qualifyingLimit, 10)) {
						allInputTags[i].value = parseInt(qualifyingLimit, 10);

					}

				}
			}
			calcTableTotEligAmt('ded100Qual', qualifyingLimit, residue50Perc);
		}

		var residue;
		if (parseInt(qualifyingLimit, 10) > parseInt(
				coalesce(totEligAmtTableC.value), 10)) {

			residue = eval(parseInt(qualifyingLimit, 10))
					- eval(parseInt(totEligAmtTableC.value, 10));

		} else {

			residue = parseInt('0', 10);
		}

		residue50Perc = eval(parseInt(residue, 10) * parseFloat('0.50'));

		if (tableId == 'ded50WithQual') {
			for (var i = 0; i < allInputTags.length; i++) {
				if (allInputTags[i].name.match("eligibleDonationAmt$")) {
					if (parseInt(allInputTags[i - 3].value, 10) > parseInt(
							2000, 10)) {
						allInputTags[i].value = parseInt(
								Math
										.round(coalesce(allInputTags[i - 2].value) / 2),
								10);
					} else {
						allInputTags[i].value = eval(parseInt(
								Math
										.round(coalesce(allInputTags[i - 2].value) / 2),
								10)
								+ parseInt(
										Math
												.round(coalesce(allInputTags[i - 3].value) / 2),
										10));
					}
					if (parseInt(allInputTags[i].value, 10) > parseInt(
							residue50Perc, 10)) {
						allInputTags[i].value = parseInt(residue50Perc, 10);

					}
				}
			}
			calcTableTotEligAmt('ded50WithQual', qualifyingLimit, residue50Perc);
		}

	} catch (e) {
		alert('ss :- ' + e);
		alert('Uma :- ' + e.stack);
	}

}

function calcTableTotEligAmt(tableId, qualifyingLimit, residue50Perc) {
	try {

		var tab = document.getElementById(tableId);
		var allInputTags = tab.getElementsByTagName('input');
		var sumOfAll = parseInt('0', 10);
		var sumOfAlluserEntredValue = parseInt('0', 10);
		for (var i = 0; i < allInputTags.length; i++) {
			if (allInputTags[i].name.match("eligibleDonationAmt$")) {
				sumOfAll = eval(parseInt(sumOfAll, 10)
						+ parseInt(allInputTags[i].value, 10));
				sumOfAlluserEntredValue = eval(parseInt(
						sumOfAlluserEntredValue, 10)
						+ parseInt(coalesce(allInputTags[i - 1].value), 10));
			}
		}

		var grossTotalIncome = coalesce(document
				.getElementsByName('partBTI.grossTotalIncome')[0].value);

		if (parseInt(grossTotalIncome, 10) < 0) {

			grossTotalIncome = '0';

		}

		if (parseInt(sumOfAll, 10) > parseInt(grossTotalIncome, 10)) {
			sumOfAll = grossTotalIncome;
		}

		if (tableId == 'ded100PerWithoutQual') {
			var temp1 = document
					.getElementsByName('schedule80G.don100Percent.totEligibleDon100Percent')[0];
			var temp2 = document
					.getElementsByName('schedule80G.don100Percent.totDon100Percent')[0];

			temp1.value = parseInt(sumOfAll, 10);

			temp2.value = parseInt(sumOfAlluserEntredValue, 10);

		} else if (tableId == 'ded50WithoutQual') {
			var temp1 = document
					.getElementsByName('schedule80G.don50PercentNoApprReqd.totEligibleDon50Percent')[0];
			var temp2 = document
					.getElementsByName('schedule80G.don50PercentNoApprReqd.totDon50PercentNoApprReqd')[0];
			temp1.value = parseInt(sumOfAll, 10);
			temp2.value = parseInt(sumOfAlluserEntredValue, 10);
		} else if (tableId == 'ded100Qual') {
			var temp1 = document
					.getElementsByName('schedule80G.don100PercentApprReqd.totEligibleDon100PercentApprReqd')[0];
			var temp2 = document
					.getElementsByName('schedule80G.don100PercentApprReqd.totDon100PercentApprReqd')[0];
			temp1.value = parseInt(sumOfAll, 10);
			temp2.value = parseInt(sumOfAlluserEntredValue, 10);

			if (parseInt(temp1.value, 10) > parseInt(qualifyingLimit, 10)) {

				temp1.value = parseInt(qualifyingLimit, 10);
				;
			}

		} else if (tableId == 'ded50WithQual') {

			var temp1 = document
					.getElementsByName('schedule80G.don50PercentApprReqd.totEligibleDon50PercentApprReqd')[0];
			var temp2 = document
					.getElementsByName('schedule80G.don50PercentApprReqd.totDon50PercentApprReqd')[0];

			temp1.value = parseInt(sumOfAll, 10);
			temp2.value = parseInt(sumOfAlluserEntredValue, 10);

			if (parseInt(temp1.value, 10) > parseInt(residue50Perc, 10)) {

				temp1.value = parseInt(residue50Perc, 10);
				;
			}

		}

		calcTotalDonations80G();
		calcEligbDonations80G();
	} catch (e) {
		// alert(e);
	}
}

function calcTotalDonations80G() {

	var tot80GAuserEntrd = document
			.getElementsByName('schedule80G.don100Percent.totDon100Percent')[0];
	tot80GAuserEntrd.value = coalesce(tot80GAuserEntrd.value);
	var tot80GBuserEntrd = document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totDon50PercentNoApprReqd')[0];
	tot80GBuserEntrd.value = coalesce(tot80GBuserEntrd.value);
	var tot80GCuserEntrd = document
			.getElementsByName('schedule80G.don100PercentApprReqd.totDon100PercentApprReqd')[0];
	tot80GCuserEntrd.value = coalesce(tot80GCuserEntrd.value);
	var tot80GDuserEntrd = document
			.getElementsByName('schedule80G.don50PercentApprReqd.totDon50PercentApprReqd')[0];
	tot80GDuserEntrd.value = coalesce(tot80GDuserEntrd.value);
	var tot80GDonuserEntrd = document
			.getElementsByName('schedule80G.totalDonationsUs80G')[0];
	tot80GDonuserEntrd.value = coalesce(tot80GDonuserEntrd.value);

	tot80GDonuserEntrd.value = eval(tot80GAuserEntrd.value)
			+ eval(tot80GBuserEntrd.value) + eval(tot80GCuserEntrd.value)
			+ eval(tot80GDuserEntrd.value);

}

function calcEligbDonations80G() {
	var grossTotalIncome = coalesce(document
			.getElementsByName('partBTI.grossTotalIncome')[0].value);
	var incChrgable = coalesce(document
			.getElementsByName('partBTI.incChargeTaxSplRate111A112')[0].value);
	var ded10A = coalesce(document
			.getElementsByName('partBTI.deductionsUnder10Aor10AA')[0].value);
	var gtiLimit = eval(parseInt(coalesce(grossTotalIncome), 10)
			- parseInt(coalesce(incChrgable), 10)
			- parseInt(coalesce(ded10A), 10));
	var tot80GAelig = document
			.getElementsByName('schedule80G.don100Percent.totEligibleDon100Percent')[0];
	tot80GAelig.value = coalesce(tot80GAelig.value);
	var tot80GBelig = document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totEligibleDon50Percent')[0];
	tot80GBelig.value = coalesce(tot80GBelig.value);
	var tot80GCelig = document
			.getElementsByName('schedule80G.don100PercentApprReqd.totEligibleDon100PercentApprReqd')[0];
	tot80GCelig.value = coalesce(tot80GCelig.value);
	var tot80GDelig = document
			.getElementsByName('schedule80G.don50PercentApprReqd.totEligibleDon50PercentApprReqd')[0];
	tot80GDelig.value = coalesce(tot80GDelig.value);
	var tot80GDonelig = document
			.getElementsByName('schedule80G.totalEligibleDonationsUs80G')[0];
	tot80GDonelig.value = coalesce(tot80GDonelig.value);

	tot80GDonelig.value = eval(tot80GAelig.value) + eval(tot80GBelig.value)
			+ eval(tot80GCelig.value) + eval(tot80GDelig.value);

	if (gtiLimit < 0) {
		gtiLimit = parseInt('0', 10);
	}
	if (tot80GDonelig.value > gtiLimit) {
		tot80GDonelig.value = gtiLimit;
	}
}

function scheduleVIAutoPopulate() {
	try {

		var grossTotalInc = document
				.getElementsByName('partBTI.grossTotalIncome')[0];
		grossTotalInc.value = coalesce(grossTotalInc.value);
		var incChrgable = document
				.getElementsByName('partBTI.incChargeTaxSplRate111A112')[0];
		incChrgable.value = coalesce(incChrgable.value);

		if (parseInt(grossTotalInc.value, 10) < 0) {

			grossTotalInc.value = '0';
		}

		if (parseInt(incChrgable.value, 10) < 0) {

			incChrgable.value = '0';
		}

		var dedVIA = document
				.getElementsByName('partBTI.deductionsUnderScheduleVIA')[0];
		dedVIA.value = coalesce(dedVIA.value);

		dedVIA.value = eval(parseInt(grossTotalInc.value, 10))
				- eval(parseInt(incChrgable.value, 10));

		var totalElgblAmt80G = document
				.getElementsByName('schedule80G.totalEligibleDonationsUs80G')[0];
		totalElgblAmt80G.value = coalesce(totalElgblAmt80G.value);
		var sec80G = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80G')[0];
		sec80G.value = coalesce(sec80G.value);
		var sec80GSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80G')[0];
		sec80GSysCal.value = coalesce(sec80GSysCal.value);

		if (parseInt(dedVIA.value, 10) < 0) {

			dedVIA.value = '0';

		}

		// 80G
		if (eval(parseInt(totalElgblAmt80G.value, 10) > parseInt(dedVIA.value,
				10))) {
			sec80GSysCal.value = parseInt(dedVIA.value, 10);
			sec80G.value = parseInt(dedVIA.value, 10);
		} else {
			sec80G.value = parseInt(totalElgblAmt80G.value, 10);
			sec80GSysCal.value = parseInt(totalElgblAmt80G.value, 10);
		}

		// 80IA

		var sch80IA = document
				.getElementsByName('schedule80IA.totSchedule80IA')[0];
		sch80IA.value = coalesce(sch80IA.value);
		var sec80IA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IA')[0];
		sec80IA.value = coalesce(sec80IA.value);
		var sec80IASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IA')[0];
		sec80IASysCal.value = coalesce(sec80IASysCal.value);

		sec80IA.value = parseInt(sch80IA.value, 10);
		sec80IASysCal.value = parseInt(sch80IA.value, 10);

		// 80IB
		var sch80IB = document
				.getElementsByName('schedule80IB.totSchedule80IB')[0];
		sch80IB.value = coalesce(sch80IB.value);
		var sec80IB = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IB')[0];
		sec80IB.value = coalesce(sec80IB.value);
		var sec80IBSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IB')[0];
		sec80IBSysCal.value = coalesce(sec80IBSysCal.value);
		sec80IB.value = parseInt(sch80IB.value, 10);
		sec80IBSysCal.value = parseInt(sch80IB.value, 10);

		// 80IC
		var sch80IC = document
				.getElementsByName('schedule80IC.totSchedule80IC')[0];
		sch80IC.value = coalesce(sch80IC.value);
		var sec80IC = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IC')[0];
		sec80IC.value = coalesce(sec80IC.value);
		var sec80ICSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IC')[0];
		sec80ICSysCal.value = coalesce(sec80ICSysCal.value);
		sec80IC.value = parseInt(sch80IC.value, 10);
		sec80ICSysCal.value = parseInt(sch80IC.value, 10);

	} catch (e) {
		// alert(e);
	}
}

function caclDedSchVIA() {
	try {

		scheduleVIAutoPopulate();
		disableSch80();
		disableChapterVIA();

		
		
		
		var grossTotInc = document
				.getElementsByName('partBTI.grossTotalIncome')[0];
		var incChrgable = document
				.getElementsByName('partBTI.incChargeTaxSplRate111A112')[0];
		var deductionsUnder10Aor10AA = document
				.getElementsByName('partBTI.deductionsUnder10Aor10AA')[0];

		if (parseInt(grossTotInc.value, 10) < 0) {

			grossTotInc.value = '0';
		}

		if (parseInt(incChrgable.value, 10) < 0) {

			incChrgable.value = '0';
		}

		var gtiLimit = eval(parseInt(coalesce(grossTotInc.value), 10)
				- parseInt(coalesce(incChrgable.value), 10));

		if (gtiLimit < 0) {
			gtiLimit = 0;
		}

		var profGainSpecifiedBus = document
				.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
		var gtiLimitC = zeroOrMore(parseInt(coalesce(gtiLimit), 10)
				- parseInt(coalesce(profGainSpecifiedBus.value), 10));

		var totalElgblAmt80G = document
				.getElementsByName('schedule80G.totalEligibleDonationsUs80G')[0];
		totalElgblAmt80G.value = coalesce(totalElgblAmt80G.value);
		var sec80G = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80G')[0];
		sec80G.value = coalesce(sec80G.value);
		var sec80GSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80G')[0];
		sec80GSysCal.value = coalesce(sec80GSysCal.value);

		var sec80GGA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80GGA')[0];
		sec80GGA.value = coalesce(document
				.getElementsByName('schedule80GGA.totalDonationsUs80GGA')[0].value);
		var sec80GGASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80GGA')[0];
	

		var sec80GGB = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80GGB')[0];
		sec80GGB.value = coalesce(sec80GGB.value);
		var sec80GGBSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80GGB')[0];
		sec80GGBSysCal.value = coalesce(sec80GGBSysCal.value);

		var sec80GGC = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80GGC')[0];
		sec80GGC.value = coalesce(sec80GGC.value);
		var sec80GGCSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80GGC')[0];
		sec80GGCSysCal.value = coalesce(sec80GGCSysCal.value);

		var sch80IA = document
				.getElementsByName('schedule80IA.totSchedule80IA')[0];
		sch80IA.value = coalesce(sch80IA.value);
		var sec80IA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IA')[0];
		sec80IA.value = coalesce(sec80IA.value);
		var sec80IASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IA')[0];
		sec80IASysCal.value = coalesce(sec80IASysCal.value);

		var sec80IAB = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAB')[0];
		sec80IAB.value = coalesce(sec80IAB.value);
		var sec80IABSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IAB')[0];
		sec80IABSysCal.value = coalesce(sec80IABSysCal.value);

		var sec80IAC = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAC')[0];
		sec80IAC.value = coalesce(sec80IAC.value);
		var sec80IACSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IAC')[0];
		sec80IACSysCal.value = coalesce(sec80IACSysCal.value);

		var sec80IBA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IBA')[0];
		sec80IBA.value = coalesce(sec80IBA.value);
		var sec80IBASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IBA')[0];
		sec80IBASysCal.value = coalesce(sec80IBASysCal.value);

		var sch80IB = document
				.getElementsByName('schedule80IB.totSchedule80IB')[0];
		sch80IB.value = coalesce(sch80IB.value);
		var sec80IB = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IB')[0];
		sec80IB.value = coalesce(sec80IB.value);
		var sec80IBSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IB')[0];
		sec80IBSysCal.value = coalesce(sec80IBSysCal.value);

		var sch80IC = document
				.getElementsByName('schedule80IC.totSchedule80IC')[0];
		sch80IC.value = coalesce(sch80IC.value);
		var sec80IC = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IC')[0];
		sec80IC.value = coalesce(sec80IC.value);
		var sec80ICSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80IC')[0];
		sec80ICSysCal.value = coalesce(sec80ICSysCal.value);

		var sec80JJA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJA')[0];
		sec80JJA.value = coalesce(sec80JJA.value);
		var sec80JJASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80JJA')[0];
		sec80JJASysCal.value = coalesce(sec80JJASysCal.value);

		var sec80JJAA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJAA')[0];
		sec80JJAA.value = coalesce(sec80JJAA.value);
		var sec80JJAASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80JJAA')[0];
		sec80JJAASysCal.value = coalesce(sec80JJAASysCal.value);

		var sec80LA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0];
		sec80LA.value = coalesce(sec80LA.value);
		var sec80LASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80LA')[0];
		sec80LASysCal.value = coalesce(sec80LASysCal.value);

				
		var sec80LA1A = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA1A')[0];
		sec80LA1A.value = coalesce(sec80LA1A.value);
		var sec80LA1ASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80LA1A')[0];
		sec80LA1ASysCal.value = coalesce(sec80LA1ASysCal.value);


		var sec80PA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0];
		sec80PA.value = coalesce(sec80PA.value);
		var sec80PASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.section80PA')[0];
		sec80PASysCal.value = coalesce(sec80PASysCal.value);

		var totalPartB = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.totalDeductionPartb')[0];
		var totalPartBSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.totalDeductionPartb')[0];

		var totalPartC = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.totalDeductionPartC')[0];
		var totalPartCSysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.totalDeductionPartC')[0];

		var totalDedVIA = document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.totalChapVIADeductions')[0];
		totalDedVIA.value = coalesce(totalDedVIA.value);
		var totalDedVIASysCal = document
				.getElementsByName('scheduleVIA.deductUndChapVIA.totalChapVIADeductions')[0];
		totalDedVIASysCal.value = coalesce(totalDedVIASysCal.value);
		// Autopopulate 80G
		sec80G.value = totalElgblAmt80G.value;
		sec80GSysCal.value = parseInt(sec80G.value, 10);
		// 80GGB
		sec80GGBSysCal.value = parseInt(sec80GGB.value, 10);

	

if (eval(
		document.getElementsByName('partBTI.profBusGain.totProfBusGain')[0].value,
		10) > 0) {
			sec80GGASysCal.value = 0;

		} else {
			
	sec80GGASysCal.value = coalesce(document
					.getElementsByName('schedule80GGA.totalEligibleDonationsUs80GGA')[0].value);	
			}

		
		// 80GGC
			sec80GGCSysCal.value = parseInt(sec80GGC.value, 10);
		// 80IAB
			sec80IABSysCal.value = parseInt(sec80IAB.value, 10);
		// 80IAC
			sec80IACSysCal.value = parseInt(sec80IAC.value, 10);
		// 80IBA
			sec80IBASysCal.value = parseInt(sec80IBA.value, 10);
		// Autopoulate 80IA
			sec80IA.value = parseInt(coalesce(sch80IA.value), 10);
			sec80IASysCal.value = parseInt(coalesce(sch80IA.value), 10);
		// Autopoulate 80IB
			sec80IB.value = parseInt(coalesce(sch80IB.value), 10);
			sec80IBSysCal.value = parseInt(coalesce(sch80IB.value), 10);
		// Autopoulate 80IC
			sec80IC.value = parseInt(coalesce(sch80IC.value), 10);
			sec80ICSysCal.value = parseInt(coalesce(sch80IC.value), 10);
		// 80JJA
			sec80JJASysCal.value = parseInt(sec80JJA.value, 10);
		// 80JJAA
			sec80JJAASysCal.value = parseInt(sec80JJAA.value, 10);
		//80LA
			sec80LASysCal.value = parseInt(sec80LA.value, 10);
		//80LA1A
			sec80LA1ASysCal.value = parseInt(sec80LA1A.value, 10);
		// 80PA
			sec80PASysCal.value = parseInt(sec80PA.value, 10);
		//Total Deduction under Part B (a + b + c + d)
			totalPartB.value = eval(parseInt(sec80G.value, 10))
				+ eval(parseInt(sec80GGA.value, 10))
				+ eval(parseInt(sec80GGB.value, 10))
				+ eval(parseInt(sec80GGC.value, 10));

		var totalPartBSysCalTemp = eval(parseInt(sec80GSysCal.value, 10))
				+ eval(parseInt(sec80GGASysCal.value, 10))
				+ eval(parseInt(sec80GGBSysCal.value, 10))
				+ eval(parseInt(sec80GGCSysCal.value, 10));

		var BFLAi5 = document
				.getElementsByName('scheduleBFLA.hp.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
		var BFLAii5 = document
				.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
		var BFLAiv5 = document
				.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
		var BFLAv5 = document
				.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
		var BFLAviii5 = document
				.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
		var BFLAxiii5 = document
				.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
		var BFLAxiv5 = document
				.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];

		var BFLATotalFields = eval(parseInt(BFLAi5.value, 10))
				+ eval(parseInt(BFLAii5.value, 10))
				+ eval(parseInt(BFLAiv5.value, 10))
				+ eval(parseInt(BFLAv5.value, 10))
				+ eval(parseInt(BFLAviii5.value, 10))
				+ eval(parseInt(BFLAxiii5.value, 10))
				+ eval(parseInt(BFLAxiv5.value, 10));

		if (eval(parseInt(totalPartBSysCalTemp, 10) > parseInt(BFLATotalFields,
				10))) {
			totalPartBSysCal.value = parseInt(BFLATotalFields, 10);
		} else {
			totalPartBSysCal.value = parseInt(totalPartBSysCalTemp, 10);
		}

	//Total Deduction under Part C (total of e to o)	
		totalPartC.value = eval(parseInt(sec80IA.value, 10))
				+ eval(parseInt(sec80IAB.value, 10))
				+ eval(parseInt(sec80IAC.value, 10))
				+ eval(parseInt(sec80IBA.value, 10))
				+ eval(parseInt(sec80IB.value, 10))
				+ eval(parseInt(sec80IC.value, 10))
				+ eval(parseInt(sec80JJA.value, 10))
				+ eval(parseInt(sec80JJAA.value, 10))
				+ eval(parseInt(sec80LA.value, 10))
				+ eval(parseInt(sec80LA1A.value, 10))
				+ eval(parseInt(sec80PA.value, 10));

	var	totalPartCSysCalTemp = eval(parseInt(sec80IASysCal.value, 10))
						+ eval(parseInt(sec80IABSysCal.value, 10))
						+ eval(parseInt(sec80IACSysCal.value, 10))
						+ eval(parseInt(sec80IBASysCal.value, 10))
						+ eval(parseInt(sec80IBSysCal.value, 10))
						+ eval(parseInt(sec80ICSysCal.value, 10))
						+ eval(parseInt(sec80JJASysCal.value, 10))
						+ eval(parseInt(sec80JJAASysCal.value, 10))
						+ eval(parseInt(sec80LASysCal.value, 10))
						+ eval(parseInt(sec80LA1ASysCal.value, 10))
						+ eval(parseInt(sec80PASysCal.value, 10));
	
	
	var BFLAii5BP = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses'),
			10)
			- parseInt(
					coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44AE'),
					10)));
					
	
	
	
	
					
	if (eval(parseInt(totalPartCSysCalTemp, 10) > parseInt(BFLAii5BP,
			10))) {
		totalPartCSysCal.value = parseInt(BFLAii5BP, 10);
	} else {
		totalPartCSysCal.value = parseInt(totalPartCSysCalTemp, 10);
	}
	
		
		//Total deductions under Chapter VI-A (1 + 2)
		totalDedVIA.value = eval(parseInt(totalPartB.value, 10))
				+ eval(parseInt(totalPartC.value, 10));
	var	totalDedVIASysCalTemp = eval(parseInt(totalPartBSysCal.value, 10))
				+ eval(parseInt(totalPartCSysCal.value, 10));


	if (eval(parseInt(totalDedVIASysCalTemp, 10) > parseInt(BFLATotalFields,
			10))) {
		totalDedVIASysCal.value = parseInt(BFLATotalFields, 10);
	} else {
		totalDedVIASysCal.value = parseInt(totalDedVIASysCalTemp, 10);
	}
	
	
		//	totalDedVIASysCal.value = parseInt(totalDedVIASysCal.value, 10);
	
		calculatePartBTI_second();
	} catch (e) {
		// alert(e);
	}
}



function getExemption_SI(){
	var age	= calcAgeCommon(document.getElementsByName('partAGEN1.orgFirmInfo.dateOFFormOrIncorp')[0]);



	var resStatus = document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0]; //RES
	var taxPayer = document.getElementsByName('partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
	if(taxPayer.value=='I' && age > 59 && age < 80 && (resStatus.value=='RES')){


		return 300000;
	}else if(taxPayer.value=='I' && age >= 80 && (resStatus.value=='RES')){


		return 500000;
	}else if( (taxPayer.value=='I' || taxPayer.value=='H') && (resStatus.value=='RES')){
		return 250000;

	}else{
		return 0;

	}

}

function calcScheduleSI() {
	try {
		var secCode1A = document
				.getElementsByName('scheduleSI.splCodeRateTax[1].secCode')[0];
		secCode1A.value = coalesceString(secCode1A.value);
		var splRatePercent1A = document
				.getElementsByName('scheduleSI.splCodeRateTax[1].splRatePercent')[0];
		splRatePercent1A.value = coalesce(splRatePercent1A.value);
		var splRateInc1A = document
				.getElementsByName('scheduleSI.splCodeRateTax[1].splRateInc')[0];
		splRateInc1A.value = coalesce(splRateInc1A.value);
		var taxableInc1A = document
				.getElementsByName('scheduleSI.splCodeRateTax[1].taxableInc')[0];
		taxableInc1A.value = coalesce(taxableInc1A.value);
		var splRateIncTax1A = document
				.getElementsByName('scheduleSI.splCodeRateTax[1].splRateIncTax')[0];
		splRateIncTax1A.value = coalesce(splRateIncTax1A.value);

		var secCode22 = document
				.getElementsByName('scheduleSI.splCodeRateTax[3].secCode')[0];
		secCode22.value = coalesceString(secCode22.value);
		var splRatePercent22 = document
				.getElementsByName('scheduleSI.splCodeRateTax[3].splRatePercent')[0];
		splRatePercent22.value = coalesce(splRatePercent22.value);
		var splRateInc22 = document
				.getElementsByName('scheduleSI.splCodeRateTax[3].splRateInc')[0];
		splRateInc22.value = coalesce(splRateInc22.value);
		var taxableInc22 = document
				.getElementsByName('scheduleSI.splCodeRateTax[3].taxableInc')[0];
		taxableInc22.value = coalesce(taxableInc22.value);
		var splRateIncTax22 = document
				.getElementsByName('scheduleSI.splCodeRateTax[3].splRateIncTax')[0];
		splRateIncTax22.value = coalesce(splRateIncTax22.value);

		var secCode21ciii = document
				.getElementsByName('scheduleSI.splCodeRateTax[4].secCode')[0];
		secCode21ciii.value = coalesceString(secCode21ciii.value);
		var splRatePercent21ciii = document
				.getElementsByName('scheduleSI.splCodeRateTax[4].splRatePercent')[0];
		splRatePercent21ciii.value = coalesce(splRatePercent21ciii.value);
		var splRateInc21ciii = document
				.getElementsByName('scheduleSI.splCodeRateTax[4].splRateInc')[0];
		splRateInc21ciii.value = coalesce(splRateInc21ciii.value);
		var taxableInc21ciii = document
				.getElementsByName('scheduleSI.splCodeRateTax[4].taxableInc')[0];
		taxableInc21ciii.value = coalesce(taxableInc21ciii.value);
		var splRateIncTax21ciii = document
				.getElementsByName('scheduleSI.splCodeRateTax[4].splRateIncTax')[0];
		splRateIncTax21ciii.value = coalesce(splRateIncTax21ciii.value);

		var secCode21 = document
				.getElementsByName('scheduleSI.splCodeRateTax[2].secCode')[0];
		secCode21.value = coalesceString(secCode21.value);
		var splRatePercent21 = document
				.getElementsByName('scheduleSI.splCodeRateTax[2].splRatePercent')[0];
		splRatePercent21.value = coalesce(splRatePercent21.value);
		var splRateInc21 = document
				.getElementsByName('scheduleSI.splCodeRateTax[2].splRateInc')[0];
		splRateInc21.value = coalesce(splRateInc21.value);
		var taxableInc21 = document
				.getElementsByName('scheduleSI.splCodeRateTax[2].taxableInc')[0];
		taxableInc21.value = coalesce(taxableInc21.value);
		var splRateIncTax21 = document
				.getElementsByName('scheduleSI.splCodeRateTax[2].splRateIncTax')[0];
		splRateIncTax21.value = coalesce(splRateIncTax21.value);

		var secCode5BB = document
				.getElementsByName('scheduleSI.splCodeRateTax[6].secCode')[0];
		secCode5BB.value = coalesceString(secCode5BB.value);
		var splRatePercent5BB = document
				.getElementsByName('scheduleSI.splCodeRateTax[6].splRatePercent')[0];
		splRatePercent5BB.value = coalesce(splRatePercent5BB.value);
		var splRateInc5BB = document
				.getElementsByName('scheduleSI.splCodeRateTax[6].splRateInc')[0];
		splRateInc5BB.value = coalesce(splRateInc5BB.value);
		var taxableInc5BB = document
				.getElementsByName('scheduleSI.splCodeRateTax[6].taxableInc')[0];
		taxableInc5BB.value = coalesce(taxableInc5BB.value);
		var splRateIncTax5BB = document
				.getElementsByName('scheduleSI.splCodeRateTax[6].splRateIncTax')[0];
		splRateIncTax5BB.value = coalesce(splRateIncTax5BB.value);

	/*	var secCode1 = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].secCode')[0];
		secCode1.value = coalesceString(secCode1.value);
		var splRatePercent1 = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRatePercent')[0];
		splRatePercent1.value = coalesce(splRatePercent1.value);
		var splRateInc1 = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRateInc')[0];
		splRateInc1.value = coalesce(splRateInc1.value);
		var taxableInc1 = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].taxableInc')[0];
		var splRateIncTax1 = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRateIncTax')[0];*/

		var secCode5b = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].secCode')[0];
		secCode5b.value = coalesceString(secCode5b.value);
		var splRatePercent5b = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRatePercent')[0];
		splRatePercent5b.value = coalesce(splRatePercent5b.value);
		var splRateInc5b = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRateInc')[0];
		splRateInc5b.value = coalesce(splRateInc5b.value);
		var taxableInc5b = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].taxableInc')[0];
		taxableInc5b.value = coalesce(taxableInc5b.value);
		var splRateIncTax5b = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRateIncTax')[0];
		splRateIncTax5b.value = coalesce(splRateIncTax5b.value);

		var secCode112A = document
				.getElementsByName('scheduleSI.splCodeRateTax[5].secCode')[0];
		secCode112A.value = coalesceString(secCode112A.value);
		var splRatePercent112A = document
				.getElementsByName('scheduleSI.splCodeRateTax[5].splRatePercent')[0];
		splRatePercent112A.value = coalesce(splRatePercent112A.value);
		var splRateInc112A = document
				.getElementsByName('scheduleSI.splCodeRateTax[5].splRateInc')[0];
		splRateInc112A.value = coalesce(splRateInc112A.value);
		var taxableInc112A = document
				.getElementsByName('scheduleSI.splCodeRateTax[5].taxableInc')[0];
		taxableInc112A.value = coalesce(taxableInc112A.value);
		var splRateIncTax112A = document
				.getElementsByName('scheduleSI.splCodeRateTax[5].splRateIncTax')[0];
		splRateIncTax112A.value = coalesce(splRateIncTax112A.value);

		var splRateIncDTAA = document
				.getElementsByName('scheduleSI.splCodeRateTax[13].splRateInc')[0];
		splRateIncDTAA.value = coalesce(splRateIncDTAA.value);
		var taxableIncDTAA = document
				.getElementsByName('scheduleSI.splCodeRateTax[13].taxableInc')[0];
		taxableIncDTAA.value = coalesce(taxableIncDTAA.value);
		var splRateIncTaxDTAA = document
				.getElementsByName('scheduleSI.splCodeRateTax[13].splRateIncTax')[0];
		splRateIncTaxDTAA.value = coalesce(splRateIncTaxDTAA.value);

		var splRateIncLtcgDtaa = document
				.getElementsByName('scheduleSI.splCodeRateTax[12].splRateInc')[0];
		splRateIncLtcgDtaa.value = coalesce(splRateIncLtcgDtaa.value);
		var taxableIncLtcgDtaa = document
				.getElementsByName('scheduleSI.splCodeRateTax[12].taxableInc')[0];
		taxableIncLtcgDtaa.value = coalesce(taxableIncLtcgDtaa.value);
		var splRateIncTaxLtcgDtaa = document
				.getElementsByName('scheduleSI.splCodeRateTax[12].splRateIncTax')[0];
		splRateIncTaxLtcgDtaa.value = coalesce(splRateIncTaxLtcgDtaa.value);

		var splRateIncStcgDtaa = document
				.getElementsByName('scheduleSI.splCodeRateTax[11].splRateInc')[0];
		splRateIncStcgDtaa.value = coalesce(splRateIncStcgDtaa.value);
		var taxableIncStcgDtaa = document
				.getElementsByName('scheduleSI.splCodeRateTax[11].taxableInc')[0];
		taxableIncStcgDtaa.value = coalesce(taxableIncStcgDtaa.value);
		var splRateIncTaxStcgDtaa = document
				.getElementsByName('scheduleSI.splCodeRateTax[11].splRateIncTax')[0];
		splRateIncTaxStcgDtaa.value = coalesce(splRateIncTaxStcgDtaa.value);

		var splRateInc5ADii = document
				.getElementsByName('scheduleSI.splCodeRateTax[7].splRateInc')[0];
		splRateInc5ADii.value = coalesce(splRateInc5ADii.value);
		var taxableInc5ADii = document
				.getElementsByName('scheduleSI.splCodeRateTax[7].taxableInc')[0];
		taxableInc5ADii.value = coalesce(taxableInc5ADii.value);
		var splRateIncTax5ADii = document
				.getElementsByName('scheduleSI.splCodeRateTax[7].splRateIncTax')[0];
		splRateIncTax5ADii.value = coalesce(splRateIncTax5ADii.value);

		var secCode115ADiiiP = document
				.getElementsByName('scheduleSI.splCodeRateTax[10].secCode')[0];
		secCode115ADiiiP.value = coalesceString(secCode115ADiiiP.value);
		var splRatePercent115ADiiiP = document
				.getElementsByName('scheduleSI.splCodeRateTax[10].splRatePercent')[0];
		splRatePercent115ADiiiP.value = coalesce(splRatePercent115ADiiiP.value);
		var splRateInc115ADiiiP = document
				.getElementsByName('scheduleSI.splCodeRateTax[10].splRateInc')[0];
		splRateInc115ADiiiP.value = coalesce(splRateInc115ADiiiP.value);
		var taxableInc115ADiiiP = document
				.getElementsByName('scheduleSI.splCodeRateTax[10].taxableInc')[0];
		taxableInc115ADiiiP.value = coalesce(taxableInc115ADiiiP.value);
		var splRateIncTax115ADiiiP = document
				.getElementsByName('scheduleSI.splCodeRateTax[10].splRateIncTax')[0];
		splRateIncTax115ADiiiP.value = coalesce(splRateIncTax115ADiiiP.value);

		var splRateInc115BBFBP = document
				.getElementsByName('scheduleSI.splCodeRateTax[8].splRateInc')[0];
		splRateInc115BBFBP.value = coalesce(splRateInc115BBFBP.value);
		var taxableInc115BBFBP = document
				.getElementsByName('scheduleSI.splCodeRateTax[8].taxableInc')[0];
		taxableInc115BBFBP.value = coalesce(taxableInc115BBFBP.value);
		var splRateIncTax115BBFBP = document
				.getElementsByName('scheduleSI.splCodeRateTax[8].splRateIncTax')[0];
		splRateIncTax115BBFBP.value = coalesce(splRateIncTax115BBFBP.value);

		var splRateInc115BGFBP = document
				.getElementsByName('scheduleSI.splCodeRateTax[9].splRateInc')[0];
		splRateInc115BGFBP.value = coalesce(splRateInc115BGFBP.value);
		var taxableInc115BBGBP = document
				.getElementsByName('scheduleSI.splCodeRateTax[9].taxableInc')[0];
		taxableInc115BBGBP.value = coalesce(taxableInc115BBGBP.value);
		var splRateIncTax115BBGBP = document
				.getElementsByName('scheduleSI.splCodeRateTax[9].splRateIncTax')[0];
		splRateIncTax115BBGBP.value = coalesce(splRateIncTax115BBGBP.value);

		// Taxable Income autopopulate

		taxableIncDTAA.value = zeroOrMore(splRateIncDTAA.value);
		taxableInc5ADii.value = zeroOrMore(splRateInc5ADii.value);
		taxableIncLtcgDtaa.value = zeroOrMore(splRateIncLtcgDtaa.value);
		taxableIncStcgDtaa.value = zeroOrMore(splRateIncStcgDtaa.value);

		taxableInc21.value = zeroOrMore(splRateInc21.value);
		taxableInc1A.value = zeroOrMore(splRateInc1A.value);
		taxableInc22.value = zeroOrMore(splRateInc22.value);
		taxableInc21ciii.value = zeroOrMore(splRateInc21ciii.value);
		taxableInc5BB.value = zeroOrMore(splRateInc5BB.value);
		taxableInc112A.value = zeroOrMore(splRateInc112A.value);
		taxableInc5b.value = zeroOrMore(splRateInc5b.value);
		taxableInc115ADiiiP.value = zeroOrMore(splRateInc115ADiiiP.value);
		taxableInc115BBFBP.value = zeroOrMore(splRateInc115BBFBP.value);
		taxableInc115BBGBP.value = zeroOrMore(splRateInc115BGFBP.value);

		// Column 'Tax thereon' values for fixed rows

		var temp115ADp = 0;
		if (parseInt(taxableInc115ADiiiP.value) <= 100000) {
			temp115ADp = 0;
		} else {
			temp115ADp = parseInt(taxableInc115ADiiiP.value) - parseInt(100000);
		}
		var temp112A = 0;
		if (parseInt(taxableInc112A.value) <= 100000) {
			temp112A = 0;
		} else {
			temp112A = parseInt(taxableInc112A.value) - parseInt(100000);
		}
		splRateIncTax115ADiiiP.value = Math.round((10 * eval(parseInt(
				temp115ADp, 10)))
				/ parseInt('100', 10));
		splRateIncTax112A.value = Math
				.round((10 * eval(parseInt(temp112A, 10)))
						/ parseInt('100', 10));
		splRateIncTax5ADii.value = Math.round((30 * eval(parseInt(
				taxableInc5ADii.value, 10)))
				/ parseInt('100', 10));

		splRateIncTax1A.value = Math.round((15 * eval(parseInt(
				taxableInc1A.value, 10)))
				/ parseInt('100', 10));
		splRateIncTax22.value = Math.round((10 * eval(parseInt(
				taxableInc22.value, 10)))
				/ parseInt('100', 10));
		splRateIncTax21ciii.value = Math.round((10 * eval(parseInt(
				taxableInc21ciii.value, 10)))
				/ parseInt('100', 10));
		splRateIncTax21.value = Math.round((20 * eval(parseInt(
				taxableInc21.value, 10)))
				/ parseInt('100', 10));
		splRateIncTax5BB.value = Math.round((30 * eval(parseInt(
				taxableInc5BB.value, 10)))
				/ parseInt('100', 10));
		splRateIncTax115BBFBP.value = Math.round((10 * eval(parseInt(
				taxableInc115BBFBP.value, 10)))
				/ parseInt('100', 10));
		splRateIncTax115BBGBP.value = Math.round((10 * eval(parseInt(
				taxableInc115BBGBP.value, 10)))
				/ parseInt('100', 10));

		splRateIncTax5b.value = Math.round((12.5 * eval(parseInt(
				taxableInc5b.value, 10)))
				/ parseInt('100', 10));

		var totSplRateInc = eval(parseInt(splRateInc1A.value, 10))
				+ eval(parseInt(splRateInc22.value, 10))
				+ eval(parseInt(splRateInc21ciii.value, 10))
				+ eval(parseInt(splRateInc21.value, 10))
				+ eval(parseInt(splRateInc5BB.value, 10))
				+ eval(parseInt(splRateInc5ADii.value, 10))
				+ eval(parseInt(splRateIncDTAA.value, 10))
				+ eval(parseInt(splRateIncLtcgDtaa.value, 10))
				+ eval(parseInt(splRateIncStcgDtaa.value, 10))
			//	+ eval(parseInt(splRateInc1.value, 10))
				+ eval(parseInt(splRateInc5b.value, 10))
				+ eval(parseInt(splRateInc115ADiiiP.value, 10))
				+ eval(parseInt(splRateInc112A.value, 10))
				+ eval(parseInt(splRateInc115BBFBP.value, 10))
				+ eval(parseInt(splRateInc115BGFBP.value, 10));

		var totSplRateIncTax = eval(parseInt(splRateIncTax1A.value, 10))
				+ eval(parseInt(splRateIncTax22.value, 10))
				+ eval(parseInt(splRateIncTax21ciii.value, 10))
				+ eval(parseInt(splRateIncTax21.value, 10))
				+ eval(parseInt(splRateIncTax5BB.value, 10))
				+ eval(parseInt(splRateIncTax5ADii.value, 10))
				+ eval(parseInt(splRateIncTaxDTAA.value, 10))
				+ eval(parseInt(splRateIncTaxLtcgDtaa.value, 10))
				+ eval(parseInt(splRateIncTaxStcgDtaa.value, 10))
				//+ eval(parseInt(splRateIncTax1.value, 10))
				+ eval(parseInt(splRateIncTax5b.value, 10))
				+ eval(parseInt(splRateIncTax115ADiiiP.value, 10))
				+ eval(parseInt(splRateIncTax112A.value, 10))
				+ eval(parseInt(splRateIncTax115BBFBP.value, 10))
				+ eval(parseInt(splRateIncTax115BBGBP.value, 10));
		var totTaxableInc = eval(parseInt(taxableInc1A.value, 10))
				+ eval(parseInt(taxableInc22.value, 10))
				+ eval(parseInt(taxableInc21ciii.value, 10))
				+ eval(parseInt(taxableInc21.value, 10))
				+ eval(parseInt(taxableInc5BB.value, 10))
				+ eval(parseInt(taxableInc5ADii.value, 10))
				+ eval(parseInt(taxableIncDTAA.value, 10))
				+ eval(parseInt(taxableIncLtcgDtaa.value, 10))
				+ eval(parseInt(taxableIncStcgDtaa.value, 10))
			//	+ eval(parseInt(taxableInc1.value, 10))
				+ eval(parseInt(taxableInc5b.value, 10))
				+ eval(parseInt(taxableInc115ADiiiP.value, 10))
				+ eval(parseInt(taxableInc112A.value, 10))
				+ eval(parseInt(taxableInc115BBFBP.value, 10))
				+ eval(parseInt(taxableInc115BBGBP.value, 10));
		var rowCount1 = countRowInTable('scheduleSI.splCodeRateTax',
				'splRateInc');
		var exemption = getExemption_SI();
		for (var i = 14; i < rowCount1; i++) {
			var secCode = document
			.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].secCode')[0].value;
			var splCodeValue = document
			.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].splRateInc')[0].value;
			var splRatePercent = document
			.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].splRatePercent')[0].value;
			var splRateIncTaxPti112A = document
			.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].splRateIncTax')[0].value;
			if (secCode == 'PTI_LTCG10P112A') {
				document.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].taxableInc')[0].value = zeroOrMore(coalesce(splCodeValue));
				if (exemption <= splCodeValue) {
					document.getElementsByName('scheduleSI.splCodeRateTax[' + i
							+ '].taxableInc')[0].value = zeroOrMore(parseInt(
									coalesce(splCodeValue), 10)
									- exemption);
					exemption = 0;
				} else {
					document.getElementsByName('scheduleSI.splCodeRateTax[' + i
							+ '].taxableInc')[0].value = 0;
					exemption = zeroOrMore(exemption
							- parseInt(coalesce(splCodeValue), 10));
				}

				document.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRateIncTax')[0].value = Math
						.round(eval((parseFloat(coalesce(splRatePercent), 10) * parseInt(
								coalesce(splCodeValue), 10))
								/ parseInt('100', 10)));
								var tempPti112A = 0;
								if (taxableInc112A.value <= 100000) {
									var exmp = parseInt('100000', 10) - taxableInc112A.value;
									if (parseInt(document
											.getElementsByName('scheduleSI.splCodeRateTax[' + i
													+ '].taxableInc')[0].value) <= exmp) {
										tempPti112A = 0;
									} else {
										tempPti112A = parseInt(document
												.getElementsByName('scheduleSI.splCodeRateTax['
														+ i + '].taxableInc')[0].value)
														- exmp;
									}
								} else {
									tempPti112A = parseInt(document
											.getElementsByName('scheduleSI.splCodeRateTax[' + i
													+ '].taxableInc')[0].value);
								}
								document
								.getElementsByName('scheduleSI.splCodeRateTax[' + i
										+ '].splRateIncTax')[0].value = Math.round((10 * eval(parseInt(
												tempPti112A, 10)))
												/ parseInt('100', 10));
												totSplRateInc = eval(parseInt(totSplRateInc, 10)
														+ parseInt(coalesce(splCodeValue), 10));
										totSplRateIncTax = eval(parseInt(totSplRateIncTax, 10)
												+ parseInt(coalesce(document
														.getElementsByName('scheduleSI.splCodeRateTax[' + i
																+ '].splRateIncTax')[0].value), 10));
										totTaxableInc = eval(parseInt(totTaxableInc, 10)
												+ parseInt(coalesce(document
														.getElementsByName('scheduleSI.splCodeRateTax[' + i
																+ '].taxableInc')[0].value), 10));
			}
		}
		for (var i = 14; i < rowCount1; i++) {
			var secCode= document
			.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].secCode')[0].value;
			var splCodeValue = document
					.getElementsByName('scheduleSI.splCodeRateTax[' + i
							+ '].splRateInc')[0].value;
			if(secCode=='PTI_LTCG10P112A')
			{
				continue;
			}
			var splRatePercent = document
					.getElementsByName('scheduleSI.splCodeRateTax[' + i
							+ '].splRatePercent')[0].value;
			document.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].taxableInc')[0].value = zeroOrMore(coalesce(splCodeValue));
			document.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].splRateIncTax')[0].value = Math
					.round(eval((parseFloat(coalesce(splRatePercent), 10) * parseInt(
							coalesce(splCodeValue), 10))
							/ parseInt('100', 10)));

			totSplRateInc = eval(parseInt(totSplRateInc, 10)
					+ parseInt(coalesce(splCodeValue), 10));
			alert('totSplRateInc'+totSplRateInc);

			
			totSplRateIncTax = eval(parseInt(totSplRateIncTax, 10)
					+ parseInt(coalesce(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].splRateIncTax')[0].value), 10));
			alert('totSplRateIncTax'+totSplRateIncTax);

			totTaxableInc = eval(parseInt(totTaxableInc, 10)
					+ parseInt(coalesce(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value), 10));
			alert('totTaxableInc'+totTaxableInc);

		}
		document.getElementsByName('scheduleSI.totSplRateInc')[0].value = zeroOrMore(totSplRateInc);
		document.getElementsByName('scheduleSI.totSplRateTaxableInc')[0].value = zeroOrMore(totTaxableInc);
		document.getElementsByName('scheduleSI.totSplRateIncTax')[0].value = zeroOrMore(totSplRateIncTax);
		checkSIAmount();
	} catch (e) {
		alert('Errror in SI:' + e.stack);
	}
}

function checkSIAmount() {
	var taxableInc1 = document.getElementsByName('scheduleSI.splCodeRateTax[1].taxableInc')[0]; taxableInc1.value = coalesce(taxableInc1.value);
	var splRateInc1 = document.getElementsByName('scheduleSI.splCodeRateTax[1].splRateInc')[0]; splRateInc1.value = coalesce(splRateInc1.value);
	if(parseInt(taxableInc1.value,10) > parseInt(splRateInc1.value,10)){
		addError(taxableInc1,'Taxable Income after adjusting cannot be greater than Income shown in Schedule OS',true);
		j.setFieldError(taxableInc1.name,'Taxable Income after adjusting cannot be greater than Income shown in Schedule OS');

	}
}
function addSchSIRow(SecCode, SecCodeValue) {
	try {
		var tableId = document.getElementById('scheduleSI');
		var mainTable = document.getElementById('scheduleSI').rows;
		var noOfRows = tableId.rows.length;
		var toInsertBefore = document.getElementById('scheduleSILastRow');
		var lastIndex = eval(parseInt(noOfRows, 10) - 2);
		var cloneNode = mainTable[lastIndex].cloneNode(true);
		var newSlNo = cloneNode.cells[0].textContent;

		var iterate = eval(parseInt(newSlNo, 10) - 1);

		cloneNode.cells[0].innerHTML = eval(parseInt(newSlNo, 10) + 1);
		// getSection
		cloneNode.cells[1].innerHTML = getSectionTextMap(SecCode);
		var inputTags = cloneNode.getElementsByTagName('input');
		for (var a = 0; a < inputTags.length; a++) {

			inputTags[a].name = inputTags[a].name.replace('[' + iterate + ']',
					'[' + lastIndex + ']');

			inputTags[a].id = inputTags[a].name.replace(/([\.\[\]])/g, '_')
					.replace(/(__)/g, '_');
			// Display Section Rate
			inputTags[1].value = getSectionTaxRate(SecCode);
			// Income
			inputTags[2].value = zeroOrMore(parseInt(SecCodeValue, 10));

			if (inputTags[a].getAttribute('type') == 'hidden'
					&& inputTags[a].name.match("secCode$")) {
				inputTags[a].value = SecCode;
			}

			var blurAttr = inputTags[a].getAttribute('onblur');
			if (blurAttr != null) {
				blurAttr = blurAttr + ";";
			} else {
				blurAttr = "";
			}
			inputTags[a].setAttribute('onblur', blurAttr
					+ 'j.blur(this,this.name,this.value);');
		}
		document.getElementById('scheduleSI').getElementsByTagName('tr')[0].parentNode
				.insertBefore(cloneNode, toInsertBefore);

	} catch (e) {
		alert('addSchSIRow' + e);
	}
}
function populateSI(cgosIncome, simap) {
	try {

		updateMapForSI(cgosIncome, simap);
		var sec111grosstot = 0;

		var table = document.getElementById('scheduleOsNriIncTaxDtaa');
		var rowCount = table.rows.length - 2;

		for (var k = 0; k < rowCount; k++) {
			if (document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ k + '].itemIncluded')[0].value == '1') {
				sec111grosstot = eval(sec111grosstot
						+ parseInt(
								coalesce(document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value), 10));
			}
		}

		// 111
/*		document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRateIncTax')[0].value = zeroOrMore(parseInt(
				document
						.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalTaxBenefit')[0].value
						- sec111grosstot, 10));
		document.getElementsByName('scheduleSI.splCodeRateTax[0].splRateInc')[0].value = zeroOrMore(parseInt(document
				.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit')[0].value));
		document.getElementsByName('scheduleSI.splCodeRateTax[0].taxableInc')[0].value = document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRateInc')[0].value;*/

		// DTAAOS
		document.getElementsByName('scheduleSI.splCodeRateTax[11].splRateInc')[0].value = zeroOrMore(parseInt(
				document
						.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value,
				10));
		document.getElementsByName('scheduleSI.splCodeRateTax[12].splRateInc')[0].value = zeroOrMore(parseInt(
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value,
				10));

		document.getElementsByName('scheduleSI.splCodeRateTax[13].splRateInc')[0].value = zeroOrMore(parseInt(
				document
						.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value,
				10));

		// 111A
		document.getElementsByName('scheduleSI.splCodeRateTax[1].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.stcg.prctg15.sec111a, 10));

		// 112
		document.getElementsByName('scheduleSI.splCodeRateTax[2].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.ltcg.prctg20.sec112, 10));

		// 112proviso

		document.getElementsByName('scheduleSI.splCodeRateTax[3].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.ltcg.prctg10.secProviso, 10));

		// 112(1)(c)(iii)
		document.getElementsByName('scheduleSI.splCodeRateTax[4].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2, 10));

		// 112A
		document.getElementsByName('scheduleSI.splCodeRateTax[5].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.ltcg.prctg10.sec112A, 10));
		// 5BB
		document.getElementsByName('scheduleSI.splCodeRateTax[6].splRateInc')[0].value = zeroOrMore(parseInt(
				document
						.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls0.sourceAmount')[0].value,
				10));

		// 115BB
		/*
		 * document.getElementsByName('scheduleSI.splCodeRateTax[1].splRateInc')[0].value =
		 * zeroOrMore(parseInt( document
		 * .getElementsByName('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value,
		 * 10));
		 */
		setEditableFieldValue(
				document
						.getElementsByName('scheduleSI.splCodeRateTax[0].splRateInc')[0],
				eval(zeroOrMore(parseInt(
						document
								.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value,
						10))));
		// 5ADii
		document.getElementsByName('scheduleSI.splCodeRateTax[7].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.stcg.prctg30.sec115AD, 10));

		document.getElementsByName('scheduleSI.splCodeRateTax[8].splRateInc')[0].value = zeroOrMore(parseInt(
				document
						.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBF')[0].value,
				10));

		document.getElementsByName('scheduleSI.splCodeRateTax[9].splRateInc')[0].value = zeroOrMore(parseInt(
				document
						.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBG')[0].value,
				10));

		document.getElementsByName('scheduleSI.splCodeRateTax[10].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP, 10));

		document.getElementsByName('scheduleSI.splCodeRateTax[2].splRateInc')[0].value = zeroOrMore(parseInt(
				cgosIncome.cgInc.ltcg.prctg20.sec112, 10));

		deleteSIRow();

		for ( var i in simap) {
			if (simap[i] != 'undefined' && simap[i] != null && simap[i] != 0
					&& i != '') {
				var secAdded = checkSectionAddedSI(i, simap[i]);
				if (!secAdded && !(i == '')) {
					addSchSIRow(i, coalesce(simap[i]));
				}
			}

		}

		for ( var si in simap) {

			simap[si] = '';
		}
		calcScheduleSI();

	} catch (e) {
		alert('Error in populateSI:' + e.stack);
	}

}

function checkSectionAddedSI(secCode, secValue) {
	try {
		var tab = document.getElementById('scheduleSI');
		var noofRows = tab.rows.length;
		var secAdded = false;
		for (var i = 0; i < eval(parseInt(noofRows, 10) - 5); i++) {

			if (document.getElementsByName('scheduleSI.splCodeRateTax[' + i
					+ '].secCode')[0].value == secCode) {

				document.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRateInc')[0].value = zeroOrMore(parseInt(
						secValue, 10));
				secAdded = true;
			}

		}
	} catch (e) {
		alert('error in checkSectionAddedSI' + e);
	}
	return secAdded;
}

function deleteSIRow() {
	try {
		var siTable = document.getElementById('scheduleSI');
		var noRows = siTable.rows.length;
		if (parseInt(noRows, 10) > 10) {

			for (var i = 15; i < parseInt(noRows, 10) - 1; i++) {
				siTable.deleteRow(15);
			}

		}
		siDisable11();

	} catch (e) {
		alert('Error in deleteSIRow:' + e.stack)
	}
}

function siDisable11() {
	try {
		var tableId = document.getElementById('scheduleSI');
		var mainTable = document.getElementById('scheduleSI').rows;
		var noOfRows = tableId.rows.length;
		var lastIndex = eval(parseInt(noOfRows, 10) - 2);
		var secCode;
		for (i = 0; i < lastIndex; i++) {
			secCode = document.getElementsByName('scheduleSI.splCodeRateTax['
					+ i + '].secCode')[0].value;
			if (secCode != 'DTAASTCG' && secCode != 'DTAALTCG'
					&& secCode != 'DTAAOS') {
				document.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRatePercent')[0].readOnly = true;
				document.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRateIncTax')[0].readOnly = true;
			}
		}

	} catch (e) {
		alert(e);
	}

}

function getSectionTextMap(key) {
	var sectionTextMap = {
		"1A" : "111A (STCG on shares where STT paid)",
		"21" : "112 (LTCG on others)",
		"22" : "112 proviso (LTCG on listed securities/ units without indexation)",
		"21ciii" : "112(1)(c)(iii)(LTCG on unlisted securities in case of non-residents)",
		"5A1ai" : "115A(1)(a)(i)- Dividends in the case of non-residents",
		"5A1aii" : "115A(1)(a)(ii)- Interest received in the case of non-residents",
		"5A1aiia" : "115A(1)(a)(iia) -Interest received by non-resident from infrastructure debt fund",
		"5A1aiiaa" : "115A(1)(a)(iiaa) -Income received by non-resident as referred in section 194LC",
		"5A1aiiab" : "115A(1)(a)(iiab) -Income received by non-resident as referred in section 194LD",
		"5A1aiii" : "115A(1)(a)(iii) - Income from units purchased in foreign currency in the case of non-residents",
		"FA" : "Para  E II of Part I of Ist Sch of FA - Income from royalty where agreement entered between 31.3.1961 to 31.3.1976 and income from fees for technical services where agreement entered between 29.2.1964 and 31.3.1976, and agreement is approved by the Central Government.",
		"5A1bA" : "115A(1)(b)- Income from royalty or fees for technical services received from Government or Indian concern - chargeable u/s 115A(1)(b)",
		"5AC1ab" : "115AC(1)(a & b) - Income from bonds or GDR purchased in foreign currency or long term capital gains arising from their transfer in case of a non-resident",
		"5AC1c" : "115AC(1)(c) -LTCG arising from the transfer of bonds or GDR purchased in foreign currency - non-resident",
		"5ACA1b" : "115ACA(1)(b) - LTCG arising from the transfer of GDR purchased in foreign currency -resident",
		"5AD1i" : "115AD(1)(i) -Income received by an FII in respect of securities (other than units referred to in section115AB)",
		"5AD1iP" : "115AD(1)(i) -Income received by an FII in respect of bonds or government securities referred to in section 194LD  ",
		"5ADii" : "115AD(1)(ii) -STCG (other than on equity share or equity oriented mutual fund referred to in section 111A) by an FII",
		"5ADiii" : "115AD(1)(iii)-Long term capital gains by an FII",
		"5B" : "115B - Profits and gains of life insurance business",
		"5BB" : "115BB - Income by way of winnings from lotteries, crossword puzzles etc.",
		"5BBA" : "115BBA - Tax on non-resident sportsmen or sports associations or entertainer",
		"5BBC" : "115BBC - Anonymous donations",
		"5BBDA" : "115BBDA -  Tax on certain dividends received from domestic companies.",
		"5BBD" : "115BBD- Tax on Dividend of an Indian Company from specified foreign Company",
		"5BBE" : "115BBE - Tax on income referred to in sections 68 or 69 or 69A or 69B or 69C or 69D",
		"5BBF" : "115BBF - Income by way of royalty taxable",
		"5BBG" : "115BBG -  Tax on Transfer of carbon credits",
		"5BBF_BP" : "115BBF- Tax on income from patent(Income under head business or profession)",
		"5BBG_BP" : "115BBG -  Income from patent chargeable u/s 115BBG(Income under head business or profession)",
		"5Eacg" : "115E(a)-LTCG on any asset other than a specified asset-non resident Indian",
		"5Eb" : "115E(b) - Income by way of long term capital gains",
		"5AB1a" : "115AB(1)(a) - Income received in respect of units purchased in foreign currency by an off-shore fund",
		"5AB1b" : "115AB(1)(b) - Income by way of long-term capital gains arising from the transfer of units purchase in foreign currency by a off-shore fund",
		"5AD1biip" : "115AD(1)(b)(ii)- Short term capital gains referred to in section 111A",
		"5A1aiiac" : "115A(1)(a)(iiac)-Income received by non-resident as referred in section 194LBA",
		"56i" : "56(2)(i)- Dividends",
		"56" : "56(2)- Interest",
		"562iii" : "56(2)(iii)- Rental income from machinery, plants, buildings etc",
		"562x" : "56(2)(x) - Income under section 56(2)(x)",
		"A1e" : "A1e",
		"A2c" : "A2c",
		"A3ie" : "A3ie-111A",
		"A3iie" : "A3iie-115AD",
		"A4a" : "A4a",
		"A4b" : "A4b",
		"A5e" : "A5e",
		"A6g" : "A6g",
		"A7" : "A7",
		"A8a" : "A8(a)",
		"A8b" : "A8(b)",
		"A8c" : "A8(c)",
		"B1e" : "B1e",
		"B2e" : "B2e",
		"B3c" : "B3c",
		"B4c" : "B4c",
		"B5" : "B5",
		"B6" : "B6",
		"B7i" : "B7ie-112(1)(c)",
		"B7ii" : "B7iie115AB1b",
		"B7iii" : "B7iiie-115AC",
		"B7iv" : "B7ive-115AD",
		"B8" : "B8",
		"B9e" : "B9e",
		"B10" : "B10",
		"B11a1" : "B11a1",
		"B11a2" : "B11a2",
		"B11b" : "B11b",
		"PTI_5A1ai" : "PTI_115A(1)(a)(i)- Dividends in the case of non-residents",
		"PTI_5A1aii" : "PTI_115A(1)(a)(ii)- Interest received in the case of non-residents",
		"PTI_5A1aiia" : "PTI_115A(1) (a)(iia) -Interest received by non-resident from infrastructure debt fund",
		"PTI_5A1aiiaa" : "PTI_115A(1) (a)(iiaa) -Income received by non-resident as referred in section 194LC",
		"PTI_5A1aiiab" : "PTI_115A(1) (a)(iiab) -Income received by non-resident as referred in section 194LD",
		"PTI_5A1aiiac" : "PTI_115A(1)(a)(iiac)-Income received by non-resident as referred in section 194LBA",
		"PTI_5A1aiii" : "PTI_115A(1) (a)(iii) - Income from units purchased in foreign currency in the case of non-residents",
		"PTI_FA" : "PTI_Para E II of Part I of Ist Sch of FA - Income from royalty where agreement entered between 31.3.1961 to 31.3.1976 and income from fees for technical services where agreement entered between 29.2.1964 and 31.3.1976, and agreement is approved by the Central Government.",
		"PTI_5A1bA" : "PTI_115A(1)(b)-Income from royalty or fees for technical services received from Government or Indian concern - chargeable u/s 115A(1)(b)",
		"PTI_5AB1a" : "PTI_Income received inrespect of units purchased in foreign currency by an off-shore fund",
		"PTI_5AC1ab" : "PTI_115AC(1)(a & b) - Income from bonds or GDR purchased in foreign currency or long term capital gains arising from their transfer in case of a non-resident",
		"PTI_5AD1i" : "PTI_115AD(1)(i) -Income received by an FII in respect of securities (other than units referred to in section115AB)",
		"PTI_5AD1iP" : "PTI_115AD(1)(i) -Income received by an FII in respect of bonds or government securities referred to in section 194LD",
		"PTI_5BBA" : "PTI_115BBA - Tax on non-resident sportsmen or sports associations or entertainer",
		"PTI_5BBC" : "PTI_115BBC - Anonymous donations",
		"PTI_5BBDA" : "PTI_115BBDA -  Tax on certain dividends received from domestic companies.",
		"PTI_5BBD" : "PTI_115BBD- Tax on Dividend of an Indian Company from specified foreign Company",
		"PTI_5BBF" : "PTI_115BBF - Income by way of royalty taxable",
		"PTI_5BBG" : "PTI_115BBG -  Tax on Transfer of carbon credits",
		"PTI_LTCG10P112A" : "Pass Through Income in the nature of Long Term Capital Gain chargeable @ 10% u/s 112A",
		"PTI_LTCG10P" : "Pass Through Income in the nature of Long Term Capital Gain chargeable @ 10%",
		"PTI_LTCG20P" : "Pass Through Income in the nature of Long Term Capital Gain chargeable @ 20%",
		"PTI_STCG30P" : "Pass Through Income in the nature of Short Term Capital Gain chargeable @ 30%",
		"PTI_STCG15P" : "Pass Through Income in the nature of Short Term Capital Gain chargeable @ 15%",
		"DTAASTCG" : "STCG Chargeable at special rates in India as per DTAA",
		"DTAALTCG" : "LTCG Chargeable at special rates in India as per DTAA",
		"DTAAOS" : "Other source Chargeable at special rates in India as per DTAA",
		"2A" : "112A - LTCG on equity shares/units of equity oriented fund/units of business trust on which STT is paid",
		"5ADiiiP" : "For NON-RESIDENTS - From sale of equity share in a company or unit of equity oriented fund or unit of a business trust on which STT is paid under section 112A",
		"5Ea" : "115E(a) - Investment Income of a Non-Resident Indian -chargeable u/s 115E",
		"sec11EA" : "115E(a)-LTCG on any asset other than a specified asset-non resident Indian",

	};

	return sectionTextMap[key];
}

function getSectionTaxRate(key) {
	var sectionRateMap = {
		"1A" : "15",
		"PTI_STCG15P" : "15",
		"PTI_STCG30P" : "30",
		"PTI_LTCG10P" : "10",
		"PTI_LTCG10P112A" : "10",
		"PTI_LTCG20P" : "20",
		"21" : "20",
		"22" : "10",
		"21ciii" : "10",
		"5A1ai" : "20",
		"5A1aii" : "20",
		"5A1aiia" : "5",
		"5A1aiiaa" : "5",
		"5A1aiiab" : "5",
		"5A1aiiac" : "5",
		"5A1aiii" : "20",
		"5ADiiiP" : "10",
		"2A" : "10",
		"5A1bA" : "10",
		"5A1bB" : "10",
		"5AC1ab" : "10",
		"5AC1c" : "10",
		"5ACA1b" : "10",
		"5AD1i" : "20",
		"5AD1iP" : "5",
		"5ADii" : "30",
		"5ADiii" : "10",
		"5B" : "12.5",
		"5BB" : "30",
		"5BBA" : "20",
		"5BBDA" : "10",
		"5BBC" : "30",
		"5BBE" : "60",
		"5BBF" : "10",
		"5BBF_BP" : "10",
		"5BBG" : "10",
		"5BBG_BP" : "10",
		"5Ea" : "20",
		"5Eacg" : "20",
		"5Eb" : "10",
		"5AB1a" : "10",
		"PTI_5AB1a" : "10",
		"5AD1biip" : "15",
		"sec11EA" : "10",
		"PTI_5A1ai" : "20",
		"PTI_5A1aii" : "20",
		"PTI_5A1aiia" : "5",
		"PTI_5A1aiiaa" : "5",
		"PTI_5A1aiiab" : "5",
		"PTI_5A1aiiac" : "5",
		"PTI_5A1aiii" : "20",
		"PTI_5A1bA" : "10",
		"PTI_5AC1ab" : "10",
		"PTI_5AD1i" : "20",
		"PTI_5AD1iP" : "5",
		"PTI_5BBA" : "20",
		"PTI_5BBC" : "30",
		"PTI_5BBDA" : "10",
		"PTI_5BBD" : "15",
		"PTI_5BBF" : "10",
		"PTI_5BBG" : "10",
		"PTI_5Ea" : "20",
		"FA" : "50",
		"PTI_FA" : "50",
		"5BBD" : "15",
		"5AB1b" : "10"

	};

	return sectionRateMap[key];

}

function calculatePartBTI_first() {
	try {

		// 1
		var incomeFromHP = document.getElementsByName('partBTI.incomeFromHP')[0];
		incomeFromHP.value = zeroOrMore(coalesceSetRet('scheduleHP.totalIncomeChargeableUnHP'));

		// 2
		var adjustedBp41 = parseInt(
				coalesceSetRet('itr6ScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus'),
				10);
		var bp37 = parseInt(
				coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C'),
				10);

		var adjustedBp47 = parseInt(
				coalesceSetRet('itr6ScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal'),
				10);

		var adjustedBp3d = parseInt(
				coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBF'),
				10);

		if (bp37 > 0) {
			document.getElementsByName('partBTI.profBusGain.profGainNoSpecBus')[0].value = bp37;
		} else {

			document.getElementsByName('partBTI.profBusGain.profGainNoSpecBus')[0].value = parseInt(
					0, 10);
		}

		if (eval(adjustedBp41) > 0) {

			var specBuisnessAfterSet = document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.speculativeInc.incOfCurYrAfterSetOff')[0].value;
			document.getElementsByName('partBTI.profBusGain.profGainSpecBus')[0].value = eval(specBuisnessAfterSet);
		} else {
			document.getElementsByName('partBTI.profBusGain.profGainSpecBus')[0].value = parseInt(
					0, 10);
		}

		if (eval(adjustedBp47) > 0) {
			var speclBusinessAfterSet = document
					.getElementsByName('itr6ScheduleBP.busSetoffCurYr.specifiedInc.incOfCurYrAfterSetOff')[0].value;
			document
					.getElementsByName('partBTI.profBusGain.profGainSpecifiedBus')[0].value = eval(speclBusinessAfterSet);

		} else {
			document
					.getElementsByName('partBTI.profBusGain.profGainSpecifiedBus')[0].value = parseInt(
					0, 10);
		}

		if (eval(adjustedBp3d) > 0) {

			document.getElementsByName('partBTI.profBusGain.gainUs115BBF')[0].value = eval(adjustedBp3d);

		} else {
			document.getElementsByName('partBTI.profBusGain.gainUs115BBF')[0].value = parseInt(
					0, 10);
		}

		document.getElementsByName('partBTI.profBusGain.gainUs115BBF')[0].value = eval(parseInt(
				coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBF'),
				10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBG'),
						10)
				+ parseInt(
						coalesceSetRet('itr6ScheduleBP.busSetoffCurYr.profitgainInc.incOfCurYrAfterSetOff'),
						10));

		document.getElementsByName('partBTI.profBusGain.totProfBusGain')[0].value = eval(parseInt(
				coalesceSetRet('partBTI.profBusGain.profGainNoSpecBus'), 10)
				+ parseInt(
						coalesceSetRet('partBTI.profBusGain.profGainSpecBus'),
						10)
				+ parseInt(
						coalesceSetRet('partBTI.profBusGain.profGainSpecifiedBus'),
						10)
				+ parseInt(coalesceSetRet('partBTI.profBusGain.gainUs115BBF'),
						10)

		);

		document.getElementsByName('partBTI.capGain.shortTerm.shortTerm15Per')[0].value = parseInt(
				coalesceSetRet('scheduleCGPost45.currYrLosses.inStcg15Per.CurrYrLosSetOff'),
				10);

		document.getElementsByName('partBTI.capGain.shortTerm.shortTerm30Per')[0].value = parseInt(
				coalesceSetRet('scheduleCGPost45.currYrLosses.inStcg30Per.currYrLosSetOff'),
				10);

		document
				.getElementsByName('partBTI.capGain.shortTerm.shortTermAppRate')[0].value = parseInt(
				coalesceSetRet('scheduleCGPost45.currYrLosses.inStcgAppRate.currYrLosSetOff'),
				10);

		var shortTermSplRateDTAA = document
				.getElementsByName('partBTI.capGain.shortTerm.shortTermSplRateDTAA')[0];
		shortTermSplRateDTAA.value = coalesceSetRet('scheduleCGPost45.currYrLosses.inStcgDTAARate.currYrLosSetOff');

		document.getElementsByName('partBTI.capGain.shortTerm.totalShortTerm')[0].value = eval(parseInt(
				coalesceSetRet('partBTI.capGain.shortTerm.shortTerm15Per'), 10)
				+ parseInt(
						coalesceSetRet('partBTI.capGain.shortTerm.shortTerm30Per'),
						10)
				+ parseInt(
						coalesceSetRet('partBTI.capGain.shortTerm.shortTermAppRate'),
						10)
				+ parseInt(
						coalesceSetRet('partBTI.capGain.shortTerm.shortTermSplRateDTAA'),
						10));
		// 3b
		document.getElementsByName('partBTI.capGain.longTerm.longTerm10Per')[0].value = parseInt(
				coalesceSetRet('scheduleCGPost45.currYrLosses.inLtcg10Per.currYrLosSetOff'),
				10);

		document.getElementsByName('partBTI.capGain.longTerm.longTerm20Per')[0].value = parseInt(
				coalesceSetRet('scheduleCGPost45.currYrLosses.inLtcg20Per.CurrYrLosSetOff'),
				10);

		var longTermSplRateDTAA = document
				.getElementsByName('partBTI.capGain.longTerm.longTermSplRateDTAA')[0];
		longTermSplRateDTAA.value = coalesceSetRet('scheduleCGPost45.currYrLosses.inLtcgDTAARates.CurrYrLosSetOff');

		document.getElementsByName('partBTI.capGain.longTerm.totalLongTerm')[0].value = eval(parseInt(
				coalesceSetRet('partBTI.capGain.longTerm.longTerm10Per'), 10)
				+ parseInt(
						coalesceSetRet('partBTI.capGain.longTerm.longTerm20Per'),
						10)
				+ parseInt(
						coalesceSetRet('partBTI.capGain.longTerm.longTermSplRateDTAA'),
						10)

		);

		if (eval(
				document
						.getElementsByName('partBTI.capGain.longTerm.totalLongTerm')[0].value,
				10) < 0) {
			document
					.getElementsByName('partBTI.capGain.longTerm.totalLongTerm')[0].value = parseInt(
					0, 10);
		}

		var totalCapGains = document
				.getElementsByName('partBTI.capGain.totalCapGains')[0];
		totalCapGains.value = parseInt(document
				.getElementsByName('partBTI.capGain.shortTerm.totalShortTerm')[0].value)
				+ parseInt(document
						.getElementsByName('partBTI.capGain.longTerm.totalLongTerm')[0].value);

		// 4
		var otherSrcThanOwnRaceHorse = document
				.getElementsByName('partBTI.incFromOS.otherSrcThanOwnRaceHorse')[0];
		otherSrcThanOwnRaceHorse.value = zeroOrMore(coalesceSetRet('scheduleOS.balanceNoRaceHorse'));

		var incChargeSplRate = document
				.getElementsByName('partBTI.incFromOS.incChargeSplRate')[0];
		incChargeSplRate.value = zeroOrMore(coalesceSetRet('scheduleOS.totalOSGross'));

		var fromOwnRaceHorse = document
				.getElementsByName('partBTI.incFromOS.fromOwnRaceHorse')[0];
		fromOwnRaceHorse.value = zeroOrMore(coalesceSetRet('scheduleOS.incFromOwnHorse.balanceOwnRaceHorse'));

		var totIncFromOS = document
				.getElementsByName('partBTI.incFromOS.totIncFromOS')[0];
		totIncFromOS.value = eval(parseInt(otherSrcThanOwnRaceHorse.value, 10)
				+ parseInt(incChargeSplRate.value, 10)
				+ parseInt(fromOwnRaceHorse.value, 10));

		// 5
		document.getElementsByName('partBTI.totalTI')[0].value = eval(parseInt(
				coalesceSetRet('partBTI.incomeFromHP'), 10)
				+ parseInt(
						coalesceSetRet('partBTI.profBusGain.totProfBusGain'),
						10)
				+ parseInt(coalesceSetRet('partBTI.capGain.totalCapGains'), 10)
				+ parseInt(coalesceSetRet('partBTI.incFromOS.totIncFromOS'), 10)

		);

		// 6
		document.getElementsByName('partBTI.currentYearLoss')[0].value = eval(parseInt(
				coalesceSetRet('scheduleCYLA.totalLossSetOff.totHPlossCurYrSetoff'),
				10)
				+ parseInt(
						coalesceSetRet('scheduleCYLA.totalLossSetOff.totBusLossSetoff'),
						10)
				+ parseInt(
						coalesceSetRet('scheduleCYLA.totalLossSetOff.totOthSrcLossNoRaceHorseSetoff'),
						10));

		// 7
		document.getElementsByName('partBTI.balanceAfterSetoffLosses')[0].value = eval(parseInt(
				coalesceSetRet('partBTI.totalTI'), 10)
				- parseInt(coalesceSetRet('partBTI.currentYearLoss'), 10));

		// 8
		document.getElementsByName('partBTI.broughtFwdLossesSetoff')[0].value = zeroOrMore(eval(parseInt(
				coalesceSetRet('scheduleBFLA.totalBFLossSetOff.totBFLossSetoff'),
				10)
				+ parseInt(
						coalesceSetRet('scheduleBFLA.totalBFLossSetOff.totUnabsorbedDeprSetoff'),
						10)
				+ parseInt(
						coalesceSetRet('scheduleBFLA.totalBFLossSetOff.totAllUs35Cl4Setoff'),
						10)));

		// 9
		document.getElementsByName('partBTI.grossTotalIncome')[0].value = zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTI.balanceAfterSetoffLosses'), 10)
				- parseInt(coalesceSetRet('partBTI.broughtFwdLossesSetoff'), 10)));

		// 10
		document.getElementsByName('partBTI.incChargeTaxSplRate111A112')[0].value = eval(parseInt(
				coalesceSetRet('scheduleSI.totSplRateInc'), 10)/*
																 * -
																 * parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[1].splRateInc'),10)
																 */
		);


	} catch (e) {

	}
}

function calculatePartBTI_second() {
	try {
		// 12
		surcharge201718();
		var BFLAi5 = document
		.getElementsByName('scheduleBFLA.hp.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
var BFLAii5 = document
		.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
var BFLAiv5 = document
		.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
var BFLAv5 = document
		.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
var BFLAviii5 = document
		.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
var BFLAxiii5 = document
		.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];
var BFLAxiv5 = document
		.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')[0];

var BFLATotalFields = eval(parseInt(BFLAi5.value, 10))
		+ eval(parseInt(BFLAii5.value, 10))
		+ eval(parseInt(BFLAiv5.value, 10))
		+ eval(parseInt(BFLAv5.value, 10))
		+ eval(parseInt(BFLAviii5.value, 10))
		+ eval(parseInt(BFLAxiii5.value, 10))
		+ eval(parseInt(BFLAxiv5.value, 10));

		/*var dedPartBLimit = zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTI.grossTotalIncome'), 10)
				- parseInt(
						coalesceSetRet('partBTI.incChargeTaxSplRate111A112'),
						10)));
		var dedPartCLimit = zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTI.grossTotalIncome'), 10)
				- parseInt(
						coalesceSetRet('partBTI.incChargeTaxSplRate111A112'),
						10)
				-
				// parseInt(coalesceSetRet('partBTI.deductionsUnder10Aor10AA'),10)-
				parseInt(
						coalesceSetRet('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses'),
						10)));*/

		var dedPartB = zeroOrMore(eval(parseInt(
				coalesceSetRet('scheduleVIA.deductUndChapVIA.totalDeductionPartb'),
				10)));
		// 11a
		if (dedPartB < BFLATotalFields) {
			document
					.getElementsByName('partBTI.deductionsUnderScheduleVIAPartB')[0].value = dedPartB;
		} else {
			document
					.getElementsByName('partBTI.deductionsUnderScheduleVIAPartB')[0].value = BFLATotalFields;
		}
		// 11b
		var dedPartC = zeroOrMore(eval(parseInt(
				coalesceSetRet('scheduleVIA.deductUndChapVIA.totalDeductionPartC'),
				10)));

		if (dedPartC < BFLAii5.value) {
			document
					.getElementsByName('partBTI.deductionsUnderScheduleVIAPartC')[0].value = dedPartC;
		} else {
			document
					.getElementsByName('partBTI.deductionsUnderScheduleVIAPartC')[0].value = BFLAii5.value;
		}

		// 11c
		coalesceSetRet('partBTI.totalDeductionsUnderScheduleVIA');
		coalesceSetRet('partBTI.deductionsUnderScheduleVIAPartB');
		coalesceSetRet('partBTI.deductionsUnderScheduleVIAPartC');
	var temp = eval(parseInt(coalesceSetRet('partBTI.deductionsUnderScheduleVIAPartB'),10)
				 + parseInt(coalesceSetRet('partBTI.deductionsUnderScheduleVIAPartC'),10)
			);
	
	var flag115BA = document
	.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	if(flag115BA == '115BAB'){
		if(temp > document.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value){
			document.getElementsByName('partBTI.totalDeductionsUnderScheduleVIA')[0].value = document.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value
		}
		
		else {
			document.getElementsByName('partBTI.totalDeductionsUnderScheduleVIA')[0].value = temp;
			
		}
		
	
		
	}else {
		
		document.getElementsByName('partBTI.totalDeductionsUnderScheduleVIA')[0].value = temp;
		
	}
	
		// 12
		var ded10A10AAAlwd = parseInt(coalesceSetRet('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses'));

		var minValue10AA = zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTI.grossTotalIncome'), 10)
				- parseInt(
						coalesceSetRet('partBTI.incChargeTaxSplRate111A112'),
						10)
				- parseInt(
						coalesceSetRet('partBTI.totalDeductionsUnderScheduleVIA'),
						10)));

		document.getElementsByName('partBTI.deductionsUnder10Aor10AA')[0].value = Math
				.min(
						parseInt(
								coalesceSetRet('schedule10AA.deductSEZ.dedUs10Detail.totalDedUs10Sub'),
								10), parseInt(minValue10AA, 10), ded10A10AAAlwd);

		document.getElementsByName('partBTI.totalIncome')[0].value = rndOffNrsTen(zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTI.grossTotalIncome'), 10)
				- parseInt(coalesceSetRet('partBTI.deductionsUnder10Aor10AA'),
						10)
				- parseInt(
						coalesceSetRet('partBTI.totalDeductionsUnderScheduleVIA'),
						10))));

		// 14
		// calling SI before 14
		calcScheduleSI();

		document.getElementsByName('partBTI.incomeChargeableTotTax')[0].value = eval(parseInt(
				coalesceSetRet('scheduleSI.totSplRateTaxableInc'), 10)

		);

		// 15
		if (document.getElementsByName('partBTI.incChargeableTaxNormalRates')[0].changed != true) {
			document.getElementsByName('partBTI.incChargeableTaxNormalRates')[0].value = zeroOrMore(eval(parseInt(
					coalesceSetRet('partBTI.totalIncome'), 10)
					- parseInt(
							coalesceSetRet('partBTI.incomeChargeableTotTax'),
							10)));
		} else {
			document.getElementsByName('partBTI.incChargeableTaxNormalRates')[0].changed = false;
		}
		// 15
		document
				.getElementsByName('partBTI.netAgricultureIncomeOrOtherIncomeForRate')[0].value = eval(parseInt(
				coalesceSetRet('scheduleEI.netAgriIncOrOthrIncRule7'), 10));
		
		// 16
		document.getElementsByName('partBTI.lossesOfCurrentYearCarriedFwd')[0].value = eval(
				parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.hpLossCFTotal'),10)
				-parseInt(coalesceSetRet('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.hpLossCFTotal'),10)
				+ parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.busLossOthThanSpecLossCF'),10)
				+ parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecBusCF'),10)
				+ parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecifiedBusCF'),10)
				+ parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmInsuCF'),10)
				+ parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal'),10)
				-parseInt(coalesceSetRet('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.stcgLossCFTotal'),10)
				+ parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal'),10)
				- parseInt(coalesceSetRet('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.ltcgLossCFTotal'),10)
				+ parseInt(coalesceSetRet('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF'),10)
				- parseInt(coalesceSetRet('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.othSrcLossRaceHorseCF'),10)
		);

		// 17
		document.getElementsByName('partBTI.deemedTotIncSec115JB')[0].value = zeroOrMore(parseInt(
				coalesceSetRet('scheduleMAT.deemedTotalIncUs115JB'), 10));

	} catch (e) {
		alert(e.stack);
	}
}

function calculatePartBTTI_first(cgosIncome) {
	try {

		// 1
		

				var flag115BA = document
				.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;

		if (flag115BA == '115BAA' || flag115BA == '115BAB') {
			document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.TaxDeemedTISec115JB')[0].value = 0;

		} else {
			document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.TaxDeemedTISec115JB')[0].value = eval(parseInt(
					coalesceSetRet('scheduleMAT.taxPayableUs115JB'), 10));
		}

		var surcharge1b = document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.surcharge')[0];

		var sysSurcharge = calculateItr6Surcharge();
		if (flag115BA == '115BAA' || flag115BA == '115BAB') {
			surcharge1b.value = 0;

		}else{
			if (surcharge1b.old != sysSurcharge) {
				surcharge1b.old = sysSurcharge;
				surcharge1b.value = sysSurcharge;
			}

		}
		
		var educationCss = Math
				.round((parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.TaxDeemedTISec115JB'),
						10) + parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.surcharge'),
						10)) * 0.04);
		var eduCess = document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.educationCess')[0];
		if (flag115BA == '115BAA' || flag115BA == '115BAB') {
			eduCess.value = 0;

		}else{
		if (eduCess.old != educationCss) {
			eduCess.old = educationCss;
			eduCess.value = educationCss;
		}
		}
		
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.totalTax')[0].value = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.TaxDeemedTISec115JB'),
				10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.surcharge'),
						10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.educationCess'),
						10));

		var compnyType = document
				.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
		

		// 2
		// setTaxPayableOnTotalInc();
		var specialRateTax = document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates')[0];
		// setEditableFieldValue(specialRateTax,
		// eval(parseInt(coalesceSetRet('scheduleSI.totSplRateIncTax'),10)));

		/*
		 * document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates')[0].value =
		 * eval( parseInt(coalesceSetRet('scheduleSI.totSplRateIncTax'),10) );
		 */

		var netTxblIncome = zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTI.incChargeableTaxNormalRates'), 10)));
		var incTax = document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates')[0];
	

		if (compnyType == 'Y' && (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB')) {
			setEditableFieldValue(specialRateTax, eval(parseInt(
					coalesceSetRet('scheduleSI.totSplRateIncTax'), 10)));
			setEditableFieldValue(incTax,
					calculateTaxPayableOnTotalInc(netTxblIncome));
		} else {
			specialRateTax.value = eval(parseInt(
					coalesceSetRet('scheduleSI.totSplRateIncTax'), 10));
			incTax.value = calculateTaxPayableOnTotalInc(netTxblIncome);
		}

		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')[0].value = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates'),
				10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates'),
						10));

		calcNormalSurcharge(cgosIncome);
		surcharge201718();

		// 4

		var eduCessTax = Math
				.round(eval((parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
						10) + parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.surchargeOnTaxPayable'),
						10)) * 0.04));

		// Surcharge on 2d

		calcNormalSurcharge(cgosIncome);
		surcharge201718();

		var educationCess = document
				.getElementsByName('partBTTI.computationOfTaxLiability.educationCess')[0];
		// var splRateIncTax =
		// parseInt(coalesce(document.getElementsByName('scheduleSI.splCodeRateTax[1].splRateIncTax')[0].value));
		var splRateIncTax = eval(parseInt(coalesce(document
				.getElementsByName('scheduleSI.splCodeRateTax[13].splRateIncTax')[0].value))
				+ parseInt(coalesce(document
						.getElementsByName('scheduleSI.splCodeRateTax[12].splRateIncTax')[0].value))
				+ parseInt(coalesce(document
						.getElementsByName('scheduleSI.splCodeRateTax[11].splRateIncTax')[0].value)));

		/*var splRateIncTax1 = parseInt(coalesce(document
				.getElementsByName('scheduleSI.splCodeRateTax[0].splRateIncTax')[0].value));
*/
		if ((compnyType == 'Y' && (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB')) || splRateIncTax > 0
				) {
			setEditableFieldValue(educationCess, eduCessTax);

		} else {
			educationCess.value = Math
					.round(eval((parseInt(
							coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
							10) + parseInt(
							coalesceSetRet('partBTTI.computationOfTaxLiability.surchargeOnTaxPayable'),
							10)) * 0.04));
		}

		// 5
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.grossTaxLiability')[0].value = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
				10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.surchargeOnTaxPayable'),
						10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.educationCess'),
						10));

		// 6
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.grossTaxPayable')[0].value = Math
				.max(
						parseInt(
								coalesceSetRet('partBTTI.computationOfTaxLiability.grossTaxLiability'),
								10),
						parseInt(
								coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.totalTax'),
								10));

		// auto populate MATC

		populateMATC();

	} catch (e) {
		alert(e.stack);
	}
}

function calculatePartBTTI_second(cgosIncome) {
	try {

		surcharge201718();
		// 7
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid')[0].value = 0;
		if (parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.grossTaxLiability'),
				10) > parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.totalTax'),
				10)) {
			document
					.getElementsByName('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid')[0].value = eval(parseInt(
					coalesceSetRet('scheduleMATC.amtTaxCredUs115JAA'), 10));
		}
		// 8
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableAfterCredUs115JAA')[0].value = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.grossTaxPayable'),
				10)
				- parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
						10));

		// 9
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxRelief.section90')[0].value = eval(parseInt(
				coalesceSetRet('scheduleTR1.totalIncomeOutIndia'), 10));
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxRelief.section91')[0].value = eval(parseInt(
				coalesceSetRet('scheduleTR1.totalIncomeOutIndiaDTAA'), 10));
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxRelief.totTaxRelief')[0].value = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxRelief.section90'),
				10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxRelief.section91'),
						10));
		// 10
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.netTaxLiability')[0].value = zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableAfterCredUs115JAA'),
				10)
				- parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.taxRelief.totTaxRelief'),
						10)));
		// 13
		calculateAdvancedTax();
		calculateTDS();
		calculateTCS();
		document.getElementsByName('partBTTI.taxPaid.taxesPaid.totalTaxesPaid')[0].value = eval(parseInt(
				coalesceSetRet('partBTTI.taxPaid.taxesPaid.advanceTax'), 10)
				+ parseInt(
						coalesceSetRet('partBTTI.taxPaid.taxesPaid.selfAssessmentTax'),
						10)
				+ parseInt(coalesceSetRet('partBTTI.taxPaid.taxesPaid.tds'), 10)
				+ parseInt(coalesceSetRet('partBTTI.taxPaid.taxesPaid.tcs'), 10));

		// 11
		calculate234IntrstForCompany(cgosIncome);
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.intrstPay.totalIntrstPay')[0].value = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234A'),
				10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234B'),
						10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234C'),
						10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234F'),
						10)

		);
		// 12
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.aggregateTaxInterestLiability')[0].value = zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.netTaxLiability'),
				10)
				+ parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.intrstPay.totalIntrstPay'),
						10)));
		// 14
		document.getElementsByName('partBTTI.taxPaid.balTaxPayable')[0].value = rndOffNrsTen(zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.aggregateTaxInterestLiability'),
				10)
				- parseInt(
						coalesceSetRet('partBTTI.taxPaid.taxesPaid.totalTaxesPaid'),
						10))));
		// 15
		document.getElementsByName('partBTTI.refundsDue')[0].value = rndOffNrsTen(zeroOrMore(eval(parseInt(
				coalesceSetRet('partBTTI.taxPaid.taxesPaid.totalTaxesPaid'), 10)
				- parseInt(
						coalesceSetRet('partBTTI.computationOfTaxLiability.aggregateTaxInterestLiability'),
						10))));

		showEpay();
	} catch (e) {
		alert(e.stack);
	}
}

function calculateTiTti(cgosIncome) {
	var varDate = document.getElementsByName('verification.date')[0];
	if (varDate.value == '' || varDate.value == undefined
			|| varDate.value == null) {
		var dt = new Date();
		varDate.value = ("00" + dt.getDate()).slice(-2) + '/'
				+ ("00" + (dt.getMonth() + 1)).slice(-2) + '/'
				+ dt.getFullYear();
	}

	calculatePartBTTI_first(cgosIncome);

}

function coalesce(value) {
	if (isNaN(value) || value == '') {
		value = 0;
	}
	return value;
}

function zeroOrMore(val) {
	val = coalesce(val);
	if (val < 0) {
		return 0;
	}
	return val;
}

function calculateItr6Surcharge() {
	var netTxblIncome = zeroOrMore(getAmt('scheduleMAT.deemedTotalIncUs115JB'));
	var status = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	if (netTxblIncome > 100000000) {
		return calculateItr6SurchargeOver10Crore();
	}
	var surcharge = 0;
	var taxOnTotInc = eval(parseInt(
			coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.TaxDeemedTISec115JB'),
			10));
	if (netTxblIncome > 10000000) {
		var surchargeRate = 0.12;
		if (status == 'N') {
			surchargeRate = 0.02;
		} else if (status == 'Y') {
			surchargeRate = 0.07;
		}

		var matTaxRate = calculateMatTaxRate();
		alert('matTaxRate'+matTaxRate);

		var taxOnCutOffInc = 10000000 * matTaxRate;
		alert('taxOnCutOffInc'+taxOnCutOffInc);
		if (rndOffNrsTen(netTxblIncome) > 10000000) {
			var tempSurcharge = taxOnTotInc * surchargeRate;
			alert('tempSurcharge'+tempSurcharge);

			// check if eligible for marginal relief
			var extraInc = rndOffNrsTen(netTxblIncome) - 10000000;
			if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc)) {
				var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
						- (taxOnCutOffInc + extraInc));
				alert('marginalRelief'+marginalRelief);
				surcharge = zeroOrMore(tempSurcharge - marginalRelief);
				surcharge = Math.round(surcharge);
			} else {
				surcharge = tempSurcharge;
				surcharge = Math.round(surcharge);
			}
		}
	}
	return Math.round(surcharge);
}

function calculateItr6SurchargeOver10Crore() {
	var netTxblIncome = zeroOrMore(getAmt('scheduleMAT.deemedTotalIncUs115JB'));
	var status = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var surcharge = 0;
	var taxOnTotInc = eval(parseInt(
			coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.TaxDeemedTISec115JB'),
			10));
	if (netTxblIncome > 100000000) {
		var surchargeRate = 0.12;
		var chargeOn1Crore = 1.07;
		if (status == 'N') {
			surchargeRate = 0.05;
			chargeOn1Crore = 1.02;
		}

		var matTaxRate = calculateMatTaxRate();

		var taxOnCutOffInc = 100000000 * matTaxRate * chargeOn1Crore;
		if (rndOffNrsTen(netTxblIncome) > 100000000) {
			var tempSurcharge = taxOnTotInc * surchargeRate;

			// check if eligible for marginal relief
			var extraInc = rndOffNrsTen(netTxblIncome) - 100000000;
			if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc)) {
				var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
						- (taxOnCutOffInc + extraInc));
				surcharge = zeroOrMore(tempSurcharge - marginalRelief);
				surcharge = Math.round(surcharge);
			} else {
				surcharge = tempSurcharge;
				surcharge = Math.round(surcharge);
			}
		}
	}
	return Math.round(surcharge);
}

function calcNormalSurcharge(cgosIncome) {
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var netIncome = getAmt('partBTI.totalIncome');
	var netTxblIncome = zeroOrMore(netIncome);
	var flag115BA = document.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	if ((domesticCompFlg == 'Y' || domesticCompFlg == 'N')
			&& netTxblIncome > 100000000 && (flag115BA != '115BAA' && flag115BA != '115BAB') ) {
		alert('Above 10crore');
		return calsurchargeOnAbove10Crore(cgosIncome);
	}
	if (domesticCompFlg == 'Y' && (flag115BA == '115BAA' || flag115BA == '115BAB') ){
		alert('Above 115BAB check');
		return calsurchargeOn115BABCheck(cgosIncome);
	}
	alert('Above Other check');
	return calsurchargeOnAboveCrore(cgosIncome);
}
function calsurchargeOn115BABCheck(cgosIncome) {
	var surchargeOther115BBE = document
	.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0];
	var f_115BBE = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
				10)
				- (parseInt(
						coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
						10) * 0.60));
alert('f_115BBE'+f_115BBE);
		var tempSurcharge = eval(( 0.10 * parseInt(f_115BBE, 10))
				+ (parseInt(
						coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
						10) * 0.60 * 0.25));
		alert('tempSurcharge'+tempSurcharge);
		var surcharge;
			surcharge = tempSurcharge;
			surcharge = Math.round(surcharge);
	var surchargeIT = zeroOrMore(eval(surcharge
			- (parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
					10) * 0.60 * 0.25)));
	alert('surchargeIT'+surchargeIT);
	surchargeOther115BBE.value = surchargeIT;
}

function calsurchargeOnAboveCrore(cgosIncome) {
	var surchargeOnAboveCrore = document
			.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOnTaxPayable')[0];
	var surchargeOther115BBE = document
			.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0];
	var totInc = document.getElementsByName('partBTI.totalIncome')[0].value;
	totInc = coalesce(totInc);
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	var surcharge = 0;
	var totalIncome = document.getElementsByName('partBTI.totalIncome')[0].value;
	var incChargeTaxSplRate111A112 = document
			.getElementsByName('partBTI.incChargeTaxSplRate111A112')[0].value;

	var dtaaInc = eval(parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[13].splRateInc')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[12].splRateInc')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[11].splRateInc')[0].value)));

	var dtaaTax = eval(parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[13].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[12].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[11].splRateIncTax')[0].value)));

	var flag115BA = document
			.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var compnyType = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var splRateIncTax = eval(parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[13].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[12].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[11].splRateIncTax')[0].value)));
	/*var splRateIncTax1 = parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[0].splRateIncTax')[0].value));*/
	var temp112A = 0;
	if (parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc')) <= 100000) {
		temp112A = 0;
	} else {
		temp112A = parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc'))
				- parseInt(100000);
	}
	var rowCount1 = countRowInTable('scheduleSI.splCodeRateTax', 'splRateInc');
	var taxableInc112A=parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc'));
	var taxableIncPti112A=0;
	var tempPti112A = 0;
	for (var i = 12; i < rowCount1; i++) {
		var secCode = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].secCode')[0].value;
		var splCodeValue = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRateInc')[0].value;
		var splRatePercent = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRatePercent')[0].value;
		var splRateIncTaxPti112A = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRateIncTax')[0].value;
		if (secCode == 'PTI_LTCG10P112A') {
			if (taxableInc112A <= 100000) {
				taxableIncPti112A=document.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].taxableInc')[0].value;
				var exmp = parseInt('100000', 10) - parseInt(coalesce(taxableInc112A));
				if (parseInt(document
						.getElementsByName('scheduleSI.splCodeRateTax[' + i
								+ '].taxableInc')[0].value) <= exmp) {
					tempPti112A = 0;
				} else {
					tempPti112A = parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax['
									+ i + '].taxableInc')[0].value)
							- exmp;
				}
			} 
		}
	}
	var temp115ADp = 0;
	if (parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[10].taxableInc')) <= 100000) {
		temp115ADp = 0;
	} else {
		temp115ADp = parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[10].taxableInc'))
				- parseInt(100000);
	}

	var exemption1125Ad = (-(parseInt(coalesce(taxableIncPti112A)))+tempPti112A)
		+(-(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc')) + temp112A)
			+ (-(coalesceSetRet('scheduleSI.splCodeRateTax[10].taxableInc')) + temp115ADp);

	// for surcharge

	totInc = parseInt(totInc);
	var tax = parseInt(
			coalesce(document
					.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')[0].value),
			10);

	var normalInc = getSlabbedIncome(parseInt(totalIncome
			- incChargeTaxSplRate111A112));

	var toBeTaxed = zeroOrMore(10000000 - coalesce(dtaaInc));
	var rowCount1 = countRowInTable('scheduleSI.splCodeRateTax', 'splRateInc');

	var percent5SIInc = 0;

	var percent10SIInc = 0;

	var percent15SIInc = 0;

	var percent20SIInc = 0;

	var percent125SIInc = 0;

	var percent25SIInc = 0;

	var percent30SIInc = 0;

	var percent50SIInc = 0;

	var percent60SIInc = 0;

	for (var i = 0; i < rowCount1; i++) {

		var splRatePercent = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRatePercent')[0].value;

		if (splRatePercent == 5) {

			percent5SIInc = eval(parseInt(percent5SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 10) {

			percent10SIInc = eval(parseInt(percent10SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 12.5) {

			percent125SIInc = eval(parseInt(percent125SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 15) {

			percent15SIInc = eval(parseInt(percent15SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 20) {

			percent20SIInc = eval(parseInt(percent20SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 25) {

			percent25SIInc = eval(parseInt(percent25SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 30) {

			percent30SIInc = eval(parseInt(percent30SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 50) {

			percent50SIInc = eval(parseInt(percent50SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 60) {

			percent60SIInc = eval(parseInt(percent60SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));
		}
	}

	var cgTax = 0;

	var cgTaxed = 0;

	if (parseInt(percent5SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = (percent5SIInc) * 0.05;
		cgTaxed = percent5SIInc;
		toBeTaxed -= parseInt(percent5SIInc, 0);
	} else {
		cgTax = (toBeTaxed) * 0.05;
		cgTaxed = toBeTaxed;
		toBeTaxed = 0;
	}

	percent10SIInc = parseInt(percent10SIInc, 10)
			+ parseInt(normalInc["10"], 10);

	if (parseInt(percent10SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent10SIInc + exemption1125Ad) * 0.1;
		cgTaxed = parseInt(cgTaxed) + percent10SIInc;
		toBeTaxed -= parseInt(percent10SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed + exemption1125Ad) * 0.1;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent125SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent125SIInc) * parseFloat(0.125);
		cgTaxed = parseInt(cgTaxed) + percent125SIInc;
		toBeTaxed -= parseInt(percent125SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * parseFloat(0.125);
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent15SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent15SIInc) * parseFloat(0.15);
		cgTaxed = parseInt(cgTaxed) + percent15SIInc;
		toBeTaxed -= parseInt(percent15SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * parseFloat(0.15);
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	percent20SIInc = parseInt(percent20SIInc, 10)
			+ parseInt(normalInc["20"], 10);

	if (parseInt(percent20SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent20SIInc) * 0.2;
		cgTaxed = parseInt(cgTaxed) + percent20SIInc;
		toBeTaxed -= parseInt(percent20SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.2;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent25SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent25SIInc) * 0.25;
		cgTaxed = parseInt(cgTaxed) + percent25SIInc;
		toBeTaxed -= parseInt(percent25SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.25;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(normalInc["25"], 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + parseInt(normalInc["25"], 10) * 0.25;
		cgTaxed = parseInt(cgTaxed) + parseInt(normalInc["25"], 10);
		toBeTaxed -= parseInt(normalInc["25"], 10);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.25;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	percent30SIInc = parseInt(percent30SIInc, 10)
			+ parseInt(normalInc["30"], 10);

	if (parseInt(percent30SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent30SIInc) * 0.3;
		cgTaxed = parseInt(cgTaxed) + percent30SIInc;
		toBeTaxed -= parseInt(percent30SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.3;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(normalInc["40"], 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (normalInc["40"]) * 0.4;
		cgTaxed = parseInt(cgTaxed) + normalInc["40"];
		toBeTaxed -= parseInt(normalInc["40"], 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.4;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent50SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent50SIInc) * 0.5;
		cgTaxed = parseInt(cgTaxed) + percent50SIInc;
		toBeTaxed -= parseInt(percent50SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.5;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent60SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent60SIInc) * 0.6;
		cgTaxed = parseInt(cgTaxed) + percent60SIInc;
		toBeTaxed -= parseInt(percent60SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.6 * 1.25;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	var taxOnCutOffInc = eval(parseInt(coalesce(cgTax))
			+ parseInt(coalesce(dtaaTax)));

	var surchrgeRate = 0.12;
	if (domesticCompFlg == 'N') {
		surchrgeRate = 0.02;
	} else if (domesticCompFlg == 'Y') {
		surchrgeRate = 0.07;
	}
	if (rndOffNrsTen(totInc) > 10000000) {

		var f_115BBE = eval(parseInt(
				coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
				10)
				- (parseInt(
						coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
						10) * 0.60));

		var tempSurcharge = eval((surchrgeRate * parseInt(f_115BBE, 10))
				+ (parseInt(
						coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
						10) * 0.60 * 0.25));

		// check if eligible for marginal relief
		var extraInc = rndOffNrsTen(totInc) - 10000000;

		if ((tax + tempSurcharge) > (taxOnCutOffInc + extraInc)) {
			var marginalRelief = zeroOrMore(tax + tempSurcharge
					- (taxOnCutOffInc + extraInc));

			surcharge = zeroOrMore(tempSurcharge - marginalRelief);
			surcharge = Math.round(surcharge);

		} else {

			surcharge = tempSurcharge;
			surcharge = Math.round(surcharge);
		}
	} else {
		surcharge = parseInt('0', 10);
	}

	setEditableFieldValue(surchargeOnAboveCrore, surcharge);

	var surchargeIT = zeroOrMore(eval(surcharge
			- (parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
					10) * 0.60 * 0.25)));
	if ((compnyType == 'Y' && (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB')) || (splRateIncTax > 0)
			) {

		setEditableFieldValue(surchargeOther115BBE, surchargeIT); 
		
	} else {

		surchargeOther115BBE.value = surchargeIT;
	}

}

function calsurchargeOnAbove10Crore(cgosIncome) {
	var surchargeOnAboveCrore = document
			.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOnTaxPayable')[0];
	var surchargeOther115BBE = document
			.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0];
	var totInc = document.getElementsByName('partBTI.totalIncome')[0].value;
	totInc = coalesce(totInc);
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	var surcharge = 0;
	var totalIncome = document.getElementsByName('partBTI.totalIncome')[0].value;
	var incChargeTaxSplRate111A112 = document
			.getElementsByName('partBTI.incChargeTaxSplRate111A112')[0].value;
	var taxAtSpecialRates = document
			.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates')[0].value;

	var dtaaInc = eval(parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[13].splRateInc')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[12].splRateInc')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[11].splRateInc')[0].value)));

	var b115Inc = document
			.getElementsByName('scheduleSI.splCodeRateTax[1].splRateInc')[0].value;

	var dtaaTax = eval(parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[13].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[12].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[11].splRateIncTax')[0].value)));
	var b115Tax = 0;

	var flag115BA = document
			.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var compnyType = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var splRateIncTax = eval(parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[13].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[12].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[11].splRateIncTax')[0].value)));

	/*var splRateIncTax1 = parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[0].splRateIncTax')[0].value));*/
	// for surcharge

	totInc = parseInt(totInc);
	var tax = parseInt(calculateTaxPayableOnTotalInc(totalIncome
			- incChargeTaxSplRate111A112))
			+ parseInt(taxAtSpecialRates);

	var normalInc = getSlabbedIncome(parseInt(totalIncome
			- incChargeTaxSplRate111A112));

	var toBeTaxed = zeroOrMore(100000000 - coalesce(dtaaInc));

	var rowCount1 = countRowInTable('scheduleSI.splCodeRateTax', 'splRateInc');

	var percent5SIInc = 0;

	var percent10SIInc = 0;

	var percent15SIInc = 0;

	var percent20SIInc = 0;

	var percent125SIInc = 0;

	var percent25SIInc = 0;

	var percent30SIInc = 0;

	var percent50SIInc = 0;

	var percent60SIInc = 0;

	for (var i = 0; i < rowCount1; i++) {

		var splRatePercent = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRatePercent')[0].value;

		if (splRatePercent == 5) {

			percent5SIInc = eval(parseInt(percent5SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 10) {

			percent10SIInc = eval(parseInt(percent10SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 12.5) {

			percent125SIInc = eval(parseInt(percent125SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 15) {

			percent15SIInc = eval(parseInt(percent15SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 20) {

			percent20SIInc = eval(parseInt(percent20SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 25) {

			percent25SIInc = eval(parseInt(percent25SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 30) {

			percent30SIInc = eval(parseInt(percent30SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 50) {

			percent50SIInc = eval(parseInt(percent50SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));

		} else if (splRatePercent == 60) {

			percent60SIInc = eval(parseInt(percent60SIInc, 10)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].taxableInc')[0].value, 10));
		}
	}

	var cgTax = 0;

	var cgTaxed = 0;
	var temp112A = 0;
	if (parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc')) <= 100000) {
		temp112A = 0;
	} else {
		temp112A = parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc'))
				- parseInt(100000);
	}
	var rowCount1 = countRowInTable('scheduleSI.splCodeRateTax', 'splRateInc');
	var taxableInc112A=parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc'));
	var taxableIncPti112A=0;
	var tempPti112A = 0;
	for (var i = 12; i < rowCount1; i++) {
		var secCode = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].secCode')[0].value;
		var splCodeValue = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRateInc')[0].value;
		var splRatePercent = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRatePercent')[0].value;
		var splRateIncTaxPti112A = document
				.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].splRateIncTax')[0].value;
		if (secCode == 'PTI_LTCG10P112A') {
			if (taxableInc112A <= 100000) {
				taxableIncPti112A=document.getElementsByName('scheduleSI.splCodeRateTax[' + i
						+ '].taxableInc')[0].value;
				var exmp = parseInt('100000', 10) - parseInt(coalesce(taxableInc112A));
				if (parseInt(document
						.getElementsByName('scheduleSI.splCodeRateTax[' + i
								+ '].taxableInc')[0].value) <= exmp) {
					tempPti112A = 0;
				} else {
					tempPti112A = parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax['
									+ i + '].taxableInc')[0].value)
							- exmp;
				}
			} 
		}
	}
	var temp115ADp = 0;
	if (parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[10].taxableInc')) <= 100000) {
		temp115ADp = 0;
	} else {
		temp115ADp = parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[10].taxableInc'))
				- parseInt(100000);
	}

	var exemption1125Ad =  (-(parseInt(coalesce(taxableIncPti112A)))+tempPti112A)
	+ (-(coalesceSetRet('scheduleSI.splCodeRateTax[5].taxableInc')) + temp112A)
			+ (-(coalesceSetRet('scheduleSI.splCodeRateTax[10].taxableInc')) + temp115ADp)

	if (parseInt(percent5SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = (percent5SIInc) * 0.05;
		cgTaxed = percent5SIInc;
		toBeTaxed -= parseInt(percent5SIInc, 0);
	} else {
		cgTax = (toBeTaxed) * 0.05;
		cgTaxed = toBeTaxed;
		toBeTaxed = 0;
	}

	percent10SIInc = parseInt(percent10SIInc, 10)
			+ parseInt(normalInc["10"], 10);

	if (parseInt(percent10SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent10SIInc + exemption1125Ad) * 0.1;
		cgTaxed = parseInt(cgTaxed) + percent10SIInc;
		toBeTaxed -= parseInt(percent10SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed + exemption1125Ad) * 0.1;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent125SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent125SIInc) * parseFloat(0.125);
		cgTaxed = parseInt(cgTaxed) + percent125SIInc;
		toBeTaxed -= parseInt(percent125SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * parseFloat(0.125);
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent15SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent15SIInc) * parseFloat(0.15);
		cgTaxed = parseInt(cgTaxed) + percent15SIInc;
		toBeTaxed -= parseInt(percent15SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * parseFloat(0.15);
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	percent20SIInc = parseInt(percent20SIInc, 10)
			+ parseInt(normalInc["20"], 10);

	if (parseInt(percent20SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent20SIInc) * 0.2;
		cgTaxed = parseInt(cgTaxed) + percent20SIInc;
		toBeTaxed -= parseInt(percent20SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.2;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent25SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent25SIInc) * 0.25;
		cgTaxed = parseInt(cgTaxed) + percent25SIInc;
		toBeTaxed -= parseInt(percent25SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.25;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(normalInc["25"], 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + parseInt(normalInc["25"], 10) * 0.25;
		cgTaxed = parseInt(cgTaxed) + parseInt(normalInc["25"], 10);
		toBeTaxed -= parseInt(normalInc["25"], 10);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.25;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	percent30SIInc = parseInt(percent30SIInc, 10)
			+ parseInt(normalInc["30"], 10);

	if (parseInt(percent30SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent30SIInc) * 0.3;
		cgTaxed = parseInt(cgTaxed) + percent30SIInc;
		toBeTaxed -= parseInt(percent30SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.3;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(normalInc["40"], 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (normalInc["40"]) * 0.4;
		cgTaxed = parseInt(cgTaxed) + normalInc["40"];
		toBeTaxed -= parseInt(normalInc["40"], 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.4;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	if (parseInt(percent50SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent50SIInc) * 0.5;
		cgTaxed = parseInt(cgTaxed) + percent50SIInc;
		toBeTaxed -= parseInt(percent50SIInc, 0);
	} else {
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.5;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	var used5BBE = percent60SIInc;

	if (parseInt(percent60SIInc, 10) < parseInt(toBeTaxed, 0)) {
		cgTax = parseInt(cgTax, 10) + (percent60SIInc) * 0.6;
		cgTaxed = parseInt(cgTaxed) + percent60SIInc;
		toBeTaxed -= parseInt(percent60SIInc, 0);
	} else {
		used5BBE = toBeTaxed;
		cgTax = parseInt(cgTax, 10) + (toBeTaxed) * 0.6 * 1.25;
		cgTaxed = parseInt(cgTaxed) + toBeTaxed;
		toBeTaxed = 0;
	}

	var surchrgeRate = 0.12;
	var chargeOn1Crore = 0.07; // 1.07 to 0.07
	if (domesticCompFlg == 'N') {
		surchrgeRate = 0.05;
		chargeOn1Crore = 0.02; // 1.02 to 0.02
	}

	var normalCutOffInc = 100000000 - parseInt(cgTaxed) - coalesce(dtaaInc)
			- coalesce(b115Inc);

	var cgTaxAftr115BBE = parseInt(cgTax) - ((used5BBE) * 0.6 * 1.25);

	var taxOnCutOffInc = ((calculateTaxPayableOnTotalInc(zeroOrMore(normalCutOffInc))
			+ parseInt(cgTaxAftr115BBE) + parseInt(dtaaTax) + parseInt(b115Tax)) * chargeOn1Crore)
			+ parseInt(cgTax);

	var f_115BBE = eval(parseInt(
			coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
			10)
			- (parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
					10) * 0.60));

	var tempSurcharge = eval((surchrgeRate * parseInt(f_115BBE, 10))
			+ (parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
					10) * 0.60 * 0.25));

	// check if eligible for marginal relief
	var extraInc = rndOffNrsTen(totInc) - 100000000;

	if ((tax + tempSurcharge) > (taxOnCutOffInc + extraInc)) {
		var marginalRelief = zeroOrMore(tax + tempSurcharge
				- (taxOnCutOffInc + extraInc));

		surcharge = zeroOrMore(tempSurcharge - marginalRelief);
		surcharge = Math.round(surcharge);

	} else {
		surcharge = tempSurcharge;
		surcharge = Math.round(surcharge);
	}

	setEditableFieldValue(surchargeOnAboveCrore, surcharge);

	var surchargeIT = zeroOrMore(eval(surcharge
			- (parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
					10) * 0.60 * 0.25)));
	if ((compnyType == 'Y' && (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB')) || (splRateIncTax > 0)
			) {
		setEditableFieldValue(surchargeOther115BBE, surchargeIT); // retain
																	// previous
																	// value
	} else {
		surchargeOther115BBE.value = surchargeIT;
	}

}

function setTaxPayableOnTotalInc() {

	// DC-01,FC-02

	var netTxblIncome = zeroOrMore(eval(parseInt(
			coalesceSetRet('partBTI.incChargeableTaxNormalRates'), 10)));
	var incTax = document
			.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates')[0];

	setEditableFieldValue(incTax, calculateTaxPayableOnTotalInc(netTxblIncome));

	// incTax.value = calculateTaxPayableOnTotalInc(netTxblIncome);

}

function calculateTaxPayableOnTotalInc(netTxblIncome) {

	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0];
	// DC-01,FC-02

	var grossReceiptFlg = document
			.getElementsByName('partAGEN1.filingStatus.grossreceipt')[0];
	
	var flag115BA = document
	.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
		

	var incTax = 0;
	
	var temp= eval(parseInt(coalesceSetRet('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses'))
			 - parseInt(coalesceSetRet('partBTI.totalDeductionsUnderScheduleVIA')));
	 alert('temp'+temp);
		
	if (domesticCompFlg.value == 'Y') {
		
		
	
		if (grossReceiptFlg.value == 'N' || flag115BA == '115BA' ) {

			incTax = rndOffNrsTen(eval(parseInt(rndOffNrsTen(netTxblIncome), 10)
					* parseFloat('0.25')));
		
			
		} else if(flag115BA == '115BAA'){
			
			incTax = rndOffNrsTen(eval(parseInt(rndOffNrsTen(netTxblIncome), 10)
					* parseFloat('0.22')));
		} else if(flag115BA == '115BAB'){
			 alert('in bab'+netTxblIncome-temp);
			incTax = rndOffNrsTen(eval(parseInt(rndOffNrsTen(netTxblIncome-temp), 10)
					* parseFloat('0.22')))  + (temp * parseFloat('0.15'));
			
			 alert('in incTax'+incTax);
		}
		else {

			incTax = eval(parseInt(rndOffNrsTen(netTxblIncome), 10)
					* parseFloat('0.3'));

		}
	
		}
	 else if (domesticCompFlg.value == 'N') {

		incTax = eval(parseInt(rndOffNrsTen(netTxblIncome), 10)
				* parseFloat('0.4'));
	}

	return incTax;
}

function calculateAdvancedTax() {
	var advanceTax = parseInt('0', 10);
	var selfAssessmentTax = parseInt('0', 10);
	var tab3 = document.getElementById('scheduleIt');
	var allInputTags = tab3.getElementsByTagName('input');
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("dateDep$")) {
			if (checkFirstDateBefore('01/04/2019', allInputTags[i].value)
					&& checkFirstDateBefore(allInputTags[i].value, '31/03/2020')) {
				advanceTax = eval(parseInt(isNVL(advanceTax), 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));
			} else if (checkFirstDateBefore('01/04/2020', allInputTags[i].value)) {
				selfAssessmentTax = eval(parseInt(isNVL(selfAssessmentTax), 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));
			}
		}
	}
	document.getElementsByName('partBTTI.taxPaid.taxesPaid.advanceTax')[0].value = advanceTax;
	document.getElementsByName('partBTTI.taxPaid.taxesPaid.selfAssessmentTax')[0].value = selfAssessmentTax;
	return advanceTax;
}

function calculateAdvancedTax234A(date) {
	var advanceTax = parseInt('0', 10);
	var tab3 = document.getElementById('scheduleIt');
	var allInputTags = tab3.getElementsByTagName('input');
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("dateDep$")) {
			if (checkFirstDateBefore('01/04/2020', allInputTags[i].value)
					&& checkFirstDateBefore(allInputTags[i].value, date)) {
				advanceTax = eval(parseInt(isNVL(advanceTax), 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));
			}
		}
	}
	return advanceTax;
}

function calculateTDS() {

	var TDS = parseInt('0', 10);
	var TDS1 = parseInt('0', 10);
	var tab1 = document.getElementById('scheduleTDS1');
	var allInputTags = tab1.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {

		if (allInputTags[i].name.match("claimOwnHands$")) {/*
															 * 
															 * if(eval(parseInt(coalesce(allInputTags[i].value),10)) >
															 * eval(parseInt(coalesce(allInputTags[i-1].value),10) +
															 * parseInt(coalesce(allInputTags[i-2].value),10))){
															 * 
															 * addError(allInputTags[i],'Amount
															 * claimed for this
															 * year cannot be
															 * more than total
															 * tax
															 * deducted',true);
															 * j.setFieldError(allInputTags[i].name,'Amount
															 * claimed for this
															 * year cannot be
															 * more than total
															 * tax deducted');
															 * allInputTags[i].value =
															 * '0'; TDS1 =
															 * eval(parseInt(TDS1
															 * ,10) +
															 * parseInt(isNVL(allInputTags[i].value)
															 * ,10));
															 * 
															 * }else{
															 */
			TDS1 = eval(parseInt(TDS1, 10)
					+ parseInt(isNVL(allInputTags[i].value), 10));

			/*
			 * }
			 * 
			 * allInputTags[i+1].value =
			 * zeroOrMore(parseInt(coalesce(allInputTags[i-2].value)) +
			 * parseInt(coalesce(allInputTags[i-1].value)) -
			 * parseInt(coalesce(allInputTags[i].value)));
			 */
		}
	}

	var TDS2 = parseInt('0', 10);
	var tab1 = document.getElementById('scheduleTDS2');
	var allInputTags = tab1.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {

		if (allInputTags[i].name.match("claimOwnHands$")) {/*
															 * 
															 * if(eval(parseInt(coalesce(allInputTags[i].value),10)) >
															 * eval(parseInt(coalesce(allInputTags[i-1].value),10) +
															 * parseInt(coalesce(allInputTags[i-2].value),10))){
															 * 
															 * addError(allInputTags[i],'Amount
															 * claimed for this
															 * year cannot be
															 * more than total
															 * tax
															 * deducted',true);
															 * j.setFieldError(allInputTags[i].name,'Amount
															 * claimed for this
															 * year cannot be
															 * more than total
															 * tax deducted');
															 * allInputTags[i].value =
															 * '0'; TDS2 =
															 * eval(parseInt(TDS2
															 * ,10) +
															 * parseInt(isNVL(allInputTags[i].value)
															 * ,10));
															 * 
															 * }else{
															 */
			TDS2 = eval(parseInt(TDS2, 10)
					+ parseInt(isNVL(allInputTags[i].value), 10));

			/*
			 * }
			 * 
			 * allInputTags[i+1].value =
			 * zeroOrMore(parseInt(coalesce(allInputTags[i-2].value)) +
			 * parseInt(coalesce(allInputTags[i-1].value)) -
			 * parseInt(coalesce(allInputTags[i].value)));
			 */}

	}

	TDS = eval(parseInt(TDS1, 10) + parseInt(TDS2, 10));
	document.getElementsByName('partBTTI.taxPaid.taxesPaid.tds')[0].value = TDS;
	/*
	 * document.getElementsByName('scheduleTDS1.tdSonOthThanSal.totalTDSonSalaries')[0].value =
	 * parseInt(TDS1,10);
	 * document.getElementsByName('scheduleTDS2.tdSonOthThanSal.totalTDSonOthThanSals')[0].value =
	 * parseInt(TDS2,10);
	 */
	return TDS;
}

function calculateTCS() {

	var TCS = parseInt('0', 10);
	var tcsTAB = document.getElementById('scheduleTCS');
	var allInputTags = tcsTAB.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {

		if (allInputTags[i].name.match("amtTCSClaimedThisYear$")) {

			if (eval(parseInt(coalesce(allInputTags[i].value), 10)) > eval(parseInt(
					coalesce(allInputTags[i - 1].value), 10)
					+ parseInt(coalesce(allInputTags[i - 2].value), 10))) {

				addError(
						allInputTags[i],
						'Amount claimed this year" cannot  more than Col (5) or Col (6) as the case may be  in schedule TCS',
						true);
				j
						.setFieldError(
								allInputTags[i].name,
								'Amount claimed this year" cannot  more than Col (5) or Col (6) as the case may be  in schedule TCS');
				allInputTags[i].value = '0';

				TCS = eval(parseInt(TCS, 10)
						+ parseInt(isNVL(allInputTags[i].value), 10));

			} else {

				TCS = eval(parseInt(TCS, 10)
						+ parseInt(isNVL(allInputTags[i].value), 10));

			}

			allInputTags[i + 1].value = eval(parseInt(
					isNVL(allInputTags[i - 1].value), 10)
					+ parseInt(isNVL(allInputTags[i - 2].value), 10)
					- parseInt(isNVL(allInputTags[i].value), 10));

		}

	}
	document.getElementsByName('partBTTI.taxPaid.taxesPaid.tcs')[0].value = parseInt(
			TCS, 10);
	document.getElementsByName('scheduleTCS.totalTcSSalary')[0].value = parseInt(
			TCS, 10);
	return TCS;
}

function calculate234IntrstForCompany(cgosIncome) {
	var advanceTax = document
			.getElementsByName('partBTTI.taxPaid.taxesPaid.advanceTax')[0].value;
	var TDSToDisplay = document
			.getElementsByName('partBTTI.taxPaid.taxesPaid.tds')[0];
	TDSToDisplay.value = coalesce(TDSToDisplay.value);
	var TDS = TDSToDisplay.value;

	var TCSToDisplay = document
			.getElementsByName('partBTTI.taxPaid.taxesPaid.tcs')[0];
	TCSToDisplay.value = coalesce(TCSToDisplay.value);
	var TCS = TCSToDisplay.value;

	var balTaxPayable = document
			.getElementsByName('partBTTI.computationOfTaxLiability.netTaxLiability')[0];
	balTaxPayable.value = coalesce(balTaxPayable.value);

	var advanceTax234A = parseInt('0', 10);
	var tempIntrst234APrinciple = parseInt(balTaxPayable.value, 10) - parseInt(advanceTax, 10)
	- parseInt(TDS, 10) - parseInt(TCS, 10);
	if(tempIntrst234APrinciple> parseInt('100000', 10))
	{
		advanceTax234A = calculateAdvancedTax234A(getDueDate234A());
	}
	else
	{
		advanceTax234A = calculateAdvancedTax234A(Int_234A_IF_NO_dt);
	}
	
	
	var intrst234Aprinciple;
	if (parseInt(balTaxPayable.value, 10) - parseInt(advanceTax, 10)
			- parseInt(advanceTax234A, 10) - parseInt(TDS, 10)
			- parseInt(TCS, 10) < 0) {

		intrst234Aprinciple = parseInt('0', 10);
	} else {

		intrst234Aprinciple = parseInt(balTaxPayable.value, 10)
				- parseInt(advanceTax, 10) - parseInt(advanceTax234A, 10)
				- parseInt(TDS, 10) - parseInt(TCS, 10);

		// Rounding off to previous hundered
		if (parseInt(intrst234Aprinciple, 10) > 100) {
			intrst234Aprinciple = Math
					.floor(parseInt(intrst234Aprinciple, 10) / 100)
					* parseInt('100', 10);

		}
	}
	var currentDate = document.getElementsByName('verification.date')[0].value;
	var filingType = document
			.getElementsByName('partAGEN1.filingStatus.secHidden')[0].value;

	if (checkFirstDateBefore(currentDate, getCurrentDate())) {
		currentDate = getCurrentDate();
	}

	var actualDate = currentDate;

	var originalFilingDate = document
			.getElementsByName('partAGEN1.filingStatus.origRetFiledDate')[0].value;
	if ((filingType == '17' || filingType == '19' || filingType == '18')
			&& originalFilingDate != undefined && originalFilingDate != null
			&& originalFilingDate != '') {
		currentDate = originalFilingDate;
	}

	var duedate = getDueDate234A();


	 if (getDueDate234A() == '15/02/2021') {

		duedate = '16/02/2021';

	}  else if (getDueDate234A() == '31/10/2020') {

		duedate = '01/11/2020';

	}else if (getDueDate234A() == '30/11/2020') {

		duedate = '01/12/2020';
	}
	
	if(parseInt(tempIntrst234APrinciple,10)> parseInt('100000', 10))
		{

			var MonthsAfterDueDate =  calcNoOfMonths(currentDate , duedate);
			MonthsAfterDueDate = MonthsAfterDueDate - 1;
		}
	else
	{
		duedate=Int_234A_Due_date_234A;

		var MonthsAfterDueDate =  calcNoOfMonths(currentDate , duedate);
	}
	var MonthsAfterDueDate = calcNoOfMonths(currentDate, duedate);

	var intrst234A = parseInt(intrst234Aprinciple, 10) * parseFloat('0.01')
			* parseInt(MonthsAfterDueDate);
//end of 234a calculation
	var intrst234B = parseInt('0', 10);
	var intrst234C = parseInt('0', 10);
	var intrst234F = parseInt('0', 10);

	var slab0 = parseInt('0', 10);
	var slab1 = parseInt('0', 10);
	var slab2 = parseInt('0', 10);
	var slab3 = parseInt('0', 10);
	var slab4 = parseInt('0', 10);

	var tab4 = document.getElementById('scheduleIt');
	var allInputTags = tab4.getElementsByTagName('input');
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("dateDep$")) {

			if (checkFirstDateBefore(FY_start_date, allInputTags[i].value)
					&& checkFirstDateBefore(allInputTags[i].value,
							slab0_end_date)) {
				slab0 = eval(parseInt(slab0, 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));

			} else if (checkFirstDateBefore(slab1_start_date,
					allInputTags[i].value)
					&& checkFirstDateBefore(allInputTags[i].value,
							slab1_end_date)) {
				slab1 = eval(parseInt(slab1, 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));
			}

			else if (checkFirstDateBefore(slab2_start_date,
					allInputTags[i].value)
					&& checkFirstDateBefore(allInputTags[i].value,
							slab2_end_date)) {
				slab2 = eval(parseInt(slab2, 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));
			}

			else if (checkFirstDateBefore(slab3_start_date,
					allInputTags[i].value)
					&& checkFirstDateBefore(allInputTags[i].value,
							slab3_end_date)) {
				slab3 = eval(parseInt(slab3, 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));
			}

			else if (checkFirstDateBefore(slab4_start_date,
					allInputTags[i].value)
					&& checkFirstDateBefore(allInputTags[i].value, FY_end_date)) {
				slab4 = eval(parseInt(slab4, 10)
						+ parseInt(isNVL(allInputTags[i + 2].value), 10));
			}
		}
	}
	// ===============Interest234C calculation=======================


	intrst234C = calculate234cIntrst(TDS, TCS, [ slab0, slab1, slab2, slab3,
			slab4 ], cgosIncome);

	// ===============Interest234F calculation=======================

	setSecRespOnSave();

	var filingSec = document
			.getElementsByName('partAGEN1.filingStatus.secHidden')[0].value;

	if ((filingSec == '17' || filingSec == '18')
			&& originalFilingDate != undefined && originalFilingDate != null
			&& originalFilingDate != '') {
		currentDate = originalFilingDate;
	}
	var liableSec92Eflg = document
			.getElementsByName('partAGEN2.liableSec92Eflg')[0].value;
	if (liableSec92Eflg == 'Y') {

		if (filingSec == '11' || filingSec == '12' || filingSec == '13') {
			var totalInc = document.getElementsByName('partBTI.totalIncome')[0].value;
			var verDate = document.getElementsByName('verification.date')[0].value;

			if (checkFirstDateBefore('16/02/2021', currentDate)
					&& checkFirstDateBefore(currentDate, '31/12/2020')) {
				if (parseInt(totalInc, 10) <= eval('500000')) {
					intrst234F = '1000';
				} else if (parseInt(totalInc, 10) > eval('500000')) {
					intrst234F = '5000';

				}
			} else if (checkFirstDateBefore('16/02/2021', currentDate)) {
				if (parseInt(totalInc, 10) <= eval('500000')) {
					intrst234F = '1000';

				} else if (parseInt(totalInc, 10) > eval('500000')) {
					intrst234F = '10000';

				}
			} else {

				intrst234F = parseInt('0', 10);
			}

		} else if (filingSec == '17' || filingSec == '18') {
			var totalInc = document.getElementsByName('partBTI.totalIncome')[0].value;

			if (checkFirstDateBefore('16/02/2021', currentDate)
					&& checkFirstDateBefore(currentDate, '31/12/2020')) {
				if (parseInt(totalInc, 10) <= eval('500000')) {
					intrst234F = '1000';
				} else if (parseInt(totalInc, 10) > eval('500000')) {
					intrst234F = '5000';

				}
			} else if (checkFirstDateBefore('16/02/2021', currentDate)) {
				if (parseInt(totalInc, 10) <= eval('500000')) {
					intrst234F = '1000';

				} else if (parseInt(totalInc, 10) > eval('500000')) {
					intrst234F = '10000';

				}
			} else {

				intrst234F = parseInt('0', 10);
			}

		}

	
	} else {

		if (filingSec == '11' || filingSec == '12' || filingSec == '13') {
				var totalInc = document
						.getElementsByName('partBTI.totalIncome')[0].value;

				if (checkFirstDateBefore('16/02/2021', currentDate)
						&& checkFirstDateBefore(currentDate, '31/12/2020')) {
					if (parseInt(totalInc, 10) <= eval('500000')) {
						intrst234F = '1000';
					} else if (parseInt(totalInc, 10) > eval('500000')) {
						intrst234F = '5000';

					}
				} else if (checkFirstDateBefore('16/02/2021', currentDate)) {
					if (parseInt(totalInc, 10) <= eval('500000')) {
						intrst234F = '1000';

					} else if (parseInt(totalInc, 10) > eval('500000')) {
						intrst234F = '10000';

					}
				} else {

					intrst234F = parseInt('0', 10);
				}

			} else if (filingSec == '17' || filingSec == '18') {
				var totalInc = document
						.getElementsByName('partBTI.totalIncome')[0].value;

				if (checkFirstDateBefore('16/02/2021', currentDate)
						&& checkFirstDateBefore(currentDate, '31/12/2020')) {
					if (parseInt(totalInc, 10) <= eval('500000')) {
						intrst234F = '1000';
					} else if (parseInt(totalInc, 10) > eval('500000')) {
						intrst234F = '5000';

					}
				} else if (checkFirstDateBefore('16/02/2021', currentDate)) {
					if (parseInt(totalInc, 10) <= eval('500000')) {
						intrst234F = '1000';

					} else if (parseInt(totalInc, 10) > eval('500000')) {
						intrst234F = '10000';

					}
				} else {

					intrst234F = parseInt('0', 10);
				}

			}

		
	}

	// ===============Interest234B calculation=======================

	var intrst234Bprinciple;
	var intrst234Bi = parseInt('0', 10);
	var noOfMonthsTillSelfasst = parseInt('0', 10);
	if (parseInt(balTaxPayable.value, 10) - parseInt(TDS, 10)
			- parseInt(TCS, 10) >= parseInt('10000', 10)) {
		if (parseInt(advanceTax, 10) < ((parseInt(balTaxPayable.value, 10)
				- parseInt(TDS, 10) - parseInt(TCS, 10)) * parseFloat('0.90'))) {

			intrst234Bprinciple = (parseInt(balTaxPayable.value, 10)
					- parseInt(advanceTax, 10) - parseInt(TDS, 10) - parseInt(
					TCS, 10));
			// Rounding off to previous hundered
			if (parseInt(intrst234Bprinciple, 10) > 100) {
				intrst234Bprinciple = Math.floor(parseInt(intrst234Bprinciple,
						10) / 100)
						* parseInt('100', 10);
			}
			// ======== Interest 234B first part calc==========

			var selfAsspaidDates = new Array();
			var selfAsspaidAmts = new Array();
			var x = parseInt('0', 10);
			var tempDate = parseInt('0', 10);
			var tempAmt = parseInt('0', 10);

			currentDate = actualDate;
			// to get all self assesment tax values
			for (var p = 0; p < allInputTags.length; p++) {
				if (allInputTags[p].name.match("dateDep$")) {
					if (checkFirstDateBefore('01/04/2020',
							allInputTags[p].value)
							&& checkFirstDateBefore(allInputTags[p].value,
									currentDate)) {
						if (allInputTags[p + 2].value != 0) {
							selfAsspaidDates[x] = allInputTags[p].value;
							selfAsspaidAmts[x] = allInputTags[p + 2].value;
							x++;
						}
					}
				}
			}

			if (selfAsspaidDates.length > 1) {
				for (var q = 0; q < selfAsspaidDates.length - 1; q++) {
					for (var r = q + 1; r < selfAsspaidDates.length; r++) {
						if (checkFirstDateBefore(selfAsspaidDates[q],
								selfAsspaidDates[r])) {

						} else {
							tempDate = selfAsspaidDates[q];
							tempAmt = selfAsspaidAmts[q];

							selfAsspaidDates[q] = selfAsspaidDates[r];
							selfAsspaidAmts[q] = selfAsspaidAmts[r];

							selfAsspaidDates[r] = tempDate;
							selfAsspaidAmts[r] = tempAmt;
						}
					}
				}
				var arrLen = selfAsspaidDates.length;
				var lastMonth = 0;
				var lastIndex = -1;
				var lastYear = 0;
				for (var q = 0; q < arrLen; q++) {
					if (parseInt(selfAsspaidDates[q].substr(3, 2), 10) == lastMonth
							&& parseInt(selfAsspaidDates[q].substr(8, 2), 10) == lastYear) {
						selfAsspaidAmts[lastIndex] = parseInt(
								selfAsspaidAmts[lastIndex], 10)
								+ parseInt(selfAsspaidAmts[q], 10);
					} else {
						lastMonth = parseInt(selfAsspaidDates[q].substr(3, 2),
								10);
						lastYear = parseInt(selfAsspaidDates[q].substr(8, 2),
								10);
						selfAsspaidAmts[++lastIndex] = selfAsspaidAmts[q];
						selfAsspaidDates[lastIndex] = selfAsspaidDates[q];
					}
				}
				selfAsspaidAmts.length = ++lastIndex;
				selfAsspaidDates.length = lastIndex;
			}

			if (selfAsspaidDates.length == 0) {
				noOfMonthsTillSelfasst = calcNoOfMonths(currentDate,
						'01/04/2020');
			} else {
				noOfMonthsTillSelfasst = calcNoOfMonths(selfAsspaidDates[0],
						'01/04/2020');
			}
			//2020 changes
			if(selfAsspaidDates.length!=0 && checkFirstDateBefore(selfAsspaidDates[0], '30/06/2020'))
			{
				intrst234Bi = parseInt(intrst234Bprinciple, 10)
				* parseFloat('0.0075')
				* parseInt(noOfMonthsTillSelfasst);

			}
			else
			{
				intrst234Bi = parseInt(intrst234Bprinciple, 10)
				* parseFloat('0.01')
				* parseInt(noOfMonthsTillSelfasst);

			}

			
			
			
			// ======== Interest 234B second part calc==========
			var intrst234Bprinciple2 = parseInt('0', 10); // intrst234Bprinciple
															// if self assesment
															// is paid
			var noOfMonthsTillSelfasst2;
			var intrst234Bii = parseInt('0', 10);
			var partialSelfAssPaid = parseInt('0', 10);
			var k = parseInt('0', 10);
			var interestFrom;
			var interestTill;

			if (selfAsspaidDates.length != 0) {

				for (var i = 0; i < selfAsspaidDates.length; i++) {
					partialSelfAssPaid = eval(parseInt(partialSelfAssPaid, 10)
							+ parseInt(selfAsspaidAmts[i], 10));

					intrst234Bprinciple2 = zeroOrMore(eval(parseInt(
							balTaxPayable.value, 10)
							- parseInt(advanceTax, 10)
							- parseInt(TDS, 10)
							- parseInt(TCS, 10)
							+ parseInt(intrst234A, 10)
							+ parseInt(intrst234C, 10)
							+ parseInt(intrst234Bi, 10)
							+ parseInt(intrst234Bii, 10)
							+ parseInt(intrst234F, 10)
							- parseInt(partialSelfAssPaid, 10)));

					// Rounding off to previous hundered
					if (parseInt(intrst234Bprinciple2, 10) > parseInt('100', 10)) {
						intrst234Bprinciple2 = Math.floor(parseInt(
								intrst234Bprinciple2, 10) / 100)
								* parseInt('100', 10);
					}
					// calclulating remaining months to levy interest
					//2020 changes
					var intrst234bflag=false;
					if(checkFirstDateBefore(AY_start_date,selfAsspaidDates[i])
							&& checkFirstDateBefore(selfAsspaidDates[i], '30/06/2020'))
					{
						intrst234bflag=true;
					}
					interestTill = currentDate;
					interestFrom = selfAsspaidDates[i];

					if (i != eval(selfAsspaidDates.length - parseInt('1', 10))) {

						for (k = i; k < eval(selfAsspaidDates.length
								- parseInt('1', 10)); k++) {
							if (selfAsspaidDates[k] != selfAsspaidDates[k + 1]) {
								interestTill = selfAsspaidDates[k + 1];
								interestFrom = selfAsspaidDates[k];
								k = selfAsspaidDates.length;
							}
						}
					}

					noOfMonthsTillSelfasst2 = calcNoOfMonths(interestTill,
							interestFrom)
							- parseInt('1', 10);
					
				
					var temp = interestTill;
					
					var interFlag=false;
					if(checkFirstDateBefore(interestFrom, '30/06/2020') && checkFirstDateBefore('30/06/2020',interestTill))
					{
						interFlag=true;
						interestTill='30/06/2020';
						noOfMonthsTillSelfasst2 = calcNoOfMonths(
								interestTill, interestFrom)
								- parseInt('1', 10);
						if (parseInt(intrst234Bprinciple2, 10) < parseInt(
								intrst234Bprinciple, 10)) {
							intrst234Bprinciple = intrst234Bprinciple2;
							if(intrst234bflag)
							{
								intrst234Bii = eval(parseInt(intrst234Bii, 10)
										+ (parseInt(intrst234Bprinciple2, 10)
												* parseFloat('0.0075') * parseInt(noOfMonthsTillSelfasst2)));
							
}
							else
							{
								intrst234Bii = eval(parseInt(intrst234Bii, 10)
										+ (parseInt(intrst234Bprinciple2, 10)
												* parseFloat('0.01') * parseInt(noOfMonthsTillSelfasst2)));
							
	}
						} else {
							if(intrst234bflag)
							{
								intrst234Bii = eval(parseInt(intrst234Bii, 10)
										+ (parseInt(intrst234Bprinciple, 10)
												* parseFloat('0.0075') * parseInt(noOfMonthsTillSelfasst2)));
								

							}
							else
							{
								intrst234Bii = eval(parseInt(intrst234Bii, 10)
										+ (parseInt(intrst234Bprinciple, 10)
												* parseFloat('0.01') * parseInt(noOfMonthsTillSelfasst2)));
								
								}
						}
						
						interestFrom='01/07/2020';
						interestTill =temp;
						noOfMonthsTillSelfasst2 = calcNoOfMonths(
								interestTill, interestFrom);
					}
					if (parseInt(intrst234Bprinciple2, 10) < parseInt(
							intrst234Bprinciple, 10)) {
						intrst234Bprinciple = intrst234Bprinciple2;
						if(intrst234bflag && !interFlag)
						{
							intrst234Bii = eval(parseInt(intrst234Bii, 10)
									+ (parseInt(intrst234Bprinciple2, 10)
											* parseFloat('0.0075') * parseInt(noOfMonthsTillSelfasst2)));
						}
						else
						{
							intrst234Bii = eval(parseInt(intrst234Bii, 10)
									+ (parseInt(intrst234Bprinciple2, 10)
											* parseFloat('0.01') * parseInt(noOfMonthsTillSelfasst2)));
						}
					} else {
						if(intrst234bflag && !interFlag)
						{
							intrst234Bii = eval(parseInt(intrst234Bii, 10)
									+ (parseInt(intrst234Bprinciple, 10)
											* parseFloat('0.0075') * parseInt(noOfMonthsTillSelfasst2)));
						}
						else
						{
							intrst234Bii = eval(parseInt(intrst234Bii, 10)
									+ (parseInt(intrst234Bprinciple, 10)
											* parseFloat('0.01') * parseInt(noOfMonthsTillSelfasst2)));
						}
					}
				}
			}
			intrst234B=eval(parseInt(intrst234Bi,10) +parseInt(intrst234Bii,10));
		}
	} else {
		intrst234B = parseInt('0', 10);
	}

	intrst234A = parseInt(intrst234A, 10);
	intrst234B = parseInt(intrst234B, 10);
	intrst234C = parseInt(intrst234C, 10);
	intrst234F = parseInt(intrst234F, 10);

	var intrstPayUs234A = document
			.getElementsByName('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234A')[0];
	var intrstPayUs234B = document
			.getElementsByName('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234B')[0];
	var intrstPayUs234C = document
			.getElementsByName('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234C')[0];
	var intrstPayUs234F = document
			.getElementsByName('partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234F')[0];

	if (intrstPayUs234A.old != intrst234A) {
		intrstPayUs234A.old = intrst234A;
		intrstPayUs234A.value = intrst234A;
	}
	if (intrstPayUs234B.old != intrst234B) {
		intrstPayUs234B.old = intrst234B;
		intrstPayUs234B.value = intrst234B;
	}
	if (intrstPayUs234C.old != intrst234C) {
		intrstPayUs234C.old = intrst234C;
		intrstPayUs234C.value = intrst234C;
	}
	if (intrstPayUs234F.old != intrst234F) {
		intrstPayUs234F.old = intrst234F;
		intrstPayUs234F.value = intrst234F;
	}

}

function calculate234cIntrst(TDS, TCS, slabs, cgosIncome) {
	try {

		var slab0 = parseInt(slabs[0], 10);
		var slab1 = parseInt(slabs[1], 10);
		var slab2 = parseInt(slabs[2], 10);
		var slab3 = parseInt(slabs[3], 10);
		var slab4 = parseInt(slabs[4], 10);

		var winLottRacePuzz = parseInt(coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls0.sourceAmount'));
		var totalCG = parseInt(zeroOrMore(parseInt(
				cgosIncome.cgInc.stcg.prctg30.sec115AD, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.stcg.prctg30.secPti, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.stcg.prctgAr.stcgApp, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.stcg.prctgAr.secPti, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.stcg.prctg15.sec111a, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.stcg.prctg15.secPti, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg20.sec112, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg20.secPti, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg20.sec11EA, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.secProviso, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec115AC_1, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec115ACA_1, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec115AD_3, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.secPti, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.secPti112A, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec115E_b, 10)))
				+ parseInt(zeroOrMore(parseInt(
						cgosIncome.cgInc.ltcg.prctg10.sec112A, 10)));

		var sumSchBpOth = eval(coalesceSetRet('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalesceSetRet('scheduleSI.splCodeRateTax[0].taxableInc')
				+ coalesceSetRet('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalesceSetRet('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses'));

		var normalBalIncome = eval(parseInt(coalesceSetRet('partBTI.grossTotalIncome'))
				- parseInt(coalesceSetRet('partBTI.incFromOS.incChargeSplRate'))
				- totalCG
				- parseInt(coalesceSetRet('partBTI.totalDeductionsUnderScheduleVIA'))
				- parseInt(coalesceSetRet('partBTI.deductionsUnder10Aor10AA'))
				- parseInt(coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBF'))
				- parseInt(coalesceSetRet('partBTI.capGain.shortTerm.shortTermSplRateDTAA'))
				- parseInt(coalesceSetRet('partBTI.capGain.longTerm.longTermSplRateDTAA'))
				- parseInt(coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBG'))
				- parseInt(coalesce(sumSchBpOth)));
		var dtaan11b = 0;

		var siexmption = getLTCG20ExmpFrmSI();
		var exemption10Pct = eval(siexmption["10"]);
		var exemption15Pct = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[2].splRateInc'))
				- parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[2].taxableInc')));
		var exemption20Pct = eval(siexmption["20"]);
		var exemption30Pct = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[6].splRateInc'))
				- parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[6].taxableInc')));

		var exemptionOth111A = 0;

		// Calculate tax on CG

		var intrstRates = [ 0.1, 0.2, 0.15, 0.3 ];
		var appRateSurcharge = 1;
		var domesticCompFlg = document
				.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

		var totalUpto15Of6 = 0;
		var totalUpto15Of9 = 0;
		var totalUp16Of9To15Of12 = 0;
		var totalUp16Of12To15Of3 = 0;
		var totalUp16Of3To31Of3 = 0;
		var avaTdsTcs = 0;

		var taxOnWinLottRacePuzz = 0;
		var balTaxPayable = document
				.getElementsByName('partBTTI.computationOfTaxLiability.netTaxLiability')[0];
		var netTaxLiability = balTaxPayable.value;

		var othExemptions = 0;
		var siTax = 0;

		if (parseInt(coalesceSetRet('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.totalTax')) != parseInt(coalesceSetRet('partBTTI.computationOfTaxLiability.grossTaxPayable'))) {

			siTax = parseInt(coalesceSetRet('scheduleSI.totSplRateIncTax'))
					- calculatePureSITax();

			taxOnWinLottRacePuzz = parseInt(winLottRacePuzz) * intrstRates[3];
			/*
			 * // OS Dividend Income u/s 115BBDA and Income from Lottery var
			 * taxon15BDA0 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6'),10)));
			 * var taxon15BDA1 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/9'),10)+parseInt(taxon15BDA0,10)));
			 * var taxon15BDA2 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/12'),10)+parseInt(taxon15BDA1,10)));
			 * var taxon15BDA3 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/3'),10)+parseInt(taxon15BDA2,10)));
			 * var taxon15BDA4 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto31/3'),10)));
			 * 
			 * 
			 * taxon15BDA0 = zeroOrMore(parseInt(taxon15BDA0,10))*0.10;
			 * taxon15BDA1 = zeroOrMore(parseInt(taxon15BDA1,10))*0.10;
			 * taxon15BDA2 = zeroOrMore(parseInt(taxon15BDA2,10))*0.10;
			 * taxon15BDA3 = zeroOrMore(parseInt(taxon15BDA3,10))*0.10;
			 * taxon15BDA4 = zeroOrMore(parseInt(taxon15BDA4,10))*0.10;
			 * 
			 * var totalBBDAtax =
			 * eval(parseInt(taxon15BDA3,10)+parseInt(taxon15BDA4,10));
			 * 
			 * var taxonLottery0 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6'),10)));
			 * var taxonLottery1 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/9'),10)+parseInt(taxonLottery0,10)));
			 * var taxonLottery2 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/12'),10)+parseInt(taxonLottery1,10)));
			 * var taxonLottery3 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/3'),10)+parseInt(taxonLottery2,10)));
			 * var taxonLottery4 =
			 * zeroOrMore(eval(parseInt(coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto31/3'),10)));
			 * 
			 * taxonLottery0 = zeroOrMore(parseInt(taxonLottery0,10))*0.30;
			 * taxonLottery1 = zeroOrMore(parseInt(taxonLottery1,10))*0.30;
			 * taxonLottery2 = zeroOrMore(parseInt(taxonLottery2,10))*0.30;
			 * taxonLottery3 = zeroOrMore(parseInt(taxonLottery3,10))*0.30;
			 * taxonLottery4 = zeroOrMore(parseInt(taxonLottery4,10))*0.30;
			 * 
			 * var totalLotteryTax; totalLotteryTax =
			 * eval(parseInt(taxonLottery3,10)+parseInt(taxonLottery4,10));
			 * 
			 * siTax = zeroOrMore(siTax -(totalBBDAtax+totalLotteryTax));
			 */

			// CG
			// App Rate
			if (parseInt(normalBalIncome) > parseInt(exemptionOth111A)) {
				normalBalIncome = parseInt(normalBalIncome)
						- parseInt(exemptionOth111A);
				exemptionOth111A = 0;
			} else if (parseInt(normalBalIncome, 0) > 0) {
				exemptionOth111A = parseInt(exemptionOth111A)
						- parseInt(normalBalIncome);
				normalBalIncome = 0;
			}

			var dateOfCommenceMent = document
					.getElementsByName('partAGEN1.orgFirmInfo.dateofBusCommencement')[0].value;

			var dateOfComAmount0 = 0;

			var dateOfComAmount1 = 0;

			var dateOfComAmount2 = 0;

			var dateOfComAmount3 = 0;

			var dateOfComAmount4 = 0;

			var schBp44AD = eval(coalesceSetRet('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses'));

			var sumSchBpOthIncome = eval(schBp44AD
					+ coalesceSetRet('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrAfterSetOffBFLosses')
					+ coalesceSetRet('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses'));
			var sum115BBFBBG115B = coalesceSetRet('scheduleSI.splCodeRateTax[8].splRateInc')
					+ coalesceSetRet('scheduleSI.splCodeRateTax[9].splRateInc')
					+ coalesceSetRet('scheduleSI.splCodeRateTax[0].splRateInc');

			var sumBP115B0 = 0;
			var sumBP115B1 = 0;
			var sumBP115B2 = 0;
			var sumBP115B3 = 0;
			var sumBP115B4 = 0;
			var sumBP115B41 = 0;

			var schBp5BBG5BBF = eval(coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBF')
					+ coalesceSetRet('itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBG'));
			var schBp5BBG5BBF0 = 0;
			var schBp5BBG5BBF1 = 0;
			var schBp5BBG5BBF2 = 0;
			var schBp5BBG5BBF3 = 0;
			var schBp5BBG5BBF4 = 0;

			if (checkFirstDateBefore(dateOfCommenceMent, slab0_end_date)
					|| dateOfCommenceMent == '') {
				dateOfComAmount0 = parseInt(coalesce(sumSchBpOthIncome));
				sumBP115B0 = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[0].taxableInc')) * 0.125);
				schBp5BBG5BBF0 = eval(parseInt(schBp5BBG5BBF) * 0.1);
			}
			if (checkFirstDateBefore(slab1_start_date, dateOfCommenceMent)
					&& checkFirstDateBefore(dateOfCommenceMent, slab1_end_date)) {
				dateOfComAmount1 = parseInt(coalesce(sumSchBpOthIncome));
				sumBP115B1 = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[0].taxableInc')) * 0.125);
				schBp5BBG5BBF1 = eval(parseInt(schBp5BBG5BBF) * 0.1);
			}
			if (checkFirstDateBefore(slab2_start_date, dateOfCommenceMent)
					&& checkFirstDateBefore(dateOfCommenceMent, slab2_end_date)) {
				dateOfComAmount2 = parseInt(coalesce(sumSchBpOthIncome));
				sumBP115B2 = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[0].taxableInc')) * 0.125);
				schBp5BBG5BBF2 = eval(parseInt(schBp5BBG5BBF) * 0.1);
			} else if (checkFirstDateBefore(slab3_start_date,
					dateOfCommenceMent)
					&& checkFirstDateBefore(dateOfCommenceMent, slab3_end_date)) {
				dateOfComAmount3 = parseInt(coalesce(sumSchBpOthIncome));
				sumBP115B3 = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[0].taxableInc')) * 0.125);
				schBp5BBG5BBF3 = eval(parseInt(schBp5BBG5BBF) * 0.1);
			} else if (checkFirstDateBefore(slab4_start_date,
					dateOfCommenceMent)
					&& checkFirstDateBefore(dateOfCommenceMent, FY_end_date)) {
				dateOfComAmount4 = parseInt(coalesce(sumSchBpOthIncome));
				sumBP115B4 = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[0].taxableInc')) * 0.125);
				schBp5BBG5BBF4 = eval(parseInt(schBp5BBG5BBF) * 0.1);
			}

			sumBP115B41 = eval(parseInt(coalesceSetRet('scheduleSI.splCodeRateTax[0].taxableInc')));
			if (dateOfCommenceMent == '') {
				dateOfComAmount0 = parseInt(coalesce(sumSchBpOthIncome));
			}

			sumBP115B0 = eval(parseInt(sumBP115B0));
			sumBP115B1 = eval(parseInt(sumBP115B0) + parseInt(sumBP115B1));
			sumBP115B2 = eval(parseInt(sumBP115B1) + parseInt(sumBP115B2));
			sumBP115B3 = eval(parseInt(sumBP115B2) + parseInt(sumBP115B3));
			sumBP115B4 = eval(parseInt(sumBP115B4));

			schBp5BBG5BBF0 = eval(parseInt(schBp5BBG5BBF0));
			schBp5BBG5BBF1 = eval(parseInt(schBp5BBG5BBF0)
					+ parseInt(schBp5BBG5BBF1));
			schBp5BBG5BBF2 = eval(parseInt(schBp5BBG5BBF1)
					+ parseInt(schBp5BBG5BBF2));
			schBp5BBG5BBF3 = eval(parseInt(schBp5BBG5BBF2)
					+ parseInt(schBp5BBG5BBF3));
			schBp5BBG5BBF4 = eval(parseInt(schBp5BBG5BBF4));

			var taxOnstcgOthers0 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.upto15Of6'),
					10)
					+ parseInt(normalBalIncome) + parseInt(dateOfComAmount0));
			var taxOnstcgOthers1 = eval(parseInt(taxOnstcgOthers0)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of6To15Of9'),
							10) + parseInt(dateOfComAmount1));
			var taxOnstcgOthers2 = eval(parseInt(taxOnstcgOthers1)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of9To15Of12'),
							10) + parseInt(dateOfComAmount2));
			var taxOnstcgOthers3 = eval(parseInt(taxOnstcgOthers2)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of12To15Of3'),
							10) + parseInt(dateOfComAmount3));
			var taxOnstcgOthers4 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of3To31Of3'),
					10)
					+ parseInt(taxOnstcgOthers3, 10)
					+ parseInt(dateOfComAmount4));

			var dtaastcgRate = parseFloat('0.00001');
			var dtaaltcgRate = parseFloat('0.00001');

			if (coalesceSetRet('scheduleSI.splCodeRateTax[11].taxableInc') > parseInt(
					'0', 10)) {
				if (!coalesceSetRet('scheduleSI.splCodeRateTax[11].splRateIncTax') > 0) {
					dtaastcgRate = eval(parseInt('1', 10)
							/ coalesceSetRet('scheduleSI.splCodeRateTax[11].taxableInc'));
				} else {
					dtaastcgRate = eval(coalesceSetRet('scheduleSI.splCodeRateTax[11].splRateIncTax')
							/ coalesceSetRet('scheduleSI.splCodeRateTax[11].taxableInc'));
				}
			}
			if (coalesceSetRet('scheduleSI.splCodeRateTax[12].taxableInc') > parseInt(
					'0', 10)) {
				if (!coalesceSetRet('scheduleSI.splCodeRateTax[12].splRateIncTax') > 0) {
					dtaaltcgRate = eval(parseInt('1', 10)
							/ coalesceSetRet('scheduleSI.splCodeRateTax[12].taxableInc'));
				} else {
					dtaaltcgRate = eval(coalesceSetRet('scheduleSI.splCodeRateTax[12].splRateIncTax')
							/ coalesceSetRet('scheduleSI.splCodeRateTax[12].taxableInc'));
				}
			}

			var taxOnstcgDtaa0 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.upto15Of6'),
					10));
			var taxOnstcgDtaa1 = eval(parseInt(taxOnstcgDtaa0, 10)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of6To15Of9'),
							10));
			var taxOnstcgDtaa2 = eval(parseInt(taxOnstcgDtaa1, 10)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of9To15Of12'),
							10));
			var taxOnstcgDtaa3 = eval(parseInt(taxOnstcgDtaa2, 10)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of12To15Of3'),
							10));
			var taxOnstcgDtaa4 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of3To31Of3'),
					10));

			taxOnstcgDtaa0 = zeroOrMore(parseInt(taxOnstcgDtaa0, 10))
					* dtaastcgRate;
			taxOnstcgDtaa1 = zeroOrMore(parseInt(taxOnstcgDtaa1, 10))
					* dtaastcgRate;
			taxOnstcgDtaa2 = zeroOrMore(parseInt(taxOnstcgDtaa2, 10))
					* dtaastcgRate;
			taxOnstcgDtaa3 = zeroOrMore(parseInt(taxOnstcgDtaa3, 10))
					* dtaastcgRate;
			taxOnstcgDtaa4 = zeroOrMore(parseInt(taxOnstcgDtaa4, 10))
					* dtaastcgRate;

			var totalStcgDtaatax = eval(parseInt(taxOnstcgDtaa3, 10)
					+ parseInt(taxOnstcgDtaa4, 10));

			var taxOnltcgDtaa0 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.upto15Of6'),
					10));
			var taxOnltcgDtaa1 = eval(parseInt(taxOnltcgDtaa0, 10)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of6To15Of9'),
							10));
			var taxOnltcgDtaa2 = eval(parseInt(taxOnltcgDtaa1, 10)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of9To15Of12'),
							10));
			var taxOnltcgDtaa3 = eval(parseInt(taxOnltcgDtaa2, 10)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of12To15Of3'),
							10));
			var taxOnltcgDtaa4 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of3To31Of3'),
					10));
			taxOnltcgDtaa0 = zeroOrMore(parseInt(taxOnltcgDtaa0, 10))
					* dtaaltcgRate;
			taxOnltcgDtaa1 = zeroOrMore(parseInt(taxOnltcgDtaa1, 10))
					* dtaaltcgRate;
			taxOnltcgDtaa2 = zeroOrMore(parseInt(taxOnltcgDtaa2, 10))
					* dtaaltcgRate;
			taxOnltcgDtaa3 = zeroOrMore(parseInt(taxOnltcgDtaa3, 10))
					* dtaaltcgRate;
			taxOnltcgDtaa4 = zeroOrMore(parseInt(taxOnltcgDtaa4, 10))
					* dtaaltcgRate;

			var totalLtcgDtaatax = eval(parseInt(taxOnltcgDtaa3, 10)
					+ parseInt(taxOnltcgDtaa4, 10));
			// 2019 changes
			var taxon15BDA0 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6'),
					10)));
			var taxon15BDA1 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/9'),
					10)
					+ parseInt(taxon15BDA0, 10)));
			var taxon15BDA2 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/12'),
					10)
					+ parseInt(taxon15BDA1, 10)));
			var taxon15BDA3 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/3'),
					10)
					+ parseInt(taxon15BDA2, 10)));
			var taxon15BDA4 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto31/3'),
					10)));

			taxon15BDA0 = zeroOrMore(parseInt(taxon15BDA0, 10)) * 0.10;
			taxon15BDA1 = zeroOrMore(parseInt(taxon15BDA1, 10)) * 0.10;
			taxon15BDA2 = zeroOrMore(parseInt(taxon15BDA2, 10)) * 0.10;
			taxon15BDA3 = zeroOrMore(parseInt(taxon15BDA3, 10)) * 0.10;
			taxon15BDA4 = zeroOrMore(parseInt(taxon15BDA4, 10)) * 0.10;

			var totalBBDAtax = eval(parseInt(taxon15BDA3, 10)
					+ parseInt(taxon15BDA4, 10))
					* parseFloat('1.04');

			var taxonLottery0 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6'),
					10)));
			var taxonLottery1 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/9'),
					10)
					+ parseInt(taxonLottery0, 10)));
			var taxonLottery2 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/12'),
					10)
					+ parseInt(taxonLottery1, 10)));
			var taxonLottery3 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/3'),
					10)
					+ parseInt(taxonLottery2, 10)));
			var taxonLottery4 = zeroOrMore(eval(parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto31/3'),
					10)));

			taxonLottery0 = zeroOrMore(parseInt(taxonLottery0, 10)) * 0.30;
			taxonLottery1 = zeroOrMore(parseInt(taxonLottery1, 10)) * 0.30;
			taxonLottery2 = zeroOrMore(parseInt(taxonLottery2, 10)) * 0.30;
			taxonLottery3 = zeroOrMore(parseInt(taxonLottery3, 10)) * 0.30;
			taxonLottery4 = zeroOrMore(parseInt(taxonLottery4, 10)) * 0.30;

			var totalLotteryTax;
			totalLotteryTax = eval(parseInt(taxonLottery3, 10)
					+ parseInt(taxonLottery4, 10))
					* parseFloat('1.04');

			var totalQuarterlyTax = ((parseInt(sumBP115B41) * 0.125)
					+ parseInt(totalStcgDtaatax) + parseInt(totalLtcgDtaatax)
					+ parseInt(totalBBDAtax) + parseInt(totalLotteryTax)) * 1.04;

			siTax = zeroOrMore(siTax - totalQuarterlyTax);

			// 30%
			if (parseInt(normalBalIncome) > parseInt(exemption30Pct)) {
				normalBalIncome = parseInt(normalBalIncome)
						- parseInt(exemption30Pct);
				exemption30Pct = 0;
			} else if (parseInt(normalBalIncome, 0) > 0) {
				exemption30Pct = parseInt(exemption30Pct)
						- parseInt(normalBalIncome);
				normalBalIncome = 0;
			}

			var shortTermUnder30Per0 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.upto15Of6'),
					10));
			var shortTermUnder30Per1 = eval(parseInt(shortTermUnder30Per0)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of6To15Of9'),
							10));
			var shortTermUnder30Per2 = eval(parseInt(shortTermUnder30Per1)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of9To15Of12'),
							10));
			var shortTermUnder30Per3 = eval(parseInt(shortTermUnder30Per2)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of12To15Of3'),
							10));
			var shortTermUnder30Per4 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of3To31Of3'),
					10));

			// 20%
			if (parseInt(normalBalIncome) > parseInt(exemption20Pct)) {
				normalBalIncome = parseInt(normalBalIncome)
						- parseInt(exemption20Pct);
				exemption20Pct = 0;
			} else if (parseInt(normalBalIncome, 0) > 0) {
				exemption20Pct = parseInt(exemption20Pct)
						- parseInt(normalBalIncome);
				normalBalIncome = 0;
			}

			var taxOnltcgNonProviso0 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.upto15Of6'),
					10));
			var taxOnltcgNonProviso1 = eval(parseInt(taxOnltcgNonProviso0)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of6To15Of9'),
							10));
			var taxOnltcgNonProviso2 = eval(parseInt(taxOnltcgNonProviso1)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of9To15Of12'),
							10));
			var taxOnltcgNonProviso3 = eval(parseInt(taxOnltcgNonProviso2)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of12To15Of3'),
							10));
			var taxOnltcgNonProviso4 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of3To31Of3'),
					10));

			// 15%
			if (parseInt(normalBalIncome) > parseInt(exemption15Pct)) {
				normalBalIncome = parseInt(normalBalIncome)
						- parseInt(exemption15Pct);
				exemption15Pct = 0;
			} else if (parseInt(normalBalIncome, 0) > 0) {
				exemption15Pct = parseInt(exemption15Pct)
						- parseInt(normalBalIncome);
				normalBalIncome = 0;
			}

			var taxOnstcg111A0 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.upto15Of6'),
					10));
			var taxOnstcg111A1 = eval(parseInt(taxOnstcg111A0)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of6To15Of9'),
							10));
			var taxOnstcg111A2 = eval(parseInt(taxOnstcg111A1)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of9To15Of12'),
							10));
			var taxOnstcg111A3 = eval(parseInt(taxOnstcg111A2)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of12To15Of3'),
							10));
			var taxOnstcg111A4 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of3To31Of3'),
					10));

			// 10%
			if (parseInt(normalBalIncome) > parseInt(exemption10Pct)) {
				normalBalIncome = parseInt(normalBalIncome)
						- parseInt(exemption10Pct);
				exemption10Pct = 0;
			} else if (parseInt(normalBalIncome, 0) > 0) {
				exemption10Pct = parseInt(exemption10Pct)
						- parseInt(normalBalIncome);
				normalBalIncome = 0;

			}

			var taxOnltcgProviso0 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.upto15Of6'),
					10));
			var taxOnltcgProviso1 = eval(parseInt(taxOnltcgProviso0)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of6To15Of9'),
							10));
			var taxOnltcgProviso2 = eval(parseInt(taxOnltcgProviso1)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of9To15Of12'),
							10));
			var taxOnltcgProviso3 = eval(parseInt(taxOnltcgProviso2)
					+ parseInt(
							coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of12To15Of3'),
							10));
			var taxOnltcgProviso4 = eval(parseInt(
					coalesceSetRet('scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of3To31Of3'),
					10));

			var temp = applyExemption2017([ taxOnltcgProviso0,
					taxOnltcgProviso1, taxOnltcgProviso2, taxOnltcgProviso3,
					taxOnltcgProviso4 ], exemption10Pct);
			taxOnltcgProviso0 = temp[0], taxOnltcgProviso1 = temp[1],
					taxOnltcgProviso2 = temp[2], taxOnltcgProviso3 = temp[3],
					taxOnltcgProviso4 = temp[4];

			taxOnltcgProviso0 *= intrstRates[0],
					taxOnltcgProviso1 *= intrstRates[0],
					taxOnltcgProviso2 *= intrstRates[0],
					taxOnltcgProviso3 *= intrstRates[0],
					taxOnltcgProviso4 *= intrstRates[0];

			temp = applyExemption2017([ shortTermUnder30Per0,
					shortTermUnder30Per1, shortTermUnder30Per2,
					shortTermUnder30Per3, shortTermUnder30Per4 ],
					exemption30Pct);
			shortTermUnder30Per0 = temp[0], shortTermUnder30Per1 = temp[1],
					shortTermUnder30Per2 = temp[2],
					shortTermUnder30Per3 = temp[3],
					shortTermUnder30Per4 = temp[4];
			shortTermUnder30Per0 *= intrstRates[3],
					shortTermUnder30Per1 *= intrstRates[3],
					shortTermUnder30Per2 *= intrstRates[3],
					shortTermUnder30Per3 *= intrstRates[3],
					shortTermUnder30Per4 *= intrstRates[3];

			temp = applyExemption2017([ taxOnltcgNonProviso0,
					taxOnltcgNonProviso1, taxOnltcgNonProviso2,
					taxOnltcgNonProviso3, taxOnltcgNonProviso4 ],
					exemption20Pct);
			taxOnltcgNonProviso0 = temp[0], taxOnltcgNonProviso1 = temp[1],
					taxOnltcgNonProviso2 = temp[2],
					taxOnltcgNonProviso3 = temp[3],
					taxOnltcgNonProviso4 = temp[4];
			taxOnltcgNonProviso0 *= intrstRates[1],
					taxOnltcgNonProviso1 *= intrstRates[1],
					taxOnltcgNonProviso2 *= intrstRates[1],
					taxOnltcgNonProviso3 *= intrstRates[1],
					taxOnltcgNonProviso4 *= intrstRates[1];

			temp = applyExemption2017([ taxOnstcg111A0, taxOnstcg111A1,
					taxOnstcg111A2, taxOnstcg111A3, taxOnstcg111A4 ],
					exemption15Pct);
			taxOnstcg111A0 = temp[0], taxOnstcg111A1 = temp[1],
					taxOnstcg111A2 = temp[2], taxOnstcg111A3 = temp[3],
					taxOnstcg111A4 = temp[4];
			taxOnstcg111A0 *= intrstRates[2], taxOnstcg111A1 *= intrstRates[2],
					taxOnstcg111A2 *= intrstRates[2],
					taxOnstcg111A3 *= intrstRates[2],
					taxOnstcg111A4 *= intrstRates[2];

			temp = applyExemption2017([ taxOnstcgOthers0, taxOnstcgOthers1,
					taxOnstcgOthers2, taxOnstcgOthers3, taxOnstcgOthers4 ],
					exemptionOth111A, true);
			taxOnstcgOthers0 = temp[0], taxOnstcgOthers1 = temp[1],
					taxOnstcgOthers2 = temp[2], taxOnstcgOthers3 = temp[3],
					taxOnstcgOthers4 = temp[4];

			taxOnstcgOthers0 = (calculateTaxPayableOnTotalInc(taxOnstcgOthers0,
					true));
			taxOnstcgOthers1 = (calculateTaxPayableOnTotalInc(taxOnstcgOthers1,
					true));
			taxOnstcgOthers2 = (calculateTaxPayableOnTotalInc(taxOnstcgOthers2,
					true));
			taxOnstcgOthers3 = calculateTaxPayableOnTotalInc(taxOnstcgOthers3,
					true);
			taxOnstcgOthers4 = parseInt(zeroOrMore(calculateTaxPayableOnTotalInc(
					taxOnstcgOthers4, true)
					- parseInt(taxOnstcgOthers3)));

			totalUpto15Of6 = eval(parseInt(taxOnltcgProviso0, 10)
					+ parseInt(taxOnltcgNonProviso0, 10)
					+ parseInt(taxOnstcg111A0, 10)
					+ parseInt(taxOnstcgOthers0, 10)
					+ parseInt(shortTermUnder30Per0, 10)
					+ parseInt(taxon15BDA0, 10) + parseInt(taxonLottery0, 10)
					+ parseInt(taxOnstcgDtaa0, 10)
					+ parseInt(taxOnltcgDtaa0, 10) + parseInt(sumBP115B0, 10)
					+ parseInt(schBp5BBG5BBF0, 10) + parseInt(siTax, 10));

			totalUpto15Of9 = eval(parseInt(taxOnltcgProviso1, 10)
					+ parseInt(taxOnltcgNonProviso1, 10)
					+ parseInt(taxOnstcg111A1, 10)
					+ parseInt(taxOnstcgOthers1, 10)
					+ parseInt(shortTermUnder30Per1, 10)
					+ parseInt(taxon15BDA1, 10) + parseInt(taxonLottery1, 10)
					+ parseInt(taxOnstcgDtaa1, 10)
					+ parseInt(taxOnltcgDtaa1, 10) + parseInt(sumBP115B1, 10)
					+ parseInt(schBp5BBG5BBF1, 10) + parseInt(siTax, 10));

			totalUp16Of9To15Of12 = eval(parseInt(taxOnltcgProviso2, 10)
					+ parseInt(taxOnltcgNonProviso2, 10)
					+ parseInt(taxOnstcg111A2, 10)
					+ parseInt(taxOnstcgOthers2, 10)
					+ parseInt(shortTermUnder30Per2, 10)
					+ parseInt(taxon15BDA2, 10) + parseInt(taxonLottery2, 10)
					+ parseInt(taxOnstcgDtaa2, 10)
					+ parseInt(taxOnltcgDtaa2, 10) + parseInt(sumBP115B2, 10)
					+ parseInt(schBp5BBG5BBF2, 10) + parseInt(siTax, 10));

			totalUp16Of12To15Of3 = eval(parseInt(taxOnltcgProviso3, 10)
					+ parseInt(taxOnltcgNonProviso3, 10)
					+ parseInt(taxOnstcg111A3, 10)
					+ parseInt(taxOnstcgOthers3, 10)
					+ parseInt(shortTermUnder30Per3, 10)
					+ parseInt(taxon15BDA3, 10) + parseInt(taxonLottery3, 10)
					+ parseInt(taxOnstcgDtaa3, 10)
					+ parseInt(taxOnltcgDtaa3, 10) + parseInt(sumBP115B3, 10)
					+ parseInt(schBp5BBG5BBF3, 10) + parseInt(siTax, 10));

			totalUp16Of3To31Of3 = eval(parseInt(taxOnltcgProviso4, 10)
					+ parseInt(taxOnltcgNonProviso4, 10)
					+ parseInt(taxOnstcg111A4, 10)
					+ parseInt(taxOnstcgOthers4, 10)
					+ parseInt(shortTermUnder30Per4, 10)
					+ parseInt(taxon15BDA4, 10) + parseInt(taxonLottery4, 10)
					+ parseInt(taxOnstcgDtaa4, 10)
					+ parseInt(taxOnltcgDtaa4, 10) + parseInt(sumBP115B4, 10)
					+ parseInt(schBp5BBG5BBF4, 10));

			var remove115BBE = eval(parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
					10) * 0.60);

			var total = parseInt(totalUp16Of12To15Of3)
					+ parseInt(totalUp16Of3To31Of3) - parseInt(remove115BBE);
			var surcharge = document
					.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0].value;
			var surcharge115BBE = document
					.getElementsByName('partBTTI.computationOfTaxLiability.surcharge25ofSI')[0].value;

			totalUpto15Of6Act = zeroOrMore(eval(parseInt(totalUpto15Of6)
					- parseInt(remove115BBE)));
			totalUpto15Of9Act = zeroOrMore(eval(parseInt(totalUpto15Of9)
					- parseInt(remove115BBE)));
			totalUp16Of9To15Of12Act = zeroOrMore(eval(parseInt(totalUp16Of9To15Of12)
					- parseInt(remove115BBE)));
			totalUp16Of12To15Of3Act = zeroOrMore(eval(parseInt(totalUp16Of12To15Of3)
					- parseInt(remove115BBE)));

			var actualTax = [ (totalUpto15Of6Act),
					(totalUpto15Of9Act - totalUpto15Of6Act),
					(totalUp16Of9To15Of12Act - totalUpto15Of9Act),
					(totalUp16Of12To15Of3Act - totalUp16Of9To15Of12Act),
					(totalUp16Of3To31Of3) ];

			totalUpto15Of6 = (parseInt(totalUpto15Of6) + (parseInt(surcharge115BBE) + parseInt(surcharge)
					* coalesce(actualTax[0] / total))) * 1.04;

			totalUpto15Of9 = parseInt(totalUpto15Of6)
					+ (parseInt(actualTax[1]) + parseInt(surcharge)
							* coalesce(actualTax[1] / total)) * 1.04;
			totalUp16Of9To15Of12 = parseInt(totalUpto15Of9)
					+ (parseInt(actualTax[2]) + parseInt(surcharge)
							* coalesce(actualTax[2] / total)) * 1.04;
			totalUp16Of12To15Of3 = parseInt(totalUp16Of9To15Of12)
					+ (parseInt(actualTax[3]) + parseInt(surcharge)
							* coalesce(actualTax[3] / total)) * 1.04;
			totalUp16Of3To31Of3 = (parseInt(actualTax[4]) + parseInt(surcharge)
					* coalesce(actualTax[4] / total)) * 1.04;

			netTaxLiability = 0;

			othExemptions = eval(parseInt(
					coalesceSetRet('partBTTI.computationOfTaxLiability.taxRelief.totTaxRelief'),
					10));

		} else {
			taxOnWinLottRacePuzz = 0;
			totSplRateIncTax = 0;
			othExemptions = 0;
		}

		var intrst234C0 = parseInt('0', 10);
		var intrst234Ci = parseInt('0', 10);
		var intrst234Cii = parseInt('0', 10);
		var intrst234Ciii = parseInt('0', 10);
		var intrst234Civ = parseInt('0', 10);

		var tempintrstBeforeSlab0 = parseInt('0', 10);
		var tempintrstBeforeSlab1 = parseInt('0', 10);
		var tempintrstBeforeSlab2 = parseInt('0', 10);
		var tempintrstBeforeSlab3 = parseInt('0', 10);
		var tempintrstForAdvTax = parseInt('0', 10);
		var totSlab = parseInt('0', 10);

		if ((eval(parseInt(balTaxPayable.value, 10) - parseInt(TDS, 10)
				- parseInt(TCS, 10)) >= parseInt('10000', 10))) {

			var totSplRateIncTax = 0;

			if (parseInt(slab0, 10) < eval((parseInt(netTaxLiability, 10)
					+ parseInt(totSplRateIncTax, 10)
					+ totalUpto15Of6
					- parseInt(othExemptions)
					- parseInt(
							coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
							10) - parseInt(TDS, 10) - parseInt(TCS, 10))
					* parseFloat('0.12'))) {

				tempintrstBeforeSlab0 = (parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10) + totalUpto15Of6
						- parseInt(othExemptions) - parseInt(TDS, 10) - parseInt(
						TCS, 10)
						* parseFloat('0.15'));

				var tempintrst234C0 = (((parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10)
						+ totalUpto15Of6
						- parseInt(othExemptions)
						- parseInt(
								coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
								10) - parseInt(TDS, 10) - parseInt(TCS, 10)) * parseFloat('0.15')) - parseInt(
						slab0, 10));
				if (parseInt(tempintrst234C0, 10) > 100) {
					tempintrst234C0 = Math
							.floor(parseInt(tempintrst234C0, 10) / 100)
							* parseInt('100', 10);
				}
				intrst234C0 = parseInt(tempintrst234C0, 10)
						* parseFloat('0.01') * parseInt('3', 10);

			}
			if (eval(parseInt(slab0, 10) + parseInt(slab1, 10)) < eval((parseInt(
					netTaxLiability, 10)
					+ parseInt(totSplRateIncTax, 10)
					+ totalUpto15Of9
					- parseInt(othExemptions)
					- parseInt(
							coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
							10) - parseInt(TDS, 10) - parseInt(TCS, 10))
					* parseFloat('0.36'))) {

				tempintrstBeforeSlab1 = ((parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10) + totalUpto15Of9
						- parseInt(othExemptions) - parseInt(TDS, 10) - parseInt(
						TCS, 10)) * parseFloat('0.45'));

				var tempintrst234Ci = (((parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10)
						+ totalUpto15Of9
						- parseInt(othExemptions)
						- parseInt(
								coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
								10) - parseInt(TDS, 10) - parseInt(TCS, 10)) * parseFloat('0.45'))
						- parseInt(slab0, 10) - parseInt(slab1, 10));
				if (parseInt(tempintrst234Ci, 10) > 100) {
					tempintrst234Ci = Math
							.floor(parseInt(tempintrst234Ci, 10) / 100)
							* parseInt('100', 10);
				}
				intrst234Ci = parseInt(tempintrst234Ci, 10)
						* parseFloat('0.01') * parseInt('3', 10);

			}

			if (eval(parseInt(slab0, 10) + parseInt(slab1, 10)
					+ parseInt(slab2, 10)) < eval((parseInt(netTaxLiability, 10)
					+ parseInt(totSplRateIncTax, 10)
					+ totalUp16Of9To15Of12
					- parseInt(othExemptions)
					- parseInt(
							coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
							10) - parseInt(TDS, 10) - parseInt(TCS, 10))
					* parseFloat('0.75'))) {

				tempintrstBeforeSlab2 = ((parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10) + totalUp16Of9To15Of12
						- parseInt(othExemptions) - parseInt(TDS, 10) - parseInt(
						TCS, 10)) * parseFloat('0.75'));

				var tempintrst234Cii = (((parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10)
						+ totalUp16Of9To15Of12
						- parseInt(othExemptions)
						- parseInt(
								coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
								10) - parseInt(TDS, 10) - parseInt(TCS, 10)) * parseFloat('0.75'))
						- parseInt(slab0, 10) - parseInt(slab1, 10) - parseInt(
						slab2, 10));
				if (parseInt(tempintrst234Cii, 10) > 100) {
					tempintrst234Cii = Math
							.floor(parseInt(tempintrst234Cii, 10) / 100)
							* parseInt('100', 10);
				}
				intrst234Cii = parseInt(tempintrst234Cii, 10)
						* parseFloat('0.01') * parseInt('3', 10);

			}

			var tempintrstForAdvTax = zeroOrMore((parseInt(netTaxLiability, 10)
					+ parseInt(totSplRateIncTax, 10) + totalUp16Of12To15Of3
					- parseInt(othExemptions) - parseInt(TDS, 10) - parseInt(
					TCS, 10))
					* parseFloat('1'));

			if (eval(parseInt(slab0, 10) + parseInt(slab1, 10)
					+ parseInt(slab2, 10) + parseInt(slab3, 10)) < eval((parseInt(
					netTaxLiability, 10)
					+ parseInt(totSplRateIncTax, 10)
					+ totalUp16Of12To15Of3
					- parseInt(othExemptions)
					- parseInt(
							coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
							10) - parseInt(TDS, 10) - parseInt(TCS, 10))
					* parseFloat('1', 10))) {

				tempintrstBeforeSlab3 = ((parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10) + totalUp16Of12To15Of3
						- parseInt(othExemptions) - parseInt(TDS, 10) - parseInt(
						TCS, 10)) * parseFloat('1'));

				var tempintrst234Ciii = (((parseInt(netTaxLiability, 10)
						+ parseInt(totSplRateIncTax, 10)
						+ totalUp16Of12To15Of3
						- parseInt(othExemptions)
						- parseInt(
								coalesceSetRet('partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'),
								10) - parseInt(TDS, 10) - parseInt(TCS, 10)) * parseFloat('1'))
						- parseInt(slab0, 10)
						- parseInt(slab1, 10)
						- parseInt(slab2, 10) - parseInt(slab3, 10));
				if (parseInt(tempintrst234Ciii, 10) > 100) {
					tempintrst234Ciii = Math.floor(parseInt(tempintrst234Ciii,
							10) / 100)
							* parseInt('100', 10);
				}
				intrst234Ciii = parseInt(tempintrst234Ciii, 10)
						* parseFloat('0.01') * parseInt('1', 10);

			}

			totSlab = parseInt(slab0, 10) + parseInt(slab1, 10)
					+ parseInt(slab2, 10) + parseInt(slab3, 10);
			var usedTdsTcs = parseInt(TDS, 10) + parseInt(TCS, 10)
					+ parseInt(othExemptions);

			avaTdsTcs = zeroOrMore(parseInt(usedTdsTcs)
					- Math.min(parseInt(usedTdsTcs),
							parseInt(totalUp16Of12To15Of3)));

			totalUp16Of3To31Of3 = zeroOrMore(eval(totalUp16Of3To31Of3
					- parseInt(avaTdsTcs, 10)));

			if (parseInt(tempintrstBeforeSlab3, 10) == 0) {
				var avalSlab = parseInt(totSlab)
						- Math.min(parseInt(totSlab),
								parseInt(tempintrstForAdvTax));
			} else {
				var avalSlab = parseInt(totSlab)
						- Math.min(parseInt(totSlab),
								parseInt(tempintrstBeforeSlab3));

			}

			if (eval(parseInt(slab4, 10)) < totalUp16Of3To31Of3) {
				var tempintrst234Civ = zeroOrMore((totalUp16Of3To31Of3
						- parseInt(slab4, 10) - parseInt(avalSlab, 10)));
				if (parseInt(tempintrst234Civ, 10) > 100) {
					tempintrst234Civ = Math
							.floor(parseInt(tempintrst234Civ, 10) / 100)
							* parseInt('100', 10);
				}
				intrst234Civ = parseInt(tempintrst234Civ, 10)
						* parseFloat('0.01') * parseInt('1', 10);
			}
		} else {
			intrst234C0 = parseInt('0', 10);
			intrst234Ci = parseInt('0', 10);
			intrst234Cii = parseInt('0', 10);
			intrst234Ciii = parseInt('0', 10);
			intrst234Civ = parseInt('0', 10);
		}

		intrst234C = eval(parseInt(intrst234C0, 10) + parseInt(intrst234Ci, 10)
				+ parseInt(intrst234Cii, 10) + parseInt(intrst234Ciii, 10)
				+ parseInt(intrst234Civ, 10));
	} catch (e) {
		alert('Error in calculate234cIntrst: ' + e.stack);
	}

	return intrst234C;

}

function calculatePureSITax() {

	var rowCount1 = countRowInTable('scheduleSI.splCodeRateTax', 'splRateInc');
	var sum = 0;
	var sumWithDtaa = 0;
	for (var i = 0; i < rowCount1; i++) {

		var section = document.getElementsByName('scheduleSI.splCodeRateTax['
				+ i + '].secCode')[0].value;

		if (section == '1A' || section == '21' || section == '22'
				|| section == '2A' || section == '21ciii' || section == '5AC1c'
				|| section == '5ACA1b' || section == '5ADii'
				|| section == '5ADiii' || section == '5AD1biip'
				|| section == '5Eb' || section == '5AB1b'
				|| section == '5BBF_BP' || section == '5BBG_BP'
				|| section == 'PTI_LTCG20P' || section == 'PTI_LTCG10P' || section == 'PTI_LTCG10P112A'
				|| section == 'PTI_STCG15P' || section == 'PTI_STCG30P'
				|| section == '5ADiiiP') {
			sum = parseInt(sum)
					+ parseInt(document
							.getElementsByName('scheduleSI.splCodeRateTax[' + i
									+ '].splRateIncTax')[0].value);
		}

	}
	sumWithDtaa = sum;
	return parseInt(sumWithDtaa);

}

function isMarginalRelfApplcbl() {
	var surcharge = document
			.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOnTaxPayable')[0];
	var taxPybl = document
			.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')[0];
	if (parseInt(surcharge.value) > 0) {
		if (parseInt(surcharge.value * 0.12) != taxPybl.value) {
			return true;
		}
	}
	return false;
}

function applyExemption(original, exemption) {
	var remaining = exemption;
	var nonZero = 0;
	for (var i = original.length - 1; i >= 0; i--) {
		if (i > 0) {
			original[i] = original[i] - original[i - 1];
		}
		if (original[i] != 0) {
			nonZero++;
		}
	}
	if (nonZero == 0) {
		return original;
	}
	var total = 0;
	for (var i = 0; i < original.length; i++) {
		if (parseInt(original[i], 10) > parseInt(0, 10)) {
			var part = remaining / nonZero--;
			if (parseInt(original[i]) > parseInt(part)) {
				remaining = remaining - part;
				original[i] = original[i] - part;
			} else {
				remaining = remaining - original[i];
				original[i] = 0;
			}
		}
		if (i > 0) {
			original[i] = original[i] + original[i - 1];
		}
		total = eval(parseInt(total, 10) + parseInt(original[i]));
	}
	if (remaining > parseInt(0, 10) && total > parseInt(0, 10)) {
		original = applyExemption(original, remaining);
	}

	return original;
}

// To calculate exemptions
function applyExemption2017(original, exemption, appRate) {
	var remaining = exemption;
	var nonZero = 0;
	for (var i = original.length - 1; i >= 0; i--) {
		if (i > 0
				&& (i < original.length - 1 || (appRate && i < original.length))) {
			original[i] = original[i] - original[i - 1];
		}
		if (original[i] != 0) {
			nonZero++;
		}
	}
	if (nonZero == 0) {
		return original;
	}
	var total = 0;
	for (var i = 0; i < original.length; i++) {
		if (parseInt(original[i], 10) > parseInt(0, 10)) {
			// var part = remaining / nonZero--;
			if (parseInt(original[i]) > parseInt(remaining)) {
				original[i] = (parseInt(original[i], 10)) - remaining;
				remaining = 0;
			} else {
				remaining = remaining - original[i];
				original[i] = 0;
			}
		}
		if (i > 0
				&& (i < original.length - 1 || (appRate && i < original.length))) {
			original[i] = original[i] + original[i - 1];
		}
		total = eval(parseInt(total, 10) + parseInt(original[i]));
	}
	if (parseInt(remaining, 10) > parseInt(0, 10) && total > parseInt(0, 10)) {
		original = applyExemption2017(original, remaining);
	}

	return original;
}

function revisedSetFor6OnLoad(section) {

	var fileSec = document.getElementsByName(section)[0].value;

	if (fileSec == '17' || fileSec == '19') {
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = true;

	} else if (fileSec == '18') {

		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = false;

	} else if (fileSec != '17') {
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		if (fileSec == '20') {
			document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].value = '';
			document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = false;
			document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
			document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = false;
		}
	} else if (fileSec == '20') {
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = false;
	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15'
			|| fileSec == '16' || fileSec == '18' || fileSec == '19') {
		enableField('partAGEN1.filingStatus.secHidden', fileSec,
				'partAGEN1.filingStatus.returnFileSec.noticeDate');
	} else if (fileSec == '11' || fileSec == '12' || fileSec == '17'
			|| fileSec == '') {
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = true;
	}
	
	if (fileSec == '11' || fileSec == '12' || fileSec == '13'
			|| fileSec == '14' || fileSec == '15' || fileSec == '16') {
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].value = '';

		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;

	}
	if (fileSec == '11' || fileSec == '12' || fileSec == '13'
			|| fileSec == '14' || fileSec == '15' || fileSec == '16') {
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = true;
	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15'
			|| fileSec == '16' || fileSec == '19' || fileSec == '20') {
		document
				.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = false;
	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15'
		|| fileSec == '16'  || fileSec == '20') {
	document
			.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = false;
}
}

function revisedSetFor6(section) {

	var fileSec = document.getElementsByName(section)[0].value;

	if (fileSec == '17' || fileSec == '19') {

		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = true;

	} else if (fileSec == '18') {
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = false;


	} else if (fileSec != '17') {
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		if (fileSec == '20') {
			document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].value = '';
			document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = true;
			document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = true;

		}
	} else if (fileSec == '20') {

		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = false;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = false;

	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15'
			|| fileSec == '16' || fileSec == '18' || fileSec == '19') {
		enableField(section, fileSec,
				'partAGEN1.filingStatus.returnFileSec.noticeDate');
	} else if (fileSec == '11' || fileSec == '12' || fileSec == '17'
			|| fileSec == '') {
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = true;
	}
	if (fileSec == '11' || fileSec == '12' || fileSec == '13'
			|| fileSec == '14' || fileSec == '15' || fileSec == '16') {
		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].value = '';

		document.getElementsByName("partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;

	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15'
			|| fileSec == '16' || fileSec == '19' || fileSec == '20') {
		document.getElementsByName("partAGEN1.filingStatus.returnFileSec.noticeDate")[0].disabled = false;
	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15'
		|| fileSec == '16' || fileSec == '20') {
	document.getElementsByName("partAGEN1.filingStatus.uniqNumOrDocIdNum")[0].disabled = false;
}
}

function disHoldComp() {

	var i = document.getElementsByName('partAGEN2For6.natOfCompFlg')[0].value;

	$('#natOfComSubBoth').find(':input').prop('disabled', true);
	$('#natOfComSubBoth').find('.addbtn').prop('hidden', true);
	$('#natOfComHoldBoth').find(':input').prop('disabled', true);
	$('#natOfComHoldBoth').find('.addbtn').prop('hidden', true);

	if (i == '2' || i == '3') {
		$('#natOfComSubBoth').find('.addbtn').prop('hidden', false);
		$('#natOfComSubBoth').find(':input').prop('disabled', false);
	} else {
		$('#natOfComSubBoth').find('[type=\"checkbox\"]').attr('checked',
				'checked');
		deleteRowTable('natOfComSubBoth', 2, 1);
		$('#natOfComSubBoth').find(':input').prop('disabled', true);
		$('#natOfComSubBoth').find('.addbtn').prop('hidden', true);
	}

	if (i == '1' || i == '3') {
		$('#natOfComHoldBoth').find('.addbtn').prop('hidden', false);
		$('#natOfComHoldBoth').find(':input').prop('disabled', false);
	} else {
		$('#natOfComHoldBoth').find('[type=\"checkbox\"]').attr('checked',
				'checked');
		deleteRowTable('natOfComHoldBoth', 2, 1);
		$('#natOfComHoldBoth').find(':input').prop('disabled', true);
		$('#natOfComHoldBoth').find('.addbtn').prop('hidden', true);
	}

}

function calcBalSheet() {
	// I. Equity and Liabilities
	var authorised = coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.shareCapital.authorised");
	var totShareCapital = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.shareCapital.totShareCapital')[0];
	var totResrNSurp = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.totResrNSurp')[0];
	var totShareHolderFund = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.totShareHolderFund')[0];
	var shareAppMoneyTotal = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.shareAppMoneyAllot.total')[0];
	var bondsDebTotal = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.bondsDebentures.total')[0];
	var termLoansTotal = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.termLoans.totalTermLoans')[0];
	var rupeeLoansTotal = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.termLoans.rupeeLoans.total')[0];
	var longTermBorrowTotal = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.totalLTBorrowings')[0];
	var totalOthLtLiab = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.othLongTermLiablities.totalOthLtLiabilities')[0];
	var longTermProvTotal = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermProvisions.total')[0];
	var totalNonCurrLiab = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.totalNonCurrLiabilites')[0];
	var totLoansRepayOnDem = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.loansRepaybleOnDemand.totLoansRepaybleOnDemand')[0];
	var totShortTrmBorw = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.totShortTrmBorrowings')[0];
	var totalTradePayables = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.tradePayables.totalTradePayables')[0];
	var totOthCurrLiab = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.totOthCurrLiabilities')[0];
	var totShortTermProv = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTermProv.totShortTermProvisions')[0];
	var totCurrLiabProv = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.totCurrLiabilitiesProvision')[0];
	var totEquityAndLiab = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.totEquityAndLiabilities')[0];

	totShareCapital.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.shareCapital.issuedSubsPaidUp')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.shareCapital.subscribedNotFullyPaid'));

	if (totShareCapital.value > authorised) {
		addError(
				'',
				'Please recheck-Issued Share Capital is more than Authorized Share Capital.',
				true);
	}

	calculateTotalInTable(
			'partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.otherResrvDtls',
			'operatingRevenueAmt',
			'natAmtId',
			'partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.otherResrvTotal');

	// Total (Bi + Bii + Biii + Biv + Bv + Bvi + Bvii + Bviii)
	totResrNSurp.value = coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.capResr")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.capRedempResr")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.securPremResr")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.debunRedResr")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.revResr")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.shareOptOSAmount")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.otherResrvTotal")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.resrNSurp.plAccount");

	var moneyRecvdAgainstShares = coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.shareHolderFund.moneyRecvdAgainstShares");

	// Total Shareholder's fund (Aiv + Bix + 1C)
	totShareHolderFund.value = eval(totShareCapital.value)
			+ eval(totResrNSurp.value) + eval(moneyRecvdAgainstShares);

	shareAppMoneyTotal.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.shareAppMoneyAllot.pendingLtOneYr')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.shareAppMoneyAllot.pendingMtOneYr'));
	bondsDebTotal.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.bondsDebentures.foreignCurrency')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.bondsDebentures.rupee'));

	// Aiic - Total (iia + b3)
	rupeeLoansTotal.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.termLoans.rupeeLoans.fromBanks')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.termLoans.rupeeLoans.fromOthers'));
	termLoansTotal.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.termLoans.foreignCurrency')
			+ eval(rupeeLoansTotal.value));

	// Total Long term borrowings (ic + iic + iii + iv + v + vi + vii + viii)
	longTermBorrowTotal.value = coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.bondsDebentures.total")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.termLoans.totalTermLoans")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.deferredPymtLiabilities")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.depositsFrmRelatedParties")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.otherDeposits")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.loansAndAdv")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.othersLoanAdv")
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermBorrowings.longTermMaturities");

	totalOthLtLiab.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.othLongTermLiablities.tradePayables')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.othLongTermLiablities.others'));
	longTermProvTotal.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermProvisions.provEmpBenefits')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.longTermProvisions.others'));

	// Total Non-current liabilities (3A + 3B + 3C + 3D)
	totalNonCurrLiab.value = eval(longTermBorrowTotal.value)
			+ coalesceSetRet("partabsFor6FrmAY13.equityAndLiablities.nonCurrLiabilities.netDefferedTaxLiability")
			+ eval(totalOthLtLiab.value) + eval(longTermProvTotal.value);

	// Total Loans repayable on demand (ia + ib + ic + id)
	totLoansRepayOnDem.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.loansRepaybleOnDemand.fromBanks')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.loansRepaybleOnDemand.frmNonBanking')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.loansRepaybleOnDemand.othFinanceInst')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.loansRepaybleOnDemand.others'));

	// Total Short-term borrowings (ie + ii + iii + iv + v)
	totShortTrmBorw.value = zeroOrMore(eval(totLoansRepayOnDem.value)
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.depositsFrmRelatedParties')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.loansAndAdv')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.othLoansAndAdv')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTrmBorrowings.othDeposits'));

	// Total Trade payables (i + ii)
	totalTradePayables.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.tradePayables.osMoreThanOneYr')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.tradePayables.others'));

	// Total Other current liabilities (i + ii + iii + iv + v + vi + vii + viii
	// + ix + x)
	totOthCurrLiab.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.currMatOnLTDebt')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.currMatFinanceOblg')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.accrInterestNotDue')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.accrInterest')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.incRecvdAdvance')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.unpaidDividend')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.appMonyRecvdAllotSecurities')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.unpaidMatDeposits')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.unpaidMatureDebenture')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.othCurrLiabilities.othPayables'));

	// Total Short-term provisions (i + ii +iii + iv + v + vi)
	totShortTermProv.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTermProv.empBenefitProv')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTermProv.itProvision')
			// +
			// coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTermProv.wtProvision')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTermProv.proposedDividend')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTermProv.taxOnDividend')
			+ coalesceSetRet('partabsFor6FrmAY13.equityAndLiablities.currentLiabilities.shortTermProv.othProvision'));

	// Total Current liabilities (4A + 4B + 4C + 4D)
	totCurrLiabProv.value = zeroOrMore(eval(totShortTrmBorw.value)
			+ eval(totalTradePayables.value) + eval(totOthCurrLiab.value)
			+ eval(totShortTermProv.value));

	// Total Equity and liabilities (1D + 2 + 3E + 4E)
	totEquityAndLiab.value = zeroOrMore(eval(totShareHolderFund.value)
			+ eval(shareAppMoneyTotal.value) + eval(totalNonCurrLiab.value)
			+ eval(totCurrLiabProv.value));

	// II. ASSETS

	var tangNetBlock = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.tangible.netBlock')[0];
	var intangNetBlock = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.inTangible.netBlock')[0];
	var totFixedAsset = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.totFixedAsset')[0];
	var totalEquityInstrmts = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.equityInstruments.total')[0];
	var totNonCurrInvst = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.totNonCurrInvstmnts')[0];
	var totLTLoanAdv = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.longTrmLoanAdv.totLTLoanAdv')[0];
	var othNonCurrAssets = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.othNonCurrAssets.ltTradeReceivables.totOthNonCurrAssets')[0];
	var totOthNonCurrAssets = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.othNonCurrAssets.total')[0];
	var totNonCurrAssets = document
			.getElementsByName('partabsFor6FrmAY13.assets.nonCurrAssets.totNonCurrAssets')[0];
	var totCurInvstEqtyInst = document
			.getElementsByName('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.equityInstruments.total')[0];
	var totCurInvstmnt = document
			.getElementsByName('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.totCurrInvstmnts')[0];
	var totInventries = document
			.getElementsByName('partabsFor6FrmAY13.assets.currentAssets.inventories.totInventries')[0];
	var totTradeRecvbles = document
			.getElementsByName('partabsFor6FrmAY13.assets.currentAssets.tradeReceivables.totalTradeReceivables')[0];
	var totCashEquivalents = document
			.getElementsByName('partabsFor6FrmAY13.assets.currentAssets.cashNCashEquivalents.totCashNCashEquivalents')[0];
	var totShrtTermLoans = document
			.getElementsByName('partabsFor6FrmAY13.assets.currentAssets.totShortTermLoanAdv.totShrtTermLoans')[0];
	var totalCurrAssets = document
			.getElementsByName('partabsFor6FrmAY13.assets.currentAssets.totCurrAssets')[0];
	var totalAssets = document
			.getElementsByName('partabsFor6FrmAY13.totalAssets')[0];

	// 1Aid - Net block (ia - ib - ic)
	tangNetBlock.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.tangible.grossBlock')
			- (coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.tangible.depreciation') + coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.tangible.impairmentLosses')));

	// 1Aiid - Net block (iia - iib - iic)
	intangNetBlock.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.inTangible.grossBlock')
			- (coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.inTangible.amortization') + coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.inTangible.impairmentLosses')));

	// 1Av - Total Fixed assets (id + iid + iii + iv)
	totFixedAsset.value = zeroOrMore(eval(tangNetBlock.value)
			+ eval(intangNetBlock.value)
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.capWrkProg')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.fixedAsset.intangibleAssetUnDev'));

	// Bix - Total Non-current investments (i + iic + iii + iv + v + vi + vii +
	// viii)
	totNonCurrInvst.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.invInProperty')
			+ eval(totalEquityInstrmts.value)
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.preferenceShares')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.govtOrTrustSecurities')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.debenturesOrBonds')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.mutualFunds')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.invstmntInPrtnrShipFirm')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.otherInvstmnts'));

	// Biic - Total (iia + iib)
	totalEquityInstrmts.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.equityInstruments.listedEquities')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.nonCurrInvstmnts.equityInstruments.unListedEquities'));

	// Dv - Total Long-term loans and advances (i + ii + iii + iv)
	totLTLoanAdv.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.longTrmLoanAdv.capitalAdv')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.longTrmLoanAdv.securityDeposits')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.longTrmLoanAdv.loanAdvRelatedParties')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.longTrmLoanAdv.othLoanAdv'));

	// Eid - Total Other non-current assets (ia + ib + ic)
	othNonCurrAssets.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.othNonCurrAssets.ltTradeReceivables.secured')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.othNonCurrAssets.ltTradeReceivables.unsecured')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.othNonCurrAssets.ltTradeReceivables.doubtful'));

	// Eiii - Total (id + ii)
	totOthNonCurrAssets.value = zeroOrMore(eval(othNonCurrAssets.value)
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.othNonCurrAssets.others'));

	// 1F - Total Non-current assets (Av + Bix + C + Dv + Eiii)
	totNonCurrAssets.value = zeroOrMore(eval(totFixedAsset.value)
			+ eval(totNonCurrInvst.value)
			+ coalesceSetRet('partabsFor6FrmAY13.assets.nonCurrAssets.netDeferredTaxAssets')
			+ eval(totLTLoanAdv.value) + eval(totOthNonCurrAssets.value));

	// 2. Current assets
	// 2Aic - Total (ia + ib)
	totCurInvstEqtyInst.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.equityInstruments.listedEquities')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.equityInstruments.unListedEquities'));

	// Aviii - Total Current investments (ic + ii + iii + iv + v + vi + vii)
	totCurInvstmnt.value = zeroOrMore(eval(totCurInvstEqtyInst.value)
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.preferenceShares')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.govtOrTrustSecurities')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.debenturesOrBonds')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.mutualFunds')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.invstmntInPrtnrShipFirm')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.currInvstmnts.otherInvstmnts'));

	// Bviii - Total Inventories (i + ii + iii + iv + v + vi + vii)
	totInventries.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.inventories.rawMatl')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.inventories.workInProgress')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.inventories.finOrTradGood')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.inventories.stkInTrade')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.inventories.storesConsumables')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.inventories.looseTools')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.inventories.others'));

	// Ciii - Trade receivables
	totTradeRecvbles.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.tradeReceivables.osMoreThanSixMonths')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.tradeReceivables.others'));

	// Dv - Total Cash and cash equivalents (i + ii + iii + iv)
	totCashEquivalents.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.cashNCashEquivalents.balWithBanks')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.cashNCashEquivalents.chequesDrafts')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.cashNCashEquivalents.cashInHand')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.cashNCashEquivalents.others'));

	// Eiii - Total Short-term loans and advances (i + ii)
	totShrtTermLoans.value = zeroOrMore(coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.totShortTermLoanAdv.loanAdv')
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.totShortTermLoanAdv.others'));

	// G - Total Current assets (Aviii + Bviii + Ciii + Dv + Eiii + F)
	totalCurrAssets.value = zeroOrMore(eval(totCurInvstmnt.value)
			+ eval(totInventries.value)
			+ eval(totTradeRecvbles.value)
			+ eval(totCashEquivalents.value)
			+ eval(totShrtTermLoans.value)
			+ coalesceSetRet('partabsFor6FrmAY13.assets.currentAssets.otherCurrAssets'));

	// Total Assets (1F + 2G)
	totalAssets.value = zeroOrMore(eval(totNonCurrAssets.value)
			+ eval(totalCurrAssets.value));

}

function addRowSchedTRFor6(tableId, noOfRow, last) {

	addRowToTable(tableId, noOfRow, last);
	totAmtOfSchedTRFor6(tableId);

}

function delRowSchedTRFor6(tableId, noOfRow, last) {

	deleteRowTable(tableId, noOfRow, last);
	totAmtOfSchedTRFor6(tableId);

}

function totAmtOfSchedTRFor6(tableId) {

	var table = document.getElementById('scheduleTR');
	var noOfRows = table.rows.length;
	var totTaxPaidOutsideInd = parseInt('0', 10);
	var totReliefAvailable = parseInt('0', 10);
	var totReliefAvailable9090A = parseInt('0', 10);
	var totReliefAvailable91 = parseInt('0', 10);

	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {
		if (document.getElementsByName('scheduleTR1.scheduleTR[' + i
				+ '].relavantArticleDTAA')[0].value == '91') {
			totReliefAvailable91 = eval(totReliefAvailable91
					+ parseInt(coalesce(document
							.getElementsByName('scheduleTR1.scheduleTR[' + i
									+ '].taxReliefOutsideIndia')[0].value), 10));

		} else if (document.getElementsByName('scheduleTR1.scheduleTR[' + i
				+ '].relavantArticleDTAA')[0].value == '90'
				|| document.getElementsByName('scheduleTR1.scheduleTR[' + i
						+ '].relavantArticleDTAA')[0].value == '90A') {
			totReliefAvailable9090A = eval(totReliefAvailable9090A
					+ parseInt(coalesce(document
							.getElementsByName('scheduleTR1.scheduleTR[' + i
									+ '].taxReliefOutsideIndia')[0].value), 10));
		}

		totTaxPaidOutsideInd = eval(parseInt(totTaxPaidOutsideInd, 10)
				+ parseInt(coalesce(document
						.getElementsByName('scheduleTR1.scheduleTR[' + i
								+ '].taxPaidOutsideIndia')[0].value, 10)));
		totReliefAvailable = eval(parseInt(totReliefAvailable, 10)
				+ parseInt(coalesce(document
						.getElementsByName('scheduleTR1.scheduleTR[' + i
								+ '].taxReliefOutsideIndia')[0].value, 10)));

	}

	document.getElementsByName('scheduleTR1.totalIncomeOutIndia')[0].value = totReliefAvailable9090A;
	document.getElementsByName('scheduleTR1.totalIncomeOutIndiaDTAA')[0].value = totReliefAvailable91;
	document.getElementsByName('scheduleTR1.totTaxPaidDeclaredInFSI')[0].value = totTaxPaidOutsideInd;
	document.getElementsByName('scheduleTR1.totReliefClaimUs9090A')[0].value = totReliefAvailable;

}

function validateScheduleTR(tableId) {
	var tab = document.getElementById(tableId);
	var allInputTags = tab.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("totTaxIncScheduleFSI$")) {

			if (parseInt(coalesce(allInputTags[i].value), 10) < eval(parseInt(
					coalesce(allInputTags[i + 1].value), 10)
					+ parseInt(coalesce(allInputTags[i + 2].value), 10))) {
				j
						.setFieldError(allInputTags[i].name,
								'Relief claimed u/s 90/91 (B1 +B2) cannot exceed the total taxes paid.');
			}
		}
	}
}

function totAmtOfSchedFSIFor6(tableId) {

	var tab = document.getElementById(tableId);
	var allInputTags = tab.getElementsByTagName('input');
	var totIncFromHPPartBTIA = parseInt('0', 10);
	var totIncBusinessPartBTIB = parseInt('0', 10);
	var totIncCapGainPartBTIC = parseInt('0', 10);
	var totIncOthSrcPartBTID = parseInt('0', 10);
	var totalAmtCountryWise = parseInt('0', 10);
	var totalIncomeOutIndiaWoDTAA = document
			.getElementsByName('itrScheduleFSI.totalIncomeOutIndiaWoDTAA')[0];
	totalIncomeOutIndiaWoDTAA.value = coalesce(totalIncomeOutIndiaWoDTAA.value);

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("incFromHPPartBTIA$")) {
			totIncFromHPPartBTIA = eval(parseInt(totIncFromHPPartBTIA, 10)
					+ parseInt(coalesce(allInputTags[i].value), 10));
			totIncBusinessPartBTIB = eval(parseInt(totIncBusinessPartBTIB, 10)
					+ parseInt(coalesce(allInputTags[i + 1].value), 10));
			totIncCapGainPartBTIC = eval(parseInt(totIncCapGainPartBTIC, 10)
					+ parseInt(coalesce(allInputTags[i + 2].value), 10));
			totIncOthSrcPartBTID = eval(parseInt(totIncOthSrcPartBTID, 10)
					+ parseInt(coalesce(allInputTags[i + 3].value), 10));
			if (allInputTags[i].value == '' && allInputTags[i + 1].value == ''
					&& allInputTags[i + 2].value == ''
					&& allInputTags[i + 3].value == '') {
				allInputTags[i + 4].value = '';
			} else {
				allInputTags[i + 4].value = eval(parseInt(
						coalesce(allInputTags[i].value), 10)
						+ parseInt(coalesce(allInputTags[i + 1].value))
						+ parseInt(coalesce(allInputTags[i + 2].value))
						+ parseInt(coalesce(allInputTags[i + 3].value)));
			}
			totalAmtCountryWise = eval(parseInt(totalAmtCountryWise, 10)
					+ parseInt(coalesce(allInputTags[i + 4].value), 10));
		}
	}

	document.getElementsByName('itrScheduleFSI.totIncFromHPPartBTIA')[0].value = totIncFromHPPartBTIA;
	document.getElementsByName('itrScheduleFSI.totIncBusinessPartBTIB')[0].value = totIncBusinessPartBTIB;
	document.getElementsByName('itrScheduleFSI.totIncCapGainPartBTIC')[0].value = totIncCapGainPartBTIC;
	document.getElementsByName('itrScheduleFSI.totIncOthSrcPartBTID')[0].value = totIncOthSrcPartBTID;
	document.getElementsByName('itrScheduleFSI.totalAmtCountryWise')[0].value = totalAmtCountryWise;

	document.getElementsByName('itrScheduleFSI.totalIncomeOutIndia')[0].value = totalAmtCountryWise;
	var totalIncomeOutIndiaWoDTAATemp = eval(totalAmtCountryWise)
			- eval(parseInt(coalesce(
					document
							.getElementsByName('itrScheduleFSI.totalIncomeOutIndiaDTAA')[0].value,
					10)));

	if (parseInt(totalIncomeOutIndiaWoDTAATemp, 10) > 0) {
		totalIncomeOutIndiaWoDTAA.value = totalIncomeOutIndiaWoDTAATemp;
	} else {
		totalIncomeOutIndiaWoDTAA.value = parseInt(0, 10);
	}

}

function zeroOrLess(val) {
	if (parseInt(val, 10) > 0) {
		return 0;
	}
	return parseInt(val, 10);
}

function calculateSchDPM() {
	
	var section115ba= document.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	if(section115ba!='115BAA' )
	{
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].value='';
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].value='';
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].value='';




		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].readOnly=true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].readOnly=true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].readOnly=true;
}



	else
	{	document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].readOnly=false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].readOnly=false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.amtAdjOnAccOptTaxUs115BAA')[0].readOnly=false;




	}
	dpmCeasesMesg = '';
	//3b=3+3a
	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.adjWrtnValueOnFirstDayPrvYr"]')[0].value = 
		zeroOrMore(	coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.wdvFirstDay")
	+ coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.amtAdjOnAccOptTaxUs115BAA"));
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.adjWrtnValueOnFirstDayPrvYr"]')[0].value = 
		zeroOrMore(	coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.wdvFirstDay")
	+ coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.amtAdjOnAccOptTaxUs115BAA"));
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.adjWrtnValueOnFirstDayPrvYr"]')[0].value = 
		zeroOrMore(	coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.wdvFirstDay")
	+ coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.amtAdjOnAccOptTaxUs115BAA"));
	
	
	var rate15Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.adjWrtnValueOnFirstDayPrvYr")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.realizationTotalPeriod");
	var rate30Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.adjWrtnValueOnFirstDayPrvYr")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.realizationTotalPeriod");
	var rate40Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.adjWrtnValueOnFirstDayPrvYr")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.realizationTotalPeriod");
	var rate45Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.additionsGrThan180Days")
	- coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.realizationTotalPeriod");

	// For Field 6
	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(rate15Adjustment);
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(rate30Adjustment);
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(rate40Adjustment);
	$('[name="scheduleDPM.plantMachinery.rate45.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(rate45Adjustment);

	rate15Adjustment = zeroOrLess(rate15Adjustment);
	rate30Adjustment = zeroOrLess(rate30Adjustment);
	rate40Adjustment = zeroOrLess(rate40Adjustment);
	rate45Adjustment = zeroOrLess(rate45Adjustment);

	// For Field 9

	rate15Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.realizationPeriodDuringYear")
			+ parseInt(rate15Adjustment, 10);
	rate30Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.realizationPeriodDuringYear")
			+ parseInt(rate30Adjustment, 10);
	rate40Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.realizationPeriodDuringYear")
			+ parseInt(rate40Adjustment, 10);
	rate45Adjustment = coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.additionsLessThan180Days")
	- coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.realizationPeriodDuringYear")
	+ parseInt(rate45Adjustment, 10);

	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(rate15Adjustment);
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(rate30Adjustment);
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(rate40Adjustment);
	$('[name="scheduleDPM.plantMachinery.rate45.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(rate45Adjustment);

	rate15Adjustment = zeroOrLess(rate15Adjustment);
	rate30Adjustment = zeroOrLess(rate30Adjustment);
	rate40Adjustment = zeroOrLess(rate40Adjustment);
	rate45Adjustment = zeroOrLess(rate45Adjustment);

	// For Field 10
	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.fullRateDeprAmt") * 0.15);
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.fullRateDeprAmt") * 0.30);
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.fullRateDeprAmt") * 0.40);
	$('[name="scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
	.round(coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.fullRateDeprAmt") * 0.45);

	// For Field 11
	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.halfRateDeprAmt") * 0.075);
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.halfRateDeprAmt") * 0.15);
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.halfRateDeprAmt") * 0.20);
	$('[name="scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
	.round(coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.halfRateDeprAmt") * 0.225);
	// For Field 15
	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationAtHalfRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprOnGT180DayAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset"));
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationAtHalfRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprOnGT180DayAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset"));
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationAtHalfRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprOnGT180DayAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset"));
	$('[name="scheduleDPM.plantMachinery.rate45.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationAtHalfRate")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprOnGT180DayAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset"));

	// For Field 17
	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.netAgvDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationITAct"));
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.netAgvDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationITAct"));
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.netAgvDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationITAct"));
	$('[name="scheduleDPM.plantMachinery.rate45.depreciationDetail.netAgvDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationITAct"));

	// For Field 21
	$('[name="scheduleDPM.plantMachinery.rate15.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate15.depreciationDetail.totalDepreciation")
			+ parseInt(rate15Adjustment, 10));
	$('[name="scheduleDPM.plantMachinery.rate30.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate30.depreciationDetail.totalDepreciation")
			+ parseInt(rate30Adjustment, 10));
	$('[name="scheduleDPM.plantMachinery.rate40.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate40.depreciationDetail.totalDepreciation")
			+ parseInt(rate40Adjustment, 10));
	$('[name="scheduleDPM.plantMachinery.rate45.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDPM.plantMachinery.rate45.depreciationDetail.totalDepreciation")
			+ parseInt(rate45Adjustment, 10));

	calculatePointNo16DPM('rate15');
	calculatePointNo16DPM('rate30');
	calculatePointNo16DPM('rate40');
	calculatePointNo16DPM('rate45');


}

function calculatePointNo16DPM(percentRate) {
	if ($('[name="scheduleDPM.plantMachinery.' + percentRate
			+ '.depreciationDetail.capGainUs50"]')[0].value != 0
			&& $('[name="scheduleDPM.plantMachinery.' + percentRate
					+ '.depreciationDetail.capGainUs50"]')[0].value != "") {

		var CapGainUs50 = calcPoint16DPMvalue(percentRate);
		if (CapGainUs50 > 0
				&& $('[name="scheduleDPM.plantMachinery.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value > 0
				&& $('[name="scheduleDPM.plantMachinery.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value < CapGainUs50) {
			if (document.getElementsByName('scheduleDPM.plantMachinery.'
					+ percentRate + '.depreciationDetail.capGainUs50')[0].changed == true) {

				document.getElementsByName('scheduleDPM.plantMachinery.'
						+ percentRate + '.depreciationDetail.capGainUs50')[0].changed = false;
			}
			main
					.generateMsgDialogWithOk(
							'The calculated value of Capital Gain/Loss u/s 50 in S.No 20 is '
									+ CapGainUs50
									+ ' and is different from what has been entered by you (value entered by user). Please enter correct value of sale consideration in S.No 5 or 8 of this schedule. Else the entered value will be replaced with the calculated value.',
							"");
			overrideDpmCapGainUs50(percentRate, CapGainUs50);
			calcSchDCGFor6();

		}

		if (CapGainUs50 < 0
				&& $('[name="scheduleDPM.plantMachinery.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value < 0
				&& $('[name="scheduleDPM.plantMachinery.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value > CapGainUs50) {
			if (document.getElementsByName('scheduleDPM.plantMachinery.'
					+ percentRate + '.depreciationDetail.capGainUs50')[0].changed == true) {

				document.getElementsByName('scheduleDPM.plantMachinery.'
						+ percentRate + '.depreciationDetail.capGainUs50')[0].changed = false;
			}
			main
					.generateMsgDialogWithOk(
							'The calculated value of Capital Gain/Loss u/s 50 in S.No 20 is '
									+ CapGainUs50
									+ ' and is different from what has been entered by you. Please enter correct value of sale consideration in S.No 5 or 8 of this schedule. Else the entered value will be replaced with the calculated value.',
							"");
			overrideDpmCapGainUs50(percentRate, CapGainUs50);
			calcSchDCGFor6();

		}

		if (CapGainUs50 < 0
				&& $('[name="scheduleDPM.plantMachinery.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value < 0) {
			dpmCeasesMesg = dpmCeasesMesg
					+ 'Block Depreciation - Plant and Machinery @ '
					+ percentRate.substring(4) + '% ceases to exist.<br/>';

		}

		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.depreciationAtFullRate"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.depreciationAtHalfRate"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.addlnDeprOnGT180DayAdditions"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.addlnDeprDuringYearAdditions"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.totalDepreciation"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.netAgvDepreciation"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.depreciationITAct"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.propAvgDepreciation"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.' + percentRate
				+ '.depreciationDetail.wdvLastDay"]')[0].value = 0;
		$('[name="scheduleDPM.plantMachinery.'
				+ percentRate
				+ '.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset"]')[0].value = 0;

	}

}

function calcPoint16DPMvalue(percentRate) {
	return coalesceSetRet("scheduleDPM.plantMachinery." + percentRate
			+ ".depreciationDetail.realizationTotalPeriod")
			+ coalesceSetRet("scheduleDPM.plantMachinery." + percentRate
					+ ".depreciationDetail.realizationPeriodDuringYear")
			- coalesceSetRet("scheduleDPM.plantMachinery." + percentRate
					+ ".depreciationDetail.adjWrtnValueOnFirstDayPrvYr")
			// -
			// coalesceSetRet("scheduleDPM.plantMachinery."+percentRate+".depreciationDetail.wDVFirstDayOfPrevYr")
			- coalesceSetRet("scheduleDPM.plantMachinery." + percentRate
					+ ".depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery." + percentRate
					+ ".depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDPM.plantMachinery." + percentRate
					+ ".depreciationDetail.expdrOnTrforSaleAsset");
}

function overrideDpmCapGainUs50(percentRate, CapGainUs50) {
	$('[name="scheduleDPM.plantMachinery.' + percentRate
			+ '.depreciationDetail.capGainUs50"]')[0].value = parseInt(
			CapGainUs50, 10);

}

function calculateSchDOA() {
	doaCeasesMesg = '';

	// 6
	var buildingRate5FullRateDeprAmt = coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.wdvFirstDay")
			+ coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.realizationTotalPeriod");
	var buildingRate10FullRateDeprAmt = coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.wdvFirstDay")
			+ coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.realizationTotalPeriod");
	var buildingRate40FullRateDeprAmt = coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.wdvFirstDay")
			+ coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.realizationTotalPeriod");
	var furnitureFittingsRate10FullRateDeprAmt = coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.wdvFirstDay")
			+ coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.realizationTotalPeriod");
	var intangibleAssetsRate25FullRateDeprAmt = coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.wdvFirstDay")
			+ coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.realizationTotalPeriod");
	var shipsRate20FullRateDeprAmt = coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.wdvFirstDay")
			+ coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.realizationTotalPeriod");

	// For Field 6
	$('[name="scheduleDOA.building.rate5.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(buildingRate5FullRateDeprAmt);
	$('[name="scheduleDOA.building.rate10.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(buildingRate10FullRateDeprAmt);
	$('[name="scheduleDOA.building.rate40.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(buildingRate40FullRateDeprAmt);
	$('[name="scheduleDOA.furnitureFittings.rate10.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(furnitureFittingsRate10FullRateDeprAmt);
	$('[name="scheduleDOA.intangibleAssets.rate25.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(intangibleAssetsRate25FullRateDeprAmt);
	$('[name="scheduleDOA.ships.rate20.depreciationDetail.fullRateDeprAmt"]')[0].value = zeroOrMore(shipsRate20FullRateDeprAmt);

	buildingRate5FullRateDeprAmt = zeroOrLess(buildingRate5FullRateDeprAmt);// 3+4-5
	buildingRate10FullRateDeprAmt = zeroOrLess(buildingRate10FullRateDeprAmt);
	buildingRate40FullRateDeprAmt = zeroOrLess(buildingRate40FullRateDeprAmt);
	furnitureFittingsRate10FullRateDeprAmt = zeroOrLess(furnitureFittingsRate10FullRateDeprAmt);
	intangibleAssetsRate25FullRateDeprAmt = zeroOrLess(intangibleAssetsRate25FullRateDeprAmt);
	shipsRate20FullRateDeprAmt = zeroOrLess(shipsRate20FullRateDeprAmt);

	buildingRate5FullRateDeprAmt = (coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.realizationPeriodDuringYear") + buildingRate5FullRateDeprAmt);// 7-8+3+4-5
	buildingRate10FullRateDeprAmt = (coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.realizationPeriodDuringYear") + buildingRate10FullRateDeprAmt);
	buildingRate40FullRateDeprAmt = (coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.realizationPeriodDuringYear") + buildingRate40FullRateDeprAmt);
	furnitureFittingsRate10FullRateDeprAmt = (coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.realizationPeriodDuringYear") + furnitureFittingsRate10FullRateDeprAmt);
	intangibleAssetsRate25FullRateDeprAmt = (coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.realizationPeriodDuringYear") + intangibleAssetsRate25FullRateDeprAmt);
	shipsRate20FullRateDeprAmt = (coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.realizationPeriodDuringYear") + shipsRate20FullRateDeprAmt);

	// For Field 9

	$('[name="scheduleDOA.building.rate5.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(buildingRate5FullRateDeprAmt);
	$('[name="scheduleDOA.building.rate10.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(buildingRate10FullRateDeprAmt);
	$('[name="scheduleDOA.building.rate40.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(buildingRate40FullRateDeprAmt);
	$('[name="scheduleDOA.furnitureFittings.rate10.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(furnitureFittingsRate10FullRateDeprAmt);
	$('[name="scheduleDOA.intangibleAssets.rate25.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(intangibleAssetsRate25FullRateDeprAmt);
	$('[name="scheduleDOA.ships.rate20.depreciationDetail.halfRateDeprAmt"]')[0].value = zeroOrMore(shipsRate20FullRateDeprAmt);

	buildingRate5FullRateDeprAmt = zeroOrLess(buildingRate5FullRateDeprAmt);
	buildingRate10FullRateDeprAmt = zeroOrLess(buildingRate10FullRateDeprAmt);
	buildingRate40FullRateDeprAmt = zeroOrLess(buildingRate40FullRateDeprAmt);
	furnitureFittingsRate10FullRateDeprAmt = zeroOrLess(furnitureFittingsRate10FullRateDeprAmt);
	intangibleAssetsRate25FullRateDeprAmt = zeroOrLess(intangibleAssetsRate25FullRateDeprAmt);
	shipsRate20FullRateDeprAmt = zeroOrLess(shipsRate20FullRateDeprAmt);

	// For Field 10
	$('[name="scheduleDOA.building.rate5.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.fullRateDeprAmt") * 0.05);
	$('[name="scheduleDOA.building.rate10.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.fullRateDeprAmt") * 0.10);
	$('[name="scheduleDOA.building.rate40.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.fullRateDeprAmt") * 0.4);// 40%
																											// AY2018Changes
																											// -
																											// Depreciation
																											// on 6
																											// at
																											// full
																											// rate
	$('[name="scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.fullRateDeprAmt") * 0.10);
	$('[name="scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.fullRateDeprAmt") * 0.25);
	$('[name="scheduleDOA.ships.rate20.depreciationDetail.depreciationAtFullRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.fullRateDeprAmt") * 0.20);

	// For Field 11
	$('[name="scheduleDOA.building.rate5.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.halfRateDeprAmt") * 0.025);
	$('[name="scheduleDOA.building.rate10.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.halfRateDeprAmt") * 0.05);
	$('[name="scheduleDOA.building.rate40.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.halfRateDeprAmt") * 0.2);// 40%(40/2)
																											// AY2018Changes
																											// -
																											// Depreciation
																											// on 9
																											// at
																											// half
																											// rate
	$('[name="scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.halfRateDeprAmt") * 0.05);
	$('[name="scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.halfRateDeprAmt") * 0.125);
	$('[name="scheduleDOA.ships.rate20.depreciationDetail.depreciationAtHalfRate"]')[0].value = Math
			.round(coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.halfRateDeprAmt") * 0.10);

	// For Field 12
	$('[name="scheduleDOA.building.rate5.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.depreciationAtHalfRate"));
	$('[name="scheduleDOA.building.rate10.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.depreciationAtHalfRate"));
	$('[name="scheduleDOA.building.rate40.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.depreciationAtHalfRate"));
	$('[name="scheduleDOA.furnitureFittings.rate10.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtHalfRate"));
	$('[name="scheduleDOA.intangibleAssets.rate25.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtHalfRate"));
	$('[name="scheduleDOA.ships.rate20.depreciationDetail.totalDepreciation"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.depreciationAtFullRate")
			+ coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.depreciationAtHalfRate"));

	// For Field 14
	$('[name="scheduleDOA.building.rate5.depreciationDetail.depreciationNetAgg"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.depreciationAtSec38"));
	$('[name="scheduleDOA.building.rate10.depreciationDetail.depreciationNetAgg"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.depreciationAtSec38"));
	$('[name="scheduleDOA.building.rate40.depreciationDetail.depreciationNetAgg"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.depreciationAtSec38"));
	$('[name="scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationNetAgg"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtSec38"));
	$('[name="scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationNetAgg"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtSec38"));
	$('[name="scheduleDOA.ships.rate20.depreciationDetail.depreciationNetAgg"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.totalDepreciation")
			- coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.depreciationAtSec38"));

	if (parseInt(document
			.getElementsByName("scheduleDOA.building.rate5.depreciationDetail.propDepreciationNetAgg")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.building.rate5.depreciationDetail.depreciationNetAgg")[0].value)) {
		j
				.setFieldError(
						'scheduleDOA.building.rate5.depreciationDetail.propDepreciationNetAgg',
						'Amount cannot be more than the amount entered in Net aggregate depreciation ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.building.rate5.depreciationDetail.propDepreciationNetAgg')[0],
				'Amount cannot be more than the amount entered in Net aggregate depreciation ',
				true);
	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.building.rate10.depreciationDetail.propDepreciationNetAgg")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.building.rate10.depreciationDetail.depreciationNetAgg")[0].value)) {

		j
				.setFieldError(
						'scheduleDOA.building.rate10.depreciationDetail.propDepreciationNetAgg',
						'Amount cannot be more than the amount entered in Net aggregate depreciation ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.building.rate10.depreciationDetail.propDepreciationNetAgg')[0],
				'Amount cannot be more than the amount entered in Net aggregate depreciation ',
				true);

	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.building.rate40.depreciationDetail.propDepreciationNetAgg")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.building.rate40.depreciationDetail.depreciationNetAgg")[0].value)) {

		j
				.setFieldError(
						'scheduleDOA.building.rate40.depreciationDetail.propDepreciationNetAgg',
						'Amount cannot be more than the amount entered in Net aggregate depreciation ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.building.rate40.depreciationDetail.propDepreciationNetAgg')[0],
				'Amount cannot be more than the amount entered in Net aggregate depreciation ',
				true);

	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.furnitureFittings.rate10.depreciationDetail.propDepreciationNetAgg")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationNetAgg")[0].value)) {

		j
				.setFieldError(
						'scheduleDOA.furnitureFittings.rate10.depreciationDetail.propDepreciationNetAgg',
						'Amount cannot be more than the amount entered in Net aggregate depreciation ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.furnitureFittings.rate10.depreciationDetail.propDepreciationNetAgg')[0],
				'Amount cannot be more than the amount entered in Net aggregate depreciation ',
				true);

	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.intangibleAssets.rate25.depreciationDetail.propDepreciationNetAgg")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationNetAgg")[0].value)) {

		j
				.setFieldError(
						'scheduleDOA.intangibleAssets.rate25.depreciationDetail.propDepreciationNetAgg',
						'Amount cannot be more than the amount entered in Net aggregate depreciation ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.intangibleAssets.rate25.depreciationDetail.propDepreciationNetAgg')[0],
				'Amount cannot be more than the amount entered in Net aggregate depreciation ',
				true);

	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.ships.rate20.depreciationDetail.propDepreciationNetAgg")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.ships.rate20.depreciationDetail.depreciationNetAgg")[0].value)) {

		j
				.setFieldError(
						'scheduleDOA.ships.rate20.depreciationDetail.propDepreciationNetAgg',
						'Amount cannot be more than the amount entered in Net aggregate depreciation ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.ships.rate20.depreciationDetail.propDepreciationNetAgg')[0],
				'Amount cannot be more than the amount entered in Net aggregate depreciation ',
				true);

	}
	if (parseInt(document
			.getElementsByName("scheduleDOA.building.rate5.depreciationDetail.depreciationAtSec38")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.building.rate5.depreciationDetail.totalDepreciation")[0].value)) {
		j
				.setFieldError(
						'scheduleDOA.building.rate5.depreciationDetail.depreciationAtSec38',
						'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.building.rate5.depreciationDetail.depreciationAtSec38')[0],
				'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ',
				true);
	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.building.rate10.depreciationDetail.depreciationAtSec38")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.building.rate10.depreciationDetail.totalDepreciation")[0].value)) {

		j
				.setFieldError(
						'scheduleDOA.building.rate10.depreciationDetail.depreciationAtSec38',
						'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.building.rate10.depreciationDetail.depreciationAtSec38')[0],
				'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ',
				true);

	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.building.rate40.depreciationDetail.depreciationAtSec38")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.building.rate40.depreciationDetail.totalDepreciation")[0].value)) {
		j
				.setFieldError(
						'scheduleDOA.building.rate40.depreciationDetail.depreciationAtSec38',
						'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.building.rate40.depreciationDetail.depreciationAtSec38')[0],
				'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ',
				true);
	}
	if (parseInt(document
			.getElementsByName("scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtSec38")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.furnitureFittings.rate10.depreciationDetail.totalDepreciation")[0].value)) {
		j
				.setFieldError(
						'scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtSec38',
						'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.furnitureFittings.rate10.depreciationDetail.depreciationAtSec38')[0],
				'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ',
				true);
	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtSec38")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.intangibleAssets.rate25.depreciationDetail.totalDepreciation")[0].value)) {
		j
				.setFieldError(
						'scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtSec38',
						'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.intangibleAssets.rate25.depreciationDetail.depreciationAtSec38')[0],
				'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ',
				true);
	}

	if (parseInt(document
			.getElementsByName("scheduleDOA.ships.rate20.depreciationDetail.depreciationAtSec38")[0].value) > parseInt(document
			.getElementsByName("scheduleDOA.ships.rate20.depreciationDetail.totalDepreciation")[0].value)) {
		j
				.setFieldError(
						'scheduleDOA.ships.rate20.depreciationDetail.depreciationAtSec38',
						'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDOA.ships.rate20.depreciationDetail.depreciationAtSec38')[0],
				'Amount cannot be more than the amount entered in Total depreciation (10+11) (Sl No 12) ',
				true);
	}

	// For Field 18
	$('[name="scheduleDOA.building.rate5.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDOA.building.rate5.depreciationDetail.totalDepreciation")
			+ parseInt(buildingRate5FullRateDeprAmt, 10));
	$('[name="scheduleDOA.building.rate10.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDOA.building.rate10.depreciationDetail.totalDepreciation")
			+ parseInt(buildingRate10FullRateDeprAmt, 10));
	$('[name="scheduleDOA.building.rate40.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDOA.building.rate40.depreciationDetail.totalDepreciation")
			+ parseInt(buildingRate40FullRateDeprAmt, 10));
	$('[name="scheduleDOA.furnitureFittings.rate10.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDOA.furnitureFittings.rate10.depreciationDetail.totalDepreciation")
			+ parseInt(furnitureFittingsRate10FullRateDeprAmt, 10));
	$('[name="scheduleDOA.intangibleAssets.rate25.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDOA.intangibleAssets.rate25.depreciationDetail.totalDepreciation")
			+ parseInt(intangibleAssetsRate25FullRateDeprAmt, 10));
	$('[name="scheduleDOA.ships.rate20.depreciationDetail.wdvLastDay"]')[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.fullRateDeprAmt")
			+ coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.halfRateDeprAmt")
			- coalesceSetRet("scheduleDOA.ships.rate20.depreciationDetail.totalDepreciation")
			+ parseInt(shipsRate20FullRateDeprAmt, 10));

	// Nil
	document
			.getElementsByName("scheduleDOA.building.rateNil.depreciationDetail.wdvLastDay")[0].value = zeroOrMore(coalesceSetRet("scheduleDOA.building.rateNil.depreciationDetail.wdvFirstDay"));

	calculatePointNo16DOA('building', 'rate5');
	calculatePointNo16DOA('building', 'rate10');
	calculatePointNo16DOA('building', 'rate40');
	calculatePointNo16DOA('furnitureFittings', 'rate10');
	calculatePointNo16DOA('intangibleAssets', 'rate25');
	calculatePointNo16DOA('ships', 'rate20');

}

function calculatePointNo16DOA(assetName, percentRate) {
	if ($('[name="scheduleDOA.' + assetName + '.' + percentRate
			+ '.depreciationDetail.capGainUs50"]')[0].value != 0
			&& $('[name="scheduleDOA.' + assetName + '.' + percentRate
					+ '.depreciationDetail.capGainUs50"]')[0].value != "") {

		var CapGainUs50 = calcPoint16DOAvalue(assetName, percentRate);
		if (CapGainUs50 > 0
				&& $('[name="scheduleDOA.' + assetName + '.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value > 0
				&& $('[name="scheduleDOA.' + assetName + '.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value < CapGainUs50) {
			if (document.getElementsByName('scheduleDOA.' + assetName + '.'
					+ percentRate + '.depreciationDetail.capGainUs50')[0].changed == true) {

				document.getElementsByName('scheduleDOA.' + assetName + '.'
						+ percentRate + '.depreciationDetail.capGainUs50')[0].changed = false;
			}

			main
					.generateMsgDialogWithOk(
							'The calculated value of Capital Gain/Loss u/s 50 in S.No 17 is '
									+ CapGainUs50
									+ ' and is different from what has been entered by you (value entered by user). Please enter correct value of sale consideration in S.No 5 or 8 of this schedule. Else the entered value will be replaced with the calculated value.',
							"");
			overrideDoaCapGainUs50(percentRate, CapGainUs50, assetName);
			calcSchDCGFor6();

		}

		if (CapGainUs50 < 0
				&& $('[name="scheduleDOA.' + assetName + '.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value < 0
				&& $('[name="scheduleDOA.' + assetName + '.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value > CapGainUs50) {
			if (document.getElementsByName('scheduleDOA.' + assetName + '.'
					+ percentRate + '.depreciationDetail.capGainUs50')[0].changed == true) {

				document.getElementsByName('scheduleDOA.' + assetName + '.'
						+ percentRate + '.depreciationDetail.capGainUs50')[0].changed = false;
			}

			main
					.generateMsgDialogWithOk(
							'The calculated value of Capital Gain/Loss u/s 50 in S.No 17 is '
									+ CapGainUs50
									+ ' and is different from what has been entered by you. Please enter correct value of sale consideration in S.No 5 or 8 of this schedule. Else the entered value will be replaced with the calculated value.',
							"");
			overrideDoaCapGainUs50(percentRate, CapGainUs50, assetName);
			calcSchDCGFor6();
		}

		if (CapGainUs50 < 0
				&& $('[name="scheduleDOA.' + assetName + '.' + percentRate
						+ '.depreciationDetail.capGainUs50"]')[0].value < 0) {
			doaCeasesMesg = doaCeasesMesg + 'Block Depreciation - ' + assetName
					+ ' @ ' + percentRate.substring(4)
					+ '% ceases to exist.<br/>';

		}

		$('[name="scheduleDOA.' + assetName + '.' + percentRate
				+ '.depreciationDetail.depreciationAtFullRate"]')[0].value = 0;
		$('[name="scheduleDOA.' + assetName + '.' + percentRate
				+ '.depreciationDetail.depreciationAtHalfRate"]')[0].value = 0;
		$('[name="scheduleDOA.' + assetName + '.' + percentRate
				+ '.depreciationDetail.depreciationNetAgg"]')[0].value = 0;
		$('[name="scheduleDOA.' + assetName + '.' + percentRate
				+ '.depreciationDetail.propDepreciationNetAgg"]')[0].value = 0;
		$('[name="scheduleDOA.' + assetName + '.' + percentRate
				+ '.depreciationDetail.depreciationAtSec38"]')[0].value = 0;
		$('[name="scheduleDOA.' + assetName + '.' + percentRate
				+ '.depreciationDetail.totalDepreciation"]')[0].value = 0;
		$('[name="scheduleDOA.' + assetName + '.' + percentRate
				+ '.depreciationDetail.wdvLastDay"]')[0].value = 0;

	}

}

function calcPoint16DOAvalue(assetName, percentRate) {
	return coalesceSetRet("scheduleDOA." + assetName + "." + percentRate
			+ ".depreciationDetail.realizationTotalPeriod")
			+ coalesceSetRet("scheduleDOA." + assetName + "." + percentRate
					+ ".depreciationDetail.realizationPeriodDuringYear")
			- coalesceSetRet("scheduleDOA." + assetName + "." + percentRate
					+ ".depreciationDetail.wdvFirstDay")
			- coalesceSetRet("scheduleDOA." + assetName + "." + percentRate
					+ ".depreciationDetail.additionsGrThan180Days")
			- coalesceSetRet("scheduleDOA." + assetName + "." + percentRate
					+ ".depreciationDetail.additionsLessThan180Days")
			- coalesceSetRet("scheduleDOA." + assetName + "." + percentRate
					+ ".depreciationDetail.expdrOnTrforSaleAsset");
}

function overrideDoaCapGainUs50(percentRate, CapGainUs50, assetName) {
	$('[name="scheduleDOA.' + assetName + '.' + percentRate
			+ '.depreciationDetail.capGainUs50"]')[0].value = parseInt(
			CapGainUs50, 10);

}

function calculateCYLA(cgosIncome) {
	try {
		// prefill the CYLA-schedule
		prefillCYLA();

		// doing successive setoffs
		// Income of current year (Fill this column only if income is zero or
		// positive)

		setOffOthSrcLossCYLA(cgosIncome);

		// Current year's Income remaining after set off
		document
				.getElementsByName('scheduleCYLA.houseProperty.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.houseProperty.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.houseProperty.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.houseProperty.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.houseProperty.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');

		}

		document
				.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');

		}

		// Profit & gain us 115B
		document
				.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.profitgainsInc.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.profitgainsInc.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}

		// Speculative Income
		document
				.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.speculativeInc.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}

		// Specified Business Income
		document
				.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.specifiedInc.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}

		// Short-term capital gain taxable @ 15%
		document
				.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}
		// Short-term capital gain taxable @ 30%
		document
				.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}

		// Short-term capital gain taxable at applicable rates
		document
				.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}
		// Long term capital gain taxable @ 10%
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');

		}
		// Long term capital gain taxable @ 20%
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');

		}

		// Other sources
		document
				.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff');
		if (coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}
		// Profit from owning and maintaining race horses
		document
				.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}
		// Short-term capital gain taxable at DTAA rates
		document
				.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');
		}

		// Long term capital gain taxable @ DTAA
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');

		}

		// Other sources income taxable at DTAA rates
		document
				.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrAfterSetOff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrAfterSetOff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrAfterSetOff',
							'This figure cannot be negative. Please rearrange your figures');

		}

		// total loss setoff
		document
				.getElementsByName('scheduleCYLA.totalLossSetOff.totHPlossCurYrSetoff')[0].value = coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.profitgainsInc.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
				+ coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff');

		// Business
		document
				.getElementsByName('scheduleCYLA.totalLossSetOff.totBusLossSetoff')[0].value = coalescePath('scheduleCYLA.houseProperty.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')
				+ coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.busLossSetoff');

		document
				.getElementsByName('scheduleCYLA.totalLossSetOff.totOthSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.profitgainsInc.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')
				+ coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff');

		// Loss remaining after set-off
		document
				.getElementsByName('scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff')[0].value = coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
				- coalescePath('scheduleCYLA.totalLossSetOff.totHPlossCurYrSetoff');
		if (coalescePath('scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff',
							'This figure cannot be negative. Please rearrange your figures');
		}

		document
				.getElementsByName('scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff')[0].value = coalescePath('scheduleCYLA.totalCurYr.totBusLoss')
				- coalescePath('scheduleCYLA.totalLossSetOff.totBusLossSetoff');
		if (coalescePath('scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff',
							'This figure cannot be negative. Please rearrange your figures');

		}

		document
				.getElementsByName('scheduleCYLA.lossRemAftSetOff.balOthSrcLossNoRaceHorseAftSetoff')[0].value = coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
				- coalescePath('scheduleCYLA.totalLossSetOff.totOthSrcLossNoRaceHorseSetoff');
		if (coalescePath('scheduleCYLA.lossRemAftSetOff.balOthSrcLossNoRaceHorseAftSetoff') < 0) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleCYLA.lossRemAftSetOff.balOthSrcLossNoRaceHorseAftSetoff')[0],
					'This figure cannot be negative. Please rearrange your figures',
					true);
			j
					.setFieldError(
							'scheduleCYLA.lossRemAftSetOff.balOthSrcLossNoRaceHorseAftSetoff',
							'This figure cannot be negative. Please rearrange your figures');

		}

		/*
		 * cgosIncome.cgInc.stcg.prctgAr =
		 * coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrAfterSetOff');
		 * cgosIncome.cgInc.stcg.prctg30 =
		 * coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrAfterSetOff');
		 * cgosIncome.cgInc.ltcg.prctg20.sec112 =
		 * coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrAfterSetOff');
		 */
		cgosIncome.bpNetInc = coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff');
		calcBFLA(cgosIncome);

	} catch (e) {
		alert('error in calcCYLA=' + e.stack);
	}
}

function prefillCYLA() {
	try {

		// Field 3c of Schedule HP) , only if 3c is positive
		document
				.getElementsByName('scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('scheduleHP.totalIncomeChargeableUnHP'));

		// prefilling column :: Income of current year (Fill this column only if
		// income is zero or positive)- Business (excluding speculation income
		// and income from specified business)
		// A37 of Sch BP,only if A37 is positive
		coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead');
		coalescePath('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead');
		coalescePath('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead');

		// Business income
		document
				.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('itr6ScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C'));
		// Profit & gain 115B
		document
				.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('itr6ScheduleBP.busSetoffCurYr.profitgainInc.incOfCurYrAfterSetOff'));

		// Speculative Income
		document
				.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('itr6ScheduleBP.busSetoffCurYr.speculativeInc.incOfCurYrAfterSetOff'));

		// Specified Business Income
		document
				.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('itr6ScheduleBP.busSetoffCurYr.specifiedInc.incOfCurYrAfterSetOff'));

		// prefilling column :: Short-term capital gain taxable @ 15%
		// Field (7ii of item E of schedule CG)
		document
				.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead')[0].value = coalescePath('scheduleCGPost45.currYrLosses.inStcg15Per.CurrYrLosSetOff');

		// prefilling column :: Short-term capital gain taxable @ 30%
		// Field (7iii of item E of schedule CG)
		document
				.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead')[0].value = coalescePath('scheduleCGPost45.currYrLosses.inStcg30Per.currYrLosSetOff');

		// prefilling column :: Short-term capital gain taxable at applicable
		// rates
		// Field (7iv of item E of schedule CG)
		document
				.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead')[0].value = coalescePath('scheduleCGPost45.currYrLosses.inStcgAppRate.currYrLosSetOff');

		// prefilling column :: Long term capital gain taxable @ 10%
		// Field (7v of item E of schedule CG)
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead')[0].value = coalescePath('scheduleCGPost45.currYrLosses.inLtcg10Per.currYrLosSetOff');

		// prefilling column :: Long term capital gain taxable @ 20%
		// Field (7vi of item E of schedule CG)
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead')[0].value = coalescePath('scheduleCGPost45.currYrLosses.inLtcg20Per.CurrYrLosSetOff');
		document
				.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead')[0].value = coalescePath('scheduleCGPost45.currYrLosses.inStcgDTAARate.currYrLosSetOff');

		document
				.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead')[0].value = coalescePath('scheduleCGPost45.currYrLosses.inLtcgDTAARates.CurrYrLosSetOff');
		// prefilling column :: Other sources income
		// Field (1i of schedule OS)
		document
				.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('scheduleOS.balanceNoRaceHorse'));

		// prefilling column :: Profit from owning and maintaining race horses
		// Field (3c of schedule OS)
		document
				.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('scheduleOS.incFromOwnHorse.balanceOwnRaceHorse'));
		// prefilling column :: Other sources income taxable at DTAA rates
		// Field (2f of schedule OS)
		document
				.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead')[0].value = zeroOrMore(coalescePath('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa.totAmtUnderDtaa'));

		// populating losses in the respective heads
		coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr');
		if (!isPostv('scheduleHP.totalIncomeChargeableUnHP')) {
			document
					.getElementsByName('scheduleCYLA.totalCurYr.totHPlossCurYr')[0].value = Math
					.abs(coalescePath('scheduleHP.totalIncomeChargeableUnHP'));
		} else {
			document
					.getElementsByName('scheduleCYLA.totalCurYr.totHPlossCurYr')[0].value = 0;
		}

		coalescePath('scheduleCYLA.totalCurYr.totBusLoss');
		document.getElementsByName('scheduleCYLA.totalCurYr.totBusLoss')[0].value = coalescePath('itr6ScheduleBP.busSetoffCurYr.lossRemainSetOffOnBus');

		coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse');
		if (!isPostv('scheduleOS.balanceNoRaceHorse')) {
			document
					.getElementsByName('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')[0].value = Math
					.abs(coalescePath('scheduleOS.balanceNoRaceHorse'));
		} else {
			document
					.getElementsByName('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')[0].value = 0;
		}

	} catch (e) {
		alert('error in prefillCYLA()=' + e.stack);
	}
}

function calcSchCG(cgosIncome) {

	try {

		calculateSTCG(cgosIncome);
		calculateLTCG(cgosIncome);

		var totScheduleCGPost45 = document
				.getElementsByName('scheduleCGPost45.totScheduleCGPost45')[0];
		totScheduleCGPost45.value = eval(coalesceSetRet('scheduleCGPost45.shortTermCapGainPost45.totalSTCG')
				+ parseInt(zeroOrMore(coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.totalLTCG'))));

		doCGSetOff(cgosIncome);

	} catch (e) {
		alert('error in calcSchCG=' + e.stack);
	}

}
// CG Table F check with BFLA(Current year’s income remaining after set off)
function calcSchCGLtcgStcg() {

	try {

		var stcg15Per = coalesceSetRet("scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrAfterSetOffBFLosses");
		var shortTermUnder15Per = coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.upto15Of6")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of6To15Of9")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of9To15Of12")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of12To15Of3")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.up16Of3To31Of3");

		var stcgAppRate = coalesceSetRet("scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrAfterSetOffBFLosses");
		var shortTermUnderAppRate = coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.upto15Of6")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of6To15Of9")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of9To15Of12")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of12To15Of3")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.up16Of3To31Of3");

		var stcg30Per = coalesceSetRet("scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrAfterSetOffBFLosses");
		var shortTermUnder30Per = coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.upto15Of6")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of6To15Of9")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of9To15Of12")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of12To15Of3")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.up16Of3To31Of3");

		var stcgDtaaRate = coalesceSetRet("scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrAfterSetOffBFLosses");
		var shortTermUnderDtaaRate = coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.upto15Of6")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of6To15Of9")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of9To15Of12")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of12To15Of3")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.up16Of3To31Of3");
		var ltcg10Per = coalesceSetRet("scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrAfterSetOffBFLosses");
		var longTermUnder10Per = coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.upto15Of6")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of6To15Of9")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of9To15Of12")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of12To15Of3")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.up16Of3To31Of3");

		var ltcg20Per = coalesceSetRet("scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrAfterSetOffBFLosses");
		var longTermUnder20Per = coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.upto15Of6")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of6To15Of9")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of9To15Of12")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of12To15Of3")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.up16Of3To31Of3");
		var ltcgDtaaRate = coalesceSetRet("scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses");
		var longTermUnderDtaaRate = coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.upto15Of6")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of6To15Of9")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of9To15Of12")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of12To15Of3")
				+ coalesceSetRet("scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.up16Of3To31Of3");

		// check for STCG
		if (stcg15Per > shortTermUnder15Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.upto15Of6',
							'Total of Quarterly breakup in STCG 15% is less by '
									+ (stcg15Per - shortTermUnder15Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in STCG 111A is less by "
							+ (stcg15Per - shortTermUnder15Per));
		}
		if (stcg15Per < shortTermUnder15Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnder15Per.upto15Of6',
							'Total of Quarterly breakup in STCG 15% is more by '
									+ Math.abs(stcg15Per - shortTermUnder15Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in STCG 111A is more by "
							+ Math.abs(stcg15Per - shortTermUnder15Per));
		}

		if (stcgAppRate > shortTermUnderAppRate) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.upto15Of6',
							'Total of Quarterly breakup in STCG Applicable Rates is less by '
									+ (stcgAppRate - shortTermUnderAppRate));
			addErrorXHTML('',
					"Total of Quarterly breakup in STCG Others is less by "
							+ (stcgAppRate - shortTermUnderAppRate));
		}
		if (stcgAppRate < shortTermUnderAppRate) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnderAppRate.upto15Of6',
							'Total of Quarterly breakup in STCG Applicable Rates is more by '
									+ Math.abs(stcgAppRate
											- shortTermUnderAppRate));
			addErrorXHTML('',
					"Total of Quarterly breakup in STCG Others is more by "
							+ Math.abs(stcgAppRate - shortTermUnderAppRate));
		}
		if (stcgDtaaRate > shortTermUnderDtaaRate) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.upto15Of6',
							'Total of Quarterly breakup in STCG Dtaa Rates is less by '
									+ (stcgDtaaRate - shortTermUnderDtaaRate));
			addErrorXHTML('',
					"Total of Quarterly breakup in STCG Others is less by "
							+ (stcgDtaaRate - shortTermUnderDtaaRate));
		}
		if (stcgDtaaRate < shortTermUnderDtaaRate) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnderDtaaRate.upto15Of6',
							'Total of Quarterly breakup in STCG Dtaa Rates is more by '
									+ Math.abs(stcgDtaaRate
											- shortTermUnderDtaaRate));
			addErrorXHTML('',
					"Total of Quarterly breakup in STCG Others is more by "
							+ Math.abs(stcgDtaaRate - shortTermUnderDtaaRate));
		}

		if (stcg30Per > shortTermUnder30Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.upto15Of6',
							'Total of Quarterly breakup in STCG 30% is less by '
									+ (stcg30Per - shortTermUnder30Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG Proviso is less by "
							+ (stcg30Per - shortTermUnder30Per));
		}
		if (stcg30Per < shortTermUnder30Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.shortTermUnder30Per.upto15Of6',
							'Total of Quarterly breakup in STCG 30% is more by '
									+ Math.abs(stcg30Per - shortTermUnder30Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG Proviso is more by "
							+ Math.abs(stcg30Per - shortTermUnder30Per));
		}

		// check for LTCG

		if (ltcg10Per > longTermUnder10Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.upto15Of6',
							'Total of Quarterly breakup in LTCG 10% is less by '
									+ (ltcg10Per - longTermUnder10Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG Non Proviso is less by "
							+ (ltcg10Per - longTermUnder10Per));
		}

		if (ltcg10Per < longTermUnder10Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.longTermUnder10Per.upto15Of6',
							'Total of Quarterly breakup in LTCG 10% is more by '
									+ Math.abs(ltcg10Per - longTermUnder10Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG Non Proviso is more by "
							+ Math.abs(ltcg10Per - longTermUnder10Per));
		}

		if (ltcg20Per > longTermUnder20Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.upto15Of6',
							'Total of Quarterly breakup in LTCG 20% is less by '
									+ (ltcg20Per - longTermUnder20Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG Non Proviso is less by "
							+ (ltcg20Per - longTermUnder20Per));
		}

		if (ltcg20Per < longTermUnder20Per) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.longTermUnder20Per.upto15Of6',
							'Total of Quarterly breakup in LTCG 20% is more by '
									+ Math.abs(ltcg20Per - longTermUnder20Per));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG Non Proviso is more by "
							+ Math.abs(ltcg20Per - longTermUnder20Per));
		}

		if (ltcgDtaaRate > longTermUnderDtaaRate) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.upto15Of6',
							'Total of Quarterly breakup in LTCG Dtaa Rate is less by '
									+ (ltcgDtaaRate - longTermUnderDtaaRate));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG DTAA is less by "
							+ (ltcgDtaaRate - longTermUnderDtaaRate));
		}

		if (ltcgDtaaRate < longTermUnderDtaaRate) {
			j
					.setFieldError(
							'scheduleCGPost45.accruOrRecOfCG.longTermUnderDtaa.upto15Of6',
							'Total of Quarterly breakup in LTCG Dtaa Rate is more by '
									+ Math.abs(ltcgDtaaRate
											- longTermUnderDtaaRate));
			addErrorXHTML('',
					"Total of Quarterly breakup in LTCG DTAA is more by "
							+ Math.abs(ltcgDtaaRate - longTermUnderDtaaRate));
		}

		var table = document.getElementById('scheduleCGstcg1');
		var noOfRows = table.rows.length;

		for (var i = 0; i < noOfRows / 14; i++) {

			var fullConsideration = document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['
							+ i + '].fullConsideration')[0];
			var propertyValuation = document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['
							+ i + '].propertyValuation')[0];
			var fullConsideration50C = document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['
							+ i + '].fullConsideration50C')[0];

			if (fullConsideration50C.value != fullConsideration.value
					&& fullConsideration50C.value != propertyValuation.value) {
				j.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['
								+ i + '].fullConsideration50C',
						"Please enter value from 'ai' or 'aii' only");
				addErrorXHTML(fullConsideration50C,
						"Please enter value from 'ai' or 'aii' only");
			}
		}

		var table = document.getElementById('scheduleCGltcg1');
		var noOfRows = table.rows.length;

		for (var i = 0; i < noOfRows / 14; i++) {

			fullConsideration = document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['
							+ i + '].fullConsideration')[0];
			propertyValuation = document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['
							+ i + '].propertyValuation')[0];
			fullConsideration50C = document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['
							+ i + '].fullConsideration50C')[0];

			if (fullConsideration50C.value != fullConsideration.value
					&& fullConsideration50C.value != propertyValuation.value) {
				j.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['
								+ i + '].fullConsideration50C',
						"Please enter value from 'ai' or 'aii' only");
				addErrorXHTML(fullConsideration50C,
						"Please enter value from 'ai' or 'aii' only");
			}
		}

		var fullConsidtnia = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnia')[0];
		var fullConsidtnib = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnib')[0];
		var fullConsidtnic = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnic')[0];

		if (parseInt(coalesce(fullConsidtnic.value), 10) != parseInt(
				coalesce(fullConsidtnia.value), 10)
				&& parseInt(coalesce(fullConsidtnic.value), 10) != parseInt(
						coalesce(fullConsidtnib.value), 10)) {
			j
					.setFieldError(
							'scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnic',
							"Please enter value from '6aia' or '6aib' only");
			addErrorXHTML(fullConsidtnic,
					"Please enter value from '6aia' or '6aib' only");
		}

		var fullConsidtnia1 = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnia')[0];
		var fullConsidtnib1 = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnib')[0];
		var fullConsidtnic1 = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnic')[0];

		if (parseInt(coalesce(fullConsidtnic1.value), 10) != parseInt(
				coalesce(fullConsidtnia1.value), 10)
				&& parseInt(coalesce(fullConsidtnic1.value), 10) != parseInt(
						coalesce(fullConsidtnib1.value), 10)) {
			j
					.setFieldError(
							'scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnic',
							"Please enter value from '5aia' or '5aib' only");
			addErrorXHTML(fullConsidtnic1,
					"Please enter value from '5aia' or '5aib' only");
		}

		var tab = document.getElementById('stcg10pctTab');
		var selects = tab.getElementsByTagName('SELECT');
		var count = {
			"21ciii" : 0,
			"5AC1c" : 0,
			"5ADiii" : 0,
			"5ACA1b" : 0
		};
		for (var i = 0; i < selects.length; i++) {
			count[selects[i].value] = count[selects[i].value] + 1;
			if (count[selects[i].value] > 1) {
				j.setFieldError(selects[i].name,
						' A particular drop down cannot be selected twice');
				addErrorXHTML(selects[i],
						" A particular drop down cannot be selected twice");
				break;
			}
		}

	//	dropDownSelection('ltcgDeduction54ec54ee1');

	} catch (e) {
		alert('error in calcSchCGLtcgStcg=' + e.stack);
	}
}

function dropDownSelection(tabName) {
	var tab = document.getElementById(tabName);
	var selects = tab.getElementsByTagName("SELECT");
	var count = {
		//"54EE" : 0,
		"54EC" : 0
	};
	for (var i = 0; i < selects.length; i++) {
		count[selects[i].value] = count[selects[i].value] + 1;
		if (count[selects[i].value] > 1) {
			j
					.setFieldError(selects[i].name,
							' A particular drop down cannot be selected twice in B2 in schedule CG');
			addErrorXHTML(selects[i],
					" A particular drop down cannot be selected twice in B2 in schedule CG");
			break;
		}
	}
}

function calcSchESRFor6() {
	var amtDebPL1i = document
			.getElementsByName('scheduleESR.deductionUs35.section351I.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351I.deductUs35.amtDebPL');
	var amtUs35Allowable1i = document
			.getElementsByName('scheduleESR.deductionUs35.section351I.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351I.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL1i = document
			.getElementsByName('scheduleESR.deductionUs35.section351I.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351I.deductUs35.excessAmtOverDebPL');

	var amtDebPL1ii = document
			.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Ii.deductUs35.amtDebPL');
	var amtUs35Allowable1ii = document
			.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Ii.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL1ii = document
			.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Ii.deductUs35.excessAmtOverDebPL');

	var amtDebPL1iia = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iia.deductUs35.amtDebPL');
	var amtUs35Allowable1iia = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iia.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL1iia = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iia.deductUs35.excessAmtOverDebPL');

	var amtDebPL1iii = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iii.deductUs35.amtDebPL');
	var amtUs35Allowable1iii = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iii.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL1iii = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iii.deductUs35.excessAmtOverDebPL');

	var amtDebPL1iiv = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iv.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iv.deductUs35.amtDebPL');
	var amtUs35Allowable1iiv = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iv.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iv.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL1iv = document
			.getElementsByName('scheduleESR.deductionUs35.section351Iv.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section351Iv.deductUs35.excessAmtOverDebPL');

	var amtDebPL2AA = document
			.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section352AA.deductUs35.amtDebPL');
	var amtUs35Allowable2AA = document
			.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section352AA.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL2AA = document
			.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section352AA.deductUs35.excessAmtOverDebPL');

	var amtDebPL2AB = document
			.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section352AB.deductUs35.amtDebPL');
	var amtUs35Allowable2AB = document
			.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section352AB.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL2AB = document
			.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section352AB.deductUs35.excessAmtOverDebPL');

	var amtDebPLCCC = document
			.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section35CCC.deductUs35.amtDebPL');
	var amtUs35AllowableCCC = document
			.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section35CCC.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPLCCC = document
			.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section35CCC.deductUs35.excessAmtOverDebPL');

	var amtDebPLCCD = document
			.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section35CCD.deductUs35.amtDebPL');
	var amtUs35AllowableCCD = document
			.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section35CCD.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPLCCD = document
			.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.section35CCD.deductUs35.excessAmtOverDebPL');

	var amtDebPLTot = document
			.getElementsByName('scheduleESR.deductionUs35.totUs35.deductUs35.amtDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.totUs35.deductUs35.amtDebPL');
	var amtUs35AllowableTot = document
			.getElementsByName('scheduleESR.deductionUs35.totUs35.deductUs35.amtUs35Allowable')[0];
	coalesceSetRet('scheduleESR.deductionUs35.totUs35.deductUs35.amtUs35Allowable');
	var excessAmtOverDebPL1iTot = document
			.getElementsByName('scheduleESR.deductionUs35.totUs35.deductUs35.excessAmtOverDebPL')[0];
	coalesceSetRet('scheduleESR.deductionUs35.totUs35.deductUs35.excessAmtOverDebPL');

	excessAmtOverDebPL1i.value = eval(parseInt(amtUs35Allowable1i.value), 10)
			- eval(parseInt(amtDebPL1i.value), 10);
	if (eval(excessAmtOverDebPL1i.value, 10) < 0) {
		excessAmtOverDebPL1i.value = parseInt(0, 10);
	}

	excessAmtOverDebPL1ii.value = eval(parseInt(amtUs35Allowable1ii.value), 10)
			- eval(parseInt(amtDebPL1ii.value), 10);
	if (eval(excessAmtOverDebPL1ii.value, 10) < 0) {
		excessAmtOverDebPL1ii.value = parseInt(0, 10);
	}

	excessAmtOverDebPL1iia.value = eval(parseInt(amtUs35Allowable1iia.value),
			10)
			- eval(parseInt(amtDebPL1iia.value), 10);
	if (eval(excessAmtOverDebPL1iia.value, 10) < 0) {
		excessAmtOverDebPL1iia.value = parseInt(0, 10);
	}
	excessAmtOverDebPL1iii.value = eval(parseInt(amtUs35Allowable1iii.value),
			10)
			- eval(parseInt(amtDebPL1iii.value), 10);
	if (eval(excessAmtOverDebPL1iii.value, 10) < 0) {
		excessAmtOverDebPL1iii.value = parseInt(0, 10);
	}

	excessAmtOverDebPL1iv.value = eval(parseInt(amtUs35Allowable1iiv.value), 10)
			- eval(parseInt(amtDebPL1iiv.value), 10);
	if (eval(excessAmtOverDebPL1iv.value, 10) < 0) {
		excessAmtOverDebPL1iv.value = parseInt(0, 10);
	}

	excessAmtOverDebPL2AA.value = eval(parseInt(amtUs35Allowable2AA.value), 10)
			- eval(parseInt(amtDebPL2AA.value), 10);
	if (eval(excessAmtOverDebPL2AA.value, 10) < 0) {
		excessAmtOverDebPL2AA.value = parseInt(0, 10);
	}

	excessAmtOverDebPL2AB.value = eval(parseInt(amtUs35Allowable2AB.value), 10)
			- eval(parseInt(amtDebPL2AB.value), 10);
	if (eval(excessAmtOverDebPL2AB.value, 10) < 0) {
		excessAmtOverDebPL2AB.value = parseInt(0, 10);
	}

	excessAmtOverDebPLCCC.value = eval(parseInt(amtUs35AllowableCCC.value), 10)
			- eval(parseInt(amtDebPLCCC.value), 10);
	if (eval(excessAmtOverDebPLCCC.value, 10) < 0) {
		excessAmtOverDebPLCCC.value = parseInt(0, 10);
	}

	excessAmtOverDebPLCCD.value = eval(parseInt(amtUs35AllowableCCD.value), 10)
			- eval(parseInt(amtDebPLCCD.value), 10);
	if (eval(excessAmtOverDebPLCCD.value, 10) < 0) {
		excessAmtOverDebPLCCD.value = parseInt(0, 10);
	}

	amtDebPLTot.value = eval(parseInt(amtDebPL1i.value), 10)
			+ eval(parseInt(amtDebPL1ii.value), 10)
			+ eval(parseInt(amtDebPL1iia.value), 10)
			+ eval(parseInt(amtDebPL1iii.value), 10)
			+ eval(parseInt(amtDebPL1iiv.value), 10)
			+ eval(parseInt(amtDebPL2AA.value), 10)
			+ eval(parseInt(amtDebPL2AB.value), 10)
			+ eval(parseInt(amtDebPLCCC.value), 10)
			+ eval(parseInt(amtDebPLCCD.value), 10);
	amtUs35AllowableTot.value = eval(parseInt(amtUs35Allowable1i.value), 10)
			+ eval(parseInt(amtUs35Allowable1ii.value), 10)
			+ eval(parseInt(amtUs35Allowable1iia.value), 10)
			+ eval(parseInt(amtUs35Allowable1iii.value), 10)
			+ eval(parseInt(amtUs35Allowable1iiv.value), 10)
			+ eval(parseInt(amtUs35Allowable2AA.value), 10)
			+ eval(parseInt(amtUs35Allowable2AB.value), 10)
			+ eval(parseInt(amtUs35AllowableCCC.value), 10)
			+ eval(parseInt(amtUs35AllowableCCD.value), 10);
	excessAmtOverDebPL1iTot.value = eval(parseInt(excessAmtOverDebPL1i.value),
			10)
			+ eval(parseInt(excessAmtOverDebPL1ii.value), 10)
			+ eval(parseInt(excessAmtOverDebPL1iia.value), 10)
			+ eval(parseInt(excessAmtOverDebPL1iii.value), 10)
			+ eval(parseInt(excessAmtOverDebPL1iv.value), 10)
			+ eval(parseInt(excessAmtOverDebPL2AA.value), 10)
			+ eval(parseInt(excessAmtOverDebPL2AB.value), 10)
			+ eval(parseInt(excessAmtOverDebPLCCC.value), 10)
			+ eval(parseInt(excessAmtOverDebPLCCD.value), 10);

}

function setOffHPLossCYLA(cgosIncome) {
	try {
		var stcgPercent15Sec111a = cgosIncome.cgInc.stcg.prctg15.sec111a;
		var stcgPercent15Sec115ad_1_b_ii = cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii;
		var stcgPercent15SecPti = cgosIncome.cgInc.stcg.prctg15.secPti;
		var stcgPercent30Sec115AD = zeroOrMore(cgosIncome.cgInc.stcg.prctg30.sec115AD);
		var stcgPercent30SecPti = zeroOrMore(cgosIncome.cgInc.stcg.prctg30.secPti);
		var stcgPercentArSecStcgApp = zeroOrMore(cgosIncome.cgInc.stcg.prctgAr.stcgApp);
		var stcgPercentArSecPti = zeroOrMore(cgosIncome.cgInc.stcg.prctgAr.secPti);
		var ltcgPrctg20SecPti = cgosIncome.cgInc.ltcg.prctg20.secPti;
		var ltcgPrctg20Sec112 = cgosIncome.cgInc.ltcg.prctg20.sec112;
		var ltcgPrctg10SecProviso = cgosIncome.cgInc.ltcg.prctg10.secProviso;
		var ltcgPrctg10Sec112c2 = cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2;
		var ltcgPrctg10Sec115AC1 = cgosIncome.cgInc.ltcg.prctg10.sec115AC_1;
		var ltcgPrctg10Sec115AD3 = cgosIncome.cgInc.ltcg.prctg10.sec115AD_3;
		var ltcgPrctg10Sec115AB1B = cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B;
		var ltcgPrctg10SecPti = cgosIncome.cgInc.ltcg.prctg10.secPti;
		var ltcgPrctgPTI_LTCG10P112A = cgosIncome.cgInc.ltcg.prctg10.secPti112A;
		var ltcgPrctg10Sec115ADiiiP = cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP;
		var ltcgPrctg10Sec112A = cgosIncome.cgInc.ltcg.prctg10.sec112A;


		document
				.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')[0].value = 0;

		if (!checkIfChanged('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totHPlossCurYr',
					coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr'));
		}

		if (!checkIfChanged('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkHPeditableValidity(
					'scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.totalCurYr.totHPlossCurYr',
					coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkHPeditableValidity(
					'scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.totalCurYr.totHPlossCurYr',
					coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));

		}

		if (!checkIfChanged('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkHPeditableValidity(
					'scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.totalCurYr.totHPlossCurYr',
					coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkHPeditableValidity(
					'scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.totalCurYr.totHPlossCurYr',
					coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkHPeditableValidity(
					'scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.totalCurYr.totHPlossCurYr',
					coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkHPeditableValidity(
					'scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.totalCurYr.totHPlossCurYr',
					coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')) {
			document
					.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff',
					'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff'));
		}

		/*
		 * Order of adjustment :- 1) Business Income 2) Speculative Income 3)
		 * Specified Income 4) Other sources 5) Profit from owning and
		 * maintaining race horses 6) Short-term capital gain taxable @ 30% 7)
		 * Short-term capital gain taxable at applicable rates 8) Long term
		 * capital gain taxable @ 20% 9) Short-term capital gain taxable @ 15%
		 * 10) Long term capital gain taxable @ 10% (1.
		 * cgosIncome.cgInc.ltcg.prctg10.secProviso, 2.
		 * cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2, 3.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115AC_1, 4.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115ACA_1, 5.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115AD_3, 6.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115E_b)
		 */

		// 1. Business Income
		var busIncSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff'));
		var prevSetOffRemStart = coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr');
		var hpLossRem = 200000;
		var prevSetOffRem = Math.min(parseInt(prevSetOffRemStart, 10),
				parseInt(hpLossRem, 10));
		var setOffRem = prevSetOffRem - busIncSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')[0].value = busIncSetOffRem;
				} else {
					checkFirstLessThanMinOthTwo(
							'scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr'));
			}
			setOffRem = 0;
		}

		// 3. Speculative Income
		var specltvIncSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff'));
		prevSetOffRem = setOffRem;
		setOffRem = prevSetOffRem - specltvIncSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')[0].value = specltvIncSetOffRem;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 4. Specified Income
		var specfidIncSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff'));
		prevSetOffRem = setOffRem;
		setOffRem = prevSetOffRem - specfidIncSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')[0].value = specfidIncSetOffRem;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 2. Profit & gain Us 115B
		var profitGain115BSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.profitgainsInc.incCYLA.othSrcLossNoRaceHorseSetoff'));
		prevSetOffRem = setOffRem;
		setOffRem = prevSetOffRem - profitGain115BSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.hPlossCurYrSetoff')[0].value = profitGain115BSetOffRem;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}
		// 5. Other sources (excluding profit from owning race horses)

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem
				- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead');
		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead');
					hpLossRem = parseInt(hpLossRem, 10)
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead');
				} else {
					checkFirstLessThanMinOthTwo(
							'scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff');
					document
							.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = hpLossRem;
					setOffRem = parseInt(setOffRem, 10)
							- parseInt(hpLossRem, 10);

				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr'));
			}
			setOffRem = 0;
		}

		// 6. Profit from owning and maintaining race horse
		var raceHrsSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - raceHrsSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = raceHrsSetOffRem;
				} else {
					checkHPeditableValidity(
							'scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
									- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			} else {
				checkHPeditableValidity(
						'scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
								- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff'));
			}
			setOffRem = 0;
		}
		// 4) OS income taxable at DTAA rates
		var oSDtaaSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - oSDtaaSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')[0].value = oSDtaaSetOffRem;
				} else {
					checkHPeditableValidity(
							'scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
									- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			} else {
				checkHPeditableValidity(
						'scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
								- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff'));
			}
			setOffRem = 0;
		}

		/*
		 * // 7. Short-term capital gain taxable @ 30%
		 * 
		 * var stcg30PercntSetOffRem =
		 * zeroOrMore(coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead')-
		 * coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
		 * 
		 * prevSetOffRem = setOffRem; setOffRem = setOffRem -
		 * stcg30PercntSetOffRem;
		 * 
		 * if(setOffRem>=0){ if(prevSetOffRem==0){
		 * document.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')[0].value =
		 * 0; }else{
		 * if(!checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')){
		 * document.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')[0].value =
		 * stcg30PercntSetOffRem; }else{
		 * checkHPeditableValidity('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff',
		 * 'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead','scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff'
		 * ,'scheduleCYLA.totalCurYr.totHPlossCurYr',
		 * coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')-
		 * coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')-
		 * coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff'));
		 * 
		 * setOffRem = parseInt(prevSetOffRem,10) -
		 * coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff'); } }
		 * }else{ if(
		 * !checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')){
		 * document.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')[0].value =
		 * prevSetOffRem; }else{
		 * checkHPeditableValidity('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff',
		 * 'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead','scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff'
		 * ,'scheduleCYLA.totalCurYr.totHPlossCurYr',
		 * coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')-
		 * coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')-
		 * coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')); }
		 * setOffRem =0 ; }
		 */

		// 8) Short-term capital gain taxable @ 30%
		var stcg30PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - stcg30PercntSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')[0].value = stcg30PercntSetOffRem;
					stcg30PercntSetOffRem = 0;
					stcgPercent30Sec115AD = 0;
					stcgPercent30SecPti = 0;

				} else {
					checkHPeditableValidity(
							'scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
									- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;

				// sec break up
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent30Sec115AD, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent30Sec115AD = parseInt(stcgPercent30Sec115AD, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent30Sec115AD, 10);
					stcgPercent30Sec115AD = 0;
				}
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent30SecPti, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent30SecPti = parseInt(stcgPercent30SecPti, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent30SecPti, 10);
					stcgPercent30SecPti = 0;
				}

			} else {
				checkHPeditableValidity(
						'scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
								- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));
			}
			setOffRem = 0;
		}

		// 8. Short-term capital gain taxable at applicable rates

		var stcgAppRateSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - stcgAppRateSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')[0].value = stcgAppRateSetOffRem;
				} else {
					checkHPeditableValidity(
							'scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
									- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			} else {
				checkHPeditableValidity(
						'scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
								- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff'));
			}
			setOffRem = 0;
		}

		// 9. Long term capital gain taxable @ 20%
		prevSetOffRem = setOffRem;
		var ltcg20PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff'));

		if (ltcg20PercntSetOffRem >= 0 && setOffRem >= 0) {
			if (ltcg20PercntSetOffRem >= setOffRem) {
				var tempAk = setOffRem;
				setOffRem = setOffRem - parseInt(ltcg20PercntSetOffRem, 10);

				if (setOffRem >= 0) {

					if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')) {
						document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value = parseInt(
								ltcg20PercntSetOffRem, 10);
						ltcgPrctg20Sec112 = 0;

						ltcgPrctg20SecPti = 0;

					} else {

						checkHPeditableValidity(
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
								'scheduleCYLA.totalCurYr.totHPlossCurYr',
								coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
										- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff'));

						if (parseInt(ltcgPrctg20Sec112, 10) >= document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value) {
							ltcgPrctg20Sec112 = parseInt(ltcgPrctg20Sec112, 10)
									- document
											.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value;
						} else {
							var remaLTCGcomplete = document
									.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value
									- parseInt(ltcgPrctg20Sec112, 10);
							ltcgPrctg20Sec112 = 0;
							/*
							 * if(parseInt(ltcgPrctg20Sec11EA,10) >=
							 * remaLTCGcomplete){ ltcgPrctg20Sec11EA =
							 * parseInt(ltcgPrctg20Sec11EA,10) -
							 * remaLTCGcomplete; }else{ ltcgPrctg20Sec11EA=0; }
							 */
							if (parseInt(ltcgPrctg20SecPti, 10) >= remaLTCGcomplete) {
								ltcgPrctg20SecPti = parseInt(ltcgPrctg20SecPti,
										10)
										- remaLTCGcomplete;
							} else {

								ltcgPrctg20SecPti = 0;
							}

						}
					}

					ltcg20PercntSetOffRem = zeroOrMore(ltcg20PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));
				} else {

					if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')) {
						document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value = tempAk;
						setOffRem = 0;
						// sec break up

						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg20Sec112, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg20Sec112 = parseInt(ltcgPrctg20Sec112, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg20Sec112, 10);
							ltcgPrctg20Sec112 = 0;
						}
						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg20SecPti, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg20SecPti = parseInt(ltcgPrctg20SecPti, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg20SecPti, 10);
							ltcgPrctg20SecPti = 0;
						}

					} else {
						checkHPeditableValidity(
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
								'scheduleCYLA.totalCurYr.totHPlossCurYr',
								coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
										- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff'));

						if (parseInt(ltcgPrctg20Sec112, 10) >= document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value) {
							ltcgPrctg20Sec112 = parseInt(ltcgPrctg20Sec112, 10)
									- document
											.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value;
						} else {
							var remaLTCGcomplete = document
									.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value
									- parseInt(ltcgPrctg20Sec112, 10);
							ltcgPrctg20Sec112 = 0;

							if (parseInt(ltcgPrctg20SecPti, 10) >= remaLTCGcomplete) {
								ltcgPrctg20SecPti = parseInt(ltcgPrctg20SecPti,
										10)
										- remaLTCGcomplete;
							} else {

								ltcgPrctg20SecPti = 0;
							}

						}
					}
					ltcg20PercntSetOffRem = zeroOrMore(ltcg20PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));
				}

			} else {
				var prevLtcgSetOffRem = ltcg20PercntSetOffRem;

				if (ltcg20PercntSetOffRem >= 0) {
					if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')) {
						document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value = parseInt(
								ltcg20PercntSetOffRem, 10);
						ltcg20PercntSetOffRem = 0;
						ltcgPrctg20Sec112 = 0;
						ltcgPrctg20SecPti = 0;

					} else {

						checkHPeditableValidity(
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
								'scheduleCYLA.totalCurYr.totHPlossCurYr',
								coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
										- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff'));

						if (parseInt(ltcgPrctg20Sec112, 10) >= document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value) {
							ltcgPrctg20Sec112 = parseInt(ltcgPrctg20Sec112, 10)
									- document
											.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value;
						} else {
							var remaLTCGcomplete = document
									.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value
									- parseInt(ltcgPrctg20Sec112, 10);
							ltcgPrctg20Sec112 = 0;

							if (parseInt(ltcgPrctg20SecPti, 10) >= remaLTCGcomplete) {
								ltcgPrctg20SecPti = parseInt(ltcgPrctg20SecPti,
										10)
										- remaLTCGcomplete;
							} else {

								ltcgPrctg20SecPti = 0;
							}

						}
					}
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));
				} else {
					if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')) {
						document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value = prevLtcgSetOffRem;
						ltcg20PercntSetOffRem = 0;
						ltcgPrctg20Sec112 = 0;
						ltcgPrctg20SecPti = 0;

					} else {

						checkHPeditableValidity(
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
								'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
								'scheduleCYLA.totalCurYr.totHPlossCurYr',
								coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
										- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff'));

						if (parseInt(ltcgPrctg20Sec112, 10) >= document
								.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value) {
							ltcgPrctg20Sec112 = parseInt(ltcgPrctg20Sec112, 10)
									- document
											.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value;
						} else {
							var remaLTCGcomplete = document
									.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')[0].value
									- parseInt(ltcgPrctg20Sec112, 10);
							ltcgPrctg20Sec112 = 0;

							if (parseInt(ltcgPrctg20SecPti, 10) >= remaLTCGcomplete) {
								ltcgPrctg20SecPti = parseInt(ltcgPrctg20SecPti,
										10)
										- remaLTCGcomplete;
							} else {

								ltcgPrctg20SecPti = 0;
							}

						}
					}
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));
				}
			}
		}

		// 10. Short-term capital gain taxable @ 15%
		var stcg15PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - stcg15PercntSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')[0].value = stcg15PercntSetOffRem;
					stcg15PercntSetOffRem = 0;
					stcgPercent15Sec111a = 0;
					stcgPercent15Sec115ad_1_b_ii = 0;
					stcgPercent15SecPti = 0;

				} else {
					checkHPeditableValidity(
							'scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
									- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
									- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;

				// sec break up
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent15Sec115ad_1_b_ii, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent15Sec115ad_1_b_ii = parseInt(
							stcgPercent15Sec115ad_1_b_ii, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent15Sec115ad_1_b_ii, 10);
					stcgPercent15Sec115ad_1_b_ii = 0;
				}
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent15SecPti, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent15SecPti = parseInt(stcgPercent15SecPti, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent15SecPti, 10);
					stcgPercent15SecPti = 0;
				}

				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent15Sec111a, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent15Sec111a = parseInt(stcgPercent15Sec111a, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent15Sec111a, 10);
					stcgPercent15Sec111a = 0;
				}

			} else {
				checkHPeditableValidity(
						'scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
								- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));
			}
			setOffRem = 0;
		}

		// 11) Long term capital gain taxable @ 10%
		prevSetOffRem = setOffRem;
		var ltcg10PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
		if (ltcg10PercntSetOffRem >= 0 && setOffRem >= 0) {
			if (ltcg10PercntSetOffRem >= setOffRem) {
				var tempAk = setOffRem;
				setOffRem = setOffRem - parseInt(ltcg10PercntSetOffRem, 10);// mod
				if (setOffRem >= 0) {
					if (!checkIfChanged('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')) {
						document
								.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value = parseInt(
								ltcg10PercntSetOffRem, 10);
						ltcgPrctg10Sec112c2 = 0;
						ltcgPrctg10Sec115AC1 = 0;
						ltcgPrctg10Sec115AD3 = 0;
						ltcgPrctg10Sec115AB1B = 0;
						ltcgPrctg10SecPti = 0;
						ltcgPrctgPTI_LTCG10P112A=0;
						ltcgPrctg10SecProviso = 0;
						ltcgPrctg10Sec115ADiiiP = 0;
						ltcgPrctg10Sec112A = 0;

					} else {

						checkHPeditableValidity(
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff',
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead',
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff',
								'scheduleCYLA.totalCurYr.totHPlossCurYr',
								coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
										- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff'));

						if (parseInt(ltcgPrctg10SecProviso, 10) >= document
								.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value) {
							ltcgPrctg10SecProviso = parseInt(
									ltcgPrctg10SecProviso, 10)
									- document
											.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value;
						} else {
							var remaLTCGcomplete = document
									.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
									- parseInt(ltcgPrctg10SecProviso, 10);
							ltcgPrctg10SecProviso = 0;
							if (parseInt(ltcgPrctg10Sec112c2, 10) >= remaLTCGcomplete) {
								ltcgPrctg10Sec112c2 = parseInt(
										ltcgPrctg10Sec112c2, 10)
										- remaLTCGcomplete;
							} else {
								remaLTCGcomplete = document
										.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
										- parseInt(ltcgPrctg10Sec112c2, 10);
								ltcgPrctg10Sec112c2 = 0;

								if (parseInt(ltcgPrctg10Sec115AB1B, 10) >= remaLTCGcomplete) {
									ltcgPrctg10Sec115AB1B = parseInt(
											ltcgPrctg10Sec115AB1B, 10)
											- remaLTCGcomplete;
								} else {
									remaLTCGcomplete = document
											.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
											- parseInt(ltcgPrctg10Sec115AC1, 10);
									ltcgPrctg10Sec115AB1B = 0;

									if (parseInt(ltcgPrctg10Sec115AC1, 10) >= remaLTCGcomplete) {
										ltcgPrctg10Sec115AC1 = parseInt(
												ltcgPrctg10Sec115AC1, 10)
												- remaLTCGcomplete;
									} else {
										remaLTCGcomplete = document
												.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
												- parseInt(
														ltcgPrctg10Sec115AC1,
														10);
										ltcgPrctg10Sec115AC1 = 0;

										if (parseInt(ltcgPrctg10Sec115AD3, 10) >= remaLTCGcomplete) {
											ltcgPrctg10Sec115AD3 = parseInt(
													ltcgPrctg10Sec115AD3, 10)
													- remaLTCGcomplete;
										} else {
											remaLTCGcomplete = document
													.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
													- parseInt(
															ltcgPrctg10Sec115AD3,
															10);
											ltcgPrctg10Sec115AD3 = 0;
											if (parseInt(
													ltcgPrctg10Sec115ADiiiP, 10) >= remaLTCGcomplete) {
												ltcgPrctg10Sec115ADiiiP = parseInt(
														ltcgPrctg10Sec115ADiiiP,
														10)
														- remaLTCGcomplete;
											} else {
												remaLTCGcomplete = document
														.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
														- parseInt(
																ltcgPrctg10Sec115ADiiiP,
																10);
												ltcgPrctg10Sec115ADiiiP = 0;

												if (parseInt(ltcgPrctg10SecPti,
														10) >= remaLTCGcomplete) {
													ltcgPrctg10SecPti = parseInt(
															ltcgPrctg10SecPti,
															10)
															- remaLTCGcomplete;
												} else {
													remaLTCGcomplete = document
															.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
															- parseInt(
																	ltcgPrctg10SecPti,
																	10);
													ltcgPrctg10SecPti = 0;

													if (parseInt(
															ltcgPrctg10SecProviso,
															10) >= remaLTCGcomplete) {
														ltcgPrctg10SecProviso = parseInt(
																ltcgPrctg10SecProviso,
																10)
																- remaLTCGcomplete;
													} else {
														remaLTCGcomplete = document
																.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
																- parseInt(
																		ltcgPrctg10Sec115AC1,
																		10);
														ltcgPrctg10SecProviso = 0;
														if (parseInt(ltcgPrctgPTI_LTCG10P112A,
																10) >= remaLTCGcomplete) {
															ltcgPrctgPTI_LTCG10P112A = parseInt(
																	ltcgPrctgPTI_LTCG10P112A,
																	10)
																	- remaLTCGcomplete;
														} else {
															remaLTCGcomplete = document
																	.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
																	- parseInt(
																			ltcgPrctgPTI_LTCG10P112A,
																			10);
															ltcgPrctgPTI_LTCG10P112A = 0;
															}
														if (parseInt(
																ltcgPrctg10Sec112A,
																10) >= remaLTCGcomplete) {
															ltcgPrctg10Sec112A = parseInt(
																	ltcgPrctg10Sec112A,
																	10)
																	- remaLTCGcomplete;
														} else {
															remaLTCGcomplete = document
																	.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
																	- parseInt(
																			ltcgPrctg10Sec112A,
																			10);
															ltcgPrctg10Sec112A = 0;
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
					ltcg10PercntSetOffRem = zeroOrMore(ltcg10PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff'));
				} else {
					if (!checkIfChanged('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')) {
						document
								.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value = tempAk;
						setOffRem = 0;

						// Section break up
						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10Sec112c2, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10Sec112c2 = parseInt(ltcgPrctg10Sec112c2,
									10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10Sec112c2, 10);
							ltcgPrctg10Sec112c2 = 0;
						}
						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10Sec115AB1B, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10Sec115AB1B = parseInt(
									ltcgPrctg10Sec115AB1B, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10Sec115AB1B, 10);
							ltcgPrctg10Sec115AB1B = 0;
						}
						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10Sec115AC1, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10Sec115AC1 = parseInt(
									ltcgPrctg10Sec115AC1, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10Sec115AC1, 10);
							ltcgPrctg10Sec115AC1 = 0;
						}
						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10Sec115AD3, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10Sec115AD3 = parseInt(
									ltcgPrctg10Sec115AD3, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10Sec115AD3, 10);
							ltcgPrctg10Sec115AD3 = 0;
						}

						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10Sec115ADiiiP, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10Sec115ADiiiP = parseInt(
									ltcgPrctg10Sec115ADiiiP, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10Sec115ADiiiP, 10);
							ltcgPrctg10Sec115ADiiiP = 0;
						}

						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10SecPti, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10SecPti = parseInt(ltcgPrctg10SecPti, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10SecPti, 10);
							ltcgPrctg10SecPti = 0;
						}
						
						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10SecProviso, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10SecProviso = parseInt(
									ltcgPrctg10SecProviso, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10SecProviso, 10);
							ltcgPrctg10SecProviso = 0;
						}

						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctgPTI_LTCG10P112A, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctgPTI_LTCG10P112A = parseInt(ltcgPrctgPTI_LTCG10P112A, 10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctgPTI_LTCG10P112A, 10);
							ltcgPrctgPTI_LTCG10P112A = 0;
						}
						if (parseInt(tempAk, 10) >= 0
								&& parseInt(ltcgPrctg10Sec112A, 10) > parseInt(
										tempAk, 10)) {
							ltcgPrctg10Sec112A = parseInt(ltcgPrctg10Sec112A,
									10)
									- parseInt(tempAk, 10);
							tempAk = 0;
						} else {
							tempAk = parseInt(tempAk, 10)
									- parseInt(ltcgPrctg10Sec112A, 10);
							ltcgPrctg10Sec112A = 0;
						}

					} else {

						checkHPeditableValidity(
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff',
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead',
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff',
								'scheduleCYLA.totalCurYr.totHPlossCurYr',
								coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
										- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff'));

						if (parseInt(ltcgPrctg10SecProviso, 10) >= document
								.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value) {
							ltcgPrctg10SecProviso = parseInt(
									ltcgPrctg10SecProviso, 10)
									- document
											.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value;
						} else {
							var remaLTCGcomplete = document
									.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
									- parseInt(ltcgPrctg10SecProviso, 10);
							ltcgPrctg10SecProviso = 0;
							if (parseInt(ltcgPrctg10Sec112c2, 10) >= remaLTCGcomplete) {
								ltcgPrctg10Sec112c2 = parseInt(
										ltcgPrctg10Sec112c2, 10)
										- remaLTCGcomplete;
							} else {
								remaLTCGcomplete = document
										.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
										- parseInt(ltcgPrctg10Sec112c2, 10);
								ltcgPrctg10Sec112c2 = 0;
								if (parseInt(ltcgPrctg10Sec115AB1B, 10) >= remaLTCGcomplete) {
									ltcgPrctg10Sec115AB1B = parseInt(
											ltcgPrctg10Sec115AB1B, 10)
											- remaLTCGcomplete;
								} else {
									remaLTCGcomplete = document
											.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
											- parseInt(ltcgPrctg10Sec115AC1, 10);
									ltcgPrctg10Sec115AB1B = 0;

									if (parseInt(ltcgPrctg10Sec115AC1, 10) >= remaLTCGcomplete) {
										ltcgPrctg10Sec115AC1 = parseInt(
												ltcgPrctg10Sec115AC1, 10)
												- remaLTCGcomplete;
									} else {
										remaLTCGcomplete = document
												.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
												- parseInt(
														ltcgPrctg10Sec115AC1,
														10);
										ltcgPrctg10Sec115AC1 = 0;

										if (parseInt(ltcgPrctg10Sec115AD3, 10) >= remaLTCGcomplete) {
											ltcgPrctg10Sec115AD3 = parseInt(
													ltcgPrctg10Sec115AD3, 10)
													- remaLTCGcomplete;
										} else {
											remaLTCGcomplete = document
													.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
													- parseInt(
															ltcgPrctg10Sec115AD3,
															10);
											ltcgPrctg10Sec115AD3 = 0;
											if (parseInt(
													ltcgPrctg10Sec115ADiiiP, 10) >= remaLTCGcomplete) {
												ltcgPrctg10Sec115ADiiiP = parseInt(
														ltcgPrctg10Sec115ADiiiP,
														10)
														- remaLTCGcomplete;
											} else {
												remaLTCGcomplete = document
														.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
														- parseInt(
																ltcgPrctg10Sec115ADiiiP,
																10);
												ltcgPrctg10Sec115ADiiiP = 0;

												if (parseInt(ltcgPrctg10SecPti,
														10) >= remaLTCGcomplete) {
													ltcgPrctg10SecPti = parseInt(
															ltcgPrctg10SecPti,
															10)
															- remaLTCGcomplete;
												} else {
													remaLTCGcomplete = document
															.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
															- parseInt(
																	ltcgPrctg10SecPti,
																	10);
													ltcgPrctg10SecPti = 0;

													if (parseInt(
															ltcgPrctg10SecProviso,
															10) >= remaLTCGcomplete) {
														ltcgPrctg10SecProviso = parseInt(
																ltcgPrctg10SecProviso,
																10)
																- remaLTCGcomplete;
													} else {
														remaLTCGcomplete = document
																.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
																- parseInt(
																		ltcgPrctg10Sec115AD3,
																		10);
														ltcgPrctg10SecProviso = 0;
														
														if (parseInt(ltcgPrctgPTI_LTCG10P112A,
																10) >= remaLTCGcomplete) {
															ltcgPrctgPTI_LTCG10P112A = parseInt(
																	ltcgPrctgPTI_LTCG10P112A,
																	10)
																	- remaLTCGcomplete;
														} else {
															remaLTCGcomplete = document
																	.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
																	- parseInt(
																			ltcgPrctgPTI_LTCG10P112A,
																			10);
															ltcgPrctgPTI_LTCG10P112A = 0;
														}
														if (parseInt(
																ltcgPrctg10Sec112A,
																10) >= remaLTCGcomplete) {
															ltcgPrctg10Sec112A = parseInt(
																	ltcgPrctg10Sec112A,
																	10)
																	- remaLTCGcomplete;
														} else {
															remaLTCGcomplete = document
																	.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
																	- parseInt(
																			ltcgPrctg10Sec112A,
																			10);
															ltcgPrctg10Sec112A = 0;
														}
													}
												}

											}
										}
									}
								}
							}
						}
					}
					ltcg10PercntSetOffRem = zeroOrMore(ltcg10PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff'));
				}
			} else {

				if (ltcg10PercntSetOffRem >= 0) {
					if (!checkIfChanged('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')) {
						document
								.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value = parseInt(
								ltcg10PercntSetOffRem, 10);
						ltcg10PercntSetOffRem = 0;
						ltcgPrctg10Sec112c2 = 0;
						ltcgPrctg10Sec115AB1B = 0;
						ltcgPrctg10Sec115AC1 = 0;
						ltcgPrctg10Sec115AD3 = 0;
						ltcgPrctg10SecPti = 0;
						ltcgPrctgPTI_LTCG10P112A = 0;
						ltcgPrctg10SecProviso = 0;
						ltcgPrctg10Sec115ADiiiP = 0;
						ltcgPrctg10Sec112A = 0;

					} else {

						checkHPeditableValidity(
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff',
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead',
								'scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff',
								'scheduleCYLA.totalCurYr.totHPlossCurYr',
								coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
										- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
										- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff'));

						if (parseInt(ltcgPrctg10SecProviso, 10) >= document
								.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value) {
							ltcgPrctg10SecProviso = parseInt(
									ltcgPrctg10SecProviso, 10)
									- document
											.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value;
						} else {
							var remaLTCGcomplete = document
									.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
									- parseInt(ltcgPrctg10SecProviso, 10);
							ltcgPrctg10SecProviso = 0;
							if (parseInt(ltcgPrctg10Sec112c2, 10) >= remaLTCGcomplete) {
								ltcgPrctg10Sec112c2 = parseInt(
										ltcgPrctg10Sec112c2, 10)
										- remaLTCGcomplete;
							} else {
								remaLTCGcomplete = document
										.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
										- parseInt(ltcgPrctg10Sec112c2, 10);
								ltcgPrctg10Sec112c2 = 0;
								if (parseInt(ltcgPrctg10Sec115AB1B, 10) >= remaLTCGcomplete) {
									ltcgPrctg10Sec115AB1B = parseInt(
											ltcgPrctg10Sec115AB1B, 10)
											- remaLTCGcomplete;
								} else {
									remaLTCGcomplete = document
											.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
											- parseInt(ltcgPrctg10Sec115AC1, 10);
									ltcgPrctg10Sec115AB1B = 0;
									if (parseInt(ltcgPrctg10Sec115AC1, 10) >= remaLTCGcomplete) {
										ltcgPrctg10Sec115AC1 = parseInt(
												ltcgPrctg10Sec115AC1, 10)
												- remaLTCGcomplete;
									} else {
										remaLTCGcomplete = document
												.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
												- parseInt(
														ltcgPrctg10Sec115AC1,
														10);
										ltcgPrctg10Sec115AC1 = 0;

										if (parseInt(ltcgPrctg10Sec115AD3, 10) >= remaLTCGcomplete) {
											ltcgPrctg10Sec115AD3 = parseInt(
													ltcgPrctg10Sec115AD3, 10)
													- remaLTCGcomplete;
										} else {
											remaLTCGcomplete = document
													.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
													- parseInt(
															ltcgPrctg10Sec115AD3,
															10);
											ltcgPrctg10Sec115AD3 = 0;
											if (parseInt(
													ltcgPrctg10Sec115ADiiiP, 10) >= remaLTCGcomplete) {
												ltcgPrctg10Sec115ADiiiP = parseInt(
														ltcgPrctg10Sec115ADiiiP,
														10)
														- remaLTCGcomplete;
											} else {
												remaLTCGcomplete = document
														.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
														- parseInt(
																ltcgPrctg10Sec115ADiiiP,
																10);
												ltcgPrctg10Sec115ADiiiP = 0;

												if (parseInt(ltcgPrctg10SecPti,
														10) >= remaLTCGcomplete) {
													ltcgPrctg10SecPti = parseInt(
															ltcgPrctg10SecPti,
															10)
															- remaLTCGcomplete;
												} else {
													remaLTCGcomplete = document
															.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
															- parseInt(
																	ltcgPrctg10SecPti,
																	10);
													ltcgPrctg10SecPti = 0;

													if (parseInt(
															ltcgPrctg10SecProviso,
															10) >= remaLTCGcomplete) {
														ltcgPrctg10SecProviso = parseInt(
																ltcgPrctg10SecProviso,
																10)
																- remaLTCGcomplete;
													} else {
														remaLTCGcomplete = document
																.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')[0].value
																- parseInt(
																		ltcgPrctg10Sec115AD3,
																		10);
														ltcgPrctg10SecProviso = 0;
														if (parseInt(ltcgPrctgPTI_LTCG10P112A,
																10) >= remaLTCGcomplete) {
															ltcgPrctgPTI_LTCG10P112A = parseInt(
																	ltcgPrctgPTI_LTCG10P112A,
																	10)
																	- remaLTCGcomplete;
														} else {
															remaLTCGcomplete = document
																	.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
																	- parseInt(
																			ltcgPrctgPTI_LTCG10P112A,
																			10);
															ltcgPrctgPTI_LTCG10P112A = 0;
														}
														if (parseInt(
																ltcgPrctg10Sec112A,
																10) >= remaLTCGcomplete) {
															ltcgPrctg10Sec112A = parseInt(
																	ltcgPrctg10Sec112A,
																	10)
																	- remaLTCGcomplete;
														} else {
															remaLTCGcomplete = document
																	.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value
																	- parseInt(
																			ltcgPrctg10Sec112A,
																			10);
															ltcgPrctg10Sec112A = 0;
														}
													}
												}
											}

										}
									}
								}
							}
						}
					}
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff'));
				}
			}
		}
		// 10) Short-term capital gain taxable at DTAA rates

		var stcgDtaaRateSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - stcgDtaaRateSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = stcgDtaaRateSetOffRem;
				} else {
					checkHPeditableValidity(
							'scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
									- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
									// -
									// coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			} else {
				checkHPeditableValidity(
						'scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
								- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
								// -
								// coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff'));
			}
			setOffRem = 0;
		}

		// 11) Long-term capital gain taxable at DTAA rates

		var ltcgDtaaRateSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - ltcgDtaaRateSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = 0;
			} else {
				if (!checkIfChanged('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')) {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = ltcgDtaaRateSetOffRem;
				} else {
					checkHPeditableValidity(
							'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff',
							'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
							'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
							'scheduleCYLA.totalCurYr.totHPlossCurYr',
							coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')

									- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')
									- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff'));

					setOffRem = parseInt(prevSetOffRem, 10)
							- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff');
				}
			}
		} else {
			if (!checkIfChanged('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')) {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')[0].value = prevSetOffRem;
			} else {
				checkHPeditableValidity(
						'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff',
						'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.totalCurYr.totHPlossCurYr',
						coalescePath('scheduleCYLA.totalCurYr.totHPlossCurYr')
								- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff'));
			}
			setOffRem = 0;
		}

		cgosIncome.cgInc.stcg.prctg15.sec111a = stcgPercent15Sec111a;
		cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii = stcgPercent15Sec115ad_1_b_ii;
		cgosIncome.cgInc.stcg.prctg15.secPti = stcgPercent15SecPti;
		cgosIncome.cgInc.stcg.prctg30.sec115AD = stcgPercent30Sec115AD;
		cgosIncome.cgInc.ltcg.prctg20.sec112 = ltcgPrctg20Sec112;
		cgosIncome.cgInc.stcg.prctg30.secPti = stcgPercent30SecPti;
		cgosIncome.cgInc.stcg.prctgAr.stcgApp = stcgPercentArSecStcgApp;
		cgosIncome.cgInc.stcg.prctgAr.secPti = stcgPercentArSecPti;
		cgosIncome.cgInc.ltcg.prctg20.secPti = ltcgPrctg20SecPti;
		cgosIncome.cgInc.ltcg.prctg10.secProviso = ltcgPrctg10SecProviso;
		cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2 = ltcgPrctg10Sec112c2;
		cgosIncome.cgInc.ltcg.prctg10.sec115AC_1 = ltcgPrctg10Sec115AC1;
		cgosIncome.cgInc.ltcg.prctg10.sec115AD_3 = ltcgPrctg10Sec115AD3;
		cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B = ltcgPrctg10Sec115AB1B;
		cgosIncome.cgInc.ltcg.prctg10.secPti = ltcgPrctg10SecPti;
		cgosIncome.cgInc.ltcg.prctg10.secPti112A = ltcgPrctgPTI_LTCG10P112A;
		cgosIncome.cgInc.ltcg.prctg10.sec112A = ltcgPrctg10Sec112A;
		cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP = ltcgPrctg10Sec115ADiiiP;
		setOffBussLossCYLA(cgosIncome);

	} catch (e) {
		alert('error in setOffHPLossCYLA = ' + e.stack);
	}
}

function setOffBussLossCYLA(cgosIncome) {
	try {
		var stcgPercent15Sec111a = cgosIncome.cgInc.stcg.prctg15.sec111a;
		var stcgPercent15Sec115ad_1_b_ii = cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii;
		var stcgPercent30Sec115AD = zeroOrMore(cgosIncome.cgInc.stcg.prctg30.sec115AD);
		var stcgPercent30SecPti = zeroOrMore(cgosIncome.cgInc.stcg.prctg30.secPti);
		var stcgPercent15SecPti = cgosIncome.cgInc.stcg.prctg15.secPti;
		var stcgPercentArSecStcgApp = zeroOrMore(cgosIncome.cgInc.stcg.prctgAr.stcgApp);
		var stcgPercentArSecPti = zeroOrMore(cgosIncome.cgInc.stcg.prctgAr.secPti);
		var ltcgPrctg20Sec112 = zeroOrMore(cgosIncome.cgInc.ltcg.prctg20.sec112);
		var ltcgPrctg20SecPti = cgosIncome.cgInc.ltcg.prctg20.secPti;
		var ltcgPrctg10SecProviso = cgosIncome.cgInc.ltcg.prctg10.secProviso;
		var ltcgPrctg10Sec112c2 = cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2;
		var ltcgPrctg10Sec115AC1 = cgosIncome.cgInc.ltcg.prctg10.sec115AC_1;
		var ltcgPrctg10Sec115AD3 = cgosIncome.cgInc.ltcg.prctg10.sec115AD_3;
		var ltcgPrctg10Sec115AB1B = cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B;
		var ltcgPrctg10SecPti = cgosIncome.cgInc.ltcg.prctg10.secPti;
		var ltcgPrctgPTI_LTCG10P112A =cgosIncome.cgInc.ltcg.prctg10.secPti112A;
		var ltcgPrctg10Sec115ADiiiP = cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP;
		var ltcgPrctg10Sec112A = cgosIncome.cgInc.ltcg.prctg10.sec112A;

		document
				.getElementsByName('scheduleCYLA.houseProperty.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.busLossSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.busLossSetoff')[0].value = 0;

		/*
		 * Order of adjustment :- 1) HP Income 2) Other sources 3) Profit from
		 * owning and maintaining race horses 4) Short-term capital gain taxable @
		 * 30% 5) Short-term capital gain taxable at applicable rates 6) Long
		 * term capital gain taxable @ 20%
		 * (1.cgosIncome.cgInc.ltcg.prctg20.sec112,
		 * 2.cgosIncome.cgInc.ltcg.prctg20.sec11EA) 7) Short-term capital gain
		 * taxable @ 15% 8) Long term capital gain taxable @ 10% (1.
		 * cgosIncome.cgInc.ltcg.prctg10.secProviso, 2.
		 * cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2, 3.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115AC_1, 4.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115ACA_1, 5.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115AD_3, 6.
		 * cgosIncome.cgInc.ltcg.prctg10.sec115E_b)
		 */

		// 1. HP Income
		var hpSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff'));
		var prevSetOffRem = coalescePath('scheduleCYLA.totalCurYr.totBusLoss');
		var setOffRem = prevSetOffRem - hpSetOffRem;

		if (setOffRem >= 0) {
			if (coalescePath('scheduleCYLA.totalCurYr.totBusLoss') == 0) {
				document
						.getElementsByName('scheduleCYLA.houseProperty.incCYLA.busLossSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.houseProperty.incCYLA.busLossSetoff')[0].value = hpSetOffRem;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.houseProperty.incCYLA.busLossSetoff')[0].value = coalescePath('scheduleCYLA.totalCurYr.totBusLoss');
			setOffRem = 0;
		}

		// 2. Other sources

		var osIncSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff'));
		prevSetOffRem = setOffRem;
		setOffRem = prevSetOffRem - osIncSetOffRem;

		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')[0].value = osIncSetOffRem;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 3) Profit from owning and maintaining race horse

		var raceHrsSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - raceHrsSetOffRem;
		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')[0].value = raceHrsSetOffRem;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 4) OS DTAA

		var oSDTAA = zeroOrMore(coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - oSDTAA;
		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.busLossSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.busLossSetoff')[0].value = oSDTAA;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.busLossSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 4) Short-term capital gain taxable @ 30%
		prevSetOffRem = setOffRem;
		var stcg30PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.hPlossCurYrSetoff'));
		if (stcg30PercntSetOffRem >= 0 && setOffRem >= 0) {
			if (stcg30PercntSetOffRem >= setOffRem) {
				var tempAk = setOffRem;
				setOffRem = setOffRem - parseInt(stcg30PercntSetOffRem, 10);

				if (setOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff')[0].value = parseInt(
							stcg30PercntSetOffRem, 10);
					stcgPercent30Sec115AD = 0;
					stcgPercent30SecPti = 0;

					stcg30PercntSetOffRem = zeroOrMore(stcg30PercntSetOffRem
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff'));
				} else {
					document
							.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff')[0].value = tempAk;
					setOffRem = 0;
					// sec break up

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(stcgPercent30Sec115AD, 10) > parseInt(
									tempAk, 10)) {
						stcgPercent30Sec115AD = parseInt(stcgPercent30Sec115AD,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(stcgPercent30Sec115AD, 10);
						stcgPercent30Sec115AD = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(stcgPercent30SecPti, 10) > parseInt(
									tempAk, 10)) {
						stcgPercent30SecPti = parseInt(stcgPercent30SecPti, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(stcgPercent30SecPti, 10);
						stcgPercent30SecPti = 0;
					}

					stcg30PercntSetOffRem = zeroOrMore(stcg30PercntSetOffRem
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff'));
				}
			} else {
				var prevLtcgSetOffRem = stcg30PercntSetOffRem;

				if (stcg30PercntSetOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff')[0].value = parseInt(
							stcg30PercntSetOffRem, 10);
					stcg30PercntSetOffRem = 0;
					stcgPercent30SecPti = 0;
					stcgPercent30Sec115AD = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff'));
				} else {
					document
							.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff')[0].value = prevLtcgSetOffRem;
					stcg30PercntSetOffRem = 0;
					stcgPercent30SecPti = 0;
					stcgPercent30Sec115AD = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.busLossSetoff'));
				}
			}
		}
		// 5) Short-term capital gain taxable at applicable rates

		prevSetOffRem = setOffRem;
		var stcgAppRatecntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
				- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff'));
		if (stcgAppRatecntSetOffRem >= 0 && setOffRem >= 0) {
			if (stcgAppRatecntSetOffRem >= setOffRem) {
				var tempAk = setOffRem;
				setOffRem = setOffRem - parseInt(stcgAppRatecntSetOffRem, 10);

				if (setOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value = parseInt(
							stcgAppRatecntSetOffRem, 10);
					var stcgPercentArSecStcgApp = 0;
					var stcgPercentArSecPti = 0;

					stcgAppRatecntSetOffRem = zeroOrMore(stcgAppRatecntSetOffRem
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff'));
				} else {
					document
							.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value = tempAk;
					setOffRem = 0;
					// sec break up

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(stcgPercentArSecStcgApp, 10) > parseInt(
									tempAk, 10)) {
						stcgPercentArSecStcgApp = parseInt(
								stcgPercentArSecStcgApp, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(stcgPercentArSecStcgApp, 10);
						stcgPercentArSecStcgApp = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(stcgPercentArSecPti, 10) > parseInt(
									tempAk, 10)) {
						stcgPercentArSecPti = parseInt(stcgPercentArSecPti, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(stcgPercentArSecPti, 10);
						stcgPercentArSecPti = 0;
					}

					stcgAppRatecntSetOffRem = zeroOrMore(stcgAppRatecntSetOffRem
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff'));
				}
			} else {
				var prevLtcgSetOffRem = stcgAppRatecntSetOffRem;

				if (stcgAppRatecntSetOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value = parseInt(
							stcgAppRatecntSetOffRem, 10);
					stcgAppRatecntSetOffRem = 0;
					stcgPercentArSecStcgApp = 0;
					stcgPercentArSecPti = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff'));
				} else {
					document
							.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value = prevLtcgSetOffRem;
					stcgAppRatecntSetOffRem = 0;
					stcgPercentArSecStcgApp = 0;
					stcgPercentArSecPti = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff'));
				}
			}
		}

		/*
		 * var stcgAppRateSetOffRem =
		 * zeroOrMore(coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead')-
		 * coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')-
		 * coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.hPlossCurYrSetoff'));
		 * 
		 * prevSetOffRem = setOffRem; setOffRem = setOffRem -
		 * stcgAppRateSetOffRem; if(setOffRem>=0){ if(prevSetOffRem==0){
		 * document.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value =
		 * 0; }else{
		 * document.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value =
		 * stcgAppRateSetOffRem; } }else{
		 * document.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.busLossSetoff')[0].value =
		 * prevSetOffRem; setOffRem =0 ; }
		 */

		// 6) Long term capital gain taxable @ 20%
		prevSetOffRem = setOffRem;
		var ltcg20PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.hPlossCurYrSetoff'));
		if (ltcg20PercntSetOffRem >= 0 && setOffRem >= 0) {
			if (ltcg20PercntSetOffRem >= setOffRem) {
				var tempAk = setOffRem;
				setOffRem = setOffRem - parseInt(ltcg20PercntSetOffRem, 10);

				if (setOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff')[0].value = parseInt(
							ltcg20PercntSetOffRem, 10);
					ltcgPrctg20Sec112 = 0;
					ltcgPrctg20SecPti = 0;

					ltcg20PercntSetOffRem = zeroOrMore(ltcg20PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff'));
				} else {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff')[0].value = tempAk;
					setOffRem = 0;
					// sec break up

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg20SecPti, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg20SecPti = parseInt(ltcgPrctg20SecPti, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg20SecPti, 10);
						ltcgPrctg20SecPti = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg20Sec112, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg20Sec112 = parseInt(ltcgPrctg20Sec112, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg20Sec112, 10);
						ltcgPrctg20Sec112 = 0;
					}

					ltcg20PercntSetOffRem = zeroOrMore(ltcg20PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff'));
				}
			} else {
				var prevLtcgSetOffRem = ltcg20PercntSetOffRem;

				if (ltcg20PercntSetOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff')[0].value = parseInt(
							ltcg20PercntSetOffRem, 10);
					ltcg20PercntSetOffRem = 0;
					ltcgPrctg20Sec112 = 0;
					ltcgPrctg20SecPti = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff'));
				} else {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff')[0].value = prevLtcgSetOffRem;
					ltcg20PercntSetOffRem = 0;
					ltcgPrctg20Sec112 = 0;
					ltcgPrctg20SecPti = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.busLossSetoff'));
				}
			}
		}

		// 7) Short-term capital gain taxable @ 15%
		var stcg15PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.hPlossCurYrSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - stcg15PercntSetOffRem;
		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.busLossSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.busLossSetoff')[0].value = stcg15PercntSetOffRem;
				stcg15PercntSetOffRem = 0;
				stcgPercent15Sec111a = 0;
				stcgPercent15Sec115ad_1_b_ii = 0;
				stcgPercent15SecPti = 0;

			}
		} else {
			document
					.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.busLossSetoff')[0].value = prevSetOffRem;

			// sec break up
			if (parseInt(prevSetOffRem, 10) >= 0
					&& parseInt(stcgPercent15Sec115ad_1_b_ii, 10) > parseInt(
							prevSetOffRem, 10)) {
				stcgPercent15Sec115ad_1_b_ii = parseInt(
						stcgPercent15Sec115ad_1_b_ii, 10)
						- parseInt(prevSetOffRem, 10);
				prevSetOffRem = 0;
			} else {
				prevSetOffRem = parseInt(prevSetOffRem, 10)
						- parseInt(stcgPercent15Sec115ad_1_b_ii, 10);
				stcgPercent15Sec115ad_1_b_ii = 0;
			}
			if (parseInt(prevSetOffRem, 10) >= 0
					&& parseInt(stcgPercent15SecPti, 10) > parseInt(
							prevSetOffRem, 10)) {
				stcgPercent15SecPti = parseInt(stcgPercent15SecPti, 10)
						- parseInt(prevSetOffRem, 10);
				prevSetOffRem = 0;
			} else {
				prevSetOffRem = parseInt(prevSetOffRem, 10)
						- parseInt(stcgPercent15SecPti, 10);
				stcgPercent15SecPti = 0;
			}

			if (parseInt(prevSetOffRem, 10) >= 0
					&& parseInt(stcgPercent15Sec111a, 10) > parseInt(
							prevSetOffRem, 10)) {
				stcgPercent15Sec111a = parseInt(stcgPercent15Sec111a, 10)
						- parseInt(prevSetOffRem, 10);
				prevSetOffRem = 0;
			} else {
				prevSetOffRem = parseInt(prevSetOffRem, 10)
						- parseInt(stcgPercent15Sec111a, 10);
				stcgPercent15Sec111a = 0;
			}

			setOffRem = 0;
		}

		// 8) Long term capital gain taxable @ 10%
		prevSetOffRem = setOffRem;
		var ltcg10PercntSetOffRem = zeroOrMore(coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.hPlossCurYrSetoff'));

		if (ltcg10PercntSetOffRem >= 0 && setOffRem >= 0) {
			if (ltcg10PercntSetOffRem >= setOffRem) {
				var tempAk = setOffRem;
				setOffRem = setOffRem - parseInt(ltcg10PercntSetOffRem, 10);

				if (setOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff')[0].value = parseInt(
							ltcg10PercntSetOffRem, 10);
					ltcgPrctg10Sec112c2 = 0;
					ltcgPrctg10Sec115AC1 = 0;
					ltcgPrctg10Sec115AD3 = 0;
					ltcgPrctg10Sec115AB1B = 0;
					ltcgPrctg10SecProviso = 0;
					ltcgPrctg10SecPti = 0;
					ltcgPrctgPTI_LTCG10P112A = 0;
					ltcgPrctg10Sec115ADiiiP = 0;
					ltcgPrctg10Sec112A = 0;

					ltcg10PercntSetOffRem = zeroOrMore(ltcg10PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff'));
				} else {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff')[0].value = tempAk;
					setOffRem = 0;

					// Section break up
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec112c2, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec112c2 = parseInt(ltcgPrctg10Sec112c2, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec112c2, 10);
						ltcgPrctg10Sec112c2 = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115AB1B, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115AB1B = parseInt(ltcgPrctg10Sec115AB1B,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115AB1B, 10);
						ltcgPrctg10Sec115AB1B = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115AC1, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115AC1 = parseInt(ltcgPrctg10Sec115AC1,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115AC1, 10);
						ltcgPrctg10Sec115AC1 = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115AD3, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115AD3 = parseInt(ltcgPrctg10Sec115AD3,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115AD3, 10);
						ltcgPrctg10Sec115AD3 = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115ADiiiP, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115ADiiiP = parseInt(
								ltcgPrctg10Sec115ADiiiP, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115ADiiiP, 10);
						ltcgPrctg10Sec115ADiiiP = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10SecPti, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10SecPti = parseInt(ltcgPrctg10SecPti, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10SecPti, 10);
						ltcgPrctg10SecPti = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10SecProviso, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10SecProviso = parseInt(ltcgPrctg10SecProviso,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10SecProviso, 10);
						ltcgPrctg10SecProviso = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctgPTI_LTCG10P112A, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctgPTI_LTCG10P112A = parseInt(ltcgPrctgPTI_LTCG10P112A, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctgPTI_LTCG10P112A, 10);
						ltcgPrctgPTI_LTCG10P112A = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec112A, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec112A = parseInt(ltcgPrctg10Sec112A, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec112A, 10);
						ltcgPrctg10Sec112A = 0;
					}

					ltcg10PercntSetOffRem = zeroOrMore(ltcg10PercntSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff'));
				}
			} else {
				var prevLtcgSetOffRem = ltcg10PercntSetOffRem;

				if (ltcg10PercntSetOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff')[0].value = parseInt(
							ltcg10PercntSetOffRem, 10);
					ltcg10PercntSetOffRem = 0;
					ltcgPrctg10Sec112c2 = 0;
					ltcgPrctg10Sec115AC1 = 0;
					ltcgPrctg10Sec115AD3 = 0;
					ltcgPrctg10Sec115AB1B = 0;
					ltcgPrctg10SecProviso = 0;
					ltcgPrctg10SecPti = 0;
					ltcgPrctgPTI_LTCG10P112A = 0;
					ltcgPrctg10Sec115ADiiiP = 0;
					ltcgPrctg10Sec112A = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.busLossSetoff'));
				}
			}
		}
		// 4) STCG DTAA
		var stcgDTAA = zeroOrMore(coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - stcgDTAA;
		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.busLossSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.busLossSetoff')[0].value = stcgDTAA;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.busLossSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 4) LTCG DTAA
		var ltcgDTAA = zeroOrMore(coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.hPlossCurYrSetoff')
				- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff'));

		prevSetOffRem = setOffRem;
		setOffRem = setOffRem - ltcgDTAA;
		if (setOffRem >= 0) {
			if (prevSetOffRem == 0) {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.busLossSetoff')[0].value = 0;
			} else {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.busLossSetoff')[0].value = ltcgDTAA;
			}
		} else {
			document
					.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.busLossSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		cgosIncome.cgInc.stcg.prctg15.sec111a = stcgPercent15Sec111a;
		cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii = stcgPercent15Sec115ad_1_b_ii;
		cgosIncome.cgInc.stcg.prctg15.secPti = stcgPercent15SecPti;
		cgosIncome.cgInc.stcg.prctg30.sec115AD = stcgPercent30Sec115AD;
		cgosIncome.cgInc.stcg.prctg30.secPti = stcgPercent30SecPti;
		cgosIncome.cgInc.stcg.prctgAr.stcgApp = stcgPercentArSecStcgApp;
		cgosIncome.cgInc.stcg.prctgAr.secPti = stcgPercentArSecPti;
		cgosIncome.cgInc.ltcg.prctg20.secPti = ltcgPrctg20SecPti;
		cgosIncome.cgInc.ltcg.prctg10.secProviso = ltcgPrctg10SecProviso;
		cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2 = ltcgPrctg10Sec112c2;
		cgosIncome.cgInc.ltcg.prctg10.sec115AC_1 = ltcgPrctg10Sec115AC1;
		cgosIncome.cgInc.ltcg.prctg10.sec115AD_3 = ltcgPrctg10Sec115AD3;
		cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B = ltcgPrctg10Sec115AB1B;
		cgosIncome.cgInc.ltcg.prctg10.secPti = ltcgPrctg10SecPti;
		cgosIncome.cgInc.ltcg.prctg10.sec112A = ltcgPrctg10Sec112A;
		cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP = ltcgPrctg10Sec115ADiiiP;
		cgosIncome.cgInc.ltcg.prctg20.sec112 = ltcgPrctg20Sec112;
		cgosIncome.cgInc.ltcg.prctg10.secPti112A = ltcgPrctgPTI_LTCG10P112A;

	} catch (e) {
		alert('error in  setOffBussLossCYLA() = ' + e.stack);
	}
}

function setOffOthSrcLossCYLA(cgosIncome) {
	try {
		var stcgPercent15Sec111a = zeroOrMore(cgosIncome.cgInc.stcg.prctg15.sec111a);
		var stcgPercent15Sec115ad_1_b_ii = zeroOrMore(cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii);
		var stcgPercent15SecPti = zeroOrMore(cgosIncome.cgInc.stcg.prctg15.secPti);
		var stcgPercent30Sec115AD = zeroOrMore(cgosIncome.cgInc.stcg.prctg30.sec115AD);
		var stcgPercent30SecPti = zeroOrMore(cgosIncome.cgInc.stcg.prctg30.secPti);
		var stcgPercentArSecStcgApp = zeroOrMore(cgosIncome.cgInc.stcg.prctgAr.stcgApp);
		var stcgPercentArSecPti = zeroOrMore(cgosIncome.cgInc.stcg.prctgAr.secPti);
		var ltcgPrctg20Sec112 = zeroOrMore(cgosIncome.cgInc.ltcg.prctg20.sec112);
		var ltcgPrctg20SecPti = zeroOrMore(cgosIncome.cgInc.ltcg.prctg20.secPti);
		var ltcgPrctg10SecProviso = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.secProviso);
		var ltcgPrctg10Sec112A = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec112A);
		var ltcgPrctg10Sec115ADiiiP = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP);
		var ltcgPrctg10Sec112c2 = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2);
		var ltcgPrctg10Sec115AC1 = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec115AC_1);
		var ltcgPrctg10Sec115AD3 = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec115AD_3);
		var ltcgPrctg10Sec115AB1B = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B);
		var ltcgPrctg10Sec112A = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec112A);
		var ltcgPrctg10Sec115ADiiiP = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP);
		var ltcgPrctg10SecPti = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.secPti);
		var ltcgPrctgPTI_LTCG10P112A = zeroOrMore(cgosIncome.cgInc.ltcg.prctg10.secPti112A);
		document
				.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;

		if (!checkIfChanged('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'));

		}
		if (!checkIfChanged('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));

		}

		document
				.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		document
				.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;

		if (!checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
		}
		if (!checkIfChanged('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
		}

		if (!checkIfChanged('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
			document
					.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = 0;
		} else {
			checkFirstLessThanMinOthTwo(
					'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
					'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
					'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
					coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
							- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')
							- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff'));
		}

		var setOffRem = coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
				- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead');

		// 1. Race Horse
		if (parseInt(setOffRem, 10) >= 0) {
			document
					.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead');

		} else {
			document
					.getElementsByName('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse');
			setOffRem = 0;
		}

		// os Dtaa

		var prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead');
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff');

			}

		} else {
			if (!checkIfChanged('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'));
			}
			setOffRem = 0;
		}

		// 2.House property
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead');
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff'));

			}
			setOffRem = 0;
		}

		// 3. Business Income
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead');
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'));

			}
			setOffRem = 0;
		}

		// 4. Speculative Income
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			document
					.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead');
		} else {

			document
					.getElementsByName('scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 5. specified Income
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			document
					.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead');
		} else {

			document
					.getElementsByName('scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 3. Profit & gain Us 115B
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			document
					.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrUnderThatHead');
		} else {

			document
					.getElementsByName('scheduleCYLA.profitgainsInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			setOffRem = 0;
		}

		// 8.Short-term capital gain taxable @ 30%
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead');
				stcgPercent30Sec115AD = 0;
				stcgPercent30SecPti = 0;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;

				// sec break up
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent30Sec115AD, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent30Sec115AD = parseInt(stcgPercent30Sec115AD, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent30Sec115AD, 10);
					stcgPercent30Sec115AD = 0;
				}

				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent30SecPti, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent30SecPti = parseInt(stcgPercent30SecPti, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent30SecPti, 10);
					stcgPercent30SecPti = 0;
				}

			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff'));
			}
			setOffRem = 0;
		}

		// 8.Short-term capital gain taxable @ AR%
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead');
				stcgPercentArSecStcgApp = 0;
				stcgPercentArSecPti = 0;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;

				// sec break up
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercentArSecStcgApp, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercentArSecStcgApp = parseInt(stcgPercentArSecStcgApp,
							10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercentArSecStcgApp, 10);
					stcgPercentArSecStcgApp = 0;
				}

				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercentArSecPti, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercentArSecPti = parseInt(stcgPercentArSecPti, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercentArSecPti, 10);
					stcgPercentArSecPti = 0;
				}

			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
			}
			setOffRem = 0;
		}

		// 9)Long term capital gain taxable @ 20%
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead');
				ltcgPrctg20Sec112 = 0;
				ltcgPrctg20SecPti = 0;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;

				// sec break up
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(ltcgPrctg20SecPti, 10) > parseInt(
								prevSetOffRem, 10)) {
					ltcgPrctg20SecPti = parseInt(ltcgPrctg20SecPti, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(ltcgPrctg20SecPti, 10);
					ltcgPrctg20SecPti = 0;
				}
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(ltcgPrctg20Sec112, 10) > parseInt(
								prevSetOffRem, 10)) {
					ltcgPrctg20Sec112 = parseInt(ltcgPrctg20Sec112, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(ltcgPrctg20Sec112, 10);
					ltcgPrctg20Sec112 = 0;
				}

			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff'));

			}
			setOffRem = 0;
		}

		// 9.Short-term capital gain taxable @ 15%
		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead');
				stcgPercent15Sec111a = 0;
				stcgPercent15Sec115ad_1_b_ii = 0;
				stcgPercent15SecPti = 0;

			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;

				// sec break up
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent15Sec115ad_1_b_ii, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent15Sec115ad_1_b_ii = parseInt(
							stcgPercent15Sec115ad_1_b_ii, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent15Sec115ad_1_b_ii, 10);
					stcgPercent15Sec115ad_1_b_ii = 0;
				}
				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent15SecPti, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent15SecPti = parseInt(stcgPercent15SecPti, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent15SecPti, 10);
					stcgPercent15SecPti = 0;
				}

				if (parseInt(prevSetOffRem, 10) >= 0
						&& parseInt(stcgPercent15Sec111a, 10) > parseInt(
								prevSetOffRem, 10)) {
					stcgPercent15Sec111a = parseInt(stcgPercent15Sec111a, 10)
							- parseInt(prevSetOffRem, 10);
					prevSetOffRem = 0;
				} else {
					prevSetOffRem = parseInt(prevSetOffRem, 10)
							- parseInt(stcgPercent15Sec111a, 10);
					stcgPercent15Sec111a = 0;
				}

			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
			}
			setOffRem = 0;
		}

		// 11)Long term capital gain taxable @ 10%
		prevSetOffRem = setOffRem;
		var ltcgSetOffRem = coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrUnderThatHead');
		if (ltcgSetOffRem >= 0 && setOffRem >= 0) {
			if (ltcgSetOffRem >= setOffRem) {
				var tempAk = setOffRem;
				setOffRem = setOffRem - parseInt(ltcgSetOffRem, 10);

				if (setOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = parseInt(
							ltcgSetOffRem, 10);
					ltcgPrctg10Sec112c2 = 0;
					ltcgPrctg10Sec115AC1 = 0;
					ltcgPrctg10Sec112A = 0;
					ltcgPrctg10Sec115ADiiiP = 0;
					ltcgPrctg10Sec115AD3 = 0;
					ltcgPrctg10Sec115AB1B = 0;
					ltcgPrctg10SecPti = 0;
					ltcgPrctgPTI_LTCG10P112A =0 ;
					ltcgPrctg10SecProviso = 0;

					ltcgSetOffRem = zeroOrMore(ltcgSetOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
				} else {

					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = tempAk;
					setOffRem = 0;
					// Section break up

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec112c2, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec112c2 = parseInt(ltcgPrctg10Sec112c2, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec112c2, 10);
						ltcgPrctg10Sec112c2 = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115AB1B, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115AB1B = parseInt(ltcgPrctg10Sec115AB1B,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115AB1B, 10);
						ltcgPrctg10Sec115AB1B = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115AC1, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115AC1 = parseInt(ltcgPrctg10Sec115AC1,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115AC1, 10);
						ltcgPrctg10Sec115AC1 = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115AD3, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115AD3 = parseInt(ltcgPrctg10Sec115AD3,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115AD3, 10);
						ltcgPrctg10Sec115AD3 = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec115ADiiiP, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec115ADiiiP = parseInt(
								ltcgPrctg10Sec115ADiiiP, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec115ADiiiP, 10);
						ltcgPrctg10Sec115ADiiiP = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10SecPti, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10SecPti = parseInt(ltcgPrctg10SecPti, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10SecPti, 10);
						ltcgPrctg10SecPti = 0;
					}

					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10SecProviso, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10SecProviso = parseInt(ltcgPrctg10SecProviso,
								10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10SecProviso, 10);
						ltcgPrctg10SecProviso = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctgPTI_LTCG10P112A, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctgPTI_LTCG10P112A = parseInt(ltcgPrctgPTI_LTCG10P112A, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctgPTI_LTCG10P112A, 10);
						ltcgPrctgPTI_LTCG10P112A = 0;
					}
					if (parseInt(tempAk, 10) >= 0
							&& parseInt(ltcgPrctg10Sec112A, 10) > parseInt(
									tempAk, 10)) {
						ltcgPrctg10Sec112A = parseInt(ltcgPrctg10Sec112A, 10)
								- parseInt(tempAk, 10);
						tempAk = 0;
					} else {
						tempAk = parseInt(tempAk, 10)
								- parseInt(ltcgPrctg10Sec112A, 10);
						ltcgPrctg10Sec112A = 0;
					}
				}
			} else {
				var prevLtcgSetOffRem = ltcgSetOffRem;

				if (ltcgSetOffRem >= 0) {
					document
							.getElementsByName('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = parseInt(
							ltcgSetOffRem, 10);
					ltcgPrctg10Sec112c2 = 0;
					ltcgPrctg10Sec115AC1 = 0;
					ltcgPrctg10Sec112A = 0;
					ltcgPrctg10Sec115ADiiiP = 0;
					ltcgPrctg10Sec115AD3 = 0;
					ltcgPrctg10Sec115AB1B = 0;
					ltcgPrctg10SecPti = 0;
					ltcgPrctgPTI_LTCG10P112A = 0;
					ltcgPrctg10SecProviso = 0;
					setOffRem = zeroOrMore(setOffRem
							- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
				}
			}
		}

		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead');
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff'));
			}
			setOffRem = 0;
		}

		prevSetOffRem = setOffRem;
		setOffRem = parseInt(setOffRem, 10)
				- coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead');
		if (parseInt(setOffRem, 10) >= 0) {
			if (!checkIfChanged('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead');
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff'));

				setOffRem = parseInt(prevSetOffRem, 10)
						- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff');
			}
		} else {

			if (!checkIfChanged('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')) {
				document
						.getElementsByName('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff')[0].value = prevSetOffRem;
			} else {
				checkFirstLessThanMinOthTwo(
						'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff',
						'scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrUnderThatHead',
						'scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse',
						coalescePath('scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')
								- coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.othSrcLossNoRaceHorseSetoff')
								- coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.othSrcLossNoRaceHorseSetoff'));
			}
			setOffRem = 0;
		}

		cgosIncome.cgInc.stcg.prctg15.sec111a = stcgPercent15Sec111a;
		cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii = stcgPercent15Sec115ad_1_b_ii;
		cgosIncome.cgInc.stcg.prctg15.secPti = stcgPercent15SecPti;
		cgosIncome.cgInc.stcg.prctg30.sec115AD = stcgPercent30Sec115AD;
		cgosIncome.cgInc.stcg.prctg30.secPti = stcgPercent30SecPti;
		cgosIncome.cgInc.stcg.prctgAr.stcgApp = stcgPercentArSecStcgApp;
		cgosIncome.cgInc.stcg.prctgAr.secPti = stcgPercentArSecPti;
		cgosIncome.cgInc.ltcg.prctg20.sec112 = ltcgPrctg20Sec112;
		cgosIncome.cgInc.ltcg.prctg20.secPti = ltcgPrctg20SecPti;
		cgosIncome.cgInc.ltcg.prctg10.secProviso = ltcgPrctg10SecProviso;
		cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2 = ltcgPrctg10Sec112c2;
		cgosIncome.cgInc.ltcg.prctg10.sec115AC_1 = ltcgPrctg10Sec115AC1;
		cgosIncome.cgInc.ltcg.prctg10.sec115AD_3 = ltcgPrctg10Sec115AD3;
		cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B = ltcgPrctg10Sec115AB1B;
		cgosIncome.cgInc.ltcg.prctg10.secPti = ltcgPrctg10SecPti;
		cgosIncome.cgInc.ltcg.prctg10.secPti112A = ltcgPrctgPTI_LTCG10P112A;
		cgosIncome.cgInc.ltcg.prctg10.sec112A = ltcgPrctg10Sec112A;
		cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP = ltcgPrctg10Sec115ADiiiP;

		setOffHPLossCYLA(cgosIncome);
	} catch (e) {
		alert('error in setOffOthSrcLossCYLA()=' + e.stack);
	}

}
function sum56to2() {
	var table = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowCount = table.rows.length - 2;
	var temp = parseInt('0',10);
	var residentFlag= document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	for (var i = 0; i < rowCount; i++) {

		var section = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].itemIncluded')[0];
		var itemIncludedIn = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].natureOfIncome')[0];
		var taxResidCertFlag = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].taxResidCertFlag')[0];
		if (residentFlag == 'NRI') {
			if ((itemIncludedIn.value == '1a' || itemIncludedIn.value == '1b'
					|| itemIncludedIn.value == '1c' || itemIncludedIn.value == '1d')
					&& taxResidCertFlag.value == 'Y') {
				if (section.value != ''
						&& (section.value == '56i' || section.value == '562iii'
								|| section.value == '562x' || section.value == '56')) {
					temp = parseInt(temp)
							+ coalesceSetRet('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ i + '].amount');
				}
			}
		} else {
			if (section.value != ''
					&& (section.value == '56i' || section.value == '562iii'
							|| section.value == '562x' || section.value == '56')) {
				temp = parseInt(temp)
						+ coalesceSetRet('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].amount');
			}
		}

	}
	return temp;
}
function calculateOS(cgosIncome) {
	var simap = initMapForSI(cgosIncome);
	var amtNotDeductibleUs581 = document
			.getElementsByName('scheduleOS.incFromOwnHorse.amtNotDeductibleUs58')[0];
	var profitChargTaxUs591 = document
			.getElementsByName('scheduleOS.incFromOwnHorse.profitChargTaxUs59')[0];
	var totOthSrcNoRaceHorse = document
			.getElementsByName('scheduleOS.totOthSrcNoRaceHorse')[0];
	var balanceOwnRaceHorse = document
			.getElementsByName('scheduleOS.incFromOwnHorse.balanceOwnRaceHorse')[0];
	var incChargeable = document.getElementsByName('scheduleOS.incChargeable')[0];

	validateSchOSDTAA1a1b();
	calcAnyOtherIncome();
	calcualteOSInterestTotal();
	// Gross Income chargeable to tax at normal applicable rates (1a+ 1b+ 1c+
	// 1d+1e)
	var totalIncomeGross = document
			.getElementsByName('scheduleOS.totalIncomeGross')[0];
	totalIncomeGross.value = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.dividendGross'),
			10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.interestGross'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incomeFromNature.underSec560.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.totalOtherIncome'),
					10)));

	calculateOSGross(simap);
//	calculateScheduleOStaxBenifit();
//	calculateScheduleOSicnomeBenifit();
	// Income chargeable at special rates (2a+ 2b+ 2c+ 2d + 2e + 2f related to
	// sl.no.1)
	var tabl = document.getElementById('schduleOsinc');
	var allSelects = tabl.getElementsByTagName('SELECT');
	var tempSum = parseInt('0', 10);
	for (var i = 0; i < allSelects.length; i++) {
		var index = name.substring(name.indexOf('[') + 1, name.indexOf(']'));
		tempSum = parseInt(tempSum)
				+ parseInt(coalesce(document
						.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
								+ i + '].sourceAmount')[0].value));
	}
	var tabl1 = document.getElementById('schduleOsincPti');
	var allSelects1 = tabl1.getElementsByTagName('SELECT');
	var tempSum1 = parseInt('0', 10);
	for (var i = 0; i < allSelects1.length; i++) {
		var index = name.substring(name.indexOf('[') + 1, name.indexOf(']'));
		tempSum1 = parseInt(tempSum1)
				+ parseInt(coalesce(document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ i + '].sourceAmount')[0].value));
	}

	var totalOSGross = document.getElementsByName('scheduleOS.totalOSGross')[0];
	totalOSGross.value = eval(parseInt(
			coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls0.sourceAmount'),
			10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
					10)
		/*	+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit'),
					10)*/
			+ parseInt(tempSum, 10)
			+ parseInt(tempSum1, 10)
			+ parseInt(sum56to2(), 10));

	var totAmtUnderDtaa = document
			.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa.totAmtUnderDtaa')[0];
	var tab = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowcount = tab.rows.length;
	var sum = 0;
	for (var i = 0; i < parseInt(rowcount - 2); i++) {
		if (document
				.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value == 'NRI'
				&& document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].taxResidCertFlag')[0].value == 'Y') {
			sum = eval(parseInt(coalesce(sum), 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ i + '].amount')[0].value), 10));
		} else if (document
				.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value != 'NRI') {
			sum = eval(parseInt(coalesce(sum), 10)
					+ parseInt(
							coalesce(document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ i + '].amount')[0].value), 10));

		}
	}
	totAmtUnderDtaa.value = sum;

	// Deductions under section 57:- (other than those relating to income
	// chargeable under at special rates under 2a, 2b & 2d
	var totDeductions = document
			.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.deductions.totDeductions')[0];
	totDeductions.value = eval(parseInt(
			coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.deductions.expenses'),
			10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation'),
					10));

	// (1 – 3 + 4 + 5)
	var amtNotDeductibleUs58 = document
			.getElementsByName('scheduleOS.amtNotDeductibleUs58')[0];

	var profitChargTaxUs59 = document
			.getElementsByName('scheduleOS.profitChargTaxUs59')[0];

	var balanceNoRaceHorse = document
			.getElementsByName('scheduleOS.balanceNoRaceHorse')[0];

	var incChargblSplRateOS56i = document
			.getElementsByName('scheduleOS.incChargblSplRateOS.56i')[0];
	var incChargblSplRateOS56 = document
			.getElementsByName('scheduleOS.incChargblSplRateOS.56')[0];
	var incChargblSplRateOS562 = document
			.getElementsByName('scheduleOS.incChargblSplRateOS.562')[0];
	var incChargblSplRateOS562x = document
			.getElementsByName('scheduleOS.incChargblSplRateOS.562x')[0];

	var totalIncomeFromDtaa = eval(parseInt(incChargblSplRateOS56i.value, 10)
			+ parseInt(incChargblSplRateOS56.value, 10)
			+ parseInt(incChargblSplRateOS562.value, 10)
			+ parseInt(incChargblSplRateOS562x.value, 10));

	var tab = document.getElementById('anyOtherIncome');
	var rowcount = tab.rows.length;
	var temp = parseInt('0', 10);

	for (var i = 0; i < rowcount - 3; i++) {
		temp = eval(parseInt(
				coalesce(document
						.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.otherIncome['
								+ i + '].anyOtherIncomeAmount')[0].value), 10))
				+ temp;
	}
	balanceNoRaceHorse.value = eval(parseInt(totalIncomeFromDtaa, 10)
			+ parseInt(temp, 10) - parseInt(totDeductions.value, 10)
			+ parseInt(coalesce(amtNotDeductibleUs58.value), 10)
			+ parseInt(coalesce(profitChargTaxUs59.value), 10));

	// (2+6)
	var totOthSrcNoRaceHorse = document
			.getElementsByName('scheduleOS.totOthSrcNoRaceHorse')[0];
	var IncmOthrSrc = document
			.getElementsByName('scheduleOS.balanceNoRaceHorse')[0];

	totOthSrcNoRaceHorse.value = eval(parseInt(totalOSGross.value, 10)
			+ parseInt(zeroOrMore(parseInt(IncmOthrSrc.value, 10))));
	// 8a - 8b + 8c + 8d

	balanceOwnRaceHorse.value = eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.receipts'), 10)
			- parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.deductSec57'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.amtNotDeductibleUs58'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incFromOwnHorse.profitChargTaxUs59'),
					10));
	// (7+8e)
	var incChargeable = document.getElementsByName('scheduleOS.incChargeable')[0];
	incChargeable.value = eval(parseInt(totOthSrcNoRaceHorse.value, 10)
			+ parseInt(zeroOrMore(parseInt(balanceOwnRaceHorse.value, 10))));

	return simap;
}

function validateSchOSDTAA1a1b() {
	var dividendGross = parseInt(
			coalesce(document
					.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.dividendGross')[0].value),
			10);
	var interestGross = parseInt(
			coalesce(document
					.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.interestGross')[0].value),
			10);

	var table = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowCount = table.rows.length - 2;

	var dividendGrossTot = parseInt('0', 10);
	var interestGrossTot = parseInt('0', 10);

	for (var k = 0; k < rowCount; k++) {
		if (document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ k + '].itemIncluded')[0].value == '56i') {
			dividendGrossTot = eval(dividendGrossTot
					+ parseInt(
							coalesce(document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value), 10));
			if (eval(dividendGrossTot > dividendGross)) {
				if (document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ k + '].amount')[0].value != '') {
					document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].amount')[0].value = 0;
					addErrorXHTML(
							document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0],
							'For Dividend - The sum of amount should not exceed amount entered in 1a.',
							true);
					j
							.setFieldError(
									'scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount',
									'For Dividend - The sum of amount should not exceed amount entered in 1a.');
				}
			}
		} else if (document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ k + '].itemIncluded')[0].value == '56') {
			interestGrossTot = eval(interestGrossTot
					+ parseInt(
							coalesce(document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value), 10));
			if (eval(interestGrossTot > interestGross)) {
				if (document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ k + '].amount')[0].value != '') {
					document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].amount')[0].value = 0;
					addErrorXHTML(
							document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0],
							'For Interest - The sum of amount should not exceed amount entered in 1b.',
							true);
					j
							.setFieldError(
									'scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount',
									'For Interest - The sum of amount should not exceed amount entered in 1b.');
				}
			}
		}
	}

}

function calculateOSGross(simap) {
	var total = parseInt('0', 10);

	try {
		var tabl = document.getElementById('schduleOsinc');

		var dividendIncome115BBDA = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBDA')[0];
		var dividendIncome115BBF = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBF')[0];
		var dividendIncome115BBE = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBE')[0];
		var dividendIncome115BBG = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBG')[0];

		dividendIncome115BBE.value = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount');
		simap['5BBE'] = coalesceSetRet('scheduleOS.incChargblSplRateOS.dividendIncome115BBE');

		var dividendIncome115BBDA_PTI = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBDA_PTI')[0];
		var dividendIncome115BBF_PTI = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBF_PTI')[0];
		var dividendIncome115BBE_PTI = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBE_PTI')[0];
		var dividendIncome115BBG_PTI = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBG_PTI')[0];
		var dividendIncome115BB_PTI = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.winningFrmLotteries_PTI')[0];

		var dropDownBBDA = parseInt(0, 10);
		var dropDownBBF = parseInt(0, 10);
		var dropDownBBE = parseInt(0, 10);
		var dropDownBBG = parseInt(0, 10);
		var dropDownBB = parseInt(0, 10);

		var dropDownBBDA_PTI = parseInt(0, 10);
		var dropDownBBF_PTI = parseInt(0, 10);
		var dropDownBBE_PTI = parseInt(0, 10);
		var dropDownBBG_PTI = parseInt(0, 10);
		var dropDownBB_PTI = parseInt(0, 10);
		var dropDown1_PTI = parseInt(0, 10);

		var total = parseInt('0', 10);
		var allInputTags = tabl.getElementsByTagName('input');
		for (var i = 0; i < allInputTags.length; i++) {
			if (allInputTags[i].name.match("sourceAmount$")) {
				total = eval(parseInt(total, 10)
						+ parseInt(isNVL(allInputTags[i].value), 10));
			}
		}
		// Any other income chargeable at special rate (total of di to dxix)
		document.getElementsByName('scheduleOS.usOthersGross')[0].value = total;

		/*
		 * var v115BBFsec = document
		 * .getElementsByName('scheduleOS.incChargblSplRateOS.sec11BBF')[0];
		 * v115BBFsec.value = parseInt(0,10);
		 * 
		 * var v115BBEsec = document
		 * .getElementsByName('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount')[0];
		 * v115BBEsec.value =parseInt(0,10);
		 * 
		 * var v115BBGsec = document
		 * .getElementsByName('scheduleOS.incChargblSplRateOS.sec11BBG')[0];
		 * v115BBGsec.value = parseInt(0,10);
		 */

		var dropDownBBF = parseInt(0, 10);
		var dropDownBBE = parseInt(0, 10);
		var dropDownBBG = parseInt(0, 10);
		var dropDownBB = parseInt(0, 10);

		/*
		 * var
		 * temp=eval(parseInt(coalesce(document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls[7].sourceAmount')[0].value),10));
		 * 
		 * var
		 * tempTotal=parseInt(coalesce(document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls[13].sourceAmount')[0].value),10);
		 * 
		 * for(var i = 0; i < allInputTags.length; i++) { if
		 * (allInputTags[i].name.match("sourceAmount$")) {
		 * 
		 * total = eval(parseInt(total ,10) +
		 * parseInt(isNVL(allInputTags[i].value) ,10)); } }
		 * 
		 * total=eval(parseInt(total ,10)- parseInt(temp ,10) -
		 * parseInt(tempTotal ,10) );
		 * 
		 */

		var allSelects = tabl.getElementsByTagName('SELECT');
		var table = document.getElementById('scheduleOsNriIncTaxDtaa');
		var residentFlag= document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
		var rowCount = table.rows.length - 2;
		var arr = {
			'5A1ai' : 0,
			'5A1aii' : 0,
			'5A1aiia' : 0,
			'5A1aiiaa' : 0,
			'5A1aiiab' : 0,
			'5A1aiiac' : 0,
			'5A1aiii' : 0,
			'5A1bA' : 0,
			// '5A1bB' : 0,
			'5AC1ab' : 0,
			'5BBA' : 0,
			'5Ea' : 0,
			'PTI_5A1ai' : 0,
			'PTI_5A1aii' : 0,
			'PTI_5A1aiia' : 0,
			'PTI_5A1aiiaa' : 0,
			'PTI_5A1aiiab' : 0,
			'PTI_5A1aiiac' : 0,
			'PTI_5A1aiii' : 0,
			'PTI_5A1bA' : 0,
			'PTI_5AC1ab' : 0,
			'PTI_5BBA' : 0,
			'PTI_5Ea' : 0,
			'PTI_5BBDA' : 0,
			'PTI_5BBC' : 0,
			'PTI_5BB' : 0,
			'PTI_5BBE' : 0
		};
		var winningFrmLotteries = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.winningFrmLotteries')[0];
		winningFrmLotteries.value = document
				.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls0.sourceAmount')[0].value;
		var sum = 0;
		var sumPti = 0;
		for (var i = 0; i < allSelects.length; i++) {
			var name = allSelects[i].name;
			var index = name
					.substring(name.indexOf('[') + 1, name.indexOf(']'));

			simap[allSelects[i].value] = coalesce(document
					.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
							+ i + '].sourceAmount')[0].value);

			if (allSelects[i].value == '5BBDA') {

				dividendIncome115BBDA.value = document
						.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}

			if (allSelects[i].value == '5BBE') {

				dividendIncome115BBE.value = document
						.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;

			}

			if (allSelects[i].value == '5BBF') {

				dividendIncome115BBF.value = document
						.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}

			if (allSelects[i].value == '5BBG') {

				dividendIncome115BBG.value = document
						.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}
			var taxResidCertFlag= false;

			if (allSelects[i].value != 'DTAA') {
				sum = parseInt(sum)
						+ parseInt(coalesce(document
								.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
										+ index + '].sourceAmount')[0].value));
				for (var k = 0; k < rowCount; k++) {
					//2020 changes
					/*if ((document
							.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit')[0].value > 0 && document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].itemIncluded')[0].value == '1')) {
						if (document
								.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].amount')[0].value > parseInt(coalesce(document
								.getElementsByName('scheduleOS.totalOSGross')[0].value))) {
							if (document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value != '') {

								document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value = 0;
								calcITR6();
								addErrorXHTML(
										document
												.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount')[0],
										'The sum of amount should not exceed amount entered in 2d.',
										true);
								j
										.setFieldError(
												'scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount',
												'The sum of amount should not exceed amount entered in 2d.');
							}

						}

					}*/
					if ((document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].itemIncluded')[0].value == allSelects[i].value)) {

						if(residentFlag=='NRI')
						{
							if(document.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].taxResidCertFlag')[0].value=='Y')
							{
						arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
								+ parseInt(coalesce(document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value)));
							}
						}
						else
						{
							arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
									+ parseInt(coalesce(document
											.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
													+ k + '].amount')[0].value)));
						}
						//alert('array   '+arr[allSelects[i].value]);
						//alert('fff arr' + JSON.stringify(arr));

						if ((arr[allSelects[i].value]) > parseInt(coalesce(document
								.getElementsByName('scheduleOS.usOthersGross')[0].value))) {

							if (document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value != '') {
								document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value = 0;
								calcITR6();
								addErrorXHTML(
										document
												.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount')[0],
										'The sum of amount should not exceed amount entered in 2c.',
										true);
								j
										.setFieldError(
												'scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount',
												'The sum of amount should not exceed amount entered in 2c.');
							}
						} else {
							if(residentFlag=='NRI')
							{
								if(document.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].taxResidCertFlag')[0].value=='Y')
								{
									taxResidCertFlag=true;
									sum -= document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value;
									
								}
							}
							else
							{
								taxResidCertFlag=false;
								sum -= document
								.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].amount')[0].value;
							}
						}
					}
				}
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag)
					{
				simap[allSelects[i].value] -= parseInt(
						coalesce(arr[allSelects[i].value]), 10);
					}
				}
				else
				{
					simap[allSelects[i].value] -= parseInt(
							coalesce(arr[allSelects[i].value]), 10);
				}
			}

		}

		for (var k = 0; k < rowCount; k++) {
			if ((document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ k + '].itemIncluded')[0].value == '5BB')) {

				if (document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ k + '].amount')[0].value > coalesceSetRet('scheduleOS.incomeChargableUnderSpc.othersGrossDtls0.sourceAmount'))
					if (document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].amount')[0].value != '') {
						document
								.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].amount')[0].value = 0;
						calcITR6();
						addErrorXHTML(
								document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0],
								'The amount should not exceed amount entered in 2a.',
								true);
						j
								.setFieldError(
										'scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount',
										'The  amount should not exceed amount entered in 2a.');
					}
			}
		}

		var tabl = document.getElementById('schduleOsincPti');
		var allSelects = tabl.getElementsByTagName('SELECT');

		var total = parseInt('0', 10);
		var allInputTags = tabl.getElementsByTagName('input');
		for (var i = 0; i < allInputTags.length; i++) {
			if (allInputTags[i].name.match("sourceAmount$")) {
				total = eval(parseInt(total, 10)
						+ parseInt(isNVL(allInputTags[i].value), 10));
			}
		}

		document.getElementsByName('scheduleOS.pTiOthersGross')[0].value = total;

		for (var i = 0; i < allSelects.length; i++) {
			var name = allSelects[i].name;
			var index = name
					.substring(name.indexOf('[') + 1, name.indexOf(']'));
			simap[allSelects[i].value] = coalesce(document
					.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
							+ i + '].sourceAmount')[0].value);

			if (allSelects[i].value == 'PTI_5BBDA') {

				dividendIncome115BBDA_PTI.value = document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}
			if (allSelects[i].value == 'PTI_5BB') {

				dividendIncome115BB_PTI.value = document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}

			if (allSelects[i].value == 'PTI_5BBF') {

				dividendIncome115BBF_PTI.value = document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}

			if (allSelects[i].value == 'PTI_5BBE') {

				dividendIncome115BBE_PTI.value = document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}

			if (allSelects[i].value == 'PTI_5BBG') {

				dividendIncome115BBG_PTI.value = document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}

			if (allSelects[i].value == 'PTI_5BB') {

				dividendIncome115BBG_PTI.value = document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}

			if (allSelects[i].value == 'PTI_5BBE') {

				dividendIncome115BBG_PTI.value = document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ index + '].sourceAmount')[0].value;
			}
			var taxResidCertFlag=false;

			if (allSelects[i].value != 'DTAA') {
				sumPti = parseInt(sum)
						+ parseInt(coalesce(document
								.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
										+ index + '].sourceAmount')[0].value));
				for (var k = 0; k < rowCount; k++) {
					if ((document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].itemIncluded')[0].value == allSelects[i].value)) {

						if(residentFlag=='NRI')
						{
							if(document.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].taxResidCertFlag')[0].value=='Y')
							{
						arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
								+ parseInt(coalesce(document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value)));
							}
						}
						else
						{
							arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
									+ parseInt(coalesce(document
											.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
													+ k + '].amount')[0].value)));
						}
						if ((arr[allSelects[i].value]) > parseInt(coalesce(document
								.getElementsByName('scheduleOS.pTiOthersGross')[0].value))) {// add
																								// OS e
																								// total

							if (document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value != '') {
								document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value = 0;
								calcITR6();
								addErrorXHTML(
										document
												.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount')[0],
										'The sum of amount should not exceed amount entered in 2c.',
										true);
								j
										.setFieldError(
												'scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount',
												'The sum of amount should not exceed amount entered in 2c.');
							}
						} else {
							if(residentFlag=='NRI')
							{
								if(document.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].taxResidCertFlag')[0].value=='Y')
								{
									taxResidCertFlag=true;
									sumPti -= document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value;
								}
							}
								else
								{
									taxResidCertFlag=false;
									sumPti -= document
									.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value;
								}
						}
					}
				}
			}
			if(residentFlag=='NRI')
			{
				if(taxResidCertFlag)
				{
				simap[allSelects[i].value] -= parseInt(
						coalesce(arr[allSelects[i].value]), 10);
				}
			}
			else
			{
				simap[allSelects[i].value] -= parseInt(
						coalesce(arr[allSelects[i].value]), 10);
			}
		}

		var dropDown56i = parseInt('0', 10);
		var dropDown56 = parseInt('0', 10);
		var dropDown562 = parseInt('0', 10);
		var dropDown562x = parseInt('0', 10);

		for (var j = 0; j < rowCount; j++) {

			var dropDownOS = document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ j + '].itemIncluded')[0].value;

			var amountofSum = document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ j + '].amount')[0].value;
			var taxResidCertFlag = document
			.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
					+ j + '].taxResidCertFlag')[0].value;
			if (dropDownOS == '5BBDA') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBDA = coalesce(eval(parseInt(dropDownBBDA)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBDA = coalesce(eval(parseInt(dropDownBBDA)
							+ parseInt(amountofSum)));
				}
			}

			if (dropDownOS == '5BBF') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBF = coalesce(eval(parseInt(dropDownBBF)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBF = coalesce(eval(parseInt(dropDownBBF)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == '5BBE') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBE = coalesce(eval(parseInt(dropDownBBE)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBE = coalesce(eval(parseInt(dropDownBBE)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == '5BBG') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBG = coalesce(eval(parseInt(dropDownBBG)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBG = coalesce(eval(parseInt(dropDownBBG)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == '5BB') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
						dropDownBB = coalesce(eval(parseInt(dropDownBB)
								+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBB = coalesce(eval(parseInt(dropDownBB)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == 'PTI_5BBDA') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBDA_PTI = coalesce(eval(parseInt(dropDownBBDA_PTI)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBDA_PTI = coalesce(eval(parseInt(dropDownBBDA_PTI)
							+ parseInt(amountofSum)));
				}
			}

			if (dropDownOS == 'PTI_5BBF') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBF_PTI = coalesce(eval(parseInt(dropDownBBF_PTI)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBF_PTI = coalesce(eval(parseInt(dropDownBBF_PTI)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == 'PTI_5BBE') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBE_PTI = coalesce(eval(parseInt(dropDownBBE_PTI)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBE_PTI = coalesce(eval(parseInt(dropDownBBE_PTI)
							+ parseInt(amountofSum)));
				}	
			}
			if (dropDownOS == 'PTI_5BBG') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBBG_PTI = coalesce(eval(parseInt(dropDownBBG_PTI)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBBG_PTI = coalesce(eval(parseInt(dropDownBBG_PTI)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == 'PTI_5BB') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDownBB_PTI = coalesce(eval(parseInt(dropDownBB_PTI)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDownBB_PTI = coalesce(eval(parseInt(dropDownBB_PTI)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == '56i') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDown56i = coalesce(eval(parseInt(dropDown56i)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDown56i = coalesce(eval(parseInt(dropDown56i)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == '56') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDown56 = coalesce(eval(parseInt(dropDown56)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDown56 = coalesce(eval(parseInt(dropDown56)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == '562iii') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDown562 = coalesce(eval(parseInt(dropDown562)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDown562 = coalesce(eval(parseInt(dropDown562)
							+ parseInt(amountofSum)));
				}
			}
			if (dropDownOS == '562x') {
				if(residentFlag=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
				dropDown562x = coalesce(eval(parseInt(dropDown562x)
						+ parseInt(amountofSum)));
					}
				}
				else
				{
					dropDown562x = coalesce(eval(parseInt(dropDown562x)
							+ parseInt(amountofSum)));
				}
			}
		}

		var incChargblSplRateOS56i = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.56i')[0];
		var incChargblSplRateOS56 = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.56')[0];
		var incChargblSplRateOS562 = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.562')[0];
		var incChargblSplRateOS562x = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.562x')[0];

		incChargblSplRateOS56i.value = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.dividendGross');
		incChargblSplRateOS56.value = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.interestGross');
		incChargblSplRateOS562.value = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs');
		incChargblSplRateOS562x.value = coalesceSetRet('scheduleOS.incomeFromNature.underSec560.sourceAmount');

		var final56i = parseInt(0, 10);

		final56i = incChargblSplRateOS56i.value - dropDown56i;
		document.getElementsByName('scheduleOS.incChargblSplRateOS.56i')[0].value = final56i;

		var final56 = parseInt(0, 10);
		final56 = incChargblSplRateOS56.value - dropDown56;
		document.getElementsByName('scheduleOS.incChargblSplRateOS.56')[0].value = final56;

		var final562 = parseInt(0, 10);
		final562 = incChargblSplRateOS562.value - dropDown562;
		document.getElementsByName('scheduleOS.incChargblSplRateOS.562')[0].value = final562;

		var final562x = parseInt(0, 10);
		final562x = incChargblSplRateOS562x.value - dropDown562x;
		document.getElementsByName('scheduleOS.incChargblSplRateOS.562x')[0].value = final562x;

		var finalBBDA = parseInt(0, 10);
		finalBBDA = dividendIncome115BBDA.value - dropDownBBDA;

		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBDA')[0].value = finalBBDA;

		var finalBBF = parseInt(0, 10);
		finalBBF = dividendIncome115BBF.value - dropDownBBF;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBF')[0].value = finalBBF;

		var finalBBE = parseInt(0, 10);
		finalBBE = dividendIncome115BBE.value - dropDownBBE;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBE')[0].value = finalBBE;

		var finalBBG = parseInt(0, 10);
		finalBBG = dividendIncome115BBG.value - dropDownBBG;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBG')[0].value = finalBBG;

		var finalBB = parseInt(0, 10);
		finalBB = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.winningFrmLotteries')[0].value
				- dropDownBB;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.winningFrmLotteries')[0].value = finalBB;

		simap['5BBE'] = coalesceSetRet('scheduleOS.incChargblSplRateOS.dividendIncome115BBE');
		simap['5BB'] = coalesceSetRet('scheduleOS.incChargblSplRateOS.winningFrmLotteries');

		var finalBBG = parseInt(0, 10);
		finalBBG = dividendIncome115BBG.value - dropDownBBG;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBG')[0].value = finalBBG;

		var finalBBDA_PTI = parseInt(0, 10);
		finalBBDA_PTI = dividendIncome115BBDA_PTI.value - dropDownBBDA_PTI;

		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBDA_PTI')[0].value = finalBBDA_PTI;

		var finalBBF = parseInt(0, 10);
		finalBBF_PTI = dividendIncome115BBF_PTI.value - dropDownBBF_PTI;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBF_PTI')[0].value = finalBBF_PTI;

		var finalBBE_PTI = parseInt(0, 10);
		finalBBE_PTI = dividendIncome115BBE_PTI.value - dropDownBBE_PTI;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBE_PTI')[0].value = finalBBE_PTI;

		var finalBBG_PTI = parseInt(0, 10);
		finalBBG_PTI = dividendIncome115BBG_PTI.value - dropDownBBG_PTI;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.dividendIncome115BBG_PTI')[0].value = finalBBG_PTI;

		var finalBB_PTI = parseInt(0, 10);
		finalBB_PTI = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.winningFrmLotteries_PTI')[0].value
				- dropDownBB_PTI;
		document
				.getElementsByName('scheduleOS.incChargblSplRateOS.winningFrmLotteries_PTI')[0].value = finalBB_PTI;

		var final1_PTI = parseInt(0, 10);
		final1_PTI = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.1_PTI')[0].value
				- dropDownBB_PTI;
		document.getElementsByName('scheduleOS.incChargblSplRateOS.1_PTI')[0].value = finalBB_PTI;

	} catch (e) {
		alert('Exception in calculateOSGross : ' + e);
	}
	return total;
}

function calcCFL(specltvIncSetOff, specfdIncSetOff,bfla115B) {
	try {

		// setting values to 0 before populating - specu, specified, stcg , ltcg
		//document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecBusCF')[0].value = parseInt(0,10);
		//document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecifiedBusCF')[0].value = parseInt(0,10);
		//document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal')[0].value = parseInt(0,10);
		//document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal')[0].value = parseInt(0,10);

		document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.hpLossCFTotal')[0].value = zeroOrMore(document.getElementsByName('scheduleBFLA.hp.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value);

		document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.busLossOthThanSpecLossCF')[0].value =
			parseInt(zeroOrMore(document.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value),10)+
			parseInt(zeroOrMore(coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff') - specltvIncSetOff),10)+
			parseInt(zeroOrMore(coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff') - specfdIncSetOff),10)+
			parseInt(zeroOrMore(coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff'),10));

		document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.lossFrmSpecBusCF')[0].value = specltvIncSetOff;
		document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.lossFrmSpecifiedBusCF')[0].value = specfdIncSetOff;
		//2020 changes

		document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.lossFrmInsuCF')[0].value = bfla115B;

		document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.othSrcLossRaceHorseCF')[0].value = zeroOrMore(document.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value);

		// scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.hpLossCFTotal
		var hpLossCFL = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.hpLossCFTotal')[0];

		setEditableFieldValue(hpLossCFL,Math
				.abs(coalescePath('scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff')));

		if(hpLossCFL.value > Math
				.abs(coalescePath('scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff')))
		{
			hpLossCFL.value = Math.abs(coalescePath('scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff'));
		}else
		{
			hpLossCFL.value=hpLossCFL.value;
		}

		var busLossOthThanSpecLossCFL = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.busLossOthThanSpecLossCF')[0];
		setEditableFieldValue(busLossOthThanSpecLossCFL,Math
				.abs(coalescePath('scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff')));

		if(busLossOthThanSpecLossCFL.value > Math
				.abs(coalescePath('scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff')))
		{
			busLossOthThanSpecLossCFL.value = Math.abs(coalescePath('scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff'));
		}else
		{
			busLossOthThanSpecLossCFL.value=busLossOthThanSpecLossCFL.value;
		}






		// speculative  ---- mod(B41) of schedule BP if B41 is -ve
		if(coalescePath('itr6ScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus') < 0 ){
			var lossFrmSpecBusCFL = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecBusCF')[0];
			setEditableFieldValue(lossFrmSpecBusCFL,Math
					.abs(coalescePath('itr6ScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus')));
			if(lossFrmSpecBusCFL.value > Math
					.abs(coalescePath('itr6ScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus')))
			{
				lossFrmSpecBusCFL.value = Math.abs(coalescePath('itr6ScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus'));
			}else
			{
				lossFrmSpecBusCFL.value=lossFrmSpecBusCFL.value;
			}
		}

		// specified   ---- mod(C47)  of schedule BP only if C47 is -ve
		if(coalescePath('itr6ScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal') < 0){
			var lossFrmSpecifiedBusCFL = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecifiedBusCF')[0];
			setEditableFieldValue(lossFrmSpecifiedBusCFL,Math
					.abs(coalescePath('itr6ScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal')));

			if(lossFrmSpecifiedBusCFL.value > Math
					.abs(coalescePath('itr6ScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal')))
			{
				lossFrmSpecifiedBusCFL.value = Math.abs(coalescePath('itr6ScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal'));
			}else
			{
				lossFrmSpecifiedBusCFL.value=lossFrmSpecifiedBusCFL.value;
			}
		}
		//2020 changes
		if(coalescePath('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b') < 0){
			var lossFrmInsuCF = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmInsuCF')[0];
			setEditableFieldValue(lossFrmInsuCF,Math
					.abs(coalescePath('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b')));

			if(lossFrmInsuCF.value > Math
					.abs(coalescePath('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b')))
			{
				lossFrmInsuCF.value = Math.abs(coalescePath('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b'));
			}else
			{
				lossFrmInsuCF.value=lossFrmInsuCF.value;
			}
		}
		var totalSTCG = coalescePath('scheduleCGPost45.currYrLosses.lossRemainSetOff.stclSetoff15Per') +
		coalescePath('scheduleCGPost45.currYrLosses.lossRemainSetOff.stclSetoff30Per') +
		coalescePath('scheduleCGPost45.currYrLosses.lossRemainSetOff.stclSetoffAppRate')+
		coalescePath('scheduleCGPost45.currYrLosses.lossRemainSetOff.stclSetoffDtaaRate');


		var totalLTCG = coalescePath('scheduleCGPost45.currYrLosses.lossRemainSetOff.ltclSetOff10Per') +
		coalescePath('scheduleCGPost45.currYrLosses.lossRemainSetOff.ltclSetOff20Per')+
		coalescePath('scheduleCGPost45.currYrLosses.lossRemainSetOff.ltclSetOffDtaaRate');


		var stcgTotal = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal')[0];

		setEditableFieldValue(stcgTotal, totalSTCG);

		if(stcgTotal.value > totalSTCG )
		{
			stcgTotal.value = totalSTCG;
		}else
		{
			stcgTotal.value=stcgTotal.value;
		}

		var ltcgTotal = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal')[0];

		setEditableFieldValue(ltcgTotal, totalLTCG);

		if(ltcgTotal.value > totalLTCG )
		{
			ltcgTotal.value = totalLTCG;
		}else
		{
			ltcgTotal.value=ltcgTotal.value;
		}

		// os ----- Enter current year OS if any from 4c of Sch OS. ie. any negative figure.
		if(coalescePath('scheduleOS.incFromOwnHorse.balanceOwnRaceHorse') < 0){
			var othSrcLossRaceHorseCFL = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF')[0];
			setEditableFieldValue(othSrcLossRaceHorseCFL,Math
					.abs(coalescePath('scheduleOS.incFromOwnHorse.balanceOwnRaceHorse')));

			if(othSrcLossRaceHorseCFL.value > Math
					.abs(coalescePath('scheduleOS.incFromOwnHorse.balanceOwnRaceHorse')))
			{
				othSrcLossRaceHorseCFL.value = Math.abs(coalescePath('scheduleOS.incFromOwnHorse.balanceOwnRaceHorse'));
			}else
			{
				othSrcLossRaceHorseCFL.value=othSrcLossRaceHorseCFL.value;
			}
		}
		else
		{
			document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF')[0].value=0;
		}


		var secondHp = document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0].value;
		var secondBus = document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0].value;
		var secondSpeculatvBus = document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.lossFrmSpecBusCF')[0].value;
		var second115b = document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.lossFrmInsuCF')[0].value;
		var secondShortTerm = document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0].value;
		var secondLongTerm = document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0].value;
		var secondOth = document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.othSrcLossRaceHorseCF')[0].value;
		var adjstHp = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.hpLossCFTotal')[0].value;
		var adjstBus = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.busLossOthThanSpecLossCF')[0].value;
		var adjstSpeculatvBus = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.lossFrmSpecBusCF')[0].value;
		//2020 changes

		var adjst115b = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.lossFrmInsuCF')[0].value;

		
		var adjstSpecifdBus = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.lossFrmSpecifiedBusCF')[0].value;
		var adjstShortTerm = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.stcgLossCFTotal')[0].value;
		var adjstLongTerm = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.ltcgLossCFTotal')[0].value;
		var adjstOth = document.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.othSrcLossRaceHorseCF')[0].value;
alert('secondHp'+secondHp);
alert('adjstHp'+adjstHp);

		if(parseInt(secondHp, 10)>parseInt(adjstHp, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.hpLossCFTotal')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.hpLossCFTotal') - secondHp +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.hpLossCFTotal'));
		}else{
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.hpLossCFTotal')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.hpLossCFTotal') - adjstHp +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.hpLossCFTotal'));
		}
alert('12121212'+document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.hpLossCFTotal')[0].value);
		if(parseInt(secondBus, 10)>parseInt(adjstBus, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.busLossOthThanSpecLossCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.busLossOthThanSpecLossCF')- secondBus  +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.busLossOthThanSpecLossCF'));
		}else{
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.busLossOthThanSpecLossCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.busLossOthThanSpecLossCF')- adjstBus +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.busLossOthThanSpecLossCF'));
		}


		if(parseInt(secondSpeculatvBus, 10) > parseInt(adjstSpeculatvBus, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.lossFrmSpecBusCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecBusCF')-secondSpeculatvBus +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecBusCF'));
		}else{
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.lossFrmSpecBusCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecBusCF')-adjstSpeculatvBus+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecBusCF'));
		}

		//2020 changes
		if(parseInt(second115b, 10) > parseInt(adjst115b, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.lossFrmInsuCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmInsuCF')-second115b +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmInsuCF'));
		}else{
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.lossFrmInsuCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmInsuCF')-adjst115b+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmInsuCF'));
		}
		


	/*	if(parseInt(firstSpecifiedBusC, 10) > parseInt(adjstSpecifdBus, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.lossFrmSpecifiedBusCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecifiedBusCF')-firstSpecifiedBusC +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecifiedBusCF'));
		}else{*/
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.lossFrmSpecifiedBusCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecifiedBusCF')-adjstSpecifdBus+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.lossFrmSpecifiedBusCF'));
	//	}


		if(parseInt(secondShortTerm, 10)>parseInt(adjstShortTerm, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.stcgLossCFTotal')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal')-secondShortTerm +
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal'));
		}else{
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.stcgLossCFTotal')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal')-adjstShortTerm+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal'));
		}

		if(parseInt(secondLongTerm, 10)>parseInt(adjstLongTerm, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.ltcgLossCFTotal')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.ltcgLossCFTotal')-secondLongTerm+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal'));
		}else{
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.ltcgLossCFTotal')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.ltcgLossCFTotal')-adjstLongTerm+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal'));
		}


		if(parseInt(secondOth, 10)>parseInt(adjstOth, 10)){
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.othSrcLossRaceHorseCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.othSrcLossRaceHorseCF')-secondOth+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF'));

		}else{
			document.getElementsByName('scheduleCFL.totalLossCFSummary.lossSummaryDetail.othSrcLossRaceHorseCF')[0].value =
				zeroOrMore(coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.othSrcLossRaceHorseCF')-adjstOth+
						coalescePath('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF'));

		}

	} catch (e) {
		alert('error in calcCFL()= ' + e.stack);
	}
}

function calcBFLA(cgosIncome) {
	try {
		prefillBFLA();
		calcCFL_sumAll();
		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.hpLossCFTotal',
				'scheduleBFLA.hp.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.hp.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		setFirstToSecondMax(
				'scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.busLossOthThanSpecLossCF',
				'scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		setFirstToSecondMax(
				'scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecBusCF',
				'scheduleBFLA.speculativeInc.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		var specltvIncSetOff = document
				.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value;

		setFirstToSecondMax(
				'scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecifiedBusCF',
				'scheduleBFLA.specifiedInc.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		var specfdIncSetOff = document
				.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value;

	//	2020 changes
		setFirstToSecondMax(
				'scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmInsuCF',
				'scheduleBFLA.profitgainInc.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		var bfla115B = document
		.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value;

		
		
		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal',
				'scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.stcg.stcg30Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal',
				'scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.stcg.stcgAppRate.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal',
				'scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.stcg.stcg15Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.ltcgLossCFTotal',
				'scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.ltcg.ltcg10Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.ltcgLossCFTotal',
				'scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.ltcg.ltcg20Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.othSrcLossRaceHorseCF',
				'scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.profitFrmRaceHorse.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal',
				'scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		setFirstToSecondMax(
				'scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.ltcgLossCFTotal',
				'scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		// setting off loss from business
		var setOffBusLoss = coalescePath('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.busLossOthThanSpecLossCF')
				- coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		// b
		var setOffNotDoneInSpecInc = coalescePath('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		var prevSetOffBusLoss = setOffBusLoss;
		setOffBusLoss = setOffBusLoss - setOffNotDoneInSpecInc;
		if (setOffBusLoss >= 0) {
			document
					.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
					+ setOffNotDoneInSpecInc;
		} else {
			document
					.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
					+ prevSetOffBusLoss;
			setOffBusLoss = 0;
		}

		// c
		var setOffNotDoneInSpecfdInc = coalescePath('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		prevSetOffBusLoss = setOffBusLoss;
		setOffBusLoss = setOffBusLoss - setOffNotDoneInSpecfdInc;
		if (setOffBusLoss >= 0) {
			document
					.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
					+ setOffNotDoneInSpecfdInc;

		} else {
			document
					.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
					+ prevSetOffBusLoss;
			setOffBusLoss = 0;
		}
		
		//	2020 changes


	var setOffNotDone115b = coalescePath('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		prevSetOffBusLoss = setOffBusLoss;
		setOffBusLoss = setOffBusLoss - setOffNotDone115b;
		if (setOffBusLoss >= 0) {
			document
					.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
					+ setOffNotDone115b;

		} else {
			document
					.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
					+ prevSetOffBusLoss;
			setOffBusLoss = 0;
		}

		/*var busLossOthThanSpecLossCFLL = zeroOrMore(coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.busLossOthThanSpecLossCF')
				- coalesceSetRet('scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- zeroOrMore(coalesceSetRet('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
						- coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecBusCF'))
				- zeroOrMore(coalesceSetRet('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
						- coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.lossFrmSpecifiedBusCF')));
	

		
		
		alert('busLossOthThanSpecLossCFLLf'+busLossOthThanSpecLossCFLL);

		setFirstToSecondMaxMod(busLossOthThanSpecLossCFLL,
				'scheduleBFLA.profitgainInc.incBFLA.incOfCurYrUndHeadFromCYLA',
				'scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
*/
		// setting off STCG and LTCG
		var stcgCFL = coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal');
		var tempstcgCFL = stcgCFL;
		var ltcgCFL = coalescePath('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.ltcgLossCFTotal');
		var tempLtcgCFL = ltcgCFL;

		var stcgBreakUp1 = cgosIncome.cgInc.stcg.prctg30.sec115AD;
		var stcgBreakUp7 = cgosIncome.cgInc.stcg.prctg30.secPti;
		var stcgBreakUp2 = cgosIncome.cgInc.stcg.prctgAr.stcgApp;
		var stcgBreakUp8 = cgosIncome.cgInc.stcg.prctgAr.secPti;
		var stcgBreakUp3 = cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii;
		var stcgBreakUp6 = cgosIncome.cgInc.stcg.prctg15.secPti;
		var stcgBreakUp4 = cgosIncome.cgInc.stcg.prctg15.sec111a;
		var stcgBreakUp5 = coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA');

		var ltcgBreakUp12 = cgosIncome.cgInc.ltcg.prctg20.secPti;
		var ltcgBreakUp1 = cgosIncome.cgInc.ltcg.prctg20.sec112;
		var ltcgBreakUp2 = cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2;
		var ltcgBreakUp3 = cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B;
		var ltcgBreakUp4 = cgosIncome.cgInc.ltcg.prctg10.sec115AC_1;
		var ltcgBreakUp5 = cgosIncome.cgInc.ltcg.prctg10.sec115AD_3;
		var ltcgBreakUp10 = cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP;
		var ltcgBreakUp13 = cgosIncome.cgInc.ltcg.prctg10.secPti;
		var ltcgBreakUp14 = cgosIncome.cgInc.ltcg.prctg10.secPti112A;
		var ltcgBreakUp6 = cgosIncome.cgInc.ltcg.prctg10.secProviso;
		var ltcgBreakUp9 = cgosIncome.cgInc.ltcg.prctg10.sec112A;
		var ltcgBreakUp11 = coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA');

		var tempstcgBreakUp1 = parseInt(stcgBreakUp1, 10);
		var tempstcgBreakUp7 = parseInt(stcgBreakUp7, 10);
		var tempstcgBreakUp2 = parseInt(stcgBreakUp2, 10);
		var tempstcgBreakUp8 = parseInt(stcgBreakUp8, 10);
		var tempstcgBreakUp3 = parseInt(stcgBreakUp3, 10);
		var tempstcgBreakUp6 = parseInt(stcgBreakUp6, 10);
		var tempstcgBreakUp4 = parseInt(stcgBreakUp4, 10);
		var tempstcgBreakUp5 = parseInt(stcgBreakUp5, 10);

		var templtcgBreakUp12 = parseInt(ltcgBreakUp12, 10);
		var templtcgBreakUp1 = parseInt(ltcgBreakUp1, 10);
		var templtcgBreakUp2 = parseInt(ltcgBreakUp2, 10);
		var templtcgBreakUp3 = parseInt(ltcgBreakUp3, 10);
		var templtcgBreakUp4 = parseInt(ltcgBreakUp4, 10);
		var templtcgBreakUp5 = parseInt(ltcgBreakUp5, 10);
		var templtcgBreakUp10 = parseInt(ltcgBreakUp10, 10);
		var templtcgBreakUp13 = parseInt(ltcgBreakUp13, 10);
		var templtcgBreakUp14 = parseInt(ltcgBreakUp14, 10);
		var templtcgBreakUp6 = parseInt(ltcgBreakUp6, 10);
		var templtcgBreakUp9 = parseInt(ltcgBreakUp9, 10);
		var templtcgBreakUp11 = parseInt(ltcgBreakUp11, 10);
		if (tempLtcgCFL > templtcgBreakUp12) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp12;
			templtcgBreakUp12 = 0;
		} else {
			templtcgBreakUp12 = zeroOrMore(templtcgBreakUp12 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp1) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp1;
			templtcgBreakUp1 = 0;
		} else {
			templtcgBreakUp1 = zeroOrMore(templtcgBreakUp1 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp2) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp2;
			templtcgBreakUp2 = 0;
		} else {
			templtcgBreakUp2 = zeroOrMore(templtcgBreakUp2 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp3) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp3;
			templtcgBreakUp3 = 0;
		} else {
			templtcgBreakUp3 = zeroOrMore(templtcgBreakUp3 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp4) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp4;
			templtcgBreakUp4 = 0;
		} else {
			templtcgBreakUp4 = zeroOrMore(templtcgBreakUp4 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp5) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp5;
			templtcgBreakUp5 = 0;
		} else {
			templtcgBreakUp5 = zeroOrMore(templtcgBreakUp5 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp10) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp10;
			templtcgBreakUp10 = 0;
		} else {
			templtcgBreakUp10 = zeroOrMore(templtcgBreakUp10 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp13) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp13;
			templtcgBreakUp13 = 0;
		} else {
			templtcgBreakUp13 = zeroOrMore(templtcgBreakUp13 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp6) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp6;
			templtcgBreakUp6 = 0;
		} else {
			templtcgBreakUp6 = zeroOrMore(templtcgBreakUp6 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp14) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp14;
			templtcgBreakUp14 = 0;
		} else {
			templtcgBreakUp14 = zeroOrMore(templtcgBreakUp14 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}
		if (tempLtcgCFL > templtcgBreakUp9) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp9;
			templtcgBreakUp9 = 0;
		} else {
			templtcgBreakUp9 = zeroOrMore(templtcgBreakUp9 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp11) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp11;
			templtcgBreakUp11 = 0;
		} else {
			templtcgBreakUp11 = zeroOrMore(templtcgBreakUp11 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		// setting the "adjustment of above losses in BFLA" - LTCG value in CFL

		document
				.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.ltcgLossCFTotal')[0].value = parseInt(
				zeroOrMore(parseInt(ltcgBreakUp1, 10) - templtcgBreakUp1), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp2, 10)
						- templtcgBreakUp2), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp12, 10)
						- templtcgBreakUp12), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp3, 10)
						- templtcgBreakUp3), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp4, 10)
						- templtcgBreakUp4), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp5, 10)
						- templtcgBreakUp5), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp6, 10)
						- templtcgBreakUp6), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp13, 10)
						- templtcgBreakUp13), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp14, 10)
						- templtcgBreakUp14), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp9, 10)
						- templtcgBreakUp9), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp10, 10)
						- templtcgBreakUp10), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp11, 10)
						- templtcgBreakUp11), 10);

		var storeSTCG1 = tempstcgBreakUp1;
		var storeSTCG7 = tempstcgBreakUp7;
		var storeSTCG2 = tempstcgBreakUp2;
		var storeSTCG8 = tempstcgBreakUp8;
		var storeLTCG12 = templtcgBreakUp12;
		var storeLTCG1 = templtcgBreakUp1;
		var storeSTCG3 = tempstcgBreakUp3;
		var storeSTCG6 = tempstcgBreakUp6;
		var storeSTCG4 = tempstcgBreakUp4;
		var storeLTCG2 = templtcgBreakUp2;
		var storeLTCG3 = templtcgBreakUp3;
		var storeLTCG4 = templtcgBreakUp4;
		var storeLTCG5 = templtcgBreakUp5;
		var storeLTCG10 = templtcgBreakUp10;
		var storeLTCG13 = templtcgBreakUp13;
		var storeLTCG14 = templtcgBreakUp14;
		var storeLTCG6 = templtcgBreakUp6;
		var storeLTCG9 = templtcgBreakUp9;
		var storeSTCG5 = tempstcgBreakUp5;
		var storeLTCG11 = templtcgBreakUp11;

		// adjusting with STCG

		if (tempstcgCFL > tempstcgBreakUp1) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp1;
			tempstcgBreakUp1 = 0;
		} else {
			tempstcgBreakUp1 = zeroOrMore(tempstcgBreakUp1 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > tempstcgBreakUp7) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp7;
			tempstcgBreakUp7 = 0;
		} else {
			tempstcgBreakUp7 = zeroOrMore(tempstcgBreakUp7 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > tempstcgBreakUp2) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp2;
			tempstcgBreakUp2 = 0;
		} else {
			tempstcgBreakUp2 = zeroOrMore(tempstcgBreakUp2 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > tempstcgBreakUp8) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp8;
			tempstcgBreakUp8 = 0;
		} else {
			tempstcgBreakUp8 = zeroOrMore(tempstcgBreakUp8 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp12) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp12;
			templtcgBreakUp12 = 0;
		} else {
			templtcgBreakUp12 = zeroOrMore(templtcgBreakUp12 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp1) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp1;
			templtcgBreakUp1 = 0;
		} else {
			templtcgBreakUp1 = zeroOrMore(templtcgBreakUp1 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > tempstcgBreakUp3) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp3;
			tempstcgBreakUp3 = 0;
		} else {
			tempstcgBreakUp3 = zeroOrMore(tempstcgBreakUp3 - tempstcgCFL);
			tempstcgCFL = 0;
		}
		if (tempstcgCFL > tempstcgBreakUp6) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp6;
			tempstcgBreakUp6 = 0;
		} else {
			tempstcgBreakUp6 = zeroOrMore(tempstcgBreakUp6 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > tempstcgBreakUp4) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp4;
			tempstcgBreakUp4 = 0;
		} else {
			tempstcgBreakUp4 = zeroOrMore(tempstcgBreakUp4 - tempstcgCFL);
			tempstcgCFL = 0;
		}
		if (tempstcgCFL > templtcgBreakUp2) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp2;
			templtcgBreakUp2 = 0;
		} else {
			templtcgBreakUp2 = zeroOrMore(templtcgBreakUp2 - tempstcgCFL);
			tempstcgCFL = 0;
		}
		if (tempstcgCFL > templtcgBreakUp3) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp3;
			templtcgBreakUp3 = 0;
		} else {
			templtcgBreakUp3 = zeroOrMore(templtcgBreakUp3 - tempstcgCFL);
			tempstcgCFL = 0;
		}
		if (tempstcgCFL > templtcgBreakUp4) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp4;
			templtcgBreakUp4 = 0;
		} else {
			templtcgBreakUp4 = zeroOrMore(templtcgBreakUp4 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp5) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp5;
			templtcgBreakUp5 = 0;
		} else {
			templtcgBreakUp5 = zeroOrMore(templtcgBreakUp5 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp10) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp10;
			templtcgBreakUp10 = 0;
		} else {
			templtcgBreakUp10 = zeroOrMore(templtcgBreakUp10 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp13) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp13;
			templtcgBreakUp13 = 0;
		} else {
			templtcgBreakUp13 = zeroOrMore(templtcgBreakUp13 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp6) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp6;
			templtcgBreakUp6 = 0;
		} else {
			templtcgBreakUp6 = zeroOrMore(templtcgBreakUp6 - tempstcgCFL);
			tempstcgCFL = 0;
		}
		if (tempstcgCFL > templtcgBreakUp14) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp14;
			templtcgBreakUp14 = 0;
		} else {
			templtcgBreakUp14 = zeroOrMore(templtcgBreakUp14 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp9) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp9;
			templtcgBreakUp9 = 0;
		} else {
			templtcgBreakUp9 = zeroOrMore(templtcgBreakUp9 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > tempstcgBreakUp5) {
			tempstcgCFL = tempstcgCFL - tempstcgBreakUp5;
			tempstcgBreakUp5 = 0;
		} else {
			tempstcgBreakUp5 = zeroOrMore(tempstcgBreakUp5 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		if (tempstcgCFL > templtcgBreakUp11) {
			tempstcgCFL = tempstcgCFL - templtcgBreakUp11;
			templtcgBreakUp11 = 0;
		} else {
			templtcgBreakUp11 = zeroOrMore(templtcgBreakUp11 - tempstcgCFL);
			tempstcgCFL = 0;
		}

		// adjusting with LTCG

		if (tempLtcgCFL > templtcgBreakUp12) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp12;
			templtcgBreakUp12 = 0;
		} else {
			templtcgBreakUp12 = zeroOrMore(templtcgBreakUp12 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp1) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp1;
			templtcgBreakUp1 = 0;
		} else {
			templtcgBreakUp1 = zeroOrMore(templtcgBreakUp1 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp2) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp2;
			templtcgBreakUp2 = 0;
		} else {
			templtcgBreakUp2 = zeroOrMore(templtcgBreakUp2 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}
		if (tempLtcgCFL > templtcgBreakUp3) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp3;
			templtcgBreakUp3 = 0;
		} else {
			templtcgBreakUp3 = zeroOrMore(templtcgBreakUp3 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp4) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp4;
			templtcgBreakUp4 = 0;
		} else {
			templtcgBreakUp4 = zeroOrMore(templtcgBreakUp4 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp5) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp5;
			templtcgBreakUp5 = 0;
		} else {
			templtcgBreakUp5 = zeroOrMore(templtcgBreakUp5 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}
		if (tempLtcgCFL > templtcgBreakUp10) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp10;
			templtcgBreakUp10 = 0;
		} else {
			templtcgBreakUp10 = zeroOrMore(templtcgBreakUp10 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp13) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp13;
			templtcgBreakUp13 = 0;
		} else {
			templtcgBreakUp13 = zeroOrMore(templtcgBreakUp13 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp6) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp6;
			templtcgBreakUp6 = 0;
		} else {
			templtcgBreakUp6 = zeroOrMore(templtcgBreakUp6 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}
		if (tempLtcgCFL > templtcgBreakUp14) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp14;
			templtcgBreakUp14 = 0;
		} else {
			templtcgBreakUp14 = zeroOrMore(templtcgBreakUp14 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}
		if (tempLtcgCFL > templtcgBreakUp9) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp9;
			templtcgBreakUp9 = 0;
		} else {
			templtcgBreakUp9 = zeroOrMore(templtcgBreakUp9 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		if (tempLtcgCFL > templtcgBreakUp11) {
			tempLtcgCFL = tempLtcgCFL - templtcgBreakUp11;
			templtcgBreakUp11 = 0;
		} else {
			templtcgBreakUp11 = zeroOrMore(templtcgBreakUp11 - tempLtcgCFL);
			tempLtcgCFL = 0;
		}

		document
				.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = parseInt(
				zeroOrMore(parseInt(stcgBreakUp1, 10) - tempstcgBreakUp1), 10)
				+ parseInt(zeroOrMore(parseInt(stcgBreakUp7, 10)
						- tempstcgBreakUp7), 10);

		document
				.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = parseInt(
				zeroOrMore(parseInt(stcgBreakUp2, 10) - tempstcgBreakUp2), 10)
				+ parseInt(zeroOrMore(parseInt(stcgBreakUp8, 10)
						- tempstcgBreakUp8), 10);

		document
				.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = parseInt(
				zeroOrMore(parseInt(stcgBreakUp3, 10) - tempstcgBreakUp3), 10)
				+ parseInt(zeroOrMore(parseInt(stcgBreakUp6, 10)
						- tempstcgBreakUp6), 10)
				+ parseInt(zeroOrMore(parseInt(stcgBreakUp4, 10)
						- tempstcgBreakUp4), 10);

		document
				.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = parseInt(
				zeroOrMore(parseInt(ltcgBreakUp1, 10) - templtcgBreakUp1), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp12, 10)
						- templtcgBreakUp12), 10);

		document
				.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = parseInt(
				zeroOrMore(parseInt(ltcgBreakUp2, 10) - templtcgBreakUp2), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp3, 10)
						- templtcgBreakUp3), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp4, 10)
						- templtcgBreakUp4), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp5, 10)
						- templtcgBreakUp5), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp10, 10)
						- templtcgBreakUp10), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp13, 10)
						- templtcgBreakUp13), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp14, 10)
						- templtcgBreakUp14), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp6, 10)
						- templtcgBreakUp6), 10)
				+ parseInt(zeroOrMore(parseInt(ltcgBreakUp9, 10)
						- templtcgBreakUp9), 10);

		document
				.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = parseInt(
				zeroOrMore(parseInt(stcgBreakUp5, 10) - tempstcgBreakUp5), 10);

		document
				.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff')[0].value = parseInt(
				zeroOrMore(parseInt(ltcgBreakUp11, 10) - templtcgBreakUp11), 10);

		document
				.getElementsByName('scheduleCFL.adjTotBFLossInBFLA.lossSummaryDetail.stcgLossCFTotal')[0].value = parseInt(
				zeroOrMore(storeSTCG1 - tempstcgBreakUp1), 10)
				+ parseInt(zeroOrMore(storeSTCG2 - tempstcgBreakUp2), 10)
				+ parseInt(zeroOrMore(storeSTCG3 - tempstcgBreakUp3), 10)
				+ parseInt(zeroOrMore(storeSTCG4 - tempstcgBreakUp4), 10)
				+ parseInt(zeroOrMore(storeLTCG1 - templtcgBreakUp1), 10)
				+ parseInt(zeroOrMore(storeLTCG2 - templtcgBreakUp2), 10)
				+ parseInt(zeroOrMore(storeLTCG3 - templtcgBreakUp3), 10)
				+ parseInt(zeroOrMore(storeLTCG4 - templtcgBreakUp4), 10)
				+ parseInt(zeroOrMore(storeLTCG5 - templtcgBreakUp5), 10)
				+ parseInt(zeroOrMore(storeLTCG6 - templtcgBreakUp6), 10)
				+ parseInt(zeroOrMore(storeSTCG7 - tempstcgBreakUp7), 10)
				+ parseInt(zeroOrMore(storeSTCG8 - tempstcgBreakUp8), 10)
				+ parseInt(zeroOrMore(storeLTCG12 - templtcgBreakUp12), 10)
				+ parseInt(zeroOrMore(storeSTCG6 - tempstcgBreakUp6), 10)
				+ parseInt(zeroOrMore(storeLTCG10 - templtcgBreakUp10), 10)
				+ parseInt(zeroOrMore(storeLTCG13 - templtcgBreakUp13), 10)
				+ parseInt(zeroOrMore(storeLTCG14 - templtcgBreakUp14), 10)
				+ parseInt(zeroOrMore(storeLTCG9 - templtcgBreakUp9), 10)
				+ parseInt(zeroOrMore(storeSTCG5 - tempstcgBreakUp5), 10)
				+ parseInt(zeroOrMore(storeLTCG11 - templtcgBreakUp11), 10);

		var totalUDDeprctn = document
				.getElementsByName('itrScheduleUD.totalamtDepCurYr')[0].value;

		var busProfSpecProfset = coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		if (busProfSpecProfset > 0) {
			if (busProfSpecProfset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.bfUnabsorbedDeprSetoff')[0].value = busProfSpecProfset;
				totalUDDeprctn = totalUDDeprctn - busProfSpecProfset;

			} else {
				document
						.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		var Speculativeset = coalescePath('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (Speculativeset > 0) {
			if (Speculativeset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = Speculativeset;
				totalUDDeprctn = totalUDDeprctn - Speculativeset;

			} else {
				document
						.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		var specifiedSet = coalescePath('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (specifiedSet > 0) {
			if (specifiedSet <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = specifiedSet;
				totalUDDeprctn = totalUDDeprctn - specifiedSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}
		var profitGainUs115B = coalescePath('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (profitGainUs115B > 0) {
			if (profitGainUs115B <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = profitGainUs115B;
				totalUDDeprctn = totalUDDeprctn - profitGainUs115B;

			} else {
				document
						.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}
		var hpset = coalescePath('scheduleBFLA.hp.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.hp.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (hpset > 0) {
			if (hpset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.hp.incBFLA.bfUnabsorbedDeprSetoff')[0].value = hpset;
				totalUDDeprctn = totalUDDeprctn - hpset;

			} else {
				document
						.getElementsByName('scheduleBFLA.hp.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.hp.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}
		document
				.getElementsByName('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0].value = coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead')
				- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')
				- coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff');
		document
				.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff');

		// xiii APPLICA
		var otherSrcset = coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA');
		if (otherSrcset > 0) {
			if (otherSrcset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')[0].value = otherSrcset;
				totalUDDeprctn = totalUDDeprctn - otherSrcset;

			} else {
				document
						.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}
		// xiv RACE HORSE
		var profitOwnset = coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (profitOwnset > 0) {

			if (profitOwnset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')[0].value = profitOwnset;
				totalUDDeprctn = totalUDDeprctn - profitOwnset;

			} else {
				document
						.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}
		// xv OS DTAA
		var otherSrcDtaasetOff = coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA');
		if (otherSrcDtaasetOff > 0) {
			if (otherSrcDtaasetOff <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')[0].value = otherSrcDtaasetOff;
				totalUDDeprctn = totalUDDeprctn - otherSrcDtaasetOff;

			} else {
				document
						.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		// 1
		var stcg30Perset = coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (stcg30Perset > 0) {
			if (stcg30Perset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = stcg30Perset;
				totalUDDeprctn = totalUDDeprctn - stcg30Perset;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		var stcgAppset = coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (stcgAppset > 0) {
			if (stcgAppset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff')[0].value = stcgAppset;
				totalUDDeprctn = totalUDDeprctn - stcgAppset;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		var ltcg20Perset = coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (ltcg20Perset > 0) {
			if (ltcg20Perset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = ltcg20Perset;
				totalUDDeprctn = totalUDDeprctn - ltcg20Perset;

			} else {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		var stcg15Perset = coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (stcg15Perset > 0) {
			if (stcg15Perset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = stcg15Perset;
				totalUDDeprctn = totalUDDeprctn - stcg15Perset;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		var ltcg10Perset = coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (ltcg10Perset > 0) {
			if (ltcg10Perset <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = ltcg10Perset;
				totalUDDeprctn = totalUDDeprctn - ltcg10Perset;

			} else {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;
		}

		var profitstcgDtaa = coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (profitstcgDtaa > 0) {
			if (profitstcgDtaa <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')[0].value = profitstcgDtaa;
				totalUDDeprctn = totalUDDeprctn - profitstcgDtaa;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {

			document
					.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		var profitltcgDtaa = coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff');
		if (profitltcgDtaa > 0) {
			if (profitltcgDtaa <= totalUDDeprctn) {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')[0].value = profitltcgDtaa;
				totalUDDeprctn = totalUDDeprctn - profitltcgDtaa;

			} else {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')[0].value = totalUDDeprctn;
				totalUDDeprctn = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')[0].value = 0;

		}

		// calculating sum of column 3
		document
				.getElementsByName('scheduleBFLA.totalBFLossSetOff.totUnabsorbedDeprSetoff')[0].value = coalescePath('scheduleBFLA.hp.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.profitgainInc.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.speculativeInc.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.specifiedInc.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')
		coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')
				+
				/*
				 * coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')+
				 */coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff');
		;

		// checking max limits of "Brought forward depreciation set off" ---
		// column 4

		var busProfSpecAllwnceSet = (coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bfUnabsorbedDeprSetoff'));
		var totalUDAllwnce = document
				.getElementsByName('itrScheduleUD.amountASACYIncome')[0].value;

		if (busProfSpecAllwnceSet > 0) {
			if (busProfSpecAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.bfAllUs35Cl4Setoff')[0].value = busProfSpecAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - busProfSpecAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;
			}
		} else {
			document
					.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}

		var SpeculatvAllwnceSet = (coalescePath('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.speculativeInc.incBFLA.bfUnabsorbedDeprSetoff'));

		if (SpeculatvAllwnceSet > 0) {
			if (SpeculatvAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = SpeculatvAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - SpeculatvAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}

		var SpecfiedAllwnceSet = (coalescePath('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.specifiedInc.incBFLA.bfUnabsorbedDeprSetoff'));

		if (SpecfiedAllwnceSet > 0) {
			if (SpecfiedAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = SpecfiedAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - SpecfiedAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}

		var profitGainUs115B = (coalescePath('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.profitgainInc.incBFLA.bfUnabsorbedDeprSetoff'));
		if (profitGainUs115B > 0) {
			if (profitGainUs115B <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = profitGainUs115B;
				totalUDAllwnce = totalUDAllwnce - profitGainUs115B;

			} else {
				document
						.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;

		}

		var hpAllwnceSet = (coalescePath('scheduleBFLA.hp.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.hp.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.hp.incBFLA.bfUnabsorbedDeprSetoff'));

		if (hpAllwnceSet > 0) {
			if (hpAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.hp.incBFLA.bfAllUs35Cl4Setoff')[0].value = hpAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - hpAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.hp.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.hp.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		// xiii os APPLICABLE RATES
		var othrSrcAllwnceSet = (coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA') - coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfUnabsorbedDeprSetoff'));

		if (othrSrcAllwnceSet > 0) {
			if (othrSrcAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfAllUs35Cl4Setoff')[0].value = othrSrcAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - othrSrcAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		// xiv os RACE
		var profitAllwnceSet = (coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfUnabsorbedDeprSetoff'));

		if (profitAllwnceSet > 0) {
			if (profitAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfAllUs35Cl4Setoff')[0].value = profitAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - profitAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}

		// xv Os dtaa
		var othrSrcdtaaSet = (coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA') - coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff'));

		if (othrSrcdtaaSet > 0) {
			if (othrSrcdtaaSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value = othrSrcdtaaSet;
				totalUDAllwnce = totalUDAllwnce - othrSrcdtaaSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}

		// 1
		var stcg30PerAllwnceSet = (coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff'));

		if (stcg30PerAllwnceSet > 0) {
			if (stcg30PerAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = stcg30PerAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - stcg30PerAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		// stcg app rate
		var stcgAppAllwnceSet = (coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff'));

		if (stcgAppAllwnceSet > 0) {
			if (stcgAppAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfAllUs35Cl4Setoff')[0].value = stcgAppAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - stcgAppAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		/*
		 * //stcg dtaa var profitstcgSet =
		 * (coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA') -
		 * coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff') -
		 * coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff'));
		 * 
		 * if (profitstcgSet > 0) { if (profitstcgSet <= totalUDAllwnce) {
		 * document
		 * .getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff')[0].value =
		 * profitstcgSet; totalUDAllwnce = totalUDAllwnce - profitstcgSet;
		 *  } else { document
		 * .getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff')[0].value =
		 * totalUDAllwnce; totalUDAllwnce = 0;
		 *  } } else { document
		 * .getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff')[0].value =
		 * 0; } //ltcg dtaa var profitltcgSet =
		 * (coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA') -
		 * coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff') -
		 * coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff'));
		 * 
		 * if (profitltcgSet > 0) { if (profitltcgSet <= totalUDAllwnce) {
		 * document
		 * .getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value =
		 * profitltcgSet; totalUDAllwnce = totalUDAllwnce - profitltcgSet;
		 *  } else { document
		 * .getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value =
		 * totalUDAllwnce; totalUDAllwnce = 0;
		 *  } } else { document
		 * .getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value =
		 * 0; }
		 */
		// ltcg 20
		var ltcg20PerAllwnceSet = (coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff'));

		if (ltcg20PerAllwnceSet > 0) {
			if (ltcg20PerAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = ltcg20PerAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - ltcg20PerAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		// stcg 15
		var stcg15PerAllwnceSet = (coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff'));

		if (stcg15PerAllwnceSet > 0) {
			if (stcg15PerAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = stcg15PerAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - stcg15PerAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		// ltcg 10
		var ltcg10PerAllwnceSet = (coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff'));

		if (ltcg10PerAllwnceSet > 0) {
			if (ltcg10PerAllwnceSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = ltcg10PerAllwnceSet;
				totalUDAllwnce = totalUDAllwnce - ltcg10PerAllwnceSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		// STCG dtaa
		var profitstcgSet = (coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff'));

		if (profitstcgSet > 0) {
			if (profitstcgSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff')[0].value = profitstcgSet;
				totalUDAllwnce = totalUDAllwnce - profitstcgSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}
		// LTCG dtaa
		var profitltcgSet = (coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff') - coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff'));

		if (profitltcgSet > 0) {
			if (profitltcgSet <= totalUDAllwnce) {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value = profitltcgSet;
				totalUDAllwnce = totalUDAllwnce - profitltcgSet;

			} else {
				document
						.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value = totalUDAllwnce;
				totalUDAllwnce = 0;

			}
		} else {
			document
					.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff')[0].value = 0;
		}

		// calculating the income after setOff
		document
				.getElementsByName('scheduleBFLA.hp.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.hp.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.hp.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.hp.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.hp.incBFLA.bfAllUs35Cl4Setoff');

		document
				.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.profitgainInc.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.profitgainInc.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.speculativeInc.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.speculativeInc.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.specifiedInc.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.specifiedInc.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfAllUs35Cl4Setoff');

		document
				.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfAllUs35Cl4Setoff');

		document
				.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff');

		document
				.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfAllUs35Cl4Setoff');

		document
				.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff');
		document
				.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses')[0].value = coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')
				- coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				- coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfAllUs35Cl4Setoff');

		// Total of brought forward loss set off
		document
				.getElementsByName('scheduleBFLA.totalBFLossSetOff.totBFLossSetoff')[0].value = coalescePath('scheduleBFLA.hp.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.profitgainInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.speculativeInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.specifiedInc.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bFlossPrevYrUndSameHeadSetoff')
				+ coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bFlossPrevYrUndSameHeadSetoff');

		document
				.getElementsByName('scheduleBFLA.totalBFLossSetOff.totUnabsorbedDeprSetoff')[0].value = coalescePath('scheduleBFLA.hp.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.profitgainInc.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.speculativeInc.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.specifiedInc.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfUnabsorbedDeprSetoff');

		document
				.getElementsByName('scheduleBFLA.totalBFLossSetOff.totAllUs35Cl4Setoff')[0].value = coalescePath('scheduleBFLA.hp.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.profitgainInc.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.speculativeInc.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.specifiedInc.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.bfAllUs35Cl4Setoff')
				+ coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.bfAllUs35Cl4Setoff');

		// x :: sum
		document.getElementsByName('scheduleBFLA.incomeOfCurrYrAftCYLABFLA')[0].value = coalescePath('scheduleBFLA.hp.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses')
				+ coalescePath('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrAfterSetOffBFLosses');

		var sumUD35_4_stcg15Per = coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg15Per.incBFLA.bfAllUs35Cl4Setoff');
		var sumUD35_4_stcg30Per = coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcg30Per.incBFLA.bfAllUs35Cl4Setoff');
		var sumUD35_4_stcgAppPer = coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgAppRate.incBFLA.bfAllUs35Cl4Setoff');
		var sumUD35_4_ltcg20Per = coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg20Per.incBFLA.bfAllUs35Cl4Setoff');
		var sumUD35_4_ltcg10Per = coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcg10Per.incBFLA.bfAllUs35Cl4Setoff');
		var sumUD35_4_stcgDtaa = coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.stcg.stcgDTAARate.incBFLA.bfAllUs35Cl4Setoff');
		var sumUD35_4_ltcgDtaa = coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfUnabsorbedDeprSetoff')
				+ coalescePath('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.bfAllUs35Cl4Setoff');
		if (sumUD35_4_stcg30Per > tempstcgBreakUp1) {
			sumUD35_4_stcg30Per = sumUD35_4_stcg30Per - tempstcgBreakUp1;
			tempstcgBreakUp1 = 0;
		} else {
			tempstcgBreakUp1 = zeroOrMore(tempstcgBreakUp1
					- sumUD35_4_stcg30Per);
			sumUD35_4_stcg30Per = 0;
		}
		if (sumUD35_4_stcg30Per > tempstcgBreakUp7) {
			sumUD35_4_stcg30Per = sumUD35_4_stcg30Per - tempstcgBreakUp7;
			tempstcgBreakUp7 = 0;
		} else {
			tempstcgBreakUp7 = zeroOrMore(tempstcgBreakUp7
					- sumUD35_4_stcg30Per);
			sumUD35_4_stcg30Per = 0;
		}

		if (sumUD35_4_stcgAppPer > tempstcgBreakUp2) {
			sumUD35_4_stcgAppPer = sumUD35_4_stcgAppPer - tempstcgBreakUp2;
			tempstcgBreakUp2 = 0;
		} else {
			tempstcgBreakUp2 = zeroOrMore(tempstcgBreakUp2
					- sumUD35_4_stcgAppPer);
			sumUD35_4_stcgAppPer = 0;
		}
		if (sumUD35_4_stcgAppPer > tempstcgBreakUp8) {
			sumUD35_4_stcgAppPer = sumUD35_4_stcgAppPer - tempstcgBreakUp8;
			tempstcgBreakUp8 = 0;
		} else {
			tempstcgBreakUp8 = zeroOrMore(tempstcgBreakUp8
					- sumUD35_4_stcgAppPer);
			sumUD35_4_stcgAppPer = 0;
		}

		if (sumUD35_4_ltcg20Per > templtcgBreakUp12) {
			sumUD35_4_ltcg20Per = sumUD35_4_ltcg20Per - templtcgBreakUp12;
			templtcgBreakUp12 = 0;
		} else {
			templtcgBreakUp12 = zeroOrMore(templtcgBreakUp12
					- sumUD35_4_ltcg20Per);
			sumUD35_4_ltcg20Per = 0;
		}
		if (sumUD35_4_ltcg20Per > templtcgBreakUp1) {
			sumUD35_4_ltcg20Per = sumUD35_4_ltcg20Per - templtcgBreakUp1;
			templtcgBreakUp1 = 0;
		} else {
			templtcgBreakUp1 = zeroOrMore(templtcgBreakUp1
					- sumUD35_4_ltcg20Per);
			sumUD35_4_ltcg20Per = 0;
		}

		if (sumUD35_4_stcg15Per > tempstcgBreakUp3) {
			sumUD35_4_stcg15Per = sumUD35_4_stcg15Per - tempstcgBreakUp3;
			tempstcgBreakUp3 = 0;
		} else {
			tempstcgBreakUp3 = zeroOrMore(tempstcgBreakUp3
					- sumUD35_4_stcg15Per);
			sumUD35_4_stcg15Per = 0;
		}
		if (sumUD35_4_stcg15Per > tempstcgBreakUp6) {
			sumUD35_4_stcg15Per = sumUD35_4_stcg15Per - tempstcgBreakUp6;
			tempstcgBreakUp6 = 0;
		} else {
			tempstcgBreakUp6 = zeroOrMore(tempstcgBreakUp6
					- sumUD35_4_stcg15Per);
			sumUD35_4_stcg15Per = 0;
		}

		if (sumUD35_4_stcg15Per > tempstcgBreakUp4) {
			sumUD35_4_stcg15Per = sumUD35_4_stcg15Per - tempstcgBreakUp4;
			tempstcgBreakUp4 = 0;
		} else {
			tempstcgBreakUp4 = zeroOrMore(tempstcgBreakUp4
					- sumUD35_4_stcg15Per);
			sumUD35_4_stcg15Per = 0;
		}

		// adjusting STCG first

		if (sumUD35_4_ltcg10Per > templtcgBreakUp2) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp2;
			templtcgBreakUp2 = 0;
		} else {
			templtcgBreakUp2 = zeroOrMore(templtcgBreakUp2
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}
		if (sumUD35_4_ltcg10Per > templtcgBreakUp3) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp3;
			templtcgBreakUp3 = 0;
		} else {
			templtcgBreakUp3 = zeroOrMore(templtcgBreakUp3
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}
		if (sumUD35_4_ltcg10Per > templtcgBreakUp4) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp4;
			templtcgBreakUp4 = 0;
		} else {
			templtcgBreakUp4 = zeroOrMore(templtcgBreakUp4
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}

		if (sumUD35_4_ltcg10Per > templtcgBreakUp5) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp5;
			templtcgBreakUp5 = 0;
		} else {
			templtcgBreakUp5 = zeroOrMore(templtcgBreakUp5
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}

		if (sumUD35_4_ltcg10Per > templtcgBreakUp10) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp10;
			templtcgBreakUp10 = 0;
		} else {
			templtcgBreakUp10 = zeroOrMore(templtcgBreakUp10
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}
		if (sumUD35_4_ltcg10Per > templtcgBreakUp13) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp13;
			templtcgBreakUp13 = 0;
		} else {
			templtcgBreakUp13 = zeroOrMore(templtcgBreakUp13
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}

		if (sumUD35_4_ltcg10Per > templtcgBreakUp6) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp6;
			templtcgBreakUp6 = 0;
		} else {
			templtcgBreakUp6 = zeroOrMore(templtcgBreakUp6
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}
		if (sumUD35_4_ltcg10Per > templtcgBreakUp14) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp14;
			templtcgBreakUp14 = 0;
		} else {
			templtcgBreakUp14 = zeroOrMore(templtcgBreakUp14
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}
		if (sumUD35_4_ltcg10Per > templtcgBreakUp9) {
			sumUD35_4_ltcg10Per = sumUD35_4_ltcg10Per - templtcgBreakUp9;
			templtcgBreakUp9 = 0;
		} else {
			templtcgBreakUp9 = zeroOrMore(templtcgBreakUp9
					- sumUD35_4_ltcg10Per);
			sumUD35_4_ltcg10Per = 0;
		}

		if (sumUD35_4_stcgDtaa > tempstcgBreakUp5) {
			sumUD35_4_stcgDtaa = sumUD35_4_stcgDtaa - tempstcgBreakUp5;
			tempstcgBreakUp5 = 0;
		} else {
			tempstcgBreakUp5 = zeroOrMore(tempstcgBreakUp5 - sumUD35_4_stcgDtaa);
			sumUD35_4_stcgDtaa = 0;
		}

		if (sumUD35_4_ltcgDtaa > templtcgBreakUp11) {
			sumUD35_4_ltcgDtaa = sumUD35_4_ltcgDtaa - templtcgBreakUp11;
			templtcgBreakUp11 = 0;
		} else {
			templtcgBreakUp11 = zeroOrMore(templtcgBreakUp11
					- sumUD35_4_ltcgDtaa);
			sumUD35_4_ltcgDtaa = 0;
		}

		cgosIncome.cgInc.stcg.prctg30.sec115AD = tempstcgBreakUp1;
		cgosIncome.cgInc.stcg.prctg30.secPti = tempstcgBreakUp7;
		cgosIncome.cgInc.stcg.prctgAr.stcgApp = tempstcgBreakUp2;
		cgosIncome.cgInc.stcg.prctgAr.secPti = tempstcgBreakUp8;
		cgosIncome.cgInc.stcg.prctg15.sec115ad_1_b_ii = tempstcgBreakUp3;
		cgosIncome.cgInc.stcg.prctg15.secPti = tempstcgBreakUp6;
		cgosIncome.cgInc.stcg.prctg15.sec111a = tempstcgBreakUp4;
		cgosIncome.cgInc.ltcg.prctg20.sec112 = templtcgBreakUp1;
		cgosIncome.cgInc.ltcg.prctg10.sec112_1_c_2 = templtcgBreakUp2;
		cgosIncome.cgInc.ltcg.prctg20.secPti = templtcgBreakUp12;
		cgosIncome.cgInc.ltcg.prctg10.sec115_AB_1_B = templtcgBreakUp3;
		cgosIncome.cgInc.ltcg.prctg10.sec115AC_1 = templtcgBreakUp4;
		cgosIncome.cgInc.ltcg.prctg10.sec115AD_3 = templtcgBreakUp5;
		cgosIncome.cgInc.ltcg.prctg10.secProviso = templtcgBreakUp6;
		cgosIncome.cgInc.ltcg.prctg10.secPti = templtcgBreakUp13;
		cgosIncome.cgInc.ltcg.prctg10.secPti112A = templtcgBreakUp14;
		cgosIncome.cgInc.ltcg.prctg10.sec112A = templtcgBreakUp9;
		cgosIncome.cgInc.ltcg.prctg10.sec115ADiiiP = templtcgBreakUp10;

		calcCFL(specltvIncSetOff, specfdIncSetOff,bfla115B);

	} catch (e) {
		alert('error in calcBFLA' + e.stack);
	}

}
function setFirstToSecondMaxMod(first, second, target) {
	try {
		if (coalesce(first) > coalesceSetRet(second)) {
			document.getElementsByName(target)[0].value = coalesceSetRet(second);
		} else {
			document.getElementsByName(target)[0].value = coalesce(first);
		}

	} catch (e) {
		alert('error in setFirstToSecondMaxMod= ' + e.stack);
	}
}

function setFirstToSecondMax(first, second, target) {
	try {
		if (coalesceSetRet(first) > coalesceSetRet(second)) {
			document.getElementsByName(target)[0].value = coalesceSetRet(second);
		} else {
			document.getElementsByName(target)[0].value = coalesceSetRet(first);
		}

	} catch (e) {
		// alert('error in setFirstToSecondMax= ' + e.stack);
	}
}

function prefillBFLA() {
	try {

		document
				.getElementsByName('scheduleBFLA.hp.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.houseProperty.incCYLA.incOfCurYrAfterSetOff');
		document
				.getElementsByName('scheduleBFLA.busProfInclSpecProf.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff');
		document
				.getElementsByName('scheduleBFLA.profitgainInc.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.profitgainsInc.incCYLA.incOfCurYrAfterSetOff');
		document
				.getElementsByName('scheduleBFLA.speculativeInc.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.speculativeInc.incCYLA.incOfCurYrAfterSetOff');
		document
				.getElementsByName('scheduleBFLA.specifiedInc.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.specifiedInc.incCYLA.incOfCurYrAfterSetOff');
		document
				.getElementsByName('scheduleBFLA.stcg.stcg15Per.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.stcg.stcg15Per.incCYLA.incOfCurYrAfterSetOff');// 4iv
																																															// of
																																															// CYLA
																																															// -->
																																															// 3i
																																															// of
																																															// BFLA
		document
				.getElementsByName('scheduleBFLA.stcg.stcg30Per.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.stcg.stcg30Per.incCYLA.incOfCurYrAfterSetOff');// 4v
																																															// of
																																															// CYLA
																																															// -->
																																															// 4i
																																															// of
																																															// BFLA
		document
				.getElementsByName('scheduleBFLA.stcg.stcgAppRate.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.stcg.stcgAppRate.incCYLA.incOfCurYrAfterSetOff');// 4Vi
																																																// of
																																																// CYLA
																																																// -->
																																																// 5i
																																																// of
																																																// BFLA
		document
				.getElementsByName('scheduleBFLA.ltcg.ltcg10Per.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.ltcg.ltcg10Per.incCYLA.incOfCurYrAfterSetOff');// 4Vii
																																															// of
																																															// CYLA
																																															// -->
																																															// 6i
																																															// of
																																															// BFLA
		document
				.getElementsByName('scheduleBFLA.ltcg.ltcg20Per.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.ltcg.ltcg20Per.incCYLA.incOfCurYrAfterSetOff');// 4Viii
																																															// of
																																															// CYLA
																																															// -->
																																															// 7i
																																															// of
																																															// BFLA
		document
				.getElementsByName('scheduleBFLA.othSrcInclRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff');
		document
				.getElementsByName('scheduleBFLA.profitFrmRaceHorse.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrAfterSetOff');
		document
				.getElementsByName('scheduleBFLA.stcg.stcgDTAARate.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.stcg.stcgDTAARate.incCYLA.incOfCurYrAfterSetOff');// 4Vii
		document
				.getElementsByName('scheduleBFLA.ltcg.ltcgDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.ltcg.ltcgDTAARate.incCYLA.incOfCurYrAfterSetOff');// 
		document
				.getElementsByName('scheduleBFLA.othSrcDtaaRates.incBFLA.incOfCurYrUndHeadFromCYLA')[0].value = coalescePath('scheduleCYLA.otherSourceDtaa.incCYLA.incOfCurYrAfterSetOff');// 4Vii

	} catch (e) {
		alert('error in prefillBFLA' + e.stack);
	}
}

function adjustForm() {
	try {
		enableField('partAGEN1.orgFirmInfo.domesticCompFlg', 'N',
				'partapl.debitsToPL.debitPlAcnt.grossReceipts',
				'partapl.debitsToPL.debitPlAcnt.netProfit'

				);
		
		enableField('partAGEN2.incomeOnlyUS44', 'N',
				'partAGEN2.incomeExc1cr'
				);
		enableField('partAGEN2.incomeExc1cr', 'Y',
				'partAGEN2.payNtExcd5PerAmt',
				'partAGEN2.payPrevYrNotExcd5PerPmt'
				);
		
		enableField('partAGEN1.filingStatus.residentialStatus', 'NRI',
				'partAGEN1.filingStatus.nripe','partAGEN1.filingStatus.residentsec90'
				);
		enableField('partAGEN1.orgFirmInfo.domesticCompFlg', 'Y',
				'partAGEN1.filingStatus.section115ba',
				'partAGEN1.filingStatus.grossreceipt');
		enableField('partAGEN1.orgFirmInfo.domesticCompFlg', 'N',
				'partAGEN1.filingStatus.registratedlaw');
		enableField('partAGEN1.filingStatus.asseseeRepFlg', 'Y',
				'partAGEN1.filingStatus.assesseeRep.repName',
				'partAGEN1.filingStatus.assesseeRep.repCapacity',
				'partAGEN1.filingStatus.assesseeRep.repAddress',
				'partAGEN1.filingStatus.assesseeRep.repPAN',
				'partAGEN1.filingStatus.assesseeRep.repAadhaar'
				);
		enableField('partAGEN2.liableSec44ABflg', 'Y',
				'partAGEN2.auditedByAccountantFlg');
		/*enableField('partAGEN2.liableSec44ABflg', 'Y',
				'scheduleVIA.usrDeductUndChapVIA.section80JJAA');*/
		enableField('partAGEN2.liableSec92Eflg', 'Y', 'partAGEN2.liableSec92Eflg.accAuditedUs92Eflg');
		enableField('partAGEN2.liableSec92Eflg.accAuditedUs92Eflg', 'Y', 'partAGEN2.sec92Edate');
		enableField('partAGEN2.auditedByAccountantFlg', 'Y',
				'partAGEN2.auditInfo.auditReportFurnishDate',
				'partAGEN2.auditInfo.auditorName',
				'partAGEN2.auditInfo.auditorMemNo',
				'partAGEN2.auditInfo.audFrmName',
				'partAGEN2.auditInfo.audFrmPAN',
				'partAGEN2.auditInfo.audFrmAadhaar',
				'partAGEN2.auditInfo.auditDate',
				'partAGEN2.auditInfo.firmRegNum');

		enableField('partAGEN1.filingStatus.residentialStatus', 'RES',
				'partBTTI.assetOutIndiaFlag');

		enableField(
				'partAGEN1.filingStatus.residentialStatus',
				'RES',
				'itr6ScheduleBP.businessIncOthThanSpec.incRecCredPLOthHeads.us115BBF',
				'itr6ScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads.us115BBF');
		enableField('scheduleTR1.taxPaidOutsideIndFlg', 'YES',
				'scheduleTR1.amtTaxRefunded', 'scheduleTR1.assmtYrTaxRelief');
		enableTable(
				'scheduleCGPost45.shortTermCapGainPost45.unutilizedCapgainFlag',
				'Y', 'scheduleStcgunUtilizedCapGain54');
		enableTable(
				'scheduleCGPost45.LongTermCapGainPost45.unutilizedCapgainFlag',
				'Y', 'scheduleLtcgunUtilizedCapGain54');
		enableNRItables();
		adjustCG();

		adjustDDT();
		adjustBBS();
		ifForeignCmpny();

	} catch (e) {
		alert('Error in adjustForm:' + e);
	}
}

function adjustBBS() {

	var tab = document.getElementById('scheduleBBT');
	var inputs = tab.getElementsByTagName('INPUT');

	if (document.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value == 'Y') {

		for (var i = 0; i < inputs.length; i++) {
			if (inputs[i].getAttribute("readOnly") != 'true') {
				inputs[i].readOnly = false;
			}
		}

		$('#scheduleBBT').find('.addbtn').prop('hidden', false);

	} else {
		for (var i = 0; i < 2; i++) {
			$('#scheduleBBTP1 input').attr("checked", true);
			deleteRowTable('scheduleBBTP1', 0, 2);
			$('#scheduleBBTP1 input').attr("checked", false);
		}
		$('#scheduleBBT input').attr("checked", true);
		// deleteRowTable('scheduleBBTP1',0,2);
		deleteRowTable('scheduleBBT', 3, 1);
		$('#scheduleBBT input').attr("checked", false);
		for (var i = 0; i < inputs.length; i++) {
			if (inputs[i].getAttribute("readOnly") != 'true') {
				inputs[i].readOnly = true;
				inputs[i].value = '';
			}
		}

		$('#scheduleBBT').find('.addbtn').prop('hidden', true);

	}
}

function adjustDDT() {
	var tab = document.getElementById('scheduleDDT');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');

	if (document.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value == 'Y') {

		for (var i = 0; i < inputs.length; i++) {
			if (inputs[i].getAttribute("readOnly") != 'true') {
				inputs[i].readOnly = false;
			}
		}

		$('#scheduleDDT').find('.addbtn').prop('hidden', false);
		// select
		for (var i = 0; i < selects.length; i++) {
			if (selects[i].getAttribute("readOnly") != 'true') {
				selects[i].disabled = false;

			}
		}

		$('#scheduleDDT').find('.addbtn').prop('hidden', false);

	} else {

		$('#scheduleDDT input').attr("checked", true);

		deleteRowTable('scheduleDDT', 3, 1);
		$('#scheduleDDT input').attr("checked", false);

		for (var i = 0; i < inputs.length; i++) {
			if (inputs[i].getAttribute("readOnly") != 'true') {
				inputs[i].readOnly = true;
				inputs[i].value = '';
			}
		}

		$('#scheduleDDT').find('.addbtn').prop('hidden', true);

		// select

		for (var i = 0; i < selects.length; i++) {
			if (selects[i].getAttribute("readOnly") != 'true') {
				selects[i].disabled = true;
				selects[i].value = '';
			}
		}

	}

}

function adjustCG() {

	if (document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value == 'NRI') {
		// A4
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid')[0].readOnly = false;
		// A5
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnia')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnib')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnic')[0].readOnly = true;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnii')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.aquisitCost')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.improveCost')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.expOnTrans')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.lossSec94of7Or94of8')[0].readOnly = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.aquisitCost')[0].readOnly = false;

		// B6
		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIProvisoSec48.BalanceCG')[0].readOnly = false;
		

		// B7
		var tab = document.getElementById('stcg10pctTab');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			if (!(inputs[i].classList.contains("readonly"))) {
				inputs[i].readOnly = false;
			}
		}

		for (var i = 0; i < selects.length; i++) {
			if (!(selects[i].classList.contains("readonly"))) {
				selects[i].disabled = false;
			}

		}
		

	} else {

		// A4
		var nRItaxSTTPaid = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid')[0];
		nRItaxSTTPaid.readOnly = true;
		nRItaxSTTPaid.value = 0;
		var nRItaxSTTNotPaid = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid')[0];
		nRItaxSTTNotPaid.readOnly = true;
		nRItaxSTTNotPaid.value = 0;

		// A5
		var fullConsidtnia = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnia')[0];
		fullConsidtnia.readOnly = true;
		fullConsidtnia.value = 0;
		var fullConsidtnib = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnib')[0];
		fullConsidtnib.readOnly = true;
		fullConsidtnib.value = 0;
		var fullConsidtnic = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnic')[0];
		fullConsidtnic.readOnly = true;
		fullConsidtnic.value = 0;
		var fullConsidtnii = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnii')[0];
		fullConsidtnii.readOnly = true;
		fullConsidtnii.value = 0;
		var fullConsideration = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration')[0];
		fullConsideration.readOnly = true;
		fullConsideration.value = 0;
		var aquisitCost = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.aquisitCost')[0];
		aquisitCost.readOnly = true;
		aquisitCost.value = 0;
		var improveCost = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.improveCost')[0];
		improveCost.readOnly = true;
		improveCost.value = 0;
		var expOnTrans = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.expOnTrans')[0];
		expOnTrans.readOnly = true;
		expOnTrans.value = 0;
		var lossSec94of7Or94of8 = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.lossSec94of7Or94of8')[0];
		lossSec94of7Or94of8.readOnly = true;
		lossSec94of7Or94of8.value = 0;
		var aquisitCost = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.aquisitCost')[0];
		aquisitCost.readOnly = true;
		aquisitCost.value = 0;

		// B6
		var BalanceCG = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIProvisoSec48.BalanceCG')[0];
		BalanceCG.readOnly = true;
		BalanceCG.value = 0;
		

		// B7
		var tab = document.getElementById('stcg10pctTab');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			if (!inputs[i].classList.contains("readonly")) {
				inputs[i].readOnly = true;
				inputs[i].value = '';
			}
		}
		for (var i = 0; i < selects.length; i++) {
			if (!selects[i].classList.contains("readonly")) {
				selects[i].disabled = true;
				selects[i].selectedIndex = 0;
			}
		}

		

	}

}

function removeAuditAllDetails(elem) {
	if (elem.value != 'Y') {
		$('.auditDetailsRow:not(:first)').remove();
		$('.auditDetailsRow').find(':input').val('');
		$('.auditDetailsRow').find(':input').prop('disabled', true);
		$('#auditDetailsButton').find(':button').prop('disabled', true);

	} else {
		$('.auditDetailsRow').find(':input').prop('disabled', false);
		$('#auditDetailsButton').find(':button').prop('disabled', false);
		if ($('.auditDetailsRow').length == 1) {
			$('#deleteAuditBtnId').prop('disabled', true);
		}
	}

}

function onChngState(state, str1, str2) {

	var position = parseInt(state.name.substring(state.name.indexOf("[") + 1,
			state.name.indexOf("]")));

	if (state.value == '99') {
		document.getElementsByName(str1 + '[' + position + '].' + str2)[0].value = '999999';
	} else if (state.value != '99'
			&& document.getElementsByName(str1 + '[' + position + '].' + str2)[0].value == '999999') {
		document.getElementsByName(str1 + '[' + position + '].' + str2)[0].value = '';
	}

}

function checkMembershipNoLength(memberShipNO) {

	if (memberShipNO.value.length == 5) {
		memberShipNO.value = 0 + memberShipNO.value;
	} else if (memberShipNO.value.length == 4) {
		memberShipNO.value = '00' + memberShipNO.value;
	} else if (memberShipNO.value.length == 3) {
		memberShipNO.value = '000' + memberShipNO.value;
	} else if (memberShipNO.value.length == 2) {
		memberShipNO.value = '0000' + memberShipNO.value;
	} else if (memberShipNO.value.length == 1 && memberShipNO.value != 0) {
		memberShipNO.value = '00000' + memberShipNO.value;
	}
}

function firmRegistrationNoLength(firmRegNum) {

	if (firmRegNum.value == "00000000") {
		var regno = document
				.getElementsByName('partAGEN2.auditInfo.firmRegNum')[0];
		addErrorXHTML(
				regno,
				'Please enter valid Registration No. of the proprietorship/firm.',
				true);

	}
}

function validateScheduleHP() {
	var tab = document.getElementById('scheduleHPMain');
	var allInputTags = tab.getElementsByTagName('select');
	var count = 0;
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("ifLetOut$")) {
			if (allInputTags[i].value == "N") {
				if (++count > 2) {
					j
							.setFieldError(
									allInputTags[i].name,
									'Where there is more than one Self occupied House property(SOP) , one of them shall be treated as SOP and all other House properties shall be deemed to be let out');
					break;
				}
			}
		}
	}
}

function validateUD() {
	var tab = document.getElementById('scheduleUD');
	var allInputTags = tab.getElementsByTagName('input');
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amtDepCurYr$")) {
			if (parseInt(allInputTags[i].value, 10) > (parseInt(
					allInputTags[i - 2].value, 10) -parseInt(
							allInputTags[i - 1].value, 10))) {
				j
						.setFieldError(
								allInputTags[i].name,
								'Amount of depreciation set-off against the current year income cannot be more than Amount of brought forward unabsorbed depreciation.');
				addError(
						allInputTags[i],
						'Amount of depreciation set-off against the current year income cannot be more than Amount of brought forward unabsorbed depreciation.',
						true);
			}
		}
		if (allInputTags[i].name.match("amountASACYIncome$")) {
			if (parseInt(allInputTags[i].value, 10) > parseInt(
					allInputTags[i - 1].value, 10)) {
				j
						.setFieldError(
								allInputTags[i].name,
								'Amount of allowance set-off against the current year income cannot exceed amount of brought forward unabsorbed allowance.');
				addError(
						allInputTags[i],
						'Amount of allowance set-off against the current year income cannot exceed amount of brought forward unabsorbed allowance.',
						true);
			}
		}
	}
}
/*
 * function checkDPMDOA(total, depFull, depHalf){ var totalDepreciation =
 * document.getElementsByName(total)[0]; var fullRateDeprAmt =
 * document.getElementsByName(depFull)[0]; var halfRateDeprAmt =
 * document.getElementsByName(depHalf)[0]; if(parseInt(totalDepreciation.value,
 * 10) > parseInt(fullRateDeprAmt.value, 10) + parseInt(halfRateDeprAmt.value,
 * 10)){ j.setFieldError(totalDepreciation.name,'Total depreciation cannot be
 * more than (Amount on which depreciation at full rate to be allowed + Amount
 * on which depreciation at half rate to be allowed)');
 * addErrorXHTML(totalDepreciation,'Total depreciation cannot be more than
 * (Amount on which depreciation at full rate to be allowed + Amount on which
 * depreciation at half rate to be allowed)',true); } }
 * 
 * function validateDPMDOA(){
 * checkDPMDOA('scheduleDPM.plantMachinery.rate15.depreciationDetail.totalDepreciation','scheduleDPM.plantMachinery.rate15.depreciationDetail.fullRateDeprAmt','scheduleDPM.plantMachinery.rate15.depreciationDetail.halfRateDeprAmt');
 * checkDPMDOA('scheduleDPM.plantMachinery.rate30.depreciationDetail.totalDepreciation','scheduleDPM.plantMachinery.rate30.depreciationDetail.fullRateDeprAmt','scheduleDPM.plantMachinery.rate30.depreciationDetail.halfRateDeprAmt');
 * checkDPMDOA('scheduleDPM.plantMachinery.rate40.depreciationDetail.totalDepreciation','scheduleDPM.plantMachinery.rate40.depreciationDetail.fullRateDeprAmt','scheduleDPM.plantMachinery.rate40.depreciationDetail.halfRateDeprAmt');
 * 
 * 
 * checkDPMDOA('scheduleDOA.building.rate5.depreciationDetail.totalDepreciation','scheduleDOA.building.rate5.depreciationDetail.fullRateDeprAmt','scheduleDOA.building.rate5.depreciationDetail.halfRateDeprAmt');
 * checkDPMDOA('scheduleDOA.building.rate10.depreciationDetail.totalDepreciation','scheduleDOA.building.rate10.depreciationDetail.fullRateDeprAmt','scheduleDOA.building.rate10.depreciationDetail.halfRateDeprAmt');
 * checkDPMDOA('scheduleDOA.building.rate40.depreciationDetail.totalDepreciation','scheduleDOA.building.rate40.depreciationDetail.fullRateDeprAmt','scheduleDOA.building.rate40.depreciationDetail.halfRateDeprAmt');
 * checkDPMDOA('scheduleDOA.furnitureFittings.rate10.depreciationDetail.totalDepreciation','scheduleDOA.furnitureFittings.rate10.depreciationDetail.fullRateDeprAmt','scheduleDOA.furnitureFittings.rate10.depreciationDetail.halfRateDeprAmt');
 * checkDPMDOA('scheduleDOA.intangibleAssets.rate25.depreciationDetail.totalDepreciation','scheduleDOA.intangibleAssets.rate25.depreciationDetail.fullRateDeprAmt','scheduleDOA.intangibleAssets.rate25.depreciationDetail.halfRateDeprAmt');
 * checkDPMDOA('scheduleDOA.ships.rate20.depreciationDetail.totalDepreciation','scheduleDOA.ships.rate20.depreciationDetail.fullRateDeprAmt','scheduleDOA.ships.rate20.depreciationDetail.halfRateDeprAmt'); }
 */

function validateOnSubmit() {

	validateOsBbdaLottery();
	checkDropdownSelectedin1d();
	verificationPanValidation('dtlsMngDir');
	mandateA6();
	mandateB8();
	calcSchCGLtcgStcg();
	validateCGSecwiseDed();
	validateSTCGSectionWiseDTAA();
	validateLTCGSectionWiseDTAA();
	//validateScheduleHP();
	checkSchFAMandatory();
	checkQDRawMatMandatory('scheduleQDRaw', 'scheduleQDFin');
	validateUD();
	validateBPforPoint39();
	checkMatcSubmit();
	balSheetWarnig();
	validateHPRent();
	calculateTCS();
	calculateTDS();
	checkUniqueOSSec();
	checkSchRAMandatory();
	validateFSI();
	calculatePL();
	calPartAPLSheetIndAs();
	validateScheduleCFlXvii();
	CheckBFLAUDMismatch();
	CheckHPShareProperty();
	checkEmptySchUDAmt();
	priBankMandtry();
	checkUniqueTableCol('scheduleFSI', 'countryCode$',
			'Same Country cannot be selected more than once.');
	if (dpmCeasesMesg != '' || doaCeasesMesg != '') {
		addErrorXHTML('', dpmCeasesMesg + '<br/>' + doaCeasesMesg, true);

	}
	checkAuditDate();
	validateTradingAcc();
	scheduleHPPanValidation();
	validateTradingAccInds();
	calExpenses();
	calExpensesii();
	validatePLNetProfit();
	checkDDTDateDepEmpty();
	checkBBTDateDepEmpty();
	//enableGrossAmtTDS2();
	enableGrossAmtTDS1();
	// ifscCheckNRIForeignComp();
	calculateTotalTaxIT('scheduleIt');
	panValidation80G('ded100PerWithoutQual');
	panValidation80GGA('schedule80GGA');
	panValidation80G('ded50WithoutQual');
	panValidation80G('ded100Qual');
	panValidation80G('ded50WithQual');
	panValidationTDS('scheduleTDS2');
	panValidationTDS('scheduleTDS1');
	setCG54Dtls();
	calcTotalAmt('schEIMinorChild');
	alertItr6User();
	otherLiquidDet();
	calcTotFullConA(
			'scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnia',
			'scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnib',
			'scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnic');
	calcTotFullConA(
			'scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnia',
			'scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnib',
			'scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnic');
	calcTotFullConA(
			'scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].fullConsidtnia',
			'scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].fullConsidtnib',
			'scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].fullConsidtnic');
	calcTotFullConA(
			'scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.fullConsidtnia',
			'scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.fullConsidtnib',
			'scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.fullConsidtnic');
	validateSchCGSTCGAmt();
	validateSchCGLTCGAmt();
	calcTotFullConTable();
	validateSchOSDTAA1a1b();
	validateTDS19Grtthen67();
	validateTDS29Grtthen67();
	threeFieldsValidationforTDS1OnSave();
	threeFieldsValidationforTDS2OnSave();

	validateTDS1();
	validateTDS2();
	validateTCS();
	onBPTableWithSingleDropMand();
	checkFor18thFiledValueDPM();
	checkFor16thFiledValue();
	calculateSchDOA();
	validateDedUs54D();
	validateDedUs54G();
	validateDedUs54GA();
	validate80GTableAForCashAndOtherMode();
	validate80GTableBForCashAndOtherMode();
	validate80GTableCForCashAndOtherMode();
	validate80GTableDForCashAndOtherMode();
	mandateSh1AL1();
//	panAadharCheckSH();
	validateNatureOfBusiness();
	validateIssurePurchasePriceAL1();
	validateSecHidden();
	setSecRespOnSave();
	validateRATableDForCashAndOtherMode();
	panValidationRA('scheduleRA');
	clearFiels112A();
	clearFiels115AD();
	validatePercentA1B1();
	//ComparePLGrsRcptAndPrft();
	otherauditedSection1();
	othergener1();
	sysDateCompOfDOF();
	sysDateCompOfSchDDT();
	sysDateCompOfResToNotice();
	selfOccupiedPrprtyCheck();
	intrstBorowdCheck();
	calculatePercentageSharePrpty();
	CheckHPShareProperty();
	validateScheduleVIA();
	document.getElementsByName('scheduleDI.deductionUndChapVIA[0].section')[0].value='80G';
	document.getElementsByName('scheduleDI.deductionUndChapVIA[1].section')[0].value='80GGA';
	document.getElementsByName('scheduleDI.deductionUndChapVIA[2].section')[0].value='80GGB';
	document.getElementsByName('scheduleDI.deductionUndChapVIA[3].section')[0].value='80GGC';
	document.getElementsByName('scheduleMATC.curAssYr')[0].value='2020-21';
	validateSchBPA5();ValidateUdAsyr();
	validatePanOrAadhaarPL47();
	validatePanOrAadhaarPLINDAS47();
	validatePanOrAadhaarKeyPerson();
	validatePanOrAadhaarShareHolder();
	validatePanOrAadhaarOwnership();
	//calculateFullVal50CStcg();
	//calculateFullVal50CLtcg();
	validateDed54EC();
	validateSTCGPoint5();
	validatescheduleDIDate();
}

function scheduleCGA5a() {

	document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration')[0].value =

	eval(coalesceSetRet("scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnii")
			+ coalesceSetRet("scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnic"));

}
function scheduleCGA6a() {

	document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsideration')[0].value =

	eval(coalesceSetRet("scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnii")
			+ coalesceSetRet("scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsidtnic"));

}

function scheduleCGB6a() {

	var tab = document.getElementById('stcg10pctTab');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows / 16); i++) {
		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
						+ i + '].fullConsideration')[0].value = eval(coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
				+ i + '].fullConsidtnii')
				+ coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
						+ i + '].fullConsidtnic'));
	}

}

function scheduleCGB7() {
	coalesceSetRet("scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.fullConsidtnia");
	coalesceSetRet("scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.fullConsidtnib");

	document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.deductSec48.fullConsideration')[0].value =

	eval(coalesceSetRet("scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.fullConsidtnii")
			+ coalesceSetRet("scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.fullConsidtnic"));

}
// CG 7a dropdown check
function mandateA6() {
	var valueA13 = parseInt('0', 10);
	var valueAb4 = parseInt('0', 10);

	var table = document.getElementById('scheduleCGstcg1');
	var noOfRows = table.rows.length;

	var tempa13 = parseInt('0', 10);
	var tempa131 = parseInt('0', 10);

	var tempaAb4 = parseInt('0', 10);
	var tempaAb41 = parseInt('0', 10);

	for (var i = 0; i < noOfRows / 14; i++) {
		// calcBalance
		var valueA13 = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['
						+ i + '].fullConsideration50C')[0].value;

		tempa13 = parseInt(valueA13.value) + parseInt(tempa131);

		tempa131 = parseInt(tempa13);
		var valueAb4 = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['
						+ i + '].deductSec48totalDedn')[0].value;

		tempaAb4 = parseInt(valueAb4.value) + parseInt(tempaAb41);

		tempaAb41 = parseInt(tempaAb4);

	}

	valueA13 = tempa13;

	valueAb4 = tempaAb4;

	var valueA1d = parseInt('0', 10);
	for (var i = 0; i < noOfRows / 14; i++) {
		var r = i + 1;
		var tableId = 'stcgDeduction_ded' + r;
		var table1 = document.getElementById(tableId);
		var noOfRows1 = table1.rows.length;
		for (var f = 0; f < parseInt(noOfRows1) - 3; f++) {
			valueA1d = eval(parseInt(
					coalesce(document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['
									+ i + '].exemptionOrDedn[' + f + '].amount')[0].value),
					10)
					+ valueA1d);
		}
	}

	var valueA2ia = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].fullConsideration')[0].value;
	var valueA2b4 = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48totalDedn')[0].value;
	var valueA2d = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].lossSec94of7Or94of8')[0].value;

	var valueA3a = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid')[0].value;
	var valueA3b = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid')[0].value;

	var valueA4a = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration')[0].value;
	var valueA44 = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.totalDedn')[0].value;
	var valueA4d = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.capgainonAssets')[0].value;

	var valueA5a = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsideration')[0].value;
	var valueA54 = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.deductSec48.totalDedn')[0].value;
	var valueA5d = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.capgainonAssets')[0].value;

	var valueA6 = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.totAmtStcgUnderDtaa')[0].value;

	var valueSTCG = parseInt(coalesce(valueA13), 10)
			+ parseInt(coalesce(valueAb4), 10)
			+ parseInt(coalesce(valueA1d), 10)
			+ parseInt(coalesce(valueA2ia), 10)
			+ parseInt(coalesce(valueA2b4), 10)
			+ parseInt(coalesce(valueA2d), 10)
			+ parseInt(coalesce(valueA3a), 10)
			+ parseInt(coalesce(valueA3b), 10)
			+ parseInt(coalesce(valueA4a), 10)
			+ parseInt(coalesce(valueA44), 10)
			+ parseInt(coalesce(valueA4d), 10)
			+ parseInt(coalesce(valueA5a), 10)
			+ parseInt(coalesce(valueA54), 10)
			+ parseInt(coalesce(valueA5d), 10)
			+ parseInt(coalesce(valueA6), 10);

	var fieldSTCG = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unutilizedCapgainFlag')[0];

	if ((valueSTCG > 0 || valueSTCG < 0) && fieldSTCG.value == "") {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.unutilizedCapgainFlag',
						'Please select whether any amount of unutilized capital gain on asset transferred during the previous years in A9a of Schedule CG');
		addErrorXHTML(
				fieldSTCG,
				'Please select whether any amount of unutilized capital gain on asset transferred during the previous years in A9 of Schedule CG',
				true);
	}

}

// CG 10a dropdown check
function mandateB8() {

	var valueBa3 = parseInt('0', 10);
	var valueBb4 = parseInt('0', 10);

	var table = document.getElementById('scheduleCGltcg1');
	var noOfRows = table.rows.length;

	var tempa13 = parseInt('0', 10);
	var tempa131 = parseInt('0', 10);

	var tempaAb4 = parseInt('0', 10);
	var tempaAb41 = parseInt('0', 10);

	for (var i = 0; i < noOfRows / 14; i++) {
		// calcBalance
		var valueBa3 = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['
						+ i + '].fullConsideration50C')[0].value;

		tempa13 = parseInt(valueBa3.value) + parseInt(tempa131);

		tempa131 = parseInt(tempa13);

		var valueBb4 = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['
						+ i + '].deductSec48totalDedn')[0].value;

		tempaAb4 = parseInt(valueBb4.value) + parseInt(tempaAb41);

		tempaAb41 = parseInt(tempaAb4);

	}

	valueBa3 = tempa13;

	valueBb4 = tempaAb4;

	var valueB1d = parseInt('0', 10);
	for (var i = 0; i < noOfRows / 14; i++) {
		var r = i + 1;
		var tableId = 'ltcgDeduction1_ded' + r;
		var table1 = document.getElementById(tableId);
		var noOfRows1 = table1.rows.length;
		for (var f = 0; f < parseInt(noOfRows1) - 3; f++) {
			valueB1d = eval(parseInt(
					coalesce(document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['
									+ i + '].exemptionOrDedn[' + f + '].amount')[0].value),
					10)
					+ valueB1d);
		}
	}

	var valueB2a = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofBondsDebntr.fullConsideration')[0].value;
	var value2Bb4 = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofBondsDebntr.deductSec48.totalDedn')[0].value;
/*	var valueB2d = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofBondsDebntr.exemptionOrDednUs54')[0].value;
*/
	var valueB3a = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].fullConsideration')[0].value;
	var valueB34 = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].deductSec48.totalDedn')[0].value;
/*	var valueB3d = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].exemptionOrDednUs54S')[0].value;
*/
/*	var valueB4a = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIProvisoSec48.ltcgWithoutBenefit')[0].value;
	var valueB4b = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIProvisoSec48.exemptionOrDednUs54')[0].value;
*/
	var valueB5a = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].fullConsideration')[0].value;
	var valueB54 = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].deductSec48.totalDedn')[0].value;
/*	var valueB5d = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].exemptionOrDednUs54S')[0].value;
*/
	var valueB7a = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.deductSec48.fullConsideration')[0].value;
	var valueB74 = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.deductSec48.totalDedn')[0].value;
	var valueB7d = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.exemptionOrDednUs54S')[0].value;

	var valueB9 = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa.totAmtLtcgUnderDtaa')[0].value;

	var valueB8 = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtStcgUnderDtaa')[0].value;

	var fieldLTCG = document
			.getElementsByName('scheduleCGPost45.LongTermCapGainPost45.unutilizedCapgainFlag')[0];

	var valueLTCG = parseInt(coalesce(valueBa3), 10)
			+ parseInt(coalesce(valueBb4), 10)
			+ parseInt(coalesce(valueB1d), 10)
			+ parseInt(coalesce(valueB2a), 10)
			+ parseInt(coalesce(value2Bb4), 10)
		//	+ parseInt(coalesce(valueB2d), 10)
			+ parseInt(coalesce(valueB3a), 10)
			+ parseInt(coalesce(valueB34), 10)
		//	+ parseInt(coalesce(valueB3d), 10)
		//	+ parseInt(coalesce(valueB4a), 10)
		//	+ parseInt(coalesce(valueB4b), 10)
			+ parseInt(coalesce(valueB5a), 10)
			+ parseInt(coalesce(valueB54), 10)
		//	+ parseInt(coalesce(valueB5d), 10)
			+ parseInt(coalesce(valueB7a), 10)
			+ parseInt(coalesce(valueB74), 10)
			+ parseInt(coalesce(valueB7d), 10)
			+ parseInt(coalesce(valueB9), 10) + parseInt(coalesce(valueB8), 10);

	var fieldLTCG = document
			.getElementsByName('scheduleCGPost45.LongTermCapGainPost45.unutilizedCapgainFlag')[0];

	if ((valueLTCG > 0 || valueLTCG < 0) && fieldLTCG.value == "") {
		j
				.setFieldError(
						'scheduleCGPost45.LongTermCapGainPost45.unutilizedCapgainFlag',
						'Please select whether any amount of unutilized capital gain on asset transferred during the previous years in B10 of Schedule CG');
		addErrorXHTML(
				fieldLTCG,
				'Please select whether any amount of unutilized capital gain on asset transferred during the previous years in B10 of Schedule CG',
				true);
	}

}

function setCG54Dtls() {
	var tab1 = document.getElementById('scheduleStcgunUtilizedCapGain54');
	var noOfRows = tab1.rows.length;

	for (var i = 0; i < (noOfRows - 3); i++) {
		var section = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
						+ i + '].section')[0].value;
		if (section != '') {
			document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].ay')[0].value = '2016-17';
		} else {
			document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].ay')[0].value = '';
		}
	}

	var tab1 = document.getElementById('scheduleLtcgunUtilizedCapGain54');
	var noOfRows = tab1.rows.length;

	for (var i = 0; i < (noOfRows - 3); i++) {
		var section = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
						+ i + '].section')[0].value;
		if (section != '') {
			document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].ay')[0].value = '2016-17';
		} else {
			document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].ay')[0].value = '';
		}
	}
}

function onStateChngSetCountry(state, country) {
	var country = document.getElementsByName(country)[0];
	if (state.value != '99' && state.value != '-1' && state.value != '') {
		country.value = '91';
	} else {
		country.value = '';
	}
}

function onStateChng() {
	try {
		var state = document
				.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0];
		var country = document
				.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];
		var pinCode = document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0];

		if (state.value != '99' && state.value != '-1') {
			country.value = '91';
			pinCode.value = '';
		} else if (state.value == '99') {
			pinCode.value = '999999';
		}
	} catch (e) {
		alert(e.stack);
	}
}

function deleteRowToTableScheduleSI(tableId, noOfRow, last) {

	deleteRowTableModified(tableId, noOfRow, last);
	calcScheduleSI();

}

function ensureToFillSchTrFsi(field) {
	var claimUs9090A91Flag = document.getElementsByName(field)[0];
	var resStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	if (field.value == 'YES' && resStatus == 'RES') {
		addErrorXHTML(
				'',
				'Do not forget to fill Schedule TR and Schedule FSI to claim Tax relief.',
				true);
	}
}
function otherLiquidDet() {

	/*
	 * var table1 = checkRowBlank('tableOlSub', 3, 2); var table2 =
	 * checkRowBlank('tableOlSub1', 3, 2); var table3 =
	 * checkRowBlank('tableOlSub2', 3, 2);
	 */
	var v1 = document.getElementsByName("partAOL.openBalances.cashInHand")[0].value;
	var v2 = document.getElementsByName("partAOL.openBalances.cashInBank")[0].value;
	var v3 = document.getElementsByName("partAOL.openBalances.cashTotInc")[0].value;
	var v4 = document.getElementsByName("partAOL.receipts.interest")[0].value;
	var v5 = document.getElementsByName("partAOL.receipts.dividend")[0].value;
	var v6 = document.getElementsByName("partAOL.receipts.rlznDuesDebtors")[0].value;
	var v7 = document.getElementsByName("partAOL.receipts.totalOfReceipts")[0].value;
	var v8 = document.getElementsByName("partAOL.totalOpenReceipts")[0].value;
	var v9 = document
			.getElementsByName("partAOL.payments.repaymentSecuredloan")[0].value;
	var v10 = document
			.getElementsByName("partAOL.payments.repaymentUnsecuredloan")[0].value;
	var v11 = document.getElementsByName("partAOL.payments.repaymentCreditors")[0].value;
	var v12 = document.getElementsByName("partAOL.payments.commission")[0].value;
	var v13 = document.getElementsByName("partAOL.payments.totalPayments")[0].value;
	var v14 = document.getElementsByName("partAOL.closingStock.cashInHand")[0].value;
	var v15 = document.getElementsByName("partAOL.closingStock.cashInBank")[0].value;
	var v16 = document.getElementsByName("partAOL.closingStock.totalClBal")[0].value;
	var v17 = document.getElementsByName("partAOL.totalClPaymnts")[0].value;
	if (document.getElementsByName('partAGEN1.filingStatus.underLiquidation')[0].value == 'Y') {

		// && v3=='' && v4=='' && v5=='' && v6=='' && v7=='' && v8=='' && v9==''
		// && v10=='' && v11=='' && v12=='' && v13=='' && v14=='' && v15=='' &&
		// v16=='' && v17==''
		// if(table1 || table2 || table3 || v1=='' || v2 =='' || v3=='' ||
		// v4=='' || v5=='' || v6=='' || v7=='' || v8=='' || v9=='' || v10==''
		// || v11=='' || v12=='' || v13=='' || v14=='' || v15=='' || v16=='' ||
		// v17=='')
		if (v1 == '' || v2 == '' || v3 == '' || v4 == '' || v5 == ''
				|| v6 == '' || v7 == '' || v8 == '' || v9 == '' || v10 == ''
				|| v11 == '' || v12 == '' || v13 == '' || v14 == ''
				|| v15 == '' || v16 == '' || v17 == '') {
			j.setFieldError('partAOL.openBalances.cashInHand',
					'Please fill all the fields in Schedule OL .');
			addErrorXHTML('', 'Please fill all the fields in Schedule OL .');
		}
	}

}
function checkSchFAMandatory() {

	var table1 = checkRowBlank('schFADtlsFrignAssetsA1', 2, 1);
	var table2 = checkRowBlank('schFADtlsFrignAssetsA2', 2, 1);
	var table3 = checkRowBlank('schFADtlsFrignAssetsA3', 2, 1);
	var table4 = checkRowBlank('schFADtlsFrignAssetsA4', 2, 1);
	var table5 = checkRowBlank('schFADtlsFinIntrest', 2, 1);
	var table6 = checkRowBlank('schFADtlsImmvbleProp', 2, 1);
	var table7 = checkRowBlank('schFADtlsOtherAsset', 2, 1);
	var table8 = checkRowBlank('schFADtlsSigningAuth', 2, 1);
	var table9 = checkRowBlank('schFADtlsTrusts', 2, 1);
	var table10 = checkRowBlank('DetailsOthIncomeOutsideIndia', 2, 1);

	if (document.getElementsByName('partBTTI.assetOutIndiaFlag')[0].value == 'YES'
			&& document
					.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value != 'NRI') {
		if (table1 && table2 && table3 && table4 && table5 && table6 && table7
				&& table8 && table9 && table10) {
			j.setFieldError('scheduleFA.detailsForiegnBank[0].countryCode',
					'Please enter any one table in Schedule FA.');
			addErrorXHTML('', 'Please enter any one table in Schedule FA.');
		}
	}
	if (document.getElementsByName('partBTTI.assetOutIndiaFlag')[0].value == 'NO'
			&& document
					.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value != 'NRI') {
		if (!(table1 && table2 && table3 && table4 && table5 && table6
				&& table7 && table8 && table9 && table10)) {
			j
					.setFieldError('partBTTI.assetOutIndiaFlag',
							'Please correct your selection of assets outside India in Schedule BA.');
			addErrorXHTML('',
					'Please correct your selection of assets outside India in Schedule BA.');
		}
	}
}

function checkQDRawMatMandatory(tableId1, tableId2) {
	try {
		var tab = document.getElementById(tableId1);
		var allInputTags = tab.getElementsByTagName('input');

		var tabFin = document.getElementById(tableId2);
		var allInputTagsFin = tabFin.getElementsByTagName('input');

		var rawMatCheck = false;
		var finGoodsCheck = false;

		var allInputTagsSelect = tab.getElementsByTagName('select');
		var allInputTagsSelectFin = tabFin.getElementsByTagName('select');

		if (tableId1 == 'scheduleQDRaw') {

			for (var i = 0; i < allInputTags.length; i++) {

				if (allInputTags[i].value != '' && !rawMatCheck
						&& allInputTags[i].type != 'checkbox'
						&& allInputTags[i].type != 'hidden') {

					rawMatCheck = true;
					break;

				}
			}

			for (var i = 0; i < allInputTagsSelect.length; i++) {
				if (allInputTagsSelect[i].value != '' && !rawMatCheck) {
					rawMatCheck = true;
					break;

				}
			}

		}

		if (tableId2 == 'scheduleQDFin') {

			for (var i = 0; i < allInputTagsFin.length; i++) {
				if (allInputTagsFin[i].value != '' && !finGoodsCheck
						&& allInputTagsFin[i].type != 'checkbox'
						&& allInputTagsFin[i].type != 'hidden') {
					finGoodsCheck = true;
					break;
				}
			}

			for (var i = 0; i < allInputTagsSelectFin.length; i++) {
				if (allInputTagsSelectFin[i].value != '' && !finGoodsCheck) {
					finGoodsCheck = true;

					break;
				}
			}

		}

		if (rawMatCheck && !finGoodsCheck) {

			addErrorXHTML(
					'',
					'At least one entry is required in Finished goods in the sheet Quantitative Details',
					true);
			j
					.setFieldError(
							'partaqd.manfactrConcern.finishrByProd.quantitDet[0].itemName',
							'At least one entry is required in Finished goods in the sheet Quantitative Details');
		}

		if (!rawMatCheck && finGoodsCheck) {

			addErrorXHTML(
					'',
					'At least one entry is required in Raw Materials in the sheet Quantitative Details',
					true);
			j
					.setFieldError(
							'partaqd.manfactrConcern.rawMaterial.quantitDet[0].itemName',
							'At least one entry is required in Raw Materials in the sheet Quantitative Details');

		}
	} catch (e) {
		alert('errorrrrr checkQDRawMatMandatory: ' + e);
	}
}

function onEmptySetZero(element) {

	if (element.value == "") {

		element.value = '0';
	}

}

function getAmt(name) {
	var val = $('[name="' + name + '"]')[0].value;
	return parseInt(coalesce(val));
}

function zeroOrMore(val) {
	val = coalesce(val);
	if (val < 0) {
		return 0;
	}
	return val;
}

function enableField(src, val, targets) {
	var srcField = document.getElementsByName(src)[0];
	if (contains(val, srcField.value)) {
		for (var i = 2; i < arguments.length; i++) {
			var targetField = document.getElementsByName(arguments[i])[0];
			targetField.disabled = false;
			targetField.readOnly = false;
		}
	} else {
		for (var i = 2; i < arguments.length; i++) {
			var targetField = document.getElementsByName(arguments[i])[0];
			if (targetField.type == 'select-one') {
				targetField.selectedIndex = 0;
			} else {
				targetField.value = '';
			}
			targetField.disabled = true;
			targetField.readOnly = true;
		}
	}

}

function contains(arr, val) {
	if (arr.constructor.name == "Array") {
		for (var i = 0; i < arr.length; i++) {
			if (arr[i] == val) {
				return true;
			}
		}
		return false;
	} else {
		return (arr == val);
	}
}

/*
 * function delScheduleHPForItr6(){
 * 
 * if($('#scheduleHPAddRow')[0].parentNode.children.length>43){ for(var i=0;i<19;i++){
 * $('#scheduleHPAddRow')[0].parentNode.deleteRow($('#scheduleHPAddRow')[0].parentNode.children.length-6); }
 * if($('#scheduleHPAddRow')[0].parentNode.children.length==43){
 * $('#delHPButtonId').prop('disabled', true); } }else
 * if($('#scheduleHPAddRow')[0].parentNode.children.length==43){
 * $('#delHPButtonId').prop('disabled', true); }
 * 
 * 
 * ($('#scheduleHPLast')[0].children)[0].innerHTML =
 * parseInt(($('#scheduleHPLast')[0].children)[0].innerHTML) - 1;
 * 
 * 
 * var totRow=document.getElementById('scheduleHPLast').cells[0].textContent;
 * 
 * var newVal = eval( parseInt(totRow)); var newText='Total ('; for(var k=1;k<newVal;k++){
 * newText=newText+k+'i +'; } newText=newText+newVal+'a )';
 * document.getElementById('scheduleHPLast').cells[0].innerHTML=newVal;
 * document.getElementById('scheduleHPLast').nextElementSibling.cells[3].innerHTML=newVal+'a';
 * document.getElementById('scheduleHPLast').nextElementSibling.nextElementSibling.cells[2].innerHTML=newVal+'b';
 * //document.getElementById('scheduleHPLast').nextElementSibling.nextElementSibling.nextElementSibling.cells[2].innerHTML=newVal+'c';
 * document.getElementById('scheduleHPLast').nextElementSibling.nextElementSibling.cells[1].innerHTML=newText;
 * 
 * var table=document.getElementById('scheduleHPMain');
 * 
 * modifyRow(table); calcITR6(); }
 */
function calculateTotalInTable(iteratorValue, columnName, tableId, totalField) {
	var total = 0, i = 0;
	var nameTemp = "";
	var tableInput = document.getElementById(tableId).getElementsByTagName(
			'input');
	while (true) {
		nameTemp = iteratorValue + '[' + (i++) + '].' + columnName;
		if (document.getElementsByName(nameTemp).length != 0) {
			var val = parseInt(document.getElementsByName(nameTemp)[0].value);
			if (isNaN(val)) {
				val = 0;
			}
			total = parseInt(total) + parseInt(val);
		} else {
			break;
		}
	}
	document.getElementsByName(totalField)[0].value = total;
}

function coalesceString(val) {
	if (val == undefined || val == null) {
		return 0;
	}
	return val;
}

function setSerialNumber(element, header) {

	try {
		var tableId = element.getAttribute('onclick').substring(20,
				element.getAttribute('onclick').lastIndexOf('\''));
		var index = tableId.substring(10);
		index = eval(index - 1);
		var table = document.getElementById(tableId);
		var noOfRows = table.rows.length;

		for (var i = 0; i < eval(parseInt(noOfRows, 10) - header); i++) {
			document.getElementsByName('scheduleHP.propertyDetails[' + index
					+ '].coOwners[' + i + '].coOwnersSNo')[0].value = i + 1;
		}
	} catch (e) {
		alert('errror:' + e);
	}
}

function checkMatcSubmit() {
	var taxValue = document.getElementsByName('scheduleMATC.amtOfTaxWithCred')[0].value;
	var totalValue = document
			.getElementsByName('scheduleMATC.totMatCredUtilCurrYr')[0].value;

	if (eval(totalValue) > eval(taxValue)) {
		totalValue = 0;
		addError(
				'',
				'The total amount of credit utilzed during the current year cannot be greater than amount of Tax against which credit is available',
				true);
		j
				.setFieldError(
						'scheduleMATC.totMatCredUtilCurrYr',
						'The total amount of credit utilzed during the current year cannot be greater than amount of Tax against which credit is available');
	}
}

function disableScheduleFSI() {

	var tabl = document.getElementById('scheduleFSI');
	var allInputTags = tabl.getElementsByTagName('input');
	var selectTags = tabl.getElementsByTagName('select');
	var resStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	for (var i = 0; i < allInputTags.length; i++) {
		if (resStatus == 'RES') {

			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;

			if (allInputTags[i].name.match("totalCountryWise$")) {
				allInputTags[i].disabled = true;
				allInputTags[i].readOnly = true;
			}
		} else {

			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;
			allInputTags[i].value = "";
		}
	}
	for (var i = 0; i < selectTags.length; i++) {
		if (resStatus == 'RES') {

			selectTags[i].disabled = false;
		} else {
			selectTags[i].disabled = true;
			selectTags[i].value = "";
		}

	}

	if (resStatus == 'RES') {
		document.getElementsByName('itrScheduleFSI.totalIncomeOutIndiaDTAA')[0].readOnly = false;

	} else {

		document.getElementsByName('itrScheduleFSI.totalIncomeOutIndia')[0].readOnly = true;
		document.getElementsByName('itrScheduleFSI.totalIncomeOutIndiaDTAA')[0].readOnly = true;
		document.getElementsByName('itrScheduleFSI.totalIncomeOutIndiaWoDTAA')[0].readOnly = true;
		document.getElementsByName('itrScheduleFSI.totalIncomeOutIndia')[0].value = '';
		document.getElementsByName('itrScheduleFSI.totalIncomeOutIndiaDTAA')[0].value = '';
		document.getElementsByName('itrScheduleFSI.totalIncomeOutIndiaWoDTAA')[0].value = '';
		$('#scheduleFSI').find('[type=\"checkbox\"]')
				.attr('checked', 'checked');
		deleteRowTable('scheduleFSI', 1, 2);
	}

	document.getElementsByName('itrScheduleFSI.totIncFromHPPartBTIA')[0].readOnly = true;
	document.getElementsByName('itrScheduleFSI.totIncBusinessPartBTIB')[0].readOnly = true;
	document.getElementsByName('itrScheduleFSI.totIncCapGainPartBTIC')[0].readOnly = true;
	document.getElementsByName('itrScheduleFSI.totIncOthSrcPartBTID')[0].readOnly = true;
	document.getElementsByName('itrScheduleFSI.totalAmtCountryWise')[0].readOnly = true;
}

function checkTRFSIMandatory() {

	var trFilled = checkRowBlank('scheduleTR', 3, 1);
	var fsiFilled = checkFSIRowBlank('scheduleFSI', 3, 1);
	var resStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var flag9090A = document
			.getElementsByName('partAGEN1.filingStatus.claimUs9090A91Flag')[0].value;

	if (resStatus == 'RES' && flag9090A == "YES") {
		if (fsiFilled) {
			j.setFieldError('itrScheduleFSI.scheduleFSI[0].countryCode',
					'Schedule FSI is mandatory');
			addErrorXHTML('', 'Schedule FSI is mandatory');
		}
		if (trFilled) {
			j.setFieldError('scheduleTR1.scheduleTR[0].countryCode',
					'Schedule TR is mandatory');
			addErrorXHTML('', 'Schedule TR is mandatory');
		}
	}

	if (resStatus == 'NRI' && flag9090A == "YES") {
		if (trFilled) {
			j.setFieldError('scheduleTR1.scheduleTR[0].countryCode',
					'Schedule TR is mandatory');
			addErrorXHTML('', 'Schedule TR is mandatory');
		}
	}
}

function checkFSIRowBlank(tableId, noOfRow, last) {
	try {
		var tab = document.getElementById(tableId);
		var rowCount = tab.rows.length;
		var trOfLastRow = tab.getElementsByTagName('tr')[rowCount - noOfRow];
		var allInputTags = trOfLastRow.getElementsByTagName('input');
		var allSelectTags = trOfLastRow.getElementsByTagName('select');
		var allTextareaTags = trOfLastRow.getElementsByTagName('textarea');
		var isRowBlank = true;

		for (var i = 0; i < allInputTags.length; i++) {
			if (!allInputTags[i].name.match(".chosenCheckBox$")) {
				if (allInputTags[i] != undefined
						|| allInputTags[i].value != null) {
					if ((allInputTags[i].getAttribute("readonly") == null)
							|| (allInputTags[i].getAttribute("readonly") != 'readonly')) {
						if (allInputTags[i].parentNode.style.display != "none"
								&& allInputTags[i].getAttribute('type') != 'hidden') {
							var str = allInputTags[i].value.replace(
									/^\s+|\s+$/g, '');

							if (!allInputTags[i].name
									.match("totalCountryWise$")) {
								if (str != '') {
									isRowBlank = false;
									break;
								}
							}
						}
					}
				}
			}
		}

		for (var i = 0; i < allTextareaTags.length; i++) {
			if (allTextareaTags[i] != undefined
					|| allTextareaTags[i].value != null) {
				var str = allTextareaTags[i].value.replace(/^\s+|\s+$/g, '');
				if (str != '') {
					isRowBlank = false;
					break;
				}
			}
		}

		for (var i = 0; i < allSelectTags.length; i++) {
			if (allSelectTags[i].value != '-1' && allSelectTags[i].value != '') {
				isRowBlank = false;
				break;
			}
		}
	} catch (e) {
		alert(e);
	}
	return isRowBlank;
}

function balSheetWarnig() {
	var totLaibilty = document
			.getElementsByName('partabsFor6FrmAY13.equityAndLiablities.totEquityAndLiabilities')[0].value;
	var totAsests = document
			.getElementsByName('partabsFor6FrmAY13.totalAssets')[0].value;

	if (totLaibilty != totAsests) {
		addErrorXHTML('',
				'Total Equity & Liabilities (I) must be equal to Total Assets (II) ');
		j
				.setFieldError(
						'',
						"Total Equity & Liabilities (I) must be equal to Total Assets (II) in Schedule Part A-BS");
	}

	var totalEquityLiab = document
			.getElementsByName('partaBsIndAS.equityAndLiablities.liabilities.currentLiabilities.totalEquityLiab')[0].value;
	var totalAssets = document.getElementsByName('partaBsIndAS.totalAssets')[0].value;

	if (totalEquityLiab != totalAssets) {
		addErrorXHTML('',
				'Total Equity & Liabilities (I) must be equal to Total Assets (II) ');
		j
				.setFieldError(
						'',
						"Total Equity & Liabilities (I) must be equal to Total Assets (II) in Schedule Part A-BS - Ind AS");
	}

}

function natureOfBusChck(tableId) {
	var noRows = 5;
	var tab = document.getElementById(tableId);
	var rowCount = tab.rows.length;
	if (rowCount > noRows) {
		addErrorXHTML('', 'Cannot insert more than 3 rows', true);
		return false;
	}
	return true;

}

function natureOfBusChckPL44AE(tableId) {
	var noRows = 5;
	var tab = document.getElementById(tableId);
	var rowCount = tab.rows.length;

	if (rowCount >= noRows) {
		addErrorXHTML('', 'Cannot insert more than 3 rows', true);
		return false;
	}
	return true;
}

function calculateTax() {
	clearOldValues();
	calcITR6();
}

function checkIfChanged(pathToCheck) {
	if ((document.getElementsByName(pathToCheck)[0].fieldChanged == undefined)
			|| (document.getElementsByName(pathToCheck)[0].fieldChanged != undefined && document
					.getElementsByName(pathToCheck)[0].fieldChanged == 'false')) {
		return false;
	} else {
		return true;
	}
}

function checkFirstLessThanMinOthTwo(path1, path2, path3, verticalCeiling) {
	if (coalesceSetRet(path2) <= verticalCeiling) {
		if (coalesceSetRet(path1) > coalesceSetRet(path2)) {
			addErrorXHTML(document.getElementsByName(path1)[0],
					'This value cannot be greater than '
							+ coalesceSetRet(path2), true);
			document.getElementsByName(path1)[0].value = coalesceSetRet(path2);
		}
	} else if (verticalCeiling < coalesceSetRet(path2)) {
		if (coalesceSetRet(path1) > verticalCeiling) {
			addErrorXHTML(document.getElementsByName(path1)[0],
					'This value cannot be greater than ' + verticalCeiling,
					true);
			document.getElementsByName(path1)[0].value = verticalCeiling;
		}
	}
}

function checkHPeditableValidity(path1, path2, path4, path3, verticalCeilingHP) {
	var tempVal = coalesceSetRet(path2) - coalesceSetRet(path4);
	if (tempVal <= verticalCeilingHP) {
		if (coalesceSetRet(path1) > tempVal) {
			addErrorXHTML(document.getElementsByName(path1)[0],
					'This value cannot be greater than ' + tempVal, true);
			document.getElementsByName(path1)[0].value = tempVal;
		}
	} else if (verticalCeilingHP < tempVal) {
		if (coalesceSetRet(path1) > verticalCeilingHP) {
			addErrorXHTML(document.getElementsByName(path1)[0],
					'This value cannot be greater than ' + verticalCeilingHP,
					true);
			document.getElementsByName(path1)[0].value = verticalCeilingHP;
		}
	}

}

function checkBPeditableValidity(path1, path2, path4, path5, path3,
		verticalCeilingBP) {

	var tempVal = coalesceSetRet(path2) - coalesceSetRet(path4)
			- coalesceSetRet(path5);

	if (tempVal <= verticalCeilingBP) {
		if (coalesceSetRet(path1) > tempVal) {
			addErrorXHTML(document.getElementsByName(path1)[0],
					'This value cannot be greater than ' + tempVal, true);
			document.getElementsByName(path1)[0].value = tempVal;
		}
	} else if (verticalCeilingBP < tempVal) {
		if (coalesceSetRet(path1) > verticalCeilingBP) {
			addErrorXHTML(document.getElementsByName(path1)[0],
					'This value cannot be greater than ' + verticalCeilingBP,
					true);
			document.getElementsByName(path1)[0].value = verticalCeilingBP;
		}
	}
}

function validateHPRent() {
	var tab = document.getElementById('scheduleHPMain');
	var allInputTags = tab.getElementsByTagName('input');
	var selectTags = tab.getElementsByTagName('select');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("rentdetails.annualLetableValue$")) {
			if (parseInt(allInputTags[i + 1].value, 10) > parseInt(
					allInputTags[i].value, 10)) {
				addError(allInputTags[i + 1],
						'Rent not realized cannot exceed Annual Letable Value',
						true);
				j.setFieldError(allInputTags[i + 1].name,
						'Rent not realized cannot exceed Annual Letable Value');
				break;
			}
		}
	}
}

function getPan() {
	var pan = document.getElementsByName('partAGEN1.orgFirmInfo.panNumber')[0].value;
	return pan;
}

function disableScheduleFA() {

	var resStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	removeTableData('schFADtlsFrignAssetsA1', resStatus);
	removeTableData('schFADtlsFrignAssetsA2', resStatus);
	removeTableData('schFADtlsFrignAssetsA3', resStatus);
	removeTableData('schFADtlsFrignAssetsA4', resStatus);
	removeTableData('schFADtlsFinIntrest', resStatus);
	removeTableData('schFADtlsImmvbleProp', resStatus);
	removeTableData('schFADtlsOtherAsset', resStatus);
	removeTableData('schFADtlsSigningAuth', resStatus);
	removeTableData('schFADtlsTrusts', resStatus);
	removeTableData('DetailsOthIncomeOutsideIndia', resStatus);
}

function disablePARTA_OL() {

	var liquidation = document
			.getElementsByName('partAGEN1.filingStatus.underLiquidation')[0].value;
	/* removeTableData('tableOl',liquidation); */
	removeOLTableData('tableOlSub', liquidation);
	removeOLTableData('tableOlSub1', liquidation);
	removeOLTableData('tableOlSub2', liquidation);

	if (liquidation == 'N') {
		document.getElementsByName("partAOL.openBalances.cashInHand")[0].disabled = true;
		document.getElementsByName("partAOL.openBalances.cashInBank")[0].disabled = true;
		document.getElementsByName("partAOL.openBalances.cashTotInc")[0].disabled = true;
		document.getElementsByName("partAOL.receipts.interest")[0].disabled = true;
		document.getElementsByName("partAOL.receipts.dividend")[0].disabled = true;
		document.getElementsByName("partAOL.receipts.rlznDuesDebtors")[0].disabled = true;
		document.getElementsByName("partAOL.receipts.totalOfReceipts")[0].disabled = true;
		document.getElementsByName("partAOL.totalOpenReceipts")[0].disabled = true;
		document.getElementsByName("partAOL.payments.repaymentSecuredloan")[0].disabled = true;
		document.getElementsByName("partAOL.payments.repaymentUnsecuredloan")[0].disabled = true;
		document.getElementsByName("partAOL.payments.repaymentCreditors")[0].disabled = true;
		document.getElementsByName("partAOL.payments.commission")[0].disabled = true;
		document.getElementsByName("partAOL.payments.totalPayments")[0].disabled = true;
		document.getElementsByName("partAOL.closingStock.cashInHand")[0].disabled = true;
		document.getElementsByName("partAOL.closingStock.cashInBank")[0].disabled = true;
		document.getElementsByName("partAOL.closingStock.totalClBal")[0].disabled = true;
		document.getElementsByName("partAOL.totalClPaymnts")[0].disabled = true;
		document.getElementsByName("partAOL.payments.totalOthersPayments")[0].disabled = true;
		document.getElementsByName("partAOL.receipts.totOthersReceiptsOnly")[0].disabled = true;
		document.getElementsByName("partAOL.receipts.totalSaleofAssets")[0].disabled = true;

		document.getElementsByName("partAOL.openBalances.cashInHand")[0].value = '';
		document.getElementsByName("partAOL.openBalances.cashInBank")[0].value = '';
		document.getElementsByName("partAOL.openBalances.cashTotInc")[0].value = '';
		document.getElementsByName("partAOL.receipts.interest")[0].value = '';
		document.getElementsByName("partAOL.receipts.dividend")[0].value = '';
		document.getElementsByName("partAOL.receipts.rlznDuesDebtors")[0].value = '';
		document.getElementsByName("partAOL.receipts.totalOfReceipts")[0].value = '';
		document.getElementsByName("partAOL.totalOpenReceipts")[0].value = '';
		document.getElementsByName("partAOL.payments.repaymentSecuredloan")[0].value = '';
		document.getElementsByName("partAOL.payments.repaymentUnsecuredloan")[0].value = '';
		document.getElementsByName("partAOL.payments.repaymentCreditors")[0].value = '';
		document.getElementsByName("partAOL.payments.commission")[0].value = '';
		document.getElementsByName("partAOL.payments.totalPayments")[0].value = '';
		document.getElementsByName("partAOL.closingStock.cashInHand")[0].value = '';
		document.getElementsByName("partAOL.closingStock.cashInBank")[0].value = '';
		document.getElementsByName("partAOL.closingStock.totalClBal")[0].value = '';
		document.getElementsByName("partAOL.totalClPaymnts")[0].value = '';

	} else {

		document.getElementsByName("partAOL.openBalances.cashInHand")[0].disabled = false;
		document.getElementsByName("partAOL.openBalances.cashInBank")[0].disabled = false;
		document.getElementsByName("partAOL.openBalances.cashTotInc")[0].disabled = false;
		document.getElementsByName("partAOL.receipts.interest")[0].disabled = false;
		document.getElementsByName("partAOL.receipts.dividend")[0].disabled = false;
		document.getElementsByName("partAOL.receipts.rlznDuesDebtors")[0].disabled = false;
		document.getElementsByName("partAOL.receipts.totalOfReceipts")[0].disabled = false;
		document.getElementsByName("partAOL.totalOpenReceipts")[0].disabled = false;
		document.getElementsByName("partAOL.payments.repaymentSecuredloan")[0].disabled = false;
		document.getElementsByName("partAOL.payments.repaymentUnsecuredloan")[0].disabled = false;
		document.getElementsByName("partAOL.payments.repaymentCreditors")[0].disabled = false;
		document.getElementsByName("partAOL.payments.commission")[0].disabled = false;
		document.getElementsByName("partAOL.payments.totalPayments")[0].disabled = false;
		document.getElementsByName("partAOL.closingStock.cashInHand")[0].disabled = false;
		document.getElementsByName("partAOL.closingStock.cashInBank")[0].disabled = false;
		document.getElementsByName("partAOL.closingStock.totalClBal")[0].disabled = false;
		document.getElementsByName("partAOL.totalClPaymnts")[0].disabled = false;

	}

}

function removeOLTableData(tableID, liquidation) {
	var tab = document.getElementById(tableID);
	if (!(liquidation == 'Y')) {
		$('#' + tableID + ' input').attr("checked", true);
		deleteRowTable(tableID, 3, 1);
		$('#' + tableID + ' input').attr("checked", false);
	}

	var allInputTags = tab.getElementsByTagName('input');
	var selectTags = tab.getElementsByTagName('select');
	for (var i = 0; i < allInputTags.length; i++) {
		if ((liquidation == 'Y')) {
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;

		} else {

			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;
			allInputTags[i].value = "";
		}
	}
	for (var i = 0; i < selectTags.length; i++) {
		if ((liquidation == 'Y')) {
			selectTags[i].disabled = false;
		} else {
			selectTags[i].disabled = true;
			selectTags[i].value = "";

		}
	}
	if ((liquidation == 'Y')) {
		tabs.enableTabs(43);
	}
}

// to remove table data
function removeTableData(tableID, resStatus) {

	var tab = document.getElementById(tableID);
	var asstFlag = document.getElementsByName('partBTTI.assetOutIndiaFlag')[0].value;

	if (!((resStatus == 'RES') && asstFlag == 'YES')) {
		$('#' + tableID + ' input').attr("checked", true);
		deleteRowTable(tableID, 3, 1);
		$('#' + tableID + ' input').attr("checked", false);
	}

	var allInputTags = tab.getElementsByTagName('input');
	var selectTags = tab.getElementsByTagName('select');

	for (var i = 0; i < allInputTags.length; i++) {
		if ((resStatus == 'RES') && asstFlag == 'YES') {
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;

		} else {

			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;
			allInputTags[i].value = "";
		}
	}
	for (var i = 0; i < selectTags.length; i++) {
		if ((resStatus == 'RES') && asstFlag == 'YES') {
			selectTags[i].disabled = false;
		} else {
			selectTags[i].disabled = true;
			selectTags[i].value = "";

		}
	}
	if ((resStatus == 'RES') && asstFlag == 'YES') {
		tabs.enableTabs(42);
	}

}

function changeSec36A() {
	var companyType = document
			.getElementsByName('partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value;
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	if (companyType == "6" && domesticCompFlg == 'Y') {
		document
				.getElementsByName('partAGEN2For6.natureOfComp.pubSectCompUs236AFlg')[0].value = "Y";
	} else if (companyType == "7") {
		document
				.getElementsByName('partAGEN2For6.natureOfComp.pubSectCompUs236AFlg')[0].value = "N";
	}
}

function numberOfCoOwnersCheck(tableId, noRows) {
	var tab = document.getElementById(tableId);
	var rowCount = tab.rows.length;
	if (rowCount > noRows) {
		addErrorXHTML('', 'Cannot insert more than 5 rows', true);
		return false;
	}
	return true;

}

function numberOfRowsForQDCheck(tableId) {
	var noRows = 21;
	var tab = document.getElementById(tableId);
	var rowCount = tab.rows.length;

	if (rowCount > noRows) {
		addErrorXHTML('', 'Cannot insert more than 20 rows');
		return false;
	}
	return true;
}

function addRowToTableSchHp(tableId, noOfRow, last, elem) {

	addRowToTable(tableId, noOfRow, last);
	setSerialNumber(elem, 2);
}

// to add rows to table sch HP tenants
function addRowToTableSchHpTenants(tableId, noOfRow, last, elem) {

	addRowToTable(tableId, noOfRow, last);
	setSerialNumberTenants(elem, 2);
}

// set serial number tenants
function setSerialNumberTenants(element, header) {

	try {
		var tableId = element.getAttribute('onclick').substring(27,
				element.getAttribute('onclick').lastIndexOf('\''));
		var index = tableId.substring(16);
		index = eval(index - 1);
		var table = document.getElementById(tableId);
		var noOfRows = table.rows.length;

		for (var i = 0; i < eval(parseInt(noOfRows, 10) - header); i++) {
			document.getElementsByName('scheduleHP.propertyDetails[' + index
					+ '].coTenants[' + i + '].coTenantsSNo')[0].value = i + 1;
		}
	} catch (e) {
		alert('Exception in setSerialNumberTenants method :: ' + e.stack);
	}
}

function deleteRowTableTaxDed80(tx, ty, tz, tn) {
	deleteRowTable(tx, ty, tz);

	var table = document.getElementById(tx);
	var rowCount = table.rows.length;
	for (var i = 0; i < rowCount - 2; i++) {
		var name = tn + '[' + i + ']';
		document.getElementsByName(name)[0].parentNode.previousSibling.previousSibling.innerHTML = 'Undertaking No.'
				+ eval(parseInt(i, 10) + 1);
	}
}

function addRowToTable80(tx, ty, tz, tn) {
	addRowToTable(tx, ty, tz);
	var table = document.getElementById(tx);
	var rowCount = table.rows.length;
	for (var i = 0; i < rowCount - 2; i++) {
		var name = tn + '[' + i + ']';
		document.getElementsByName(name)[0].parentNode.previousSibling.previousSibling.innerHTML = 'Undertaking No.'
				+ eval(parseInt(i, 10) + 1);
	}
}

function calcScheduleFSI() {
	try {
		var table = document.getElementById('scheduleFSI');
		var noOfRows = table.rows.length;
		var indexValue = eval(((parseInt(noOfRows, 10) - 4) / 5));

		for (var i = 0; i < indexValue; i++) {

			document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
					+ "].totalCountryWiseincFrmOutsideInd")[0].value = eval(parseInt(
					coalesce(document
							.getElementsByName("itrScheduleFSI.scheduleFSI["
									+ i + "].incFromHPincFrmOutsideInd")[0].value),
					10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i
											+ "].incFromBusinessincFrmOutsideInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i
											+ "].incCapGainincFrmOutsideInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i + "].incOthSrcincFrmOutsideInd")[0].value),
							10));

			document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
					+ "].totalCountryWisetaxPaidOutsideInd")[0].value = eval(parseInt(
					coalesce(document
							.getElementsByName("itrScheduleFSI.scheduleFSI["
									+ i + "].incFromHPtaxPaidOutsideInd")[0].value),
					10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i
											+ "].incFromBusinesstaxPaidOutsideInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i
											+ "].incCapGaintaxPaidOutsideInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i
											+ "].incOthSrctaxPaidOutsideInd")[0].value),
							10));

			document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
					+ "].totalCountryWisetaxPayableinInd")[0].value = eval(parseInt(
					coalesce(document
							.getElementsByName("itrScheduleFSI.scheduleFSI["
									+ i + "].incFromHPtaxPayableinInd")[0].value),
					10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i
											+ "].incFromBusinesstaxPayableinInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i + "].incCapGaintaxPayableinInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i + "].incOthSrctaxPayableinInd")[0].value),
							10));

			if (eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["
					+ i + "].incFromHPtaxPaidOutsideInd")[0].value) < eval(document
					.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
							+ "].incFromHPtaxPayableinInd")[0].value)) {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incFromHPtaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incFromHPtaxPaidOutsideInd")[0].value;
			} else {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incFromHPtaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incFromHPtaxPayableinInd")[0].value;
			}

			if (eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["
					+ i + "].incFromBusinesstaxPaidOutsideInd")[0].value) < eval(document
					.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
							+ "].incFromBusinesstaxPayableinInd")[0].value)) {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incFromBusinesstaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incFromBusinesstaxPaidOutsideInd")[0].value;
			} else {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incFromBusinesstaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incFromBusinesstaxPayableinInd")[0].value;
			}

			if (eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["
					+ i + "].incCapGaintaxPaidOutsideInd")[0].value) < eval(document
					.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
							+ "].incCapGaintaxPayableinInd")[0].value)) {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incCapGaintaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incCapGaintaxPaidOutsideInd")[0].value;
			} else {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incCapGaintaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incCapGaintaxPayableinInd")[0].value;
			}

			if (eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["
					+ i + "].incOthSrctaxPaidOutsideInd")[0].value) < eval(document
					.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
							+ "].incOthSrctaxPayableinInd")[0].value)) {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incOthSrctaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incOthSrctaxPaidOutsideInd")[0].value;
			} else {
				document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
						+ "].incOthSrctaxReliefinInd")[0].value = document
						.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
								+ "].incOthSrctaxPayableinInd")[0].value;
			}

			document.getElementsByName("itrScheduleFSI.scheduleFSI[" + i
					+ "].totalCountryWisetaxReliefinInd")[0].value = eval(parseInt(
					coalesce(document
							.getElementsByName("itrScheduleFSI.scheduleFSI["
									+ i + "].incFromHPtaxReliefinInd")[0].value),
					10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i
											+ "].incFromBusinesstaxReliefinInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i + "].incCapGaintaxReliefinInd")[0].value),
							10))
					+ eval(parseInt(
							coalesce(document
									.getElementsByName("itrScheduleFSI.scheduleFSI["
											+ i + "].incOthSrctaxReliefinInd")[0].value),
							10));
		}
		populateTR();
	} catch (e) {
		alert('error in calcScheduleFSI = ' + e.stack);
	}
}

function populateTR() {
	try {
		deleteTRRow();
		var fsiTable = document.getElementById('scheduleFSI');
		var noRows = (fsiTable.rows.length - 4) / 5;
		var pos = document
				.getElementsByName('itrScheduleFSI.scheduleFSI[0].countryCode')[0].selectedIndex;

		document.getElementsByName('scheduleTR1.scheduleTR[0].countryCode')[0].value = document
				.getElementsByName('itrScheduleFSI.scheduleFSI[0].countryCode')[0].value;
		document.getElementsByName('scheduleTR1.scheduleTR[0].countryName')[0].value = document
				.getElementsByName('itrScheduleFSI.scheduleFSI[0].countryName')[0].value;

		if (document
				.getElementsByName('itrScheduleFSI.scheduleFSI[0].countryCode')[0].options[pos].text == "Select") {
			document
					.getElementsByName('scheduleTR1.scheduleTR[0].countryCodeName')[0].value = '';
		} else {
			document
					.getElementsByName('scheduleTR1.scheduleTR[0].countryCodeName')[0].value = document
					.getElementsByName('itrScheduleFSI.scheduleFSI[0].countryCode')[0].options[pos].text;
		}

		document
				.getElementsByName('scheduleTR1.scheduleTR[0].taxIdentificationNo')[0].value = document
				.getElementsByName('itrScheduleFSI.scheduleFSI[0].taxIdentificationNo')[0].value;
		document
				.getElementsByName('scheduleTR1.scheduleTR[0].taxPaidOutsideIndia')[0].value = document
				.getElementsByName('itrScheduleFSI.scheduleFSI[0].totalCountryWisetaxPaidOutsideInd')[0].value;
		document
				.getElementsByName('scheduleTR1.scheduleTR[0].taxReliefOutsideIndia')[0].value = document
				.getElementsByName('itrScheduleFSI.scheduleFSI[0].totalCountryWisetaxReliefinInd')[0].value;

		var firstSecCode = document
				.getElementsByName('scheduleTR1.scheduleTR[0].countryCodeName')[0].value
				+ '_'
				+ document
						.getElementsByName('scheduleTR1.scheduleTR[0].taxIdentificationNo')[0].value;

		document
				.getElementsByName('scheduleTR1.scheduleTR[0].relavantArticleDTAA')[0].value = sectionClaimed[firstSecCode];

		if (noRows > 1) {

			var countryCodeName = '';
			var taxIdentificationNo = '';
			var taxPaidOutsideIndia = '';
			var taxReliefOutsideIndia = '';

			for (var i = 1; i < noRows; i++) {
				var index = document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].countryCode')[0].selectedIndex;

				countryCodeName = document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].countryCode')[0].options[index].text;

				if (countryCodeName == "Select") {
					countryCodeName = '';
				}

				taxIdentificationNo = document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].taxIdentificationNo')[0].value;
				taxPaidOutsideIndia = document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].totalCountryWisetaxPaidOutsideInd')[0].value;
				taxReliefOutsideIndia = document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].totalCountryWisetaxReliefinInd')[0].value;

				addSchTRRow(countryCodeName, taxIdentificationNo,
						taxPaidOutsideIndia, taxReliefOutsideIndia);

				var countryCode = document
						.getElementsByName('scheduleTR1.scheduleTR[' + i
								+ '].countryCode')[0];
				var countryName = document
						.getElementsByName('scheduleTR1.scheduleTR[' + i
								+ '].countryName')[0];

				countryCode.value = document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].countryCode')[0].value;
				countryName.value = document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].countryName')[0].value;

				document.getElementsByName('scheduleTR1.scheduleTR[' + i
						+ '].relavantArticleDTAA')[0].value = sectionClaimed[countryCodeName
						+ '_' + taxIdentificationNo];

			}

		}
		for (var i = 0; i < noRows; i++) {
			var relavantArticleDTAA = document
					.getElementsByName('scheduleTR1.scheduleTR[' + i
							+ '].relavantArticleDTAA')[0];
			if (relavantArticleDTAA.value != '90'
					&& relavantArticleDTAA.value != '90A'
					&& relavantArticleDTAA.value != '91') {
				relavantArticleDTAA.value = '';
			}
		}

		totAmtOfSchedTRFor6('scheduleTR');
	} catch (e) {
		alert('Error in populateTR:' + e);
	}

}

var sectionClaimed = {};

function deleteTRRow() {
	try {
		var trTable = document.getElementById('scheduleTR');
		var noRows = trTable.rows.length;

		if (parseInt(noRows, 10) > 4) {
			for (var i = 2; i < parseInt(noRows, 10) - 3; i++) {
				var countryCode = document
						.getElementsByName('scheduleTR1.scheduleTR[' + (i - 1)
								+ '].countryCodeName')[0];
				var taxIdentificationNo = document
						.getElementsByName('scheduleTR1.scheduleTR[' + (i - 1)
								+ '].taxIdentificationNo')[0];
				sectionClaimed[countryCode.value + '_'
						+ taxIdentificationNo.value] = document
						.getElementsByName('scheduleTR1.scheduleTR[' + (i - 1)
								+ '].relavantArticleDTAA')[0].value;
				trTable.deleteRow(3);
			}
		}
		sectionClaimed[document
				.getElementsByName('scheduleTR1.scheduleTR[0].countryCodeName')[0].value
				+ '_'
				+ document
						.getElementsByName('scheduleTR1.scheduleTR[0].taxIdentificationNo')[0].value] = document
				.getElementsByName('scheduleTR1.scheduleTR[0].relavantArticleDTAA')[0].value;

		document.getElementsByName('scheduleTR1.scheduleTR[0].countryCode')[0].value = '';
		document
				.getElementsByName('scheduleTR1.scheduleTR[0].taxIdentificationNo')[0].value = '';
		document
				.getElementsByName('scheduleTR1.scheduleTR[0].taxPaidOutsideIndia')[0].value = '';
		document
				.getElementsByName('scheduleTR1.scheduleTR[0].taxReliefOutsideIndia')[0].value = '';

	} catch (e) {
		alert('Error in deleteTRRow:' + e);
	}
}

function addSchTRRow(countryCodeName, taxIdentificationNo, taxPaidOutsideIndia,
		taxReliefOutsideIndia) {
	try {
		var tableId = document.getElementById('scheduleTR');
		var mainTable = document.getElementById('scheduleTR').rows;
		var noOfRows = tableId.rows.length;
		var toInsertBefore = document.getElementById('scheduleTRLastRow');

		var lastIndex = eval(parseInt(noOfRows, 10) - 3);

		var cloneNode = mainTable[lastIndex].cloneNode(true);
		var newSlNo = cloneNode.cells[0].textContent;

		var iterate = eval(parseInt(newSlNo, 10) - 1);

		cloneNode.cells[0].innerHTML = eval(parseInt(newSlNo, 10) + 1);
		var inputTags = cloneNode.getElementsByTagName('input');
		var selectTags = cloneNode.getElementsByTagName('select');
		for (var a = 0; a < inputTags.length; a++) {
			inputTags[a].name = inputTags[a].name.replace('[' + iterate + ']',
					'[' + (lastIndex - 1) + ']');

			inputTags[a].id = inputTags[a].name.replace(/([\.\[\]])/g, '_')
					.replace(/(__)/g, '_');

			inputTags[0].value = countryCodeName;

			inputTags[3].value = taxIdentificationNo;

			inputTags[4].value = parseInt(taxPaidOutsideIndia, 10);
			inputTags[5].value = parseInt(taxReliefOutsideIndia, 10);

			var blurAttr = inputTags[a].getAttribute('onblur');
			if (blurAttr != null) {
				blurAttr = blurAttr + ";";
			} else {
				blurAttr = "";
			}
			inputTags[a].setAttribute('onblur', blurAttr
					+ 'j.blur(this,this.name,this.value);');
		}

		for (var a = 0; a < selectTags.length; a++) {
			selectTags[a].name = selectTags[a].name.replace(
					'[' + iterate + ']', '[' + (lastIndex - 1) + ']');
			selectTags[a].id = selectTags[a].name.replace(/([\.\[\]])/g, '_')
					.replace(/(__)/g, '_');

			var blurAttr = inputTags[a].getAttribute('onblur');
			if (blurAttr != null) {
				blurAttr = blurAttr + ";";
			} else {
				blurAttr = "";
			}
			selectTags[a].setAttribute('onblur', blurAttr
					+ 'j.blur(this,this.name,this.value);');
		}
		document.getElementById('scheduleTR').getElementsByTagName('tr')[0].parentNode
				.insertBefore(cloneNode, toInsertBefore);

	} catch (e) {
		alert('addSchTRRow' + e);
	}
}

function addRowSchedFSIFor2(nocheck) {

	var mainTable = document.getElementById('scheduleFSI').rows;
	var noOfRows = mainTable.length;

	var tobeInsertBefore = document.getElementById('scheduleFSIAddRow');
	var flag = true;
	var checkFirst = true;
	var totRow = document.getElementById('scheduleFSIFirst').cells[0].textContent;

	var iterate = eval(parseInt(totRow, 10));

	var indexValue = eval(((parseInt(noOfRows, 10) - 4) / 5) + 1);

	var isRowBlank = true;
	for (var i = 0; i < 6; i++) {
		if (!checkRowBlank('scheduleFSI', (3 + i), 0)) {
			isRowBlank = false;
			break;
		}
	}

	if (!isRowBlank || nocheck) {

		for (var i = 2; i < mainTable.length; i++) {
			var cloneNode = mainTable[i].cloneNode(true);
			if (flag) {
				var cellsTot = cloneNode.cells;
				var newVal = eval(parseInt(totRow) + 1);
				if (checkFirst) {
					iterate = eval(indexValue - 1);

					cloneNode.cells[0].innerHTML = indexValue;
					checkFirst = false;
				}

				// Numbering
				var inputTags = cloneNode.getElementsByTagName('input');
				for (var a = 0; a < inputTags.length; a++) {
					inputTags[a].name = inputTags[a].name.replace('[0]', '['
							+ iterate + ']');

					inputTags[a].id = inputTags[a].name.replace(/([\.\[\]])/g,
							'_').replace(/(__)/g, '_');
					inputTags[a].value = '';
					var blurAttr = inputTags[a].getAttribute('onblur');
					if (blurAttr != null) {
						blurAttr = blurAttr + ";";
					} else {
						blurAttr = "";
					}
					inputTags[a].setAttribute('onblur', blurAttr
							+ 'j.blur(this,this.name,this.value);');
				}

				var selectTags = cloneNode.getElementsByTagName('select');
				for (var a = 0; a < selectTags.length; a++) {
					selectTags[a].name = selectTags[a].name.replace('[0]', '['
							+ iterate + ']');
					selectTags[a].value = '';

					selectTags[a].id = selectTags[a].name.replace(
							/([\.\[\]])/g, '_').replace(/(__)/g, '_');

					var blurAttr = selectTags[a].getAttribute('onblur');
					if (blurAttr != null) {
						blurAttr = blurAttr + ";";
					} else {
						blurAttr = "";
					}
					selectTags[a].setAttribute('onblur', blurAttr
							+ 'j.blur(this,this.name,this.value);');
				}

				document.getElementById('scheduleFSI').getElementsByTagName(
						'tr')[0].parentNode.insertBefore(cloneNode,
						tobeInsertBefore);
			}
			if (mainTable[i].id == 'scheduleFSIEnd') {
				flag = false;
				break;
			}
		}
		if ($('#scheduleFSIAddRow')[0].parentNode.children.length == 10) {
			$('#delFSIButtonId').prop('disabled', true);
		} else if ($('#scheduleFSIAddRow')[0].parentNode.children.length > 10) {
			$('#delFSIButtonId').prop('disabled', false);
		}

	} else {
		addErrorXHTML(
				'',
				'Please fill in all the mandatory fields in the last row before adding another row.');
	}
	checkMaxLengthLimit();
}

function deleteRowFSI(tableId, noOfHeader, noOfFooter) {
	try {
		var mytable = document.getElementById(tableId);
		var rowCount = mytable.rows.length;
		var itemCount = (rowCount - 4) / 5;
		noOfHeader = parseInt(noOfHeader, 10);
		var isChecked = false;
		var listOfCheckBox = mytable.getElementsByTagName('input');
		var totalChecked = 0;
		for (var z = 0; z < listOfCheckBox.length; z++) {
			if (listOfCheckBox[z].name.match(".chosenCheckBox$")) {
				if (listOfCheckBox[z].checked == true) {
					totalChecked = eval(parseInt(totalChecked, 10) + 1);
					isChecked = true;
				}
			}
		}
/*		if (!isChecked) {
			addErrorXHTML('', 'Please select a checkbox for deleting row');
		}*/

		for (var j = 1; j <= totalChecked; j++) { // iterate for total number
													// of checkboxes
			var totalNoOfInput = mytable.getElementsByTagName('input');

			for (var z = 0; z < totalNoOfInput.length; z++) {
				if (totalNoOfInput[z].name.match(".chosenCheckBox$")) { // if
																		// its a
																		// chosenCheckBox
																		// element

					var akhilIndex1 = eval(parseInt(totalNoOfInput[z].name
							.lastIndexOf('['), 10) + 1);
					var akhilIndex2 = eval(parseInt(totalNoOfInput[z].name
							.lastIndexOf(']'), 10));
					var rowNumber = totalNoOfInput[z].name.substring(
							akhilIndex1, akhilIndex2);
					rowNumber = parseInt(rowNumber, 10);

					var myCurrtable = document.getElementById(tableId);
					var rowCurrCount = myCurrtable.rows.length;

					if (totalNoOfInput[z].checked == true) {
						if ((rowNumber != 0)
								|| (rowNumber == 0 && parseInt(eval(rowCurrCount
										- noOfHeader - noOfFooter) / 5) > 1)) {
							rowNumber = eval(parseInt(rowNumber, 10) * 5
									+ noOfHeader);
							for (var i = 0; i < 5; i++) {
								mytable.deleteRow(rowNumber);
							}
							// To Do - reset the name of row for all input ,
							// textarea, select
							var newTrList = mytable.getElementsByTagName('tr');
							var newTrListLength = eval(parseInt(
									newTrList.length, 10)
									- noOfFooter);
							for (var q = rowNumber; q < newTrListLength; q++) { // iterate
																				// over
																				// all
																				// rows
																				// from
																				// delete
																				// point
																				// to
																				// second
																				// last
																				// row
								var p = parseInt((q - noOfHeader) / 5)
										+ noOfHeader;
								// set the serial number;
								if ((q - noOfHeader) % 5 == 0) {
									if (noOfHeader == 2) {
										newTrList[q].getElementsByTagName('td')[0].innerHTML = parseInt(
												p - 1, 10);
									} else if (noOfHeader == 1) {
										newTrList[q].getElementsByTagName('td')[0].innerHTML = parseInt(
												p, 10);
									} else if (noOfHeader == 3) {
										newTrList[q].getElementsByTagName('td')[0].innerHTML = parseInt(
												p - 2, 10);
									}
								}
								var allInputTags = newTrList[q]
										.getElementsByTagName('input');

								for (var zz = 0; zz < allInputTags.length; zz++) {
									var index1 = allInputTags[zz].name
											.lastIndexOf('[');
									var index2 = allInputTags[zz].name
											.lastIndexOf(']');

									var str1 = allInputTags[zz].name.substring(
											0, index1);
									var str3 = allInputTags[zz].name.substring(
											index2 + 1,
											allInputTags[zz].name.length);

									allInputTags[zz].name = str1
											+ '['
											+ eval(parseInt(p, 10) - noOfHeader)
											+ ']' + str3;
								}

								var allSelectTags = newTrList[q]
										.getElementsByTagName('select');

								for (var zz = 0; zz < allSelectTags.length; zz++) {
									var index1 = allSelectTags[zz].name
											.lastIndexOf('[');
									var index2 = allSelectTags[zz].name
											.lastIndexOf(']');

									var str1 = allSelectTags[zz].name
											.substring(0, index1);
									var str3 = allSelectTags[zz].name
											.substring(
													index2 + 1,
													allSelectTags[zz].name.length);

									allSelectTags[zz].name = str1
											+ '['
											+ eval(parseInt(p, 10) - noOfHeader)
											+ ']' + str3;
								}

								var allTextAreaTags = newTrList[q]
										.getElementsByTagName('textarea');

								for (var zz = 0; zz < allTextAreaTags.length; zz++) {
									var index1 = allTextAreaTags[zz].name
											.lastIndexOf('[');
									var index2 = allTextAreaTags[zz].name
											.lastIndexOf(']');

									var str1 = allTextAreaTags[zz].name
											.substring(0, index1);
									var str3 = allTextAreaTags[zz].name
											.substring(
													index2 + 1,
													allTextAreaTags[zz].name.length);

									allTextAreaTags[zz].name = str1
											+ '['
											+ eval(parseInt(p, 10) - noOfHeader)
											+ ']' + str3;
								}
							}
							break;
						} else if ((rowNumber == 0)
								&& (parseInt(eval(rowCurrCount - noOfHeader
										- noOfFooter) / 5) == 1)) {
							// Vacate the content if its first row

							for (var m = 0; m < 5; m++) {
								var firstRow = mytable
										.getElementsByTagName('tr')[parseInt(noOfHeader)
										+ m];

								var firstInputBox = firstRow
										.getElementsByTagName('input')[0];
								firstInputBox.checked = false;

								var allInputTags = firstRow
										.getElementsByTagName('input');
								for (var i = 0; i < allInputTags.length; i++) {
									allInputTags[i].value = "";
								}
								var allSelectTags = firstRow
										.getElementsByTagName('select');
								for (var i = 0; i < allSelectTags.length; i++) {
									var elem = allSelectTags[i];
									elem[0].selected = true;
								}
								var allTextAreaTags = firstRow
										.getElementsByTagName('textarea');
								for (var i = 0; i < allTextAreaTags.length; i++) {
									allTextAreaTags[i].value = "";
								}
							}
						}
					}
				}
			}
		}

	} catch (e) {
		alert('exception caught in =' + e.stack);
	}
}

function setSch80HiddenField(tableId, SecDesc) {
	var tab = document.getElementById(tableId);
	var inputs = tab.getElementsByTagName('INPUT');

	for (var i = 0; i < inputs.length; i++) {

		if (inputs[i].name.match('SectionDesc$')) {
			inputs[i].value = SecDesc;
		}
	}

}

function schTRonLoad() {

	var fsiTable = document.getElementById('scheduleFSI');
	var noRows = (fsiTable.rows.length - 4) / 5;

	for (var i = 0; i < noRows; i++) {
		var index = document.getElementsByName('itrScheduleFSI.scheduleFSI['
				+ i + '].countryCode')[0].selectedIndex;
		var countryCodeName = document
				.getElementsByName('scheduleTR1.scheduleTR[' + i
						+ '].countryCodeName')[0];

		countryCodeName.value = document
				.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
						+ '].countryCode')[0].options[index].text;

		if (countryCodeName.value == "Select") {
			countryCodeName.value = '';
		}
	}
	totAmtOfSchedTRFor6();
}

function validateFSI() {
	var table = document.getElementById('scheduleFSI');
	var noOfRows = table.rows.length;
	var indexValue = eval(((parseInt(noOfRows, 10) - 4) / 5));
	var empty2, empty3, empty4;
	for (var i = 0; i < indexValue; i++) {
		if (document.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
				+ '].countryCode')[0].value != '') {
			var empty = true;
			var errors = [
					'Income from outside India(included in PART B-TI) is required',
					'Tax paid outside India is required',
					'Tax payable on such income under normal provisions in India is required',
					'Relevant article of DTAA if relief claimed u/s 90 or 90A is required' ];
			empty2 = empty
					&& !validateAllFilled([
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromHPincFrmOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromHPtaxPaidOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromHPtaxPayableinInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromHPdtaaReliefUs90or90A' ],
							errors);
			empty3 = empty
					&& !validateAllFilled([
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incCapGainincFrmOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incCapGaintaxPaidOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incCapGaintaxPayableinInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incCapGaindtaaReliefUs90or90A' ],
							errors);
			empty4 = empty
					&& !validateAllFilled([
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incOthSrcincFrmOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incOthSrctaxPaidOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incOthSrctaxPayableinInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incOthSrcdtaaReliefUs90or90A' ],
							errors);
			empty5 = empty
					&& !validateAllFilled([
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromBusinessincFrmOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromBusinesstaxPaidOutsideInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromBusinesstaxPayableinInd',
							'itrScheduleFSI.scheduleFSI[' + i
									+ '].incFromBusinessdtaaReliefUs90or90A' ],
							errors);
			if (empty2 && empty3 && empty4 && empty5) {
				j.setFieldError('itrScheduleFSI.scheduleFSI[' + i
						+ '].incFromHPincFrmOutsideInd',
						'Please fill atleast one income');
				addErrorXHTML(document
						.getElementsByName('itrScheduleFSI.scheduleFSI[' + i
								+ '].incFromHPincFrmOutsideInd')[0],
						'Please fill atleast one income', true);
			}
		}
	}
}
function validateAllFilled(fieldNames, errors) {
	var fields = [];
	var filled = 0;
	for (var i = 0; i < fieldNames.length; i++) {
		fields[i] = document.getElementsByName(fieldNames[i])[0];
		if (fields[i].value != '' && fields[i].value != undefined) {
			filled++;
		}
	}
	if (filled > 0) {
		for (var i = 0; i < fieldNames.length; i++) {
			if (fields[i].value == '' || fields[i].value == undefined) {
				if (i == fieldNames.length - 1) {
					if (Math.min(coalesce(fields[1].value),
							coalesce(fields[2].value)) == parseInt(0)) {
						continue;
					}
				}
				j.setFieldError(fieldNames[i], errors[i]);
				addErrorXHTML(fields[i], errors[i], true);
				break;
			}
		}
		return true;
	}
	return false;
}

function validateCGSecwiseDed() {
	var arr = {
		'54D' : 0,
		'54EC' : 0,
		//'54EE' : 0,
		'54G' : 0,
		'54GA' : 0

	};

	var arrDed = {
		'54D' : 0,
		'54EC' : 0,
	//	'54EE' : 0,
		'54G' : 0,
		'54GA' : 0

	};
	var table = document.getElementById('scheduleCGstcg1');
	var noOfRows = table.rows.length;
	var valueA1d = parseInt('0', 10);
	for (var i = 0; i < noOfRows / 14; i++) {
		var r = i + 1;
		var tableId = 'stcgDeduction_ded' + r;
		sumSectionWise(tableId, arr);
	}
	sumSectionWise('stcgDeduction2', arr);

	var table = document.getElementById('scheduleCGltcg1');
	var noOfRows = table.rows.length;
	var valueB1d = parseInt('0', 10);
	for (var i = 0; i < noOfRows / 14; i++) {
		var r = i + 1;
		var tableId = 'ltcgDeduction1_ded' + r;
		sumSectionWiseTable2(tableId, arr);
	}
	coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.capGainSlumpSale.exemptionOrDednUs54')
	var amtEC = document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.capGainSlumpSale.exemptionOrDednUs54')[0].value;
	var temp =arr['54EC']+parseInt(amtEC);
	
	sumSectionWise('scheduleCGltcg7', arr);
	sumSectionWise('scheduleCGltcg3', arr);
	//sumSectionWiseTable2(arr);

	/*arr['54EE'] = parseInt(arr['54EE'])
			+ coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.saleofBondsDebntr.exemptionOrDednUs54');*/
/*	arr['54EE'] = parseInt(arr['54EE'])
			+ coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].exemptionOrDednUs54S');
*/
/*	arr['54EE'] = parseInt(arr['54EE'])
			+ coalesceSetRet('scheduleCGFor5.shortTermCapGainFor5.saleofEquityLtcg.deduction54F');*/

/*	arr['54EE'] = parseInt(arr['54EE'])
			+ coalesceSetRet('scheduleCGPost45.longTermCapGainPost45.nRIProvisoSec48.exemptionOrDednUs54');*/
/*	arr['54EE'] = parseInt(arr['54EE'])
			+ coalesceSetRet('scheduleCGFor8.shortTermCapGainFor8.saleofEquityLtcg.deduction54F');
*/
	//arr['54EE'] = parseInt(arr['54EE']) + sumSectionWiseNEW('stcg10pctTab');

	sumSectionWiseCGTableD('schduleCGDedD1B', arrDed, '54D');
	sumSectionWiseCGTableD('schduleCGDedD1C', arrDed, '54EC');
	//sumSectionWiseCGTableD('schduleCGDedD1D', arrDed, '54EE');
	sumSectionWiseCGTableD('schduleCGDedD1E', arrDed, '54G');
	sumSectionWiseCGTableD('schduleCGDedD1F', arrDed, '54GA');

	if (arr['54D'] != arrDed['54D']) {
		j
				.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtls[0].deductedSecCode',
						'Deduction under 54D must match with deduction in table D');
		addErrorXHTML('',
				'Deduction under 54D must match with deduction in table D',
				true);
	}

	if (temp != arrDed['54EC']) {
		
		j
				.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtls[0].deductedSecCode',
						'Deduction under 54EC must match with deduction in table D');
		addErrorXHTML('',
				'Deduction under 54EC must match with deduction in table D',
				true);
	}

/*	if (arr['54EE'] != arrDed['54EE']) {
		j
				.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtls[0].deductedSecCode',
						'Deduction under 54EE must match with deduction in table D');
		addErrorXHTML('',
				'Deduction under 54EE must match with deduction in table D',
				true);
	}*/

	if (arr['54G'] != arrDed['54G']) {
		j
				.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtls[0].deductedSecCode',
						'Deduction under 54G must match with deduction in table D');
		addErrorXHTML('',
				'Deduction under 54G must match with deduction in table D',
				true);
	}

	if (arr['54GA'] != arrDed['54GA']) {
		j
				.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtls[0].deductedSecCode',
						'Deduction under 54GA must match with deduction in table D');
		addErrorXHTML('',
				'Deduction under 54GA must match with deduction in table D',
				true);
	}

	if (arr) {
		if (arr['54D'] > 0) {
			document.getElementsByName('scheduleCG54D')[0].value = "Y";
		} else {
			document.getElementsByName('scheduleCG54D')[0].value = "N";

		}
		if (arr['54EC'] > 0) {
			document.getElementsByName('scheduleCG54EC')[0].value = "Y";
		} else {
			document.getElementsByName('scheduleCG54EC')[0].value = "N";

		}
		/*if (arr['54EE'] > 0) {
			document.getElementsByName('scheduleCG54EE')[0].value = "Y";
		} else {
			document.getElementsByName('scheduleCG54EE')[0].value = "N";

		}*/
		if (arr['54G'] > 0) {
			document.getElementsByName('scheduleCG54G')[0].value = "Y";
		} else {
			document.getElementsByName('scheduleCG54G')[0].value = "N";

		}
		if (arr['54GA'] > 0) {
			document.getElementsByName('scheduleCG54GA')[0].value = "Y";
		} else {
			document.getElementsByName('scheduleCG54GA')[0].value = "N";

		}

		var tab4 = document.getElementById('schduleCGDedD1E');
		var noOfRows4 = tab4.rows.length;

		for (var i = 0; i < (noOfRows4 - 3); i++) {
			if (document
					.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
							+ i + '].costofNewResHouse')[0].value != ""
					|| document
							.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
									+ i + '].dateofPurchase')[0].value != ""
					|| document
							.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
									+ i + '].amtDeposited')[0].value != "") {
				document.getElementsByName('scheduleCG54D')[0].value = "Y";
			}
			if (document
					.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
							+ i + '].costofNewResHouse')[0].value != ""
					|| document
							.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
									+ i + '].dateofPurchase')[0].value != ""
					|| document
							.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
									+ i + '].amtDeposited')[0].value != "") {
				document.getElementsByName('scheduleCG54G')[0].value = "Y";
			}
			if (document
					.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
							+ i + '].costofNewResHouse')[0].value != ""
					|| document
							.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
									+ i + '].dateofPurchase')[0].value != ""
					|| document
							.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
									+ i + '].amtDeposited')[0].value != "") {
				document.getElementsByName('scheduleCG54GA')[0].value = "Y";
			}
		}

	}
}
function sumSectionWise(tableId, arr){
	var tab = document.getElementById(tableId);
	var selects = tab.getElementsByTagName("SELECT");
	for(var i=0;i<selects.length;i++){
		if((selects[i].name.match('section$') || selects[i].name.match('deductedSecCode$')) && selects[i].value!=''){
			var name = selects[i].name;
			var str1 = name.substr(0,name.lastIndexOf('[')+1);
			var amt = document.getElementsByName(str1+i+'].amount')[0];
			arr[selects[i].value] = parseInt(arr[selects[i].value]) + parseInt(coalesce(amt.value));
			
		}
	}
	return arr;
}
function sumSectionWiseTable2(tableId, arr) {
	var tab = document.getElementById(tableId);
	var selects = tab.getElementsByTagName("SELECT");
	for (var i = 0; i < selects.length; i++) {
		if ((selects[i].name.match('section$') || selects[i].name
				.match('deductedSecCode$'))
				&& selects[i].value != '') {
			var name = selects[i].name;
			var str1 = name.substr(0, name.lastIndexOf('[') + 1);
			var amt = document.getElementsByName(str1 + i + '].amount')[0];

			arr[selects[i].value] = parseInt(arr[selects[i].value]) + parseInt(coalesce(amt.value));

		
		}
	}


	return arr['54EC'];
}

/*function sumSectionWiseTable2(arr){
	var amt = document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.capGainSlumpSale.exemptionOrDednUs54')[0].value;
	alert('sumSectionWiseTable2 amt '+amt);
	return arr['54EC']=amt;
	
}*/
function sumSectionWiseCGTableD(tableId, arr, section) {

	var tab = document.getElementById(tableId);
	var input = tab.getElementsByTagName("INPUT");
	for (var i = 0; i < input.length; i++) {
		if ((input[i].name.match('amtDeducted$')) && input[i].value != '') {
			arr[section] = parseInt(arr[section])
					+ parseInt(coalesce(input[i].value));
		}
	}
	return arr;
}

function getDueDate234A() {
	var duedate = '31/10/2020';

	var auditFlag = document.getElementsByName('partAGEN2.liableSec44ABflg')[0].value;
	
	var tab92E = document.getElementById('othSecDateTabId');
	var allInputTags = tab92E.getElementsByTagName('select');

	for (var i = 0; i < allInputTags.length; i++) {

		if (allInputTags[i].name.match("auditedSection$")) {
			if (document.getElementsByName('partAGEN2.liableSec92Eflg')[0].value == 'Y') {

				duedate = '30/11/2020';
				break;
			}

			else {
				duedate = "31/10/2020";
			
			}
		}
	}

	return duedate;
}

function CheckHPShareProperty() {
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);

	for (var i = 0; i < totHp; i++) {

		if (document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].propCoOwnedFlg')[0].value == 'YES') {
			var count = i;
			var AssessPerc = document
					.getElementsByName('scheduleHP.propertyDetails[' + i
							+ '].asseseeShareProperty')[0];
			var tab = document.getElementById('scheduleHP' + (++count));

			var sumOfCoOwner = parseFloat('0');

			var rowCount = tab.rows.length;

			for (var k = 0; k < rowCount - 2; k++) {

				sumOfCoOwner = sumOfCoOwner
						+ (mulFloatBy100(document
								.getElementsByName('scheduleHP.propertyDetails['
										+ i
										+ '].coOwners['
										+ k
										+ '].percentShareProperty')[0].value));
			}

			if (checkHPShareSum((parseInt(sumOfCoOwner) + mulFloatBy100(AssessPerc.value)) / 100)) {
				addErrorXHTML(
						AssessPerc,
						'Sum of Assessee Percentage and Co-owner(s) Percentage should be equal to 100 percent',
						true);
				j
						.setFieldError(
								'scheduleHP.propertyDetails[' + i
										+ '].asseseeShareProperty',
								'Sum of Assessee Percentage and Co-owner(s) Percentage should be equal to 100 percent');
			}
		}
	}
}

function checkHPShareSum(total) {
	if (total >= 99.9 && total <= 100) {
		return false;
	}
	return true;
}

function CheckBFLAUDMismatch() {
	if (coalescePath('scheduleBFLA.totalBFLossSetOff.totUnabsorbedDeprSetoff') != coalescePath('itrScheduleUD.totalamtDepCurYr')) {
		addErrorXHTML(
				document.getElementsByName('itrScheduleUD.totalamtDepCurYr')[0],
				'This figure must match with Total of brought forward loss set off in BFLA',
				true);
		j
				.setFieldError('itrScheduleUD.totalamtDepCurYr',
						'This figure must match with Total of brought forward loss set off in BFLA');
	}

	if (coalescePath('scheduleBFLA.totalBFLossSetOff.totAllUs35Cl4Setoff') != coalescePath('itrScheduleUD.amountASACYIncome')) {
		addErrorXHTML(
				document.getElementsByName('itrScheduleUD.amountASACYIncome')[0],
				'This figure must match with Total of brought forward loss set off in BFLA',
				true);
		j
				.setFieldError('itrScheduleUD.amountASACYIncome',
						'This figure must match with Total of brought forward loss set off in BFLA');
	}
}

function checkEmptySchUDAmt() {
	var tab1 = document.getElementById('scheduleUD');
	var rowCount = tab1.rows.length;

	for (var i = 0; i < rowCount - 5; i++) {
		var assYr = document.getElementsByName('itrScheduleUD.scheduleUD[' + i
				+ '].assYr')[0].value;
		if (assYr != '' && assYr != undefined && assYr != null) {
			var amtBFUD = document
					.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].amtBFUD')[0];
			var amountBFUA = document
					.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].amountBFUA')[0];

			var amtDepCurYr = document
					.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].amtDepCurYr')[0];
			var amountASACYIncome = document
					.getElementsByName('itrScheduleUD.scheduleUD[' + i
							+ '].amountASACYIncome')[0];

			if (amtBFUD.value == '' && amountBFUA.value == '') {
				addError(
						amtBFUD,
						'Please enter amount of brought forward unabsorbed depreciation or Allowance u/s 35(4)',
						true);
				j
						.setFieldError(
								amtBFUD.name,
								'Please enter amount of brought forward unabsorbed depreciation or Allowance u/s 35(4)');
			} else {
				if (amtBFUD.value > 0 && amtDepCurYr.value == '') {
					addError(
							amtDepCurYr,
							'Please enter amount of depreciation set-off against the current year income u/s 35(4)',
							true);
					j
							.setFieldError(
									amtDepCurYr.name,
									'Please enter amount of depreciation set-off against the current year income u/s 35(4)');
				}
				if (amountBFUA.value > 0 && amountASACYIncome.value == '') {
					addError(
							amountASACYIncome,
							'Please enter amount of allowance set-off against the current year income u/s 35(4)',
							true);
					j
							.setFieldError(
									amountASACYIncome.name,
									'Please enter amount of allowance set-off against the current year income u/s 35(4)');
				}
			}

		}
	}
}

/*
 * function checkSI5BWarning(){
 * 
 * if(document.getElementsByName('scheduleSI.splCodeRateTax[2].splRateInc')[0].value>0){
 * 
 * addErrorXHTML('','Please ensure that income u/s 115B forms part of Sch
 * BP',true); } }
 */

function addRowToCG(tableId) {
	try {
		var tab = document.getElementById(tableId);
		var body = tab.tBodies[0];
		var clone = body.cloneNode(true);
		var index = parseInt(tab.tBodies.length, 10) + 1;
		clone.rows[0].cells[0].innerHTML = index;
		var inputs = clone.getElementsByTagName('INPUT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].name = inputs[i].name.replace(/\[[\d]+\]/, '['
					+ (index - 1) + ']');
			inputs[i].value = '';
			var blurAttr = inputs[i].getAttribute('onblur');
			if (blurAttr != null) {
				blurAttr = blurAttr + ";";
			} else {
				blurAttr = "";
			}
			inputs[i].setAttribute('onblur', blurAttr
					+ 'j.blur(this,this.name,this.value);');
		}
		var selects = clone.getElementsByTagName('SELECT');
		for (var i = 0; i < selects.length; i++) {
			selects[i].name = selects[i].name.replace(/\[[\d]+\]/, '['
					+ (index - 1) + ']');
			selects[i].selectedIndex = 0;
			var blurAttr = selects[i].getAttribute('onblur');
			if (blurAttr != null) {
				blurAttr = blurAttr + ";";
			} else {
				blurAttr = "";
			}
			selects[i].setAttribute('onblur', blurAttr
					+ 'j.blur(this,this.name,this.value);');
		}
		if (tableId == 'scheduleCGstcg1') {
			if (clone.getElementsByTagName('table').length > 1) {
				var newTableId = clone.getElementsByTagName('table')[0].id
						.substring(0, 13);
				var newTableId1 = clone.getElementsByTagName('table')[1].id
						.substring(0, 14);

				clone.getElementsByTagName('table')[0].setAttribute('id',
						newTableId + '_ded' + index);
				clone.getElementsByTagName('img')[0].setAttribute('onclick',
						'addRowToTable(' + '\'' + newTableId + '_ded' + index
								+ '\',3,2,this);');
				clone.getElementsByTagName('img')[1].setAttribute('onclick',
						'deleteRowTable(' + '\'' + newTableId + '_ded' + index
								+ '\',1,2)');
				clone.getElementsByTagName('table')[1].setAttribute('id',
						newTableId1 + '_ded' + index);
				clone.getElementsByTagName('img')[2].setAttribute('onclick',
						'addRowToTable(' + '\'' + newTableId1 + '_ded' + index
								+ '\',2,1);');
				clone.getElementsByTagName('img')[3].setAttribute('onclick',
						'deleteRowTable(' + '\'' + newTableId1 + '_ded' + index
								+ '\',2,1)');
			}
		} else {
			if (tableId == 'scheduleCGltcg1') {
				if (clone.getElementsByTagName('table').length > 1) {
					var newTableId = clone.getElementsByTagName('table')[0].id
							.substring(0, 14);

					clone.getElementsByTagName('table')[0].setAttribute('id',
							newTableId + '_ded' + index);
					clone.getElementsByTagName('img')[0].setAttribute(
							'onclick', 'addRowToTable(' + '\'' + newTableId
									+ '_ded' + index + '\',3,2,this);');
					clone.getElementsByTagName('img')[1].setAttribute(
							'onclick', 'deleteRowTable(' + '\'' + newTableId
									+ '_ded' + index + '\',1,2)');
					clone.getElementsByTagName('table')[1].setAttribute('id',
							tableId + '_ded' + index);
					clone.getElementsByTagName('img')[2].setAttribute(
							'onclick', 'addRowToTable(' + '\'' + tableId
									+ '_ded' + index + '\',2,1);');
					clone.getElementsByTagName('img')[3].setAttribute(
							'onclick', 'deleteRowTable(' + '\'' + tableId
									+ '_ded' + index + '\',2,1)');
				}

			} else {

				if (clone.getElementsByTagName('table').length > 0) {
					clone.getElementsByTagName('table')[0].setAttribute('id',
							tableId + '_ded' + index);
					clone.getElementsByTagName('img')[0].setAttribute(
							'onclick', 'addRowToTable(' + '\'' + tableId
									+ '_ded' + index + '\',3,2,this);');
					clone.getElementsByTagName('img')[1].setAttribute(
							'onclick', 'deleteRowTable(' + '\'' + tableId
									+ '_ded' + index + '\',1,2)');
				}
			}

		}

		tab.appendChild(clone);
		modifyRow(tab);

		if (tableId == 'scheduleCGltcg1') {
			if (clone.getElementsByTagName('table').length > 0) {
				var newTableId = clone.getElementsByTagName('table')[0].id
						.substring(0, 14);
				var newTableId1 = tableId.substring(0, 15);

				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						true);
				deleteRowTable(newTableId + '_ded' + index, 1, 2);
				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						false);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", true);
				deleteRowTable(newTableId1 + '_ded' + index, 2, 1);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", false);
			}
		} else if (tableId == 'scheduleCGstcg1') {
			if (clone.getElementsByTagName('table').length > 0) {
				var newTableId = clone.getElementsByTagName('table')[0].id
						.substring(0, 13);
				var newTableId1 = tableId.substring(0, 14);

				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						true);
				deleteRowTable(newTableId + '_ded' + index, 1, 2);
				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						false);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", true);
				deleteRowTable(newTableId1 + '_ded' + index, 2, 1);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", false);
			}

		} else {
			if (clone.getElementsByTagName('table').length > 0) {
				$('#' + tableId + '_ded' + index + ' input').attr("checked",
						true);
				deleteRowTable(tableId + '_ded' + index, 1, 2);
				$('#' + tableId + '_ded' + index + ' input').attr("checked",
						false);
			}
		}
	} catch (e) {
		alert(e.stack);
	}

}

function deleteRowToCG(tableId) {
	var tab = document.getElementById(tableId);
	var len = tab.tBodies.length;
	if (len > 1) {
		tab.removeChild(tab.tBodies[len - 1]);
	}
	modifyRow(tab);
}

function addRowToTableSchDDT(tableId, noOfRow, last, elem) {

	addRowToTable(tableId, noOfRow, last);

}

function addRowToTableSchBBT(tableId, noOfRow, last, elem) {

	addRowToTable(tableId, noOfRow, last);

}

function addRowToDDT() {

	var tableId = document.getElementById('scheduleDDT');
	var TableRows = document.getElementById('scheduleDDT').rows;
	var tbdy = document.getElementById('scheduleDDT').tBodies[0];
	var noOfRows = tableId.rows.length;
	var ddtptableId = document.getElementById('scheduleDDTP1');
	var lastRowDDT = document.getElementById('lastrowddt');
	var lastIndex = eval(parseInt(noOfRows, 10) - 2);
	var cloneNode = TableRows[lastIndex].cloneNode(true);

	var lastTab = eval(parseInt(TableRows[lastIndex]
			.getElementsByTagName('table')[0].id.substring(12), 10) + 1);

	var newSlNo = cloneNode.cells[0].textContent;
	var iterate = eval(parseInt(newSlNo, 10));
	var index = noOfRows - 3;
	cloneNode.cells[0].innerHTML = eval(parseInt(newSlNo, 10) + 1);
	var newTableId = 'scheduleDDTP' + lastTab;
	var inputTags = cloneNode.getElementsByTagName('input');
	var selectTags = cloneNode.getElementsByTagName('select');

	var isRowBlank = checkRowBlankDDT('scheduleDDT', 2, 1);

	if (!isRowBlank) {
		for (var i = 0; i < TableRows.length; i++) {

			for (var n = 0; n < inputTags.length; n++) {

				inputTags[n].name = inputTags[n].name.replace(/\[[\d]+\]/, '['
						+ (iterate) + ']');
				inputTags[n].id = inputTags[n].name.replace(/([\.\[\]])/g, '_')
						.replace(/(__)/g, '_');
				inputTags[n].value = '';
				var blurAttr = inputTags[n].getAttribute('onblur');
				if (blurAttr != null) {
					blurAttr = blurAttr + ";";
				} else {
					blurAttr = "";
				}
				inputTags[n].setAttribute('onblur', blurAttr
						+ 'j.blur(this,this.name,this.value);');

				var classType = inputTags[n].getAttribute("class");
				var className = inputTags[n].getAttribute("className");

				if (classType == "date_dummy_black hasDatepicker"
						|| className == "date_dummy_black hasDatepicker") {
					inputTags[n].id = inputTags[n].id + newSlNo;
					inputTags[n].setAttribute("className", "date_dummy_black");
					inputTags[n].setAttribute("class", "date_dummy_black");
					saras = inputTags[n].id;

				}

			}

			for (var n = 0; n < selectTags.length; n++) {

				selectTags[n].name = selectTags[n].name.replace(/\[[\d]+\]/,
						'[' + (iterate) + ']');
				selectTags[n].id = selectTags[n].name.replace(/([\.\[\]])/g,
						'_').replace(/(__)/g, '_');
				selectTags[n].value = '';
				var blurAttr = selectTags[n].getAttribute('onblur');
				if (blurAttr != null) {
					blurAttr = blurAttr + ";";
				} else {
					blurAttr = "";
				}
				selectTags[n].setAttribute('onblur', blurAttr
						+ 'j.blur(this,this.name,this.value);');
			}
			if (cloneNode.getElementsByTagName('table').length > 0) {
				cloneNode.getElementsByTagName('table')[0].setAttribute('id',
						newTableId);
				cloneNode.getElementsByTagName('img')[0].setAttribute(
						'onclick', 'addRowToTable(' + '\'' + newTableId
								+ '\',3,2,this);calcITR6();');
				cloneNode.getElementsByTagName('img')[1].setAttribute(
						'onclick', 'deleteRowTable(' + '\'' + newTableId
								+ '\',0,2);calcITR6();');

			}

		}

		document.getElementById('scheduleDDT').getElementsByTagName('tr')[0].parentNode
				.insertBefore(cloneNode, lastRowDDT);

		if (document.getElementById(newTableId).rows.length > 3) {
			$('#' + newTableId + ' input').attr("checked", true);
			deleteRowTable(newTableId, 0, 2);
			$('#' + newTableId + ' input').attr("checked", false);
		}

		var allInputTags = cloneNode.getElementsByTagName('input');

		for (var i = 0; i < allInputTags.length; i++) {

			var classType = allInputTags[i].getAttribute("class");
			var className = allInputTags[i].getAttribute("className");

			if (classType == "date_dummy_black"
					|| className == "date_dummy_black") {
				saras = allInputTags[i].id;

				$(function() {
					$("#" + saras).datepicker({
						changeMonth : true,
						changeYear : true,
						yearRange : "-100:+5",
						dateFormat : "dd/mm/yy",
						buttonText : "Choose",
						showOtherMonths : true,
						selectOtherMonths : true
					});
				});
			}
		}

		checkMaxLengthLimit();

	} else {
		addErrorXHTML(
				'',
				'Please fill in all the mandatory fields in the last row before adding another row.');
	}

}

function deleteRowDDT(tableId, noOfHeader, noOfFooter) {
	try {
		var mytable = document.getElementById(tableId);
		var rowCount = mytable.rows.length;
		noOfHeader = parseInt(noOfHeader, 10);
		var isChecked = false;
		var listOfCheckBox = mytable.getElementsByTagName('input');
		var totalChecked = 0;

		for (var z = 0; z < listOfCheckBox.length; z++) {
			if (listOfCheckBox[z].name.match(".pChosenCheckBox$")) {

				if (listOfCheckBox[z].checked == true) {
					totalChecked = eval(parseInt(totalChecked, 10) + 1);
					isChecked = true;
				}
			}
		}

		if (!isChecked) {
			addErrorXHTML('', 'Please select a checkbox for deleting row');
		}

		for (var j = 1; j <= totalChecked; j++) { // iterate for total number
													// of checkboxes
			var totalNoOfInput = mytable.getElementsByTagName('input');

			for (var z = 0; z < totalNoOfInput.length; z++) {
				if (totalNoOfInput[z].name.match(".pChosenCheckBox$")) { // if
																			// its
																			// a
																			// chosenCheckBox
																			// element

					var akhilIndex1 = eval(parseInt(totalNoOfInput[z].name
							.lastIndexOf('['), 10) + 1);
					var akhilIndex2 = eval(parseInt(totalNoOfInput[z].name
							.lastIndexOf(']'), 10));
					var rowNumber = totalNoOfInput[z].name.substring(
							akhilIndex1, akhilIndex2);
					rowNumber = parseInt(rowNumber, 10);

					var myCurrtable = document.getElementById(tableId);
					var rowCurrCount = myCurrtable.rows.length;

					if (totalNoOfInput[z].checked == true) {
						if ((rowNumber != 0)
								|| (rowNumber == 0 && eval(rowCurrCount
										- noOfHeader - noOfFooter) > 1)) {
							rowNumber = eval(parseInt(rowNumber, 10)
									+ noOfHeader);
							mytable.deleteRow(rowNumber);

							// To Do - reset the name of row for all input ,
							// textarea, select
							var newTrList = mytable.rows;
							var newTrListLength = eval(parseInt(
									newTrList.length, 10)
									- noOfFooter);
							for (var p = rowNumber; p < newTrListLength; p++) { // iterate
																				// over
																				// all
																				// rows
																				// from
																				// delete
																				// point
																				// to
																				// second
																				// last
																				// row
								// set the serial number;
								if (noOfHeader == 2) {
									newTrList[p].getElementsByTagName('td')[0].innerHTML = parseInt(
											p - 1, 10);
								} else if (noOfHeader == 1) {
									newTrList[p].getElementsByTagName('td')[0].innerHTML = parseInt(
											p, 10);
								} else if (noOfHeader == 3) {
									newTrList[p].getElementsByTagName('td')[0].innerHTML = parseInt(
											p - 2, 10);
								} else if (noOfHeader == 0) {
									newTrList[p].getElementsByTagName('td')[0].innerHTML = parseInt(
											p + 1, 10);
								}

								var allInputTags = newTrList[p]
										.getElementsByTagName('input');

								for (var zz = 0; zz < allInputTags.length; zz++) {

									var index1 = allInputTags[zz].name
											.lastIndexOf('[');
									var index2 = allInputTags[zz].name
											.lastIndexOf(']');

									var index3 = allInputTags[zz].name
											.indexOf('[');
									var index4 = allInputTags[zz].name
											.indexOf(']');
									if (allInputTags[zz].name.split('[').length == 2) {
										var str1 = allInputTags[zz].name
												.substring(0, index1);
										var str3 = allInputTags[zz].name
												.substring(
														index2 + 1,
														allInputTags[zz].name.length);

									} else {
										var str1 = allInputTags[zz].name
												.substring(0, index3);

										var str3 = allInputTags[zz].name
												.substring(
														index4 + 1,
														allInputTags[zz].name.length);

									}
									allInputTags[zz].name = str1
											+ '['
											+ eval(parseInt(p, 10) - noOfHeader)
											+ ']' + str3;

								}

							}
							break;
						} else if ((rowNumber == 0)
								&& (eval(rowCurrCount - noOfHeader - noOfFooter) == 1)) {
							// Vacate the content if its first row

							var firstRow = mytable.getElementsByTagName('tr')[noOfHeader];

							var firstInputBox = firstRow
									.getElementsByTagName('input')[0];
							firstInputBox.checked = false;

							var allInputTags = firstRow
									.getElementsByTagName('input');
							for (var i = 0; i < allInputTags.length; i++) {
								allInputTags[i].value = "";
							}
							var allSelectTags = firstRow
									.getElementsByTagName('select');
							for (var i = 0; i < allSelectTags.length; i++) {
								var elem = allSelectTags[i];
								elem[0].selected = true;
							}
							var allTextAreaTags = firstRow
									.getElementsByTagName('textarea');
							for (var i = 0; i < allTextAreaTags.length; i++) {
								allTextAreaTags[i].value = "";
							}
						}
					}

				}
			}
		}

	} catch (e) {
		alert('exception caught in =' + e.stack);
	}
}

function copyDDTHiddenVals() {
	try {
		var table = document.getElementById('scheduleDDT');
		var noOfRows = table.rows.length;

		for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

			copySourceToDest('scheduleDDT.ddt[' + i
					+ '].netPayableOrRefundable', 'scheduleDDT.ddt[' + i
					+ '].netPayableOrRefundableDisp');
			addBrackets('scheduleDDT.ddt[' + i + '].netPayableOrRefundableDisp');
		}
	} catch (e) {

	}

}

function copyBBTHiddenVals() {
	try {
		var table = document.getElementById('scheduleBBT');
		var noOfRows = table.rows.length;

		for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {

			copySourceToDest('scheduleBBT.bbt[' + i
					+ '].netPayableOrRefundable', 'scheduleBBT.bbt[' + i
					+ '].netPayableOrRefundableDisp');
			addBrackets('scheduleBBT.bbt[' + i + '].netPayableOrRefundableDisp');
		}
	} catch (e) {
		// alert(e);
	}

}

function addRowToBBT() {

	var tableId = document.getElementById('scheduleBBT');
	var TableRows = document.getElementById('scheduleBBT').rows;
	var tbdy = document.getElementById('scheduleBBT').tBodies[0];
	var noOfRows = tableId.rows.length;
	var lastRowDDT = document.getElementById('lastrowbbt');
	var lastIndex = eval(parseInt(noOfRows, 10) - 2);
	var cloneNode = TableRows[lastIndex].cloneNode(true);

	var lastTab = eval(parseInt(TableRows[lastIndex]
			.getElementsByTagName('table')[0].id.substring(12), 10) + 1);

	var newSlNo = cloneNode.cells[0].textContent;
	var iterate = eval(parseInt(newSlNo, 10));
	var index = noOfRows - 3;
	cloneNode.cells[0].innerHTML = eval(parseInt(newSlNo, 10) + 1);
	var newTableId = 'scheduleBBTP' + lastTab;
	var inputTags = cloneNode.getElementsByTagName('input');

	var isRowBlank = checkRowBlankDDT('scheduleBBT', 2, 1);

	if (!isRowBlank) {
		for (var i = 0; i < TableRows.length; i++) {

			for (var n = 0; n < inputTags.length; n++) {

				inputTags[n].name = inputTags[n].name.replace(/\[[\d]+\]/, '['
						+ (iterate) + ']');
				inputTags[n].id = inputTags[n].name.replace(/([\.\[\]])/g, '_')
						.replace(/(__)/g, '_');
				inputTags[n].value = '';
				var blurAttr = inputTags[n].getAttribute('onblur');
				if (blurAttr != null) {
					blurAttr = blurAttr + ";";
				} else {
					blurAttr = "";
				}
				inputTags[n].setAttribute('onblur', blurAttr
						+ 'j.blur(this,this.name,this.value);');

				var classType = inputTags[n].getAttribute("class");
				var className = inputTags[n].getAttribute("className");

				if (classType == "date_dummy_black hasDatepicker"
						|| className == "date_dummy_black hasDatepicker") {
					inputTags[n].id = inputTags[n].id + newSlNo;
					inputTags[n].setAttribute("className", "date_dummy_black");
					inputTags[n].setAttribute("class", "date_dummy_black");
					saras = inputTags[n].id;

				}

			}

			if (cloneNode.getElementsByTagName('table').length > 0) {
				cloneNode.getElementsByTagName('table')[0].setAttribute('id',
						newTableId);
				cloneNode.getElementsByTagName('img')[0].setAttribute(
						'onclick', 'addRowToTable(' + '\'' + newTableId
								+ '\',3,2,this);calcITR6();');
				cloneNode.getElementsByTagName('img')[1].setAttribute(
						'onclick', 'deleteRowTable(' + '\'' + newTableId
								+ '\',0,2);calcITR6();');

			}

		}

		document.getElementById('scheduleBBT').getElementsByTagName('tr')[0].parentNode
				.insertBefore(cloneNode, lastRowDDT);

		if (document.getElementById(newTableId).rows.length > 3) {
			$('#' + newTableId + ' input').attr("checked", true);
			deleteRowTable(newTableId, 0, 2);
			$('#' + newTableId + ' input').attr("checked", false);
		}

		var allInputTags = cloneNode.getElementsByTagName('input');

		for (var i = 0; i < allInputTags.length; i++) {

			var classType = allInputTags[i].getAttribute("class");
			var className = allInputTags[i].getAttribute("className");

			if (classType == "date_dummy_black"
					|| className == "date_dummy_black") {
				saras = allInputTags[i].id;

				$(function() {
					$("#" + saras).datepicker({
						changeMonth : true,
						changeYear : true,
						yearRange : "-100:+5",
						dateFormat : "dd/mm/yy",
						buttonText : "Choose",
						showOtherMonths : true,
						selectOtherMonths : true
					});
				});
			}
		}

		checkMaxLengthLimit();
	} else {
		addErrorXHTML(
				'',
				'Please fill in all the mandatory fields in the last row before adding another row.');
	}

}

function checkRowBlankDDT(tableId, noOfRow, last) {
	try {
		var tab = document.getElementById(tableId);
		var rowCount = tab.rows.length;
		var trOfLastRow = tab.rows[rowCount - noOfRow];
		var allInputTags = trOfLastRow.getElementsByTagName('input');
		var allSelectTags = trOfLastRow.getElementsByTagName('select');
		var allTextareaTags = trOfLastRow.getElementsByTagName('textarea');
		var isRowBlank = true;

		for (var i = 0; i < allInputTags.length; i++) {
			if (!allInputTags[i].name.match(".chosenCheckBox$")) {
				if (allInputTags[i] != undefined
						|| allInputTags[i].value != null) {
					if ((allInputTags[i].getAttribute("readonly") == null)
							|| (allInputTags[i].getAttribute("readonly") != 'true')) {
						if (allInputTags[i].parentNode.style.display != "none"
								&& allInputTags[i].getAttribute('type') != 'hidden') {
							var str = allInputTags[i].value.replace(
									/^\s+|\s+$/g, '');
							if (str != '') {
								isRowBlank = false;
								break;
							}
						}
					}
				}
			}
		}

		for (var i = 0; i < allTextareaTags.length; i++) {
			if (allTextareaTags[i] != undefined
					|| allTextareaTags[i].value != null) {
				var str = allTextareaTags[i].value.replace(/^\s+|\s+$/g, '');
				if (str != '') {
					isRowBlank = false;
					break;
				}
			}
		}

		for (var i = 0; i < allSelectTags.length; i++) {
			if (allSelectTags[i].value != '-1' && allSelectTags[i].value != '') {
				isRowBlank = false;
				break;
			}
		}
	} catch (e) {
		alert(e);
	}

	return isRowBlank;
}

function checkAuditDate() {
	var tab1 = document.getElementById('othSecDateTabId');
	var rowCount = tab1.rows.length;
	for (var i = 0; i < rowCount - 2; i++) {

		if (document.getElementsByName('partAGEN2.auditDetails[' + i
				+ '].auditedSection')[0].value != ''
				&& document.getElementsByName('partAGEN2.auditDetails[' + i
						+ '].dateOfAudit')[0].value == '') {

			addErrorXHTML(
					'',
					'Please select the "Date of Audit Report" in "AUDIT DETAILS". If the date field is left blank, it is assumed that audit has not been carried out.');
		}

	}

}

function checkDDTDateDepEmpty() {
	try {
		var mainTab = document.getElementById('scheduleDDT');
		var mainTabRows = mainTab.rows.length;

		for (var i = 0; i < eval(parseInt(mainTabRows, 10) - 4); i++) {

			var innerTable = mainTab.rows[i + 3].getElementsByTagName("table")[0].rows.length;

			for (var k = 0; k < eval(parseInt(innerTable, 10) - 2); k++) {

				if (document.getElementsByName('scheduleDDT.ddt[' + i
						+ '].taxPayOnDividDeclarOrPaid[' + k + '].bsrCode')[0].value != ''
						&& document.getElementsByName('scheduleDDT.ddt[' + i
								+ '].taxPayOnDividDeclarOrPaid[' + k
								+ '].dateDep')[0].value == '') {

					addErrorXHTML(document.getElementsByName('scheduleDDT.ddt['
							+ i + '].taxPayOnDividDeclarOrPaid[' + k
							+ '].dateDep')[0],
							'Please enter the Date of deposit', true);
					j.setFieldError('scheduleDDT.ddt[' + i
							+ '].taxPayOnDividDeclarOrPaid[' + k + '].dateDep',
							'Please enter the Date of deposit');

				}
			}

		}
	} catch (e) {
		alert('Exception in checkDDTDateDepEmpty' + e.stack);
	}
}

function checkBBTDateDepEmpty() {
	try {
		var mainTab = document.getElementById('scheduleBBT');
		var mainTabRows = mainTab.rows.length;

		for (var i = 0; i < eval(parseInt(mainTabRows, 10) - 4); i++) {

			var innerTable = mainTab.rows[i + 3].getElementsByTagName("table")[0].rows.length;

			for (var k = 0; k < eval(parseInt(innerTable, 10) - 2); k++) {

				if (document.getElementsByName('scheduleBBT.bbt[' + i
						+ '].taxPayOnDividDeclarOrPaid[' + k + '].bsrCode')[0].value != ''
						&& document.getElementsByName('scheduleBBT.bbt[' + i
								+ '].taxPayOnDividDeclarOrPaid[' + k
								+ '].dateDep')[0].value == '') {

					addErrorXHTML(document.getElementsByName('scheduleBBT.bbt['
							+ i + '].taxPayOnDividDeclarOrPaid[' + k
							+ '].dateDep')[0],
							'Please enter the Date of deposit', true);
					j.setFieldError('scheduleBBT.bbt[' + i
							+ '].taxPayOnDividDeclarOrPaid[' + k + '].dateDep',
							'Please enter the Date of deposit');

				}
			}

		}
	} catch (e) {
		alert('Exception in checkBBTDateDepEmpty' + e.stack);
	}
}

// To enable / disable FII / FPI Field based on Drop-down value Y / N
function disableSebiRegNo() {
	var fiiFpiFlag = document
			.getElementsByName("partAGEN1.filingStatus.fiiFpiFlg")[0].value;

	if (fiiFpiFlag == 'Y') {
		document.getElementsByName("partAGEN1.filingStatus.sebiRegnNo")[0].disabled = false;
	} else {
		document.getElementsByName("partAGEN1.filingStatus.sebiRegnNo")[0].disabled = true;
		document.getElementsByName("partAGEN1.filingStatus.sebiRegnNo")[0].value = "";
	}

}

// To enable point FA-E fields
function enableFieldsForPointE(tableId) {

	var tab = document.getElementById(tableId);
	var rows = tab.getElementsByTagName('tr');
	var rowCount = rows.length;

	for (var i = 0; i < rowCount - 4; i++) {
		var selectedOptionId = document
				.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
						+ i + '].taxableIncomeFlag')[0];
		if (selectedOptionId != null && selectedOptionId != ''
				&& selectedOptionId.selectedIndex != -1) {
			var selectedOption = selectedOptionId.options[selectedOptionId.selectedIndex].value;
		}
		if (selectedOption == 'Y') {

			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].interestInAccount')[0].disabled = false;
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].amount')[0].disabled = false;
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].scheduleOffered')[0].disabled = false;
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].itemNo')[0].disabled = false;

		} else {

			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].interestInAccount')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].amount')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].scheduleOffered')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].itemNo')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].interestInAccount')[0].value = '';
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].amount')[0].value = '';
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].scheduleOffered')[0].value = '';
			document
					.getElementsByName('scheduleFA.detailsOfAccntsHvngSigningAuth['
							+ i + '].itemNo')[0].value = '';
		}
	}
}

// To enable point F fields
function enableFieldsForPointF(tableId) {

	var tab = document.getElementById(tableId);
	var rows = tab.getElementsByTagName('tr');
	var rowCount = rows.length;

	for (var i = 0; i < rowCount - 4; i++) {
		var selectedOptionId = document
				.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
						+ i + '].trustIncomeFlag')[0];
		if (selectedOptionId != null && selectedOptionId != ''
				&& selectedOptionId.selectedIndex != -1) {
			var selectedOption = selectedOptionId.options[selectedOptionId.selectedIndex].value;
		}
		if (selectedOption == 'Y') {

			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].trustIncome')[0].disabled = false;
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].amount')[0].disabled = false;
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].scheduleOffered')[0].disabled = false;
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].itemNo')[0].disabled = false;

		} else {

			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].trustIncome')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].amount')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].scheduleOffered')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].itemNo')[0].disabled = true;
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].trustIncome')[0].value = '';
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].amount')[0].value = '';
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].scheduleOffered')[0].value = '';
			document
					.getElementsByName('scheduleFA.detailsOfTrustOutIndiaTrustee['
							+ i + '].itemNo')[0].value = '';
		}
	}
}

// To enable point G fields
function enableFieldsForPointG(tableId) {
	var tab = document.getElementById(tableId);
	var rows = tab.getElementsByTagName('tr');
	var rowCount = rows.length;

	for (var i = 0; i < rowCount - 4; i++) {
		var selectedOptionId = document
				.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
						+ '].trustIncomeFlag')[0];
		if (selectedOptionId != null && selectedOptionId != ''
				&& selectedOptionId.selectedIndex != -1) {
			var selectedOption = selectedOptionId.options[selectedOptionId.selectedIndex].value;
		}
		if (selectedOption == 'Y') {
			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].amount')[0].disabled = false;
			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].scheduleOffered')[0].disabled = false;
			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].itemNo')[0].disabled = false;

		} else {

			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].amount')[0].disabled = true;
			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].scheduleOffered')[0].disabled = true;
			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].itemNo')[0].disabled = true;

			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].amount')[0].value = '';
			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].scheduleOffered')[0].value = '';
			document.getElementsByName('scheduleFA.detailsOfOtherIncome[' + i
					+ '].itemNo')[0].value = '';
		}
	}
}

// To display 92CD Verification based on the filing section
function display92CDVerification(type) {

	var fileSec = document
			.getElementsByName('partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;

	if (fileSec == '19') {
		document.getElementById('92cdVerification').style.display = '';
	} else {
		document.getElementById('92cdVerification').style.display = 'none';
	}

	if (type != 'onload' && fileSec == '19') {
		addErrorXHTML(
				'',
				'To file return u/s 92CD, post login in e-Filing portal, go to e-File -> e-File u/s 119(2)(b)/92CD and select the filing type as “92CD”.');
	}
	if (type != 'onload' && fileSec == '20') {
		addErrorXHTML(
				'',
				'Section 119(2)(b)-after condonation of delay should be filed after expiry of due date mentioned in 139(1)/139(4).');
	}
}

// Function to Enable Tables when Status = NRI
function enableNRItables() {
	enableTableWithOutCB('partAGEN1.filingStatus.residentialStatus', 'NRI',
			'stcg10pctTab');
}

function enableTableWithOutCB(element, value, tableId) {
	var flag = document.getElementsByName(element)[0].value;
	var tabId = "#" + tableId;
	if (flag == value) {
		$(tabId).find(':input').prop('disabled', false);
		$(tabId).find('.addbtn').prop('hidden', false);
	} else {
		$(tabId).find(':input').prop('disabled', true);
		$(tabId).find('.addbtn').prop('hidden', true);
		$(tabId).find(':input').prop('value', '');
		if (tableId == 'stcg10pctTab') {
			deleteRowToCG('stcg10pctTab');
		}
	}
	var tab = document.getElementById('stcg10pctTab');
	var inputs = tab.getElementsByTagName('INPUT');

	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows / 16); i++) {
		document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
						+ i + '].fullConsideration')[0].disabled = true;
	}

	calCGA7TotalSum();
	calCGPointB8Total();
}

// Calculate a6 Total Sum.
function calCGA7TotalSum() {

	var tab1 = document.getElementById('scheduleStcgunUtilizedCapGain54');
	var noOfRows = tab1.rows.length;
	var sum = 0;
	for (var i = 0; i < (noOfRows - 3); i++) {
		var amt = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
						+ i + '].amountUnUtilized')[0].value;
		sum = eval(parseInt(sum, 10) + parseInt(coalesce(amt), 10));
	}
	var total = eval(parseInt(sum, 10)
			+ parseInt(
					coalesce(document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.amtDeemedStcg')[0].value),
					10));
	document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.totAmtStcgUnderDtaa')[0].value = total;
}

// Calculate Point B8 Total.
function calCGPointB8Total() {

	var tab1 = document.getElementById('scheduleLtcgunUtilizedCapGain54');
	var noOfRows = tab1.rows.length;
	var sum = 0;
	for (var i = 0; i < (noOfRows - 3); i++) {
		var amt = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
						+ i + '].amountUnUtilized')[0].value;
		sum = eval(parseInt(sum, 10) + parseInt(coalesce(amt), 10));
	}
	var total = eval(parseInt(sum, 10)
			+ parseInt(
					coalesce(document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54.amtDeemedLtcg')[0].value),
					10));
	document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtStcgUnderDtaa')[0].value = total;
}

// To enable tables for NRI
function enableTableForNRI(element, value, tableId) {

	var flag = document.getElementsByName(element)[0].value;
	var tabId = "#" + tableId;

	$(tabId).find(':input').prop('disabled', true);
	$(tabId).find('.addbtn').prop('hidden', true);

	if (flag == value) {
		$(tabId).find('.addbtn').prop('hidden', false);
		$(tabId).find(':input').prop('disabled', false);
	} else {
		$(tabId).find('[type=\"checkbox\"]').attr('checked', 'checked');
		deleteRowTable(tableId, 1, 1);
		$(tabId).find(':input').prop('disabled', true);
		$(tabId).find('.addbtn').prop('hidden', true);
	}
}

// Calculate Total Tax for Schedule-IT.
function calculateTotalTaxIT(tableId) {

	var tab1 = document.getElementById('scheduleIt');
	var noOfRows = tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for (var i = 0; i < (noOfRows - 3); i++) {
		amt = document
				.getElementsByName('scheduleIT.taxPayment[' + i + '].amt')[0].value;
		sum = eval(parseInt(sum, 10) + parseInt(coalesce(amt), 10));
	}
	document.getElementsByName('scheduleIT.taxPayment.totalTaxPayments')[0].value = parseInt(
			sum, 10);
}

// To calculate NetAgricultureIncomeforEI
function calculateNetAgricultureIncomeforEI() {

	var grossAgriReceipt7B8 = document
			.getElementsByName('scheduleEI.grossAgriReceipt7B8')[0].value;
	var expendAgriculture = document
			.getElementsByName('scheduleEI.expendAgriculture')[0].value;
	var expendAgricultureUnabsorbed = document
			.getElementsByName('scheduleEI.expendAgricultureUnabsorbed')[0].value;
	var agriInc = document.getElementsByName('scheduleEI.agriInc')[0].value;

	var result = zeroOrMore(eval(parseInt(coalesce(grossAgriReceipt7B8), 10)
			- parseInt(coalesce(expendAgriculture), 10)
			- parseInt(coalesce(expendAgricultureUnabsorbed), 10)
			+ parseInt(coalesce(agriInc), 10)));
	document.getElementsByName('scheduleEI.netAgriIncOrOthrIncRule7')[0].value = result;
}

// Get the Bank Name corresponding to the IFS Code entered
function getIfscBankName(field) {

	document.getElementsByName('itr.refund.depositToBankAccount.bankName')[0].value = main
			.getBankName(field.value);
}

// Get the Bank Name corresponding to the IFS Code entered for Other Bank
// Details
function getIfscBankDetails(elem) {

	var position = parseInt(elem.name.substring(elem.name.indexOf("[") + 1,
			elem.name.indexOf("]")));

	var ifscCode = document.getElementsByName('itr.scheduleBA[' + position
			+ '].ifscCode')[0].value;

	document.getElementsByName('itr.scheduleBA[' + position + '].bankName')[0].value = main
			.getBankName(ifscCode);
}

// on change of part BTTI refund
function onChngBTTIRefund() {

	var typeHP = document.getElementsByName('partBTTI.assetOutIndiaFlag')[0].value;
	if (typeHP == 'YES') {
		addErrorXHTML('',
				'Schedule FA is mandatory. Ensure all the details in Schedule FA are filled');
	}
}

// Validate STCG Section Wise along with DTAA.
function validateSTCGSectionWiseDTAA() {
	var arr = {
		'A1e' : 0,
		'A2c' : 0,
		'A3ie' : 0,
		'A3iie' : 0,
		'A4a' : 0,
		'A4b' : 0,
		'A5e' : 0,
		'A6g' : 0,
		'A7' : 0,
		'A8a' : 0,
		'A8b' : 0,
		'A8c' : 0
	};
	var tab = document.getElementById('scheduleStcgDtaa');
	var rowCount = tab.rows.length - 2;
	for (var i = 0; i < rowCount; i++) {
		var itemIncluded = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
						+ i + '].itemIncluded')[0].value;
		var amount = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
						+ i + '].amount')[0].value;
		if (itemIncluded == 'A1e') {
			arr['A1e'] = parseInt(arr['A1e'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A2c') {
			arr['A2c'] = parseInt(arr['A2c'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A4a') {
			arr['A4a'] = parseInt(arr['A4a'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A4b') {
			arr['A4b'] = parseInt(arr['A4b'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A5e') {
			arr['A5e'] = parseInt(arr['A5e'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A6g') {
			arr['A6g'] = parseInt(arr['A6g'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A3ie') {
			arr['A3ie'] = parseInt(arr['A3ie'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A3iie') {
			arr['A3iie'] = parseInt(arr['A3iie'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A7') {
			arr['A7'] = parseInt(arr['A7'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A8a') {
			arr['A8a'] = parseInt(arr['A8a'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A8b') {
			arr['A8b'] = parseInt(arr['A8b'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'A8c') {
			arr['A8c'] = parseInt(arr['A8c'], 10)
					+ parseInt(coalesce(amount), 10);
		}

	}

	var table = document.getElementById('scheduleStcgDtaa');
	var rowCount = table.rows.length - 2;

	var dtaaSection = [];

	for (var i = 0; i < rowCount; i++) {
		var itemIncluded = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
						+ i + '].itemIncluded')[0].value;
		if (itemIncluded != '' && dtaaSection.indexOf(itemIncluded) == -1) {
			dtaaSection.push(itemIncluded);
		}
	}

	var table1 = document.getElementById('scheduleCGstcg2');
	var rowCount1 = table1.rows.length / 10;

	var arrSection2 = [];
	var arrAmount2 = {
		'1A' : 0,
		'5AD1biip' : 0
	};

	for (var k = 0; k < rowCount1; k++) {
		var section = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT['
						+ k + '].section')[0].value;
		var amount = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT['
						+ k + '].fullConsideration')[0].value;
		if (section != '' && arrSection2.indexOf(section) == -1) {
			arrSection2.push(section);
			arrAmount2[section] = amount;
		}
	}

	var fullConsideration50C = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild.capgainonAssets')[0];
	if (dtaaSection.indexOf('A1e') != -1 && arr['A1e'] > 0
			&& fullConsideration50C.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild.capgainonAssets',
						'A1(aiii) value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsideration50C,
				'A1(aiii) value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var fullConsideration = document
			.getElementsByName('scheduleCGFor4.shortTermCapGainFor4.capGainSlumpSale.fullConsideration')[0];
	if (dtaaSection.indexOf('A2c') != -1 && arr['A2c'] > 0
			&& fullConsideration.value == 0) {
		j
				.setFieldError(
						'scheduleCGFor4.shortTermCapGainFor4.capGainSlumpSale.fullConsideration',
						'A2a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsideration,
				'A2a value should not be zero as there is an entry in DTAA table.',
				true);
	}

	if (dtaaSection.indexOf('A3ie') != -1 && arr['A3ie'] > 0
			&& (arrSection2.indexOf('1A') == -1 || arrAmount2['1A'] == 0)) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].section',
						'111A section in A3 should be selected and amount should not be zero, as there is an entry in DTAA table.');
		addErrorXHTML(
				document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].section')[0],
				'111A section in A3 should be selected and amount should not be zero, as there is an entry in DTAA table.',
				true);
	}

	if (dtaaSection.indexOf('A3iie') != -1
			&& arr['A3iie'] > 0
			&& (arrSection2.indexOf('5AD1biip') == -1 || arrAmount2['5AD1biip'] == 0)) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].section',
						'115AD(1)(b)(ii) section in A3 should be selected and amount should not be zero, as there is an entry in DTAA table.');
		addErrorXHTML(
				document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].section')[0],
				'115AD(1)(b)(ii) section in A3 should be selected and amount should not be zero, as there is an entry in DTAA table.',
				true);
	}

	var nRItaxSTTPaid = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid')[0];
	if (dtaaSection.indexOf('A4a') != -1 && arr['A4a'] > 0
			&& nRItaxSTTPaid.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid',
						'A4a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				nRItaxSTTPaid,
				'A4a value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var nRItaxSTTNotPaid = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid')[0];
	if (dtaaSection.indexOf('A4b') != -1 && arr['A4b'] > 0
			&& nRItaxSTTNotPaid.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid',
						'A4b value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				nRItaxSTTNotPaid,
				'A4b value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var fullConsideration = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration')[0];
	if (dtaaSection.indexOf('A5e') != -1 && arr['A5e'] > 0
			&& fullConsideration.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration',
						'A5e value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsideration,
				'A5e value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var fullConsiderationA6f = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsideration')[0];
	if (dtaaSection.indexOf('A6f') != -1 && arr['A6f'] > 0
			&& fullConsiderationA6f.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.saleOnOtherAssets.fullConsideration',
						'A6f value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsiderationA6f,
				'A6f value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var totAmtStcgUnderDtaa = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.totAmtStcgUnderDtaa')[0];
	if (dtaaSection.indexOf('A7') != -1 && arr['A7'] > 0
			&& totAmtStcgUnderDtaa.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.totAmtStcgUnderDtaa',
						'A7 value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				totAmtStcgUnderDtaa,
				'A7 value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var deprAssest = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.amtDeemedCGDepAssets')[0];
	if (dtaaSection.indexOf('A8') != -1 && arr['A8'] > 0
			&& deprAssest.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.amtDeemedCGDepAssets',
						'A8 value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				deprAssest,
				'A8 value should not be zero as there is an entry in DTAA table.',
				true);
	}

	// A8a

	var totAmtStcgUnderDtaa = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa.ptiStcg15')[0];
	if (dtaaSection.indexOf('A8a') != -1 && arr['A8a'] > 0
			&& totAmtStcgUnderDtaa.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.totAmtStcgUnderDtaa',
						'A8a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				totAmtStcgUnderDtaa,
				'A8a value should not be zero as there is an entry in DTAA table.',
				true);
	}

	// A8b

	var totAmtStcgUnderDtaa = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa.ptiStcg30')[0];
	if (dtaaSection.indexOf('A8b') != -1 && arr['A8b'] > 0
			&& totAmtStcgUnderDtaa.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.totAmtStcgUnderDtaa',
						'A8b value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				totAmtStcgUnderDtaa,
				'A8b value should not be zero as there is an entry in DTAA table.',
				true);
	}

	// A8c

	var totAmtStcgUnderDtaa = document
			.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa.ptiStcgAr')[0];
	if (dtaaSection.indexOf('A8c') != -1 && arr['A8c'] > 0
			&& totAmtStcgUnderDtaa.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54.totAmtStcgUnderDtaa',
						'A8c value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				totAmtStcgUnderDtaa,
				'A8c value should not be zero as there is an entry in DTAA table.',
				true);
	}

}

// Validate LTCG Section-wise along with DTAA.
function validateLTCGSectionWiseDTAA() {
	var arr = {
		'B1e' : 0,
		'B2e' : 0,
		'B3c' : 0,
		'B4c' : 0,
		'B5' : 0,
		'B6' : 0,
		'B7i' : 0,
		'B7ii' : 0,
		'B7iii' : 0,
		'B7iv' : 0,
		'B8' : 0,
		'B9e' : 0,
		'B10' : 0,
		'B11a1' : 0,
		'B11a2' : 0,
		'B11b' : 0
	};
	var tab = document.getElementById('scheduleLtcgDtaa');
	var rowCount = tab.rows.length - 2;
	for (var i = 0; i < rowCount; i++) {
		var itemIncluded = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
						+ i + '].itemIncluded')[0].value;
		var amount = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
						+ i + '].amount')[0].value;
		if (itemIncluded == 'B1e') {
			arr['B1e'] = parseInt(arr['B1e'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B2e') {
			arr['B2e'] = parseInt(arr['B2e'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B3c') {
			arr['B3c'] = parseInt(arr['B3c'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B4c') {
			arr['B4c'] = parseInt(arr['B4c'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B5') {
			arr['B5'] = parseInt(arr['B5'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B6') {
			arr['B6'] = parseInt(arr['B6'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B7i') {
			arr['B7i'] = parseInt(arr['B7i'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B7ii') {
			arr['B7ii'] = parseInt(arr['B7ii'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B7iii') {
			arr['B7iii'] = parseInt(arr['B7iii'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B7iv') {
			arr['B7iv'] = parseInt(arr['B7iv'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B8') {
			arr['B8'] = parseInt(arr['B8'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B9e') {
			arr['B9e'] = parseInt(arr['B9e'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B10') {
			arr['B10'] = parseInt(arr['B10'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B11a1') {
			arr['B11a1'] = parseInt(arr['B11a1'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B11a2') {
			arr['B11a2'] = parseInt(arr['B11a2'], 10)
					+ parseInt(coalesce(amount), 10);
		} else if (itemIncluded == 'B11b') {
			arr['B11b'] = parseInt(arr['B11b'], 10)
					+ parseInt(coalesce(amount), 10);
		}
	}

	var table = document.getElementById('scheduleLtcgDtaa');
	var rowCount = table.rows.length - 2;

	var dtaaSection = [];

	for (var i = 0; i < rowCount; i++) {
		var itemIncluded = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
						+ i + '].itemIncluded')[0].value;
		if (itemIncluded != '' && dtaaSection.indexOf(itemIncluded) == -1) {
			dtaaSection.push(itemIncluded);
		}
	}

	var fullConsideration50C = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild.capgainonAssets')[0];
	if (dtaaSection.indexOf('B1e') != -1 && arr['B1e'] > 0
			&& fullConsideration50C.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.saleofLandBuild.capgainonAssets',
						'B1(aiii) value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsideration50C,
				'B1(aiii) value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var fullConsideration = document
			.getElementsByName('scheduleCGFor4.shortTermCapGainFor4.capGainSlumpSale.fullConsiderationB')[0];
	if (dtaaSection.indexOf('B2e') != -1 && arr['B2e'] > 0
			&& fullConsideration.value == 0) {
		j
				.setFieldError(
						'scheduleCGFor4.shortTermCapGainFor4.capGainSlumpSale.fullConsiderationB',
						'B2a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsideration,
				'B2a value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var fullConsiderationB3e = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofBondsDebntr.fullConsideration')[0];
	if (dtaaSection.indexOf('B3c') != -1 && arr['B3c'] > 0
			&& fullConsiderationB3e.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.saleofBondsDebntr.fullConsideration',
						'B3a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsiderationB3e,
				'B3a value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var fullConsiderationB4a = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].fullConsideration')[0];
	if (dtaaSection.indexOf('B4c') != -1 && arr['B4c'] > 0
			&& fullConsiderationB4a.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].fullConsideration',
						'B4a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsiderationB4a,
				'B4a value should not be zero as there is an entry in DTAA table.',
				true);
	}

/*	var fullConsiderationB5f = document
			.getElementsByName('scheduleCGFor5.shortTermCapGainFor5.saleofEquityLtcg.fullConsideration')[0];
	if (dtaaSection.indexOf('B5f') != -1 && arr['B5f'] > 0
			&& fullConsiderationB5f.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].capgainonAssets',
						'B5f value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsiderationB5f,
				'B5f value should not be zero as there is an entry in DTAA table.',
				true);
	}*/

/*	var ltcgWithoutBenefit = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIProvisoSec48.ltcgWithoutBenefit')[0];
	if (dtaaSection.indexOf('B6c') != -1 && arr['B6c'] > 0
			&& ltcgWithoutBenefit.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.nRIProvisoSec48.ltcgWithoutBenefit',
						'B5a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				ltcgWithoutBenefit,
				'B5a value should not be zero as there is an entry in DTAA table.',
				true);
	}*/

	var table2 = document.getElementById('stcg10pctTab');
	var rowCount2 = table2.rows.length / 15;

	var arrSection1 = [];
	var arrAmount1 = {
		'21ciii' : 0,
		'5AB1b' : 0,
		'5AC1c' : 0,
		'5ADiii' : 0
	};

	for (var a = 0; a < rowCount2; a++) {
		var sectionCode = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
						+ a + '].sectionCode')[0].value;
		var amount = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
						+ a + '].fullConsideration')[0].value;
		if (sectionCode != '' && arrSection1.indexOf(sectionCode) == -1) {
			arrSection1.push(sectionCode);
			arrAmount1[sectionCode] = amount;
		}
	}

	if (dtaaSection.indexOf('B7i') != -1
			&& arr['B7i'] > 0
			&& (arrSection1.indexOf('21ciii') == -1 || arrAmount1['21ciii'] == 0)) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode',
						'21ciii section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.');
		addErrorXHTML(
				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode')[0],
				'21ciii section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.',
				true);
	}

	if (dtaaSection.indexOf('B7ii') != -1 && arr['B7ii'] > 0
			&& (arrSection1.indexOf('5AB1b') == -1 || arrAmount1['5AB1b'] == 0)) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode',
						'5AB1b section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.');
		addErrorXHTML(
				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode')[0],
				'5AB1b section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.',
				true);
	}

	if (dtaaSection.indexOf('B7iii') != -1 && arr['B7iii'] > 0
			&& (arrSection1.indexOf('5AC1c') == -1 || arrAmount1['5AC1c'] == 0)) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode',
						'5AC1c section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.');
		addErrorXHTML(
				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode')[0],
				'5AC1c section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.',
				true);
	}

	if (dtaaSection.indexOf('B7iv') != -1
			&& arr['B7iv'] > 0
			&& (arrSection1.indexOf('5ADiii') == -1 || arrAmount1['5ADiii'] == 0)) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode',
						'5ADiii section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.');
		addErrorXHTML(
				document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115[0].sectionCode')[0],
				'5ADiii section in B6 should be selected and amount should not be zero, as there is an entry in DTAA table.',
				true);
	}

	var fullConsiderationB7a = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.deductSec48.fullConsideration')[0];
	if (dtaaSection.indexOf('B7e') != -1 && arr['B7e'] > 0
			&& fullConsiderationB7a.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.deductSec48.fullConsideration',
						'B7a value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsiderationB7a,
				'B7a value should not be zero as there is an entry in DTAA table.',
				true);
	}

/*	var fullConsiderationB8f = document
			.getElementsByName('scheduleCGFor8.shortTermCapGainFor8.saleofEquityLtcg.fullConsideration')[0];
	if (dtaaSection.indexOf('B8f') != -1 && arr['B8f'] > 0
			&& fullConsiderationB8f.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.proviso112Applicable[0].capgainonAssets',
						'B8f value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsiderationB8f,
				'B8f value should not be zero as there is an entry in DTAA table.',
				true);
	}*/

	var capgainonAssetsB9e = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.capgainonAssets')[0];
	if (dtaaSection.indexOf('B9e') != -1 && arr['B9e'] > 0
			&& capgainonAssetsB9e.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.saleofAssetNA.capgainonAssets',
						'B9e value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				capgainonAssetsB9e,
				'B9e value should not be zero as there is an entry in DTAA table.',
				true);
	}

	var fullConsiderationB10 = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtStcgUnderDtaa')[0];
	if (dtaaSection.indexOf('B10') != -1 && arr['B10'] > 0
			&& fullConsiderationB10.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtStcgUnderDtaa',
						'B10 value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				fullConsiderationB10,
				'B10 value should not be zero as there is an entry in DTAA table.',
				true);
	}
	// B11a1

	var totAmtStcgUnderDtaa = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtLtcgUnderPTI')[0];
	if (dtaaSection.indexOf('B11a1') != -1 && arr['B11a1'] > 0
			&& totAmtStcgUnderDtaa.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtStcgUnderDtaa',
						'B11a1 value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				totAmtStcgUnderDtaa,
				'B11a1 value should not be zero as there is an entry in DTAA table.',
				true);
	}
	// B11a2

	var totAmtStcgUnderDtaa = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.ptiLtcg10')[0];
	if (dtaaSection.indexOf('B11a2') != -1 && arr['B11a2'] > 0
			&& totAmtStcgUnderDtaa.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtStcgUnderDtaa',
						'B11a2 value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				totAmtStcgUnderDtaa,
				'B11a2 value should not be zero as there is an entry in DTAA table.',
				true);
	}

	// B11b

	var totAmtStcgUnderDtaa = document
			.getElementsByName('scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.ptiLtcg20')[0];
	if (dtaaSection.indexOf('B11b') != -1 && arr['B11b'] > 0
			&& totAmtStcgUnderDtaa.value == 0) {
		j
				.setFieldError(
						'scheduleCGPost45.longTermCapGainPost45.stcgUnderDtaa.totAmtStcgUnderDtaa',
						'B11b value should not be zero as there is an entry in DTAA table.');
		addErrorXHTML(
				totAmtStcgUnderDtaa,
				'B11b value should not be zero as there is an entry in DTAA table.',
				true);
	}

}

// To set other gross
function setOtherGrossSource() {
	var status = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var isDomesticComp = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var tab = document.getElementById('schduleOsinc');
	var rowCount = tab.rows.length - 3;

	var allSectionArray = [ '5A1ai', '5A1aii', '5A1aiia', '5A1aiiaa',
			'5A1aiiab', '5A1aiiac', '5A1aiii', '5A1bA', '5AC1ab', '5AD1i',
			'5AD1iP', '5BBA', '5BBC', '5BBDA', '5BBD', '5BBF', '5BBG', 'FA',
			'5AB1a' ];

	if (status == 'RES' && isDomesticComp == 'Y') {

		addAllOptions(allSectionArray, rowCount);
		var sectionArray = [ '5A1ai', '5A1aii', '5A1aiia', '5A1aiiaa',
				'5A1aiiab', '5A1aiiac', '5A1aiii', 'FA', '5A1bA', '5AC1ab',
				'5BBA', '5BBDA', '5AB1a' ];
		removeSection(sectionArray, rowCount);
	}
	if (status == 'NRI' && isDomesticComp == 'N') {

		addAllOptions(allSectionArray, rowCount);
		var sectionArray = [ '5BBD', '5BBF', '5BBDA' ];
		removeSection(sectionArray, rowCount);
	}
	if (status == 'NRI' && isDomesticComp == 'Y') {

		addAllOptions(allSectionArray, rowCount);
		var sectionArray = [ '5BBD', '5BBF', '5BBDA' ];
		removeSection(sectionArray, rowCount);
	}
	if (status == 'RES' && isDomesticComp == 'N') {

		addAllOptions(allSectionArray, rowCount);
		var sectionArray = [ '5A1ai', '5A1aii', '5A1aiia', '5A1aiiaa',
				'5A1aiiab', '5A1aiiac', '5A1aiii', 'FA', '5A1bA', '5AC1ab',
				'5BBA', '5AB1a' ];
		removeSection(sectionArray, rowCount);
	}
	// 2019changes

	var tab1 = document.getElementById('schduleOsincPti');
	var rowCount1 = tab1.rows.length - 3;

	var allSectionArray1 = [ 'PTI_5A1ai', 'PTI_5A1aii', 'PTI_5A1aiia',
			'PTI_5A1aiiaa', 'PTI_5A1aiiab', 'PTI_5A1aiiac', 'PTI_5A1aiii',
			'PTI_5A1bA', 'PTI_5AC1ab', 'PTI_5AD1i', 'PTI_5AD1iP', 'PTI_5BBA',
			'PTI_5BBC', 'PTI_5BBDA', 'PTI_5BBD', 'PTI_5BBF', 'PTI_5BBG',
			'PTI_FA', 'PTI_5AB1a' ];

	if (status == 'RES' && isDomesticComp == 'Y') {

		addAllOptionsPTI(allSectionArray1, rowCount1);
		var sectionArray1 = [ 'PTI_5A1ai', 'PTI_5A1aii', 'PTI_5A1aiia',
				'PTI_5A1aiiaa', 'PTI_5A1aiiab', 'PTI_5A1aiiac', 'PTI_5A1aiii',
				'PTI_FA', 'PTI_5A1bA', 'PTI_5AC1ab', 'PTI_5BBA', 'PTI_5BBDA',
				'PTI_5AB1a' ];
		removeSectionPTI(sectionArray1, rowCount1);
	}
	if (status == 'NRI' && isDomesticComp == 'N') {

		addAllOptionsPTI(allSectionArray1, rowCount1);
		var sectionArray1 = [ 'PTI_5BBD', 'PTI_5BBF', 'PTI_5BBDA' ];
		removeSectionPTI(sectionArray1, rowCount1);
	}
	if (status == 'NRI' && isDomesticComp == 'Y') {
		addAllOptionsPTI(allSectionArray1, rowCount1);
		var sectionArray1 = [ 'PTI_5BBD', 'PTI_5BBF', 'PTI_5BBDA' ];
		removeSectionPTI(sectionArray1, rowCount1);

	}
	if (status == 'RES' && isDomesticComp == 'N') {

		addAllOptionsPTI(allSectionArray1, rowCount1);
		var sectionArray1 = [ 'PTI_5A1ai', 'PTI_5A1aii', 'PTI_5A1aiia',
				'PTI_5A1aiiaa', 'PTI_5A1aiiab', 'PTI_5A1aiiac', 'PTI_5A1aiii',
				'PTI_FA', 'PTI_5A1bA', 'PTI_5AC1ab', 'PTI_5BBA', 'PTI_5AB1a' ];
		removeSectionPTI(sectionArray1, rowCount1);
	}

	setOtherGrossSourceOnChangeCGSTCG();
	setOtherGrossSourceOnChangeCGLTCG();

}

function setOtherGrossSourceOnChangeCGSTCG() {
	var status = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var tab = document.getElementById('scheduleStcgDtaa');

	var rowCount = tab.rows.length - 2;

	var allSectionArray = [ 'A1e', 'A2c', 'A3ie', 'A3iie', 'A4a', 'A4b', 'A5e',
			'A6g', 'A7', 'A8a', 'A8b', 'A8c' ];

	if (status == 'RES') {
		addAllOptionsCGSTCG(allSectionArray, rowCount);

		var sectionArray = [ 'A4a', 'A4b', 'A5e' ];
		removeSectionOnChangeCGSTCG(sectionArray, rowCount);
	} else {
		addAllOptionsCGSTCG(allSectionArray, rowCount);
	}

}

function setOtherGrossSourceOnChangeCGLTCG() {
	var status = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var tab = document.getElementById('scheduleLtcgDtaa');

	var rowCount = tab.rows.length - 2;

	var allSectionArray = [ 'B1e', 'B2e', 'B3c', 'B4c', 'B5', 'B6', 'B7i',
			'B7ii', 'B7iii', 'B7iv', 'B8', 'B9e', 'B10', 'B11a1','B11a2','B11b' ];

	if (status == 'RES') {
		addAllOptionsCGLTCG(allSectionArray, rowCount);

		var sectionArray = [ 'B6', 'B7i', 'B7ii', 'B7iii', 'B7iv' ];
		removeSectionOnChangeCGLTCG(sectionArray, rowCount);
	} else {
		addAllOptionsCGLTCG(allSectionArray, rowCount);
	}

}

// To add all options
function addAllOptions(allSectionArray, rowCount) {
	for (var i = 0; i < rowCount; i++) {
		var srcDesc = document
				.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
						+ i + '].sourceDescription')[0];
		var selectedValue = srcDesc.value;
		removeAll(srcDesc);

		for (var k = 0; k < allSectionArray.length; k++) {
			var optn = document.createElement("option");
			optn.text = getSectionTextMap(allSectionArray[k]);
			optn.value = allSectionArray[k];
			srcDesc.options.add(optn);
		}
		srcDesc.value = selectedValue;
	}
}
function addAllOptionsPTI(allSectionArray, rowCount) {
	for (var i = 0; i < rowCount; i++) {
		var srcDesc = document
				.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
						+ i + '].sourceDescription')[0];
		var selectedValue = srcDesc.value;

		removeAll(srcDesc);
		for (var k = 0; k < allSectionArray.length; k++) {
			var optn = document.createElement("option");
			optn.text = getSectionTextMap(allSectionArray[k]);
			optn.value = allSectionArray[k];
			srcDesc.options.add(optn);
		}
		srcDesc.value = selectedValue;
	}
}
// To add all options
function addAllOptionsCGLTCG(allSectionArray, rowCount) {
	for (var i = 0; i < rowCount; i++) {

		var srcDesc = document
				.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
						+ i + '].itemIncluded')[0];

		var selectedValue = srcDesc.value;
		removeAll(srcDesc);
		for (var k = 0; k < allSectionArray.length; k++) {
			var optn = document.createElement("option");
			optn.text = getSectionTextMap(allSectionArray[k]);
			optn.value = allSectionArray[k];
			srcDesc.options.add(optn);
		}
		srcDesc.value = selectedValue;
	}

}

// To add all options
function addAllOptionsCGSTCG(allSectionArray, rowCount) {
	for (var i = 0; i < rowCount; i++) {

		var srcDesc = document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
						+ i + '].itemIncluded')[0];

		var selectedValue = srcDesc.value;
		removeAll(srcDesc);
		for (var k = 0; k < allSectionArray.length; k++) {
			var optn = document.createElement("option");
			optn.text = getSectionTextMap(allSectionArray[k]);
			optn.value = allSectionArray[k];
			srcDesc.options.add(optn);
		}
		srcDesc.value = selectedValue;
	}

}

// To remove section
function removeSection(sectionArray, rowCount) {
	try {
		for (var i = 0; i < rowCount; i++) {
			var selectsLength = document
					.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
							+ i + '].sourceDescription')[0].options.length;
			for (var k = selectsLength; k > 0; k--) {

				if (document
						.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
								+ i + '].sourceDescription')[0].options[k] != null
						&& sectionArray
								.indexOf(document
										.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
												+ i + '].sourceDescription')[0].options[k].value) != -1) {
					document
							.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
									+ i + '].sourceDescription')[0].remove(k);

				}
			}
		}
	} catch (e) {
		alert(e.stack);
	}
}

// To remove section
function removeSectionOnChangeCGLTCG(sectionArray1, rowCount1) {
	try {
		for (var i = 0; i < rowCount1; i++) {
			var selectsLength = document
					.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
							+ i + '].itemIncluded')[0].options.length;
			for (var k = selectsLength; k > 0; k--) {
				if (document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
								+ i + '].itemIncluded')[0].options[k] != null
						&& sectionArray1
								.indexOf(document
										.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
												+ i + '].itemIncluded')[0].options[k].value) != -1) {
					document
							.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['
									+ i + '].itemIncluded')[0].remove(k);
				}
			}
		}
	} catch (e) {
		alert('exception in removeSection' + e.stack);
	}
}

// To remove section
function removeSectionOnChangeCGSTCG(sectionArray1, rowCount1) {
	try {
		for (var i = 0; i < rowCount1; i++) {
			var selectsLength = document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ i + '].itemIncluded')[0].options.length;
			for (var k = selectsLength; k > 0; k--) {
				if (document
						.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
								+ i + '].itemIncluded')[0].options[k] != null
						&& sectionArray1
								.indexOf(document
										.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
												+ i + '].itemIncluded')[0].options[k].value) != -1) {
					document
							.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
									+ i + '].itemIncluded')[0].remove(k);
				}
			}
		}
	} catch (e) {
		alert('exception in removeSection' + e.stack);
	}
}

// To delete all options
function removeAll(selectbox) {

	for (var i = selectbox.options.length - 1; i > 0; i--) {
		selectbox.removeChild(selectbox[i]);

	}
}

// To enable/disable tables based on the value
function enableTable(element, value, tableId) {

	var flag = document.getElementsByName(element)[0].value;
	var tabId = "#" + tableId;

	$(tabId).find(':input').prop('disabled', true);
	$(tabId).find('.addbtn').prop('hidden', true);

	if (flag == value) {
		$(tabId).find('.addbtn').prop('hidden', false);
		$(tabId).find(':input').prop('disabled', false);
	} else {
		$(tabId).find('[type=\"checkbox\"]').attr('checked', 'checked');
		if (tableId == 'partnerTableId') {
			deleteRowTable(tableId, 1, 1);
		} else {
			deleteRowTable(tableId, 2, 1);
		}
		$(tabId).find(':input').prop('disabled', true);
		$(tabId).find('.addbtn').prop('hidden', true);
	}
}

function panValidation80G(tableId) {

	var pan = document.getElementsByName('partAGEN1.orgFirmInfo.panNumber')[0].value;
	var verificationPAN = document
			.getElementsByName('verification.declaration.assesseeVerPAN')[0].value;
	var table = document.getElementById(tableId);
	var allInputTags = table.getElementsByTagName('input');
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("doneePanNo$")) {
			if (allInputTags[i].value != ''
					&& (allInputTags[i].value == pan || allInputTags[i].value == verificationPAN)) {
				j
						.setFieldError(allInputTags[i].name,
								'Donee PAN cannot be same as assesse PAN or verification PAN ');

			}
		}
	}
}

function panValidation80GGA(tableId) {

	var pan = document.getElementsByName('partAGEN1.orgFirmInfo.panNumber')[0].value;
	var verificationPAN = document
			.getElementsByName('verification.declaration.assesseeVerPAN')[0].value;
	var table = document.getElementById(tableId);
	var allInputTags = table.getElementsByTagName('input');
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("panOfDonee$")) {
			if (allInputTags[i].value != ''
					&& (allInputTags[i].value == pan || allInputTags[i].value == verificationPAN)) {
				j
						.setFieldError(allInputTags[i].name,
								'Donee PAN cannot be same as assesse PAN or verification PAN');

			}
		}
	}
}

// To check dropdown
function checkDropdownSelectedin1d() {
	var table = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowCount = table.rows.length - 2;
	var itemIncluded = [];

	var tabl = document.getElementById('schduleOsinc');
	var rowCountTab1 = tabl.rows.length - 3;
	var tab2 = document.getElementById('schduleOsincPti');
	var rowCountTab2 = tab2.rows.length - 3;

	var sourceDescriptionMap = [];

	for (var i = 0; i < rowCount; i++) {
		var section = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].itemIncluded')[0];
		if (section.value != '' && section.value != '56i'
				&& section.value != '56' && section.value != '562iii'
				&& section.value != '562x' && section.value != '5BB'
				&& itemIncluded.indexOf(section.value) == -1) {
			itemIncluded.push(section.value);
		}
	}

	for (var i = 0; i < rowCountTab1; i++) {
		var sourceDescription = document
				.getElementsByName('scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
						+ i + '].sourceDescription')[0];

		if (sourceDescription.value != ''
				&& sourceDescriptionMap.indexOf(sourceDescription.value) == -1) {
			sourceDescriptionMap.push(sourceDescription.value);
		}
	}

	var index = 0;
	for (var i = 0; i < rowCountTab2; i++) {
		var sourceDescription = document
				.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
						+ i + '].sourceDescription')[0];

		if (sourceDescription.value != '') {
			sourceDescriptionMap.push(sourceDescription.value);
		}

	}

	for (var i = 0; i < itemIncluded.length; i++) {

		if (sourceDescriptionMap.indexOf(itemIncluded[i]) == -1) {
			for (var k = 0; k < rowCount; k++) {
				var section = document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ k + '].itemIncluded')[0];

				if (section.value != '' && section.value == itemIncluded[i]) {

					index = k;
				}
			}
			addErrorXHTML(
					document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ index + '].itemIncluded')[0],
					'Please select this section in table 2c.', true);
			j.setFieldError('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
					+ index + '].itemIncluded',
					'Please select this section in table 2c.');
		}
	}
}

// To alert user
function alertItr6User() {

	var errText = "";
	var i = 1;
	var amountPayable = document
			.getElementsByName('partBTTI.taxPaid.balTaxPayable')[0].value;
	var fileSec = document
			.getElementsByName('partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;

	if (fileSec == '20') {
		errText += (i++)
				+ "119(2)(b)-after condonation of delay should be filed after expiry of due date mentioned in 139(1)/139(4).\n\n";
	}
	if (fileSec == '19') {
		errText += (i++)
				+ ".To file return u/s 92CD, post login in e-Filing portal, go to 'e-File' --> 'Income Tax Return' and select the applicable AY, ITR and other options.\n\n";
	}

	main.generateMsgDialogWithOk(errText, "");
}

// To open Save file dialog
function popupWithOk() {
	j.popup();
}

function disableCGPpoint4() {
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	if (domesticCompFlg == 'N') {

		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid')[0].disabled = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid')[0].disabled = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration')[0].disabled = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.aquisitCost')[0].disabled = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.improveCost')[0].disabled = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.expOnTrans')[0].disabled = false;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.lossSec94of7Or94of8')[0].disabled = false;
		
	} else {
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid')[0].disabled = true;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid')[0].disabled = true;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration')[0].disabled = true;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.aquisitCost')[0].disabled = true;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.improveCost')[0].disabled = true;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.expOnTrans')[0].disabled = true;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.lossSec94of7Or94of8')[0].disabled = true;
		
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTPaid')[0].value = 0;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRITransacSec48Dtl.nRItaxSTTNotPaid')[0].value = 0;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsideration')[0].value = 0;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.aquisitCost')[0].value = 0;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.improveCost')[0].value = 0;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.deductSec48.expOnTrans')[0].value = 0;
		document
				.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.lossSec94of7Or94of8')[0].value = 0;
		
	}
}

function verificationPanValidation(tableId) {

	var verificationPAN = document
			.getElementsByName('verification.declaration.assesseeVerPAN')[0];
	var companyType = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var flag = true;
	var table = document.getElementById(tableId);
	var allInputTags = table.getElementsByTagName('input');
	if (companyType == 'Y') {
		for (var i = 0; i < allInputTags.length; i++) {
			if (allInputTags[i].name.match("keyPerPAN$")) {
				if (allInputTags[i].value == verificationPAN.value) {
					flag = false;
				}
			}
		}

		if (flag) {
			j
					.setFieldError(
							verificationPAN.name,
							'PAN entered at Verification is not matching with any PAN entered in table Key persons. Please ensure that the person authorized to verify the ITR is as per Section 140 of the Income Tax Act.');
		}
	}

}

// Calculate Total Income for Schedule ICDS.
function calcTotalICDS() {
	try {
		var totalNatEffect = document
				.getElementsByName('itrScheduleICDS.totNetEffect')[0];
		var totalNetAmtNegative = document
				.getElementsByName('itrScheduleICDS.totalNetAmtNegative')[0];

		var temp = eval(parseInt(coalesce(document
				.getElementsByName('itrScheduleICDS.accntPolicies')[0].value),
				10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.valInventories')[0].value),
						10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.constructionCon')[0].value),
						10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.revenueRecog')[0].value),
						10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.tangFixedAssets')[0].value),
						10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.foriegnExcRates')[0].value),
						10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.govGrants')[0].value),
						10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.securities')[0].value),
						10)
				+ parseInt(coalesce(document
						.getElementsByName('itrScheduleICDS.assets')[0].value),
						10)
				+ parseInt(
						coalesce(document
								.getElementsByName('itrScheduleICDS.borrowingCosts')[0].value),
						10))
		if (parseInt(temp) > 0) {
			document.getElementsByName('itrScheduleICDS.totNetEffect')[0].value = ''
			document.getElementsByName('itrScheduleICDS.totalNetAmtNegative')[0].value = ''
			document.getElementsByName('itrScheduleICDS.totNetEffect')[0].value = temp
		} else if (parseInt(temp) < 0) {

			document.getElementsByName('itrScheduleICDS.totNetEffect')[0].value = ''
			document.getElementsByName('itrScheduleICDS.totalNetAmtNegative')[0].value = ''
			document.getElementsByName('itrScheduleICDS.totalNetAmtNegative')[0].value = Math
					.abs(temp);
		} else {

			document.getElementsByName('itrScheduleICDS.totNetEffect')[0].value = ''
			document.getElementsByName('itrScheduleICDS.totalNetAmtNegative')[0].value = ''
		}

		// populates to OI point 3a and 3b
		document.getElementsByName('partaoi.profDeviatDueAcctMeth')[0].value = parseInt(
				coalesce(totalNatEffect.value), 10);
		document.getElementsByName('partaoi.profDeviationICDS')[0].value = parseInt(
				coalesce(totalNetAmtNegative.value), 10);

	} catch (e) {
		alert(e.stack);
	}

}
function surchargeEditable() {
	var splRateIncTax = eval(parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[13].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[12].splRateIncTax')[0].value))
			+ parseInt(coalesce(document
					.getElementsByName('scheduleSI.splCodeRateTax[11].splRateIncTax')[0].value)));

	var splRateIncTax1 = parseInt(coalesce(document
			.getElementsByName('scheduleSI.splCodeRateTax[0].splRateIncTax')[0].value));
	if (splRateIncTax > 0 || splRateIncTax1 > 0) {
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0].readOnly = false;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.educationCess')[0].readOnly = false;
	} else {
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0].readOnly = true;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.educationCess')[0].readOnly = true;
	}

}
function clearOldSurchargeValue() {
	var surcharge = document
			.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0];
	if (surcharge.old != undefined) {
		surcharge.old = undefined;
	}
	if (surcharge.oldvalue != undefined) {
		surcharge.oldvalue = undefined;
	}
}

function OSSubCal() {

	document
			.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount')[0].value = eval(parseInt(
			coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls7.sourceAmount'),
			10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls2.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls3.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls4.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls5.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls6.sourceAmount'),
					10));
}

function OSSubCalInc() {

	document
			.getElementsByName('scheduleOS.incomeFromNature.underSec560.sourceAmount')[0].value = eval(parseInt(
			coalesceSetRet('scheduleOS.incomeFromNature.underSec561.sourceAmount'),
			10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incomeFromNature.underSec562.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incomeFromNature.underSec563.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incomeFromNature.underSec564.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incomeFromNature.underSec565.sourceAmount'),
					10));

}

function additionOfFields(a, b, sum) {
	var a = Number(document.getElementById(a).value);
	var b = Number(document.getElementById(b).value);
	document.getElementById(sum).value = a + b;
}

function additionOfGrandTotal(a, b, sum) {

	var a = Number(document.getElementById(a).value);
	var b = Number(document.getElementById(b).value);
	document.getElementById(sum).value = a + b;
}

function calTOtal() {
	var iii = Number(document
			.getElementsByName('partAOL.receipts.totalOfReceipts')[0].value);
	var vi = Number(document
			.getElementsByName('partAOL.openBalances.cashTotInc')[0].value);
	document.getElementsByName('partAOL.totalOpenReceipts')[0].value = iii + vi;
}

function calReceiptAmt() {
	var interest = Number(document
			.getElementsByName('partAOL.receipts.interest')[0].value);
	var dividend = Number(document
			.getElementsByName('partAOL.receipts.dividend')[0].value);
	var realisation = Number(document
			.getElementsByName('partAOL.receipts.rlznDuesDebtors')[0].value);
	var massTotal = Number(document
			.getElementsByName('partAOL.receipts.totalOfReceipts')[0].value);
	calTOtal();
	var tab1 = getNetTotal('tableOlSub');
	var tab2 = getNetTotal('tableOlSub1');

	document.getElementsByName('partAOL.receipts.totalOfReceipts')[0].value = interest
			+ dividend + realisation + tab1 + tab2;

}
function calPaymentsAmt() {
	var repaymentSecuredloan = Number(document
			.getElementsByName('partAOL.payments.repaymentSecuredloan')[0].value);
	var repaymentUnsecuredloan = Number(document
			.getElementsByName('partAOL.payments.repaymentUnsecuredloan')[0].value);
	var repaymentCreditors = Number(document
			.getElementsByName('partAOL.payments.repaymentCreditors')[0].value);
	var commision = Number(document
			.getElementsByName('partAOL.payments.commission')[0].value);
	var tab1 = getNetTotal('tableOlSub2');
	document.getElementsByName('partAOL.payments.totalPayments')[0].value = repaymentSecuredloan
			+ repaymentCreditors + repaymentUnsecuredloan + commision + tab1;
}
function getNetTotal(tableId) {
	var listOfTr = document.getElementById(tableId).getElementsByTagName('tr');
	var noOfRows = eval(parseInt(listOfTr.length, 10) - 3);
	var totalAmount = 0;
	if (tableId == 'tableOlSub') {

		for (var i = 0; i < noOfRows; i++) {
			var amount = Number(document
					.getElementsByName('partAOL.receipts.saleAssets[' + i
							+ '].amount')[0].value);

			// var decProfit =
			// document.getElementsByName('deviationDesc.3cb13d['+i+'].decreaseProfits')[0].value;
			if (isNaN(amount))
				amount = 0;

			totalAmount = totalAmount + amount;
		}
		document.getElementsByName('partAOL.receipts.totalSaleofAssets')[0].value = totalAmount;
		return totalAmount;
	}
	if (tableId == 'tableOlSub1') {

		for (var i = 0; i < noOfRows; i++) {
			var amount = Number(document
					.getElementsByName('partAOL.receipts.othersReceipts[' + i
							+ '].amount')[0].value);
			// var decProfit =
			// document.getElementsByName('deviationDesc.3cb13d['+i+'].decreaseProfits')[0].value;
			if (isNaN(amount))
				amount = 0;

			totalAmount = totalAmount + amount;
		}
		document.getElementsByName('partAOL.receipts.totOthersReceiptsOnly')[0].value = totalAmount;
		return totalAmount;
	}

	if (tableId == 'tableOlSub2') {

		for (var i = 0; i < noOfRows; i++) {
			var amount = Number(document
					.getElementsByName('partAOL.payments.othersPayments[' + i
							+ '].amount')[0].value);
			// var decProfit =
			// document.getElementsByName('deviationDesc.3cb13d['+i+'].decreaseProfits')[0].value;
			if (isNaN(amount))
				amount = 0;

			totalAmount = totalAmount + amount;
		}
		document.getElementsByName('partAOL.payments.totalOthersPayments')[0].value = totalAmount;
		return totalAmount;
	}

}

function surcharge201718() {

	var surcharge25ofSI = document
			.getElementsByName('partBTTI.computationOfTaxLiability.surcharge25ofSI')[0];
	var surcharge115bbe = eval(parseInt(
			coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
			10) * 0.60 * 0.25);

	var flag115BA = document
			.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var compnyType = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	if (compnyType == 'Y' && (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB')) {
		setEditableFieldValue(surcharge25ofSI, surcharge115bbe);
	} else {
		surcharge25ofSI.value = eval(parseInt(
				coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls1.sourceAmount'),
				10) * 0.60 * 0.25);
	}

	document
			.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOnTaxPayable')[0].value = eval(parseInt(
			coalesceSetRet('partBTTI.computationOfTaxLiability.surcharge25ofSI'),
			10)
			+ parseInt(
					coalesceSetRet('partBTTI.computationOfTaxLiability.surchargeOther115BBE'),
					10));

}

function calculateMatTaxRate() {

	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var residentSec90Flag = document
			.getElementsByName('partAGEN1.filingStatus.residentsec90')[0].value;
	var permanentEstbFlag = document
			.getElementsByName('partAGEN1.filingStatus.nripe')[0].value;
	var registrationFlag = document
			.getElementsByName('partAGEN1.filingStatus.registratedlaw')[0].value;
	var intFinancialServicesFlag = document
			.getElementsByName('partAGEN1.filingStatus.isifsc')[0].value;

	var taxRate = 0.15;

	if (domesticCompFlg == "N" && residentSec90Flag == "Y"
			&& permanentEstbFlag == "N") {

		taxRate = 0;

	} else if (domesticCompFlg == "N" && residentSec90Flag == "N"
			&& registrationFlag == "N") {

		taxRate = 0;

	} else if (intFinancialServicesFlag == "Y") {

		taxRate = 0.09;

	}

	return taxRate;
}

function onChg115ba() {

	var flag115BA = document
			.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var compnyType = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	if (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB' ) {

		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates')[0].readOnly = false;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates')[0].readOnly = false;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.surcharge25ofSI')[0].readOnly = false;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0].readOnly = false;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.educationCess')[0].readOnly = false;
	} else {
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates')[0].readOnly = true;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates')[0].readOnly = true;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.surcharge25ofSI')[0].readOnly = true;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.surchargeOther115BBE')[0].readOnly = true;
		document
				.getElementsByName('partBTTI.computationOfTaxLiability.educationCess')[0].readOnly = true;

		surchargeEditable();

	}

	if (compnyType == 'Y') {
		if (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB') {
			document.getElementsByName('partAGEN1.filingStatus.grossreceipt')[0].value = '';
			document.getElementsByName('partAGEN1.filingStatus.grossreceipt')[0].disabled = true;
		} else {
			document.getElementsByName('partAGEN1.filingStatus.grossreceipt')[0].disabled = false;
		}
	}
	if (flag115BA == '115BAA' || flag115BA == '115BAB') {
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.addSec28To44DA')[0].value = '';
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.dedSec28To44DAOTDedSec35AD')[0].value = '';
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.deductionUs35AD1')[0].value = '';

		
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.addSec28To44DA')[0].readOnly = true;
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.dedSec28To44DAOTDedSec35AD')[0].readOnly = true;
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.deductionUs35AD1')[0].readOnly = true;

	}else{
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.addSec28To44DA')[0].readOnly = false;
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.dedSec28To44DAOTDedSec35AD')[0].readOnly = false;
		document.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.deductionUs35AD1')[0].readOnly = false;

		
	}
	
	if (flag115BA == '115BAA' || flag115BA == '115BAB' || flag115BA == '115BA' ) {
		document.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtDebPL')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtUs35Allowable')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtDebPL')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtUs35Allowable')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtDebPL')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtUs35Allowable')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtDebPL')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtUs35Allowable')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtDebPL')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtUs35Allowable')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtDebPL')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtUs35Allowable')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtDebPL')[0].value = '';
		document.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtUs35Allowable')[0].value = '';
		
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].value = '';
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].value = '';
		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deductUs32AD')[0].value = '';
		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amt32AC')[0].value = '';
		
		
		
		document.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtDebPL')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtUs35Allowable')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtDebPL')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtUs35Allowable')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtDebPL')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtUs35Allowable')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtDebPL')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtUs35Allowable')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtDebPL')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtUs35Allowable')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtDebPL')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtUs35Allowable')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtDebPL')[0].readOnly =true;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtUs35Allowable')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =true;
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =true;
		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deductUs32AD')[0].readOnly =true;
		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amt32AC')[0].readOnly =true;
	}else{
		document.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtDebPL')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtUs35Allowable')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtDebPL')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtUs35Allowable')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtDebPL')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtUs35Allowable')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtDebPL')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtUs35Allowable')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtDebPL')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section352AB.deductUs35.amtUs35Allowable')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtDebPL')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCC.deductUs35.amtUs35Allowable')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtDebPL')[0].readOnly =false;
		document.getElementsByName('scheduleESR.deductionUs35.section35CCD.deductUs35.amtUs35Allowable')[0].readOnly =false;
	
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprOnGT180DayAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =false;
		document.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.addlnDeprDuringYearAdditions180DayAsset')[0].readOnly =false;

		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.deductUs32AD')[0].readOnly =false;
		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.amt32AC')[0].readOnly =false;
	}
	
	
	var tab1 = document.getElementById('page55');
	var allInputTags1 = tab1.getElementsByTagName('input');
	
	for (var i = 0; i < allInputTags1.length; i++) {
		if (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB') {
			allInputTags1[i].value = "";
			allInputTags1[i].disabled = true;
			$(tab1).find('.addbtn').prop('hidden', true);
		}else{
			allInputTags1[i].disabled = false;
			$(tab1).find('.addbtn').prop('hidden', false);
		}
	}
	var selects = tab1.getElementsByTagName('SELECT');
	for (var i = 0; i < selects.length; i++) {
		if (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB') {
			selects[i].disabled = true;
			selects[i].selectedIndex = 0;
		}else{
			if(selects[i].name.match("financialStamentFlag") )
			{
				continue;
			}
			selects[i].disabled = false;
		}
		
		
	}
	
	
	
}

function disableIntFinSerCntr() {
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var residentsec90 = document
			.getElementsByName('partAGEN1.filingStatus.residentsec90')[0].value;
	var nripe = document.getElementsByName('partAGEN1.filingStatus.nripe')[0].value;
	var isifsc = document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].value;
	var registratedlaw = document
			.getElementsByName('partAGEN1.filingStatus.registratedlaw')[0].value;
	if (domesticCompFlg == 'N') {

		if (residentsec90 == 'Y' && nripe == 'N') {
			document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].value = '';
			document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].disabled = true;
		} else if (residentsec90 == 'N' && registratedlaw == 'N') {
			document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].value = '';
			document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].disabled = true;
		} else {
			document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].disabled = false;
		}
	} else {

		document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].disabled = false;
	}

}
function removeIncomeDtls1() {

	var status = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	if (status == 'NRI' || status == 'RES') {
		document.getElementsByName('scheduleOS.incChargblSplRateOS.sec11BBF')[0].value = 0;
		// document.getElementsByName('scheduleOS.incChargblSplRateOS.sec115BBDA')[0].value
		// = 0;
		document.getElementsByName('scheduleOS.incChargblSplRateOS.sec11BBG')[0].value = 0;
	}

}
function setCountryForStateItr6() {

	try {

		var state = document
				.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0];
		var country = document
				.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];

		if (state.value == '99') {

			country.value = '';

		} else if (state.value == '') {

			country.value = '';

		} else {

			country.value = "91";

		}

	} catch (e) {
	}
}

function checkPinOnStateChangeVer() {
	var state = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0];
	var country = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];

	if (state.value == "99" || country.value != "91") {
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = false;
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled = false;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].value = "";
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].disabled = false;

	} else {
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = false;
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].disabled = false;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].value = "";
	}

	// populateZipCodeVer();

}

function checkPinOnCountryChangeVer() {
	var state = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0];
	var country = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];

	var zipCode = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].value
	if (country.value == "91" || country.value == "-1") {
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = false;
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].disabled = false;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].value = "";
	} else {
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = false;
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled = false;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].value = "";
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].disabled = false;

	}

	// populateZipCodeVer();

}

function setStateForCountryitr6() {

	var state = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0];
	var country = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];

	try {
		if (country.value == '91') {

			state.value = '';

		} else if (country.value != '91') {
			state.value = "99";

		}
	} catch (e) {
	}
}

function populateZipCodeVer() {

	var zipCodeCheck = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0];
	var country = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];

	if (zipCodeCheck.checked == true && country.value != '91'
			&& country.value != "") {

		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].value = "XXXXXX";
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly = true;
		zipCodeCheck.value = true;

	} else {

		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].value = "";
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly = false;
		zipCodeCheck.value = false;
	}

}

function checkPinZipOnload() {
	var state = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0];
	var country = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];
	var zipCode = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].value

	if (country.value == "91" || country.value == "-1") {
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = false;
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].disabled = false;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].value = "";

	} else {
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = false;
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled = false;

		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].disabled = true;
		document.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode')[0].value = "";
		if (zipCode == "XXXXXX") {

			document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly = true;
			document
					.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = true;
		} else {

			document.getElementsByName('partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly = false;
			document
					.getElementsByName('partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked = false;
		}

	}

	// populateZipCodeVer();

}
function priBankMandtry() {
	var bankDtlflag = document.getElementsByName('itr.scheduleBA.bankDtlsFlag')[0].value;
	var bankName = document.getElementsByName('itr.scheduleBA[0].bankName')[0].value;
	var ifscCode = document.getElementsByName('itr.scheduleBA[0].ifscCode')[0].value;
	var bankAcctNo = document.getElementsByName('itr.scheduleBA[0].accNo')[0].value;

	var tab = document.getElementById('scheduleBA');
	var allInputTags = tab.getElementsByTagName('input');
	var countOfCheckBox = 0;
	var disbaledornot = true;
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("useForRefund$")) {
			if (allInputTags[i].checked == true
					&& allInputTags[i].disabled != true) {
				allInputTags[i].value = true;
				countOfCheckBox++;
			} else {
				if (allInputTags[i].disabled != true) {
					allInputTags[i].value = false;
				} else {
					disbaledornot = false;
					allInputTags[i].value = "";
				}

			}
		}
	}

	if (countOfCheckBox == 0 && disbaledornot == true) {
		addErrorXHTML(
				'',
				'Please select atleast one account in which you prefer to get your refund in Part B TTI.');
		j
				.setFieldError(
						'itr.scheduleBA[0].useForRefund',
						'Please select atleast one account in which you prefer to get your refund in Part B TTI.');
	}
	if (bankDtlflag == 'N') {
		if (bankName != "" && (ifscCode == "" || bankAcctNo == "")) {

			addErrorXHTML('',
					'Please fill all the fields under Indian Bank Account details.');
			j
					.setFieldError('itr.scheduleBA[0].accNo',
							'Please fill all the fields under Indian Bank Account details.');
		}

		if (ifscCode != "" && (bankName == "" || bankAcctNo == "")) {

			addErrorXHTML('',
					'Please fill all the fields under Indian Bank Account details.');
			j
					.setFieldError('itr.scheduleBA[0].accNo',
							'Please fill all the fields under Indian Bank Account details.');
		}

		if (bankAcctNo != "" && (ifscCode == "" || bankName == "")) {

			addErrorXHTML('',
					'Please fill all the fields under Indian Bank Account details.');
			j
					.setFieldError('itr.scheduleBA[0].accNo',
							'Please fill all the fields under Indian Bank Account details.');
		}

	}

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("ifscCode$")
				&& allInputTags[i + 1].name.match("bankName$")
				&& allInputTags[i + 2].name.match("accNo$")
				&& allInputTags[i + 3].name.match("depositAmount$")) {
			if (allInputTags[i + 3].value != ''
					&& (allInputTags[i].value == ''
							|| allInputTags[i + 1].value == '' || allInputTags[i + 2].value == '')) {
				addError(
						'',
						'Please fill all the fields under Other Bank account details.',
						true);
				j
						.setFieldError('itr.scheduleBA[0].ifscCode',
								'Please fill all the fields under Other Bank account details.');
			}
		}
	}

}

function enableBankDtls() {

	enableTableForNRI('itr.scheduleBA.bankDtlsFlag', 'Y', 'scheduleBA');

	var tab = document.getElementById('scheduleBA');
	var allInputTags = tab.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("useForRefund$")) {
			if (allInputTags[i].value == 'false') {
				allInputTags[i].checked = false;
			} else if (allInputTags[i].value == 'true') {
				allInputTags[i].checked = true;
			}
		}
	}
	enableField('itr.scheduleBA.bankDtlsFlag', 'N',
			'itr.scheduleBA.foreignBankDtls[0].ibanSwiftCode');
	enableField('itr.scheduleBA.bankDtlsFlag', 'N',
			'itr.scheduleBA.foreignBankDtls[0].bankName');
	enableField('itr.scheduleBA.bankDtlsFlag', 'N',
			'itr.scheduleBA.foreignBankDtls[0].countryCode');
	enableField('itr.scheduleBA.bankDtlsFlag', 'N',
			'itr.scheduleBA.foreignBankDtls[0].bankAccountNo');

	enableField('partAGEN1.filingStatus.residentialStatus', 'NRI',
			'itr.scheduleBA.foreignBankDtls[0].ibanSwiftCode');
	enableField('partAGEN1.filingStatus.residentialStatus', 'NRI',
			'itr.scheduleBA.foreignBankDtls[0].bankName');
	enableField('partAGEN1.filingStatus.residentialStatus', 'NRI',
			'itr.scheduleBA.foreignBankDtls[0].countryCode');
	enableField('partAGEN1.filingStatus.residentialStatus', 'NRI',
			'itr.scheduleBA.foreignBankDtls[0].bankAccountNo');

}

function populateBankFlg() {

	var residentialStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	if (residentialStatus == 'RES') {
		document.getElementsByName('itr.scheduleBA.bankDtlsFlag')[0].value = 'Y';
		document.getElementsByName('itr.scheduleBA.bankDtlsFlag')[0].disabled = true;
	} else {
		document.getElementsByName('itr.scheduleBA.bankDtlsFlag')[0].disabled = false;
	}
	enableBankDtlsOnload();
}

function setSchHPPinZipOnLoad() {

	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);

	var state;
	var country;

	for (var i = 0; i < totHp; i++) {

		state = document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].addressDetail.stateCode')[0].value;
		country = document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].addressDetail.country')[0].value;

		if (country == '91') {
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].addressDetail.pinCode')[0].value = '';
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].addressDetail.pinCode')[0].disabled = true;
		} else {
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2PinZipOnLoadHold() {

	var table = document.getElementById('natOfComSubBoth');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document
				.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
						+ i + '].compDetails.addressDetail.stateCode')[0].value;
		country = document
				.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
						+ i + '].compDetails.addressDetail.country')[0].value;

		if (country == '91') {
			document
					.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document
					.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
							+ i + '].compDetails.addressDetail.pinCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
							+ i + '].compDetails.addressDetail.pinCode')[0].disabled = true;
		} else {
			document
					.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.holdingStatus.holdingCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2PinZipOnLoadHoldSub() {

	var table = document.getElementById('natOfComHoldBoth');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document
				.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
						+ i + '].compDetails.addressDetail.stateCode')[0].value;
		country = document
				.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
						+ i + '].compDetails.addressDetail.country')[0].value;

		if (country == '91') {
			document
					.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document
					.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
							+ i + '].compDetails.addressDetail.pinCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
							+ i + '].compDetails.addressDetail.pinCode')[0].disabled = true;
		} else {
			document
					.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.holdingStatus.subsidiaryCompDetail['
							+ i + '].compDetails.addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2PinZipOnLoadBusOrg() {

	var table = document.getElementById('bussOrg');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document.getElementsByName('partAGEN2For6.busOrganisation[' + i
				+ '].addressDetail.stateCode')[0].value;
		country = document.getElementsByName('partAGEN2For6.busOrganisation['
				+ i + '].addressDetail.country')[0].value;

		if (country == '91') {
			document.getElementsByName('partAGEN2For6.busOrganisation[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.busOrganisation[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document.getElementsByName('partAGEN2For6.busOrganisation[' + i
					+ '].addressDetail.pinCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.busOrganisation[' + i
					+ '].addressDetail.pinCode')[0].disabled = true;
		} else {
			document.getElementsByName('partAGEN2For6.busOrganisation[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.busOrganisation[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2PinZipOnLoadKey() {

	var table = document.getElementById('dtlsMngDir');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document.getElementsByName('partAGEN2For6.keyPersons[' + i
				+ '].addressDetail.stateCode')[0].value;
		country = document.getElementsByName('partAGEN2For6.keyPersons[' + i
				+ '].addressDetail.country')[0].value;

		if (country == '91') {
			document.getElementsByName('partAGEN2For6.keyPersons[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.keyPersons[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document.getElementsByName('partAGEN2For6.keyPersons[' + i
					+ '].addressDetail.pinCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.keyPersons[' + i
					+ '].addressDetail.pinCode')[0].disabled = true;
		} else {
			document.getElementsByName('partAGEN2For6.keyPersons[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.keyPersons[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2PinZipOnLoadShare() {

	var table = document.getElementById('shareInfo');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document.getElementsByName('partAGEN2For6.shareHolderInfo[' + i
				+ '].addressDetail.stateCode')[0].value;
		country = document.getElementsByName('partAGEN2For6.shareHolderInfo['
				+ i + '].addressDetail.country')[0].value;

		if (country == '91') {
			document.getElementsByName('partAGEN2For6.shareHolderInfo[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.shareHolderInfo[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document.getElementsByName('partAGEN2For6.shareHolderInfo[' + i
					+ '].addressDetail.pinCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.shareHolderInfo[' + i
					+ '].addressDetail.pinCode')[0].disabled = true;
		} else {
			document.getElementsByName('partAGEN2For6.shareHolderInfo[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.shareHolderInfo[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2PinZipOnLoadOwner() {

	var table = document.getElementById('ownerInfo');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
				+ '].addressDetail.stateCode')[0].value;
		country = document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
				+ '].addressDetail.country')[0].value;

		if (country == '91') {
			document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
					+ '].addressDetail.pinCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
					+ '].addressDetail.pinCode')[0].disabled = true;
		} else {
			document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
					+ '].addressDetail.zipCode')[0].value = '';
			document.getElementsByName('partAGEN2For6.ownershipInfo[' + i
					+ '].addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2ForiegnUltimate() {
	var table = document.getElementById('ownerInfoForiegnUltimate');
	var rowCount = table.rows.length;
	for (var i = 0; i < rowCount - 3; i++) {
		
		var country = document.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['+ i + '].addressDetail.country')[0].value;
		document.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['+ i + '].countryOfResidence')[0].value = country ;
		
	}
	
}
function setPartAGen2CountryOfResidence() {
	var table = document.getElementById('ownerInfoForiegnImmediate');
	var rowCount = table.rows.length;
	for (var i = 0; i < rowCount - 3; i++) {
		
		var country = document.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['+ i + '].addressDetail.country')[0].value;
		document.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['+ i + '].countryOfResidence')[0].value = country ;
		
	}
	
}
function setPartAGen2PinZipOnLoadImmediate() {

	var table = document.getElementById('ownerInfoForiegnImmediate');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document
				.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
						+ i + '].addressDetail.stateCode')[0].value;
		country = document
				.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
						+ i + '].addressDetail.country')[0].value;

		if (country == '91') {
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
							+ i + '].addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
							+ i + '].addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
							+ i + '].addressDetail.pinCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
							+ i + '].addressDetail.pinCode')[0].disabled = true;
		} else {
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
							+ i + '].addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnImmediate['
							+ i + '].addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function setPartAGen2PinZipOnLoadUltimate() {

	var table = document.getElementById('ownerInfoForiegnUltimate');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document
				.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
						+ i + '].addressDetail.stateCode')[0].value;
		country = document
				.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
						+ i + '].addressDetail.country')[0].value;

		if (country == '91') {
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
							+ i + '].addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
							+ i + '].addressDetail.zipCode')[0].disabled = true;
		} else if (state == '99') {
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
							+ i + '].addressDetail.pinCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
							+ i + '].addressDetail.pinCode')[0].disabled = true;
		} else {
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
							+ i + '].addressDetail.zipCode')[0].value = '';
			document
					.getElementsByName('partAGEN2For6.ownerInfoForiegnUltimate['
							+ i + '].addressDetail.zipCode')[0].disabled = true;
		}
	}

}

function calcTotalAmt(tableId) {

	var tab1 = document.getElementById('schEIMinorChild');
	var noOfRows = tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for (var i = 0; i < (noOfRows - 2); i++) {
		amt = document.getElementsByName('scheduleEI.othersInc[' + i
				+ '].othAmount')[0].value;
		sum = eval(parseInt(sum, 10) + parseInt(coalesce(amt), 10));
	}
	document.getElementsByName('scheduleEI.others')[0].value = parseInt(sum, 10);
}

function populateMobileCode()

{

	state = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.stateCode')[0];
	country = document
			.getElementsByName('partAGEN1.orgFirmInfo.address.country')[0];

	if (state.value != '99' && state.value != '-1') {

		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.countryCodeMobile')[0].value = '91';
		// document.getElementsByName('partAGEN1.orgFirmInfo.address.countryCodeMobile')[0].disabled
		// = true;
	} else if (state.value == '99') {
		document
				.getElementsByName('partAGEN1.orgFirmInfo.address.countryCodeMobile')[0].value = '';
		// document.getElementsByName('partAGEN1.orgFirmInfo.address.countryCodeMobile')[0].disabled
		// = false;
	}
}

function disableTDS1Fields(el)  {
	var tdsTable = document.getElementById('scheduleTDS1');
	var noOfRows = tdsTable.rows.length;
	var startIndex=0;
	
	var endIndex=noOfRows - 6

	/*if(el){	
		startIndex = parseInt(el.name.substring(el.name.lastIndexOf("[")+1,el.name.lastIndexOf("]")))
		endIndex=startIndex+1
	}*/
 
	for (var i = startIndex; i < endIndex; i++) {		
		setTimeout(disableTDS1FieldsRows,300,i)
	}
}
function disableTDS1FieldsRows(i) {
	//alert('disableTDS1FieldsRows ' ,i)
	if (document.getElementsByName('scheduleTDS1.tdSonOthThanSal['
				+ i + '].claimOwnHands')[0] ) {
		if (parseInt(document.getElementsByName('scheduleTDS1.tdSonOthThanSal['
				+ i + '].claimOwnHands')[0].value) == 0) {
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].grossAmount')[0].value = '';
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].headOfIncome')[0].value = '';
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].grossAmount')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].headOfIncome')[0].disabled = true;
		} else {
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].grossAmount')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].headOfIncome')[0].disabled = false;
		}

		tDSCreditName = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].tDSCreditName')[0].value;

		if (tDSCreditName == 'O') {

			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].pANofOtherPerson')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].value = "";
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = true;
			
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = true;
		
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].value = "";
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value = "";
			
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].value = "";
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].value = "";
			
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = false;
		} else if (tDSCreditName == 'S') {
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].pANofOtherPerson')[0].value = "";
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].value = "";
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].pANofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = false;
		
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = false;
		
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value = "";
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].value = "";
		} else {
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = false;
		
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = false;
		
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = false;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = false;

		}

	}

}

function disableTDS2Fields() {
	var tdsTable = document.getElementById('scheduleTDS2');
	var noOfRows = tdsTable.rows.length;

	for (var i = 0; i < (noOfRows - 6); i++) {

		if (parseInt(document.getElementsByName('scheduleTDS2.tdSonOthThanSal['
				+ i + '].claimOwnHands')[0].value) == 0) {
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].grossAmount')[0].value = '';
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].headOfIncome')[0].value = '';
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].grossAmount')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].headOfIncome')[0].disabled = true;
		} else {
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].grossAmount')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].headOfIncome')[0].disabled = false;
		}

		tDSCreditName = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].tDSCreditName')[0].value;

		if (tDSCreditName == 'O') {

			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].pANofOtherPerson')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].value = "";
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = true;
		
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = true;
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].value = "";
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].value = "";
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = false;
		}

		else if (tDSCreditName == 'S') {
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].pANofOtherPerson')[0].value = "";
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].value = "";
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].pANofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value = "";
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].value = "";
		}

		else {
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].totTDSOnAmtPaidCY')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = false;
		
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = false;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = false;

		}

	}

}

function validateTDS19Grtthen67() {

	var mainTab = document.getElementById('scheduleTDS1');

	var mainTabRows = mainTab.rows.length;

	for (var i = 0; i < mainTabRows - 6; i++) {

		tDSCreditName = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].tDSCreditName')[0].value;

		if (tDSCreditName == 'S') {

			var amt6 = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaid')[0].value;

			var amt7 = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaidCY')[0].value;

			var amt9 = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].claimOwnHands')[0];

			var tempVal = eval(parseInt(coalesce(amt6), 10)
					+ parseInt(coalesce(amt7), 10));

			if (amt9.value > tempVal) {
				j
						.setFieldError('scheduleTDS1.tdSonOthThanSal[' + i
								+ '].claimOwnHands',
								'Amount cannot be more than the amount entered in Col (6) or col (7)');
				addErrorXHTML(
						document
								.getElementsByName('scheduleTDS1.tdSonOthThanSal['
										+ i + '].claimOwnHands')[0],
						'Amount cannot be more than the amount entered in Col (6) or col (7)',
						true);
			}
		} else {
			var amt6 = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaid')[0].value;

			var amt8 = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;

			var amt9 = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].claimOwnHands')[0];

			var tempVal = eval(parseInt(coalesce(amt6), 10)
					+ parseInt(coalesce(amt8), 10));

			if (amt9.value > tempVal) {
				j
						.setFieldError('scheduleTDS1.tdSonOthThanSal[' + i
								+ '].claimOwnHands',
								'Amount cannot be more than the amount entered in Col (6) or col (8)');
				addErrorXHTML(
						document
								.getElementsByName('scheduleTDS1.tdSonOthThanSal['
										+ i + '].claimOwnHands')[0],
						'Amount cannot be more than the amount entered in Col (6) or col (8)',
						true);
			}

		}
	}
}

function validateTDS29Grtthen67() {

	var mainTab = document.getElementById('scheduleTDS2');

	var mainTabRows = mainTab.rows.length;

	for (var i = 0; i < mainTabRows - 6; i++) {

		tDSCreditName = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].tDSCreditName')[0].value;

		if (tDSCreditName == 'S') {

			var amt6 = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaid')[0].value;

			var amt7 = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaidCY')[0].value;

			var amt9 = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].claimOwnHands')[0];

			var tempVal = eval(parseInt(coalesce(amt6), 10)
					+ parseInt(coalesce(amt7), 10));

			if (amt9.value > tempVal) {
				j
						.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i
								+ '].claimOwnHands',
								'Amount cannot be more than the amount entered in Col (6) or col (7)');
				addErrorXHTML(
						document
								.getElementsByName('scheduleTDS2.tdSonOthThanSal['
										+ i + '].claimOwnHands')[0],
						'Amount cannot be more than the amount entered in Col (6) or col (7)',
						true);
			}
		} else {

			var amt6 = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaid')[0].value;

			var amt8 = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;

			var amt9 = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].claimOwnHands')[0];

			var tempVal = eval(parseInt(coalesce(amt6), 10)
					+ parseInt(coalesce(amt8), 10));

			if (amt9.value > tempVal) {
				j
						.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i
								+ '].claimOwnHands',
								'Amount cannot be more than the amount entered in Col (6) or col (8)');
				addErrorXHTML(
						document
								.getElementsByName('scheduleTDS2.tdSonOthThanSal['
										+ i + '].claimOwnHands')[0],
						'Amount cannot be more than the amount entered in Col (6) or col (8)',
						true);
			}

		}
	}
}

function calcTotalTDS1() {
	var tdsTable = document.getElementById('scheduleTDS1');
	var noOfRows = tdsTable.rows.length;

	var sum = 0;

	for (var i = 0; i < (noOfRows - 6); i++) {

		var taxCreditedOwnHands = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].claimOwnHands')[0].value;

		sum = eval(parseInt(sum, 10)
				+ parseInt(coalesce(taxCreditedOwnHands), 10));

	}

	document
			.getElementsByName('scheduleTDS1.tdSonOthThanSal.totalTDSonSalaries')[0].value = sum;

}

function calcTotalTDS2() {

	var tdsTable = document.getElementById('scheduleTDS2');
	var noOfRows = tdsTable.rows.length;

	var sum = 0;

	for (var i = 0; i < (noOfRows - 6); i++) {

		var taxCreditedOwnHands = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].claimOwnHands')[0].value;

		sum = eval(parseInt(sum, 10)
				+ parseInt(coalesce(taxCreditedOwnHands), 10));

	}

	document
			.getElementsByName('scheduleTDS2.tdSonOthThanSal.totalTDSonOthThanSals')[0].value = sum;

}

function totalOfAmtCarriedTDS1(el) {

	var mainTab = document.getElementById('scheduleTDS1');
	var mainTabRows = mainTab.rows.length;

	var sum = 0;

	while ((el = el.parentNode) && el.nodeName.toLowerCase() !== 'tr')
		;
	if (el) {
		var index = el.rowIndex - 4;
	}
	for (var i = 0; i < mainTabRows - 6; i++) {
		if (i == index) {

			totTDSOnAmtPaid = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaid')[0].value;

			taxDeductedOwnHands = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaidCY')[0].value;

			taxDeductedTDS = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;

			taxCreditedOwnHands = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].claimOwnHands')[0].value;

			taxCreditedTDS = document
					.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value;

			sum = zeroOrMore(eval(parseInt(sum, 10)
					+ parseInt(coalesce(totTDSOnAmtPaid), 10)
					+ parseInt(coalesce(taxDeductedOwnHands), 10)
					+ parseInt(coalesce(taxDeductedTDS), 10)
					- parseInt(coalesce(taxCreditedOwnHands), 10)
					- parseInt(coalesce(taxCreditedTDS), 10)));

			document.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].amntCarryForward')[0].value = sum;

		}
	}
}

function totalOfAmtCarriedTDS2(el) {

	var mainTab = document.getElementById('scheduleTDS2');
	var mainTabRows = mainTab.rows.length;

	var sum = 0;

	while ((el = el.parentNode) && el.nodeName.toLowerCase() !== 'tr')
		;
	if (el) {
		var index = el.rowIndex - 4;
	}
	for (var i = 0; i < mainTabRows - 6; i++) {
		if (i == index) {

			totTDSOnAmtPaid = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaid')[0].value;

			taxDeductedOwnHands = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].totTDSOnAmtPaidCY')[0].value;

			taxDeductedTDS = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;

			taxCreditedOwnHands = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].claimOwnHands')[0].value;

			taxCreditedTDS = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value;

			sum = zeroOrMore(eval(parseInt(sum, 10)
					+ parseInt(coalesce(totTDSOnAmtPaid), 10)
					+ parseInt(coalesce(taxDeductedOwnHands), 10)
					+ parseInt(coalesce(taxDeductedTDS), 10)
					- parseInt(coalesce(taxCreditedOwnHands), 10)
					- parseInt(coalesce(taxCreditedTDS), 10)));
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].amntCarryForward')[0].value = sum;

		}
	}
}

function threeFieldsValidationforTDS1OnSave() {

	var mainTab = document.getElementById('scheduleTDS1');
	var mainTabRows = mainTab.rows.length;

	var sum = 0;

	for (var i = 0; i < mainTabRows - 6; i++) {
		taxCreditedIncome = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedIncome')[0].value;

		taxCreditedTDS = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value;

		taxCreditedSpousePAN = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].value;

		if (taxCreditedIncome != ''
				&& (taxCreditedTDS == null || taxCreditedSpousePAN == null
						|| taxCreditedTDS == '' || taxCreditedSpousePAN == '')) {
			j.setFieldError('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome',
					'Please enter all the mandatory fields in TDS1 point 10.');
			return;
		}
		if (taxCreditedTDS != ''
				&& (taxCreditedIncome == null || taxCreditedSpousePAN == null
						|| taxCreditedIncome == '' || taxCreditedSpousePAN == '')) {

			j.setFieldError('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome',
					'Please enter all the mandatory fields in TDS1 point 10.');
			return;
		}

		if (taxCreditedSpousePAN != ''
				&& (taxCreditedIncome == null || taxCreditedTDS == null
						|| taxCreditedIncome == '' || taxCreditedTDS == '')) {
			j.setFieldError('scheduleTDS1.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome',
					'Please enter all the mandatory fields in TDS1 point 10.');
			return;
		}
	}
}

function threeFieldsValidationforTDS2OnSave() {

	var mainTab = document.getElementById('scheduleTDS2');
	var mainTabRows = mainTab.rows.length;

	var sum = 0;

	for (var i = 0; i < mainTabRows - 6; i++) {
		taxCreditedIncome = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedIncome')[0].value;

		taxCreditedTDS = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value;

		taxCreditedSpousePAN = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].value;
		

		if (taxCreditedIncome != ''
				&& (taxCreditedTDS == null || taxCreditedSpousePAN == null  
						|| taxCreditedTDS == '' || taxCreditedSpousePAN == '')) {
			j.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome',
					'Please enter all the mandatory fields in TDS2 point 10.');
			return;
		}
		if (taxCreditedTDS != ''
				&& (taxCreditedIncome == null || taxCreditedSpousePAN == null  
						|| taxCreditedIncome == '' || taxCreditedSpousePAN == '' )) {

			j.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome',
					'Please enter all the mandatory fields in TDS2 point 10.');
			return;
		}

		if (taxCreditedSpousePAN != ''
				&& (taxCreditedIncome == null || taxCreditedTDS == null
						|| taxCreditedIncome == '' || taxCreditedTDS == '')) {
			j.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome',
					'Please enter all the mandatory fields in TDS2 point 10.');
			return;
		}
		
	}
}

function checkFor18thFiledValueDPM() {

	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.propAvgDepreciation')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.netAgvDepreciation')[0].value)) {
		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate15.depreciationDetail.propAvgDepreciation',
						'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.propAvgDepreciation')[0],
				'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM',
				true);
	}

	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.propAvgDepreciation')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.netAgvDepreciation')[0].value)) {
		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate30.depreciationDetail.propAvgDepreciation',
						'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.propAvgDepreciation')[0],
				'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM',
				true);
	}

	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.propAvgDepreciation')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.netAgvDepreciation')[0].value)) {
		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate40.depreciationDetail.propAvgDepreciation',
						'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.propAvgDepreciation')[0],
				'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM',
				true);
	}
	
	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.propAvgDepreciation')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.netAgvDepreciation')[0].value)) {
		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate45.depreciationDetail.propAvgDepreciation',
						'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.propAvgDepreciation')[0],
				'Amount cannot be more than the amount entered in Proportionate aggregate depreciation in Schedule DPM',
				true);
	}
}

function validateTDS1() {

	var mainTab = document.getElementById('scheduleTDS1');
	var mainTabRows = mainTab.rows.length;

	for (var i = 0; i < mainTabRows - 6; i++) {
		var taxDeductedOwnHands = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].totTDSOnAmtPaidCY')[0].value;
		// 6th field
		var totTDSOnAmtPaid = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].totTDSOnAmtPaid')[0].value;
		// 8th field
		var taxDeductedIncome = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxDeductedIncome')[0].value;
		var taxDeductedTDS = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;
		// 1st field
		var tDSCreditName = document
				.getElementsByName('scheduleTDS1.tdSonOthThanSal[' + i
						+ '].tDSCreditName')[0].value;

		if (tDSCreditName == 'O') {
			if (totTDSOnAmtPaid != ''
					&& (taxDeductedIncome != '' || taxDeductedTDS != '')) {

				addErrorXHTML(
						'',
						'Unclaimed TDS brought forward and Income details of TDS Deducted in the hands of any other person as per rule 37BA(2) should be provided in different rows in Sch TDS 1.');
				j
						.setFieldError(
								'scheduleTDS1.tdSonOthThanSal['
										+ i
										+ '].taxDeductCreditDtls.taxDeductedTDS',
								'Unclaimed TDS brought forward and Income details of TDS Deducted in the hands of any other person as per rule 37BA(2) should be provided in different rows in Sch TDS 1.');
			}
		}

		if (taxDeductedOwnHands != '' && totTDSOnAmtPaid != '') {
			addErrorXHTML(
					'',
					'Unclaimed TDS brought forward and details of TDS of current FY should be provided in different rows in Table 1 of schedule TDS.');
			j
					.setFieldError(
							'scheduleTDS1.tdSonOthThanSal[' + i
									+ '].totTDSOnAmtPaid',
							'Unclaimed TDS brought forward and details of TDS of current FY should be provided in different rows in Table 1 of schedule TDS.');

		}
	}
}

function validateTDS2() {

	var mainTab = document.getElementById('scheduleTDS2');
	var mainTabRows = mainTab.rows.length;

	for (var i = 0; i < mainTabRows - 6; i++) {
		var taxDeductedOwnHands = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].totTDSOnAmtPaidCY')[0].value;
		var totTDSOnAmtPaid = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].totTDSOnAmtPaid')[0].value;
		// 8th field
		var taxDeductedIncome = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxDeductedIncome')[0].value;
		var taxDeductedTDS = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;
		// 1st field

		var tDSCreditName = document
				.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].tDSCreditName')[0].value;
		if (tDSCreditName == 'O') {
			if (totTDSOnAmtPaid != ''
					&& (taxDeductedIncome != '' || taxDeductedTDS != '')) {
				addErrorXHTML(
						'',
						'Unclaimed TDS brought forward and TDS details of TDS Deducted in the hands of any other person as per rule 37BA(2) should be provided in different rows in Sch TDS 2');
				j
						.setFieldError(
								'scheduleTDS2.tdSonOthThanSal['
										+ i
										+ '].taxDeductCreditDtls.taxDeductedTDS',
								'Unclaimed TDS brought forward and TDS details of TDS Deducted in the hands of any other person as per rule 37BA(2) should be provided in different rows in Sch TDS 2');
			}
		}
		if (taxDeductedOwnHands != '' && totTDSOnAmtPaid != '') {

			addErrorXHTML(
					'',
					'Unclaimed TDS brought forward and details of TDS of current FY should be provided in different rows in Sch TDS 2 in Table 2 of schedule TDS.');
			j
					.setFieldError(
							'scheduleTDS2.tdSonOthThanSal[' + i
									+ '].totTDSOnAmtPaid',
							'Unclaimed TDS brought forward and details of TDS of current FY should be provided in different rows in Sch TDS 2 in Table 2 of schedule TDS.');
		}
	}
}

function validateTCS() {

	var mainTab = document.getElementById('scheduleTCS');
	var mainTabRows = mainTab.rows.length;

	for (var i = 0; i < mainTabRows - 5; i++) {
		var amtbfTCS = document.getElementsByName('scheduleTCS.tcs[' + i
				+ '].amountBF')[0].value;
		var totTCS = document.getElementsByName('scheduleTCS.tcs[' + i
				+ '].totalTCS')[0].value;

		if (amtbfTCS != '' && totTCS != '') {

			addErrorXHTML(
					'',
					'Unclaimed TCS brought forward and details of TCS of current FY should be provided in different rows in Sch TCS');
			j
					.setFieldError(
							'scheduleTCS.tcs[' + i + '].totalTCS',
							'Unclaimed TCS brought forward and details of TCS of current FY should be provided in different rows in Sch TCS');

		}
	}
}

function onBPTableWithSingleDropMand() {

	var netPLFrmSpecifiedBus = document
			.getElementsByName('itr6ScheduleBP.specifiedBusinessInc.netPLFrmSpecifiedBus')[0].value;

	if (netPLFrmSpecifiedBus != 0) {
		if (document
				.getElementsByName('itr6ScheduleBP.incSpecifiedBusiness.dedUs35ADSubSec5Dtls[0].dedUs35ADSubSec5')[0].value == '') {

			addErrorXHTML(
					'',
					'Please select any Relevant clause of sub-section (5) of section 35AD from dropdown (Schedule BP Sl No 50');

			j
					.setFieldError(
							'',
							'Please select  Relevant clause of sub-section (5) of section 35AD from dropdown (Schedule BP Sl No 51)');

		}
	}
}

function checkFor16thFiledValue() {

	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationITAct')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.totalDepreciation')[0].value)) {

		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationITAct',
						'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate15.depreciationDetail.depreciationITAct')[0],
				'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM',
				true);
	}

	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationITAct')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.totalDepreciation')[0].value)) {
		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationITAct',
						'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate30.depreciationDetail.depreciationITAct')[0],
				'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM',
				true);
	}

	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationITAct')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.totalDepreciation')[0].value)) {
		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationITAct',
						'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate40.depreciationDetail.depreciationITAct')[0],
				'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM',
				true);
	}
	
	if (parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationITAct')[0].value) > parseInt(document
			.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.totalDepreciation')[0].value)) {
		j
				.setFieldError(
						'scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationITAct',
						'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM');
		addErrorXHTML(
				document
						.getElementsByName('scheduleDPM.plantMachinery.rate45.depreciationDetail.depreciationITAct')[0],
				'Amount cannot be more than the amount entered in Total depreciation in Schedule DPM',
				true);
	}

}

function addAllOptionsDTAA(allSectionArray, rowCount) {
	for (var i = 0; i < rowCount; i++) {
		var srcDesc = document
				.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].itemIncluded')[0];
		var selectedValue = srcDesc.value;
		removeAll(srcDesc);
		for (var k = 0; k < allSectionArray.length; k++) {
			var optn = document.createElement("option");
			optn.text = getSectionTextMap(allSectionArray[k]);
			optn.value = allSectionArray[k];
			srcDesc.options.add(optn);
		}
		srcDesc.value = selectedValue;
	}
}

function setOtherGrossSourceOnChangeDTAA() {

	var status = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	var isDomesticComp = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var tab = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowCount = tab.rows.length - 2;

	var allSectionArray = [ '56i', '56', '562iii', '562x', '5A1ai', '5A1aii',
			'5A1aiia', '5A1aiiaa', '5A1aiiab', '5A1aiiac', '5A1aiii', 'FA',
			'5A1bA', '5AB1a', '5AC1ab', '5AD1i', '5AD1iP', '5BBA', '5BBG',
			'5BBC', '5BBD', '5BBF', '5BB', '5BBDA', 'PTI_5A1ai', 'PTI_5A1aii',
			'PTI_5A1aiia', 'PTI_5A1aiiaa', 'PTI_5A1aiiab', 'PTI_5A1aiiac',
			'PTI_5A1aiii', 'PTI_FA', 'PTI_5A1bA', 'PTI_5AB1a', 'PTI_5AC1ab',
			'PTI_5AD1i', 'PTI_5AD1iP', 'PTI_5BBA', 'PTI_5BBC', 'PTI_5BBG',
			'PTI_5BBD', 'PTI_5BBF', 'PTI_5BBDA' ];

	if (status == 'RES' && isDomesticComp == 'Y') {

		addAllOptionsDTAA(allSectionArray, rowCount);
		var sectionArray = [ '5A1ai', '5A1aii', '5A1aiia', '5A1aiiaa',
				'5A1aiiab', '5A1aiiac', '5A1aiii', 'FA', '5A1bA', '5AB1a',
				'5AC1ab', '5BBA', '5BBDA', 'PTI_5A1ai', 'PTI_5A1aii',
				'PTI_5A1aiia', 'PTI_5A1aiiaa', 'PTI_5A1aiiab', 'PTI_5A1aiiac',
				'PTI_5A1aiii', 'PTI_FA', 'PTI_5A1bA', 'PTI_5AB1a',
				'PTI_5AC1ab', 'PTI_5BBA', 'PTI_5BBDA' ];
		removeSectionOnChangeDTAA(sectionArray, rowCount);
	}
	if (status == 'NRI' && isDomesticComp == 'N') {

		addAllOptionsDTAA(allSectionArray, rowCount);
		var sectionArray = [ '5BBD', '5BBF', '5BBDA', 'PTI_5BBD', 'PTI_5BBF',
				'PTI_5BBDA' ];
		removeSectionOnChangeDTAA(sectionArray, rowCount);
	}
	if (status == 'NRI' && isDomesticComp == 'Y') {

		addAllOptionsDTAA(allSectionArray, rowCount);
		var sectionArray = [ '5BBD', '5BBF', '5BBDA', 'PTI_5BBD', 'PTI_5BBF',
				'PTI_5BBDA' ];
		removeSectionOnChangeDTAA(sectionArray, rowCount);
	}
	if (status == 'RES' && isDomesticComp == 'N') {

		addAllOptionsDTAA(allSectionArray, rowCount);
		var sectionArray = [ '5A1ai', '5A1aii', '5A1aiia', '5A1aiiaa',
				'5A1aiiab', '5A1aiiac', '5A1aiii', 'FA', '5A1bA', '5AB1a',
				'5AC1ab', '5BBA', 'PTI_5A1ai', 'PTI_5A1aii', 'PTI_5A1aiia',
				'PTI_5A1aiiaa', 'PTI_5A1aiiab', 'PTI_5A1aiiac', 'PTI_5A1aiii',
				'PTI_FA', 'PTI_5A1bA', 'PTI_5AB1a', 'PTI_5AC1ab', 'PTI_5BBA' ];
		removeSectionOnChangeDTAA(sectionArray, rowCount);
	}

}

function removeSectionOnChangeDTAA(sectionArray, rowCount) {

	try {
		for (var i = 0; i < rowCount; i++) {

			var selectsLength = document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ i + '].itemIncluded')[0].options.length - 1;

			for (var k = selectsLength; k > 0; k--) {
				if (document
						.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].itemIncluded')[0].options[k] != null
						&& sectionArray
								.indexOf(document
										.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ i + '].itemIncluded')[0].options[k].value) != -1) {

					document
							.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ i + '].itemIncluded')[0].remove(k);

				}
			}
		}
		calcITR6();

	} catch (e) {
		alert('exception in removeSection' + e.stack);
	}
}

function populateMATC() {

	var taxUs115JBCurrAssYr = document
			.getElementsByName('scheduleMATC.taxUs115JBCurrAssYr')[0];
	var taxOthProvCurrAssYr = document
			.getElementsByName('scheduleMATC.taxOthProvCurrAssYr')[0];

	var totTaxRelief = document
			.getElementsByName('partBTTI.computationOfTaxLiability.taxRelief.totTaxRelief')[0];
	var grossTaxLiability = document
			.getElementsByName('partBTTI.computationOfTaxLiability.grossTaxLiability')[0];
	var taxlaib = zeroOrMore(parseInt(coalesce(totTaxRelief.value), 10)
			- parseInt(coalesce(grossTaxLiability.value), 10));

	taxUs115JBCurrAssYr.value = document
			.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnDeemedTI.totalTax')[0].value;

	taxOthProvCurrAssYr.value = document
			.getElementsByName('partBTTI.computationOfTaxLiability.grossTaxLiability')[0].value;

	if (taxUs115JBCurrAssYr.value == '') {
		taxUs115JBCurrAssYr.value = '0';
	}
	if (taxOthProvCurrAssYr.value == '') {
		taxOthProvCurrAssYr.value = '0';
	}

	if (parseInt(coalesce(taxUs115JBCurrAssYr.value), 10) > parseInt(
			coalesce(taxOthProvCurrAssYr.value), 10)) {

		document.getElementsByName('scheduleMATC.mATCredGrossCurAY')[0].value = eval(taxUs115JBCurrAssYr.value)
				- eval(taxOthProvCurrAssYr.value) - coalesce(taxlaib);
		if (parseInt(document
				.getElementsByName('scheduleMATC.mATCredGrossCurAY')[0].value,
				10) < 0) {
			document.getElementsByName('scheduleMATC.mATCredGrossCurAY')[0].value = parseInt(
					'0', 10);
		}

	}

	if (eval(parseInt(coalesce(taxOthProvCurrAssYr.value), 10)) > eval(parseInt(
			coalesce(taxUs115JBCurrAssYr.value), 10))) {

		document.getElementsByName('scheduleMATC.amtOfTaxWithCred')[0].value = eval(parseInt(
				coalesce(taxOthProvCurrAssYr.value), 10))
				- eval(parseInt(coalesce(taxUs115JBCurrAssYr.value), 10));
	} else {
		document.getElementsByName('scheduleMATC.amtOfTaxWithCred')[0].value = parseInt(
				'0', 10);
	}

	if (parseInt(
			document.getElementsByName('scheduleMATC.amtOfTaxWithCred')[0].value,
			10) < 0) {
		document.getElementsByName('scheduleMATC.amtOfTaxWithCred')[0].value = parseInt(
				'0', 10);
	}

	if (document.getElementsByName('scheduleMATC.mATCredGrossCurAY')[0].value > zeroOrMore(eval(parseInt(
			coalesce(taxUs115JBCurrAssYr.value), 10))
			- eval(parseInt(coalesce(taxOthProvCurrAssYr.value), 10)))) {
		addErrorXHTML(
				document.getElementsByName('scheduleMATC.mATCredGrossCurAY')[0],
				' MAT Credit Gross B1(2017-18) should not be greater than point (1-2)',
				true);
		document.getElementsByName('scheduleMATC.mATCredGrossCurAY')[0].value = "0";
	}

}

function validateDedUs54D() {
	var tab = document.getElementById('schduleCGDedD1B');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 2); i++) {

		var date = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
						+ i + '].dateofTransfer')[0].value;

		var cost = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
						+ i + '].costofNewResHouse')[0].value;

		var dateofPurchase = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
						+ i + '].dateofPurchase')[0].value;

		var amtDeposited = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
						+ i + '].amtDeposited')[0].value;

		if (date != '') {
			if (cost != '' && dateofPurchase == '') {
				addErrorXHTML('', 'Please enter the date of purchase.');

				j.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
								+ i + '].dateofPurchase',
						'Please enter the date of purchase.');

				return;
			}
			if (dateofPurchase != '' && cost == '') {
				addErrorXHTML('',
						'Please enter the cost of new residential house.');

				j.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D['
								+ i + '].costofNewResHouse',
						'Please enter the cost of new residential house.');

				return;
			}
			if (dateofPurchase == '' && cost == '' && amtDeposited == '') {
				addErrorXHTML(
						'',
						'Please fill either Cost of purchase/construction & Date of purchase or Amount deposited in Deduction claimed u/s 54D');

				j
						.setFieldError(
								'',
								'Please fill either Cost of purchase/construction & Date of purchase or Amount deposited in Deduction claimed u/s 54D');

				return;
			}
		} else if (date == ''
				&& (cost != '' || dateofPurchase != '' || amtDeposited != '')) {

			j.setFieldError(
					'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54D[' + i
							+ '].dateofTransfer',
					'Please enter Date of acquisition of original asset.');

			return;

		}

	}

}

function validateDedUs54G() {
	var tab = document.getElementById('schduleCGDedD1E');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 2); i++) {

		var date = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
						+ i + '].dateofTransfer')[0].value;

		var cost = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
						+ i + '].costofNewResHouse')[0].value;

		var dateofPurchase = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
						+ i + '].dateofPurchase')[0].value;

		var amtDeposited = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
						+ i + '].amtDeposited')[0].value;

		if (date != '') {
			if (cost != '' && dateofPurchase == '') {
				addErrorXHTML('', 'Please enter the date of purchase.');

				j.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
								+ i + '].dateofPurchase',
						'Please enter the date of purchase.');

				return;
			}
			if (dateofPurchase != '' && cost == '') {
				addErrorXHTML('',
						'Please enter the cost of new residential house.');

				j.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
								+ i + '].costofNewResHouse',
						'Please enter the cost of new residential house.');

				return;
			}
			if (dateofPurchase == '' && cost == '' && amtDeposited == '') {
				addErrorXHTML(
						'',
						'Please fill either Cost and expenses & Date of purchase/construction or Amount deposited in Deduction claimed u/s 54G');

				j
						.setFieldError(
								'',
								'Please fill either Cost and expenses & Date of purchase/construction or Amount deposited in Deduction claimed u/s 54G');

				return;
			}
		} else if (date == ''
				&& (cost != '' || dateofPurchase != '' || amtDeposited != '')) {

			j
					.setFieldError(
							'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54G['
									+ i + '].dateofTransfer',
							'Please enter Date of transfer of original asset from urban area');

			return;

		}
	}

}

function validateDedUs54GA() {
	var tab = document.getElementById('schduleCGDedD1F');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 2); i++) {

		var date = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
						+ i + '].dateofTransfer')[0].value;

		var cost = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
						+ i + '].costofNewResHouse')[0].value;

		var dateofPurchase = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
						+ i + '].dateofPurchase')[0].value;

		var amtDeposited = document
				.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
						+ i + '].amtDeposited')[0].value;

		if (date != '') {
			if (cost != '' && dateofPurchase == '') {
				addErrorXHTML('', 'Please enter the date of purchase.');

				j.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
								+ i + '].dateofPurchase',
						'Please enter the date of purchase.');

				return;
			}
			if (dateofPurchase != '' && cost == '') {
				addErrorXHTML('',
						'Please enter the cost of new residential house.');

				j.setFieldError(
						'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
								+ i + '].costofNewResHouse',
						'Please enter the cost of new residential house.');

				return;
			}
			if (dateofPurchase == '' && cost == '' && amtDeposited == '') {
				addErrorXHTML(
						'',
						'Please fill either Cost and expenses & Date of purchase/construction or Amount deposited in Deduction claimed u/s 54GA');

				j
						.setFieldError(
								'',
								'Please fill either Cost and expenses & Date of purchase/construction or Amount deposited in Deduction claimed u/s 54GA');
				return;
			}
		} else if (date == ''
				&& (cost != '' || dateofPurchase != '' || amtDeposited != '')) {

			j
					.setFieldError(
							'scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54GA['
									+ i + '].dateofTransfer',
							'Please enter Date of transfer of original asset from urban area');

			return;

		}

	}

}

function editableCFLFields() {
	var returnFileSec = document
			.getElementsByName('partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;

	if (returnFileSec == '12' || returnFileSec == '13' || returnFileSec == '20') {
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.hpLossCFTotal')[0].readOnly = false;
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal')[0].readOnly = false;
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal')[0].readOnly = false;
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF')[0].readOnly = false;
	} else {
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.hpLossCFTotal')[0].readOnly = true;
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal')[0].readOnly = true;
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal')[0].readOnly = true;
		document
		.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF')[0].readOnly = true;
	}

}
function enableFieldsForPoint1B(tableId) {

	var tab = document.getElementById(tableId);
	var rows = tab.getElementsByTagName('tr');
	var rowCount = rows.length;

	for (var i = 0; i < rowCount - 4; i++) {
		var selectedOptionId = document
				.getElementsByName('scheduleFA.dtlsForeignCustodialAcc[' + i
						+ '].natureOfAmount')[0];
		if (selectedOptionId != null && selectedOptionId != ''
				&& selectedOptionId.selectedIndex != -1) {
			var selectedOption = selectedOptionId.options[selectedOptionId.selectedIndex].value;
		}
		if (selectedOption == 'I' || selectedOption == 'D'
				|| selectedOption == 'S' || selectedOption == 'O'
				|| selectedOption == 'N') {
			document.getElementsByName('scheduleFA.dtlsForeignCustodialAcc['
					+ i + '].grossAmtPaidCredited')[0].disabled = false;

		} else {
			document.getElementsByName('scheduleFA.dtlsForeignCustodialAcc['
					+ i + '].grossAmtPaidCredited')[0].disabled = true;
			document.getElementsByName('scheduleFA.dtlsForeignCustodialAcc['
					+ i + '].grossAmtPaidCredited')[0].value = '';

		}
	}
}

function calculatedon100Total() {
	var table = document.getElementById('ded100PerWithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtOther')[0];

		document.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
				+ '].eligibleDonationTotal')[0].value = eval(parseInt(coalesce(
				donationAmtCash.value, 10)))
				+ eval(parseInt(coalesce(donationAmtOther.value, 10)));

	}

	calculatedon100TotalCash();
	calculateTotal80G();

}

function calculatedon100TotalCash() {
	var table = document.getElementById('ded100PerWithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtOther')[0];

		sumCash += eval(parseInt(coalesce(donationAmtCash.value, 10)));

		sumOther += eval(parseInt(coalesce(donationAmtOther.value, 10)));
	}

	document
			.getElementsByName('schedule80G.don100Percent.totDon100PercentCash')[0].value = sumCash;
	document
			.getElementsByName('schedule80G.don100Percent.totDon100PercentOtherMode')[0].value = sumOther;

	document.getElementsByName('schedule80G.don100Percent.totDon100Percent')[0].value = eval(parseInt(coalesce(
			sumCash, 10)))
			+ eval(parseInt(coalesce(sumOther, 10)));
}

function calculatedon100Eligible() {
	var table = document.getElementById('ded100PerWithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtOther')[0];

		if (donationAmtCash.value <= 2000) {

			document.getElementsByName('schedule80G.don100Percent.doneeDetail['
					+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtCash.value, 10)))
					+ eval(parseInt(coalesce(donationAmtOther.value, 10)));
		}

		else {
			document.getElementsByName('schedule80G.don100Percent.doneeDetail['
					+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtOther.value, 10)));
		}

	}

	calculateTotEligAmt();

}

function calculateTotEligAmt() {
	var table = document.getElementById('ded100PerWithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumelig = 0;

	for (var i = 0; i < totRow; i++) {

		var eligibleDonationAmt = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].eligibleDonationAmt')[0];

		sumelig += eval(parseInt(coalesce(eligibleDonationAmt.value, 10)));

	}

	document
			.getElementsByName('schedule80G.don100Percent.totEligibleDon100Percent')[0].value = sumelig;

}

function calculatedon50Total() {
	var table = document.getElementById('ded50WithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].eligibleDonationTotal')[0].value = eval(parseInt(coalesce(
				donationAmtCash.value, 10)))
				+ eval(parseInt(coalesce(donationAmtOther.value, 10)));

	}

	calculatedon50TotalCash();

	calculateTotal80G();

}

function calculatedon50TotalCash() {
	var table = document.getElementById('ded50WithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		sumCash += eval(parseInt(coalesce(donationAmtCash.value, 10)));

		sumOther += eval(parseInt(coalesce(donationAmtOther.value, 10)));
	}

	document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totDon50PercentCash')[0].value = sumCash;
	document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.don50PercentOtherMode')[0].value = sumOther;

	document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totDon50PercentNoApprReqd')[0].value = eval(parseInt(coalesce(
			sumCash, 10)))
			+ eval(parseInt(coalesce(sumOther, 10)));
}

function calculatedon50Eligible() {
	var table = document.getElementById('ded50WithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		if (donationAmtCash.value <= 2000) {

			document
					.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
							+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtCash.value, 10)))
					+ eval(parseInt(coalesce(donationAmtOther.value, 10)));
		}

		else {
			document
					.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
							+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtOther.value, 10)));
		}

	}

	calculatedon50TotEligAmt();

}

function calculatedon50TotEligAmt() {
	var table = document.getElementById('ded50WithoutQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumelig = 0;

	for (var i = 0; i < totRow; i++) {

		var eligibleDonationAmt = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].eligibleDonationAmt')[0];

		sumelig += eval(parseInt(coalesce(eligibleDonationAmt.value, 10)));

	}

	document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totEligibleDon50Percent')[0].value = sumelig;

}

function calculatedon100ApprTotal() {
	var table = document.getElementById('ded100Qual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].eligibleDonationTotal')[0].value = eval(parseInt(coalesce(
				donationAmtCash.value, 10)))
				+ eval(parseInt(coalesce(donationAmtOther.value, 10)));

	}

	calculatedon100ApprTotalCash();

	calculateTotal80G();

}

function calculatedon100ApprTotalCash() {
	var table = document.getElementById('ded100Qual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		sumCash += eval(parseInt(coalesce(donationAmtCash.value, 10)));

		sumOther += eval(parseInt(coalesce(donationAmtOther.value, 10)));
	}

	document
			.getElementsByName('schedule80G.totDon100PercentApprReqd.totDon100PercentApprReqdCash')[0].value = sumCash;
	document
			.getElementsByName('schedule80G.totDon100PercentApprReqd.totDon100PercentApprReqdOtherMode')[0].value = sumOther;

	document
			.getElementsByName('schedule80G.don100PercentApprReqd.totDon100PercentApprReqd')[0].value = eval(parseInt(coalesce(
			sumCash, 10)))
			+ eval(parseInt(coalesce(sumOther, 10)));
}

function calculatedon100ApprEligible() {
	var table = document.getElementById('ded100Qual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		if (donationAmtCash.value <= 2000) {

			document
					.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
							+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtCash.value, 10)))
					+ eval(parseInt(coalesce(donationAmtOther.value, 10)));
		}

		else {
			document
					.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
							+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtOther.value, 10)));
		}

	}

	calculatedon100ApprTotEligAmt();

}

function calculatedon100ApprTotEligAmt() {
	var table = document.getElementById('ded100Qual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumelig = 0;

	for (var i = 0; i < totRow; i++) {

		var eligibleDonationAmt = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].eligibleDonationAmt')[0];

		sumelig += eval(parseInt(coalesce(eligibleDonationAmt.value, 10)));

	}

	document
			.getElementsByName('schedule80G.don100PercentApprReqd.totEligibleDon100PercentApprReqd')[0].value = sumelig;

}

function calculatedon50PercentApprTotal() {
	var table = document.getElementById('ded50WithQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].eligibleDonationTotal')[0].value = zeroOrMore(eval(parseInt(coalesce(
				donationAmtCash.value, 10)))
				+ eval(parseInt(coalesce(donationAmtOther.value, 10))));

	}

	calculatedon50PercentApprTotalCash();
	calculateTotal80G();

}

function calculatedon50PercentApprTotalCash() {
	var table = document.getElementById('ded50WithQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		sumCash += eval(parseInt(coalesce(donationAmtCash.value, 10)));

		sumOther += eval(parseInt(coalesce(donationAmtOther.value, 10)));
	}

	document
			.getElementsByName('schedule80G.don50PercentApprReqd.totdon50PercentApprReqdCash')[0].value = sumCash;
	document
			.getElementsByName('schedule80G.don50PercentApprReqd.totdon50PercentApprReqdOtherMode')[0].value = sumOther;

	document
			.getElementsByName('schedule80G.don50PercentApprReqd.totDon50PercentApprReqd')[0].value = eval(parseInt(coalesce(
			sumCash, 10)))
			+ eval(parseInt(coalesce(sumOther, 10)));
}

function calculatedon50PercentApprEligible() {
	var table = document.getElementById('ded50WithQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0];

		if (donationAmtCash.value <= 2000) {

			document
					.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
							+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtCash.value, 10)))
					+ eval(parseInt(coalesce(donationAmtOther.value, 10)));
		}

		else {
			document
					.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
							+ i + '].eligibleDonationAmt')[0].value = eval(parseInt(coalesce(
					donationAmtOther.value, 10)));
		}

	}

	calculatedon50PercentApprTotEligAmt();

}

function calculatedon50PercentApprTotEligAmt() {
	var table = document.getElementById('ded50WithQual');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumelig = 0;

	for (var i = 0; i < totRow; i++) {

		var eligibleDonationAmt = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].eligibleDonationAmt')[0];

		sumelig += zeroOrMore(eval(parseInt(eligibleDonationAmt.value, 10)));

	}

	document
			.getElementsByName('schedule80G.don50PercentApprReqd.totEligibleDon50PercentApprReqd')[0].value = sumelig;

}

function calculateTotal80G() {
	var totDon100Percent = document
			.getElementsByName('schedule80G.don100Percent.totDon100Percent')[0].value;
	var totEligibleDon100Percent = document
			.getElementsByName('schedule80G.don100Percent.totEligibleDon100Percent')[0].value
	var totDon50PercentNoApprReqd = document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totDon50PercentNoApprReqd')[0].value;
	var totEligibleDon50Percent = document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totEligibleDon50Percent')[0].value
	var totDon100PercentApprReqd = document
			.getElementsByName('schedule80G.don100PercentApprReqd.totDon100PercentApprReqd')[0].value;
	var totEligibleDon100PercentApprReqd = document
			.getElementsByName('schedule80G.don100PercentApprReqd.totEligibleDon100PercentApprReqd')[0].value
	var totDon50PercentApprReqd = document
			.getElementsByName('schedule80G.don50PercentApprReqd.totDon50PercentApprReqd')[0].value;
	var totEligibleDon50PercentApprReqd = document
			.getElementsByName('schedule80G.don50PercentApprReqd.totEligibleDon50PercentApprReqd')[0].value

	var totDon100PercentCash = document
			.getElementsByName('schedule80G.don100Percent.totDon100PercentCash')[0].value
	var totDon50PercentCash = document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.totDon50PercentCash')[0].value
	var totDon100PercentApprReqdCash = document
			.getElementsByName('schedule80G.totDon100PercentApprReqd.totDon100PercentApprReqdCash')[0].value
	var totdon50PercentApprReqdCash = document
			.getElementsByName('schedule80G.don50PercentApprReqd.totdon50PercentApprReqdCash')[0].value

	var totDon100PercentOtherMode = document
			.getElementsByName('schedule80G.don100Percent.totDon100PercentOtherMode')[0].value
	var don50PercentOtherMode = document
			.getElementsByName('schedule80G.don50PercentNoApprReqd.don50PercentOtherMode')[0].value
	var totDon100PercentApprReqdOtherMode = document
			.getElementsByName('schedule80G.totDon100PercentApprReqd.totDon100PercentApprReqdOtherMode')[0].value
	var totdon50PercentApprReqdOtherMode = document
			.getElementsByName('schedule80G.don50PercentApprReqd.totdon50PercentApprReqdOtherMode')[0].value

	document.getElementsByName('schedule80G.totalDonationsUs80GCash')[0].value = zeroOrMore(eval(parseInt(coalesce(
			totDon100PercentCash, 10)))
			+ eval(parseInt(coalesce(totDon50PercentCash, 10)))
			+ eval(parseInt(coalesce(totDon100PercentApprReqdCash, 10)))
			+ eval(parseInt(coalesce(totdon50PercentApprReqdCash, 10))));

	document.getElementsByName('schedule80G.totalDonationsUs80GOtherMode')[0].value = zeroOrMore(eval(parseInt(coalesce(
			totDon100PercentOtherMode, 10)))
			+ eval(parseInt(coalesce(don50PercentOtherMode, 10)))
			+ eval(parseInt(coalesce(totDon100PercentApprReqdOtherMode, 10)))
			+ eval(parseInt(coalesce(totdon50PercentApprReqdOtherMode, 10))));

	document.getElementsByName('schedule80G.totalDonationsUs80G')[0].value = zeroOrMore(eval(parseInt(coalesce(
			totDon100Percent, 10)))
			+ eval(parseInt(coalesce(totDon50PercentNoApprReqd, 10)))
			+ eval(parseInt(coalesce(totDon100PercentApprReqd, 10)))
			+ eval(parseInt(coalesce(totDon50PercentApprReqd, 10))));

	document.getElementsByName('schedule80G.totalEligibleDonationsUs80G')[0].value = zeroOrMore(eval(parseInt(coalesce(
			totEligibleDon100Percent, 10)))
			+ eval(parseInt(coalesce(totEligibleDon50Percent, 10)))
			+ eval(parseInt(coalesce(totEligibleDon100PercentApprReqd, 10)))
			+ eval(parseInt(coalesce(totEligibleDon50PercentApprReqd, 10))));

}

function validateOsBbdaLottery() {

	var taxon15BDA0 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6'),
			10)));
	var taxon15BDA1 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/9'),
			10)
			+ parseInt(taxon15BDA0, 10)));
	var taxon15BDA2 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/12'),
			10)
			+ parseInt(taxon15BDA1, 10)));
	var taxon15BDA3 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/3'),
			10)
			+ parseInt(taxon15BDA2, 10)));
	var taxon15BDA4 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto31/3'),
			10)));

	var totalBBDAtax = eval(parseInt(taxon15BDA3, 10)
			+ parseInt(taxon15BDA4, 10));

	var taxonLottery0 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6'),
			10)));
	var taxonLottery1 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/9'),
			10)
			+ parseInt(taxonLottery0, 10)));
	var taxonLottery2 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/12'),
			10)
			+ parseInt(taxonLottery1, 10)));
	var taxonLottery3 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/3'),
			10)
			+ parseInt(taxonLottery2, 10)));
	var taxonLottery4 = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto31/3'),
			10)));

	var totalLotteryTax = eval(parseInt(taxonLottery3, 10)
			+ parseInt(taxonLottery4, 10));

	var BBDA = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incChargblSplRateOS.dividendIncome115BBDA'),
			10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incChargblSplRateOS.dividendIncome115BBDA_PTI'),
					10)));

	var Res = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var company = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	if (Res == "RES" && company == "N") {
		if (BBDA < totalBBDAtax || BBDA > totalBBDAtax) {
			addErrorXHTML(
					document
							.getElementsByName('scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6')[0],
					'The total of all the quarter of Dividend Income u/s 115BBDA must be equal to  (2d(xv) + 115BBDA dropdown of 2e-DTAA 115BBDA - DTAA 115BBDA PTI) of Schedule OS',
					true);
			j
					.setFieldError(
							'scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6',
							'The total of all the quarter of Dividend Income u/s 115BBDA must be equal to  (2d(xv) + 115BBDA dropdown of 2e-DTAA 115BBDA - DTAA 115BBDA PTI) of Schedule OS');
		}
	}

	var lottery = zeroOrMore(eval(parseInt(
			coalesceSetRet('scheduleOS.incChargblSplRateOS.winningFrmLotteries'),
			10)
			+ parseInt(
					coalesceSetRet('scheduleOS.incChargblSplRateOS.winningFrmLotteries_PTI'),
					10)));

	if (lottery < totalLotteryTax || lottery > totalLotteryTax) {
		addErrorXHTML(
				document
						.getElementsByName('scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6')[0],
				'Income from Lottery must be equal to 2a of Schedule OS-DTAA 115BB respectively.',
				true);
		j
				.setFieldError(
						'scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6',
						"Income from Lottery must be equal to 2a of Schedule OS-DTAA 115BB respectively.");
	}

}

function validate80GTableAForCashAndOtherMode() {
	var tab = document.getElementById('ded100PerWithoutQual');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 4); i++) {
		var doneeName = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].doneeName')[0].value;

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtCash')[0].value;

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100Percent.doneeDetail[' + i
						+ '].donationAmtOther')[0].value;

		if (doneeName != '') {
			if (donationAmtCash == '' && donationAmtOther == '') {
				addErrorXHTML(
						'',
						'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table A');

				j
						.setFieldError(
								'',
								'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table A ');

				return;
			}

		}
	}
}
function validate80GTableBForCashAndOtherMode() {
	var tab = document.getElementById('ded50WithoutQual');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 4); i++) {
		var doneeName = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].doneeName')[0].value;

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0].value;

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentNoApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0].value;

		if (doneeName != '') {
			if (donationAmtCash == '' && donationAmtOther == '') {
				addErrorXHTML(
						'',
						'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table B');

				j
						.setFieldError(
								'',
								'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table B ');

				return;
			}

		}
	}
}
function validate80GTableCForCashAndOtherMode() {
	var tab = document.getElementById('ded100Qual');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 4); i++) {
		var doneeName = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].doneeName')[0].value;

		var donationAmtCash = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0].value;

		var donationAmtOther = document
				.getElementsByName('schedule80G.don100PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0].value;

		if (doneeName != '') {
			if (donationAmtCash == '' && donationAmtOther == '') {
				addErrorXHTML(
						'',
						'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table C');

				j
						.setFieldError(
								'',
								'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table C ');

				return;
			}

		}
	}
}
function validate80GTableDForCashAndOtherMode() {
	var tab = document.getElementById('ded50WithQual');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 4); i++) {
		var doneeName = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].doneeName')[0].value;

		var donationAmtCash = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtCash')[0].value;

		var donationAmtOther = document
				.getElementsByName('schedule80G.don50PercentApprReqd.doneeDetail['
						+ i + '].donationAmtOther')[0].value;

		if (doneeName != '') {
			if (donationAmtCash == '' && donationAmtOther == '') {
				addErrorXHTML(
						'',
						'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table D');

				j
						.setFieldError(
								'',
								'Enter the amount of donation either in field Donation in cash or Donation in other mode in Table D ');

				return;
			}

		}
	}
}

function calcTotSchEIDTAA() {
	var amtTotal = parseInt('0', 10);
	var tabl = document.getElementById('incomeDTAAEITable');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amountOfIncome$")) {
			amtTotal = eval(parseInt(amtTotal, 10)
					+ parseInt(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('scheduleEI.incChrgblAsPerDTAA')[0].value = amtTotal;
}

/* Manufacturing */

function calcManufacTotalA() {
	var openingStockRawMaterial = document
			.getElementsByName('partama.openingInventory.openingStockRawMaterial')[0].value;
	var openingStockWip = document
			.getElementsByName('partama.openingInventory.openingStockWip')[0].value;

	document
			.getElementsByName('partama.openingInventory.openingStocktotalAiii')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockRawMaterial, 10)))
			+ eval(parseInt(coalesce(openingStockWip, 10))));

	calculateOpeningStkTotal();

}

function calcManufacTotalD() {
	var openingStockcarInward = document
			.getElementsByName('partama.openingInventory.openingStockcarInward')[0].value;
	var openingStockpowerandfuel = document
			.getElementsByName('partama.openingInventory.openingStockpowerandfuel')[0].value;
	var openingStockOtherDirectExpenses = document
			.getElementsByName('partama.openingInventory.openingStockOtherDirectExpenses')[0].value;

	document
			.getElementsByName('partama.openingInventory.openingStockdirectExpenses')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockcarInward, 10)))
			+ eval(parseInt(coalesce(openingStockpowerandfuel, 10)))
			+ eval(parseInt(coalesce(openingStockOtherDirectExpenses, 10))));

	calculateOpeningStkTotal();

}

function calcManufacTotalE() {
	var openingStockindirectWages = document
			.getElementsByName('partama.openingInventory.openingStockindirectWages')[0].value;
	var openingStockfactoryRentandRates = document
			.getElementsByName('partama.openingInventory.openingStockfactoryRentandRates')[0].value;
	var openingStockFactoryInsurance = document
			.getElementsByName('partama.openingInventory.openingStockFactoryInsurance')[0].value;
	var openingStockfactoryFuelPower = document
			.getElementsByName('partama.openingInventory.openingStockfactoryFuelPower')[0].value;
	var openingStockfactoryGeneral = document
			.getElementsByName('partama.openingInventory.openingStockfactoryGeneral')[0].value;
	var openingStockdepOffactory = document
			.getElementsByName('partama.openingInventory.openingStockdepOffactory')[0].value;

	document.getElementsByName('partama.openingInventory.openingStocktotalE')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockindirectWages, 10)))
			+ eval(parseInt(coalesce(openingStockfactoryRentandRates, 10)))
			+ eval(parseInt(coalesce(openingStockFactoryInsurance, 10)))
			+ eval(parseInt(coalesce(openingStockfactoryFuelPower, 10)))
			+ eval(parseInt(coalesce(openingStockfactoryGeneral, 10)))
			+ eval(parseInt(coalesce(openingStockdepOffactory, 10))));

	calculateOpeningStkTotal();

}

function calculateOpeningStkTotal() {
	var openingStocktotalAiii = document
			.getElementsByName('partama.openingInventory.openingStocktotalAiii')[0].value;
	var openingStockPurchase = document
			.getElementsByName('partama.openingInventory.openingStockPurchase')[0].value;
	var openingStockdirectWages = document
			.getElementsByName('partama.openingInventory.openingStockdirectWages')[0].value;
	var openingStockdirectExpenses = document
			.getElementsByName('partama.openingInventory.openingStockdirectExpenses')[0].value;
	var openingStocktotalE = document
			.getElementsByName('partama.openingInventory.openingStocktotalE')[0].value;

	document.getElementsByName('partama.openingInventory.openingStocktotalF')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStocktotalAiii, 10)))
			+ eval(parseInt(coalesce(openingStockPurchase, 10)))
			+ eval(parseInt(coalesce(openingStockdirectWages, 10)))
			+ eval(parseInt(coalesce(openingStockdirectExpenses, 10)))
			+ eval(parseInt(coalesce(openingStocktotalE, 10))));

	calcManufacturingTotal();

}

function calcClosingStockTotal() {

	var rawMaterial = document
			.getElementsByName('partama.closingStock.rawMaterial')[0].value;
	var WorkinProgress = document
			.getElementsByName('partama.closingStock.WorkinProgress')[0].value;

	document.getElementsByName('partama.closingStock.totalOf2')[0].value = zeroOrMore(eval(parseInt(coalesce(
			rawMaterial, 10)))
			+ eval(parseInt(coalesce(WorkinProgress, 10))));

	calcManufacturingTotal();

}

function calcManufacturingTotal() {

	var openingStocktotalF = document
			.getElementsByName('partama.openingInventory.openingStocktotalF')[0].value;
	var totalOf2 = document.getElementsByName('partama.closingStock.totalOf2')[0].value;

	document.getElementsByName('partama.closingStock.total1and2')[0].value = eval(parseInt(coalesce(
			openingStocktotalF, 10)))
			- eval(parseInt(coalesce(totalOf2, 10)));

	document.getElementsByName('partatr.revFromOperations.costOfGoodsFromMnf')[0].value = document
			.getElementsByName('partama.closingStock.total1and2')[0].value;

	calculateManTrading();
}

function calcTotSchTradingRev() {
	var amtTotal = parseInt('0', 10);
	var tabl = document.getElementById('otherOperatingRevenue');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal, 10)
					+ parseInt(isNVL(allInputTags[i].value), 10));
		}
	}

	document
			.getElementsByName('partatr.revFromOperations.otherOperatingRevTotal')[0].value = amtTotal;
	calcTradingTotalA();
}

function calcTotSchTradingExp() {
	var amtTotal = parseInt('0', 10);
	var tabl = document.getElementById('otherDirectExpenses');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal, 10)
					+ parseInt(isNVL(allInputTags[i].value), 10));
		}
	}

	document
			.getElementsByName('partatr.revFromOperations.otherDirectExpencesTotal')[0].value = amtTotal;
	calcTradingTotal9();
}

function calcTradingTotalA() {
	var openingStockRawMaterial = document
			.getElementsByName('partatr.revFromOperations.openingStockRawMaterial')[0].value;
	var openingStockWip = document
			.getElementsByName('partatr.revFromOperations.openingStockWip')[0].value;
	var otherOperatingRevTotal = document
			.getElementsByName('partatr.revFromOperations.otherOperatingRevTotal')[0].value;

	document.getElementsByName('partatr.revFromOperations.openingStocktotalA')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockRawMaterial, 10)))
			+ eval(parseInt(coalesce(openingStockWip, 10)))
			+ eval(parseInt(coalesce(otherOperatingRevTotal, 10))));

	calcTradingTotalD();
	calcTradingTotal9();
}

function calculateTradingC() {

	var unionExciseDuty = document
			.getElementsByName('partatr.revFromOperations.unionExciseDuty')[0].value;
	var serviceTax = document
			.getElementsByName('partatr.revFromOperations.serviceTax')[0].value;
	var vatSalesTax = document
			.getElementsByName('partatr.revFromOperations.vatSalesTax')[0].value;
	var centralGoodsServiceTax = document
			.getElementsByName('partatr.revFromOperations.centralGoodsServiceTax')[0].value;
	var stateGoodsServiceTax = document
			.getElementsByName('partatr.revFromOperations.stateGoodsServiceTax')[0].value;
	var inteGoodsServiceTax = document
			.getElementsByName('partatr.revFromOperations.inteGoodsServiceTax')[0].value;
	var unionGoodsServiceTax = document
			.getElementsByName('partatr.revFromOperations.unionGoodsServiceTax')[0].value;
	var otherGoodsServiceTax = document
			.getElementsByName('partatr.revFromOperations.otherGoodsServiceTax')[0].value;

	document
			.getElementsByName('partatr.revFromOperations.totalGoodsServiceTax')[0].value = zeroOrMore(eval(parseInt(coalesce(
			unionExciseDuty, 10)))
			+ eval(parseInt(coalesce(serviceTax, 10)))
			+ eval(parseInt(coalesce(vatSalesTax, 10)))
			+ eval(parseInt(coalesce(centralGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(stateGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(inteGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(unionGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(otherGoodsServiceTax, 10))));

	calcTradingTotalD();
}

function calcTradingTotalD() {

	var openingStocktotalA = document
			.getElementsByName('partatr.revFromOperations.openingStocktotalA')[0].value;
	var grossReceiptsfromPro = document
			.getElementsByName('partatr.revFromOperations.grossReceiptsfromPro')[0].value;
	var totalGoodsServiceTax = document
			.getElementsByName('partatr.revFromOperations.totalGoodsServiceTax')[0].value;

	document
			.getElementsByName('partatr.revFromOperations.totalRevFormOperations')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStocktotalA, 10)))
			+ eval(parseInt(coalesce(grossReceiptsfromPro, 10)))
			+ eval(parseInt(coalesce(totalGoodsServiceTax, 10))));

	calcTradingTotal6();

}

function calcTradingTotal6() {

	var totalRevFormOperations = document
			.getElementsByName('partatr.revFromOperations.totalRevFormOperations')[0].value;
	var closingStock = document
			.getElementsByName('partatr.revFromOperations.closingStock')[0].value;

	document
			.getElementsByName('partatr.revFromOperations.totalCreditsTradingAcc')[0].value = zeroOrMore(eval(parseInt(coalesce(
			totalRevFormOperations, 10)))
			+ eval(parseInt(coalesce(closingStock, 10))));

	calculateManTrading();

}

function calcTradingTotal9() {
	var carriageInward = document
			.getElementsByName('partatr.revFromOperations.carriageInward')[0].value;
	var powerAndFuel = document
			.getElementsByName('partatr.revFromOperations.powerAndFuel')[0].value;
	var otherDirectExpencesTotal = document
			.getElementsByName('partatr.revFromOperations.otherDirectExpencesTotal')[0].value;

	document.getElementsByName('partatr.revFromOperations.directExpenses')[0].value = zeroOrMore(eval(parseInt(coalesce(
			carriageInward, 10)))
			+ eval(parseInt(coalesce(powerAndFuel, 10)))
			+ eval(parseInt(coalesce(otherDirectExpencesTotal, 10))));

	calculateManTrading();
}

function calcTradingTotal10() {

	var sl10customDuty = document
			.getElementsByName('partatr.revFromOperations.sl10customDuty')[0].value;
	var sl10counterveilingDuty = document
			.getElementsByName('partatr.revFromOperations.sl10counterveilingDuty')[0].value;
	var sl10SplAddnDuty = document
			.getElementsByName('partatr.revFromOperations.sl10SplAddnDuty')[0].value;
	var sl10unionExciseDuty = document
			.getElementsByName('partatr.revFromOperations.sl10unionExciseDuty')[0].value;
	var sl10ServiceTax = document
			.getElementsByName('partatr.revFromOperations.sl10ServiceTax')[0].value;
	var sl10VATSales = document
			.getElementsByName('partatr.revFromOperations.sl10VATSales')[0].value;
	var sl10CentralTax = document
			.getElementsByName('partatr.revFromOperations.sl10CentralTax')[0].value;
	var sl10StateTax = document
			.getElementsByName('partatr.revFromOperations.sl10StateTax')[0].value;
	var sl10intTax = document
			.getElementsByName('partatr.revFromOperations.sl10intTax')[0].value;
	var sl10unionTax = document
			.getElementsByName('partatr.revFromOperations.sl10unionTax')[0].value;
	var sl10otherTax = document
			.getElementsByName('partatr.revFromOperations.sl10otherTax')[0].value;

	document.getElementsByName('partatr.revFromOperations.sl10Total')[0].value = zeroOrMore(eval(parseInt(coalesce(
			sl10customDuty, 10)))
			+ eval(parseInt(coalesce(sl10counterveilingDuty, 10)))
			+ eval(parseInt(coalesce(sl10unionExciseDuty, 10)))
			+ eval(parseInt(coalesce(sl10ServiceTax, 10)))
			+ eval(parseInt(coalesce(sl10VATSales, 10)))
			+ eval(parseInt(coalesce(sl10CentralTax, 10)))
			+ eval(parseInt(coalesce(sl10StateTax, 10)))
			+ eval(parseInt(coalesce(sl10intTax, 10)))
			+ eval(parseInt(coalesce(sl10unionTax, 10)))
			+ eval(parseInt(coalesce(sl10otherTax, 10)))
			+ eval(parseInt(coalesce(sl10SplAddnDuty, 10))));
	calculateManTrading();

}

function calculateManTrading() {
	var totalCreditsTradingAcc = document
			.getElementsByName('partatr.revFromOperations.totalCreditsTradingAcc')[0].value;
	var openingStockFinishedGoods = document
			.getElementsByName('partatr.revFromOperations.openingStockFinishedGoods')[0].value;
	var purchases = document
			.getElementsByName('partatr.revFromOperations.purchases')[0].value;
	var directExpenses = document
			.getElementsByName('partatr.revFromOperations.directExpenses')[0].value;
	var sl10Total = document
			.getElementsByName('partatr.revFromOperations.sl10Total')[0].value;
	var costOfGoodsFromMnf = document
			.getElementsByName('partatr.revFromOperations.costOfGoodsFromMnf')[0].value;

	document
			.getElementsByName('partatr.revFromOperations.totalofMnfandTrading')[0].value = eval(parseInt(coalesce(
			totalCreditsTradingAcc, 10)))
			- eval(parseInt(coalesce(openingStockFinishedGoods, 10)))
			- eval(parseInt(coalesce(purchases, 10)))
			- eval(parseInt(coalesce(directExpenses, 10)))
			- eval(parseInt(coalesce(sl10Total, 10)))
			- eval(parseInt(coalesce(costOfGoodsFromMnf, 10)));

	document.getElementsByName('partapl.creditsToPL.grossPLTrading')[0].value = eval(parseInt(coalesceSetRet('partatr.revFromOperations.totalofMnfandTrading'),10))+eval(parseInt(coalesceSetRet('partatr.revFromOperations.incomIntraday'),10));

}

/* Manufacturing INDAS */

function calcManufacTotalAIndAs() {
	var openingStockRawMaterial = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockRawMaterial')[0].value;
	var openingStockWip = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockWip')[0].value;

	document
			.getElementsByName('partamaIndAs.openingInventory.openingStocktotalAiii')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockRawMaterial, 10)))
			+ eval(parseInt(coalesce(openingStockWip, 10))));

	calculateOpeningStkTotalIndAs();

}

function calcManufacTotalDIndAs() {
	var openingStockcarInward = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockcarInward')[0].value;
	var openingStockpowerandfuel = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockpowerandfuel')[0].value;
	var openingStockOtherDirectExpenses = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockOtherDirectExpenses')[0].value;

	document
			.getElementsByName('partamaIndAs.openingInventory.openingStockdirectExpenses')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockcarInward, 10)))
			+ eval(parseInt(coalesce(openingStockpowerandfuel, 10)))
			+ eval(parseInt(coalesce(openingStockOtherDirectExpenses, 10))));

	calculateOpeningStkTotalIndAs();

}

function calcManufacTotalEIndAs() {
	var openingStockindirectWages = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockindirectWages')[0].value;
	var openingStockfactoryRentandRates = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockfactoryRentandRates')[0].value;
	var openingStockFactoryInsurance = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockFactoryInsurance')[0].value;
	var openingStockfactoryFuelPower = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockfactoryFuelPower')[0].value;
	var openingStockfactoryGeneral = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockfactoryGeneral')[0].value;
	var openingStockdepOffactory = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockdepOffactory')[0].value;

	document
			.getElementsByName('partamaIndAs.openingInventory.openingStocktotalE')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockindirectWages, 10)))
			+ eval(parseInt(coalesce(openingStockfactoryRentandRates, 10)))
			+ eval(parseInt(coalesce(openingStockFactoryInsurance, 10)))
			+ eval(parseInt(coalesce(openingStockfactoryFuelPower, 10)))
			+ eval(parseInt(coalesce(openingStockfactoryGeneral, 10)))
			+ eval(parseInt(coalesce(openingStockdepOffactory, 10))));

	calculateOpeningStkTotalIndAs();

}

function calculateOpeningStkTotalIndAs() {

	var openingStocktotalAiii = document
			.getElementsByName('partamaIndAs.openingInventory.openingStocktotalAiii')[0].value;
	var openingStockPurchase = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockPurchase')[0].value;
	var openingStockdirectWages = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockdirectWages')[0].value;
	var openingStockdirectExpenses = document
			.getElementsByName('partamaIndAs.openingInventory.openingStockdirectExpenses')[0].value;
	var openingStocktotalE = document
			.getElementsByName('partamaIndAs.openingInventory.openingStocktotalE')[0].value;

	document
			.getElementsByName('partamaIndAs.openingInventory.openingStocktotalF')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStocktotalAiii, 10)))
			+ eval(parseInt(coalesce(openingStockPurchase, 10)))
			+ eval(parseInt(coalesce(openingStockdirectWages, 10)))
			+ eval(parseInt(coalesce(openingStockdirectExpenses, 10)))
			+ eval(parseInt(coalesce(openingStocktotalE, 10))));

	calcManufacturingTotalIndAs();

}

function calcClosingStockTotalIndAs() {

	var rawMaterial = document
			.getElementsByName('partamaIndAs.closingStock.rawMaterial')[0].value;
	var WorkinProgress = document
			.getElementsByName('partamaIndAs.closingStock.WorkinProgress')[0].value;

	document.getElementsByName('partamaIndAs.closingStock.totalOf2')[0].value = zeroOrMore(eval(parseInt(coalesce(
			rawMaterial, 10)))
			+ eval(parseInt(coalesce(WorkinProgress, 10))));

	calcManufacturingTotalIndAs();

}

function calcManufacturingTotalIndAs() {

	var openingStocktotalF = document
			.getElementsByName('partamaIndAs.openingInventory.openingStocktotalF')[0].value;
	var totalOf2 = document
			.getElementsByName('partamaIndAs.closingStock.totalOf2')[0].value;

	document.getElementsByName('partamaIndAs.closingStock.total1and2')[0].value = eval(parseInt(coalesce(
			openingStocktotalF, 10)))
			- eval(parseInt(coalesce(totalOf2, 10)));

	document
			.getElementsByName('partatrIndAs.revFromOperations.costOfGoodsFromMnf')[0].value = document
			.getElementsByName('partamaIndAs.closingStock.total1and2')[0].value;

	calculateManTradingIndAs();
}

function calcTotSchTradingRevIndAs() {
	var amtTotal = parseInt('0', 10);
	var tabl = document.getElementById('otherOperatingRevenueIndAs');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal, 10)
					+ parseInt(isNVL(allInputTags[i].value), 10));
		}
	}

	document
			.getElementsByName('partatrIndAs.revFromOperations.otherOperatingRevTotal')[0].value = amtTotal;
	calcTradingTotalAIndAs();
}

function calcTotSchTradingExpIndAs() {
	var amtTotal = parseInt('0', 10);
	var tabl = document.getElementById('otherDirectExpensesIndAs');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal, 10)
					+ parseInt(isNVL(allInputTags[i].value), 10));
		}
	}

	document
			.getElementsByName('partatrIndAs.revFromOperations.otherDirectExpencesTotal')[0].value = amtTotal;
	calcTradingTotal9IndAs();
}

function calcTradingTotalAIndAs() {

	var openingStockRawMaterial = document
			.getElementsByName('partatrIndAs.revFromOperations.openingStockRawMaterial')[0].value;
	var openingStockWip = document
			.getElementsByName('partatrIndAs.revFromOperations.openingStockWip')[0].value;
	var otherOperatingRevTotal = document
			.getElementsByName('partatrIndAs.revFromOperations.otherOperatingRevTotal')[0].value;

	document
			.getElementsByName('partatrIndAs.revFromOperations.openingStocktotalA')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStockRawMaterial, 10)))
			+ eval(parseInt(coalesce(openingStockWip, 10)))
			+ eval(parseInt(coalesce(otherOperatingRevTotal, 10))));

	calcTradingTotalDIndAs();

}

function calculateTradingCIndAs() {

	var unionExciseDuty = document
			.getElementsByName('partatrIndAs.revFromOperations.unionExciseDuty')[0].value;
	var serviceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.serviceTax')[0].value;
	var vatSalesTax = document
			.getElementsByName('partatrIndAs.revFromOperations.vatSalesTax')[0].value;
	var centralGoodsServiceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.centralGoodsServiceTax')[0].value;
	var stateGoodsServiceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.stateGoodsServiceTax')[0].value;
	var inteGoodsServiceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.inteGoodsServiceTax')[0].value;
	var unionGoodsServiceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.unionGoodsServiceTax')[0].value;
	var otherGoodsServiceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.otherGoodsServiceTax')[0].value;

	document
			.getElementsByName('partatrIndAs.revFromOperations.totalGoodsServiceTax')[0].value = zeroOrMore(eval(parseInt(coalesce(
			unionExciseDuty, 10)))
			+ eval(parseInt(coalesce(serviceTax, 10)))
			+ eval(parseInt(coalesce(vatSalesTax, 10)))
			+ eval(parseInt(coalesce(centralGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(stateGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(inteGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(unionGoodsServiceTax, 10)))
			+ eval(parseInt(coalesce(otherGoodsServiceTax, 10))));

	calcTradingTotalDIndAs();
}

function calcTradingTotalDIndAs() {

	var openingStocktotalA = document
			.getElementsByName('partatrIndAs.revFromOperations.openingStocktotalA')[0].value;
	var grossReceiptsfromPro = document
			.getElementsByName('partatrIndAs.revFromOperations.grossReceiptsfromPro')[0].value;
	var totalGoodsServiceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.totalGoodsServiceTax')[0].value;

	document
			.getElementsByName('partatrIndAs.revFromOperations.totalRevFormOperations')[0].value = zeroOrMore(eval(parseInt(coalesce(
			openingStocktotalA, 10)))
			+ eval(parseInt(coalesce(grossReceiptsfromPro, 10)))
			+ eval(parseInt(coalesce(totalGoodsServiceTax, 10))));

	calcTradingTotal6IndAs();

}

function calcTradingTotal6IndAs() {

	var totalRevFormOperations = document
			.getElementsByName('partatrIndAs.revFromOperations.totalRevFormOperations')[0].value;
	var closingStock = document
			.getElementsByName('partatrIndAs.revFromOperations.closingStock')[0].value;

	document
			.getElementsByName('partatrIndAs.revFromOperations.totalCreditsTradingAcc')[0].value = zeroOrMore(eval(parseInt(coalesce(
			totalRevFormOperations, 10)))
			+ eval(parseInt(coalesce(closingStock, 10))));

	calculateManTradingIndAs();

}

function calcTradingTotal9IndAs() {

	var carriageInward = document
			.getElementsByName('partatrIndAs.revFromOperations.carriageInward')[0].value;
	var powerAndFuel = document
			.getElementsByName('partatrIndAs.revFromOperations.powerAndFuel')[0].value;
	var otherDirectExpencesTotal = document
			.getElementsByName('partatrIndAs.revFromOperations.otherDirectExpencesTotal')[0].value;

	document.getElementsByName('partatrIndAs.revFromOperations.directExpenses')[0].value = zeroOrMore(eval(parseInt(coalesce(
			carriageInward, 10)))
			+ eval(parseInt(coalesce(powerAndFuel, 10)))
			+ eval(parseInt(coalesce(otherDirectExpencesTotal, 10))));

	calculateManTradingIndAs();
}

function calcTradingTotal10IndAs() {

	var sl10customDuty = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10customDuty')[0].value;
	var sl10counterveilingDuty = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10counterveilingDuty')[0].value;
	var sl10SplAddnDuty = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10SplAddnDuty')[0].value;
	var sl10unionExciseDuty = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10unionExciseDuty')[0].value;
	var sl10ServiceTax = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10ServiceTax')[0].value;
	var sl10VATSales = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10VATSales')[0].value;
	var sl10CentralTax = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10CentralTax')[0].value;
	var sl10StateTax = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10StateTax')[0].value;
	var sl10intTax = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10intTax')[0].value;
	var sl10unionTax = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10unionTax')[0].value;
	var sl10otherTax = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10otherTax')[0].value;

	document.getElementsByName('partatrIndAs.revFromOperations.sl10Total')[0].value = zeroOrMore(eval(parseInt(coalesce(
			sl10customDuty, 10)))
			+ eval(parseInt(coalesce(sl10counterveilingDuty, 10)))
			+ eval(parseInt(coalesce(sl10unionExciseDuty, 10)))
			+ eval(parseInt(coalesce(sl10ServiceTax, 10)))
			+ eval(parseInt(coalesce(sl10VATSales, 10)))
			+ eval(parseInt(coalesce(sl10CentralTax, 10)))
			+ eval(parseInt(coalesce(sl10StateTax, 10)))
			+ eval(parseInt(coalesce(sl10intTax, 10)))
			+ eval(parseInt(coalesce(sl10unionTax, 10)))
			+ eval(parseInt(coalesce(sl10otherTax, 10)))
			+ eval(parseInt(coalesce(sl10SplAddnDuty, 10))));
	calculateManTrading();

}

function calculateManTradingIndAs() {
	var totalCreditsTradingAcc = document
			.getElementsByName('partatrIndAs.revFromOperations.totalCreditsTradingAcc')[0].value;
	var openingStockFinishedGoods = document
			.getElementsByName('partatrIndAs.revFromOperations.openingStockFinishedGoods')[0].value;
	var purchases = document
			.getElementsByName('partatrIndAs.revFromOperations.purchases')[0].value;
	var directExpenses = document
			.getElementsByName('partatrIndAs.revFromOperations.directExpenses')[0].value;
	var sl10Total = document
			.getElementsByName('partatrIndAs.revFromOperations.sl10Total')[0].value;
	var costOfGoodsFromMnf = document
			.getElementsByName('partatrIndAs.revFromOperations.costOfGoodsFromMnf')[0].value;

	document
			.getElementsByName('partatrIndAs.revFromOperations.totalofMnfandTrading')[0].value = eval(parseInt(coalesce(
			totalCreditsTradingAcc, 10)))
			- eval(parseInt(coalesce(openingStockFinishedGoods, 10)))
			- eval(parseInt(coalesce(purchases, 10)))
			- eval(parseInt(coalesce(directExpenses, 10)))
			- eval(parseInt(coalesce(sl10Total, 10)))
			- eval(parseInt(coalesce(costOfGoodsFromMnf, 10)));

}

function validate80GGA() {
	var table = document.getElementById('schedule80GGA');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInOtherMode')[0];
		if (document.getElementsByName('schedule80GGA.scientificResearch[' + i
				+ '].panOfDonee')[0].value != '') {
			if (donationAmtCash.value == '' && donationAmtOther.value == '') {
				j
						.setFieldError(
								'',
								'Enter the amount of donation either in field Donation in cash or Donation in other mode');
				addErrorXHTML(
						document.getElementsByName('')[0],
						'Enter the amount of donation either in field Donation in cash or Donation in other mode',
						true);

			}
		}

	}

}

function calculatedon80GGA() {
	var table = document.getElementById('schedule80GGA');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInOtherMode')[0];

		document.getElementsByName('schedule80GGA.scientificResearch[' + i
				+ '].totalDonation')[0].value = eval(parseInt(coalesce(
				donationAmtCash.value, 10)))
				+ eval(parseInt(coalesce(donationAmtOther.value, 10)));

	}

	calculatedon80GGATotalCash();

}

function calculatedon80GGATotalCash() {
	var table = document.getElementById('schedule80GGA');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInOtherMode')[0];

		sumCash += eval(parseInt(coalesce(donationAmtCash.value, 10)));

		sumOther += eval(parseInt(coalesce(donationAmtOther.value, 10)));
	}

	document.getElementsByName('schedule80GGA.donationInCash')[0].value = sumCash;
	document.getElementsByName('schedule80GGA.donationInOtherMode')[0].value = sumOther;

	document.getElementsByName('schedule80GGA.totalDonationsUs80GGA')[0].value = eval(parseInt(coalesce(
			sumCash, 10)))
			+ eval(parseInt(coalesce(sumOther, 10)));
	calculatedon80GGAEligible();
}

function calculatedon80GGAEligible() {
	var table = document.getElementById('schedule80GGA');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumCash = 0;
	var sumOther = 0;

	var totGti = eval(coalesceSetRet('partBTI.grossTotalIncome')
			- coalesceSetRet('partBTI.incChargeTaxSplRate111A112'));

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInCash')[0];

		var donationAmtOther = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].donationInOtherMode')[0];

		if (donationAmtCash.value <= 10000) {

			document.getElementsByName('schedule80GGA.scientificResearch[' + i
					+ '].eligibleAmount')[0].value = eval(parseInt(coalesce(
					donationAmtCash.value, 10)))
					+ eval(parseInt(coalesce(donationAmtOther.value, 10)));
		}

		else {
			document.getElementsByName('schedule80GGA.scientificResearch[' + i
					+ '].eligibleAmount')[0].value = eval(parseInt(coalesce(
					donationAmtOther.value, 10)));
		}
		if (parseInt(totGti) < parseInt(document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].eligibleAmount')[0].value, 10)) {
			document.getElementsByName('schedule80GGA.scientificResearch[' + i
					+ '].eligibleAmount')[0].value = parseInt(totGti);
		} else {
			document.getElementsByName('schedule80GGA.scientificResearch[' + i
					+ '].eligibleAmount')[0].value = parseInt(document
					.getElementsByName('schedule80GGA.scientificResearch[' + i
							+ '].eligibleAmount')[0].value, 10);

		}

		if (document.getElementsByName('schedule80GGA.scientificResearch[' + i
				+ '].eligibleAmount')[0].value == 0
				&& donationAmtCash.value == '') {
			document.getElementsByName('schedule80GGA.scientificResearch[' + i
					+ '].eligibleAmount')[0].value = '';
		}

	}

	calculate80GGAEligAmt();

}

function calculate80GGAEligAmt() {
	var table = document.getElementById('schedule80GGA');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;

	var sumelig = 0;

	var totGti = eval(coalesceSetRet('partBTI.grossTotalIncome')
			- coalesceSetRet('partBTI.incChargeTaxSplRate111A112'));

	for (var i = 0; i < totRow; i++) {

		var eligibleDonationAmt = document
				.getElementsByName('schedule80GGA.scientificResearch[' + i
						+ '].eligibleAmount')[0];

		sumelig += eval(parseInt(coalesce(eligibleDonationAmt.value, 10), 10));

	}

	if (parseInt(totGti) < parseInt(
			document
					.getElementsByName('schedule80GGA.totalEligibleDonationsUs80GGA')[0].value,
			10)) {
		document
				.getElementsByName('schedule80GGA.totalEligibleDonationsUs80GGA')[0].value = parseInt(totGti);
	} else {
		document
				.getElementsByName('schedule80GGA.totalEligibleDonationsUs80GGA')[0].value = sumelig;

	}
}
function calcTotal80GGA() {
	var mainTable = document.getElementById('schedule80GGA').rows;
	var noOfRows = mainTable.length;
}

function validateRATableDForCashAndOtherMode() {
	var tab = document.getElementById('scheduleRA');
	var noOfRows = tab.rows.length;

	for (var i = 0; i < (noOfRows - 4); i++) {
		var doneeName = document.getElementsByName('scheduleRA.doneeDetail['
				+ i + '].doneeName')[0].value;

		var donationAmtCash = document
				.getElementsByName('scheduleRA.doneeDetail[' + i
						+ '].donationAmtCash')[0].value;

		var donationAmtOther = document
				.getElementsByName('scheduleRA.doneeDetail[' + i
						+ '].donationAmtOther')[0].value;

		if (doneeName != '') {
			if (donationAmtCash == '' && donationAmtOther == '') {
				addErrorXHTML(
						'',
						'Enter the amount of donation either in field Donation in cash or Donation in other mode in Schedule RA');

				j
						.setFieldError(
								'',
								'Enter the amount of donation either in field Donation in cash or Donation in other mode in Schedule RA ');

				return;
			}

		}
	}
}

function calculateSchRA() {
	var table = document.getElementById('scheduleRA');
	var rowCount = table.rows.length;
	var totRow = rowCount - 4;
	var sumCash = 0;
	var sumOther = 0;
	var sumElig = 0;

	for (var i = 0; i < totRow; i++) {

		var donationAmtCash = document
				.getElementsByName('scheduleRA.doneeDetail[' + i
						+ '].donationAmtCash')[0];
		var donationAmtOther = document
				.getElementsByName('scheduleRA.doneeDetail[' + i
						+ '].donationAmtOther')[0];
		var eligibleDonationAmt = document
				.getElementsByName('scheduleRA.doneeDetail[' + i
						+ '].eligibleDonationAmt')[0];

		sumCash += eval(parseInt(coalesce(donationAmtCash.value, 10)));

		sumOther += eval(parseInt(coalesce(donationAmtOther.value, 10)));

		sumElig += eval(parseInt(coalesce(eligibleDonationAmt.value, 10)));

		document.getElementsByName('scheduleRA.doneeDetail[' + i
				+ '].eligibleDonationTotal')[0].value = eval(parseInt(coalesce(
				donationAmtCash.value, 10)))
				+ eval(parseInt(coalesce(donationAmtOther.value, 10)));

		document.getElementsByName('scheduleRA.totDon100Percent')[0].value = eval(parseInt(coalesce(
				sumCash, 10)))
				+ eval(parseInt(coalesce(sumOther, 10)));

	}

	document.getElementsByName('scheduleRA.totDon100PercentCash')[0].value = sumCash;
	document.getElementsByName('scheduleRA.totDon100PercentOtherMode')[0].value = sumOther;
	document.getElementsByName('scheduleRA.totEligibleDon100Percent')[0].value = sumElig;

}
// Function to check if Schedule FA is Mandatory.
function checkSchRAMandatory() {

	var table1 = checkRowBlank('scheduleRA', 3, 1);

	var section351IiamtDebPL = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtDebPL')[0].value);
	var section351IiamtUs35Allowable = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section351Ii.deductUs35.amtUs35Allowable')[0].value);
	var section351IiaamtDebPL = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtDebPL')[0].value);
	var section351IiaamtUs35Allowable = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section351Iia.deductUs35.amtUs35Allowable')[0].value);
	var section351IiiamtDebPL = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtDebPL')[0].value);
	var section351IiiamtUs35Allowable = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section351Iii.deductUs35.amtUs35Allowable')[0].value);
	var section352AAamtDebPL = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtDebPL')[0].value);
	var section352AAamtUs35Allowable = parseInt(document
			.getElementsByName('scheduleESR.deductionUs35.section352AA.deductUs35.amtUs35Allowable')[0].value);

	if ((section351IiamtDebPL > 0) || (section351IiamtUs35Allowable > 0)
			|| (section351IiaamtDebPL > 0)
			|| (section351IiaamtUs35Allowable > 0)
			|| (section351IiiamtDebPL > 0)
			|| (section351IiiamtUs35Allowable > 0)
			|| (section352AAamtDebPL > 0) || (section352AAamtUs35Allowable > 0)) {
		if (table1) {
			j.setFieldError('scheduleRA.doneeDetail[0].doneeName',
					'Please enter value in Schedule RA.');
			addErrorXHTML('', 'Please enter value in Schedule RA.');
		}
	}

}

function dpitOnchangeForSHandAL() {

	var form2AccordPara5DPIITFlag = document
			.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.form2AccordPara5DPIITFlag')[0];

	if (form2AccordPara5DPIITFlag.value == "N"
			|| form2AccordPara5DPIITFlag.value == "") {

		// sh-2

		var tab = document.getElementById('schSH2PointA');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}
		var tab = document.getElementById('schSH2PointB');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}
		var tab = document.getElementById('schSH2PointC');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

	} else if (form2AccordPara5DPIITFlag.value == "Y") {

		// enable

		// sh-2

		var tab = document.getElementById('schSH2PointA');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			if (inputs[i].name.match("shareTypeOthers$")) {
				inputs[i].readonly = true;
				inputs[i].disabled = true;
				continue;
			}
			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}
		var tab = document.getElementById('schSH2PointB');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			if (inputs[i].name.match("shareTypeOthers$")) {
				inputs[i].readonly = true;
				inputs[i].disabled = true;
				continue;
			}
			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}
		var tab = document.getElementById('schSH2PointC');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}

	}

}

function fynstFlagOnchangeForPLManuTradandBS() {
	var financialStmtFlag = document
			.getElementsByName('partAGEN1.filingStatus.financialStmtFlag')[0];

	if (financialStmtFlag.value == "N") {

		// Page 6
		var tab = document.getElementById('BalSheetINDTableId');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}
		// Page 50
		var tab = document.getElementById('ScheduleMaAccIND');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;
		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

		// Page 51
		var tab = document.getElementById('ScheduleTrAccIND');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;
		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

		// Page 8
		var tab = document.getElementById('scheduleP&LIND');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;
		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

		// Page 5
		var tab = document.getElementById('BalSheetTableId');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}

		var tab = document.getElementById('BSAssetsTableId');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}

		// Page 48
		var tab = document.getElementById('ScheduleMaAcc');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}

		// Page 49
		var tab = document.getElementById('ScheduleTrAcc');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}

		// Page 7

		var tab = document.getElementById('scheduleP&L');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].readonly = false;
			inputs[i].disabled = false;
		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].disabled = false;
		}
		var anyCompPaidToNonRes = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.employeeComp.anyCompPaidToNonRes')[0];
		var amtPaidToNonRes = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.employeeComp.amtPaidToNonRes')[0];

		if (anyCompPaidToNonRes.value == "N") {
			amtPaidToNonRes.disabled = true;
		} else {
			amtPaidToNonRes.disabled = false;
		}
	} else if (financialStmtFlag.value == "Y") {

		// Page 5
		var tab = document.getElementById('BalSheetTableId');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}
		var tab = document.getElementById('BSAssetsTableId');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

		// Page 48
		var tab = document.getElementById('ScheduleMaAcc');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

		// Page 49
		var tab = document.getElementById('ScheduleTrAcc');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

		// Page 7
		var tab = document.getElementById('scheduleP&L');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

		// Page 6
		var tab = document.getElementById('BalSheetINDTableId');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].disabled = false;

		}
		// Page 50
		var tab = document.getElementById('ScheduleMaAccIND');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;
		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}

		// Page 51
		var tab = document.getElementById('ScheduleTrAccIND');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {

			inputs[i].readonly = false;
			inputs[i].disabled = false;
		}
		for (var i = 0; i < selects.length; i++) {

			selects[i].disabled = false;

		}

		// Page 8
		var tab = document.getElementById('scheduleP&LIND');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].readonly = false;
			inputs[i].disabled = false;

		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].disabled = false;
		}

		var anyCompPaidToNonResindas = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.anyCompPaidToNonRes')[0];
		var amtPaidToNonResindas = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.employeeComp.amtPaidToNonRes')[0];

		if (anyCompPaidToNonResindas.value == "N") {
			amtPaidToNonResindas.disabled = true;
		} else {
			amtPaidToNonResindas.disabled = false;
		}
	}
}

function mandateSh1AL1() {

	var schSHPointA = checkRowBlank('schSHPointA', 2, 1);
	var schSHPointB = checkRowBlank('schSHPointB', 2, 1);
	var schSHPointC = checkRowBlank('schSHPointC', 2, 1);

	var schALPointA = checkRowBlank('schALPointA', 2, 1);
	var schALPointB = checkRowBlank('schALPointB', 2, 1);
	var schALPointC = checkRowBlank('schALPointC', 2, 1);
	var schALPointD = checkRowBlank('schALPointD', 2, 1);
	var schALPointE = checkRowBlank('schALPointE', 2, 1);
	var schALPointF = checkRowBlank('schALPointF', 2, 1);
	var schALPointG = checkRowBlank('schALPointG', 2, 1);
	var schALPointH = checkRowBlank('schALPointH', 2, 1);
	var schALPointI = checkRowBlank('schALPointI', 2, 1);
	var schALPointJ = checkRowBlank('schALPointJ', 2, 1);

	var form2AccordPara5DPIITFlag = document
			.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.form2AccordPara5DPIITFlag')[0].value;
	var unlistedFlag = document
			.getElementsByName('partAGEN2For6.natureOfComp.unlisted')[0].value;
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var sec581AFlag = document
			.getElementsByName('partAGEN1.filingStatus.sec581AFlag')[0].value;

	var scheduleSH1DDCheck = document
			.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value;
	var scheduleAL1DDCheck = document
			.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value;

	if (form2AccordPara5DPIITFlag == 'N' || form2AccordPara5DPIITFlag == "") {
		if (unlistedFlag == 'Y' && domesticCompFlg == 'Y' && sec581AFlag == 'N') {
			if (scheduleSH1DDCheck == '') {
				j
						.setFieldError(
								'scheduleSH1.dropDownMandatoryCheck',
								'Please select an Option from drop down Are you a Company registered under section 8 of Companies Act,2013 (Previously Section 25 of Companies Act,1956) or Company Formed Limited by Guarantee under section 3(2) of Companies Act, 2013 ? in Schedule SH-1');
				addErrorXHTML(
						'',
						'Please select an Option from drop down Are you a Company registered under section 8 of Companies Act,2013 (Previously Section 25 of Companies Act,1956) or Company Formed Limited by Guarantee under section 3(2) of Companies Act, 2013 ? in Schedule SH-1');
			}

			if (scheduleSH1DDCheck == 'N') {
				if (schSHPointA && schSHPointB && schSHPointC) {
					j
							.setFieldError(
									'scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC[0].shareholderName',
									'Please enter any one table in Schedule SH-1.');
					addErrorXHTML('',
							'Please enter any one table in Schedule SH-1.');
				}
			}
		}
		if (unlistedFlag == 'Y' && domesticCompFlg == 'Y') {
			if (scheduleAL1DDCheck == '') {
				j
						.setFieldError(
								'scheduleAL1.dropDownMandatoryCheck',
								'Please select an Option from drop down Do you have assets & liabilities as at the end of the year as mentioned in Schedule AL-1? in Schedule AL-1');
				addErrorXHTML(
						'',
						'Please select an Option from drop down Do you have assets & liabilities as at the end of the year as mentioned in Schedule AL-1? in Schedule AL-1');
			}
			if (scheduleAL1DDCheck == 'Y') {
				if (schALPointA && schALPointB && schALPointC && schALPointD
						&& schALPointE && schALPointF && schALPointG
						&& schALPointH && schALPointI && schALPointJ) {
					j.setFieldError(
							'scheduleAL.dtlsBldLandResHouseUC[0].address',
							'Please enter any one table in Schedule AL-1.');
					addErrorXHTML('',
							'Please enter any one table in Schedule AL-1.');
				}
			}
		}

	}
	var schSH2PointA = checkRowBlank('schSH2PointA', 2, 1);
	var schSH2PointB = checkRowBlank('schSH2PointB', 2, 1);
	var schSH2PointC = checkRowBlank('schSH2PointC', 2, 1);

	var schAL2PointA = checkRowBlank('schAL2PointA', 2, 1);
	var schAL2PointB = checkRowBlank('schAL2PointB', 2, 1);
	var schAL2PointC = checkRowBlank('schAL2PointC', 2, 1);
	var schAL2PointD = checkRowBlank('schAL2PointD', 2, 1);
	var schAL2PointE = checkRowBlank('schAL2PointE', 2, 1);
	var schAL2PointF = checkRowBlank('schAL2PointF', 2, 1);
	var schAL2PointG = checkRowBlank('schAL2PointG', 2, 1);
	var schAL2PointH = checkRowBlank('schAL2PointH', 2, 1);
	var schAL2PointI = checkRowBlank('schAL2PointI', 2, 1);

	var scheduleAL2DDCheck = document
			.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value;

	if (form2AccordPara5DPIITFlag == 'Y') {
		if (schSH2PointA && schSH2PointB && schSH2PointC) {
			j
					.setFieldError(
							'scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU[0].shareholderCategory',
							'Please enter any one table in Schedule SH-2.');
			addErrorXHTML('', 'Please enter any one table in Schedule SH-2.');
		}
		if (scheduleAL2DDCheck == '') {
			j
					.setFieldError(
							'scheduleAL2.dropDownMandatoryCheck',
							'Please select an Option from drop down Do you have assets & liabilities as at the end of the year as mentioned in Schedule AL-2? in Schedule AL-2');
			addErrorXHTML(
					'',
					'Please select an Option from drop down Do you have assets & liabilities as at the end of the year as mentioned in Schedule AL-2? in Schedule AL-2');
		}
		if (scheduleAL2DDCheck == 'Y') {
			if (schAL2PointA && schAL2PointB && schAL2PointC && schAL2PointD
					&& schAL2PointE && schAL2PointF && schAL2PointG
					&& schAL2PointH && schAL2PointI) {
				j.setFieldError('scheduleAL.dtlsBldLandResHouseSU[0].address',
						'Please enter any one table in Schedule AL-2.');
				addErrorXHTML('',
						'Please enter any one table in Schedule AL-2.');
			}
		}

	}

}

function validateNatureOfBusiness() {
	var code = document
			.getElementsByName('partAGEN2For6.natOfBus.business[0].code')[0].value;
	var code1 = document
			.getElementsByName('partapl.debitsToPL.debitPlAcnt.compPresumptive44AE[0].bussCode')[0].value;

	if ((code == '') && (code1 == '')) {
		addErrorXHTML(
				'',
				'Atleast one Business Code is mandatory either in Schedule Nature of Business or at Point-61 of  Sch P&L or at point 63 of Sch P&L IndAS');
		j
				.setFieldError(
						'',
						"Atleast one Business Code is mandatory either in Schedule Nature of Business or at Point-61 of  Sch P&L or at point 63 of Sch P&L IndAS");
	}
}

function validateBPforPoint39() {
	var section7_38 = parseInt(document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7')[0].value);
	var section7A_38 = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7A')[0];
	section7A_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section7A');
	var section7B_38 = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7B')[0];
	section7B_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section7B');
	var section7B1A_38 = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7B1A')[0];
	section7B1A_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section7B1A');
	var section8_38 = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section8')[0];
	section8_38.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.section8');

	var section7 = parseInt(document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7')[0].value);
	var section7a = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7a')[0];
	section7a.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7a');
	var section7b1 = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7b1')[0];
	section7b1.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7b1');
	var section7b2 = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7b2')[0];
	section7b2.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section7b2');
	var section8 = document
			.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section8')[0];
	section8.value = coalesceSetRet('itr4ScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG4b.section8');

	if (section7 < section7_38) {

		j
				.setFieldError(
						'itr4ScheduleBP.businessIncOthThanSpec.section7',
						'The amount shall not exceed amount shown at 4(b)(i) of schedule BP');
		addErrorXHTML(
				document
						.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7')[0],
				'The amount shall not exceed amount shown at 4(b)(i) of schedule BP',
				true);
	}

	if (section7A_38.value < (section7a.value * 0.35)) {
		j
				.setFieldError(
						'itr4ScheduleBP.businessIncOthThanSpec.section7A',
						'Income Chargeable  under Rule 7 at point 39(a) can not exceed amount shown in point 4(c )(i) of schedule BP');
		addErrorXHTML(
				document
						.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7A')[0],
				'Income Chargeable  under Rule 7 at point 39(a) can not exceed amount shown in point 4(c )(i) of schedule BP',
				true);
	}

	if (section7B_38.value < (section7b1.value * 0.25)) {
		j
				.setFieldError(
						'itr4ScheduleBP.businessIncOthThanSpec.section7B',
						'Deemed chargeable Income under Rule 7B(1) shall be minimum of 25 percent of amount shown at 4(c)(iii) of schedule BP');
		addErrorXHTML(
				document
						.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7B')[0],
				'Deemed chargeable Income under Rule 7B(1) shall be minimum of 25 percent of amount shown at 4(c)(iii) of schedule BP',
				true);
	}

	if (section7B1A_38.value < (section7b2.value * 0.40)) {
		j
				.setFieldError(
						'itr4ScheduleBP.businessIncOthThanSpec.section7B1A',
						'Deemed chargeable Income under Rule 7B(1A) shall be minimum of 40 percent of amount shown at 4(c)(iv) of schedule BP');
		addErrorXHTML(
				document
						.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section7B1A')[0],
				'Deemed chargeable Income under Rule 7B(1A) shall be minimum of 40 percent of amount shown at 4(c)(iv) of schedule BP',
				true);
	}

	if (section8_38.value < (section8.value * 0.40)) {
		j
				.setFieldError(
						'itr4ScheduleBP.businessIncOthThanSpec.section8',
						'Deemed chargeable Income under Rule 8 shall be minimum of 40 percent of amount shown at 4(c)(v) of schedule BP');
		addErrorXHTML(
				document
						.getElementsByName('itr4ScheduleBP.businessIncOthThanSpec.section8')[0],
				'Deemed chargeable Income under Rule 8 shall be minimum of 40 percent of amount shown at 4(c)(v) of schedule BP',
				true);
	}

}

function enableShareTypeOthInSH() {
	var tableA1 = document.getElementById('schSHPointA');
	var rowCountA1 = tableA1.rows.length;
	var totRowA1 = rowCountA1 - 4;

	for (var i = 0; i < totRowA1; i++) {
		if (document
				.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC['
						+ i + '].shareType')[0].value == 'OT') {
			document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC['
							+ i + '].shareTypeOthers')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC['
							+ i + '].shareTypeOthers')[0].value = '';
			document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC['
							+ i + '].shareTypeOthers')[0].disabled = true;
		}
	}
	var tableB1 = document.getElementById('schSHPointB');
	var rowCountB1 = tableB1.rows.length;
	var totRowB1 = rowCountB1 - 4;

	for (var i = 0; i < totRowB1; i++) {
		if (document
				.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsEquityShareEndPrvYr['
						+ i + '].shareType')[0].value == 'OT') {
			document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsEquityShareEndPrvYr['
							+ i + '].shareTypeOthers')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsEquityShareEndPrvYr['
							+ i + '].shareTypeOthers')[0].value = '';
			document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsEquityShareEndPrvYr['
							+ i + '].shareTypeOthers')[0].disabled = true;
		}
	}
	var tableA2 = document.getElementById('schSH2PointA');
	var rowCountA2 = tableA2.rows.length;
	var totRowA2 = rowCountA2 - 5;

	for (var i = 0; i < totRowA2; i++) {
		if (document
				.getElementsByName('scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU['
						+ i + '].shareType')[0].value == 'OT') {
			document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU['
							+ i + '].shareTypeOthers')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU['
							+ i + '].shareTypeOthers')[0].value = '';
			document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU['
							+ i + '].shareTypeOthers')[0].disabled = true;
		}
	}
	var tableB2 = document.getElementById('schSH2PointB');
	var rowCountB2 = tableB2.rows.length;
	var totRowB2 = rowCountB2 - 4;

	for (var i = 0; i < totRowB2; i++) {
		if (document
				.getElementsByName('scheduleSH.shrhldngStartUps.dtlsShareAppMoneyAlltEndPrvYr['
						+ i + '].shareType')[0].value == 'OT') {
			document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsShareAppMoneyAlltEndPrvYr['
							+ i + '].shareTypeOthers')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsShareAppMoneyAlltEndPrvYr['
							+ i + '].shareTypeOthers')[0].value = '';
			document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsShareAppMoneyAlltEndPrvYr['
							+ i + '].shareTypeOthers')[0].disabled = true;
		}
	}
}

function enableOthInAL() {
	var tableE1 = document.getElementById('schALPointE');
	var rowCountE1 = tableE1.rows.length;
	var totRowE1 = rowCountE1 - 4;

	for (var i = 0; i < totRowE1; i++) {
		if (document.getElementsByName('scheduleAL.dtlsOtherSecuritiesUC[' + i
				+ '].securitiesType')[0].value == 'O') {
			document.getElementsByName('scheduleAL.dtlsOtherSecuritiesUC[' + i
					+ '].securitiesTypeOthers')[0].disabled = false;
		} else {
			document.getElementsByName('scheduleAL.dtlsOtherSecuritiesUC[' + i
					+ '].securitiesTypeOthers')[0].value = '';
			document.getElementsByName('scheduleAL.dtlsOtherSecuritiesUC[' + i
					+ '].securitiesTypeOthers')[0].disabled = true;
		}
	}

	var tableH1 = document.getElementById('schALPointH');
	var rowCountH1 = tableH1.rows.length;
	var totRowH1 = rowCountH1 - 4;

	for (var i = 0; i < totRowH1; i++) {
		if (document.getElementsByName('scheduleAL.dtlsVehiclestransportUC['
				+ i + '].assetParticulars')[0].value == 'O') {
			document.getElementsByName('scheduleAL.dtlsVehiclestransportUC['
					+ i + '].assetParticularsOthers')[0].disabled = false;
		} else {
			document.getElementsByName('scheduleAL.dtlsVehiclestransportUC['
					+ i + '].assetParticularsOthers')[0].value = '';
			document.getElementsByName('scheduleAL.dtlsVehiclestransportUC['
					+ i + '].assetParticularsOthers')[0].disabled = true;
		}
	}
	var tableI1 = document.getElementById('schALPointI');
	var rowCountI1 = tableI1.rows.length;
	var totRowI1 = rowCountI1 - 4;

	for (var i = 0; i < totRowI1; i++) {
		if (document
				.getElementsByName('scheduleAL.dtlsJewelleryArchCollectionsUC['
						+ i + '].assetParticulars')[0].value == 'OT') {
			document
					.getElementsByName('scheduleAL.dtlsJewelleryArchCollectionsUC['
							+ i + '].assetParticularsOthers')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleAL.dtlsJewelleryArchCollectionsUC['
							+ i + '].assetParticularsOthers')[0].value = '';
			document
					.getElementsByName('scheduleAL.dtlsJewelleryArchCollectionsUC['
							+ i + '].assetParticularsOthers')[0].disabled = true;
		}
	}

	var tableE2 = document.getElementById('schAL2PointE');
	var rowCountE2 = tableE2.rows.length;
	var totRowE2 = rowCountE2 - 4;

	for (var i = 0; i < totRowE2; i++) {
		if (document
				.getElementsByName('scheduleAL.dtlsAcqustSharesSecuritiesSU['
						+ i + '].sharesSecuritiesType')[0].value == 'OT') {
			document
					.getElementsByName('scheduleAL.dtlsAcqustSharesSecuritiesSU['
							+ i + '].sharesSecuritiesTypeOthers')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleAL.dtlsAcqustSharesSecuritiesSU['
							+ i + '].sharesSecuritiesTypeOthers')[0].value = '';
			document
					.getElementsByName('scheduleAL.dtlsAcqustSharesSecuritiesSU['
							+ i + '].sharesSecuritiesTypeOthers')[0].disabled = true;
		}
	}
	var tableF2 = document.getElementById('schAL2PointF');
	var rowCountF2 = tableF2.rows.length;
	var totRowF2 = rowCountF2 - 4;

	for (var i = 0; i < totRowF2; i++) {
		if (document.getElementsByName('scheduleAL.dtlsVehiclestransportSU['
				+ i + '].assetParticulars')[0].value == 'O') {
			document.getElementsByName('scheduleAL.dtlsVehiclestransportSU['
					+ i + '].assetParticularsOthers')[0].disabled = false;
		} else {
			document.getElementsByName('scheduleAL.dtlsVehiclestransportSU['
					+ i + '].assetParticularsOthers')[0].value = '';
			document.getElementsByName('scheduleAL.dtlsVehiclestransportSU['
					+ i + '].assetParticularsOthers')[0].disabled = true;
		}
	}
	var tableH2 = document.getElementById('schAL2PointH');
	var rowCountH2 = tableH2.rows.length;
	var totRowH2 = rowCountH2 - 4;

	for (var i = 0; i < totRowH2; i++) {
		if (document.getElementsByName('scheduleAL.dtlsArchaeologicalCollctSU['
				+ i + '].assetParticulars')[0].value == 'OT') {
			document.getElementsByName('scheduleAL.dtlsArchaeologicalCollctSU['
					+ i + '].assetParticularsOthers')[0].disabled = false;
		} else {
			document.getElementsByName('scheduleAL.dtlsArchaeologicalCollctSU['
					+ i + '].assetParticularsOthers')[0].value = '';
			document.getElementsByName('scheduleAL.dtlsArchaeologicalCollctSU['
					+ i + '].assetParticularsOthers')[0].disabled = true;
		}
	}
}

function validateIssurePurchasePriceAL1() {

	var tableD = document.getElementById('schALPointD');
	var rowCountD = tableD.rows.length;
	var totRowD = rowCountD - 4;

	for (var i = 0; i < totRowD; i++) {
		if (document.getElementsByName('scheduleAL.dtlsUnListedEquitySharesUC['
				+ i + '].issuePricePerShare')[0].value > 0
				&& document
						.getElementsByName('scheduleAL.dtlsUnListedEquitySharesUC['
								+ i + '].purchasePricePerShare')[0].value > 0) {
			j
					.setFieldError(
							document
									.getElementsByName('scheduleAL.dtlsUnListedEquitySharesUC['
											+ i + '].issuePricePerShare')[0],
							'Issue Price per share and Purchase price per share cannot filled together, Please provide information in different row in Table D in Schedule AL-1.');
			addErrorXHTML(
					'',
					'Issue Price per share and Purchase price per share cannot filled together, Please provide information in different row in Table D in Schedule AL-1.',
					true);
		}
	}
	var tableE = document.getElementById('schALPointE');
	var rowCountE = tableE.rows.length;
	var totRowE = rowCountE - 4;

	for (var i = 0; i < totRowE; i++) {
		if (document.getElementsByName('scheduleAL.dtlsOtherSecuritiesUC[' + i
				+ '].issuePriceSecurity')[0].value > 0
				&& document
						.getElementsByName('scheduleAL.dtlsOtherSecuritiesUC['
								+ i + '].purchasePricePerSecurity')[0].value > 0) {
			j
					.setFieldError(
							document
									.getElementsByName('scheduleAL.dtlsOtherSecuritiesUC['
											+ i + '].issuePriceSecurity')[0],
							'Issue Price per security and Purchase price per security cannot filled together, Please provide information in different row in Table E in Schedule AL-1.');
			addErrorXHTML(
					'',
					'Issue Price per security and Purchase price per security cannot filled together, Please provide information in different row in Table E in Schedule AL-1.',
					true);
		}
	}

}

// 2019changes
// 1b Interest , Gross (bi + bii + biii + biv + bv)
function calcualteOSInterestTotal() {
	var sum = 0;

	var intrstFrmSavingBank = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.intrstFrmSavingBank');
	var intrstFrmTermDeposit = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.intrstFrmTermDeposit');
	var intrstFrmIncmTaxRefund = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.intrstFrmIncmTaxRefund');
	var intrstFrmOthers = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.intrstFrmOthers');
	var intrstFrmPTI = coalesceSetRet('scheduleOS.incOthThanOwnRaceHorse.intrstFrmPTI');

	sum = eval(parseInt(sum, 10)
			+ parseInt(coalesce(intrstFrmSavingBank), 10)
			+ parseInt(coalesce(intrstFrmTermDeposit), 10)
			+ parseInt(coalesce(intrstFrmIncmTaxRefund), 10)
			+ parseInt(coalesce(intrstFrmOthers), 10)
			+ parseInt(coalesce(intrstFrmPTI), 10));

	document
			.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.interestGross')[0].value = sum;
}
function calcAnyOtherIncome() {
	var tab = document.getElementById('anyOtherIncome');
	var rowcount = tab.rows.length;
	var totalOtherIncome = document
			.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.totalOtherIncome')[0];
	var temp = parseInt('0', 10);
	for (var i = 0; i < rowcount - 3; i++) {
		temp = eval(parseInt(
				coalesce(document
						.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.otherIncome['
								+ i + '].anyOtherIncomeAmount')[0].value), 10))
				+ temp;
	}
	totalOtherIncome.value = temp;
}

/*function calculateScheduleOStaxBenifit() {
	var tab1 = document.getElementById('accumalatedBalance');
	var noOfRows = tab1.rows.length;
	var amt1 = 0;
	var amt2 = 0;

	for (var i = 0; i < (noOfRows - 4); i++) {
		amt1 = parseInt(
				zeroOrMore(document
						.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.taxAccmltdBalRecPFDtls['
								+ i + '].taxBenefit')[0].value), 10)
				+ parseInt(amt2, 10);
		amt2 = amt1;
	}

	document
			.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalTaxBenefit')[0].value = amt1;
}*/

/*function calculateScheduleOSicnomeBenifit() {
	var tab1 = document.getElementById('accumalatedBalance');
	var noOfRows = tab1.rows.length;
	var amt1 = 0;
	var amt2 = 0;
	for (var i = 0; i < (noOfRows - 4); i++) {
		amt1 = parseInt(
				zeroOrMore(document
						.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.taxAccmltdBalRecPFDtls['
								+ i + '].incomeBenefit')[0].value), 10)
				+ parseInt(amt2, 10);
		amt2 = amt1;
	}

	document
			.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit')[0].value = amt1;
}
*/
function removeSectionPTI(sectionArray, rowCount) {
	try {
		for (var i = 0; i < rowCount; i++) {
			var selectsLength = document
					.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
							+ i + '].sourceDescription')[0].options.length;
			for (var k = selectsLength; k > 0; k--) {

				if (document
						.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
								+ i + '].sourceDescription')[0].options[k] != null
						&& sectionArray
								.indexOf(document
										.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
												+ i + '].sourceDescription')[0].options[k].value) != -1) {
					document
							.getElementsByName('scheduleOS.schduleOsincPti.othersGrossDtls['
									+ i + '].sourceDescription')[0].remove(k);

				}
			}
		}
	} catch (e) {
		alert(e.stack);
	}
}

function calcSch112A() {
	calcSchedule112A();
	calTotofTotShareVal112A();
	calTotCostOfAcqWthoutIndx112A();
	calTotCostOfAcq112A();
	calTotLngTrmCaptAsstAcq112A();
	calTotOfTotFairMktValPerShare112A();
	//calTotFullValCons112A();
	//calTotCostOfimptWthoutIndx112A();
	calTotExpTransfer112A();
	calTotDeductions112A();
	calTotBalance112A();
	//populateCG112A();
}

function calcSch115Ad1() {
	calcSchedule115AD();
	calTotofTotShareVal115AD();
	calTotCostOfAcqWthoutIndx115AD();
	calTotCostOfAcq115AD();
	calTotLngTrmCaptAsstAcq115AD();
	calTotOfTotFairMktValPerShare115AD();
//	calTotFullValCons115AD();
	//calTotCostOfimptWthoutIndx115AD();
	calTotExpTransfer115AD();
	calTotDeductions115AD();
	calTotBalance115AD();
	populateCG115AD();
}
function calTotofTotShareVal112A() {
	var amtTotal = parseFloat('0', 10).toFixed(4);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("totSaleValue$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.saleValue112A')[0].value = Math.floor(amtTotal);

}
function calTotCostOfAcqWthoutIndx112A() {
	var amtTotal = parseFloat('0', 10).toFixed(4);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("costOfAcqWthoutIndex$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.costAcqWithoutIndx112A')[0].value = Math.floor(amtTotal);

}
function calTotCostOfAcq112A() {
	var amtTotal = parseFloat('0', 10).toFixed(4);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("costOfAcq$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.acquisitionCost112A')[0].value = Math.floor(amtTotal);

}
function calTotLngTrmCaptAsstAcq112A() {
	var amtTotal = parseFloat('0', 10).toFixed(4);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("lngTrmCaptAsstAcq$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.lTCGBeforelowerB1B2112A')[0].value = Math.floor(amtTotal);

}
function calTotOfTotFairMktValPerShare112A() {
	var amtTotal = parseFloat('0', 10).toFixed(4);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("totFairMktValCapAsst552$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.fairMktValueCapAst112A')[0].value = Math.floor(amtTotal);

}
/*function calTotFullValCons112A() {
	var amtTotal = parseFloat('0', 10).toFixed(2);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("fullValCons$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.fullValueConsdr112A')[0].value = amtTotal
			.toFixed(2);

}*/
/*function calTotCostOfimptWthoutIndx112A() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("costOfimptWthoutIndx$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.costImprvWithoutIndx112A')[0].value = amtTotal
			.toFixed(2);

}*/
function calTotExpTransfer112A() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("expTransfer$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.expExclCnctTransfer112A')[0].value = Math.floor(amtTotal);

}
function calTotDeductions112A() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("totDeductions$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.deductions112A')[0].value = Math.floor(amtTotal);

}
function calTotBalance112A() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule112A');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("balance$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule112A.balance112A')[0].value = Math.floor(amtTotal);
	if(document.getElementsByName('schedule112A.saleOfEquity112A[0].ISINCode')[0].value!=""){

	document.getElementsByName('scheduleCGFor5.shortTermCapGainFor5.saleofEquityLtcg.ltcgCapGain')[0].value=Math.round(document.getElementsByName('schedule112A.balance112A')[0].value);
	}
}

function calTotofTotShareVal115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("totSaleValue$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.saleValue115AD')[0].value = Math.floor(amtTotal);

}
function calTotCostOfAcqWthoutIndx115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("costOfAcqWthoutIndex$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.costAcqWithoutIndx115AD')[0].value = Math.floor(amtTotal);

}
function calTotCostOfAcq115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("costOfAcq$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.acquisitionCost115AD')[0].value = Math.floor(amtTotal);

}
function calTotLngTrmCaptAsstAcq115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("lngTrmCaptAsstAcq$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.lTCGBeforelowerB1B2115AD')[0].value = Math.floor(amtTotal);

}

function calTotOfTotFairMktValPerShare115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("totFairMktValCapAsst552$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.fairMktValueCapAst115AD')[0].value = Math.floor(amtTotal);

}
/*function calTotFullValCons115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("fullValCons$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.fullValueConsdr115AD')[0].value = amtTotal
			.toFixed(2);

}
function calTotCostOfimptWthoutIndx115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("costOfimptWthoutIndx$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.costImprvWithoutIndx115AD')[0].value = amtTotal
			.toFixed(2);

}*/
function calTotExpTransfer115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("expTransfer$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.expExclCnctTransfer115AD')[0].value = Math.floor(amtTotal);

}
function calTotDeductions115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("totDeductions$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.deductions115AD')[0].value = Math.floor(amtTotal);

}
function calTotBalance115AD() {
	var amtTotal = parseFloat('0', 10);
	var tabl = document.getElementById('Schedule115AD');
	var allInputTags = tabl.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("balance$")) {
			amtTotal = eval(parseFloat(amtTotal, 10)
					+ parseFloat(isNVL(allInputTags[i].value), 10));
		}
	}

	document.getElementsByName('schedule115AD.balance115AD')[0].value = Math.floor(amtTotal);

}
/*function getIsinName112A(elem) {
	var position = parseInt(elem.name.substring(elem.name.indexOf("[") + 1,
			elem.name.indexOf("]")));

	var isinCode = document.getElementsByName('schedule112A.saleOfEquity112A['
			+ position + '].ISINCode')[0].value;

	document.getElementsByName('schedule112A.saleOfEquity112A[' + position
			+ '].nameOfShare')[0].value = main.getISINName(isinCode);
}*/
/*function getIsinName115AD(elem) {
	var position = parseInt(elem.name.substring(elem.name.indexOf("[") + 1,
			elem.name.indexOf("]")));

	var isinCode = document
			.getElementsByName('schedule115AD.saleOfEquity115AD[' + position
					+ '].ISINCode')[0].value;

	document.getElementsByName('schedule115AD.saleOfEquity115AD[' + position
			+ '].nameOfShare')[0].value = main.getISINName(isinCode);
}*/
function calcSchedule112A() {
	try {
		var table = document.getElementById('Schedule112A');
		var noOfRows = table.rows.length;
		var indexValue = eval(((parseInt(noOfRows, 10) - 3)));

		for (var i = 0; i < indexValue; i++) {

			var shareOnOrBefore = document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].shareOnOrBefore')[0];
			
			if(shareOnOrBefore.value == "BE" || shareOnOrBefore.value == ""){
			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totSaleValue")[0].value = parseFloat(
					eval(parseFloat(coalesce(document
							.getElementsByName("schedule112A.saleOfEquity112A["
									+ i + "].noOfShare")[0].value), 10))
							* eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule112A.saleOfEquity112A["
													+ i + "].salePricePerShare")[0].value),
									10)));
			}else{ 
				document.getElementsByName("schedule112A.saleOfEquity112A[" + i
						+ "].totSaleValue")[0].value=parseFloat(eval(parseFloat(coalesce(document.getElementsByName("schedule112A.saleOfEquity112A[" + i
								+ "].totSaleValue")[0].value))));
			}
			
			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totSaleValue")[0].value = Math.floor(document.getElementsByName("schedule112A.saleOfEquity112A[" + i
						+ "].totSaleValue")[0].value);
			/*document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].fullValCons")[0].value = parseFloat(
					eval(parseFloat(coalesce(document
							.getElementsByName("schedule112A.saleOfEquity112A["
									+ i + "].noOfShare")[0].value), 10))
							* eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule112A.saleOfEquity112A["
													+ i + "].salePricePerShare")[0].value),
									10))).toFixed(2);*/

			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totFairMktValCapAsst552")[0].value = parseFloat(
					eval(parseFloat(coalesce(document
							.getElementsByName("schedule112A.saleOfEquity112A["
									+ i + "].noOfShare")[0].value), 10))
							* eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule112A.saleOfEquity112A["
													+ i
													+ "].fairMktValPerShare")[0].value),
									10)));
			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totFairMktValCapAsst552")[0].value= Math.floor(document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totFairMktValCapAsst552")[0].value);
			
			var colVal11 = parseFloat(coalesce(document
					.getElementsByName("schedule112A.saleOfEquity112A[" + i
							+ "].totFairMktValCapAsst552")[0].value), 10);
			
		
		     var colVal6=parseFloat(coalesce(document.getElementsByName("schedule112A.saleOfEquity112A["+i+"].totSaleValue")[0].value),10);
	            if(colVal11>colVal6)
	            	{
	            	 document.getElementsByName("schedule112A.saleOfEquity112A["+i+"].lngTrmCaptAsstAcq")[0].value=colVal6;
	            	}
	            else
	            	{
	            	document.getElementsByName("schedule112A.saleOfEquity112A["+i+"].lngTrmCaptAsstAcq")[0].value=colVal11;
	            	}
	            
	            document.getElementsByName("schedule112A.saleOfEquity112A["+i+"].lngTrmCaptAsstAcq")[0].value=Math.floor(document.getElementsByName("schedule112A.saleOfEquity112A["+i+"].lngTrmCaptAsstAcq")[0].value);
			
			var colVal8 = parseFloat(coalesce(document
					.getElementsByName("schedule112A.saleOfEquity112A[" + i
							+ "].costOfAcq")[0].value), 10);
			var colVal9 = parseFloat(coalesce(document
					.getElementsByName("schedule112A.saleOfEquity112A[" + i
							+ "].lngTrmCaptAsstAcq")[0].value), 10);
			if (colVal8 > colVal9) {
				document.getElementsByName("schedule112A.saleOfEquity112A[" + i
						+ "].costOfAcqWthoutIndex")[0].value = colVal8
						;
			} else {
				document.getElementsByName("schedule112A.saleOfEquity112A[" + i
						+ "].costOfAcqWthoutIndex")[0].value = colVal9
						;
			}
			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].costOfAcqWthoutIndex")[0].value=Math.floor(document.getElementsByName("schedule112A.saleOfEquity112A[" + i
						+ "].costOfAcqWthoutIndex")[0].value);
			
			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totDeductions")[0].value = parseFloat(
					eval(parseFloat(coalesce(document
							.getElementsByName("schedule112A.saleOfEquity112A["
									+ i + "].costOfAcqWthoutIndex")[0].value),
							10))
							+ eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule112A.saleOfEquity112A["
													+ i + "].expTransfer")[0].value),
									10)));
			
			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totDeductions")[0].value=Math.floor(document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].totDeductions")[0].value);

			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].balance")[0].value = parseFloat(
					eval(parseFloat(
							coalesce(document
									.getElementsByName("schedule112A.saleOfEquity112A["
											+ i + "].totSaleValue")[0].value),
							10))
							- eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule112A.saleOfEquity112A["
													+ i + "].totDeductions")[0].value),
									10)));
			
			document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].balance")[0].value=Math.floor(document.getElementsByName("schedule112A.saleOfEquity112A[" + i
					+ "].balance")[0].value);

		}
	} catch (e) {
		alert('error in calcSchedule112A = ' + e.stack);
	}
}

function calcSchedule115AD() {
	try {
		var table = document.getElementById('Schedule115AD');
		var noOfRows = table.rows.length;
		var indexValue = eval(((parseInt(noOfRows, 10) - 3)));

		for (var i = 0; i < indexValue; i++) {
			
        var shareOnOrBefore = document.getElementsByName("schedule115AD.saleOfEquity115AD["+i+"].shareOnOrBefore")[0];
			if(shareOnOrBefore.value == "BE" || shareOnOrBefore.value == ""){

			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totSaleValue")[0].value = parseFloat(
					eval(parseFloat(
							coalesce(document
									.getElementsByName("schedule115AD.saleOfEquity115AD["
											+ i + "].noOfShare")[0].value), 10)
							.toFixed(4))
							* eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule115AD.saleOfEquity115AD["
													+ i + "].salePricePerShare")[0].value),
									10)));
			}else{
				document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
						+ "].totSaleValue")[0].value = parseFloat(
						eval(parseFloat(
								coalesce(document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
						+ "].totSaleValue")[0].value))));
				
			}
			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totSaleValue")[0].value=Math.floor(document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totSaleValue")[0].value);
/*
			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].fullValCons")[0].value = parseFloat(
					eval(parseFloat(
							coalesce(document
									.getElementsByName("schedule115AD.saleOfEquity115AD["
											+ i + "].noOfShare")[0].value), 10))
							* eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule115AD.saleOfEquity115AD["
													+ i + "].salePricePerShare")[0].value),
									10))).toFixed(2);*/

			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totFairMktValCapAsst552")[0].value = parseFloat(
					eval(parseFloat(
							coalesce(document
									.getElementsByName("schedule115AD.saleOfEquity115AD["
											+ i + "].noOfShare")[0].value), 10))
							* eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule115AD.saleOfEquity115AD["
													+ i
													+ "].fairMktValPerShare")[0].value),
									10)));
			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totFairMktValCapAsst552")[0].value=Math.floor(document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totFairMktValCapAsst552")[0].value);

			var colVal11 = parseFloat(
					coalesce(document
							.getElementsByName("schedule115AD.saleOfEquity115AD["
									+ i + "].totFairMktValCapAsst552")[0].value),
					10);
			
			var colVal6 = parseFloat(
					coalesce(document
							.getElementsByName("schedule115AD.saleOfEquity115AD["
									+ i + "].totSaleValue")[0].value), 10);
					
			if (colVal11 > colVal6) {
				document.getElementsByName("schedule115AD.saleOfEquity115AD["
						+ i + "].lngTrmCaptAsstAcq")[0].value = colVal6;
			} else {
				document.getElementsByName("schedule115AD.saleOfEquity115AD["
						+ i + "].lngTrmCaptAsstAcq")[0].value = colVal11;
			}
			document.getElementsByName("schedule115AD.saleOfEquity115AD["
					+ i + "].lngTrmCaptAsstAcq")[0].value=Math.floor(document.getElementsByName("schedule115AD.saleOfEquity115AD["
						+ i + "].lngTrmCaptAsstAcq")[0].value);
			
			var colVal8 = parseFloat(
					coalesce(document
							.getElementsByName("schedule115AD.saleOfEquity115AD["
									+ i + "].costOfAcq")[0].value), 10);
			var colVal9 = parseFloat(
					coalesce(document
							.getElementsByName("schedule115AD.saleOfEquity115AD["
									+ i + "].lngTrmCaptAsstAcq")[0].value), 10);
			if (colVal8 > colVal9) {
				document.getElementsByName("schedule115AD.saleOfEquity115AD["
						+ i + "].costOfAcqWthoutIndex")[0].value = colVal8;
			} else {
				document.getElementsByName("schedule115AD.saleOfEquity115AD["
						+ i + "].costOfAcqWthoutIndex")[0].value = colVal9;
			}
			
			document.getElementsByName("schedule115AD.saleOfEquity115AD["
					+ i + "].costOfAcqWthoutIndex")[0].value=Math.floor(document.getElementsByName("schedule115AD.saleOfEquity115AD["
						+ i + "].costOfAcqWthoutIndex")[0].value);
			
			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totDeductions")[0].value = parseFloat(
					eval(parseFloat(
							coalesce(document
									.getElementsByName("schedule115AD.saleOfEquity115AD["
											+ i + "].costOfAcqWthoutIndex")[0].value),
							10))
							
							+ eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule115AD.saleOfEquity115AD["
													+ i + "].expTransfer")[0].value),
									10)));
			
			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totDeductions")[0].value=Math.floor(document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].totDeductions")[0].value);

			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].balance")[0].value = parseFloat(
					eval(parseFloat(
							coalesce(document
									.getElementsByName("schedule115AD.saleOfEquity115AD["
											+ i + "].totSaleValue")[0].value),
							10))
							- eval(parseFloat(
									coalesce(document
											.getElementsByName("schedule115AD.saleOfEquity115AD["
													+ i + "].totDeductions")[0].value),
									10)));
			
			document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].balance")[0].value=Math.floor(document.getElementsByName("schedule115AD.saleOfEquity115AD[" + i
					+ "].balance")[0].value);

		}
	} catch (e) {
		alert('error in calcSchedule115AD = ' + e.stack);
	}
}
function NoneOrVal(value) {
	if (value > 0 || value < 0) {
		return value;
	} else {
		return '';
	}
}

function populateCG115AD() {
	
	if (document
			.getElementsByName('schedule115AD.saleOfEquity115AD[0].ISINCode')[0].value != "") {
	
		var ltcgAssestsB4 = document
		.getElementsByName('scheduleCGFor8.shortTermCapGainFor8.saleofEquityLtcg.ltcgCapGain')[0];
		ltcgAssestsB4.value = Math.round(NoneOrVal(coalesce(document
				.getElementsByName('schedule115AD.balance115AD')[0].value)));
		
	}else {
		var ltcgAssestsB4 = document
		.getElementsByName('scheduleCGFor8.shortTermCapGainFor8.saleofEquityLtcg.ltcgCapGain')[0];
		ltcgAssestsB4.value ='0';
	}


}

function clearFiels112A() {
	if (document.getElementsByName('schedule112A.saleOfEquity112A[0].ISINCode')[0].value == "") {
		var tabId = "#" + "Schedule112A";
		$(tabId).find(':input').prop('value', "");

	}

}

function clearFiels115AD() {
	try {
		if (document
				.getElementsByName('schedule115AD.saleOfEquity115AD[0].ISINCode')[0].value == "") {
			var tabId = "#" + "Schedule115AD";
			$(tabId).find(':input').prop('value', "");

		}
	} catch (e) {
		alert(e);
	}
}
function returnSecCheck(Sec, Resp) {
	var Sec = document.getElementsByName(Sec)[0];
	var Resp = document.getElementsByName(Resp)[0];
	var secHidden = document
			.getElementsByName('partAGEN1.filingStatus.secHidden')[0];
	if (Sec.value != '') {
		Resp.value = '';
		secHidden.value = Sec.value;
	}
}

function returnSecRespCheck(Sec, Resp) {
	var Sec = document.getElementsByName(Sec)[0];
	var Resp = document.getElementsByName(Resp)[0];
	var secHidden = document
			.getElementsByName('partAGEN1.filingStatus.secHidden')[0];
	if (Resp.value != '') {
		Sec.value = '';
		secHidden.value = Resp.value;
	}
}

function setSecRespOnSave() {
	var HiddenSec = document
			.getElementsByName('partAGEN1.filingStatus.secHidden')[0];
	var fileSec = document
			.getElementsByName('partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;
	var respSec = document
			.getElementsByName('partAGEN1.filingStatus.returnFileInResp')[0].value;

	if (fileSec == '11' || fileSec == '12' || fileSec == '17'
			|| fileSec == '19' || fileSec == '20') {
		HiddenSec.value = fileSec;
	} else {
		HiddenSec.value = respSec;
	}
}

function validateSecHidden() {
	var HiddenSec = document
			.getElementsByName('partAGEN1.filingStatus.secHidden')[0];
	if (HiddenSec.value == '') {
		j
				.setFieldError('partAGEN1.filingStatus.secHidden',
						'Either Filed u/s or Filed in response to notice u/s must have to be selected');
		addErrorXHTML(
				HiddenSec,
				'Either Filed u/s or Filed in response to notice u/s must have to be selected',
				true);
	}
}

function setSecResp() {

	var HiddenSec = document
			.getElementsByName('partAGEN1.filingStatus.secHidden')[0].value;
	var fileSec = document
			.getElementsByName('partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0];
	var respSec = document
			.getElementsByName('partAGEN1.filingStatus.returnFileInResp')[0];

	if (HiddenSec == '11' || HiddenSec == '12' || HiddenSec == '17'
			|| HiddenSec == '19' || HiddenSec == '20') {
		fileSec.value = HiddenSec;
	} else if (HiddenSec == '13' || HiddenSec == '14' || HiddenSec == '15'
			|| HiddenSec == '16' || HiddenSec == '18') {
		respSec.value = HiddenSec;
	} else {
		fileSec.value = '11';
	}
}
/*
function sumSectionWiseNEW(tableId) {
	var table2 = document.getElementById('stcg10pctTab');
	var rowCount2 = table2.rows.length / 15;
	var amt = 0;

	for (var i = 0; i < rowCount2; i++) {
		amt = parseInt(amt)
				+ parseInt(coalesce(document
						.getElementsByName('scheduleCGPost45.longTermCapGainPost45.nRIOnSec112and115['
								+ i + '].exemptionOrDednUs54S')[0].value));
	}

	return amt;
}*/
function validateTradingAcc() {
	var turnovr = document
			.getElementsByName('partatr.revFromOperations.turnovrIntraday')[0].value;
	var income = document
			.getElementsByName('partatr.revFromOperations.incomIntraday')[0].value;
	if (parseInt(income) > parseInt(turnovr)) {
		j
				.setFieldError(
						'',
						'Income from Intraday Trading can not be more than Turnover from Intraday Trading in Part A-Trading Account');
		addErrorXHTML(
				'',
				'Income from Intraday Trading can not be more than Turnover from Intraday Trading in Part A-Trading Account',
				true);
	}
}
function validatePLNetProfit() {
	var grossReceipts = document
			.getElementsByName('partapl.debitsToPL.debitPlAcnt.grossReceipts')[0].value;
	var netProfit = document
			.getElementsByName('partapl.debitsToPL.debitPlAcnt.netProfit')[0].value;
	if (parseInt(netProfit) > parseInt(grossReceipts)) {
		j.setFieldError('',
				'62b can not be more than 62a in Schedule Profit & Loss');
		addErrorXHTML('',
				'62b can not be more than 62a in Schedule Profit & Loss', true);
	}
}
function validateTradingAccInds() {
	var turnovr = document
			.getElementsByName('partatrIndAs.revFromOperations.turnovrIntraday')[0].value;
	var income = document
			.getElementsByName('partatrIndAs.revFromOperations.incomIntraday')[0].value;
	if (parseInt(income) > parseInt(turnovr)) {
		j
				.setFieldError(
						'',
						'Income from Intraday Trading can not be more than Turnover from Intraday Trading in Part A-Trading Account-Ind AS');
		addErrorXHTML(
				'',
				'Income from Intraday Trading can not be more than Turnover from Intraday Trading in Part A-Trading Account-Ind AS',
				true);
	}
}
function calExpenses() {
	/*
	 * var
	 * grossReceipts64ia=document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.grossReceipts64ia')[0].value;
	 * var
	 * grossReceipts64ib=document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.grossReceipts64ib')[0].value;
	 * var
	 * expenses=document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.expenses')[0].value;
	 * if(parseInt(expenses)>0 && (!parseInt(grossReceipts64ia)>0 &&
	 * !parseInt(grossReceipts64ib)>0 )) { j.setFieldError('','In order to claim
	 * Expenses, Either Gross Receipts or Gross Profit must be greater than zero
	 * in Point 64 in Part A P&L IndAS'); addErrorXHTML('','In order to claim
	 * Expenses, Either Gross Receipts or Gross Profit must be greater than zero
	 * in Point 64 in Part A P&L IndAS',true); }
	 */
}
function calExpensesii() {
	/*
	 * var
	 * grossReceipts64ia=document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.grossReceipts64ia')[0].value;
	 * var
	 * grossReceipts64ib=document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.grossReceipts64ib')[0].value;
	 * var
	 * expenses=document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.expenses')[0].value;
	 * if(parseInt(expenses)>0 && (!parseInt(grossReceipts64ia)>0 &&
	 * !parseInt(grossReceipts64ib)>0 )) { j.setFieldError('','In order to claim
	 * Expenses, Either Gross Receipts or Gross Profit must be greater than zero
	 * in Point 64 in Part A P&L IndAS'); addErrorXHTML('','In order to claim
	 * Expenses, Either Gross Receipts or Gross Profit must be greater than zero
	 * in Point 64 in Part A P&L IndAS',true); }
	 */
}
function onStateChngPLOther() {

	var listOfTr = document.getElementById('badDebtPLOthers')
			.getElementsByTagName('tr');
	var noOfRows = eval(parseInt(listOfTr.length, 10) - 3);

	for (var i = 0; i < noOfRows; i++) {
		var state = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].stateCode')[0];
		var country = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].country')[0];
		var pinCode = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].pinCode')[0];
		var zipCode = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].zipCode')[0];

		if (state.value != '99' && state.value != '') {
			if (country.value != '91') {
				zipCode.disabled = true;
				pinCode.disabled = false;
				zipCode.value = "";

				if (country.value != '91') {
					country.value = '91'
				}

			}
		} else if (state.value == '99') {

			if (pinCode.value != null || pinCode.value != '') {
				zipCode.disabled = false;
				pinCode.disabled = true;
				pinCode.value = "";

				if (country.value == '91') {
					country.value = ''
				}

			}
		}
	}

	var listOfTrIndAs = document.getElementById('badDebtPLOthersIndAS')
			.getElementsByTagName('tr');
	var noOfRowsIndAs = eval(parseInt(listOfTrIndAs.length, 10) - 3);

	for (var i = 0; i < noOfRowsIndAs; i++) {
		var stateIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].stateCode')[0];
		var countryIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].country')[0];
		var pinCodeIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].pinCode')[0];
		var zipCodeIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].zipCode')[0];

		if (stateIndAs.value != '99' && stateIndAs.value != '') {
			if (zipCodeIndAs.value != null || zipCodeIndAs.value != '') {
				zipCodeIndAs.disabled = true;
				pinCodeIndAs.disabled = false;
				zipCodeIndAs.value = "";

				if (countryIndAs.value != '91') {
					countryIndAs.value = '91';
				}
			}
		} else if (stateIndAs.value == '99') {
			if (pinCodeIndAs.value != null || pinCodeIndAs.value != '') {
				zipCodeIndAs.disabled = false;
				pinCodeIndAs.disabled = true;
				pinCodeIndAs.value = "";

				if (countryIndAs.value == '91') {
					countryIndAs.value = '';
				}
			}
		}
	}
}
function onCountryChngPLOther() {
	var listOfTr = document.getElementById('badDebtPLOthers')
			.getElementsByTagName('tr');
	var noOfRows = eval(parseInt(listOfTr.length, 10) - 3);

	for (var i = 0; i < noOfRows; i++) {
		var state = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].stateCode')[0];
		var country = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].country')[0];
		var pinCode = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].pinCode')[0];
		var zipCode = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].zipCode')[0];

		try {
			if (country.value == '91' && state.value == "99") {
				zipCode.disabled = true;
				pinCode.disabled = false;
				state.value = "";
				zipCode.value = "";

			} else if (country.value != '' && country.value != "91") {
				zipCode.disabled = false;
				pinCode.disabled = true;
				state.value = '99';
				pinCode.value = "";

			}

		} catch (e) {
		}
	}

	var listOfTrIndAs = document.getElementById('badDebtPLOthersIndAS')
			.getElementsByTagName('tr');
	var noOfRowsIndAs = eval(parseInt(listOfTrIndAs.length, 10) - 3);

	for (var i = 0; i < noOfRowsIndAs; i++) {
		var stateIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].stateCode')[0];
		var countryIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].country')[0];
		var pinCodeIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].pinCode')[0];
		var zipCodeIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].zipCode')[0];

		try {
			if (countryIndAs.value == '91' && stateIndAs.value == "99") {

				zipCodeIndAs.disabled = true;
				pinCodeIndAs.disabled = false;
				stateIndAs.value = "";
				zipCodeIndAs.value = "";

			} else if (countryIndAs.value != '' && countryIndAs.value != "91") {

				zipCodeIndAs.disabled = false;
				pinCodeIndAs.disabled = true;
				stateIndAs.value = '99';
				pinCodeIndAs.value = "";

			}

		} catch (e) {
		}
	}

}
function setSclPLZipCodeOnLoad() {
	var table = document.getElementById('badDebtPLOthers');
	var rowCount = table.rows.length;
	var state;
	var country;

	for (var i = 0; i < rowCount - 3; i++) {

		state = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].stateCode')[0].value;
		country = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].country')[0].value;

		if (country == '91') {
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].value = '';
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].disabled = true;
		} else if (state == '99') {
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].pinCode')[0].value = '';
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].pinCode')[0].disabled = true;
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].disabled = false;
		} else {
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].value = '';
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].disabled = true;
		}
	}

	var tableIndAs = document.getElementById('badDebtPLOthersIndAS');
	var rowCountIndAs = tableIndAs.rows.length;
	var stateIndAs;
	var countryIndAs;

	for (var i = 0; i < rowCountIndAs - 3; i++) {

		stateIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].stateCode')[0].value;
		countryIndAs = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
						+ i + '].country')[0].value;

		if (countryIndAs == '91') {

			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].value = '';
			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].disabled = true;
		} else if (stateIndAs == '99') {

			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].pinCode')[0].value = '';
			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].pinCode')[0].disabled = true;
			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].disabled = false;
		} else {

			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].value = '';
			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers['
							+ i + '].zipCode')[0].disabled = true;
		}
	}

}
function importBaonLoad() {
	var tab = document.getElementById('scheduleBA');
	var allInputTags = tab.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("useForRefund$")) {
			if (allInputTags[i].value == "true") {
				allInputTags[i].checked = true;
			}
		}
	}


}

function enableBankDtlsOnload() {
	try {
		if (document
				.getElementsByName('itr.scheduleBA.foreignBankDtls[0].ibanSwiftCode')[0].value != "")
			document.getElementsByName('itr.scheduleBA.bankDtlsFlag')[0].value = 'N';
		enableTableForNRI('itr.scheduleBA.bankDtlsFlag', 'Y', 'scheduleBA');

		var tab = document.getElementById('scheduleBA');
		var allInputTags = tab.getElementsByTagName('input');

		for (var i = 0; i < allInputTags.length; i++) {
			if (allInputTags[i].name.match("useForRefund$")) {
				if (allInputTags[i].disabled == 'true') {
					allInputTags[i].checked = true;
				} else if (allInputTags[i].disabled == 'false') {
					allInputTags[i].checked = false;
				}
			}
		}
		if (document
				.getElementsByName('itr.scheduleBA.foreignBankDtls[0].ibanSwiftCode')[0].value == "") {
			enableField('itr.scheduleBA.bankDtlsFlag', 'N',
					'itr.scheduleBA.foreignBankDtls[0].ibanSwiftCode');
			enableField('itr.scheduleBA.bankDtlsFlag', 'N',
					'itr.scheduleBA.foreignBankDtls[0].bankName');
			enableField('itr.scheduleBA.bankDtlsFlag', 'N',
					'itr.scheduleBA.foreignBankDtls[0].countryCode');
			enableField('itr.scheduleBA.bankDtlsFlag', 'N',
					'itr.scheduleBA.foreignBankDtls[0].bankAccountNo');
		}

	} catch (e) {
		alert(e.stack);
	}

}

function uncheckCheckBox() {
	var tab = document.getElementById('scheduleBA');
	var allInputTags = tab.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("useForRefund$")) {
			if (allInputTags[i].checked == true
					&& allInputTags[i].value != "true") {
				allInputTags[i].checked = false;
			}
		}
	}
}
function uncheckCheckBoxOnclick() {
	var tab = document.getElementById('scheduleBA');
	var allInputTags = tab.getElementsByTagName('input');

	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("useForRefund$")) {
			if (allInputTags[i].checked == true) {
				allInputTags[i].value = "true";
			} else if (allInputTags[i].checked == false) {
				allInputTags[i].value = "false";
			}
		}
	}
}

function enable115AdP() {

	var residentialStatus = document
			.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;

	if (residentialStatus == "NRI") {

		enableTable('partAGEN1.filingStatus.residentialStatus', 'NRI',
				'Schedule115AD');
	} else {

		var tabId = "#" + "Schedule115AD";
		$(tabId).find('[type=\"checkbox\"]').attr('checked', 'checked');
		deleteRowTable('Schedule115AD', 1, 2);
		$(tabId).find(':input').prop('disabled', true);
		$(tabId).find(':input').prop('value', "");
		$(tabId).find('.addbtn').prop('hidden', true);
	}

}

function disabledpit() {
	var startUpDPIITFlag = document
			.getElementsByName('partAGEN1.filingStatus.startUpDPIITFlag')[0].value;

	if (startUpDPIITFlag == "N") {

		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.recgnNumAllottedByDPIIT')[0].readOnly = true;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.interMinisterialCertFlag')[0].disabled = true;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.certificationNumber')[0].readOnly = true;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.form2AccordPara5DPIITFlag')[0].disabled = true;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.dateOfFilingForm2')[0].disabled = true;

		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.recgnNumAllottedByDPIIT')[0].value = '';
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.interMinisterialCertFlag')[0].value = '';
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.certificationNumber')[0].value = '';
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.form2AccordPara5DPIITFlag')[0].value = '';
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.dateOfFilingForm2')[0].value = '';
	} else {
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.recgnNumAllottedByDPIIT')[0].readOnly = false;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.interMinisterialCertFlag')[0].disabled = false;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.certificationNumber')[0].readOnly = false;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.form2AccordPara5DPIITFlag')[0].disabled = false;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.dateOfFilingForm2')[0].disabled = false;

	}
	var interMinisterialCertFlag = document
			.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.interMinisterialCertFlag')[0].value;

	if (interMinisterialCertFlag == "N") {
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.certificationNumber')[0].readOnly = true;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.certificationNumber')[0].value = '';

	} else if (interMinisterialCertFlag == "Y") {
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.certificationNumber')[0].readOnly = false;

	}

	var form2AccordPara5DPIITFlag = document
			.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.form2AccordPara5DPIITFlag')[0].value;

	if (form2AccordPara5DPIITFlag == "N") {
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.dateOfFilingForm2')[0].readOnly = true;
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.dateOfFilingForm2')[0].value = '';

	} else if (form2AccordPara5DPIITFlag == "Y") {
		document
				.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.dateOfFilingForm2')[0].readOnly = false;

	}

}

function checkRepsentative() {
	try {
		var val = document
				.getElementsByName('verification.declaration.capacity')[0];
		if (val.value == "RA") {
			document.getElementsByName('partAGEN1.filingStatus.asseseeRepFlg')[0].value = 'Y';
			document.getElementsByName('partAGEN1.filingStatus.asseseeRepFlg')[0].readOnly = true;
			document.getElementsByName('partAGEN1.filingStatus.asseseeRepFlg')[0].disabled = true;
		} else {
			// document.getElementsByName('partAGEN1.filingStatus.asseseeRepFlg')[0].value='';
			document.getElementsByName('partAGEN1.filingStatus.asseseeRepFlg')[0].readOnly = false;
			document.getElementsByName('partAGEN1.filingStatus.asseseeRepFlg')[0].disabled = false;
		}

		enableField('partAGEN1.filingStatus.asseseeRepFlg', 'Y',
				'partAGEN1.filingStatus.assesseeRep.repName',
				'partAGEN1.filingStatus.assesseeRep.repCapacity',
				'partAGEN1.filingStatus.assesseeRep.repAddress',
				'partAGEN1.filingStatus.assesseeRep.repPAN',
				'partAGEN1.filingStatus.assesseeRep.repAadhaar');
	} catch (e) {
		alert(e.stack);
	}
}



function addRowToCGOnimportItr5(tableId) {
	try {
		var tab = document.getElementById(tableId);
		var body = tab.tBodies[0];
		var clone = body.cloneNode(true);
		var index = parseInt(tab.tBodies.length, 10) + 1;
		clone.rows[0].cells[0].innerHTML = index;
		var inputs = clone.getElementsByTagName('INPUT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].name = inputs[i].name.replace(/\[[\d]+\]/, '['
					+ (index - 1) + ']');
			inputs[i].value = '';
			var blurAttr = inputs[i].getAttribute('onblur');
			if (blurAttr != null) {
				blurAttr = blurAttr + ";";
			} else {
				blurAttr = "";
			}
			inputs[i].setAttribute('onblur', blurAttr
					+ 'j.blur(this,this.name,this.value);');
		}
		var selects = clone.getElementsByTagName('SELECT');
		for (var i = 0; i < selects.length; i++) {
			selects[i].name = selects[i].name.replace(/\[[\d]+\]/, '['
					+ (index - 1) + ']');
			selects[i].selectedIndex = 0;
			var blurAttr = selects[i].getAttribute('onblur');
			if (blurAttr != null) {
				blurAttr = blurAttr + ";";
			} else {
				blurAttr = "";
			}
			selects[i].setAttribute('onblur', blurAttr
					+ 'j.blur(this,this.name,this.value);');
		}
		if (tableId == 'scheduleCGstcg1') {
			if (clone.getElementsByTagName('table').length > 1) {
				var newTableId = clone.getElementsByTagName('table')[0].id
						.substring(0, 13);
				var newTableId1 = clone.getElementsByTagName('table')[1].id
						.substring(0, 14);
				clone.getElementsByTagName('table')[0].setAttribute('id',
						newTableId + '_ded' + index);
				clone.getElementsByTagName('img')[0].setAttribute('onclick',
						'addRowToTable(' + '\'' + newTableId + '_ded' + index
								+ '\',3,2,this);');
				clone.getElementsByTagName('img')[1].setAttribute('onclick',
						'deleteRowTable(' + '\'' + newTableId + '_ded' + index
								+ '\',1,2)');
				clone.getElementsByTagName('table')[1].setAttribute('id',
						newTableId1 + '_ded' + index);
				clone.getElementsByTagName('img')[2].setAttribute('onclick',
						'addRowToTable(' + '\'' + newTableId1 + '_ded' + index
								+ '\',2,1);');
				clone.getElementsByTagName('img')[3].setAttribute('onclick',
						'deleteRowTable(' + '\'' + newTableId1 + '_ded' + index
								+ '\',2,1)');
			}
		} else {
			if (tableId == 'scheduleCGltcg1') {
				if (clone.getElementsByTagName('table').length > 1) {
					var newTableId = clone.getElementsByTagName('table')[0].id
							.substring(0, 14);
					clone.getElementsByTagName('table')[0].setAttribute('id',
							newTableId + '_ded' + index);
					clone.getElementsByTagName('img')[0].setAttribute(
							'onclick', 'addRowToTable(' + '\'' + newTableId
									+ '_ded' + index + '\',3,2,this);');
					clone.getElementsByTagName('img')[1].setAttribute(
							'onclick', 'deleteRowTable(' + '\'' + newTableId
									+ '_ded' + index + '\',1,2)');
					clone.getElementsByTagName('table')[1].setAttribute('id',
							tableId + '_ded' + index);
					clone.getElementsByTagName('img')[2].setAttribute(
							'onclick', 'addRowToTable(' + '\'' + tableId
									+ '_ded' + index + '\',2,1);');
					clone.getElementsByTagName('img')[3].setAttribute(
							'onclick', 'deleteRowTable(' + '\'' + tableId
									+ '_ded' + index + '\',2,1)');
				}

			} else {

				if (clone.getElementsByTagName('table').length > 0) {
					clone.getElementsByTagName('table')[0].setAttribute('id',
							tableId + '_ded' + index);
					clone.getElementsByTagName('img')[0].setAttribute(
							'onclick', 'addRowToTable(' + '\'' + tableId
									+ '_ded' + index + '\',3,2,this);');
					clone.getElementsByTagName('img')[1].setAttribute(
							'onclick', 'deleteRowTable(' + '\'' + tableId
									+ '_ded' + index + '\',1,2)');
				}
			}

		}

		tab.appendChild(clone);
		modifyRow(tab);

		if (tableId == 'scheduleCGltcg1') {
			if (clone.getElementsByTagName('table').length > 0) {
				var newTableId = clone.getElementsByTagName('table')[0].id
						.substring(0, 14);
				var newTableId1 = tableId.substring(0, 15);
				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						true);
				deleteRowTable(newTableId + '_ded' + index, 1, 2);
				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						false);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", true);
				deleteRowTable(newTableId1 + '_ded' + index, 2, 1);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", false);
			}
		} else if (tableId == 'scheduleCGstcg1') {
			if (clone.getElementsByTagName('table').length > 0) {
				var newTableId = clone.getElementsByTagName('table')[0].id
						.substring(0, 13);
				var newTableId1 = tableId.substring(0, 14);
				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						true);
				deleteRowTable(newTableId + '_ded' + index, 1, 2);
				$('#' + newTableId + '_ded' + index + ' input').attr("checked",
						false);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", true);
				deleteRowTable(newTableId1 + '_ded' + index, 2, 1);
				$('#' + newTableId1 + '_ded' + index + ' input').attr(
						"checked", false);
			}

		} else {
			if (clone.getElementsByTagName('table').length > 0) {
				$('#' + tableId + '_ded' + index + ' input').attr("checked",
						true);
				deleteRowTable(tableId + '_ded' + index, 1, 2);
				$('#' + tableId + '_ded' + index + ' input').attr("checked",
						false);
			}
		}
	} catch (e) {
		alert(e.stack);
	}

}

function panValidationRA(tableId) {

	var assesseeVerPAN = document
			.getElementsByName('verification.declaration.assesseeVerPAN')[0].value;
	var table = document.getElementById(tableId);
	var allInputTags = table.getElementsByTagName('input');
	for (var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("doneePanNo$")) {
			if (allInputTags[i].value != ''
					&& (allInputTags[i].value == assesseeVerPAN)) {
				j
						.setFieldError(allInputTags[i].name,
								'Enter the PAN of the person to whom the donation is made.');

			}
		}
	}
}
function enableAL2() {
	var schAL2PointA = document.getElementById('schAL2PointA');
	var rowCountA = schAL2PointA.rows.length;
	var totRowA = rowCountA - 5;

	for (var i = 0; i < totRowA; i++) {
		var transferFlag = document
				.getElementsByName('scheduleAL.dtlsBldLandResHouseSU[' + i
						+ '].transferFlag')[0];
		var transferDate = document
				.getElementsByName('scheduleAL.dtlsBldLandResHouseSU[' + i
						+ '].transferDate')[0];
		if (transferFlag.value == 'Y') {
			transferDate.disabled = false;
		} else {
			transferDate.value = '';
			transferDate.disabled = true;
		}
	}

	var schAL2PointB = document.getElementById('schAL2PointB');
	var rowCountB = schAL2PointB.rows.length;
	var totRowB = rowCountB - 4;

	for (var i = 0; i < totRowB; i++) {
		var transferFlag1 = document
				.getElementsByName('scheduleAL.dtlsBldLandNotResHouseSU[' + i
						+ '].transferFlag')[0];
		var transferDate1 = document
				.getElementsByName('scheduleAL.dtlsBldLandNotResHouseSU[' + i
						+ '].transferDate')[0];
		if (transferFlag1.value == 'Y') {
			transferDate1.disabled = false;
		} else {
			transferDate1.value = '';
			transferDate1.disabled = true;
		}
	}

	var schAL2PointC = document.getElementById('schAL2PointC');
	var rowCountC = schAL2PointC.rows.length;
	var totRowC = rowCountC - 4;

	for (var i = 0; i < totRowC; i++) {
		var loansAdvancesFlag = document
				.getElementsByName('scheduleAL.dtlsLoansAdvancesSU[' + i
						+ '].loansAdvancesFlag')[0];
		var repaymentDate = document
				.getElementsByName('scheduleAL.dtlsLoansAdvancesSU[' + i
						+ '].repaymentDate')[0];
		if (loansAdvancesFlag.value == 'Y') {
			repaymentDate.disabled = false;
		} else {
			repaymentDate.value = '';
			repaymentDate.disabled = true;
		}
	}

	var schAL2PointE = document.getElementById('schAL2PointE');
	var rowCountE = schAL2PointE.rows.length;
	var totRowE = rowCountE - 4;

	for (var i = 0; i < totRowE; i++) {
		var transferFlag2 = document
				.getElementsByName('scheduleAL.dtlsAcqustSharesSecuritiesSU['
						+ i + '].transferFlag')[0];
		var transferDate2 = document
				.getElementsByName('scheduleAL.dtlsAcqustSharesSecuritiesSU['
						+ i + '].transferDate')[0];
		if (transferFlag2.value == 'Y') {
			transferDate2.disabled = false;
		} else {
			transferDate2.value = '';
			transferDate2.disabled = true;
		}
	}

	var schAL2PointF = document.getElementById('schAL2PointF');
	var rowCountF = schAL2PointF.rows.length;
	var totRowF = rowCountF - 4;

	for (var i = 0; i < totRowF; i++) {
		var transferFlag3 = document
				.getElementsByName('scheduleAL.dtlsVehiclestransportSU[' + i
						+ '].transferFlag')[0];
		var transferDate3 = document
				.getElementsByName('scheduleAL.dtlsVehiclestransportSU[' + i
						+ '].transferDate')[0];
		if (transferFlag3.value == 'Y') {
			transferDate3.disabled = false;
		} else {
			transferDate3.value = '';
			transferDate3.disabled = true;
		}
	}

	var schAL2PointG = document.getElementById('schAL2PointG');
	var rowCountG = schAL2PointG.rows.length;
	var totRowG = rowCountG - 4;

	for (var i = 0; i < totRowG; i++) {
		var transferFlag4 = document
				.getElementsByName('scheduleAL.dtlsJewelleryAcquiredSU[' + i
						+ '].transferFlag')[0];
		var transferDate4 = document
				.getElementsByName('scheduleAL.dtlsJewelleryAcquiredSU[' + i
						+ '].transferDate')[0];
		if (transferFlag4.value == 'Y') {
			transferDate4.disabled = false;
		} else {
			transferDate4.value = '';
			transferDate4.disabled = true;
		}
	}

	var schAL2PointH = document.getElementById('schAL2PointH');
	var rowCountH = schAL2PointH.rows.length;
	var totRowH = rowCountH - 4;

	for (var i = 0; i < totRowH; i++) {
		var transferFlag5 = document
				.getElementsByName('scheduleAL.dtlsArchaeologicalCollctSU[' + i
						+ '].transferFlag')[0];
		var transferDate5 = document
				.getElementsByName('scheduleAL.dtlsArchaeologicalCollctSU[' + i
						+ '].transferDate')[0];
		if (transferFlag5.value == 'Y') {
			transferDate5.disabled = false;
		} else {
			transferDate5.value = '';
			transferDate5.disabled = true;
		}
	}

}

function getPercentOfSharecg(tableId) {
	var tab = document.getElementById(tableId);
	var inputs = tab.getElementsByTagName('input');
	var foreignPerc = 0;

	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name != undefined
				&& inputs[i].name.match('percentageShare$')) {

			var index = inputs[i].name.substr(
					eval(inputs[i].name.indexOf("[")) + 1, 1);
			foreignPerc = eval(foreignPerc + (mulFloatBy100(inputs[i].value)));

		}
	}
	return {
		'foreignPerc' : foreignPerc / 100
	};
}

function validatePercentA1B1() {
	var table = document.getElementById('scheduleCGstcg1');
	var noOfRows = table.rows.length;
	var total = 0.0;
	for (var i = 0; i < noOfRows / 14; i++) {
		var tableId = 'scheduleCGstcg_ded' + (i + 1);
		var shares = getPercentOfSharecg(tableId);

		if (parseFloat(shares.foreignPerc) > 100) {
			j
					.setFieldError('',
							'Total Percentage share cannot be more than 100% in table A1f in schedule CG');
			addErrorXHTML(document.getElementsByName('')[0],
					'Sum of percentage share  cannot be more than 100% in table A1f in schedule CG');
		}
		if (parseFloat(shares.foreignPerc) != 100
				&& parseFloat(shares.foreignPerc) > 0) {
			j
					.setFieldError('',
							'Total Percentage share should be exactly 100% in table A1f in schedule CG');
			addErrorXHTML(document.getElementsByName('')[0],
					'Sum of percentage share should be equal to 100% in table A1f in schedule CG');
		}

	}

	var table1 = document.getElementById('scheduleCGltcg1');
	var noOfRows1 = table1.rows.length;
	var total1 = 0.0;
	for (var i = 0; i < noOfRows1 / 14; i++) {
		var tableId = 'scheduleCGltcg1_ded' + (i + 1);
		var shares = getPercentOfSharecg(tableId);

		if (parseFloat(shares.foreignPerc) > 100) {
			j
					.setFieldError('',
							'Total Percentage share cannot be more than 100% in table B1f in schedule CG');
			addErrorXHTML(document.getElementsByName('')[0],
					'Sum of percentage share  cannot be more than 100% in table B1f in schedule CG');
		}

		if (parseFloat(shares.foreignPerc) != 100
				&& parseFloat(shares.foreignPerc) > 0) {
			j
					.setFieldError('',
							'Total Percentage share shoule be exactly 100% in table B1f in schedule CG');
			addErrorXHTML(document.getElementsByName('')[0],
					'Sum of percentage share should be equal to 100% in table B1f in schedule CG');
		}

	}

}

function ComparePLGrsRcptAndPrft() {

	coalesceSetRet('partapl.debitsToPL.debitPlAcnt.grossReceipts');
	var grossReceipts = document
			.getElementsByName('partapl.debitsToPL.debitPlAcnt.grossReceipts')[0].value;
	var netProfit = document
			.getElementsByName('partapl.debitsToPL.debitPlAcnt.netProfit')[0].value;

	if (netProfit > grossReceipts) {
		j.setFieldError('',
				'62b can not be more than 62a in Schedule Profit & Loss');
		addErrorXHTML(document.getElementsByName('')[0],
				'62b can not be more than 62a in Schedule Profit & Loss');
	}

	/*
	 * var grossReceipts64ia =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.grossReceipts64ia')[0].value;
	 * var grossReceipts64ib =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.grossReceipts64ib')[0].value;
	 * var expenses =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngBuss.expenses')[0].value;
	 * 
	 * if (expenses > 0) { if ((grossReceipts64ia + grossReceipts64ib) == 0) {
	 * j.setFieldError('','In order to claim Expenses, Either Gross Receipts or
	 * Gross Profit must be greater than zero in Point 64 in Part A P&L IndAS');
	 * addErrorXHTML(document.getElementsByName('')[0],'In order to claim
	 * Expenses, Either Gross Receipts or Gross Profit must be greater than zero
	 * in Point 64 in Part A P&L IndAS'); } }
	 */

	/*
	 * var grossReceipts64ia2 =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.grossReceipts64ia')[0].value;
	 * var grossReceipts64ib2 =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.grossReceipts64ib')[0].value;
	 * var expenses2 =
	 * document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.regularBookOfAccount.assessCarrngProf.expenses')[0].value;
	 * 
	 * 
	 * if (expenses2 > 0) { if ((grossReceipts64ia2 + grossReceipts64ib2) == 0) {
	 * j.setFieldError('','In order to claim Expenses, Either Gross Receipts or
	 * Gross Profit must be greater than zero in Point 64 in Part A P&L IndAS');
	 * addErrorXHTML(document.getElementsByName('')[0],'In order to claim
	 * Expenses, Either Gross Receipts or Gross Profit must be greater than zero
	 * in Point 64 in Part A P&L IndAS'); } }
	 */

}

function othergener() {
	var partaoth = document.getElementById('othSecDateTabId1');

	var noOfRows = partaoth.rows.length;

	for (var i = 0; i < noOfRows - 2; i++) {

		var nature = document.getElementsByName('partAGEN2.auditReportDetails['
				+ i + '].auditReportAct')[0].value;

		if (nature == '19') {
			document.getElementsByName('partAGEN2.auditReportDetails[' + i
					+ '].auditReportActOthers')[0].disabled = false;
			document.getElementsByName('partAGEN2.auditReportDetails[' + i
					+ '].auditReportActOthers')[0].readOnly = false;

		} else {
			document.getElementsByName('partAGEN2.auditReportDetails[' + i
					+ '].auditReportActOthers')[0].disabled = true;
			document.getElementsByName('partAGEN2.auditReportDetails[' + i
					+ '].auditReportActOthers')[0].readOnly = true;

			document.getElementsByName('partAGEN2.auditReportDetails[' + i
					+ '].auditReportActOthers')[0].value = '';
		}

	}
}

function othergener1() {
	var partaoth = document.getElementById('othSecDateTabId1');

	var noOfRows = partaoth.rows.length;

	for (var i = 0; i < noOfRows - 2; i++) {

		var natureothr = document
				.getElementsByName('partAGEN2.auditReportDetails[' + i
						+ '].auditReportActOthers')[0].value;
		var nature = document.getElementsByName('partAGEN2.auditReportDetails['
				+ i + '].auditReportAct')[0].value;

		if (nature == '19' && (natureothr == null || natureothr == '')) {
			addErrorXHTML('',
					'Please enter the description in audit report details.');

			j.setFieldError('partAGEN2.auditReportDetails[' + i
					+ '].auditReportActOthers',
					'Please enter the description in audit report details.');

			return;

		}

	}
}

function sysDateCompOfDOF()
{
	var date = document.getElementsByName('partAGEN1.filingStatus.origRetFiledDate')[0].value;
	var verficationDate=document.getElementsByName('verification.date')[0].value;
	if (date!=verficationDate && checkFirstDateBefore(verficationDate, date)) {
		j.setFieldError('partAGEN1.filingStatus.origRetFiledDate','In schedule Part A-General Date of filing of original return can not be more than system date.');
		addErrorXHTML( document.getElementsByName('partAGEN1.filingStatus.origRetFiledDate')[0],
				'In schedule Part A-General Date of filing of original return can not be more than system date.',	true);
	}
}
function sysDateCompOfSchDDT() {
	
	var table = document.getElementById('scheduleDDT');
	var noOfRows = table.rows.length;
	for (var i = 0; i < eval(parseInt(noOfRows, 10) - 4); i++) {
		var date = document.getElementsByName('scheduleDDT.ddt[' + i
					+ '].dateOfDeclareDividProfDomesComp')[0].value;
		if (date != getCurrentDate()
				&& checkFirstDateBefore(getCurrentDate(), date)) {
			j
					.setFieldError(
							'',
							'In schedule DDT Date of declaration or distribution or payment, whichever is earliest, of dividend by domestic company can not be more than system date.');
			addErrorXHTML('',
					'In schedule DDT Date of declaration or distribution or payment, whichever is earliest, of dividend by domestic company can not be more than system date.',
					true);
		}
	}
}
function sysDateCompOfResToNotice() {
	var date = document
			.getElementsByName('partAGEN1.filingStatus.returnFileSec.noticeDate')[0].value;
	if (date != getCurrentDate()
			&& checkFirstDateBefore(getCurrentDate(), date)) {
		j
				.setFieldError(
						'partAGEN1.filingStatus.returnFileSec.noticeDate',
						'In schedule Part A-General date of notice/order or date of advance pricing agreement can not be more than system date.');
		addErrorXHTML(
				document
						.getElementsByName('partAGEN1.filingStatus.returnFileSec.noticeDate')[0],
				'In schedule Part A-General date of notice/order or date of advance pricing agreement can not be more than system date.',
				true);
	}
}

function dropDownChange() {
	var unlistedFlag = document
			.getElementsByName('partAGEN2For6.natureOfComp.unlisted')[0].value;
	var form2AccordPara5DPIITFlag = document
			.getElementsByName('partAGEN1.filingStatus.startUpDPIITDtls.form2AccordPara5DPIITFlag')[0].value;
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	var sec581AFlag = document
			.getElementsByName('partAGEN1.filingStatus.sec581AFlag')[0].value;

	if (form2AccordPara5DPIITFlag == 'N' || form2AccordPara5DPIITFlag == '') {

		if (unlistedFlag == 'N') {
			if (domesticCompFlg == 'Y') {
				if (sec581AFlag == 'N') {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					al2Disable();
					sh1Disable();
					al1Disable();

				} else {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					al2Disable();
					sh1Disable();
					al1Disable();
				}

			} else {

				if (sec581AFlag == 'N') {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					al2Disable();
					sh1Disable();
					al1Disable();

				} else {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = true;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					al2Disable();
					sh1Disable();
					al1Disable();

				}

			}

		} else {

			if (domesticCompFlg == 'Y') {

				if (sec581AFlag == 'N') {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					if (document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value == 'Y') {
						al1Enable();

					} else {

						al1Disable();

					}
					if (document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value == 'N') {
						sh1Enable();

					} else {

						sh1Disable();

					}

					al2Disable();

				} else {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					if (document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value == 'Y') {
						al1Enable();

					} else {

						al1Disable();

					}
					if (document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value == 'N') {
						sh1Enable();

					} else {

						sh1Disable();

					}
					al2Disable();
				}

			} else {

				if (sec581AFlag == 'N') {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					if (document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value == 'Y') {
						al1Enable();

					} else {

						al1Disable();

					}
					if (document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value == 'N') {
						sh1Enable();

					} else {

						sh1Disable();

					}
					al2Disable();
				} else {
					document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = false;
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = '';
					document
							.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = true;
					if (document
							.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value == 'Y') {
						al1Enable();

					} else {

						al1Disable();

					}
					if (document
							.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value == 'N') {
						sh1Enable();

					} else {

						sh1Disable();

					}
					al2Disable();
				}

			}

		}

	} else {
		document.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value = '';
		document.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value = '';
		document.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].disabled = true;
		document.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].disabled = true;
		document.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].disabled = false;
		al1Disable();
		sh1Disable();

		if (document.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value == 'Y') {
			al2Enable();

		} else {

			al2Disable();

		}

	}

}

function onImportOfALandSHSchedule() {
	var schALPointA = checkRowBlank('schALPointA', 2, 1);
	var schALPointB = checkRowBlank('schALPointB', 2, 1);
	var schALPointC = checkRowBlank('schALPointC', 2, 1);
	var schALPointD = checkRowBlank('schALPointD', 2, 1);
	var schALPointE = checkRowBlank('schALPointE', 2, 1);
	var schALPointF = checkRowBlank('schALPointF', 2, 1);
	var schALPointG = checkRowBlank('schALPointG', 2, 1);
	var schALPointH = checkRowBlank('schALPointH', 2, 1);
	var schALPointI = checkRowBlank('schALPointI', 2, 1);
	var schALPointJ = checkRowBlank('schALPointJ', 2, 1);

	if (!schALPointA || !schALPointB || !schALPointC || !schALPointD
			|| !schALPointE || !schALPointF || !schALPointG || !schALPointH
			|| !schALPointI || !schALPointJ) {
		document.getElementsByName('scheduleAL1.dropDownMandatoryCheck')[0].value = 'Y';
	}

	var schAL2PointA = checkRowBlank('schAL2PointA', 2, 1);
	var schAL2PointB = checkRowBlank('schAL2PointB', 2, 1);
	var schAL2PointC = checkRowBlank('schAL2PointC', 2, 1);
	var schAL2PointD = checkRowBlank('schAL2PointD', 2, 1);
	var schAL2PointE = checkRowBlank('schAL2PointE', 2, 1);
	var schAL2PointF = checkRowBlank('schAL2PointF', 2, 1);
	var schAL2PointG = checkRowBlank('schAL2PointG', 2, 1);
	var schAL2PointH = checkRowBlank('schAL2PointH', 2, 1);
	var schAL2PointI = checkRowBlank('schAL2PointI', 2, 1);
	if (!schAL2PointA || !schAL2PointB || !schAL2PointC || !schAL2PointD
			|| !schAL2PointE || !schAL2PointF || !schAL2PointG || !schAL2PointH
			|| !schAL2PointI) {
		document.getElementsByName('scheduleAL2.dropDownMandatoryCheck')[0].value = 'Y';

	}
	var schSHPointA = checkRowBlank('schSHPointA', 2, 1);
	var schSHPointB = checkRowBlank('schSHPointB', 2, 1);
	var schSHPointC = checkRowBlank('schSHPointC', 2, 1);
	if (!schSHPointA || !schSHPointB || !schSHPointC) {
		document.getElementsByName('scheduleSH1.dropDownMandatoryCheck')[0].value = 'N';

	}

}

function al2Disable() {
	var tab = document.getElementById('schAL2PointA');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schAL2PointB');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schAL2PointC');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}

	var tab = document.getElementById('schAL2PointD');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schAL2PointE');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schAL2PointF');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schAL2PointG');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schAL2PointH');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schAL2PointI');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
}

function al2Enable() {
	var tab = document.getElementById('schAL2PointA');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}

	var tab = document.getElementById('schAL2PointB');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schAL2PointC');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}

	var tab = document.getElementById('schAL2PointD');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schAL2PointE');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("sharesSecuritiesTypeOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schAL2PointF');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("assetParticularsOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schAL2PointG');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schAL2PointH');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("assetParticularsOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schAL2PointI');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
}

function sh1Disable() {
	var tab = document.getElementById('schSHPointA');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schSHPointB');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schSHPointC');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
}

function sh1Enable() {
	var tab = document.getElementById('schSHPointA');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("shareTypeOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schSHPointB');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("shareTypeOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schSHPointC');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
}

function al1Disable() {
	var tab = document.getElementById('schALPointA');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointB');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointC');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}

	var tab = document.getElementById('schALPointD');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointE');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointF');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointG');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointH');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointI');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
	var tab = document.getElementById('schALPointJ');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].value = '';
		inputs[i].readonly = true;
		inputs[i].disabled = true;

	}
	for (var i = 0; i < selects.length; i++) {
		selects[i].value = '';
		selects[i].disabled = true;

	}
}

function al1Enable() {

	var tab = document.getElementById('schALPointA');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointB');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointC');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}

	var tab = document.getElementById('schALPointD');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointE');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("securitiesTypeOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointF');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointG');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointH');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("assetParticularsOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointI');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].name.match("assetParticularsOthers$")) {
			inputs[i].readonly = true;
			inputs[i].disabled = true;
			continue;
		}
		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
	var tab = document.getElementById('schALPointJ');
	var inputs = tab.getElementsByTagName('INPUT');
	var selects = tab.getElementsByTagName('SELECT');
	for (var i = 0; i < inputs.length; i++) {

		inputs[i].readonly = false;
		inputs[i].disabled = false;

	}
	for (var i = 0; i < selects.length; i++) {

		selects[i].disabled = false;

	}
}

/*
 * function scheduleSI115BEditable() { var compnyType=
 * document.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
 * var flag115BA =
 * document.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
 * var netTxblIncome = zeroOrMore( eval(
 * parseInt(coalesceSetRet('partBTI.incChargeableTaxNormalRates'),10))); var
 * incTax =
 * document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates')[0];
 * var specialRateTax =
 * document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates')[0];
 * 
 * if(compnyType == 'Y' && flag115BA == 'Y'){
 * setEditableFieldValue(specialRateTax,
 * eval(parseInt(coalesceSetRet('scheduleSI.totSplRateIncTax'),10)));
 * setEditableFieldValue(incTax, calculateTaxPayableOnTotalInc(netTxblIncome));
 * }else { specialRateTax.value =
 * eval(parseInt(coalesceSetRet('scheduleSI.totSplRateIncTax'),10));
 * incTax.value = calculateTaxPayableOnTotalInc(netTxblIncome); } }
 */

function enableTRCFlagSTCG() {
	var tab = document.getElementById('scheduleStcgDtaa');
	var rowcount = tab.rows.length;

	for (var j = 0; j < parseInt(rowcount - 2); j++) {
		if (document
				.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value == 'NRI') {
			document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ j + '].taxResidCertFlag')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ j + '].taxResidCertFlag')[0].disabled = true;
			document
					.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.stcgUnderDtaa['
							+ j + '].taxResidCertFlag')[0].value = '';
		}
	}
	populateRateSTCG();
	validateSchCGSTCGAmt();
}

function enableTRCFlagLTCG() {
	var tab = document.getElementById('scheduleLtcgDtaa');
	var rowcount = tab.rows.length;


	for (var j = 0; j < parseInt(rowcount - 2); j++) {
	
		  if(document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value ==
		 'NRI') { 
		 
		  document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['+j+'].taxResidCertFlag')[0].disabled=false; }
		  else {
		  document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['+j+'].taxResidCertFlag')[0].disabled=true;
		  document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.ltcgUnderDtaa['+j+'].taxResidCertFlag')[0].value=''; }
		 
	}
	populateRateLTCG();
	validateSchCGLTCGAmt();
}
function enableTRCFlagOS()

{
	var tab = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowcount = tab.rows.length;
	for (var j = 0; j < parseInt(rowcount - 2); j++) {
		if (document
				.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value == 'NRI') {
			document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ j + '].taxResidCertFlag')[0].disabled = false;
		} else {
			document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ j + '].taxResidCertFlag')[0].disabled = true;
			document
					.getElementsByName('scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ j + '].taxResidCertFlag')[0].value = '';
		}
	}
	populateRateOS();

}
function calculatePercentageSharePrpty()
{
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);

	for (var i = 0; i < totHp; i++) {
		var tempName = 'scheduleHP.propertyDetails[' + i + '].propCoOwnedFlg';
		var val = document.getElementsByName(tempName)[0].value;
		var assessePercentShareProp = 100;
		if (val == 'YES') {
			var tab = document.getElementById('scheduleHP' + eval(parseInt(i) + 1));
			var rowcount = tab.rows.length;
			for (var j = 0; j <rowcount-2; j++) {
				assessePercentShareProp=eval(eval(coalesce(assessePercentShareProp))-
				eval(coalesce(document.getElementsByName('scheduleHP.propertyDetails[' + i
						+ '].coOwners[' + j + '].percentShareProperty')[0].value)));
				
			}
			document
			.getElementsByName('scheduleHP.propertyDetails[' + i
					+ '].asseseeShareProperty')[0].value=assessePercentShareProp.toFixed(2);
		}
	}
}
function selfOccupiedPrprtyCheck()
{
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);
	var count=0;
	for (var i = 0; i < totHp; i++) {
		var tempName = 'scheduleHP.propertyDetails[' + i + '].ifLetOut';
		var val = document.getElementsByName(tempName)[0].value;
		if(val=='N')
		{
			count++;
		}
	}
	if(count>2)
	{
		j.setFieldError('','Where there is more than one Self occupied House property(SOP) , one of them shall be treated as SOP and all other House properties shall be deemed to be let out');
		addErrorXHTML('','Where there is more than one Self occupied House property(SOP) , one of them shall be treated as SOP and all other House properties shall be deemed to be let out',true);
	}
}

function intrstBorowdCheck()
{

	var tab = document.getElementById('scheduleHPMain');
	var selectTags = tab.getElementsByTagName('select');
	var sumIntrst=parseInt('0', 10);
	for (var i = 0; i < selectTags.length; i++) {
		var selfoccupiedFlag = false;
		if (selectTags[i].name.match("ifLetOut$")) {
			var index = parseInt(selectTags[i].name.substring(selectTags[i].name.indexOf("[") + 1, selectTags[i].name.indexOf("]")));
			if (selectTags[i].value == "N") {
				selfoccupiedFlag=true;
			}
		}
		if(selfoccupiedFlag)
		{
				var intOnBorwCap = document.getElementsByName('scheduleHP.propertyDetails['+index+'].rentdetails.intOnBorwCap')[0];
				sumIntrst=eval(parseInt(coalesce(sumIntrst),10)+parseInt(coalesce(intOnBorwCap.value),10));
				if(sumIntrst >200000)
				{
					j.setFieldError(document.getElementsByName('scheduleHP.propertyDetails['+index+'].rentdetails.intOnBorwCap')[0],
							'Interest cannot be more than Rs. 2,00,000 for category self-occupied in schedule HP.');
					addErrorXHTML('','Interest cannot be more than Rs. 2,00,000 for category self-occupied in schedule HP.',true);
				}
		}
	}
}
function CheckHPShareProperty() {
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);

	for (var i = 0; i < totHp; i++) {

		if (document.getElementsByName('scheduleHP.propertyDetails[' + i
				+ '].propCoOwnedFlg')[0].value == 'YES') {
			var count = i;
			var AssessPerc = document
					.getElementsByName('scheduleHP.propertyDetails[' + i
							+ '].asseseeShareProperty')[0];
			var tab = document.getElementById('scheduleHP' + (++count));

			var sumOfCoOwner = parseFloat('0');

			var rowCount = tab.rows.length;

			for (var k = 0; k < rowCount - 2; k++) {

				sumOfCoOwner = sumOfCoOwner
						+ (mulFloatBy100(document
								.getElementsByName('scheduleHP.propertyDetails['
										+ i
										+ '].coOwners['
										+ k
										+ '].percentShareProperty')[0].value));
			}

			if (checkHPShareSum((parseInt(sumOfCoOwner) + mulFloatBy100(AssessPerc.value)) / 100)) {
				addErrorXHTML(
						AssessPerc,
						'Sum of Assessee Percentage and Co-owner(s) Percentage should be equal to 100 percent',
						true);
				j
						.setFieldError(
								'scheduleHP.propertyDetails[' + i
										+ '].asseseeShareProperty',
								'Sum of Assessee Percentage and Co-owner(s) Percentage should be equal to 100 percent');
			}
		}
	}
}

// To check schedule HP Share Sum value
function checkHPShareSum(total) {
	if (total >= 99.9 && total <= 100) {
		return false;
	}
	return true;
}





function calcTotSchPL47i(){
	var amtTotal = parseInt('0' ,10);
	var tabl = document.getElementById('badDebtPL');
	var allInputTags = tabl.getElementsByTagName('input');

	for(var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal ,10) + parseInt(isNVL(allInputTags[i].value) ,10));
		}
	}
	document.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls.total')[0].value = amtTotal;
}

function calcTotSchPL47ii(){
	var amtTotal = parseInt('0' ,10);
	var tabl = document.getElementById('badDebtPLOthers');
	var allInputTags = tabl.getElementsByTagName('input');

	for(var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal ,10) + parseInt(isNVL(allInputTags[i].value) ,10));
		}
	}
	document.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers.total')[0].value = amtTotal;	
}


function calcTotSchPLINDAS47i(){
	var amtTotal = parseInt('0' ,10);
	var tabl = document.getElementById('badDebtAmtDtls');
	var allInputTags = tabl.getElementsByTagName('input');

	for(var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal ,10) + parseInt(isNVL(allInputTags[i].value) ,10));
		}
	}
	document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls.total')[0].value = amtTotal;
}

function calcTotSchPLINDAS47ii(){
	var amtTotal = parseInt('0' ,10);
	var tabl = document.getElementById('badDebtPLOthersIndAS');
	var allInputTags = tabl.getElementsByTagName('input');

	for(var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("amount$")) {
			amtTotal = eval(parseInt(amtTotal ,10) + parseInt(isNVL(allInputTags[i].value) ,10));
		}
	}
	document.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtlsOthers.total')[0].value = amtTotal;	
}



/*function panAadharCheckSH() {
	panAadharCheckschSHPointA();
	panAadharCheckschSHPointB();
	panAadharCheckschSHPointC();
	panAadharCheckschSHPointCPart2();
	
	panAadharCheckschSH2PointA();
	panAadharCheckschSH2PointB();
	panAadharCheckschSH2PointC();
	panAadharCheckschSH2PointCPart2();
}*/
/*
function panAadharCheckschSHPointA() {

	var schSHPointA = checkRowBlank('schSHPointA', 2, 1);

	if (!schSHPointA) {

		var tab = document.getElementById('schSHPointA');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 4); i++) {

			if (document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC['
							+ i + '].pan')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC['
								+ i + '].aadhaar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngUnlistedCompany.dtlsSHEndPreviousYearUC['
											+ j + '].pan',
									'Please enter either Pan or Aadhaar Number in table A of Schedule SH-1.');
					addErrorXHTML('',
							'Please enter either Pan or Aadhaar Number in table A of Schedule SH-1.');

				}
			}
		}

	}

}

function panAadharCheckschSHPointB() {

	var schSHPointB = checkRowBlank('schSHPointB', 2, 1);

	if (!schSHPointB) {

		var tab = document.getElementById('schSHPointB');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 4); i++) {

			if (document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsEquityShareEndPrvYr['
							+ i + '].pan')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngUnlistedCompany.dtlsEquityShareEndPrvYr['
								+ i + '].aadhaar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngUnlistedCompany.dtlsEquityShareEndPrvYr['
											+ j + '].pan',
									'Please enter either Pan or Aadhaar Number in table B of Schedule SH-1.');
					addErrorXHTML('',
							'Please enter either Pan or Aadhaar Number in table B of Schedule SH-1.');

				}
			}
		}
	}
}

function panAadharCheckschSHPointC() {

	var schSHPointC = checkRowBlank('schSHPointC', 2, 1);

	if (!schSHPointC) {

		var tab = document.getElementById('schSHPointC');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 4); i++) {

			if (document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.sHDtlsAnyTimePrevYearUC['
							+ i + '].pan')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngUnlistedCompany.sHDtlsAnyTimePrevYearUC['
								+ i + '].aadhaar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngUnlistedCompany.sHDtlsAnyTimePrevYearUC['
											+ j + '].pan',
									'Please enter either Pan or Aadhaar Number in table C of Schedule SH-1.');
					addErrorXHTML('',
							'Please enter either Pan or Aadhaar Number in table C of Schedule SH-1.');

				}
			}
		}
	}
}

function panAadharCheckschSHPointCPart2() {

	var schSHPointC = checkRowBlank('schSHPointC', 2, 1);

	if (!schSHPointC) {

		var tab = document.getElementById('schSHPointC');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 4); i++) {
			if (document
					.getElementsByName('scheduleSH.shrhldngUnlistedCompany.sHDtlsAnyTimePrevYearUC['
							+ i + '].newShareholderPAN')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngUnlistedCompany.sHDtlsAnyTimePrevYearUC['
								+ i + '].newShareholderAadhaar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngUnlistedCompany.sHDtlsAnyTimePrevYearUC['
											+ j + '].newShareholderPAN',
									'Please enter either Pan or Aadhaar Number of new shareHolder in table C of Schedule SH-1.');
					addErrorXHTML(
							'',
							'Please enter either Pan or Aadhaar Number of new shareHolder in table C of Schedule SH-1.');

				}
			}
		}
	}
}



//sh-2 pan aadhaar check


function panAadharCheckschSH2PointA() {

	var schSH2PointA = checkRowBlank('schSH2PointA', 2, 1);

	if (!schSH2PointA) {

		var tab = document.getElementById('schSH2PointA');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 5); i++) {

			if (document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU['
							+ i + '].pan')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU['
								+ i + '].aadhaar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngStartUps.dtlsSHEndPreviousYearSU['
											+ j + '].pan',
									'Please enter either Pan or Aadhaar Number in table A of Schedule SH-2.');
					addErrorXHTML('',
							'Please enter either Pan or Aadhaar Number in table A of Schedule SH-2.');

				}
			}
		}

	}

}

function panAadharCheckschSH2PointB() {

	var schSH2PointB = checkRowBlank('schSH2PointB', 2, 1);

	if (!schSH2PointB) {

		var tab = document.getElementById('schSH2PointB');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 4); i++) {

			if (document
					.getElementsByName('scheduleSH.shrhldngStartUps.dtlsShareAppMoneyAlltEndPrvYr['
							+ i + '].pan')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngStartUps.dtlsShareAppMoneyAlltEndPrvYr['
								+ i + '].aadhaar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngStartUps.dtlsShareAppMoneyAlltEndPrvYr['
											+ j + '].pan',
									'Please enter either Pan or Aadhaar Number in table B of Schedule SH-2.');
					addErrorXHTML('',
							'Please enter either Pan or Aadhaar Number in table B of Schedule SH-2.');

				}
			}
		}
	}
}

function panAadharCheckschSH2PointC() {

	var schSH2PointC = checkRowBlank('schSH2PointC', 2, 1);

	if (!schSH2PointC) {

		var tab = document.getElementById('schSH2PointC');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 4); i++) {

			if (document
					.getElementsByName('scheduleSH.shrhldngStartUps.sHDtlsAnyTimePrevYearSU['
							+ i + '].pan')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngStartUps.sHDtlsAnyTimePrevYearSU['
								+ i + '].aadhaar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngStartUps.sHDtlsAnyTimePrevYearSU['
											+ j + '].pan',
									'Please enter either Pan or Aadhaar Number in table C of Schedule SH-2.');
					addErrorXHTML('',
							'Please enter either Pan or Aadhaar Number in table C of Schedule SH-2.');

				}
			}
		}
	}
}

function panAadharCheckschSH2PointCPart2() {

	var schSH2PointC = checkRowBlank('schSH2PointC', 2, 1);

	if (!schSH2PointC) {

		var tab = document.getElementById('schSH2PointC');
		var rowcount = tab.rows.length;
		for (var i = 0; i < parseInt(rowcount - 4); i++) {
			if (document
					.getElementsByName('scheduleSH.shrhldngStartUps.sHDtlsAnyTimePrevYearSU['
							+ i + '].newShareholderPAN')[0].value == '') {

				if (document
						.getElementsByName('scheduleSH.shrhldngStartUps.sHDtlsAnyTimePrevYearSU['
								+ i + '].newShareholderaadhar')[0].value == '') {
					j
							.setFieldError(
									'scheduleSH.shrhldngStartUps.sHDtlsAnyTimePrevYearSU['
											+ j + '].newShareholderPAN',
									'Please enter either Pan or Aadhaar Number of new shareHolder in table C of Schedule SH-2.');
					addErrorXHTML(
							'',
							'Please enter either Pan or Aadhaar Number of new shareHolder in table C of Schedule SH-2.');

				}
			}
		}
	}
}
*/

function tpsaBasedOnOIFlag() {
	var assesseeSubsection92ce = document
			.getElementsByName('partaoi.assesseeSubsection92ce')[0];

	if (assesseeSubsection92ce.value == "N") {
		var tab = document.getElementById('scheduleTPSA');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			inputs[i].value = '';
			inputs[i].readonly = true;
			inputs[i].disabled = true;
		}
		for (var i = 0; i < selects.length; i++) {
			selects[i].value = '';
			selects[i].disabled = true;

		}

	}else {
		
		var tab = document.getElementById('scheduleTPSA');
		var inputs = tab.getElementsByTagName('INPUT');
		var selects = tab.getElementsByTagName('SELECT');
		for (var i = 0; i < inputs.length; i++) {
			//inputs[i].value = '';
			inputs[i].readonly = false;
			inputs[i].disabled = false;
		}
		for (var i = 0; i < selects.length; i++) {
			//selects[i].value = '';
			selects[i].disabled = false;

		}
		alert('i el;se')
	}
	}

function calTotAmtTPSA(){
	
	
	var table=document.getElementById('scheduleTPSADtlsTbl');
        var noOfRows=table.rows.length;
        var indexValue=eval(((parseInt(noOfRows,10)-4)));
        var sum = 0;
        var totalTaxPayments= document.getElementsByName('scheduleTPSA.taxPayment.totalTaxPayments')[0];
        for(var i=0;i<indexValue;i++){
        	
        	var amount = document.getElementsByName('scheduleTPSA.taxPayment['+i+'].amt')[0].value;
        	sum = eval(parseInt(coalesce(sum,10))) + eval(parseInt(coalesce(amount,10)));
        }

        totalTaxPayments.value =  eval(parseInt(coalesce(sum,10)));
        calcSchTPSA();
}

function calcSchTPSA(){
	
	coalesceSetRet('scheduleTPSA.amount');
	coalesceSetRet('scheduleTPSA.addlIncome');
	coalesceSetRet('scheduleTPSA.surcharge');
	coalesceSetRet('scheduleTPSA.healthEdu');
	coalesceSetRet('scheduleTPSA.total');
	coalesceSetRet('scheduleTPSA.taxesPaid');
	coalesceSetRet('scheduleTPSA.taxPayment.totalTaxPayments');
	coalesceSetRet('scheduleTPSA.taxpayable');
	
	var amount = document.getElementsByName('scheduleTPSA.amount')[0].value;
	var addlIncome = document.getElementsByName('scheduleTPSA.addlIncome')[0];
	addlIncome.value = Math.round(0.18 * parseInt(coalesce(amount), 10));
	
	var surcharge = document.getElementsByName('scheduleTPSA.surcharge')[0];
	surcharge.value = Math.round(0.12 * parseInt(coalesce(addlIncome.value), 10));
	
	var healthEdu = document.getElementsByName('scheduleTPSA.healthEdu')[0];
	healthEdu.value = Math.round(0.04 * (parseInt(coalesce(addlIncome.value), 10) + parseInt(coalesce(surcharge.value), 10)));
	
	var total = document.getElementsByName('scheduleTPSA.total')[0];
	total.value = parseInt(addlIncome.value,10) + parseInt(surcharge.value,10) + parseInt(healthEdu.value,10);
	//total.value = parseInt(coalesce(addlIncome.value), 10) + parseInt(coalesce(surcharge.value), 10)) + parseInt(coalesce(healthEdu.value), 10));
	
	var taxesPaid = document.getElementsByName('scheduleTPSA.taxesPaid')[0];
	taxesPaid.value = document.getElementsByName('scheduleTPSA.taxPayment.totalTaxPayments')[0].value;
	
	var taxpayable = document.getElementsByName('scheduleTPSA.taxpayable')[0];
	taxpayable.value = zeroOrMore(parseInt(total.value, 10) - parseInt(taxesPaid.value, 10));
	
}


function validateScheduleVIA()
{
	
	var totalDeductionPartb = document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.totalDeductionPartb')[0];

var totalDeductionPartC = document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.totalDeductionPartC')[0];













var total=eval(parseInt(coalesce(totalDeductionPartb.value), 10)
				+ parseInt(coalesce(totalDeductionPartC.value), 10));
	if(total>0 && document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.invsFlag')[0].value=='')
	{
		j.setFieldError('scheduleVIA.usrDeductUndChapVIA.invsFlag','Please select drop down in field Whether, you have made any investment/ deposit/ payments between 01.04.2020 to 31.07.2020 for the purpose of claiming any deduction under Part B of Chapter VIA?');
		addErrorXHTML(document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.invsFlag')[0],'Please select drop down in field Whether, you have made any investment/ deposit/ payments between 01.04.2020 to 31.07.2020 for the purpose of claiming any deduction under Part B of Chapter VIA?',true);
	}
}


function disableSch80(){
	var tab1 = document.getElementById('page32');
	
	var status = document.getElementsByName('partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;
	var allInputTags1 = tab1.getElementsByTagName('input');
	var flag115BA = document
	.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	
	for (var i = 0; i < allInputTags1.length; i++) {
		if (status=='12' || flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB') {
		//allInputTags1[i].disabled = true;
			if(allInputTags1[i].name.match("SectionDesc$") )
			{
				continue;
			}
			
			allInputTags1[i].readOnly = true;
		
			
			allInputTags1[i].value = '0';
			$(tab1).find('.addbtn').prop('hidden', true);
		}else{
			if(allInputTags1[i].name.match("totSchedule80IA$") ||
					allInputTags1[i].name.match("totSchedule80IB$") || allInputTags1[i].name.match("totSchedule80IC$")
					|| allInputTags1[i].name.match("totDeductInNorthEast$"))
			{
				continue;
			}
			
		//	allInputTags1[i].disabled = false;
		/*	if(allInputTags1[i].name.match("80IBb[0]$") || allInputTags1[i].name.match("80IBc[0]$") || allInputTags1[i].name.match("80IBf[0]$") || allInputTags1[i].name.match("80IBi[0]$"))
			{
				continue;
			}*/
			allInputTags1[i].readOnly = false;
			$(tab1).find('.addbtn').prop('hidden', false);
		}
		
		
	}
	
} 


function calculateSchedulePTI(elem){
	var index = parseInt(elem.name.substring(elem.name.indexOf("[") + 1, elem.name.indexOf("]")));
	
	var incFromHPamtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromHP.amtOfIncm')[0];
	var incFromHPshareOfLoss= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromHP.shareOfLoss')[0];
	var incFromHPnetIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromHP.netIncome')[0];
	incFromHPnetIncome.value=eval(parseInt(coalesce(incFromHPamtOfIncm.value),10))-eval(parseInt(coalesce(incFromHPshareOfLoss.value),10));
	
	var incFromCGShortTermtdsOnAmt111a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.tdsOnAmt111a')[0];
	var incFromCGShortTermtdsOnAmtOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.tdsOnAmtOthrs')[0];
	var incFromCGShortTermtdsOnAmt= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.tdsOnAmt')[0];
	incFromCGShortTermtdsOnAmt.value=eval(parseInt(coalesce(incFromCGShortTermtdsOnAmt111a.value),10))+eval(parseInt(coalesce(incFromCGShortTermtdsOnAmtOthrs.value),10));
	
	var incFromCGShortTermamtOfIncm111a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.amtOfIncm111a')[0];
	var incFromCGShortTermshareOfLoss111a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.shareOfLoss111a')[0];
	var incFromCGShortTermnetIncome111a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.netIncome111a')[0];
	incFromCGShortTermnetIncome111a.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncm111a.value),10))-eval(parseInt(coalesce(incFromCGShortTermshareOfLoss111a.value),10));
	
	var incFromCGShortTermamtOfIncmOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.amtOfIncmOthrs')[0];
	var incFromCGShortTermshareOfLossOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.shareOfLossOthrs')[0];
	var incFromCGShortTermnetIncomeOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.netIncomeOthrs')[0];
	incFromCGShortTermnetIncomeOthrs.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncmOthrs.value),10))-eval(parseInt(coalesce(incFromCGShortTermshareOfLossOthrs.value),10));
	
	var incFromCGShortTermamtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.amtOfIncm')[0];
	incFromCGShortTermamtOfIncm.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncm111a.value),10))+eval(parseInt(coalesce(incFromCGShortTermamtOfIncmOthrs.value),10));
	var incFromCGShortTermshareOfLoss= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.shareOfLoss')[0];
	incFromCGShortTermshareOfLoss.value=eval(parseInt(coalesce(incFromCGShortTermshareOfLoss111a.value),10))+eval(parseInt(coalesce(incFromCGShortTermshareOfLossOthrs.value),10));
	var incFromCGShortTermnetIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.netIncome')[0];
	incFromCGShortTermnetIncome.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncm.value),10))-eval(parseInt(coalesce(incFromCGShortTermshareOfLoss.value),10));
	
	var incFromCGLongTermtdsOnAmt112a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.tdsOnAmt112a')[0];
	var incFromCGLongTermtdsOnAmtOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.tdsOnAmtOthrs')[0];
	var incFromCGLongTermtdsOnAmt= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.tdsOnAmt')[0];
	incFromCGLongTermtdsOnAmt.value=eval(parseInt(coalesce(incFromCGLongTermtdsOnAmt112a.value),10))+eval(parseInt(coalesce(incFromCGLongTermtdsOnAmtOthrs.value),10));
	
	var incFromCGLongTermamtOfIncm112a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.amtOfIncm112a')[0];
	var incFromCGLongTermshareOfLoss112a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.shareOfLoss112a')[0];
	var incFromCGLongTermnetIncome112a= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.netIncome112a')[0];
	incFromCGLongTermnetIncome112a.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncm112a.value),10))-eval(parseInt(coalesce(incFromCGLongTermshareOfLoss112a.value),10));
	
	var incFromCGLongTermamtOfIncmOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.amtOfIncmOthrs')[0];
	var incFromCGLongTermshareOfLossOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.shareOfLossOthrs')[0];
	var incFromCGLongTermnetIncomeOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.netIncomeOthrs')[0];
	incFromCGLongTermnetIncomeOthrs.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncmOthrs.value),10))-eval(parseInt(coalesce(incFromCGLongTermshareOfLossOthrs.value),10));
	
	var incFromCGLongTermamtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.amtOfIncm')[0];
	incFromCGLongTermamtOfIncm.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncm112a.value),10))+eval(parseInt(coalesce(incFromCGLongTermamtOfIncmOthrs.value),10));
	var incFromCGLongTermshareOfLoss= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.shareOfLoss')[0];
	incFromCGLongTermshareOfLoss.value=eval(parseInt(coalesce(incFromCGLongTermshareOfLoss112a.value),10))+eval(parseInt(coalesce(incFromCGLongTermshareOfLossOthrs.value),10));
	var incFromCGLongTermnetIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.netIncome')[0];
	incFromCGLongTermnetIncome.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncm.value),10))-eval(parseInt(coalesce(incFromCGLongTermshareOfLoss.value),10));
	
	var incFromDividendtdsOnAmtDividend= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.tdsOnAmtDividend')[0];
	var incFromDividendtdsOnAmtOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.tdsOnAmtOthrs')[0];
	var incFromOStdsOnAmt= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromOS.tdsOnAmt')[0];
	incFromOStdsOnAmt.value=eval(parseInt(coalesce(incFromDividendtdsOnAmtDividend.value),10))+eval(parseInt(coalesce(incFromDividendtdsOnAmtOthrs.value),10));
	
	var incFromDividendamtOfIncmDividend= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.amtOfIncmDividend')[0];
	//coalesceSetRet('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.shareOfLossDividend');
	var incFromDividendnetIncomeDiviend= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.netIncomeDividend')[0];
	incFromDividendnetIncomeDiviend.value=eval(parseInt(coalesce(incFromDividendamtOfIncmDividend.value),10));
	
	var incFromDividendamtOfIncmOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.amtOfIncmOthrs')[0];
	//coalesceSetRet('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.shareOfLossOthrs');
	var incFromDividendnetIncomeOthrs= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromDividend.netIncomeOthrs')[0];
	incFromDividendnetIncomeOthrs.value=eval(parseInt(coalesce(incFromDividendamtOfIncmOthrs.value),10));
	
	var incFromOSamtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromOS.amtOfIncm')[0];
	incFromOSamtOfIncm.value=eval(parseInt(coalesce(incFromDividendamtOfIncmDividend.value),10))+eval(parseInt(coalesce(incFromDividendamtOfIncmOthrs.value),10));
	
	var incFromOSnetIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromOS.netIncome')[0];
	incFromOSnetIncome.value=eval(parseInt(coalesce(incFromOSamtOfIncm.value),10));
	
	var incFromExemptSec10_23FBBamtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.amtOfIncm')[0];
	
	var incFromExemptSec10_23FBBnetIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.netIncome')[0];
	if(incFromExemptSec10_23FBBamtOfIncm.value!='')
	{
		incFromExemptSec10_23FBBnetIncome.value=eval(parseInt(coalesce(incFromExemptSec10_23FBBamtOfIncm.value),10));
	}
	else
	{
		incFromExemptSec10_23FBBnetIncome.value='';
	}
	
	var incFromExemptSec10_23FBB1amtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.amtOfIncm')[0];
	var incFromExemptSec10_23FBB1netIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.netIncome')[0];
	if(incFromExemptSec10_23FBB1amtOfIncm.value!='')
	{
		incFromExemptSec10_23FBB1netIncome.value=eval(parseInt(coalesce(incFromExemptSec10_23FBB1amtOfIncm.value),10));
	}
	else
	{
		incFromExemptSec10_23FBB1netIncome.value='';
	}
	var incFromExemptSec10_23FBB2amtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.amtOfIncm')[0];
	
	var incFromExemptSec10_23FBB2netIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.netIncome')[0];
	if(incFromExemptSec10_23FBB2amtOfIncm.value!='')
	{
		incFromExemptSec10_23FBB2netIncome.value=eval(parseInt(coalesce(incFromExemptSec10_23FBB2amtOfIncm.value),10));
	}
	else
	{
		incFromExemptSec10_23FBB2netIncome.value='';
	}
	
	var incFromExemptSec10_23FBBamtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.amtOfIncm')[0];
	var incFromExemptSec10_23FBB1amtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.amtOfIncm')[0];
	var incFromExemptSec10_23FBB2amtOfIncm= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.amtOfIncm')[0];
	var incFromExemptSec10_23FBBamtOfIncmTotal= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.amtOfIncmTotal')[0];
	incFromExemptSec10_23FBBamtOfIncmTotal.value=eval(parseInt(coalesce(incFromExemptSec10_23FBBamtOfIncm.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB1amtOfIncm.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB2amtOfIncm.value),10));
	
	/*var incFromExemptSec10_23FBBshareOfLoss= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.shareOfLoss')[0];
	var incFromExemptSec10_23FBB1shareOfLoss= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.shareOfLoss')[0];
	var incFromExemptSec10_23FBB2shareOfLoss= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.shareOfLoss')[0];
	var incFromExemptSec10_23FBBshareOfLossTotal= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.shareOfLossTotal')[0];
	incFromExemptSec10_23FBBshareOfLossTotal.value=eval(parseInt(coalesce(incFromExemptSec10_23FBBshareOfLoss.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB1shareOfLoss.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB2shareOfLoss.value),10));
	*/
	var incFromExemptSec10_23FBBnetIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.netIncome')[0];
	var incFromExemptSec10_23FBB1netIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.netIncome')[0];
	var incFromExemptSec10_23FBB2netIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.netIncome')[0];
	var incFromExemptSec10_23FBBnetIncomeTotal= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.netIncomeTotal')[0];
	incFromExemptSec10_23FBBnetIncomeTotal.value=eval(parseInt(coalesce(incFromExemptSec10_23FBBnetIncome.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB1netIncome.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB2netIncome.value),10));
	
	var incFromExemptSec10_23FBBtdsOnAmt= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.tdsOnAmt')[0];
	var incFromExemptSec10_23FBB1tdsOnAmt= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.tdsOnAmt')[0];
	var incFromExemptSec10_23FBB2tdsOnAmt= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.tdsOnAmt')[0];
	var incFromExemptSec10_23FBBtdsOnAmtTotal= document.getElementsByName('itrSchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.tdsOnAmtTotal')[0];
	incFromExemptSec10_23FBBtdsOnAmtTotal.value=eval(parseInt(coalesce(incFromExemptSec10_23FBBtdsOnAmt.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB1tdsOnAmt.value),10))+eval(parseInt(coalesce(incFromExemptSec10_23FBB2tdsOnAmt.value),10));
}
function enableScheduleFSI()
{
	var tab = document.getElementById('scheduleFSI');
	var status = document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var allInputTags = tab.getElementsByTagName('input');
	var selectTags = tab.getElementsByTagName('select');
	
	if (status=='NRI') {
		deleteRowFSI('scheduleFSI',2,2);
		$('#addFsiButtonId').prop('disabled', true);
	}
	for (var i = 0; i < allInputTags.length; i++) {
		
		if (status=='NRI') {
			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;
			allInputTags[i].value = "";

		} else {
			if(allInputTags[i].name.match("taxReliefinInd$") || allInputTags[i].name.match("totalCountryWiseincFrmOutsideInd$")|| allInputTags[i].name.match("totalCountryWisetaxPaidOutsideInd$")|| allInputTags[i].name.match("totalCountryWisetaxPayableinInd$"))
			{
				continue;
			}
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;
		}
	}
	for (var i = 0; i < selectTags.length; i++) {
		if (status=='NRI') {
			document.getElementsByName('scheduleTR1.scheduleTR[0].relavantArticleDTAA')[0].disabled = true;
			document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].disabled = true;
			document.getElementsByName('scheduleTR1.scheduleTR[0].relavantArticleDTAA')[0].value = "";
			document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].value = "";
			selectTags[i].disabled = true;
			selectTags[i].readOnly = true;
			selectTags[i].value = "";

		} else {
			document.getElementsByName('scheduleTR1.scheduleTR[0].relavantArticleDTAA')[0].disabled = false;
			document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].disabled = false;
			selectTags[i].disabled = false;
			selectTags[i].readOnly = false;
		}
	}
}



function populateDI(elem) {
	var indexString = elem.name;
	var index = indexString.substring(
			indexString.lastIndexOf("[") + 1, 
			indexString.lastIndexOf("]")
		);
	var table = document.getElementById('taxDed10AAId');
	var rowCount = table.rows.length;
	var table10AA = document.getElementById('scheduleDI10AA');
	var rowCount10AA = table10AA.rows.length;
	if( index > 0 ){
		if((rowCount-3)<=rowCount10AA){
			addRowToTableNoCheck('scheduleDI10AA',2,1);
		}
	}
	document.getElementsByName('scheduleDI.deductionUnd10AA['+index+'].UndrtakAsPrSchedule10AA')[0].value = 'Undertaking No '+ eval(parseInt(index, 10) + 1 );
	document.getElementsByName('scheduleDI.deductionUnd10AA['+index+'].AmountDedSchedule10AA')[0].value = elem.value;
}

function checkSchDIpartB(elem){
	
	var indexString = elem.name;
	var index = indexString.substring(
			indexString.lastIndexOf("[") + 1, 
			indexString.lastIndexOf("]")
		);
	var checked = document.getElementsByName(indexString)[0].checked; 
	
	var table10AA = document.getElementById('scheduleDI10AA');
	document.getElementsByName('scheduleDI.deductionUnd10AA['+index+'].chosenCheckBox')[0].checked = checked;
}

function updateUndertaking(){
	
	var table = document.getElementById('scheduleDI10AA');
	var rowCount = table.rows.length;
	for(var i=0;i<rowCount-2;i++){
		document.getElementsByName('scheduleDI.deductionUnd10AA['+i+'].UndrtakAsPrSchedule10AA')[0].value = 'Undertaking No '+ eval(parseInt(i, 10) + 1 );
	}
	
}

function calculateScheduleDI()
{
	var scheduleviaFlag= document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.invsFlag')[0].value;
	if(scheduleviaFlag=='Y')
	{
		document.getElementsByName('scheduleDI.deductionUndChapVIA[0].deduction')[0].readOnly=false;
		document.getElementsByName('scheduleDI.deductionUndChapVIA[1].deduction')[0].readOnly=false;
		document.getElementsByName('scheduleDI.deductionUndChapVIA[2].deduction')[0].readOnly=false;
		document.getElementsByName('scheduleDI.deductionUndChapVIA[3].deduction')[0].readOnly=false;

	}
	else
	{
		document.getElementsByName('scheduleDI.deductionUndChapVIA[0].deduction')[0].readOnly=true;
		document.getElementsByName('scheduleDI.deductionUndChapVIA[1].deduction')[0].readOnly=true;
		document.getElementsByName('scheduleDI.deductionUndChapVIA[2].deduction')[0].readOnly=true;
		document.getElementsByName('scheduleDI.deductionUndChapVIA[3].deduction')[0].readOnly=true;


		document.getElementsByName('scheduleDI.deductionUndChapVIA[0].deduction')[0].value=parseInt('0', 10);
		document.getElementsByName('scheduleDI.deductionUndChapVIA[1].deduction')[0].value=parseInt('0', 10);
		document.getElementsByName('scheduleDI.deductionUndChapVIA[2].deduction')[0].value=parseInt('0', 10);
		document.getElementsByName('scheduleDI.deductionUndChapVIA[3].deduction')[0].value=parseInt('0', 10);

	}
	if(scheduleviaFlag=='Y')
	{
		var sec80G = document.getElementsByName('scheduleVIA.deductUndChapVIA.section80G')[0];
		var sec80GGA = document.getElementsByName('scheduleVIA.deductUndChapVIA.section80GGA')[0];
		var sec80GGB = document.getElementsByName('scheduleVIA.deductUndChapVIA.section80GGB')[0];
		var sec80GGC = document.getElementsByName('scheduleVIA.deductUndChapVIA.section80GGC')[0];

		if(eval(parseInt(coalesce(sec80G.value), 10))>0)
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[0].eligibleAmt')[0].value = eval(parseInt(coalesce(sec80G.value), 10));
		}
		else
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[0].eligibleAmt')[0].value=parseInt('0', 10);
		}

		if(eval(parseInt(coalesce(sec80GGA.value), 10))>0)
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[1].eligibleAmt')[0].value = eval(parseInt(coalesce(sec80GGA.value), 10));
		}
		else
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[1].eligibleAmt')[0].value=parseInt('0', 10);
		}
		if(eval(parseInt(coalesce(sec80GGB.value), 10))>0)
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[2].eligibleAmt')[0].value = eval(parseInt(coalesce(sec80GGB.value), 10));
		}
		else
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[2].eligibleAmt')[0].value=parseInt('0', 10);
		}
		if(eval(parseInt(coalesce(sec80GGC.value), 10))>0)
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[3].eligibleAmt')[0].value = eval(parseInt(coalesce(sec80GGC.value), 10));
		}
		else
		{
			document.getElementsByName('scheduleDI.deductionUndChapVIA[3].eligibleAmt')[0].value=parseInt('0', 10);
		}

	}
	else
	{
		document.getElementsByName('scheduleDI.deductionUndChapVIA[0].eligibleAmt')[0].value=parseInt('0', 10);
		document.getElementsByName('scheduleDI.deductionUndChapVIA[1].eligibleAmt')[0].value=parseInt('0', 10);
		document.getElementsByName('scheduleDI.deductionUndChapVIA[2].eligibleAmt')[0].value=parseInt('0', 10);
		document.getElementsByName('scheduleDI.deductionUndChapVIA[3].eligibleAmt')[0].value=parseInt('0', 10);

	}
	var eligibleAmt0 = document.getElementsByName('scheduleDI.deductionUndChapVIA[0].eligibleAmt')[0];
	var eligibleAmt1 = document.getElementsByName('scheduleDI.deductionUndChapVIA[1].eligibleAmt')[0];
	var eligibleAmt2 = document.getElementsByName('scheduleDI.deductionUndChapVIA[2].eligibleAmt')[0];
	var eligibleAmt3 = document.getElementsByName('scheduleDI.deductionUndChapVIA[3].eligibleAmt')[0];

	var eligibleAmt80DedTotal = document.getElementsByName('scheduleDI.deductionUndChapVIA.eligibleAmt80DedTotal')[0];
	eligibleAmt80DedTotal.value = eval(parseInt(coalesce(eligibleAmt0.value), 10)
			+ parseInt(coalesce(eligibleAmt1.value), 10)
			+ parseInt(coalesce(eligibleAmt2.value), 10)
			+ parseInt(coalesce(eligibleAmt3.value), 10));
	document.getElementsByName('scheduleDI.deductionUndChapVIA.eligibleAmt80DedTotal')[0].value=eligibleAmt80DedTotal.value;

	var deduction0 = document.getElementsByName('scheduleDI.deductionUndChapVIA[0].deduction')[0];
	var deduction1 = document.getElementsByName('scheduleDI.deductionUndChapVIA[1].deduction')[0];
	var deduction2 = document.getElementsByName('scheduleDI.deductionUndChapVIA[2].deduction')[0];
	var deduction3 = document.getElementsByName('scheduleDI.deductionUndChapVIA[3].deduction')[0];

	coalesceSetRet('scheduleDI.deductionUndChapVIA[0].deduction');
	coalesceSetRet('scheduleDI.deductionUndChapVIA[1].deduction');
	coalesceSetRet('scheduleDI.deductionUndChapVIA[2].deduction');
	coalesceSetRet('scheduleDI.deductionUndChapVIA[3].deduction');

	if(eval(parseInt(coalesce(deduction0.value), 10))>eval(parseInt(coalesce(eligibleAmt0.value), 10)))
	{
		j.setFieldError('scheduleDI.deductionUndChapVIA[0].deduction','Deduction attributable to investment/expenditure made between 01.04.2020 to 31.07.2020 cannont exceed Eligible amount of deduction during FY 2019-20');
		addErrorXHTML(document.getElementsByName('scheduleDI.deductionUndChapVIA[0].deduction')[0],'Deduction attributable to investment/expenditure made between 01.04.2020 to 31.07.2020 cannont exceed Eligible amount of deduction during FY 2019-20',true);
		deduction0.value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(deduction1.value), 10))>eval(parseInt(coalesce(eligibleAmt1.value), 10)))
	{
		j.setFieldError('scheduleDI.deductionUndChapVIA[1].deduction','Deduction attributable to investment/expenditure made between 01.04.2020 to 30.06.2020 cannont exceed Eligible amount of deduction during FY 2019-20');
		addErrorXHTML(document.getElementsByName('scheduleDI.deductionUndChapVIA[1].deduction')[0],'Deduction attributable to investment/expenditure made between 01.04.2020 to 31.07.2020 cannont exceed Eligible amount of deduction during FY 2019-20',true);
		deduction1.value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(deduction2.value), 10))>eval(parseInt(coalesce(eligibleAmt2.value), 10)))
	{
		j.setFieldError('scheduleDI.deductionUndChapVIA[2].deduction','Deduction attributable to investment/expenditure made between 01.04.2020 to 30.06.2020 cannont exceed Eligible amount of deduction during FY 2019-20');
		addErrorXHTML(document.getElementsByName('scheduleDI.deductionUndChapVIA[2].deduction')[0],'Deduction attributable to investment/expenditure made between 01.04.2020 to 30.06.2020 cannont exceed Eligible amount of deduction during FY 2019-20',true);
		deduction2.value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(deduction3.value), 10))>eval(parseInt(coalesce(eligibleAmt3.value), 10)))
	{
		j.setFieldError('scheduleDI.deductionUndChapVIA[3].deduction','Deduction attributable to investment/expenditure made between 01.04.2020 to 30.06.2020 cannont exceed Eligible amount of deduction during FY 2019-20');
		addErrorXHTML(document.getElementsByName('scheduleDI.deductionUndChapVIA[3].deduction')[0],'Deduction attributable to investment/expenditure made between 01.04.2020 to 30.06.2020 cannont exceed Eligible amount of deduction during FY 2019-20',true);
		deduction3.value=parseInt('0', 10);
	}
	var deduction80Total = document.getElementsByName('scheduleDI.deductionUndChapVIA.deduction80Total')[0];
	deduction80Total.value = eval(parseInt(coalesce(deduction0.value), 10)
			+ parseInt(coalesce(deduction1.value), 10)
			+ parseInt(coalesce(deduction2.value), 10)
			+ parseInt(coalesce(deduction3.value), 10));
	document.getElementsByName('scheduleDI.deductionUndChapVIA.deduction80Total')[0].value=deduction80Total.value;
//Long Term Capital Gain
	var sec54DAmt=0;
	var sec54GAmt=0;
	var sec54GAAmt=0;

	var tableId = document.getElementById('scheduleLtcgunUtilizedCapGain54');
	var rowCount = tableId.rows.length;
	for (var i = 0; i < rowCount - 3; i++) {

		var subCat = document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
				+ i + '].section')[0].value;
		if(subCat=='54D')
		{
			sec54DAmt=eval(parseInt(coalesce(sec54DAmt), 10)
					+ parseInt(coalesce(document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].amountUtilized')[0].value), 10));
		}
		if(subCat=='54G')
		{
			sec54GAmt=eval(parseInt(coalesce(sec54GAmt), 10)
					+ parseInt(coalesce(document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].amountUtilized')[0].value), 10));
		}
		if(subCat=='54GA')
		{
			sec54GAAmt=eval(parseInt(coalesce(sec54GAAmt), 10)
					+ parseInt(coalesce(document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].amountUtilized')[0].value), 10));
		}
	}
	if(eval(parseInt(coalesce(sec54DAmt), 10))>0)
	{
		document.getElementsByName('scheduleDI.longTermCapitalGain[0].amtUtilizedOutOfLtcg')[0].value = eval(parseInt(coalesce(sec54DAmt), 10));
	}
	else
	{
		document.getElementsByName('scheduleDI.longTermCapitalGain[0].amtUtilizedOutOfLtcg')[0].value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(sec54GAmt), 10))>0)
	{
		document.getElementsByName('scheduleDI.longTermCapitalGain[1].amtUtilizedOutOfLtcg')[0].value = eval(parseInt(coalesce(sec54GAmt), 10));
	}
	else
	{
		document.getElementsByName('scheduleDI.longTermCapitalGain[1].amtUtilizedOutOfLtcg')[0].value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(sec54GAAmt), 10))>0)
	{
		document.getElementsByName('scheduleDI.longTermCapitalGain[2].amtUtilizedOutOfLtcg')[0].value = eval(parseInt(coalesce(sec54GAAmt), 10));
	}
	else
	{
		document.getElementsByName('scheduleDI.longTermCapitalGain[2].amtUtilizedOutOfLtcg')[0].value=parseInt('0', 10);
	}


	var amtUtilizedOutOfLtcg0 = document.getElementsByName('scheduleDI.longTermCapitalGain[0].amtUtilizedOutOfLtcg')[0];
	var amtUtilizedOutOfLtcg1 = document.getElementsByName('scheduleDI.longTermCapitalGain[1].amtUtilizedOutOfLtcg')[0];
	var amtUtilizedOutOfLtcg2 = document.getElementsByName('scheduleDI.longTermCapitalGain[2].amtUtilizedOutOfLtcg')[0];
	var amtUtilizedOutOfLtcgtotal = document.getElementsByName('scheduleDI.longTermCapitalGain.amtUtilizedOutOfLtcgtotal')[0];
	amtUtilizedOutOfLtcgtotal.value = eval(parseInt(coalesce(amtUtilizedOutOfLtcg0.value), 10)
			+ parseInt(coalesce(amtUtilizedOutOfLtcg1.value), 10)
			+ parseInt(coalesce(amtUtilizedOutOfLtcg2.value), 10));
	document.getElementsByName('scheduleDI.longTermCapitalGain.amtUtilizedOutOfLtcgtotal')[0].value=amtUtilizedOutOfLtcgtotal.value;


	var amtUtilized0 = document.getElementsByName('scheduleDI.longTermCapitalGain[0].amtUtilized')[0];
	var amtUtilized1 = document.getElementsByName('scheduleDI.longTermCapitalGain[1].amtUtilized')[0];
	var amtUtilized2 = document.getElementsByName('scheduleDI.longTermCapitalGain[2].amtUtilized')[0];
	coalesceSetRet('scheduleDI.longTermCapitalGain[0].amtUtilized');
	coalesceSetRet('scheduleDI.longTermCapitalGain[1].amtUtilized');
	coalesceSetRet('scheduleDI.longTermCapitalGain[2].amtUtilized');

	if(eval(parseInt(coalesce(amtUtilized0.value), 10))>eval(parseInt(coalesce(amtUtilizedOutOfLtcg0.value), 10)))
	{
		j.setFieldError('scheduleDI.longTermCapitalGain[0].amtUtilized','Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account');
		addErrorXHTML(document.getElementsByName('scheduleDI.longTermCapitalGain[0].amtUtilized')[0],'Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account',true);
		amtUtilized0.value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(amtUtilized1.value), 10))>eval(parseInt(coalesce(amtUtilizedOutOfLtcg1.value), 10)))
	{
		j.setFieldError('scheduleDI.longTermCapitalGain[1].amtUtilized','Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account');
		addErrorXHTML(document.getElementsByName('scheduleDI.longTermCapitalGain[1].amtUtilized')[0],'Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account',true);
		amtUtilized1.value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(amtUtilized2.value), 10))>eval(parseInt(coalesce(amtUtilizedOutOfLtcg2.value), 10)))
	{
		j.setFieldError('scheduleDI.longTermCapitalGain[2].amtUtilized','Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account');
		addErrorXHTML(document.getElementsByName('scheduleDI.longTermCapitalGain[2].amtUtilized')[0],'Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account',true);
		amtUtilized2.value=parseInt('0', 10);
	}

	var amtUtilizedLtcgTotal = document.getElementsByName('scheduleDI.longTermCapitalGain.amtUtilizedLtcgTotal')[0];
	amtUtilizedLtcgTotal.value = eval(parseInt(coalesce(amtUtilized0.value), 10)
			+ parseInt(coalesce(amtUtilized1.value), 10)
			+ parseInt(coalesce(amtUtilized2.value), 10));
	document.getElementsByName('scheduleDI.longTermCapitalGain.amtUtilizedLtcgTotal')[0].value=amtUtilizedLtcgTotal.value;


	//Short Term Capital Gain
	var sec54DAmt1=0;
	var sec54GAmt1=0;
	var sec54GAAmt1=0;

	var tableId = document.getElementById('scheduleStcgunUtilizedCapGain54');
	var rowCount = tableId.rows.length;
	for (var i = 0; i < rowCount - 3; i++) {
		var subCat = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
				+ i + '].section')[0].value;
		if(subCat=='54D')
		{
			sec54DAmt1=eval(parseInt(coalesce(sec54DAmt1), 10)
					+ parseInt(coalesce(document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].amountUtilized')[0].value), 10));
		}
		if(subCat=='54G')
		{
			sec54GAmt1=eval(parseInt(coalesce(sec54GAmt1), 10)
					+ parseInt(coalesce(document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].amountUtilized')[0].value), 10));
		}
		if(subCat=='54GA')
		{
			sec54GAAmt1=eval(parseInt(coalesce(sec54GAAmt1), 10)
					+ parseInt(coalesce(document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.unUtilizedCapGain54['
							+ i + '].amountUtilized')[0].value), 10));
		}
	}
	if(eval(parseInt(coalesce(sec54DAmt1), 10))>0)
	{
		document.getElementsByName('scheduleDI.shortTermCapitalGain[0].amtUtilizedOutOfStcg')[0].value = eval(parseInt(coalesce(sec54DAmt1), 10));
	}
	else
	{
		document.getElementsByName('scheduleDI.shortTermCapitalGain[0].amtUtilizedOutOfStcg')[0].value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(sec54GAmt1), 10))>0)
	{
		document.getElementsByName('scheduleDI.shortTermCapitalGain[1].amtUtilizedOutOfStcg')[0].value = eval(parseInt(coalesce(sec54GAmt1), 10));
	}
	else
	{
		document.getElementsByName('scheduleDI.shortTermCapitalGain[1].amtUtilizedOutOfStcg')[0].value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(sec54GAAmt1), 10))>0)
	{
		document.getElementsByName('scheduleDI.shortTermCapitalGain[2].amtUtilizedOutOfStcg')[0].value = eval(parseInt(coalesce(sec54GAAmt1), 10));
	}
	else
	{
		document.getElementsByName('scheduleDI.shortTermCapitalGain[2].amtUtilizedOutOfStcg')[0].value=parseInt('0', 10);
	}

	var amtUtilizedOutOfStcg0 = document.getElementsByName('scheduleDI.shortTermCapitalGain[0].amtUtilizedOutOfStcg')[0];
	var amtUtilizedOutOfStcg1 = document.getElementsByName('scheduleDI.shortTermCapitalGain[1].amtUtilizedOutOfStcg')[0];
	var amtUtilizedOutOfStcg2 = document.getElementsByName('scheduleDI.shortTermCapitalGain[2].amtUtilizedOutOfStcg')[0];

	var amtUtilizedOutOfStcgtotal = document.getElementsByName('scheduleDI.shortTermCapitalGain.amtUtilizedOutOfStcgtotal')[0];
	amtUtilizedOutOfStcgtotal.value = eval(parseInt(coalesce(amtUtilizedOutOfStcg0.value), 10)
			+ parseInt(coalesce(amtUtilizedOutOfStcg1.value), 10)
			+ parseInt(coalesce(amtUtilizedOutOfStcg2.value), 10));
	document.getElementsByName('scheduleDI.shortTermCapitalGain.amtUtilizedOutOfStcgtotal')[0].value=amtUtilizedOutOfStcgtotal.value;

	var amtUtilizedStcg0 = document.getElementsByName('scheduleDI.shortTermCapitalGain[0].amtUtilized')[0];
	var amtUtilizedStcg1 = document.getElementsByName('scheduleDI.shortTermCapitalGain[1].amtUtilized')[0];
	var amtUtilizedStcg2 = document.getElementsByName('scheduleDI.shortTermCapitalGain[2].amtUtilized')[0];
	coalesceSetRet('scheduleDI.shortTermCapitalGain[0].amtUtilized');
	coalesceSetRet('scheduleDI.shortTermCapitalGain[1].amtUtilized');
	coalesceSetRet('scheduleDI.shortTermCapitalGain[2].amtUtilized');

	if(eval(parseInt(coalesce(amtUtilizedStcg0.value), 10))>eval(parseInt(coalesce(amtUtilizedOutOfStcg0.value), 10)))
	{
		j.setFieldError('scheduleDI.shortTermCapitalGain[0].amtUtilized','Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account');
		addErrorXHTML(document.getElementsByName('scheduleDI.shortTermCapitalGain[0].amtUtilized')[0],'Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account',true);
		amtUtilizedStcg0.value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(amtUtilizedStcg1.value), 10))>eval(parseInt(coalesce(amtUtilizedOutOfStcg1.value), 10)))
	{
		j.setFieldError('scheduleDI.shortTermCapitalGain[1].amtUtilized','Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account');
		addErrorXHTML(document.getElementsByName('scheduleDI.shortTermCapitalGain[1].amtUtilized')[0],'Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account',true);
		amtUtilizedStcg1.value=parseInt('0', 10);
	}
	if(eval(parseInt(coalesce(amtUtilizedStcg2.value), 10))>eval(parseInt(coalesce(amtUtilizedOutOfStcg2.value), 10)))
	{
		j.setFieldError('scheduleDI.shortTermCapitalGain[2].amtUtilized','Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account');
		addErrorXHTML(document.getElementsByName('scheduleDI.shortTermCapitalGain[2].amtUtilized')[0],'Amount utilised between 01.04.2020 to 30.06.2020 out of Col 2 cannont exceed Amount utilised out of Capital Gains account',true);
		amtUtilizedStcg2.value=parseInt('0', 10);
	}


	var amtUtilizedStcgTotal = document.getElementsByName('scheduleDI.shortTermCapitalGain.amtUtilizedStcgTotal')[0];
	amtUtilizedStcgTotal.value = eval(parseInt(coalesce(amtUtilizedStcg0.value), 10)
			+ parseInt(coalesce(amtUtilizedStcg1.value), 10)
			+ parseInt(coalesce(amtUtilizedStcg2.value), 10));
	document.getElementsByName('scheduleDI.shortTermCapitalGain.amtUtilizedStcgTotal')[0].value=amtUtilizedStcgTotal.value;


}


function CompanyToResStatus() {

	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;

	if ( domesticCompFlg == 'Y') {
		document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value = "RES";
		document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].disabled=true;
	}else{
		document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value = "";
		document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].disabled=false;

	}
	
	enableField('partAGEN1.filingStatus.residentialStatus', 'RES',
	'partBTTI.assetOutIndiaFlag');
}

function OnLoadCompanyToResStatus() {
	var domesticCompFlg = document
			.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	if ( domesticCompFlg == 'Y') {
		
		document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].disabled=true;
	}else{
		document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].disabled=false;
	}
}

function otherauditedSection() {
	var partaoth = document.getElementById('othSecDateTabId');

	var noOfRows = partaoth.rows.length;

	for (var i = 0; i < noOfRows - 2; i++) {

		var auditedSection = document.getElementsByName('partAGEN2.auditDetails['
				+ i + '].auditedSection')[0].value;

		if (auditedSection == 'OTH') {
			document.getElementsByName('partAGEN2.auditDetails[' + i
					+ '].anyOtherSection')[0].disabled = false;
			document.getElementsByName('partAGEN2.auditDetails[' + i
					+ '].anyOtherSection')[0].readOnly = false;

		} else {
			document.getElementsByName('partAGEN2.auditDetails[' + i
					+ '].anyOtherSection')[0].disabled = true;
			document.getElementsByName('partAGEN2.auditDetails[' + i
					+ '].anyOtherSection')[0].readOnly = true;

			document.getElementsByName('partAGEN2.auditDetails[' + i
					+ '].anyOtherSection')[0].value = '';
		}

	}
}

function otherauditedSection1() {
	var partaoth = document.getElementById('othSecDateTabId');

	var noOfRows = partaoth.rows.length;

	for (var i = 0; i < noOfRows - 2; i++) {

		var anyOtherSection = document
				.getElementsByName('partAGEN2.auditDetails[' + i
						+ '].anyOtherSection')[0].value;
		var auditedSection = document.getElementsByName('partAGEN2.auditDetails['
				+ i + '].auditedSection')[0].value;

		if (auditedSection == 'OTH' && (anyOtherSection == null || anyOtherSection == '')) {
			addErrorXHTML('',
					'Please  enter the section number  in Audit Information.');

			j.setFieldError('partAGEN2.auditDetails[' + i
					+ '].anyOtherSection',
					'Please  enter the section number  in Audit Information.');

			return;

		}

	}
}

function disableMatOn115(){
	
	alert('disableMatOn115');
	var domesticCompFlg = document
	.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	
	var residentsec90 = document
	.getElementsByName('partAGEN1.filingStatus.residentsec90')[0].value;
	
	var nripe = document.getElementsByName('partAGEN1.filingStatus.nripe')[0].value;
	var registratedlaw = document
	.getElementsByName('partAGEN1.filingStatus.registratedlaw')[0].value;
	
	
	var flag115BA = document
	.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var tab1 = document.getElementById('page37');
	var allInputTags1 = tab1.getElementsByTagName('input');
	
	for (var i = 0; i < allInputTags1.length; i++) {
		
		if (domesticCompFlg == 'N' && residentsec90 == 'Y' && nripe == 'N'&& registratedlaw == 'N') {
			alert('case 1');
			allInputTags1[i].value = "";
			allInputTags1[i].disabled = true;
		} else if (domesticCompFlg == 'N' && residentsec90 == 'Y' && nripe == 'N' && registratedlaw == 'Y') {
			alert('case 2');
			allInputTags1[i].value = "";
			allInputTags1[i].disabled = true;
		} else if (domesticCompFlg == 'N' && residentsec90 == 'N' && nripe == 'Y' && registratedlaw == 'N') {
			alert('case3');
			allInputTags1[i].value = "";
			allInputTags1[i].disabled = true;
		} else if (domesticCompFlg == 'N' && residentsec90 == 'N' && nripe == 'N' && registratedlaw == 'N') {
			alert('case4');
			allInputTags1[i].value = "";
			allInputTags1[i].disabled = true;
		} else if (domesticCompFlg == 'Y' && (flag115BA == '115BAA' || flag115BA == '115BAB')) {
			alert('case5');
			allInputTags1[i].value = "";
			allInputTags1[i].disabled = true;
		} else {
			alert('case6');
			allInputTags1[i].disabled = false;
		}
	}
	var selects = tab1.getElementsByTagName('SELECT');

	for (var i = 0; i < selects.length; i++) {
		if(domesticCompFlg == 'N' && residentsec90 == 'Y' && nripe == 'N' && registratedlaw == 'N' ){
			selects[i].disabled = true;
			selects[i].selectedIndex = 0;
		}
		else if(domesticCompFlg == 'N' && residentsec90 == 'Y' && nripe == 'N' && registratedlaw == 'Y'  ){
			selects[i].disabled = true;
			selects[i].selectedIndex = 0;
		}
		else if(domesticCompFlg == 'N' && residentsec90 == 'N' && nripe == 'Y' && registratedlaw == 'N'  ){
			selects[i].disabled = true;
			selects[i].selectedIndex = 0;
		}
		else if(domesticCompFlg == 'N' && residentsec90 == 'N' && nripe == 'N' && registratedlaw == 'N'  ){
			selects[i].disabled = true;
			selects[i].selectedIndex = 0;
		}
		else if(domesticCompFlg == 'Y' && ( flag115BA == '115BAA' || flag115BA == '115BAB')){
			selects[i].disabled = true;
			selects[i].selectedIndex = 0;
		}
		else{
			if(selects[i].name.match("financialStamentFlag") )
			{
				continue;
			}
			selects[i].disabled = false;

		}
		
		
	}
}

function disableMatCOn115(){
	var domesticCompFlg = document
	.getElementsByName('partAGEN1.orgFirmInfo.domesticCompFlg')[0].value;
	
	var flag115BA = document
	.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var residentsec90 = document
	.getElementsByName('partAGEN1.filingStatus.residentsec90')[0].value;
	
	var nripe = document.getElementsByName('partAGEN1.filingStatus.nripe')[0].value;
	var registratedlaw = document
	.getElementsByName('partAGEN1.filingStatus.registratedlaw')[0].value;
	
	var tab1 = document.getElementById('page38');
	var allInputTags1 = tab1.getElementsByTagName('input');
	
	for (var i = 0; i < allInputTags1.length; i++) {
		if(allInputTags1[i].name.match("assYr") )
		{
			continue;
		}
		
		else if(domesticCompFlg == 'N' && residentsec90 == 'Y' && nripe == 'N' && registratedlaw == 'N' ){
					allInputTags1[i].value = "";
					allInputTags1[i].disabled = true;
				}
				else if(domesticCompFlg == 'N' && residentsec90 == 'Y' && nripe == 'N' && registratedlaw == 'Y'  ){
					allInputTags1[i].value = "";
					allInputTags1[i].disabled = true;
				}
				else if(domesticCompFlg == 'N' && residentsec90 == 'N' && nripe == 'Y' && registratedlaw == 'N'  ){
					allInputTags1[i].value = "";
					allInputTags1[i].disabled = true;
				}
				else if(domesticCompFlg == 'N' && residentsec90 == 'N' && nripe == 'N' && registratedlaw == 'N'  ){
					allInputTags1[i].value = "";
					allInputTags1[i].disabled = true;
				}
				else if(domesticCompFlg == 'Y' && ( flag115BA == '115BAA' || flag115BA == '115BAB')){
					allInputTags1[i].disabled = false;

					if(allInputTags1[i].name.match("matCredUtilCurrYr") ){
					allInputTags1[i].value = "";
					allInputTags1[i].disabled = true;
					}
				}
			
				else{
					allInputTags1[i].disabled = false;
				}	
				
		coalesceSetRet('scheduleMATC.utilMATCredAvl[0].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[0].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[1].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[1].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[2].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[2].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[3].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[3].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[4].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[4].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[5].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[5].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[6].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[6].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[7].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[7].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[8].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[8].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[9].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[9].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[10].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[10].balMATCredCF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[11].matCredBF');
		coalesceSetRet('scheduleMATC.utilMATCredAvl[11].balMATCredCF');
		
			}
	
	}
	



//CG
function calculateFullVal50CStcg()
{
	var table = document.getElementById('scheduleCGstcg1');
	var noOfRows = table.rows.length;

	for (var i = 0; i <noOfRows/14; i++) {
	var fullConsiderationSt=document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['+i+'].fullConsideration')[0];
	var propertyValuationSt=document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['+i+'].propertyValuation')[0];
	if(eval(parseInt(coalesce(propertyValuationSt.value),10))<=Math.round((1.05 * eval(parseInt(
			coalesce(fullConsiderationSt.value), 10)))))
	{
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['+ i +'].fullConsideration50C')[0].value=parseInt(
				coalesce(fullConsiderationSt.value), 10);
	}
	else
	{
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.saleofLandBuild['+ i +'].fullConsideration50C')[0].value=parseInt(
				coalesce(propertyValuationSt.value), 10);
	}
	}

}
function calculateFullVal50CLtcg()
{
	var table = document.getElementById('scheduleCGltcg1');
	var noOfRows = table.rows.length;

	for (var i = 0; i <noOfRows/14; i++) {

	var fullConsiderationSt=document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['+ i +'].fullConsideration')[0];
	var propertyValuationSt=document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['+ i +'].propertyValuation')[0];
	if(eval(parseInt(coalesce(propertyValuationSt.value),10))<=Math.round((1.05 * eval(parseInt(
			coalesce(fullConsiderationSt.value), 10)))))
	{
		document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['+ i +'].fullConsideration50C')[0].value=parseInt(
				coalesce(fullConsiderationSt.value), 10);
	}
	else
	{
		document.getElementsByName('scheduleCGPost45.longTermCapGainPost45.saleofLandBuild['+ i +'].fullConsideration50C')[0].value=parseInt(
				coalesce(propertyValuationSt.value), 10);
	}
	}

}


function calculateCFLTotalNormalPti()
{	
	
	var hpLossCFNormal7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPti7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotal7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotal7thyr.value=eval(parseInt(coalesce(hpLossCFNormal7thyr.value), 10))+ eval(parseInt(coalesce(hpLossCFPti7thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotal7thyr.value;

	var broughtFrwrdBusLoss7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BA7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCF7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCF7thyr.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLoss7thyr.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BA7thyr.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCF7thyr.value;

	
	var stcgLossCFNormal7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPti7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotal7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotal7thyr.value=eval(parseInt(coalesce(stcgLossCFNormal7thyr.value), 10))+ eval(parseInt(coalesce(stcgLossCFPti7thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotal7thyr.value;

	var ltcgLossCFNormal7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPti7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotal7thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotal7thyr.value=eval(parseInt(coalesce(ltcgLossCFNormal7thyr.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPti7thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotal7thyr.value;
	/*2013-14*/

	var hpLossCFNormal6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPti6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotal6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotal6thyr.value=eval(parseInt(coalesce(hpLossCFNormal6thyr.value), 10))+ eval(parseInt(coalesce(hpLossCFPti6thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotal6thyr.value;

	var broughtFrwrdBusLoss6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BA6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCF6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCF6thyr.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLoss6thyr.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BA6thyr.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCF6thyr.value;

	
	var stcgLossCFNormal6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPti6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotal6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotal6thyr.value=eval(parseInt(coalesce(stcgLossCFNormal6thyr.value), 10))+ eval(parseInt(coalesce(stcgLossCFPti6thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotal6thyr.value;

	var ltcgLossCFNormal6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPti6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotal6thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotal6thyr.value=eval(parseInt(coalesce(ltcgLossCFNormal6thyr.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPti6thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotal6thyr.value;
	/*2014-15*/

	var hpLossCFNormal5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPti5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotal5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotal5thyr.value=eval(parseInt(coalesce(hpLossCFNormal5thyr.value), 10))+ eval(parseInt(coalesce(hpLossCFPti5thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotal5thyr.value;

	var broughtFrwrdBusLoss5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BA5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCF5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCF5thyr.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLoss5thyr.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BA5thyr.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCF5thyr.value;

	
	var stcgLossCFNormal5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPti5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotal5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotal5thyr.value=eval(parseInt(coalesce(stcgLossCFNormal5thyr.value), 10))+ eval(parseInt(coalesce(stcgLossCFPti5thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotal5thyr.value;

	var ltcgLossCFNormal5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPti5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotal5thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotal5thyr.value=eval(parseInt(coalesce(ltcgLossCFNormal5thyr.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPti5thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotal5thyr.value;
	/*2015-16*/

	var hpLossCFNormal4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPti4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotal4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotal4thyr.value=eval(parseInt(coalesce(hpLossCFNormal4thyr.value), 10))+ eval(parseInt(coalesce(hpLossCFPti4thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotal4thyr.value;

	
	var broughtFrwrdBusLoss4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BA4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCF4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCF4thyr.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLoss4thyr.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BA4thyr.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCF4thyr.value;


	var stcgLossCFNormal4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPti4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotal4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotal4thyr.value=eval(parseInt(coalesce(stcgLossCFNormal4thyr.value), 10))+ eval(parseInt(coalesce(stcgLossCFPti4thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotal4thyr.value;

	var ltcgLossCFNormal4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPti4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotal4thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotal4thyr.value=eval(parseInt(coalesce(ltcgLossCFNormal4thyr.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPti4thyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotal4thyr.value;
	/*2016-17*/

	var hpLossCFNormal3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPti3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotal3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotal3rdyr.value=eval(parseInt(coalesce(hpLossCFNormal3rdyr.value), 10))+ eval(parseInt(coalesce(hpLossCFPti3rdyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotal3rdyr.value;

	var broughtFrwrdBusLoss3thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BA3thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCF3thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCF3thyr.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLoss3thyr.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BA3thyr.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCF3thyr.value;

	
	
	var stcgLossCFNormal3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPti3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotal3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotal3rdyr.value=eval(parseInt(coalesce(stcgLossCFNormal3rdyr.value), 10))+ eval(parseInt(coalesce(stcgLossCFPti3rdyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotal3rdyr.value;

	var ltcgLossCFNormal3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPti3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotal3rdyr= document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotal3rdyr.value=eval(parseInt(coalesce(ltcgLossCFNormal3rdyr.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPti3rdyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotal3rdyr.value;
	/*2017-18*/

	var hpLossCFNormal2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPti2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotal2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotal2ndyr.value=eval(parseInt(coalesce(hpLossCFNormal2ndyr.value), 10))+ eval(parseInt(coalesce(hpLossCFPti2ndyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotal2ndyr.value;

	
	var broughtFrwrdBusLoss2thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BA2thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCF2thyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCF2thyr.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLoss2thyr.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BA2thyr.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCF2thyr.value;

	
	
	var stcgLossCFNormal2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPti2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotal2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotal2ndyr.value=eval(parseInt(coalesce(stcgLossCFNormal2ndyr.value), 10))+ eval(parseInt(coalesce(stcgLossCFPti2ndyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotal2ndyr.value;

	var ltcgLossCFNormal2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPti2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotal2ndyr= document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotal2ndyr.value=eval(parseInt(coalesce(ltcgLossCFNormal2ndyr.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPti2ndyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotal2ndyr.value;
	/*2018-19*/

	var hpLossCFNormalPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPtiPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotalPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotalPrevyr.value=eval(parseInt(coalesce(hpLossCFNormalPrevyr.value), 10))+ eval(parseInt(coalesce(hpLossCFPtiPrevyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotalPrevyr.value;

	var broughtFrwrdBusLossPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BAPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCFPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCFPrevyr.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLossPrevyr.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BAPrevyr.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCFPrevyr.value;

	
	
	var stcgLossCFNormalPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPtiPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotalPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotalPrevyr.value=eval(parseInt(coalesce(stcgLossCFNormalPrevyr.value), 10))+ eval(parseInt(coalesce(stcgLossCFPtiPrevyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotalPrevyr.value;

	var ltcgLossCFNormalPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPtiPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotalPrevyr= document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotalPrevyr.value=eval(parseInt(coalesce(ltcgLossCFNormalPrevyr.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPtiPrevyr.value), 10));
	document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotalPrevyr.value;


	var hpLossCFNormalPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.hpLossCFNormal')[0];
	var hpLossCFPtiPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.hpLossCFPti')[0];
	var hpLossCFTotalPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.hpLossCFTotal')[0];
	hpLossCFTotalPrevyr1819.value=eval(parseInt(coalesce(hpLossCFNormalPrevyr1819.value), 10))+ eval(parseInt(coalesce(hpLossCFPtiPrevyr1819.value), 10));
	document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.hpLossCFTotal')[0]=hpLossCFTotalPrevyr1819.value;


	var broughtFrwrdBusLossPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.broughtFrwrdBusLoss')[0];
	var amtAdjAccOptTaxUs115BAA_115BAPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0];
	var busLossOthThanSpecLossCFPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.busLossOthThanSpecLossCF')[0];
	busLossOthThanSpecLossCFPrevyr1819.value=zeroOrMore(eval(parseInt(coalesce(broughtFrwrdBusLossPrevyr1819.value), 10))- eval(parseInt(coalesce(amtAdjAccOptTaxUs115BAA_115BAPrevyr1819.value), 10)));
	document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.busLossOthThanSpecLossCF')[0]=busLossOthThanSpecLossCFPrevyr1819.value;

	
	
	var stcgLossCFNormalPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.stcgLossCFNormal')[0];
	var stcgLossCFPtiPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.stcgLossCFPti')[0];
	var stcgLossCFTotalPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.stcgLossCFTotal')[0];
	stcgLossCFTotalPrevyr1819.value=eval(parseInt(coalesce(stcgLossCFNormalPrevyr1819.value), 10))+ eval(parseInt(coalesce(stcgLossCFPtiPrevyr1819.value), 10));
	document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.stcgLossCFTotal')[0]=stcgLossCFTotalPrevyr1819.value;

	var ltcgLossCFNormalPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.ltcgLossCFNormal')[0];
	var ltcgLossCFPtiPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.ltcgLossCFPti')[0];
	var ltcgLossCFTotalPrevyr1819= document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.ltcgLossCFTotal')[0];
	ltcgLossCFTotalPrevyr1819.value=eval(parseInt(coalesce(ltcgLossCFNormalPrevyr1819.value), 10))+ eval(parseInt(coalesce(ltcgLossCFPtiPrevyr1819.value), 10));
	document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.ltcgLossCFTotal')[0]=ltcgLossCFTotalPrevyr1819.value;

	
}

function cflFieldxiii(){
	
//Balance available of Total of earlier year b/f (xi-xii)
	
	if(coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.hpLossCFTotal')>coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.hpLossCFTotal'))
	{
		document.getElementsByName('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.hpLossCFTotal')[0].value=0;
	}
	if(coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.stcgLossCFTotal')>coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.stcgLossCFTotal'))
	{
		document.getElementsByName('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.stcgLossCFTotal')[0].value=0;
	}
	if(coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.ltcgLossCFTotal')>coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.ltcgLossCFTotal'))
	{
		document.getElementsByName('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.ltcgLossCFTotal')[0].value=0;
	}
	if(coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.othSrcLossRaceHorseCF')>coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.othSrcLossRaceHorseCF'))
	{
		document.getElementsByName('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.othSrcLossRaceHorseCF')[0].value=0;
	}
	var BFLossestotalEarlierYrsHP = document
			.getElementsByName('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.hpLossCFTotal')[0];
	BFLossestotalEarlierYrsHP.value = zeroOrMore(coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.hpLossCFTotal')
			- coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.hpLossCFTotal'));

	var BFLossestotalEarlierYrsBUSS = document
			.getElementsByName('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.busLossOthThanSpecLossCF')[0];
	BFLossestotalEarlierYrsBUSS.value = zeroOrMore(coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.busLossOthThanSpecLossCF')
			);

	var BFLossestotalEarlierYrsSTCG = document
			.getElementsByName('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.stcgLossCFTotal')[0];
	BFLossestotalEarlierYrsSTCG.value = zeroOrMore(coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.stcgLossCFTotal')
			- coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.stcgLossCFTotal'));

	var BFLossestotalEarlierYrsLTCG = document
			.getElementsByName('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.ltcgLossCFTotal')[0];
	BFLossestotalEarlierYrsLTCG.value = zeroOrMore(coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.ltcgLossCFTotal')
			- coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.ltcgLossCFTotal'));

	var BFLossestotalEarlierYrsOTHSRC = document
			.getElementsByName('scheduleCFL.BFLossestotalEarlierYrs.balanceSummaryDetail.othSrcLossRaceHorseCF')[0];
	BFLossestotalEarlierYrsOTHSRC.value = zeroOrMore(coalesceSetRet('scheduleCFL.totalOfBFLossesEarlierYrs.lossSummaryDetail.othSrcLossRaceHorseCF')
			- coalesceSetRet('scheduleCFL.BFLossesEarlierYrs.lossUnitHolder.othSrcLossRaceHorseCF'));
}
function enableDepreciation()
{
	var flag115BA = document
	.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;

	if (flag115BA == '115BAB') {
		document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.deductions.expenses')[0].readOnly= true;
		document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.deductions.expenses')[0].value='';
		
		document.getElementsByName('scheduleOS.incFromOwnHorse.deductSec57')[0].readOnly= true;
		document.getElementsByName('scheduleOS.incFromOwnHorse.deductSec57')[0].value='';
	}else{
		
		document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.deductions.expenses')[0].readOnly= false;
		document.getElementsByName('scheduleOS.incFromOwnHorse.deductSec57')[0].readOnly= false;

	}
		
		
	var rentFromMachPlantBldgs = document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs')[0].value;
	if((parseInt(coalesce(document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs')[0].value),10)>0) && (flag115BA != '115BAB' ))
	{
		document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation')[0].readOnly= false;
	}
	else
	{
		document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation')[0].readOnly= true;
		document.getElementsByName('scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation')[0].value='';
	}
}


function validateSchBPA5(){
	
	var amtSchBPA5=document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.totExempIncPL')[0];
	var schEIfield1=document.getElementsByName('scheduleEI.interestInc')[0];
	var schEIfield2=document.getElementsByName('scheduleEI.dividendInc')[0];
	var schEIfield3i=document.getElementsByName('scheduleEI.grossAgriReceipt7B8')[0];
	var schEIfield4=document.getElementsByName('scheduleEI.others')[0];
	var schEIfield5=document.getElementsByName('scheduleEI.incChrgblAsPerDTAA')[0];
	var schEIfield6=document.getElementsByName('scheduleEI.incNotChrgblToTax')[0];
	
	var sumTotalEI = parseInt(coalesce(schEIfield1.value),10)+
					 parseInt(coalesce(schEIfield2.value),10)+
					 parseInt(coalesce(schEIfield3i.value),10)+
					 parseInt(coalesce(schEIfield4.value),10)+
					 parseInt(coalesce(schEIfield5.value),10)+
					 parseInt(coalesce(schEIfield6.value),10);
	
	if(amtSchBPA5.value > sumTotalEI){
		j.setFieldError('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.totExempIncPL','Value at Row no 5d cannot be  more than the SUM of row no. 1,2,3(i),4, 5 and 6 in Exempt income Schedule');
 		addErrorXHTML(document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.incCredPL.totExempIncPL')[0],'Value at Row no 5d cannot be  more than the SUM of row no. 1,2,3(i),4, 5 and 6 in Exempt income Schedule',true);
	}
	
}
	
function schBPDep321I()
{
	var tab = document.getElementById('natOfBustTradeTableId');
	var noOfRows = tab.rows.length;
	var count = 0;
	for (var i = 0; i < (noOfRows - 3); i++) {
		count++;
		var code = document.getElementsByName('partAGEN2For6.natOfBus.business[' + i + '].code')[0].value;
		if ((code == '05001') || (code == '06008')) {
			document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321I')[0].readOnly = false;
			calcSchBPBalFor6();
			break;
		} 
		else {

			document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321I')[0].value = '';
			document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321I')[0].readOnly = true;
			calcSchBPBalFor6();
			}
	}
}
function enablePt12ii(){
	var tab = document.getElementById('natOfBustTradeTableId');
	var noOfRows = tab.rows.length;
	var flag = true;
	if(noOfRows==6){
		var codeA = document.getElementsByName('partAGEN2For6.natOfBus.business[0].code')[0].value;
		var codeB = document.getElementsByName('partAGEN2For6.natOfBus.business[1].code')[0].value;
		var codeC = document.getElementsByName('partAGEN2For6.natOfBus.business[2].code')[0].value;
		if((codeA==codeB)||(codeB==codeC)||(codeC==codeA)){
			flag=false;
		}
	}	
	if(flag== true && noOfRows==6 ){

		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321I')[0].readOnly = false;
	}else{

		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321I')[0].value = '';
		document.getElementsByName('itr6ScheduleBP.businessIncOthThanSpec.depreciationAllowITAct32.depreciationAllowUs321I')[0].readOnly = true;
		schBPDep321I();
	}
}

function ValidateUdAsyr(){

		var table = document.getElementById('scheduleUD');
		var allInputTags = table.getElementsByTagName('input');

		var rowCount = table.rows.length;
		var sumTotal = 0;
		for (var i = 0; i < rowCount - 5; i++) {

if (document.getElementsByName('itrScheduleUD.scheduleUD[' + i + '].assYr')[0].value.substring(0,4) > 2019 ) 

{
		

//	if (allInputTags[i].name.match("assYr")) {
	
			j
					.setFieldError(
							'',
							'Assessment Year cannot be greater than 2019-20 in schedule UD');
			addError(
					'',
					'Assessment Year cannot be greater than 2019-20 schedule UD',
					true);
		
	}	
//}

}
		

}




function disable10AAOn115(){
	
	
	var flag115BA = document
	.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var tab1 = document.getElementById('page30');
	var tab2 = document.getElementById('scheduleDI10AA');

	
	var allInputTags1 = tab1.getElementsByTagName('input');
	var allInputTags2 = tab2.getElementsByTagName('input');

	for (var i = 0; i < allInputTags1.length; i++) {
		if (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB') {
			allInputTags1[i].value = "";
			allInputTags1[i].disabled = true;
			$(tab1).find('.addbtn').prop('hidden', true);
		}else{
			allInputTags1[i].disabled = false;
			$(tab1).find('.addbtn').prop('hidden', false);
		}
	}
	for (var i = 0; i < allInputTags2.length; i++) {
		if (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB') {
			if(allInputTags2[i].name.match("DateSEZAct") )
			{
				continue;
			}
			
			allInputTags2[i].value = "";
			allInputTags2[i].readonly = true;
		}else{
			allInputTags2[i].readonly = false;
		}
	}
	
	
	var table = document.getElementById('scheduleUD');

	var rowCount = table.rows.length;
	
	var residentialStatus = document
	.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	

		for (var i = 0; i < rowCount - 5; i++) {
		if (residentialStatus == 'NRI') {

			document.getElementsByName('itrScheduleUD.scheduleUD[' + i
					+ '].amtBFUD3a')[0].value = '';

			document.getElementsByName('itrScheduleUD.scheduleUD[' + i
					+ '].amtBFUD3a')[0].readOnly = true;
		} else if (flag115BA == '115BAA')

		{
			document.getElementsByName('itrScheduleUD.scheduleUD[' + i
					+ '].amtBFUD3a')[0].readOnly = false;

		} else {

			document.getElementsByName('itrScheduleUD.scheduleUD[' + i
					+ '].amtBFUD3a')[0].value = '';

			document.getElementsByName('itrScheduleUD.scheduleUD[' + i
					+ '].amtBFUD3a')[0].readOnly = true;
		}
}
	
	
	
	var selects = tab1.getElementsByTagName('SELECT');

	for (var i = 0; i < selects.length; i++) {
		if (flag115BA == '115BA' || flag115BA == '115BAA' || flag115BA == '115BAB') {
			selects[i].disabled = true;
			selects[i].selectedIndex = 0;
		}else{
			
			selects[i].disabled = false;
		}	
		
	}
}


function validatePanOrAadhaarPL47() {

	var tab = document.getElementById('badDebtPL');
	var rowCount = tab.rows.length - 2;
	for (var i = 0; i < rowCount; i++) {
		var aadhaarNum = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
						+ i + '].aadhaarNum')[0].value;
		var panNum = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
						+ i + '].pan')[0].value;
		var amount = document
				.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
						+ i + '].amount')[0].value;
		if (amount != '') {/*
			if (aadhaarNum == '' && panNum == '') {

				j
						.setFieldError(
								'partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
										+ i + '].pan',
								'Please enter  either PAN or aadhaar in point 47(i) of schedule P&L.');
				addErrorXHTML(
						document
								.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
										+ i + '].pan')[0],
						'Please enter  either PAN or aadhaar in point 47(i) of schedule P&L.',
						true);
			}
		*/}
		if(aadhaarNum == '000000000000' ||aadhaarNum == '111111111111' ){
			
			j
			.setFieldError(
					'partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
							+ i + '].aadhaarNum',
					'Aadhaar Number should not be all Zeros or all ones in schedule P&L.');
	addErrorXHTML(
			document
					.getElementsByName('partapl.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
							+ i + '].aadhaarNum')[0],
			'Aadhaar Number should not be all Zeros or all ones in schedule P&L.',
			true);	
		}
		
	}

}



function validatePanOrAadhaarPLINDAS47() {

	var tab = document.getElementById('badDebtAmtDtls');
	var rowCount = tab.rows.length - 2;

	for (var i = 0; i < rowCount; i++) {
		var aadhaarNum = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
						+ i + '].aadhaarNum')[0].value;
		var panNum = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
						+ i + '].pAN')[0].value;
		var amount = document
				.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
						+ i + '].amount')[0].value;
		if (amount != '') {/*

			if (aadhaarNum == '' && panNum == '') {
				j
						.setFieldError(
								'PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
										+ i + '].pAN',
								'Please enter  either PAN or aadhaar in point 47(i) of schedule P&L INDAS.');
				addErrorXHTML(
						document
								.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
										+ i + '].pAN')[0],
						'Please enter  either PAN or aadhaar in point 47(i) of schedule P&L INDAS.',
						true);
			}
		*/}
		
		
	if(aadhaarNum == '000000000000' ||aadhaarNum == '111111111111' ){
			
			j
			.setFieldError(
					'PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
							+ i + '].aadhaarNum',
					'Aadhaar Number should not be all Zeros or all ones in schedule P&L INDAS.');
	addErrorXHTML(
			document
					.getElementsByName('PartaPLIndAS.debitsToPL.debitPlAcnt.badDebtDtls.badDebtAmtDtls['
							+ i + '].aadhaarNum')[0],
			'Aadhaar Number should not be all Zeros or all ones in schedule P&L INDAS.',
			true);	
		}
	}

}

function validatePanOrAadhaarKeyPerson() {
	var tab = document.getElementById('dtlsMngDir');
	var rowCount = tab.rows.length - 3;
	for (var i = 0; i < rowCount; i++) {
		var aadhaarNum = document
				.getElementsByName('partAGEN2For6.keyPersons['
						+ i + '].keyPerAadhaar')[0].value;
		var panNum = document
				.getElementsByName('partAGEN2For6.keyPersons['
						+ i + '].keyPerPAN')[0].value;
		var personName = document
				.getElementsByName('partAGEN2For6.keyPersons['
						+ i + '].personName')[0].value;
/*		if (personName != '') {
			if (aadhaarNum == '' && panNum == '') {
				j
						.setFieldError(
								'partAGEN2For6.keyPersons['
										+ i + '].keyPerPAN',
								'Please enter  either PAN or aadhaar in  key persons  of Schedule Part A general 2.');
				addErrorXHTML(
						document
								.getElementsByName('partAGEN2For6.keyPersons['
										+ i + '].keyPerPAN')[0],
						'Please enter  either PAN or aadhaar in  key persons of Schedule Part A general 2.',
						true);
			}
		}*/
		
		
	if(aadhaarNum == '000000000000' ||aadhaarNum == '111111111111' ){
			
			j
			.setFieldError(
					'partAGEN2For6.keyPersons['
							+ i + '].keyPerAadhaar',
					'Aadhaar Number should not be all Zeros or all ones in key persons of Schedule Part A general 2.');
	addErrorXHTML(
			document
					.getElementsByName('partAGEN2For6.keyPersons['
							+ i + '].keyPerAadhaar')[0],
			'Aadhaar Number should not be all Zeros or all ones in key persons of Schedule Part A general 2.',
			true);	
		}
	}
}
function validatePanOrAadhaarShareHolder() {
	var tab = document.getElementById('shareInfo');
	var rowCount = tab.rows.length - 3;
	for (var i = 0; i < rowCount; i++) {
		var aadhaarNum = document
				.getElementsByName('partAGEN2For6.shareHolderInfo['
						+ i + '].shareHolderAadhaar')[0].value;
		var panNum = document
				.getElementsByName('partAGEN2For6.shareHolderInfo['
						+ i + '].shareHolderPAN')[0].value;
		var shareHolderInfoName = document
				.getElementsByName('partAGEN2For6.shareHolderInfo['
						+ i + '].shareHolderInfoName')[0].value;
		if (shareHolderInfoName != '') {/*
			if (aadhaarNum == '' && panNum == '') {
				j
						.setFieldError(
								'partAGEN2For6.shareHolderInfo['
										+ i + '].shareHolderPAN',
								'Please enter  either PAN or aadhaar in  SHAREHOLDERS INFORMATION  of Schedule Part A general 2.');
				addErrorXHTML(
						document
								.getElementsByName('partAGEN2For6.shareHolderInfo['
										+ i + '].shareHolderPAN')[0],
						'Please enter  either PAN or aadhaar in  SHAREHOLDERS INFORMATION of Schedule Part A general 2.',
						true);
			}
		*/}
		
		
	if(aadhaarNum == '000000000000' ||aadhaarNum == '111111111111' ){
			
			j
			.setFieldError(
					'partAGEN2For6.shareHolderInfo['
							+ i + '].shareHolderAadhaar',
					'Aadhaar Number should not be all Zeros or all ones in SHAREHOLDERS INFORMATION of Schedule Part A general 2.');
	addErrorXHTML(
			document
					.getElementsByName('partAGEN2For6.shareHolderInfo['
							+ i + '].shareHolderAadhaar')[0],
			'Aadhaar Number should not be all Zeros or all ones in SHAREHOLDERS INFORMATION of Schedule Part A general 2.',
			true);	
		}
	}
}
function validatePanOrAadhaarOwnership() {
	var tab = document.getElementById('ownerInfo');
	var rowCount = tab.rows.length - 3;
	for (var i = 0; i < rowCount; i++) {
		var aadhaarNum = document
				.getElementsByName('partAGEN2For6.ownershipInfo['
						+ i + '].ownerAadhar')[0].value;
		var panNum = document
				.getElementsByName('partAGEN2For6.ownershipInfo['
						+ i + '].ownerPAN')[0].value;
		var ownershipInfoName = document
				.getElementsByName('partAGEN2For6.ownershipInfo['
						+ i + '].ownershipInfoName')[0].value;
		if (ownershipInfoName != '') {/*
			if (aadhaarNum == '' && panNum == '') {
				j
						.setFieldError(
								'partAGEN2For6.ownershipInfo['
										+ i + '].ownerPAN',
								'Please enter  either PAN or aadhaar in  OWNERSHIP INFORMATION  of Schedule Part A general 2.');
				addErrorXHTML(
						document
								.getElementsByName('partAGEN2For6.ownershipInfo['
										+ i + '].ownerPAN')[0],
						'Please enter  either PAN or aadhaar in  OWNERSHIP INFORMATION of Schedule Part A general 2.',
						true);
			}
		*/}
		
		
	if(aadhaarNum == '000000000000' ||aadhaarNum == '111111111111' ){
			
			j
			.setFieldError(
					'partAGEN2For6.ownershipInfo['
							+ i + '].ownerAadhar',
					'Aadhaar Number should not be all Zeros or all ones in OWNERSHIP INFORMATION of Schedule Part A general 2.');
	addErrorXHTML(
			document
					.getElementsByName('partAGEN2For6.ownershipInfo['
							+ i + '].ownerAadhar')[0],
			'Aadhaar Number should not be all Zeros or all ones in OWNERSHIP INFORMATION of Schedule Part A general 2.',
			true);	
		}
	}
}
function panValidationTDS(tableId) {
	var pan = document.getElementsByName('partAGEN1.orgFirmInfo.panNumber')[0].value;
	var table = document.getElementById(tableId);
	var allInputTags = table.getElementsByTagName('input');
	for(var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("pANofOtherPerson$")) {
			if(allInputTags[i].value != '' && (allInputTags[i].value == pan)){
				j.setFieldError(allInputTags[i].name,'PAN cannot be same as assesse PAN in Schedule TDS');
			}
		}
	}
}
function enableGrossAmtTDS1()
{
	var tdsTable = document.getElementById('scheduleTDS1');
	var noOfRows = tdsTable.rows.length;
	for (var i = 0; i < (noOfRows - 6); i++) {
		if(document.getElementsByName('scheduleTDS1.tdSonOthThanSal['+i+'].headOfIncome')[0].value=='NA')
		{
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal['+i+'].grossAmount')[0].readOnly=true;
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal['+i+'].grossAmount')[0].value='';
		}
		else
		{
			document.getElementsByName('scheduleTDS1.tdSonOthThanSal['+i+'].grossAmount')[0].readOnly=false;
		}
	}
}
/*
function enableGrossAmtTDS2()
{
	var tdsTable = document.getElementById('scheduleTDS2');
	var noOfRows = tdsTable.rows.length;
	for (var i = 0; i < (noOfRows - 6); i++) {
		if(document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+i+'].headOfIncome')[0].value=='NA')
		{
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+i+'].grossAmount')[0].readOnly=true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+i+'].grossAmount')[0].value='';
		}
		else
		{
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+i+'].grossAmount')[0].readOnly=false;
		}
	}
}
*/
function addRowSchedPTIFor3(nocheck) {
	var mainTable = document.getElementById('schedulePTI').rows;
	var noOfRows = mainTable.length;
	var tobeInsertBefore = document.getElementById('schedulePTIAddRow');
	var flag = true;
	var checkFirst = true;
	var totRow = document.getElementById('schedulePTIFirst').cells[0].textContent;
	var iterate = eval(parseInt(totRow, 10));
	var indexValue = eval(parseInt(((parseInt(noOfRows, 10) - 3) / 15) + 1));
	var isRowBlank = true;
	for ( var i = 0; i < 15; i++) {
		if (!checkRowBlank('schedulePTI', (3+i), 0)) {
			isRowBlank = false;
			break;
		}
	}
	if (!isRowBlank || nocheck) {
		for ( var i = 1; i < mainTable.length; i++) {
			var cloneNode = mainTable[i].cloneNode(true);
			if (flag) {
				if (checkFirst) {
					iterate = eval(indexValue - 1);
					cloneNode.cells[0].innerHTML = indexValue;
					checkFirst = false;
				}
				// Numbering
				var inputTags = cloneNode.getElementsByTagName('input');
				for ( var a = 0; a < inputTags.length; a++) {
					inputTags[a].name = inputTags[a].name.replace('[0]', '['
							+ iterate + ']');
					inputTags[a].id = inputTags[a].name.replace(/([\.\[\]])/g,
					'_').replace(/(__)/g, '_');
					inputTags[a].value = '';
					var blurAttr = inputTags[a].getAttribute('onblur');
					if (blurAttr != null) {
						blurAttr = blurAttr + ";";
					} else {
						blurAttr = "";
					}
					inputTags[a].setAttribute('onblur', blurAttr
							+ 'j.blur(this,this.name,this.value);');
				}
				var selectTags = cloneNode.getElementsByTagName('select');
				for (var a = 0; a < selectTags.length; a++) {
					selectTags[a].name = selectTags[a].name.replace('[0]', '['
							+ iterate + ']');
					selectTags[a].value = '';
					selectTags[a].id = selectTags[a].name.replace(
							/([\.\[\]])/g, '_').replace(/(__)/g, '_');
					var blurAttr = selectTags[a].getAttribute('onblur');
					if (blurAttr != null) {
						blurAttr = blurAttr + ";";
					} else {
						blurAttr = "";
					}
					selectTags[a].setAttribute('onblur', blurAttr
							+ 'j.blur(this,this.name,this.value);');
				}
				document.getElementById('schedulePTI').getElementsByTagName(
				'tr')[0].parentNode.insertBefore(cloneNode,
						tobeInsertBefore);
			}
			if (mainTable[i].id == 'schedulePTIEnd') {
				flag = false;
				break;
			}
		}
		if ($('#schedulePTIAddRow')[0].parentNode.children.length == 12) {
			$('#delPTIButtonId').prop('disabled', true);
		} else if ($('#schedulePTIAddRow')[0].parentNode.children.length > 12) {
			$('#delPTIButtonId').prop('disabled', false);
		}
	} else {
		addErrorXHTML(
				'',
		'Please fill in all the mandatory fields in the last row before adding another row.');
	}
	checkMaxLengthLimit();
}
function deleteRowPTI2(tableId , noOfHeader , noOfFooter){
	try{
		var mytable = document.getElementById(tableId);
		var rowCount = mytable.rows.length;
		var itemCount = (rowCount - 3 )/ 15;
		noOfHeader = parseInt(noOfHeader , 10);
		var isChecked=false;
		var listOfCheckBox = mytable.getElementsByTagName('input');
		var totalChecked = 0;
		for(var z=0; z<listOfCheckBox.length; z++){
			if(listOfCheckBox[z].name.match(".chosenCheckBox$")){
				if(listOfCheckBox[z].checked==true){
					totalChecked = eval( parseInt(totalChecked,10) +1);
					isChecked=true;
				}
			}
		}
		if(!isChecked){
			addErrorXHTML('','Please select a checkbox for deleting row');
		}
		for(var j=1; j<=totalChecked ; j++){
			var totalNoOfInput = mytable.getElementsByTagName('input');
			for(var z=0; z<totalNoOfInput.length; z++){
				if(totalNoOfInput[z].name.match(".chosenCheckBox$")){
					var akhilIndex1 = eval(parseInt(totalNoOfInput[z].name.lastIndexOf('[') ,10)+1);
					var akhilIndex2 = eval(parseInt(totalNoOfInput[z].name.lastIndexOf(']') ,10));
					var rowNumber = totalNoOfInput[z].name.substring(akhilIndex1, akhilIndex2);
					rowNumber = parseInt(rowNumber ,10);
					var myCurrtable = document.getElementById(tableId);
					var rowCurrCount = myCurrtable.rows.length;
					if(totalNoOfInput[z].checked==true){
						if((rowNumber!=0) || (rowNumber==0 &&  parseInt(eval(rowCurrCount-noOfHeader-noOfFooter)/9)>1) ){
							rowNumber = eval(parseInt(rowNumber,10) * 9 + noOfHeader);
							for(var i=0;i<15;i++){
								mytable.deleteRow(rowNumber);
							}
							//To Do - reset the name of row for all input , textarea, select
							var newTrList = mytable.getElementsByTagName('tr');
							var newTrListLength = eval(parseInt(newTrList.length ,10)-noOfFooter);
							for( var q=rowNumber; q < newTrListLength ; q++ ){
								var p = parseInt((q-noOfHeader) /9) + noOfHeader;
								//set the serial number;
								if((q-noOfHeader)%9==0){
									if(noOfHeader==2){
										newTrList[q].getElementsByTagName('td')[0].innerHTML = parseInt(p-1,10);
									}else if(noOfHeader==1){
										newTrList[q].getElementsByTagName('td')[0].innerHTML = parseInt(p,10);
									}else if(noOfHeader==3){
										newTrList[q].getElementsByTagName('td')[0].innerHTML = parseInt(p-2,10);
									}
								}
								var allInputTags = newTrList[q].getElementsByTagName('input');
								for(var zz=0; zz<allInputTags.length ; zz++ ){
									var index1= allInputTags[zz].name.lastIndexOf('[');
									var index2= allInputTags[zz].name.lastIndexOf(']');
									var str1 = allInputTags[zz].name.substring(0, index1);
									var str3 = allInputTags[zz].name.substring(index2 + 1, allInputTags[zz].name.length);
									allInputTags[zz].name = str1+'[' +eval(parseInt(p,10)-noOfHeader) +']'+str3;
								}
								var allTextAreaTags = newTrList[q].getElementsByTagName('textarea');
								for(var zz=0; zz<allTextAreaTags.length ; zz++ ){
									var index1= allTextAreaTags[zz].name.lastIndexOf('[');
									var index2= allTextAreaTags[zz].name.lastIndexOf(']');
									var str1 = allTextAreaTags[zz].name.substring(0, index1);
									var str3 = allTextAreaTags[zz].name.substring(index2 + 1, allTextAreaTags[zz].name.length);
									allTextAreaTags[zz].name = str1+'[' +eval(parseInt(p,10)-noOfHeader) +']'+str3;
								}
							}
							break;
						}else if((rowNumber==0)  && (parseInt(eval(rowCurrCount-noOfHeader-noOfFooter)/9)==1)){
							//Vacate the content if its first row
							for(var m=0; m<15; m++){
								var firstRow = mytable.getElementsByTagName('tr')[parseInt(noOfHeader) + m];
								if(firstRow.getElementsByTagName('input').length > 0 ){
								var firstInputBox = firstRow.getElementsByTagName('input')[0];
								firstInputBox.checked = false;
								var allInputTags = firstRow.getElementsByTagName('input');
								for ( var i = 0; i < allInputTags.length; i++) {
									allInputTags[i].value = "";
								}
								var allSelectTags = firstRow.getElementsByTagName('select');
								for ( var i = 0; i < allSelectTags.length; i++) {
									var elem = allSelectTags[i];
									elem[0].selected = true;
								}
								var allTextAreaTags = firstRow.getElementsByTagName('textarea');
								for ( var i = 0; i < allTextAreaTags.length; i++) {
									allTextAreaTags[i].value = "";
								}
							  }
							}
						}
					}
				}
			}
		}
	}catch(e){
		alert('exception caught in =' +e.stack );
	}
}
function validateDed54EC(){
	
	var tab2 = document.getElementById('schduleCGDedD1C');
	var noOfRows2 = tab2.rows.length;
	for (var i = 0; i < (noOfRows2 - 2); i++) {
		
		var amtInvested = document
		.getElementsByName('scheduleCGPost45.deducClaimInfo.deducClaimDtlsUs54EC['
				+ i + '].amtInvested')[0].value;
		
		if(amtInvested > 5000000)
		{
			j.setFieldError('','Amount invested in specified/notified bonds should not exceeds Rs. 50 Lakhs in Table D u/s 54EC ');
			addErrorXHTML( document.getElementsByName('')[0],
					'Amount invested in specified/notified bonds should not exceeds Rs. 50 Lakhs in Table D u/s 54EC',
					true);
		}
		
		
		
	}
	
	
}
function validateScheduleCFlXvii()
{
	var totalLossCFCurrenthpLossCFTotal = document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.hpLossCFTotal')[0].value;
	var currentAYlossDetailhpLossCFTotal = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.hpLossCFTotal')[0].value;
	
	if(parseInt(totalLossCFCurrenthpLossCFTotal,10)>parseInt(currentAYlossDetailhpLossCFTotal,10))
	{
		j.setFieldError('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.hpLossCFTotal','Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL');
 		addErrorXHTML(document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.hpLossCFTotal')[0],'Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL',true);
	}
	
	var totalLossCFCurrentstcgLossCFTotal = document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.stcgLossCFTotal')[0].value;
	var currentAYlossDetailstcgLossCFTotal = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.stcgLossCFTotal')[0].value;
	
	if(parseInt(totalLossCFCurrentstcgLossCFTotal,10)>parseInt(currentAYlossDetailstcgLossCFTotal,10))
	{
		j.setFieldError('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.stcgLossCFTotal','Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL');
 		addErrorXHTML(document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.stcgLossCFTotal')[0],'Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL',true);
	}
	var totalLossCFCurrentltcgLossCFTotal = document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.ltcgLossCFTotal')[0].value;
	var currentAYlossDetailltcgLossCFTotal = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.ltcgLossCFTotal')[0].value;
	
	if(parseInt(totalLossCFCurrentltcgLossCFTotal,10)>parseInt(currentAYlossDetailltcgLossCFTotal,10))
	{
		j.setFieldError('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.ltcgLossCFTotal','Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL');
 		addErrorXHTML(document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.ltcgLossCFTotal')[0],'Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL',true);
	}
	var totalLossCFCurrentothSrcLossRaceHorseCF = document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.othSrcLossRaceHorseCF')[0].value;
	var currentAYlossDetailothSrcLossRaceHorseCF = document.getElementsByName('scheduleCFL.currentAYloss.lossSummaryDetail.othSrcLossRaceHorseCF')[0].value;
	
	if(parseInt(totalLossCFCurrentothSrcLossRaceHorseCF,10)>parseInt(currentAYlossDetailothSrcLossRaceHorseCF,10))
	{
		j.setFieldError('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.othSrcLossRaceHorseCF','Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL');
 		addErrorXHTML(document.getElementsByName('scheduleCFL.totalLossCFCurrent.lossSummaryDetail.othSrcLossRaceHorseCF')[0],'Amount entered sl no at xvii cannot be higher than amount at sl no xv in Schedule CFL',true);
	}
}
function enableStcgMutualFund()
{
	schCgA3greyOff();
	var residentialStatus=document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var table1 = document.getElementById('scheduleCGstcg2');
	var rowCount1 = table1.rows.length / 10;
	if(residentialStatus=='RES')
	{
		for (var k = 0; k < rowCount1; k++) {
			var section = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT['
					+ k + '].section')[0];
			for (var i = 0; section.length > 0; i++) {
				section.options.remove(0);
			}
			var option1 = document.createElement("option");
			option1.text = "Select";
			option1.value = "";
			var option2 = document.createElement("option");
			option2.text = "(i) 111A [for others]";
			option2.value = "1A";
			section.add(option1);
			section.add(option2);
		}
	}
	else
	{
		for (var k = 0; k < rowCount1; k++) {
			var section = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT['
					+ k + '].section')[0];
			for (var i = 0; section.length > 0; i++) {
				section.options.remove(0);
			}
			var option1 = document.createElement("option");
			option1.text = "Select";
			option1.value = "";
			var option2 = document.createElement("option");
			option2.text = "(i) 111A [for others]";
			option2.value = "1A";
			var option3 = document.createElement("option");
			option3.text = "(ii) 115AD(1)(b)(ii)[proviso for Foreign Institutional Investors]";
			option3.value = "5AD1biip";
			section.add(option1);
			section.add(option2);
			section.add(option3);
		}
	}
}
function enableStcgMutualFundOnload()
{
	var residentialStatus=document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var table1 = document.getElementById('scheduleCGstcg2');
	var rowCount1 = table1.rows.length / 10;
	if(residentialStatus=='RES')
	{
		for (var k = 0; k < rowCount1; k++) {
			var section = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT['
					+ k + '].section')[0];
			var selectedValue=section.value;
			for (var i = 0; section.length > 0; i++) {
				section.options.remove(0);
			}
			var option1 = document.createElement("option");
			option1.text = "Select";
			option1.value = "";
			var option2 = document.createElement("option");
			option2.text = "(i) 111A [for others]";
			option2.value = "1A";
			section.add(option1);
			section.add(option2);
			section.value=selectedValue;
		}
	}
	else
	{
		for (var k = 0; k < rowCount1; k++) {
			var section = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT['
					+ k + '].section')[0];
			var selectedValue=section.value;
			for (var i = 0; section.length > 0; i++) {
				section.options.remove(0);
			}
			var option1 = document.createElement("option");
			option1.text = "Select";
			option1.value = "";
			var option2 = document.createElement("option");
			option2.text = "(i) 111A [for others]";
			option2.value = "1A";
			var option3 = document.createElement("option");
			option3.text = "(ii) 115AD(1)(b)(ii)[proviso for Foreign Institutional Investors]";
			option3.value = "5AD1biip";
			section.add(option1);
			section.add(option2);
			section.add(option3);
			section.value=selectedValue;
		}
	}
}
function schCgA3greyOff(){
	var status = document.getElementsByName('partAGEN1.filingStatus.residentialStatus')[0].value;
	var section = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].section')[0].value;
	if(status=='RES'&& section =='5AD1biip')
	{
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].fullConsideration')[0].readOnly=true;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48aquisitCost')[0].readOnly=true;
		
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48improveCost')[0].readOnly=true;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48expOnTrans')[0].readOnly=true;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48totalDedn')[0].readOnly=true;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].balanceCG')[0].readOnly=true;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].lossSec94of7Or94of8')[0].readOnly=true;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].capgainonAssets')[0].readOnly=true;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].fullConsideration')[0].value=0;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48aquisitCost')[0].value=0;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48improveCost')[0].value=0;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48expOnTrans')[0].value=0;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48totalDedn')[0].value=0;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].balanceCG')[0].value=0;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].lossSec94of7Or94of8')[0].value=0;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].capgainonAssets')[0].value=0;
	}else{
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].fullConsideration')[0].readOnly=false;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48aquisitCost')[0].readOnly=false;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48improveCost')[0].readOnly=false;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48expOnTrans')[0].readOnly=false;
		//document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].deductSec48totalDedn')[0].readOnly=false;
		//document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].balanceCG')[0].readOnly=false;
		document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].lossSec94of7Or94of8')[0].readOnly=false;
		//document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.equityMFonSTT[0].capgainonAssets')[0].readOnly=false;
		}
}
function popOnchangeCompanyType() {/*
	if (document.getElementsByName('partAGEN1.filingStatus.sec581AFlag')[0].value == 'Y') {
		document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].disabled = false;
	} else if (document.getElementsByName('partAGEN1.filingStatus.sec581AFlag')[0].value == 'N') {
		document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].value = "";
		document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].disabled = true;
	} else {
		document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].value = "";
		document
				.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].disabled = true;
	}
*/}
function disableChapterVIA(){
	var flag115BA = document.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	var status = document.getElementsByName('partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;
	var isifsc = document.getElementsByName('partAGEN1.filingStatus.isifsc')[0].value;
	var sec581AFlag = document.getElementsByName('partAGEN1.filingStatus.sec581AFlag')[0].value;
	
	if (status=='12'){
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAB')[0].value="";
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAC')[0].value="";
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IBA')[0].value="";
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJA')[0].value="";
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJAA')[0].value="";
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].value="";
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA1A')[0].value="";
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].value="";
		
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAB')[0].readOnly=true;
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAC')[0].readOnly=true;
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IBA')[0].readOnly=true;
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJA')[0].readOnly=true;
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJAA')[0].readOnly=true;
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].readOnly=true;
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA1A')[0].readOnly=true;
		document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].readOnly=true;
	}else{
		
		if(flag115BA == '115BAA' || flag115BA == '115BAB' || flag115BA == '115BA'){
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAB')[0].value = '';
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAC')[0].value = '';
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IBA')[0].value = '';
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJA')[0].value = '';
		//	document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].value = '';
			
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAB')[0].readOnly =true;
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAC')[0].readOnly =true;
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IBA')[0].readOnly =true;
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJA')[0].readOnly =true;
		//	document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].readOnly =true;
		} else {
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAB')[0].readOnly =false;
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IAC')[0].readOnly =false;
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80IBA')[0].readOnly =false;
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80JJA')[0].readOnly =false;
		//	document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].readOnly =false;
		}
		
		//80la1a
		
		if(flag115BA == '115BAA'|| flag115BA == 'NA' || flag115BA == '' || isifsc =='Y'){
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA1A')[0].readOnly = false;
		} else {
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA1A')[0].value = '';
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA1A')[0].readOnly = true;
		}
		
		//80la
		if (flag115BA == 'NA'  || isifsc == "N" || flag115BA == '' ) {
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].readOnly = false;
		} else if (isifsc == "Y") {
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].value = '';
			document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80LA')[0].readOnly = true;
		} 
		
		
		if (sec581AFlag == 'Y') {
		
		var tab = document.getElementById('natOfBustTradeTableId');
		var noOfRows = tab.rows.length;
		for (var i = 0; i < (noOfRows - 3); i++) {
			
			var code = document.getElementsByName('partAGEN2For6.natOfBus.business[' + i + '].code')[0].value;
			
			if((code == '01001' || code == '01002' || code == '01003'
				|| code == '01004' || code == '01005'
					|| code == '01006' || code == '01007'
					|| code == '01008' || code == '01009'
					|| code == '01010' || code == '01011'
					|| code == '01012' || code == '01013'
					|| code == '01014' || code == '01015'
					|| code == '01016' || code == '01017'
					|| code == '01018') )
				{
				   document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].readOnly = false;
			       break;
			     }
			else {
					alert('loop3'+code);
				
				document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].value = "";
				document.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].readOnly = true;
				
			}
		}
		}else if (sec581AFlag == 'N') {
			document
					.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].value = "";
			document
					.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].readOnly = true;
		} else {
			document
					.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].value = "";
			document
					.getElementsByName('scheduleVIA.usrDeductUndChapVIA.section80PA')[0].readOnly = true;
		}
	}
}
function cflOn115BA(){
	var section115ba= document.getElementsByName('partAGEN1.filingStatus.section115ba')[0].value;
	if(section115ba=='115BAA' ||  section115ba=='115BA')
	{
		
		
		document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=false;
		
		}
	else
	{
		document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
		document.getElementsByName('scheduleCFL.lossCFFromPrev7ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		
		document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
		document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
		document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
		document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
		document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
		document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
		document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].value='';
	
		document.getElementsByName('scheduleCFL.lossCFFromPrev6ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		document.getElementsByName('scheduleCFL.lossCFFromPrev5ThYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		document.getElementsByName('scheduleCFL.lossCFFromPrev4thYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		document.getElementsByName('scheduleCFL.lossCFFromPrev3rdYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		document.getElementsByName('scheduleCFL.lossCFFromPrev2ndYearFromAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		document.getElementsByName('scheduleCFL.lossCFFromPrevYrToAY.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		document.getElementsByName('scheduleCFL.lossCFCurrentAssmntYear.carryFwdLossDetail.amtAdjAccOptTaxUs115BAA_115BA')[0].readOnly=true;
		
	}	
	
}
function populateHP_PTI(){
	var mainTable = document.getElementById('schedulePTI').rows;
	var rows = mainTable.length;
	var noOfRows = eval(parseInt(((parseInt(rows, 10) - 3) / 15)));
	var amount = 0;
	for ( var i = 0; i < noOfRows; i++) {
		var incFromHPnetIncome= document.getElementsByName('itrSchedulePTI.schedulePTI['+ i +'].incFromHP.netIncome')[0].value;
		amount= parseInt(coalesce(amount), 10)+ parseInt(coalesce(incFromHPnetIncome),10);
		document.getElementsByName('scheduleHP.passThroughIncome')[0].value=amount;
	}
	
}
function validateSTCGPoint5(){
	var fullConsidtnib = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnib')[0].value;
	var fullConsidtnia = document.getElementsByName('scheduleCGPost45.shortTermCapGainPost45.nRISecur115AD.fullConsidtnia')[0].value;
	if( fullConsidtnib > 0 && (fullConsidtnia == 0 ||fullConsidtnia == '') )
		{
		j.setFieldError('fullConsidtnia','Full value of consideration received/receivable in respect of unquoted shares at point 5aia in Schedule CG is mandatory  ');
		addErrorXHTML( fullConsidtnia,
				'Full value of consideration received/receivable in respect of unquoted shares at point 5aia in Schedule CG is mandatory',
				true);
		
		}
	
	
}
function scheduleHPPanValidation()
{
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);
	var verificationPAN = document.getElementsByName('verification.declaration.assesseeVerPAN')[0].value;
	var panofAssesee = document.getElementsByName('partAGEN1.orgFirmInfo.panNumber')[0].value;
	for (var i = 0; i < totHp; i++) {
			var count = i;
		
			var tab = document.getElementById('scheduleHP' + (++count));
			var sumOfCoOwner = parseFloat('0');
			var rowCount = tab.rows.length;
			for (var k = 0; k < rowCount - 2; k++) {
				panCoOwner = document
								.getElementsByName('scheduleHP.propertyDetails['
										+ i
										+ '].coOwners['
										+ k
										+ '].panCoOwner')[0].value;
				
				
				if((panCoOwner!=null || panCoOwner!='') && panCoOwner==panofAssesee)
				{
					
					j.setFieldError('scheduleHP.propertyDetails[0].coOwners[0].panCoOwner','PAN of the assesee or Co-owners PAN cannot be same in Schedule HP.');
					addErrorXHTML( 'scheduleHP.propertyDetails[0].coOwners[0].panCoOwner',
							'PAN of the assesee or Co-owners PAN cannot be same in Schedule HP.',
							true);
				}
			}
		}
}
function validatescheduleDIDate(){
	
	var table = document.getElementById('scheduleDI10AA');
	var rowCount = table.rows.length;
	alert('rowCount di'+rowCount);
	for(var i=0;i<rowCount-2;i++){
	var AmountDedSchedule10AA=document.getElementsByName('scheduleDI.deductionUnd10AA['+i+'].AmountDedSchedule10AA')[0].value;
	var DateSEZAct=document.getElementsByName('scheduleDI.deductionUnd10AA['+i+'].DateSEZAct')[0].value;
	var DeductionUs10AAFlg=document.getElementsByName('scheduleDI.deductionUnd10AA['+i+'].DeductionUs10AAFlg')[0].value;
	if(AmountDedSchedule10AA=='' && (DateSEZAct != '' || DeductionUs10AAFlg != '' ) )
		{
			j.setFieldError('','Undertaking as per schedule 10AA  and Amount of deduction as per schedule 10AA is mandatory to filled in schedule DI');
			addErrorXHTML( '','Undertaking as per schedule 10AA  and Amount of deduction as per schedule 10AA is mandatory to filled in schedule DI',
					true);
		}
		
	}
	
}
function disableFieldsBasedOnShare(){
	var tab = document.getElementById('Schedule112A');
	var rowcount = tab.rows.length;
	//index= index.parentNode.rowIndex-2;
	//alert(index);
	//index= index.rowIndex-2;
	for(var index =0;index<rowcount;index++){
	var shareonOrBefore = document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].shareOnOrBefore')[0];
	  if (shareonOrBefore.value == "AE") {
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].ISINCode')[0].readOnly = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].shareUnitName')[0].readOnly = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].noOfShare')[0].readOnly = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].salePricePerShare')[0].readOnly = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].fairMktValPerShare')[0].readOnly= true;
		
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].ISINCode')[0].disabled = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].shareUnitName')[0].disabled = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].noOfShare')[0].disabled = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].salePricePerShare')[0].disabled = true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].fairMktValPerShare')[0].disabled= true;
		
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].ISINCode')[0].value = 'INNOTREQUIRD';
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].shareUnitName')[0].value = 'CONSOLIDATED';
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].noOfShare')[0].value = 0;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].salePricePerShare')[0].value = 0;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].fairMktValPerShare')[0].value = 0;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].totSaleValue')[0].disabled=false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].totSaleValue')[0].readOnly=false;

	} else {
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].ISINCode')[0].readOnly = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].shareUnitName')[0].readOnly = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].noOfShare')[0].readOnly = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].salePricePerShare')[0].readOnly = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].fairMktValPerShare')[0].readOnly= false;
		
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].ISINCode')[0].disabled = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].shareUnitName')[0].disabled = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].noOfShare')[0].disabled = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].salePricePerShare')[0].disabled = false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].fairMktValPerShare')[0].disabled= false;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].totSaleValue')[0].disabled=true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].totSaleValue')[0].readOnly=true;
		if(	document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].ISINCode')[0].value =='INNOTREQUIRD'){
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].ISINCode')[0].value ='';
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].shareUnitName')[0].value ='';
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].noOfShare')[0].value ='';
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].salePricePerShare')[0].value ='';
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].fairMktValPerShare')[0].value ='';
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].totSaleValue')[0].disabled=true;
		document.getElementsByName('schedule112A.saleOfEquity112A['+index+'].totSaleValue')[0].readOnly=true;
	}
	}
	}
}

function disableFieldsBasedOnShare115Ad1(){

	var tab = document.getElementById('Schedule115AD');
	var rowcount = tab.rows.length;
	for(var index=0;index<rowcount;index++){
	//index= index-2;
	var shareOnOrBef= document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].shareOnOrBefore')[0];
    if(shareOnOrBef.value=="AE") {
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].ISINCode')[0].readOnly = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].shareUnitName')[0].readOnly = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].noOfShare')[0].readOnly = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].salePricePerShare')[0].readOnly = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].fairMktValPerShare')[0].readOnly= true;
	
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].ISINCode')[0].disabled = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].shareUnitName')[0].disabled = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].noOfShare')[0].disabled = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].salePricePerShare')[0].disabled = true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].fairMktValPerShare')[0].disabled= true;
	
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].ISINCode')[0].value = 'INNOTREQUIRD';
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].shareUnitName')[0].value = 'CONSOLIDATED';
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].noOfShare')[0].value = 0;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].salePricePerShare')[0].value = 0;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].fairMktValPerShare')[0].value =0;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].totSaleValue')[0].disabled=false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].totSaleValue')[0].readOnly=false;
	
} else {
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].ISINCode')[0].readOnly = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].shareUnitName')[0].readOnly = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].noOfShare')[0].readOnly = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].salePricePerShare')[0].readOnly = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].fairMktValPerShare')[0].readOnly= false;
	
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].ISINCode')[0].disabled = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].shareUnitName')[0].disabled = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].noOfShare')[0].disabled = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].salePricePerShare')[0].disabled = false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].fairMktValPerShare')[0].disabled= false;
	
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].totSaleValue')[0].disabled=true;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].totSaleValue')[0].readOnly=true;
	if(document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].ISINCode')[0].value =='INNOTREQUIRD'){
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].ISINCode')[0].value ='';
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].shareUnitName')[0].value ='';
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].noOfShare')[0].value ='';
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].salePricePerShare')[0].value ='';
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].fairMktValPerShare')[0].value ='';

	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].totSaleValue')[0].disabled=false;
	document.getElementsByName('schedule115AD.saleOfEquity115AD['+index+'].totSaleValue')[0].readOnly=false;
	}
}
}
}
function disableScheduleFor(elementId){
	var tab = document.getElementById(elementId);
	var rowcount = tab.rows.length;
	for(var i=0; i<rowcount;i++){
		var shareonOrBefore = document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].shareOnOrBefore')[0];
	    if (shareonOrBefore.value == "AE") {
	    	document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].ISINCode')[0].disabled = true;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].shareUnitName')[0].disabled = true;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].noOfShare')[0].disabled = true;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].salePricePerShare')[0].disabled = true;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].fairMktValPerShare')[0].disabled= true;
			
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].totSaleValue')[0].readOnly=false;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].totSaleValue')[0].disabled=false;
			
	    }else{
	    	document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].ISINCode')[0].disabled = false;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].shareUnitName')[0].disabled = false;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].noOfShare')[0].disabled = false;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].salePricePerShare')[0].disabled = false;
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].fairMktValPerShare')[0].disabled= false;
			
			document.getElementsByName('schedule112A.saleOfEquity112A['+i+'].totSaleValue')[0].disabled=true;
	    }	    
	}
}

function disableScheduleFor115AD(elementId){
	var tab = document.getElementById(elementId);
	var rowcount = tab.rows.length;
	for(var i=0; i<rowcount;i++){
		var shareonOrBefore = document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].shareOnOrBefore')[0];
	    if (shareonOrBefore.value == "AE") {
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].ISINCode')[0].disabled = true;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].shareUnitName')[0].disabled = true;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].noOfShare')[0].disabled = true;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].salePricePerShare')[0].disabled = true;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].fairMktValPerShare')[0].disabled= true;
			
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].totSaleValue')[0].readOnly=false;
			document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].totSaleValue')[0].disabled=false;
			
	    }else{

	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].ISINCode')[0].disabled = false;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].shareUnitName')[0].disabled = false;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].noOfShare')[0].disabled = false;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].salePricePerShare')[0].disabled = false;
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].fairMktValPerShare')[0].disabled= false;
	    	
	    	document.getElementsByName('schedule115AD.saleOfEquity115AD['+i+'].totSaleValue')[0].disabled=true;
	    }	    
	}
}



