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


var slab1_end_date = '15/06/2019';
var slab2_start_date = '16/06/2019';
var slab2_end_date = '16/09/2019';
var slab3_start_date = '17/09/2019';
var slab3_end_date = '16/12/2019';

var slab4_start_date = '17/12/2019';
var slab4_end_date = '16/03/2020';

var slab5_start_date = '17/03/2020';
var slab5_end_date = '31/03/2020';

var Filing_dueDate = '31/07/2020';
//var Int_start_date_234A = '01/01/2021';
//var Int_234A_IF_NO_dt = '31/12/2020';

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

	}
}

function validateSchBP34(){
	if(document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.netPLFrmSpecifiedBus')[0].value<0||document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.netPLFrmSpecifiedBus')[0].value>0){
		document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.netPLFrm')[0].value="Y";
	}
	else{
		document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.netPLFrm')[0].value="N";
	}

}
function disabledrop(){

	var secUnderExemptionClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')(0).value;

}

function calculateBalanceI() {

	
	var tab = document.getElementById('scheduleI');
	var rowcount = tab.rows.length;
	var totalTotAmountAccumlated = 0,totalTotAmountAppliedPreviousYear=0,totalTotAmountInvested=0,totalTotAmountAppliedDuringYear=0,totalTotBalanceAmount=0,totalTotAmountDeemedUs11=0;
	var totAmountAccumlated = document.getElementsByName('itr7.itrScheduleI.totAmountAccumlated')[0];
	var totAmountAppliedPreviousYear = document.getElementsByName('itr7.itrScheduleI.totAmountAppliedPreviousYear')[0];
	var totAmountInvested = document.getElementsByName('itr7.itrScheduleI.totAmountInvested')[0];
	var totAmountAppliedDuringYear = document.getElementsByName('itr7.itrScheduleI.totAmountAppliedDuringYear')[0];
	var totBalanceAmount = document.getElementsByName('itr7.itrScheduleI.totBalanceAmount')[0];
	var totAmountDeemedUs11 = document.getElementsByName('itr7.itrScheduleI.totAmountDeemedUs11')[0];

	for(var i=0;i<rowcount - 3;i++) {
		var amountAccumlated = document.getElementsByName('itr7.itrScheduleI.scheduleI['+i+'].amountAccumlated')[0].value;
		var amountAppliedPreviousYear = document.getElementsByName('itr7.itrScheduleI.scheduleI['+i+'].amountAppliedPreviousYear')[0].value;
		var amountAppliedDuringYear = document.getElementsByName('itr7.itrScheduleI.scheduleI['+i+'].amountAppliedDuringYear')[0].value;
		var balanceAmount = document.getElementsByName('itr7.itrScheduleI.scheduleI['+i+'].balanceAmount')[0];
		var amountInvested = document.getElementsByName('itr7.itrScheduleI.scheduleI['+i+'].amountInvested')[0].value;
		var amountDeemedUs11 = document.getElementsByName('itr7.itrScheduleI.scheduleI['+i+'].amountDeemedUs11')[0].value;
		balanceAmount.value = zeroOrMore(parseInt(coalesce(amountAccumlated),10) -parseInt(coalesce(amountAppliedPreviousYear),10)  -parseInt(coalesce(amountAppliedDuringYear),10));
		totalTotAmountAccumlated = parseInt(coalesce(totalTotAmountAccumlated),10) + parseInt(coalesce(amountAccumlated),10);
		totalTotAmountAppliedPreviousYear = parseInt(coalesce(totalTotAmountAppliedPreviousYear),10) + parseInt(coalesce(amountAppliedPreviousYear),10);
		totalTotAmountInvested = parseInt(coalesce(totalTotAmountInvested),10) + parseInt(coalesce(amountInvested),10);
		totalTotAmountAppliedDuringYear = parseInt(coalesce(totalTotAmountAppliedDuringYear),10) + parseInt(coalesce(amountAppliedDuringYear),10);
		totalTotBalanceAmount= parseInt(coalesce(totalTotBalanceAmount),10) + parseInt(coalesce(balanceAmount.value),10);
		totalTotAmountDeemedUs11=parseInt(coalesce(totalTotAmountDeemedUs11),10) + parseInt(coalesce(amountDeemedUs11),10);
	}

	totAmountAccumlated.value = parseInt(totalTotAmountAccumlated);
	totAmountAppliedPreviousYear.value = parseInt(totalTotAmountAppliedPreviousYear);
	totAmountInvested.value = parseInt(totalTotAmountInvested);
	totAmountAppliedDuringYear.value = parseInt(totalTotAmountAppliedDuringYear);
	totBalanceAmount.value=parseInt(totalTotBalanceAmount);
	totAmountDeemedUs11.value=parseInt(totalTotAmountDeemedUs11);
	
	calculateSchSI();
	calculateTiTti();
}

function disableOS(){
	var osVal=document.getElementsByName('itr7.scheduleOS.incFromOtherSourcesFlag')[0].value;
	if(osVal=='Y'){
		var inputTags=document.getElementById('scheduleOS').getElementsByTagName('input');
		var tagLength=inputTags.length;
		for(var i=0;i<tagLength;i++){
			inputTags.item(i).disabled=false;
		}
	}else{
		var inputTags=document.getElementById('scheduleOS').getElementsByTagName('input');
		var tagLength=inputTags.length;
		for(var i=0;i<tagLength;i++){
			inputTags.item(i).disabled=true;
			inputTags.item(i).value="";
		}
	}
}
function OSSubCalInc() {

	document
			.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.sourceAmount')[0].value = eval(parseInt(
			coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec561.sourceAmount'),
			10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec562.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec563.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec564.sourceAmount'),
					10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec565.sourceAmount'),
					10));

}

function OSSubCal() {

	document
			.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE')[0].value = eval(parseInt(
			coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec68'),
			10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec69'),
					10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec69A'),
					10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec69B'),
					10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec69C'),
					10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incomeFromNature.underSec69D'),
					10));

}

function sum56to2(){

	var table = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowCount = table.rows.length - 2;
	var temp = parseInt('0',10);
	var residentFlag= document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value;
	for (var i = 0; i < rowCount; i++) {

		var section = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].itemIncluded')[0];
		var itemIncludedIn = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
						+ i + '].itemIncludedIn')[0];
		var taxResidCertFlag = document
				.getElementsByName('itr7.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('itr7.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('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
								+ i + '].amount');
			}
		}
	}
	return temp;
}

function calculateOSGross(simap) {



	try {

		var resStatus = document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0];
		// 2c table
		var tabl = document.getElementById('schduleOsinc');
		// 2c total
		var temp = eval(parseInt(
				coalesce(document.getElementsByName('itr7.scheduleOS.usOthersGross')[0].value),10));
		
		// 1d
		var temp562X = eval(parseInt(
				coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.sourceAmount')[0].value),10));

		var dividendIncome115BBDA = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA')[0];
		var dividendIncome115BBF = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBF')[0];
		var dividendIncome115BBE = document	.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBE')[0];
		dividendIncome115BBE.value = coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE');

		var winningFrmLotteries = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries')[0];
		winningFrmLotteries.value = getAmt('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.winningFrmLotteries');

		var dividendIncome115BBG = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBG')[0];

		var dividendIncome115BBDA_PTI = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA_PTI')[0];
		var dividendIncome115BBF_PTI = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBF_PTI')[0];
		var dividendIncome115BBE_PTI = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBE_PTI')[0];
		var dividendIncome115BBG_PTI = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBG_PTI')[0];
		var dividendIncome115BB_PTI = document.getElementsByName('itr7.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');
		// sum 2c
		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));
			}
		}

		var residentFlag= document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value;
		// 2c total
		document.getElementsByName('itr7.scheduleOS.usOthersGross')[0].value=total;
		
		var allSelects = tabl.getElementsByTagName('SELECT');
		// 2e table
		var table = document.getElementById('scheduleOsNriIncTaxDtaa');
		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,
			'5BBDA' : 0,
			'5BBC' : 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_5A1bB' : 0,
			'PTI_5AC1ab' : 0,
			'PTI_5BBA' : 0,
			'PTI_5Ea' : 0,
			'PTI_5BBDA' : 0,
			'PTI_5BBC' : 0,
			'PTI_5BB' :0,
			'PTI_5BBE':0
		};
		console.log("document.getElementsByName('itr7.scheduleOS.usOthersGross')[0].value"+document.getElementsByName('itr7.scheduleOS.usOthersGross')[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(']'));

				if (allSelects[i].value == '5BBDA') {

					dividendIncome115BBDA.value = document
							.getElementsByName('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}

				if (allSelects[i].value == '5BBF') {

					dividendIncome115BBF.value = document
							.getElementsByName('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}

				if (allSelects[i].value == '5BBG') {

					dividendIncome115BBG.value = document
							.getElementsByName('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}
				var taxResidCertFlag= false;
				if (allSelects[i].value != 'DTAA') {
					sum = parseInt(sum)
							+ parseInt(coalesce(document
									.getElementsByName('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
											+ index + '].sourceAmount')[0].value));
					for (var k = 0; k < rowCount; k++) {
						if ((document
								.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].itemIncluded')[0].value == '1')) {
							if (document
									.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value > parseInt(coalesce(document
									.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit')[0].value))) {
								if (document
										.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value != '') {

									document
											.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
													+ k + '].amount')[0].value = 0;
									//calcITR3();
									addErrorXHTML(
											document
													.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
															+ k + '].amount')[0],
											'The sum of amount should not exceed amount entered in 2c.',
											true);
									j
											.setFieldError(
													'itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
															+ k + '].amount',
													'The sum of amount should not exceed amount entered in 2c.');
								}

							}

						}
						if ((document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].itemIncluded')[0].value == allSelects[i].value)) {
							if(residentFlag=='NRI')
							{
								if(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].taxResidCertFlag')[0].value=='Y')
							{
							arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
									+ parseInt(coalesce(document
											.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
													+ k + '].amount')[0].value)));
							}
							}
							else
							{
								arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
										+ parseInt(coalesce(document
												.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount')[0].value)));
							}
							if ((arr[allSelects[i].value]) > parseInt(coalesce(document
									.getElementsByName('itr7.scheduleOS.usOthersGross')[0].value))) {

								if (document
										.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value != '') {
									
									document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
													+ k + '].amount')[0].value = 0;
									// calcITR3();
									addErrorXHTML(
											document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0],
											'The sum of amount should not exceed amount entered in 2c.',true);
								
									j.setFieldError('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount',
													'The sum of amount should not exceed amount entered in 2c.');
								}
							} else {

								if(residentFlag=='NRI')
								{
									if(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].taxResidCertFlag')[0].value=='Y')
									{
										taxResidCertFlag=true;
										sum -= document
											.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value;
									}
								}
								else
								{
									taxResidCertFlag=false;
									sum -= document
									.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value;
								}

							}
						}
					}

				}
		}

		for (var k = 0; k < rowCount; k++) {
			if ((document
					.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ k + '].itemIncluded')[0].value == '5BB')) {

					if(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].amount')[0].value>coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.winningFrmLotteries'))
						if (document
							.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
									+ k + '].amount')[0].value != '') {
						document
								.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].amount')[0].value = 0;
						// calcITR3();
						addErrorXHTML(
								document
										.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0],
								'The amount should not exceed amount entered in 2a.',
								true);
						j
								.setFieldError(
										'itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount',
										'The  amount should not exceed amount entered in 2a.');
					}
				}
			}
		// 2d table
		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));
			}
		}
		// 2d total
		document.getElementsByName('itr7.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(']'));

				if (allSelects[i].value == 'PTI_5BBDA') {

					dividendIncome115BBDA_PTI.value = document
							.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}
				if (allSelects[i].value == 'PTI_5BB') {

					dividendIncome115BB_PTI.value = document
							.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}

				if (allSelects[i].value == 'PTI_5BBF') {

					dividendIncome115BBF_PTI.value = document
							.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}

				if (allSelects[i].value == 'PTI_5BBE') {

					dividendIncome115BBE_PTI.value = document
							.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}

				if (allSelects[i].value == 'PTI_5BBG') {

					dividendIncome115BBG_PTI.value = document
							.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}

				if (allSelects[i].value == 'PTI_5BB') {

					dividendIncome115BBG_PTI.value = document
							.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}

				if (allSelects[i].value == 'PTI_5BBE') {

					dividendIncome115BBG_PTI.value = document
							.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
									+ index + '].sourceAmount')[0].value;
				}
				var taxResidCertFlag=false;
				if (allSelects[i].value != 'DTAA') {
					sumPti = parseInt(sum)
							+ parseInt(coalesce(document
									.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
											+ index + '].sourceAmount')[0].value));
					for (var k = 0; k < rowCount; k++) {
						if ((document
								.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
										+ k + '].itemIncluded')[0].value == allSelects[i].value)) {
							if(residentFlag=='NRI')
							{
								if(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].taxResidCertFlag')[0].value=='Y')
								{
							arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
									+ parseInt(coalesce(document
											.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
													+ k + '].amount')[0].value)));
								}
							}
							else
							{
								arr[allSelects[i].value] = eval(parseInt(coalesce(arr[allSelects[i].value]))
										+ parseInt(coalesce(document
												.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
														+ k + '].amount')[0].value)));
							}
							if ((arr[allSelects[i].value]) > parseInt(coalesce(document
									.getElementsByName('itr7.scheduleOS.pTiOthersGross')[0].value))) {// add
																										// OS e
																										// total

								if (document
										.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].amount')[0].value != '') {
									document
											.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
													+ k + '].amount')[0].value = 0;
									// calcITR3();
									addErrorXHTML(
											document
													.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
															+ k + '].amount')[0],
											'The sum of amount should not exceed amount entered in 2d.',
											true);
									j.setFieldError(
													'itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
															+ k + '].amount',
													'The sum of amount should not exceed amount entered in 2d.');
								}
							} else {

								if(residentFlag=='NRI')
								{
									if(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
												+ k + '].taxResidCertFlag')[0].value=='Y')
									{
										taxResidCertFlag=true;
										sum -= document
											.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value;
									}
								}
								else
								{
									taxResidCertFlag=false;
									sum -= document
									.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
											+ k + '].amount')[0].value;
								}

							}
						}
					}
				}

			}

		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 taxResidCertFlag = document
			.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
					+ j + '].taxResidCertFlag')[0].value;
			
			var dropDownOS = document
					.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ j + '].itemIncluded')[0].value;

			var amountofSum = document
					.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['
							+ j + '].amount')[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{
					dropDownBBF = coalesce(eval(parseInt(dropDownBBF)
							+ 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('itr7.scheduleOS.incChargblSplRateOS.56i')[0];
		var incChargblSplRateOS56 = document
		.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.56')[0];
		var incChargblSplRateOS562 = document
		.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.562')[0];
		var incChargblSplRateOS562x = document
		.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.562x')[0];
		// 1a
		incChargblSplRateOS56i.value = coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.dividendGross');
		// 1b
		incChargblSplRateOS56.value = coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.interestGross');
		// 1c
		incChargblSplRateOS562.value = coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs');
		// 1d
		incChargblSplRateOS562x.value = coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.sourceAmount');

		var final56i = parseInt(0, 10);
		final56i = incChargblSplRateOS56i.value - dropDown56i;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.56i')[0].value = final56i;

		var final56 = parseInt(0, 10);
		
		
		final56 = incChargblSplRateOS56.value - dropDown56;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.56')[0].value = final56;

		var final562 = parseInt(0, 10);
		final562 = incChargblSplRateOS562.value - dropDown562;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.562')[0].value = final562;

		var final562x = parseInt(0, 10);
		final562x = incChargblSplRateOS562x.value - dropDown562x;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.562x')[0].value = final562x;

		console.log("final562x"+final562x);
		console.log("final562"+final562);
		console.log("final56"+final56);
		console.log("final56i"+final56i);





		var finalBBDA = parseInt(0, 10);
		finalBBDA = dividendIncome115BBDA.value - dropDownBBDA;


		document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA')[0].value = finalBBDA;
		var finalBBF = parseInt(0, 10);
		finalBBF = dividendIncome115BBF.value - dropDownBBF;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBF')[0].value = finalBBF;

		var finalBBE = parseInt(0, 10);
		finalBBE = dividendIncome115BBE.value - dropDownBBE;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBE')[0].value = finalBBE;

		var finalBB = parseInt(0, 10);
		finalBB = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries')[0].value
				- dropDownBB;

		document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries')[0].value = finalBB;

		var finalBBG = parseInt(0, 10);
		finalBBG = dividendIncome115BBG.value - dropDownBBG;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBG')[0].value = finalBBG;

		console.log("finalBBG"+finalBBG);




		var finalBBDA_PTI = parseInt(0, 10);
		finalBBDA_PTI = dividendIncome115BBDA_PTI.value - dropDownBBDA_PTI;

		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA_PTI')[0].value = finalBBDA_PTI;

		var finalBBF = parseInt(0, 10);
		finalBBF_PTI = dividendIncome115BBF_PTI.value - dropDownBBF_PTI;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBF_PTI')[0].value = finalBBF_PTI;

		var finalBBE_PTI = parseInt(0, 10);
		finalBBE_PTI = dividendIncome115BBE_PTI.value - dropDownBBE_PTI;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBE_PTI')[0].value = finalBBE_PTI;

		var finalBBG_PTI = parseInt(0, 10);
		finalBBG_PTI = dividendIncome115BBG_PTI.value - dropDownBBG_PTI;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBG_PTI')[0].value = finalBBG_PTI;

		console.log("finalBBG_PTI"+finalBBG_PTI);

		var finalBB_PTI = parseInt(0, 10);
		finalBB_PTI = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries_PTI')[0].value
				- dropDownBB_PTI;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries_PTI')[0].value = finalBB_PTI;

		var final1_PTI = parseInt(0, 10);
		final1_PTI = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.1_PTI')[0].value
				- dropDownBB_PTI;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.1_PTI')[0].value = finalBB_PTI;



		var tempWinningFromLotteries = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries')[0].value;

		var temp115BBDA = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA')[0].value;

		var temp115BBF = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBF')[0].value;

		var temp115BBG = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBG')[0].value;

		var temp115BBE = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBE')[0].value;

		var secXIIOth = document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.secXIIOth')[0];
		/*
		 * if (eval(parseInt( coalesce(document
		 * .getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit')[0].value),
		 * 10)) > 0) { sum = sum + eval(parseInt( coalesce(document
		 * .getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit')[0].value),
		 * 10)); sum = calculateSec111(sum); }
		 */

		secXIIOth.value = zeroOrMore(eval(sum - temp - tempWinningFromLotteries
				- temp115BBDA - temp115BBF - temp115BBE - temp115BBG
				- (2 * temp562X)));
		validateOSd();
		validateOSc();

	} catch (e) {
		alert('Exception in calculateOSGross : ' + e.stack);
	}
}


function schedueOsCalc(osmap){

	try{
	calcAnyOtherIncome();
	validateSchOSDTAA1a1b();
	// calculateOSTotal6869();
	calculateGrossIncCharge();
	calculateIncSpecialRates();
	calculateOSIntstTotal();
	OSSubCalInc();
	OSSubCal();
	var simap ={};
	calculateOSGross(simap);

	var totalOSGross = document.getElementsByName('itr7.scheduleOS.totalIncomeGross')[0];
	totalOSGross.value = eval(
			parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.dividendGross'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.interestGross'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.sourceAmount'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.totalOtherIncome'),10)
		);

	var totAmtUnderDtaa = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa.totAmtUnderDtaa')[0];
	
	var totAmtUnderDtaa = document
	.getElementsByName('itr7.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('itr7.partAGEN1.filingStatus.residentialStatus')[0].value == 'NRI' && document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+i+'].taxResidCertFlag')[0].value == 'Y')
		{
			sum=eval(parseInt(coalesce(sum), 10)
					+ parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+i+'].amount')[0].value), 10));
		}
		else if(document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value != 'NRI')
		{
			sum=eval(parseInt(coalesce(sum), 10)
					+ parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+i+'].amount')[0].value), 10));
		}
	}
	totAmtUnderDtaa.value=sum;
	// totAmtUnderDtaa.value = addCGDeductions('scheduleOsNriIncTaxDtaa');

	var tab = document.getElementById('anyOtherIncome');
	var rowcount = tab.rows.length;
	var totalOtherIncome=document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.totalOtherIncome')[0];
	var temp=parseInt('0',10);


	var tabl = document.getElementById('schduleOsinc');
	var allSelects = tabl.getElementsByTagName('SELECT');
	var tempSum = parseInt('0',10);
	for(var i=0;i<allSelects.length;i++){
		tempSum = parseInt(tempSum)+parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
					+ i + '].sourceAmount')[0].value));
	}
	document.getElementsByName('itr7.scheduleOS.usOthersGross')[0].value=parseInt(tempSum);

	var tabl1 = document.getElementById('schduleOsincPti');
	var allSelects1 = tabl1.getElementsByTagName('SELECT');
	var tempSum1 = parseInt('0',10);
	for(var i=0;i<allSelects1.length;i++){
		tempSum1 = parseInt(tempSum1)+parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['+ i + '].sourceAmount')[0].value));
	}
	document.getElementsByName('itr7.scheduleOS.pTiOthersGross')[0].value=parseInt(tempSum1);
	// total of 2
	var totalOSGross = document.getElementsByName('itr7.scheduleOS.totalOSGross')[0];
	totalOSGross.value = eval(parseInt(
			coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.winningFrmLotteries'),
			10)
			+ parseInt(
					coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
					10)
			/*
			 * + parseInt(
			 * coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit'),
			 * 10)
			 */
			+ parseInt(tempSum,10)
			+ parseInt(tempSum1,10)
			+ parseInt(sum56to2(),10));
	
	var totDeductions = document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.deductions.totDeductions')[0];
	totDeductions.value = eval(
			parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.deductions.expenses'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation'),10)
		);
	var balanceNoRaceHorse = document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.balanceNoRaceHorse')[0];

	var incChargblSplRateOS56i = document
	.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.56i')[0];
	var incChargblSplRateOS56 = document
	.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.56')[0];
	var incChargblSplRateOS562 = document
	.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.562')[0];
	var incChargblSplRateOS562x = document
	.getElementsByName('itr7.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-4;i++){
		temp = eval(parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.otherIncome['+i+'].anyOtherIncomeAmount')[0].value),10)) + temp;
	}
	temp = temp + getAmt('itr7.scheduleOS.incOthThanOwnRaceHorse.anyOtherIncomeExemptUS10');
	
	var amtNotDeductibleUs58 = getAmt('itr7.scheduleOS.incOthThanOwnRaceHorse.amountNotDed58');
	var profitChargTaxUs59 = getAmt('itr7.scheduleOS.incOthThanOwnRaceHorse.profitsChargavleTax59');
	
	balanceNoRaceHorse.value = eval(parseInt(totalIncomeFromDtaa,10)+parseInt(temp,10)-parseInt(totDeductions.value, 10)
			+ amtNotDeductibleUs58
			+ profitChargTaxUs59);
	var totOthSrcNoRaceHorse = document.getElementsByName('itr7.scheduleOS.totOthSrcNoRaceHorse')[0];

	totOthSrcNoRaceHorse.value = eval(parseInt(
			totalOSGross.value, 10)
			+ parseInt(zeroOrMore(parseInt(balanceNoRaceHorse.value, 10))));

	var balanceOwnRaceHorse = document.getElementsByName('itr7.scheduleOS.incFromOwnHorse.balanceOwnRaceHorse')[0];
	balanceOwnRaceHorse.value = eval(
			parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.receipts'),10)
			- parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.deductSec57'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.deductSec59'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.deductSec58'),10)
		);
	var incChargeable = document.getElementsByName('itr7.scheduleOS.incChargeableFrmOthSrc')[0];
	incChargeable.value = eval(
			parseInt(totOthSrcNoRaceHorse.value,10)
			+ parseInt(zeroOrMore(parseInt(balanceOwnRaceHorse.value ,10)))
		);
	// scheduleOsCalcNature();

	if(!osmap) {
		changeCYLA();
		calculateTiTti();
	}
	}catch(e){
		alert(e.stack);
	}
}

function calculateOSIntstTotal(){

	var totalOSIntGross = document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.interestGross')[0];
	totalOSIntGross.value = eval(
			parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.fromSavBank'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.fromTermDep'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.fromIncTaxRef'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.natPassThrIncome'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.fromOthers'),10)
		);

}


function scheduleCGCalc(){
	var fullConsiderationRecv=getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset.fullConsiderationRecv');
	var fairMarketQoute=getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset.fairMarketQoute');
	if(fairMarketQoute>fullConsiderationRecv){
    	document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.fullValueAsPer50CA')[0].value=fairMarketQoute;
    }
	if(fullConsiderationRecv>fairMarketQoute){
	document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.fullValueAsPer50CA')[0].value=fullConsiderationRecv;
	}
	if(fullConsiderationRecv==fairMarketQoute){
		document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.fullValueAsPer50CA')[0].value=fairMarketQoute;
	}
	{
		document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.fullConsidertationTotal')[0].value=getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset.fullValueAsPer50CA')+getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset.fullConsideration');
	}

	// schCG2fField();


	var fullConsiderationRecvLong=getAmt('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullConsiderationRecv');
	var fairMarketQouteLong=getAmt('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fairMarketQoute');
	if(fairMarketQouteLong>fullConsiderationRecvLong){
    	document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullValueAsPer50CA')[0].value=fairMarketQouteLong;
    }
	if(fullConsiderationRecvLong>fairMarketQouteLong){
	document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullValueAsPer50CA')[0].value=fullConsiderationRecvLong;
	}
	if(fullConsiderationRecvLong==fairMarketQouteLong){
		document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullValueAsPer50CA')[0].value=fairMarketQouteLong;
	}
	{
		document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullConsidertationTotal')[0].value=getAmt('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullValueAsPer50CA')+getAmt('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullConsideration');
	}
	{
		var temp='itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.deductSec48';
		document.getElementsByName(temp+'.totalDedn')[0].value=eval(parseInt(document.getElementsByName(temp+'.aquisitCost')[0].value==""?0:document.getElementsByName(temp+'.aquisitCost')[0].value) + parseInt(document.getElementsByName(temp+'.improveCost')[0].value==""?0:document.getElementsByName(temp+'.improveCost')[0].value) + parseInt(document.getElementsByName(temp+'.expOnTrans')[0].value==""?0:document.getElementsByName(temp+'.expOnTrans')[0].value));
	}

	{
		document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balanceCG')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.fullConsideration')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.fullConsideration')[0].value) - parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.deductSec48.totalDedn')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.deductSec48.totalDedn')[0].value));
	}

	{
		document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balanceCG')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balanceCG')[0].value) + parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.lossSec94Of7Or94Of8')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.lossSec94Of7Or94Of8')[0].value));
	}

	{
		document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.totalDedn')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.aquisitCost')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.aquisitCost')[0].value) +  parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.improveCost')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.improveCost')[0].value) + parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.expOnTrans')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.expOnTrans')[0].value));
	}
	{
		document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.totalDedn')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.aquisitCostIndexed')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.aquisitCostIndexed')[0].value) +  parseInt(document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.improveCostIndexed')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.improveCostIndexed')[0].value) + parseInt(document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.expOnTrans')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.expOnTrans')[0].value));
	}

	{
		document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.balanceCG')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.fullConsidertationTotal')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.fullConsidertationTotal')[0].value) - parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.totalDedn')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.deductSec48.totalDedn')[0].value));
	}

	{
		document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.balSCG')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.lossSec94Of7Or94Of8')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.lossSec94Of7Or94Of8')[0].value) + parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.balanceCG')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.balanceCG')[0].value));
	}
	
	{
		document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balanceCG')[0].value=eval( parseInt(document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullConsidertationTotal')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.fullConsidertationTotal')[0].value) - parseInt(document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.totalDedn')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.deductSec48.totalDedn')[0].value));
	}
	{
		document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balLTCGNo112')[0].value=eval( parseInt(document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balanceCG')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balanceCG')[0].value))

	}
	{
		var sum = 0;
		var noOfBody= $('#ltcg10pctTab tbody').length;
		for(var i = 0 ; i < noOfBody ; i++){
			if(document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].asstProvisoUndrSec112')[0].value != ""){
				var fullConsideration = document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].fullConsideration')[0]; 
				fullConsideration.value = coalesce(fullConsideration.value);
				var aquisitCostNoIndex = document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.aquisitCostNoIndex')[0]; 
				aquisitCostNoIndex.value = coalesce(aquisitCostNoIndex.value);
				var improveCostNoIndex = document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.improveCostNoIndex')[0]; 
				improveCostNoIndex.value = coalesce(improveCostNoIndex.value);
				var expOnTrans = document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.expOnTrans')[0]; 
				expOnTrans.value = coalesce(expOnTrans.value);
				
	    		document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.totalDedn')[0].value=
	  			  getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.aquisitCostNoIndex')
	  			+ getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.improveCostNoIndex')
	  			+ getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.expOnTrans')	;
	    		
	    		document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].balanceCG')[0].value=
	    			  getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].fullConsideration')
	    	  		- getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.totalDedn');
	    		
	    	  	sum = sum +getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].balanceCG');
			}else{
				document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].deductSec48.totalDedn')[0].value=0
		    	document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].balanceCG')[0].value=0
		    		
		    	sum = sum +getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].balanceCG');
			}
    	}
    	document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetProviso112.balLTCG112')[0].value = sum;
	}
 
    
    {
    	$('[name="itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.totAmtStcgUnderPTI"]')[0].value = 
			getAmt('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg15')
			+ getAmt('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg30');
    }
    {
		$('[name="itr7.scheduleCG.longTermCapGain.passThrtotalIncome"]')[0].value = 
			getAmt('itr7.scheduleCG.longTermCapGain.passThrInc10Per')
			+ getAmt('itr7.scheduleCG.longTermCapGain.passThrInc20Per');
    }
    {
		document.getElementsByName('itr7.scheduleCG.longTermCapGain.totalLTCG')[0].value=
			    eval(coalesceSetRet('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balLTCGNo112') +
	                coalesceSetRet('itr7.scheduleCG.longTermCapGain.otherAssetProviso112.balLTCG112') +
	                coalesceSetRet('itr7.scheduleCG.longTermCapGain.passThrInc10Per') +
	                coalesceSetRet('itr7.scheduleCG.longTermCapGain.passThrInc20Per'));
	}
    {
	    $('[name="itr7.scheduleCG.shortTermCapGain.totalSTCG"]')[0].value =
			  getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')
			+ getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset.balSCG')
			+ getAmt('itr7.scheduleCG.shortTermCapGain.deemedSTCGDeprAsset')
			+ getAmt('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.totAmtStcgUnderPTI');
    }
    calculateTiTti();
    {
    	if(document.getElementsByName('itr7.scheduleCG.longTermCapGain.totalLTCG')[0].value >= 0){
    		document.getElementsByName('itr7.scheduleCG.incChargeableHeadCapGain')[0].value =zeroOrMore(parseInt(coalesceSetRet('itr7.scheduleCG.shortTermCapGain.totalSTCG'),10) + parseInt(coalesceSetRet('itr7.scheduleCG.longTermCapGain.totalLTCG'),10) );
    	}else{
    		document.getElementsByName('itr7.scheduleCG.incChargeableHeadCapGain')[0].value =zeroOrMore(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.totalSTCG')[0].value);
    	}
	}

	// scheduleSiIncome('scheduleSI');
	changeCYLA();
	
}

function scheduleCGExemptDisable() {
	var val2=eval(parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')[0].value) +
                    parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.balSCG')[0].value) +
                    parseInt(coalesce(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.deemedSTCGDeprAsset')[0].value)));

	 var val1c=parseInt(coalesce(document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balanceCG')[0].value));

       /*
		 * if(val1c<0){
		 * document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.exemptionUs111A')[0].readOnly=true;
		 * document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.exemptionUs111A')[0].value=0;
		 * }else{
		 * document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.exemptionUs111A')[0].readOnly=false; }
		 */

		var val2c=parseInt(coalesce(document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[0].balanceCG')[0].value));

}

function scheduleETCalc(){
	
	document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAfterVoluntaryContribution')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].value) + parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr')[0].value));

	document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.total')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties')[0].value) + parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0].value))
	
	document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.closingBalance')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAfterVoluntaryContribution')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAfterVoluntaryContribution')[0].value) - parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.total')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.total')[0].value));

	if(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.closingBalance')[0].value < 0){

		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.closingBalance')[0].value=parseInt('0',10);
	}
	document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].value = getAmt('itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr');
	
	document.getElementsByName('itr7.partBTI.exemptionUs13_B')[0].value=getAmt('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B');

}

function populateMobileCode()

{

	state = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.stateCode')[0];

	if (state.value != '99' && state.value != '-1') {

		document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobile')[0].value = '91';
		// document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobile')[0].disabled
		// = true;
		// document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobileNoSec')[0].value
		// = '91';
		// document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobileNoSec')[0].disabled
		// = true;
	} else if (state.value == '99') {
		document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobile')[0].value = '';
		document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobile')[0].disabled = false;
		document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobileNoSec')[0].value = '';
		document.getElementsByName('partAGEN1.personalInfo.address.countryCodeMobileNoSec')[0].disabled = false;
	}




}

function delScheduleHP(){
	if ($('#scheduleHPAddRow')[0].parentNode.children.length > 26) {
		for (var i = 0; i < 22; i++) {
			$('#scheduleHPAddRow')[0].parentNode
					.deleteRow($('#scheduleHPAddRow')[0].parentNode.children.length - 5);
		}
		if ($('#scheduleHPAddRow')[0].parentNode.children.length == 27) {
			$('#delHPButtonId').prop('disabled', true);
		}
	} else if ($('#scheduleHPAddRow')[0].parentNode.children.length == 27) {
		$('#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 = 'Income under the head “Income from house property” ';
	for (var k = 1; k < newVal; k++) {
		newText = newText + k + 'k +';
	}
	newText = newText + newVal + '(if negative take the figure to 2i of schedule CYLA)';
	document.getElementById('scheduleHPLast').cells[0].innerHTML = newVal;
	document.getElementById('scheduleHPLast').cells[2].innerHTML = newVal;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[2].innerHTML = newVal+1;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[1].innerHTML = newText;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[0].innerHTML = newVal+1;

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

	modifyRow(table);
	scheduleHPCalc();
}

function addScheduleHP(called){

	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 = "itr7.scheduleHP.propertyDetails["+iterate+"].addressDetail.stateCode";
				var Countryname = "itr7.scheduleHP.propertyDetails["+iterate+"].addressDetail.country";
				if(selectTags[a].name== name){
					if (selectTags[a].name.indexOf('stateCode') != '') {
						selectTags[a].onchange = function() {
							setCounrtyForStateNew('itr7.scheduleHP.propertyDetails[' + iterate + '].addressDetail.stateCode','itr7.scheduleHP.propertyDetails[' + iterate + '].addressDetail.country','itr7.scheduleHP.propertyDetails[' + iterate + '].addressDetail.pinCode','itr7.scheduleHP.propertyDetails[' + iterate + '].addressDetail.zipCode');
						};
					}
			}else if(selectTags[a].name== Countryname){

					if (selectTags[a].name.indexOf('country') != '') {
						selectTags[a].onchange = function() {
							setStateForCountryNew('itr7.scheduleHP.propertyDetails[' + iterate + '].addressDetail.stateCode','itr7.scheduleHP.propertyDetails[' + iterate + '].addressDetail.country','itr7.scheduleHP.propertyDetails[' + iterate + '].addressDetail.pinCode','itr7.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 = 'Income under the head “Income from house property” ';
	for ( var k = 1; k < newVal; k++) {
		newText = newText + k + 'j +';
	}
	newText = newText + newVal + '(if negative take the figure to 2i of schedule CYLA)';
	document.getElementById('scheduleHPLast').cells[0].innerHTML = newVal;
	document.getElementById('scheduleHPLast').cells[2].innerHTML = newVal;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[2].innerHTML = newVal+1;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[1].innerHTML = newText;
	document.getElementById('scheduleHPLast').nextElementSibling.cells[0].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('itr7.scheduleHP.propertyDetails['
			+ (parseInt(totRow) - 1) + '].propCoOwnedFlg')[0]
			.getAttribute('onchange');
	var onchange2 = document.getElementsByName('itr7.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();

}


// 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 scheduleHPCalc(){
	var totHp=eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent)-1);
	var total=0;
    var thirtyPercentOfBalanceTemp = 0;
	var thirtyPercentOfBalance = 0;

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

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


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


      	thirtyPercentOfBalanceTemp = zeroOrMore(coalesce(Math.round(eval(parseInt(document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.balanceALV')[0].value==""?0:document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.balanceALV')[0].value) * 0.3 ))));
//      	if(coalesce(thirtyPercentOfBalance.value) > parseInt(thirtyPercentOfBalanceTemp ,10) ){
//			addErrorXHTML(thirtyPercentOfBalance, 'Amount can not be more than 30% of Annual value i.e, '+thirtyPercentOfBalanceTemp+'.',true);
//			j.setFieldError(thirtyPercentOfBalance,'Amount can not be more than 30% of Annual value i.e, '+thirtyPercentOfBalanceTemp+'.');
//
//		}
      	if(document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.annualLetableValue')[0].value == 0
      			||document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.annualLetableValue')[0].value == ""){
      		document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.intOnBorwCap')[0].value=0;    		
      	}
      	
      	var totalDeductVal = document.getElementsByName('itr7.scheduleHP.propertyDetails['+ i +'].rentdetails.totalDeduct')[0];
      	totalDeductVal.value = eval(parseInt(thirtyPercentOfBalanceTemp ,10) +
                 coalesceSetRet('itr7.scheduleHP.propertyDetails['+ i +'].rentdetails.intOnBorwCap') );

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

		// total=eval(parseInt(total) +
		// parseInt(document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.incomeOfHP')[0].value));
		total = eval(parseInt(total)
				+ parseInt(document
						.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
								+ '].rentdetails.incomeOfHP')[0].value));
		if(document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i+ '].rentdetails.intOnBorwCap')[0].value=='0')
			{
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i+ '].rentdetails.intOnBorwCap')[0].value='';
			}
		if(document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i+ '].rentdetails.arrearsRent')[0].value=='0')
		{
		document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i+ '].rentdetails.arrearsRent')[0].value='';
		}

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

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

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

	changeCYLA();
	calculateTiTti();
}


// To check co-owned
function isCoOwned() {
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);

	for ( var i = 0; i < totHp; i++) {
		var tempName = 'itr7.scheduleHP.propertyDetails[' + i + '].propCoOwnedFlg';
		var val = document.getElementsByName(tempName)[0].value;
		var assessePercentShareProp = document
				.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
						+ '].asseseeShareProperty')[0];
		if (val == 'YES') {
			$('#scheduleHP' + eval(parseInt(i) + 1)).find(':input').prop(
					'disabled', false);
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].coOwners[0].coOwnersSNo')[0].value = 1;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].asseseeShareProperty')[0].disabled = true;
			if (assessePercentShareProp.value == 100
					|| assessePercentShareProp.value == 0.0) {
				assessePercentShareProp.value = '0';
			}
		} 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 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 adjustForm(){

enableField('itr7.partAGEN1.filingStatus.asseseeRepFlg','Y',
			'itr7.partAGEN1.filingStatus.assesseeRep.repName',
			'itr7.partAGEN1.filingStatus.assesseeRep.repCapacity',
			'itr7.partAGEN1.filingStatus.assesseeRep.repAddress',
			'itr7.partAGEN1.filingStatus.assesseeRep.repPAN',
			'itr7.partAGEN1.filingStatus.assesseeRep.repAadhaar'
			);


	enableField('itr7.partAGEN1.filingStatus.residentialStatus','RES',
			'itr7.partBTTI.assetOutIndiaFlag'
			);
	enableField('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.charitablePurposeOfGeneralPublic','Y',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityNature215',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityRendering215'
		);



	enableField('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityNature215','Y',
			'itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.natureofTrade');

	enableField('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityRendering215','Y',
			'itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.anyofTrade'
			);



	enableField('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs80G.approvalUs80G','Y',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsUs80G.approvalNo',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsUs80G.dateOfApproval'
		);

	enableField('itr7.partAGEN2.otherDetailsFor7.changeInActivitiesDuringYr','Y',
			'itr7.partAGEN2.otherDetailsFor7.dateOfChange','itr7.partAGEN2.otherDetailsFor7.dateOfFreshRegistration','itr7.partAGEN2.otherDetailsFor7.freshRegistrationPrescribed','itr7.partAGEN2.otherDetailsFor7.freshRegistrationUnder12AA'
			);

	enableField('itr7.partAGEN2.otherDetailsFor7.freshRegistrationUnder12AA','Y',
			'itr7.partAGEN2.otherDetailsFor7.dateOfFreshRegistration'
			);

	enableField('itr7.partBTI.tiDeductions.exercisedBfDueDateFlag','Y',
			'itr7.partBTI.tiDeductions.dateOfFurnishing'
			);


	enableField('itr7.scheduleET.accountsAudited','Y',
			'itr7.scheduleET.auditReportDate'
			);

	enableField('itr7.partAGEN2.otherDetailsFor7.otherDetailsFC.regUnForeignContribution','Y',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsFC.registrationNo',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsFC.dateOfRegistration',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsFC.amtReceivedFromOutSideIndia',
		'itr7.partAGEN2.otherDetailsFor7.otherDetailsFC.purposeOfReceivedAmt'
		);

		enableField('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.regUnSEBI','Y',
			'itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.registrationNo',
			'itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.dateOfRegistration'
			);


	enableField('itr7.scheduleLA.reportUs29','Y',
			'itr7.scheduleLA.submissionDate'
			);

	removeAuditAllDetails($('[name="itr7.partAGEN2.liableSec44ABflg"]')[0]);

	  /*
		 * if(document.getElementsByName('itr7.partAGEN2.liableSec92Eflg')[0].value=='Y'){
		 * $('#AuditDetails92E').find(':input').prop('disabled', false); }else{
		 * $('AuditDetails92E').find(':input').prop('disabled', true);
		 * $('#AuditDetails92E').find(':input').val(''); }
		 */

	  enableField('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType','5',
				'itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType');

	 /*
		 * enableField('itr7.partAGEN2.liableSec92Eflg','Y',
		 * 'itr7.partAGEN2.auditDetails.dateOfAudit92E',
		 * 'itr7.partAGEN2.auditDetails.auditorName92E',
		 * 'itr7.partAGEN2.auditDetails.auditorMemNo92E',
		 * 'itr7.partAGEN2.auditDetails.audFrmName92E',
		 * 'itr7.partAGEN2.auditDetails.audFrmPAN92E',
		 * 'itr7.partAGEN2.auditDetails.auditDate92E',
		 * 'itr7.partAGEN2.auditDetails.auditReportFurnishDate92E' );
		 */

         enableField('scheduleTR1.taxPaidOutsideIndFlg','YES',
				'scheduleTR1.amtTaxRefunded',
				'scheduleTR1.assmtYrTaxRelief'
				);


         if(document.getElementsByName('itr7.partAGEN2.othIncTaxActFlag')[0].value=='Y'){
        	 $('#othIncTaxActTab').find(':input').prop('disabled', false);
        	 $('#othIncTaxActTab').find('.addbtn').prop('hidden', false);
          }else{
        	  $('#othIncTaxActTab').find(':input').prop('disabled', true);
        	  $('#othIncTaxActTab').find('.addbtn').prop('hidden', true);
        	  $('#othIncTaxActTab').find(':input').val('');
          }


	addOtherSectionDetails();
	// adjustOS();
	}

function addOtherSectionDetails() {
	var tab = document.getElementsByClassName('auditDetailsRow');
	for(var j=0;j<tab.length;j++) {
	var allInputTags = tab[j].getElementsByTagName('select');

				if(allInputTags[0].value == 'Others') {

					document.getElementsByName('itr7.partAGEN2.auditDetails['+j+'].otherSectionDesc')[0].style.display="";
					document.getElementsByName('itr7.partAGEN2.auditDetails['+j+'].otherSectionDesc')[0].parentNode.parentNode.parentNode.parentNode.rows[0].cells[1].children[0].style.display='';
					document.getElementsByName('itr7.partAGEN2.auditDetails['+j+'].otherSectionDesc')[0].parentNode.parentNode.parentNode.parentNode.rows[0].cells[1].children[1].style.display='';

				} else {
					document.getElementsByName('itr7.partAGEN2.auditDetails['+j+'].otherSectionDesc')[0].value="";
					document.getElementsByName('itr7.partAGEN2.auditDetails['+j+'].otherSectionDesc')[0].style.display="none";
					document.getElementsByName('itr7.partAGEN2.auditDetails['+j+'].otherSectionDesc')[0].parentNode.parentNode.parentNode.parentNode.rows[0].cells[1].children[0].style.display='none';
					document.getElementsByName('itr7.partAGEN2.auditDetails['+j+'].otherSectionDesc')[0].parentNode.parentNode.parentNode.parentNode.rows[0].cells[1].children[1].style.display='none';
			}
		}
}


function revisedSet(section,type){

     var fileSec=section.value;
     var fileType=document.getElementsByName(type)[0];

	if(fileSec=='17' && fileType.value!='R'){

		document.getElementsByName(type)[0].value='R';
        }
        else{
            document.getElementsByName(type)[0].value='O';
        }

}

function sectionSet(section,type)
{
    var fileSec = document.getElementsByName(section)[0];
    var fileType=type.value;

        if(fileType=='R' && fileSec.value!=17){
            fileSec.value='17';
        }
        else{
            fileSec.value='';
        }
}




	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 calculateTiTti(called){

	try{
		//calcExemptUS10();
	     // calculateLAincome();
		calculateERexpTrustInstitution();
		calculateDisallowableExpenditure();
		calculaterevenueExpenditure();
		enableShareTypeOthInSH();
		enableDirecComp();
		validateTI4iii();
		validateTI4v();
		// calculatetotalRevenueExpenses();
// calstcgNatOfIncome();
// calltcgNatOfIncome();
		// calculateSumOfAB();
		enableOtherAct();
		setSecRespOnSave();
	    calcDueDate();
		scheduleVCCalc();
		calculateSchAI();
		calculateSchER();
		calculateSchEC();
		calculateSch115TD();
		// exemptCalculateTiTti();
		// calculateAmtDeemedInc();
		validateIE3Grtthan34();
		validateTDS29Grtthen67();
		validateTDS39Grtthen67();
		// calculateScheduleOSicnomeBenifit();
		// calculateScheduleOStaxBenifit();
		calculateTotalTaxIT('scheduleIT');
		// calculateLiabilities();

		document.getElementsByName('itr7.partBTI.exemptionUs13_B')[0].value=document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].value;

		var varDate = document.getElementsByName('itr7.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()  ;
		}

		var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
		var returnFurnishedSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;

		if(exemptClaimed == '23CIV' || exemptClaimed == '23CV' || exemptClaimed == '23CVI' || exemptClaimed == '23CVIA' || exemptClaimed == '13A' || exemptClaimed == '11'){

			$('[name="itr7.partBTI.vcCorpusSec11"]')[0].value = (getAmt('itr7.scheduleVC.local.otherThanCorpusFund')+(getAmt('itr7.scheduleVC.foreign.otherThanCorpusFund')));
			$('[name="itr7.partBTI.voluntaryContributions.totIncFromVC"]')[0].value = (getAmt('itr7.scheduleVC.local.corpusFundDonation')+(getAmt('itr7.scheduleVC.foreign.corpusFundDonation')));

		}else{
			$('[name="itr7.partBTI.voluntaryContributions.totIncFromVC"]')[0].value = 0;
			$('[name="itr7.partBTI.vcCorpusSec11"]')[0].value = 0;
		}	
		
		var exemptionUs13_B = getAmt('itr7.partBTI.exemptionUs13_B');
		var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
		var flagRegAppSec = "true";
		
		for(var i = 0 ; i < noOfRowsRejApprovalDtls ; i++){
			var sectionUdrReg = $('[name="itr7.partAGEN1.rejApprovalDtls[' + i + '].secUnderRegistration"]')[0].value
			if(sectionUdrReg == "VIII"){
				flagRegAppSec = "false";
			}
		}
		var ET_6iv = getAmt('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties');
		var ET_6ii = getAmt('itr7.scheduleET.voluntaryContributionDtls.totalAfterVoluntaryContribution');
		var ET_DD = "false";
		if($('[name="itr7.scheduleET.booksOfAccMaintained"]')[0].value == "N"
				|| $('[name="itr7.scheduleET.voluntaryContribution"]')[0].value == "N"
				|| $('[name="itr7.scheduleET.recordsMaintainedWithPAN"]')[0].value == "N"
				|| $('[name="itr7.scheduleET.accountsAudited"]')[0].value == "N"
				|| $('[name="itr7.scheduleET.reportAsPerRule17CA"]')[0].value == "N"){
			ET_DD = "true";
		}
	
		if( exemptClaimed == '13B' && exemptionUs13_B > 0){
			if(flagRegAppSec == "true"
					|| ET_6iv < (0.95*ET_6ii)
					|| ET_DD == "true"){
				$('[name="itr7.partBTI.vcCorpusSec11"]')[0].value = (getAmt('itr7.scheduleVC.local.otherThanCorpusFund')+(getAmt('itr7.scheduleVC.foreign.otherThanCorpusFund')));
				$('[name="itr7.partBTI.voluntaryContributions.totIncFromVC"]')[0].value = (getAmt('itr7.scheduleVC.local.corpusFundDonation')+(getAmt('itr7.scheduleVC.foreign.corpusFundDonation')));
	
			}else{
				$('[name="itr7.partBTI.voluntaryContributions.totIncFromVC"]')[0].value = 0;
				$('[name="itr7.partBTI.vcCorpusSec11"]')[0].value = 0;
			}
		}
		
		

		var totalContribution = document.getElementsByName('itr7.scheduleVC.totalContribution')[0].value;

		if((exemptClaimed == '21' || exemptClaimed == '22B' || exemptClaimed == '23AAA' || exemptClaimed == '23B' || exemptClaimed == '23D'
		 || exemptClaimed == '23DA' || exemptClaimed == '23EC' || exemptClaimed == '23ED' || exemptClaimed == '23EE' || exemptClaimed == '29A'
		 || exemptClaimed == '26' || exemptClaimed == '47' || exemptClaimed == '2135I' || exemptClaimed == '23FB') || (returnFurnishedSec == 'OTH')){
			if(totalContribution > 0 && (document.getElementsByName('itr7.scheduleIE1.totalReceipts')[0].value==0 || document.getElementsByName('itr7.scheduleIE1.totalReceipts')[0].value=='')){
				$('[name="itr7.scheduleIE1.totalReceipts"]')[0].value = getAmt('itr7.scheduleVC.totalContribution');
			}
		}else{
			// $('[name="itr7.scheduleIE1.totalReceipts"]')[0].value = 0 ;
		}

		if(exemptClaimed == '23A' || exemptClaimed == '24'){
			if(totalContribution > 0 && (document.getElementsByName('itr7.scheduleIE2.totalReceiptsContribution')[0].value==0 || document.getElementsByName('itr7.scheduleIE2.totalReceiptsContribution')[0].value=='')){
				$('[name="itr7.scheduleIE2.totalReceiptsContribution"]')[0].value = getAmt('itr7.scheduleVC.totalContribution');
			}
		}/*
			 * else{
			 * $('[name="itr7.scheduleIE2.totalReceiptsContribution"]')[0].value =
			 * 0; }
			 */

		if(exemptClaimed == '13B'){
			if(totalContribution > 0){
				$('[name="itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr"]')[0].value = getAmt('itr7.scheduleVC.totalContribution');
			}else{
				$('[name="itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr"]')[0].value = '';
			}
		}else{
			// $('[name="itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr"]')[0].value
			// = 0;
		}
		scheduleETCalc();
		
		if(exemptClaimed == '13A'){
			document.getElementsByName('itr7.partBTI.exemptionUs13_A')[0].readOnly = false;
		}else{
			document.getElementsByName('itr7.partBTI.exemptionUs13_A')[0].readOnly = true;
		}

		// $('[name="itr7.partBTI.vcCorpusSec11"]')[0].value =
		// getAmt('itr7.scheduleVC.local.corpusFundDonation')+getAmt('itr7.scheduleVC.foreign.corpusFundDonation');
		// $('[name="itr7.partBTI.voluntaryContributions.totIncFromVC"]')[0].value
		// =
		// (getAmt('itr7.scheduleVC.totalContribution')-(getAmt('itr7.scheduleVC.local.corpusFundDonation')
		// + getAmt('itr7.scheduleVC.foreign.corpusFundDonation')));


		$('[name="itr7.partBTI.aggregateIncomeUs1112"]')[0].value = getAmt('itr7.scheduleAI.schAITotalIncome');
		if(document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAccumlated')[0].value > 0){
			var amountDeemedUs11 = document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountDeemedUs11')[0];
			// amountDeemedUs11.value=zeroOrMore(document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAccumlated')[0].value
			// -
			// document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAppliedPreviousYear')[0].value
			// -
			// document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAppliedDuringYear')[0].value);
			setEditableFieldValue(amountDeemedUs11,zeroOrMore(document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAccumlated')[0].value - document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAppliedPreviousYear')[0].value - document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAppliedDuringYear')[0].value));
		}

		if(document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountAccumlated')[0].value > 0){
			document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountDeemedUs11')[0].value=zeroOrMore(document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountAccumlated')[0].value - document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountInvested')[0].value);
		}else{
			document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountDeemedUs11')[0].value = '';
		}
		{
    		document.getElementsByName('itr7.scheduleCG.longTermCapGain.totalLTCG')[0].value=
    			    eval(coalesceSetRet('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balLTCGNo112') +
    	                coalesceSetRet('itr7.scheduleCG.longTermCapGain.otherAssetProviso112.balLTCG112') +
    	                 coalesceSetRet('itr7.scheduleCG.longTermCapGain.passThrInc10Per') +
    	                coalesceSetRet('itr7.scheduleCG.longTermCapGain.passThrInc20Per'));
    	}

		// document.getElementsByName('itr7.scheduleCG.incChargeableHeadCapGain')[0].value=zeroOrMore(eval(parseInt((document.getElementsByName('itr7.scheduleCG.longTermCapGain.totalLTCG')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.longTermCapGain.totalLTCG')[0].value))
		// +
		// parseInt(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.totalSTCG')[0].value==""?0:document.getElementsByName('itr7.scheduleCG.shortTermCapGain.totalSTCG')[0].value)));

		$('[name="itr7.partBTI.tiDeductions.amtAppliedtForCharitablePurpose"]')[0].value = zeroOrMore(
				getAmt('itr7.scheduleER.expensesTotal') +
				getAmt('itr7.scheduleER.totalBTrustExpenditure') -
				getAmt('itr7.scheduleER.incomeDeemedus111') -
				getAmt('itr7.scheduleER.incomeUpto15Per') -
				getAmt('itr7.scheduleER.borrowedFund') -
				getAmt('itr7.scheduleER.totOthIncome'));

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

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

				balanceALV =  document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.balanceALV')[0];

				thirtyPercentOfBalance = document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.thirtyPercentOfBalance')[0];

				thirtyPercentOfBalance.value = zeroOrMore(Math.round(eval(parseInt(coalesce(balanceALV.value), 10)) * eval('0.30')));

			}

			// scheduleHPCalc();

		/*
		 * document.getElementsByName('itr7.partBTI.tiDeductions.amtAppliedtForCharitablePurpose')[0].value =
		 * zeroOrMore(document.getElementsByName('itr7.scheduleER.expensesTotal')[0].value +
		 * document.getElementsByName('itr7.scheduleER.totalBTrustExpenditure')[0].value -
		 * document.getElementsByName('itr7.scheduleER.incomeDeemedus111')[0].value -
		 * document.getElementsByName('itr7.scheduleER.incomeUpto15Per')[0].value -
		 * document.getElementsByName('itr7.scheduleER.borrowedFund')[0].value -
		 * document.getElementsByName('itr7.scheduleER.totOthIncome')[0].value);
		 */

		/*
		 * $('[name="itr7partBTI.tiAdditions.incChargeableUs111i"]')[0].value =
		 * getAmt('itr7.scheduleER.donation.corpus');
		 */

		$('[name="itr7.partBTI.totIncNot711Abv"]')[0].value = zeroOrMore(getAmt('itr7.partBTI.incomeFromHP') + getAmt('itr7.partBTI.profBusGain.profGainNoSpecBus') + getAmt('itr7.partBTI.capGain.totalCapGains') + getAmt('itr7.partBTI.incFromOS.totIncFromOS'));

		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAfterVoluntaryContribution')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].value) + parseInt(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr')[0].value==""?0:document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr')[0].value));

		var AccIncAsPerSection115TD = document.getElementsByName('itr7.schedule115TD.AccIncAsPerSection115TD')[0];
		AccIncAsPerSection115TD.value = zeroOrMore(eval(
				 parseInt(coalesceSetRet('itr7.schedule115TD.netValueAsset'),10)
				- (parseInt(coalesceSetRet('itr7.schedule115TD.fmvTotal'),10)
				- parseInt(coalesceSetRet('itr7.schedule115TD.LiabRespAssat4Abv'),10))
			));

		// $('[name="itr7.partBTI.tiDeductions.amtAppliedForRelegiousPurposeUs111A"]')[0].value
		// = getAmt('itr7.scheduleEC.totalCapitalExpense') -
		// getAmt('itr7.scheduleEC.incomeDeemedPrecedingYear') -
		// getAmt('itr7.scheduleEC.incomeEarlierYears15Percent') -
		// getAmt('itr7.scheduleEC.borrowedFund') ;

		document.getElementsByName('itr7.partBTI.tiDeductions.amtAppliedForRelegiousPurposeUs111A')[0].value =
			zeroOrMore(document.getElementsByName('itr7.scheduleEC.totalCapitalExpense')[0].value -
			document.getElementsByName('itr7.scheduleEC.incomeDeemedPrecedingYear')[0].value -
			document.getElementsByName('itr7.scheduleEC.incomeEarlierYears15Percent')[0].value -
			document.getElementsByName('itr7.scheduleEC.borrowedFund')[0].value -
			document.getElementsByName('itr7.scheduleEC.anyOtherIncome')[0].value);

		$('[name="itr7.scheduleCG.shortTermCapGain.totalSTCG"]')[0].value =
					  getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')
					+ getAmt('itr7.scheduleCG.shortTermCapGain.otherAsset.balSCG')
					+ getAmt('itr7.scheduleCG.shortTermCapGain.deemedSTCGDeprAsset')
					+ getAmt('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.totAmtStcgUnderPTI');

		$('[name="itr7.partBTI.tiDeductions.totalDeductions"]')[0].value = getAmt('itr7.partBTI.tiDeductions.amtAppliedtForCharitablePurpose')
									+ getAmt('itr7.partBTI.tiDeductions.amtAppliedForRelegiousPurposeUs111A')
									+ getAmt('itr7.partBTI.tiDeductions.amtAppForCharitablePurposeRepayment')
									+ getAmt('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable')
									+ getAmt('itr7.partBTI.tiDeductions.amtAppForDeemedIncome')
									+ getAmt('itr7.partBTI.tiDeductions.amtFulfilledUs112')
									+ getAmt('itr7.partBTI.tiDeductions.amtForCharitableUs111') ;




		$('[name="itr7.partBTI.tiAdditions.totalAdditions"]')[0].value = /*
																			 * getAmt('itr7partBTI.tiAdditions.incChargeableUs111i') +
																			 */ getAmt('itr7.partBTI.tiAdditions.incChargeableUs111B')
									+ getAmt('itr7.partBTI.tiAdditions.incChargeableUs113')
									+ getAmt('itr7.partBTI.tiAdditions.anonymousDonationVC')
									+ getAmt('itr7.partBTI.tiAdditions.otherThanAD')
									+ getAmt('itr7.partBTI.tiAdditions.incChargeableUs122')
									+ getAmt('itr7.partBTI.tiAdditions.amtDisallowUs40aia')
									+ getAmt('itr7.partBTI.tiAdditions.amtDisallowUs40A33A') ;

		var table = document.getElementById('rejApprovalDtls');
		var noOfRows = table.rows.length;
		var flag = false;
		for(var i = 0; i < parseInt(noOfRows-2); i++)
			{
			var secRegApproved=document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration')[0].value;

			if(secRegApproved == 'VI' )
			{
				flag = true;
				break;
			}
			}
		var flag2=false;
			if(document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.changeInActivitiesDuringYr')[0].value=='N'||
				(document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.changeInActivitiesDuringYr')[0].value=='Y' && 
				 document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.freshRegistrationPrescribed')[0].value=='Y' &&
				 document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.freshRegistrationUnder12AA')[0].value=='Y'))
			{
				flag2=true;
			}
			var activityNature215=document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityNature215')[0].value;
			var activityRendering215=document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityRendering215')[0].value;
			
			var natureofTrade=coalesce(document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.natureofTrade')[0].value);
			var anyofTrade=coalesce(document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.anyofTrade')[0].value);
			
//			var total = getAmt('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.natureofTrade')
//						+ getAmt('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.anyofTrade');
//			
			natureofTrade = parseFloat(natureofTrade);
			anyofTrade = parseFloat(anyofTrade);
			var total = eval(natureofTrade + anyofTrade);
			
			var flag3=false;
			
			if(((activityNature215=='' && activityRendering215=='')||(activityNature215=='N' && activityRendering215=='N'))|| 
					((activityNature215=='Y' || activityRendering215=='Y') && total<=parseInt('20',0)))
			{
				flag3=true;
			}
			if(flag && document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value=='11' && flag2 && flag3)
				{
					$('[name="itr7.partBTI.totalTI"]')[0].value = getAmt('itr7.partBTI.vcCorpusSec11')
					+ getAmt('itr7.partBTI.aggregateIncomeUs1112')
					- getAmt('itr7.partBTI.tiDeductions.totalDeductions')
					+ getAmt('itr7.partBTI.tiAdditions.totalAdditions')
					+ getAmt('itr7.partBTI.incChargeableUs114');
				}
				else
				{
					$('[name="itr7.partBTI.totalTI"]')[0].value = getAmt('itr7.partBTI.voluntaryContributions.totIncFromVC')
					+ getAmt('itr7.partBTI.vcCorpusSec11')
					+ getAmt('itr7.partBTI.aggregateIncomeUs1112')
					- getAmt('itr7.partBTI.tiDeductions.totalDeductions')
					+ getAmt('itr7.partBTI.tiAdditions.totalAdditions')
					+ getAmt('itr7.partBTI.incChargeableUs114');
				}





		//chkamtAccumulatedForCharitable();
		$('[name="itr7.partBTI.tiAdditions.totalAdditions"]')[0].value = getAmt('itr7.partBTI.tiAdditions.incChargeableUs111B')+getAmt('itr7.partBTI.tiAdditions.incChargeableUs113')+getAmt('itr7.partBTI.tiAdditions.incChargeableUs122')+getAmt('itr7.partBTI.tiAdditions.amtDisallowUs40aia')+getAmt('itr7.partBTI.tiAdditions.amtDisallowUs40A33A')+getAmt('itr7.partBTI.tiAdditions.anonymousDonationVC')+getAmt('itr7.partBTI.tiAdditions.otherThanAD')/* +getAmt('itr7partBTI.tiAdditions.incChargeableUs111i') */;

		$('[name="itr7.partBTI.tiAdditions.incChargeableUs113"]')[0].value = getAmt('itr7.itrScheduleI.totAmountDeemedUs11');

		$('[name="itr7.partBTI.incChargeableUs114"]')[0].value = getAmt('itr7.corpScheduleBP.chargeableUs11.incChargeableUs11');
		// $('[name="itr7.partBTI.totalTI"]')[0].value =
		// getAmt('itr7.partBTI.voluntaryContributions.totIncFromVC') +
		// getAmt('itr7.partBTI.aggregateIncomeUs1112')-getAmt('itr7.partBTI.tiDeductions.totalDeductions')+getAmt('itr7.partBTI.tiAdditions.totalAdditions')+getAmt('itr7.partBTI.incChargeableUs114');

		$('[name="itr7.partBTI.exemptionUs10_21"]')[0].value =getAmt('itr7.partBTI.exemptionUs1021')+getAmt('itr7.partBTI.exemptionUs10_22B')+
			getAmt('itr7.partBTI.exemptionUs10_23A')+
			getAmt('itr7.partBTI.exemptionUs10_23AAA')+
			getAmt('itr7.partBTI.exemptionUs10_23B')+
			getAmt('itr7.partBTI.exemptionUs10_23EC')+
			getAmt('itr7.partBTI.exemptionUs10_23ED')+
			getAmt('itr7.partBTI.exemptionUs10_23EE')+
			getAmt('itr7.partBTI.exemptionUs10_29A')
			;



		$('[name="itr7.partBTI.exemptionUs10_23C"]')[0].value =getAmt('itr7.partBTI.exemptionUs10_23Ciiiab')+getAmt('itr7.partBTI.exemptionUs10_23Ciiiac')+
		getAmt('itr7.partBTI.exemptionUs10_23Ciiiad')+
		getAmt('itr7.partBTI.exemptionUs10_23Ciiiae')+
		getAmt('itr7.partBTI.exemptionUs10_23D')+
		getAmt('itr7.partBTI.exemptionUs10_23DA')+
		getAmt('itr7.partBTI.exemptionUs10_23FB')+
		getAmt('itr7.partBTI.exemptionUs10_24') + getAmt('itr7.partBTI.exemptionUs10_46') + getAmt('itr7.partBTI.exemptionUs10_47');

		$('[name="itr7.partBTI.incomeFromHP"]')[0].value = zeroOrMore(getAmt("scheduleHP.incomeUnderIncFrmHp"));

		$('[name="itr7.partBTI.profBusGain.profGainNoSpecBus"]')[0].value = getAmt("itr7.corpScheduleBP.chargeableUs11.incAsAccOfBusUndertaking");


		$('[name="itr7.partBTI.capGain.shortTerm.totalShortTerm"]')[0].value = getAmt("itr7.scheduleCG.shortTermCapGain.totalSTCG");

		$('[name="itr7.partBTI.capGain.longTerm.totalLongTerm"]')[0].value = zeroOrMore(getAmt('itr7.scheduleCG.longTermCapGain.totalLTCG'));

		$('[name="itr7.partBTI.incFromOS.totIncFromOS"]')[0].value = getAmt('itr7.scheduleOS.incChargeableFrmOthSrc');


		if($('[name="itr7.partBTI.totalTI"]')[0].value < 0){
			$('[name="itr7.partBTI.totalTI"]')[0].value = parseInt('0',10);
		}



		$('[name="itr7.partBTI.capGain.totalCapGains"]')[0].value = zeroOrMore(getAmt('itr7.partBTI.capGain.shortTerm.totalShortTerm') + getAmt('itr7.partBTI.capGain.longTerm.totalLongTerm'));

		$('[name="itr7.partBTI.profBusGain.profGainNoSpecBus"]')[0].value = zeroOrMore(getAmt('itr7.corpScheduleBP.incChrgUnHdProftGain'));

		// $('[name="itr7.partBTI.grossInc"]')[0].value =
		// zeroOrMore(getAmt('itr7.partBTI.totalTI')+getAmt('itr7.partBTI.incChargeableUs11_3')+getAmt('itr7.partBTI.totIncNot711Abv')-getAmt('itr7.partBTI.exemptionUs10_21')-getAmt('itr7.partBTI.exemptionUs10_23C')-getAmt('itr7.partBTI.exemptionOtherthenUs10')-getAmt('itr7.partBTI.exemptionUs13_A')-getAmt('itr7.partBTI.exemptionUs13_B'));

		$('[name="itr7.partBTI.grossInc"]')[0].value = zeroOrMore(getAmt('itr7.partBTI.totalTI')+getAmt('itr7.partBTI.incChargeableUs11_3')+getAmt('itr7.partBTI.totIncNot711Abv')-getAmt('itr7.partBTI.exemptionUs13_A'));

		// CYLA
		$('[name="itr7.partBTI.currentYearLoss"]')[0].value = zeroOrMore(getAmt('itr7.scheduleCYLA.totalLossSetOff.totHPlossCurYrSetoff') + getAmt('itr7.scheduleCYLA.totalLossSetOff.totBusLossSetoff') + getAmt('itr7.scheduleCYLA.totalLossSetOff.totOthSrcLossNoRaceHorseSetoff')) ;
		$('[name="itr7.partBTI.grossTotalIncome"]')[0].value = getAmt('itr7.partBTI.grossInc')-getAmt('itr7.partBTI.currentYearLoss');

		if($('[name="itr7.partBTI.grossTotalIncome"]')[0].value < 0){
			$('[name="itr7.partBTI.grossTotalIncome"]')[0].value = parseInt('0',10);
		}

		// SI Income 1 to 4
		// $('[name="itr7.partBTI.incChargeTaxSplRate111A112"]')[0].value =
		// getAmt('itr7.scheduleSI.splCodeRateTax[0].splRateInc') +
		// getAmt('itr7.scheduleSI.splCodeRateTax[1].splRateInc') +
		// getAmt('itr7.scheduleSI.splCodeRateTax[2].splRateInc') +
		// getAmt('itr7.scheduleSI.splCodeRateTax[3].splRateInc') ;
		// getOSInc();


		$('[name="itr7.partBTI.totalIncome"]')[0].value = Math.round(parseInt(getAmt('itr7.partBTI.grossTotalIncome'),10));
		$('[name="itr7.partBTI.totalIncome"]')[0].value = Math.round(parseInt(getAmt('itr7.partBTI.grossTotalIncome'), 10)/10)*10;


			if( $('[name="itr7.partBTI.totalIncome"]')[0].value < 0){
			$('[name="itr7.partBTI.totalIncome"]')[0].value = parseInt('0',10);
		}

		$('[name="itr7.partBTI.incomeChargeableTotTax"]')[0].value = getAmt('itr7.scheduleSI.totSplRateInc');

		$('[name="itr7.partBTI.incChargeTaxSplRate111A112"]')[0].value = getAmt('itr7.scheduleSI.totSplRateInc');
		// getOSInc();

                var temp14m15 = zeroOrMore(getAmt('itr7.partBTI.totalIncome')-getAmt('itr7.partBTI.incomeChargeableTotTax'));

                if(temp14m15 > getExemption()){
                    $('[name="itr7.partBTI.aggregateIncome"]')[0].value = zeroOrMore(getAmt('itr7.partBTI.totalIncome')-getAmt('itr7.partBTI.incomeChargeableTotTax')+getAmt('itr7.partBTI.netAgricultureIncomeOrOtherIncomeForRate'));
                }else{
                    $('[name="itr7.partBTI.aggregateIncome"]')[0].value = 0;
                }

         $('[name="itr7.partBTI.donationsUs115BBC"]')[0].value =  zeroOrMore(Math.round(zeroOrMore(getAmt('itr7.scheduleVC.anonymousDonations.anonymousDonations115BBC'))));

         // $('[name="itr7.partBTI.incChrgbleMaxMarginalRates"]')[0].value =
			// getAmt('itr7.partBTI.aggregateIncome')-getAmt('itr7.partBTI.donationsUs115BBC');

         $('[name="itr7.partBTI.exemptionUs13_B"]')[0].value = getAmt('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B');


		
			var tmpSurcharge = calculateItr7Surcharge();
			
		if($('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates"]')[0].noChange!=true) {
				calculateTaxPayableOnTotalInc();
		} 
		if($('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates"]')[0].noChange!=true) {
                        var totSplRateIncTaxTemp = getAmt('itr7.scheduleSI.totSplRateIncTax');

			if($('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates"]')[0].old !=  totSplRateIncTaxTemp){
				$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates"]')[0].old = totSplRateIncTaxTemp;
				$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates"]')[0].value = totSplRateIncTaxTemp;
			}
		} else {
			$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates"]')[0].noChange=false;
		}
		if($('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.donationUs115BC"]')[0].noChange!=true) {
			var donationsUs115BBC = Math.round(getAmt('itr7.partBTI.donationsUs115BBC') * 0.3);
			if($('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.donationUs115BC"]')[0].old !=  donationsUs115BBC){
				$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.donationUs115BC"]')[0].old = donationsUs115BBC;
				$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.donationUs115BC"]')[0].value = donationsUs115BBC;
			}
		} else {
			$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.donationUs115BC"]')[0].noChange=false;
		}

		if($('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtMarginalRate"]')[0].noChange!=true) {
			// $('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtMarginalRate"]')[0].value
			// = calculateTaxAtMaxMarginalRate();
			var taxAtMarginalRate = calculateTaxAtMaxMarginalRate();
			if($('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtMarginalRate"]')[0].old !=  taxAtMarginalRate){
				$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtMarginalRate"]')[0].old = taxAtMarginalRate;
				$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtMarginalRate"]')[0].value = taxAtMarginalRate;
			}
		} else {
			$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtMarginalRate"]')[0].noChange=false;
		}
        if(called == 'dateOFFormOrIncorp' || called == 'statusOrCompanyType' || called == 'residentialStatus' || called == 'netAgricultureIncomeOrOtherIncomeForRate')
        {
            if(getAmt('itr7.partBTI.aggregateIncome')>0){
                $('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.rebateOnAgricultureInc"]')[0].value = calculateAgriRebate();
            }else{
                $('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.rebateOnAgricultureInc"]')[0].value =0;
            }
        }


		$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc"]')[0].value = zeroOrMore(getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates')+getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates')+getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.donationUs115BC')+getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtMarginalRate')-getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.rebateOnAgricultureInc'));

		$('[name="partBTTI.computationOfTaxLiability.taxPayableOnTI.surchargeonSI"]')[0].value =Math.round(parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),10) * 0.60* 0.25);



		$('[name="itr7.partBTTI.computationOfTaxLiability.surchargeOnTaxPayable"]')[0].value = calcNormalSurcharge();

		$('[name="itr7.partBTTI.computationOfTaxLiability.surchargeOnTaxPayable"]')[0].value = zeroOrMore(getAmt('partBTTI.computationOfTaxLiability.taxPayableOnTI.surchargeonSI')+getAmt('partBTTI.computationOfTaxLiability.taxPayableOnTI.surchargeonTI'));


		// $('[name="itr7.partBTTI.computationOfTaxLiability.surchargeOnTaxPayable"]')[0].value
		// = calcNormalSurcharge();
		$('[name="itr7.partBTTI.computationOfTaxLiability.educationCess"]')[0].value = Math.round((getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')+getAmt('itr7.partBTTI.computationOfTaxLiability.surchargeOnTaxPayable')) * 0.04);
		$('[name="itr7.partBTTI.computationOfTaxLiability.grossTaxLiability"]')[0].value = getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')+getAmt('itr7.partBTTI.computationOfTaxLiability.surchargeOnTaxPayable') + getAmt('itr7.partBTTI.computationOfTaxLiability.educationCess');
		// $('[name="itr7.partBTTI.computationOfTaxLiability.grossTaxPayable"]')[0].value
		// =
		// Math.max(getAmt('itr7.partBTTI.computationOfTaxLiability.grossTaxLiability'));




		// $('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableAfterCredUs115JAA"]')[0].value
		// =
		// zeroOrMore(getAmt('itr7.partBTTI.computationOfTaxLiability.credUs115JAATaxPaid'));

		// TR
		$('[name="itr7.partBTTI.computationOfTaxLiability.taxRelief.section90"]')[0].value = getAmt('scheduleTR1.totalIncomeOutIndia');
		$('[name="itr7.partBTTI.computationOfTaxLiability.taxRelief.section91"]')[0].value = getAmt('scheduleTR1.totalIncomeOutIndiaDTAA');

// limitTo($('[name="itr7.partBTTI.computationOfTaxLiability.taxRelief.section90"]')[0],getAmt('itr7.partBTTI.computationOfTaxLiability.grossTaxLiability'));
// limitTo($('[name="itr7.partBTTI.computationOfTaxLiability.taxRelief.section91"]')[0],getAmt('itr7.partBTTI.computationOfTaxLiability.grossTaxLiability'));
		$('[name="itr7.partBTTI.computationOfTaxLiability.taxRelief.totTaxRelief"]')[0].value = getAmt('itr7.partBTTI.computationOfTaxLiability.taxRelief.section90') + getAmt('itr7.partBTTI.computationOfTaxLiability.taxRelief.section91');

		$('[name="itr7.partBTTI.computationOfTaxLiability.netTaxLiability"]')[0].value = zeroOrMore(getAmt('itr7.partBTTI.computationOfTaxLiability.grossTaxLiability') - getAmt('itr7.partBTTI.computationOfTaxLiability.taxRelief.totTaxRelief'));
		calculateAdvancedTax();
		calculateTDS();
		calculateTCS();


			if($('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234A"]')[0].noChange!=true && $('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234B"]')[0].noChange!=true && $('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234C"]')[0].noChange!=true && $('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234F"]')[0].noChange!=true ){
				calculate234Intrst(getAmt('itr7.partBTTI.taxPaid.taxesPaid.advanceTax'));
			}else{
				$('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234A"]')[0].noChange=false;
				$('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234B"]')[0].noChange=false;
				$('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234C"]')[0].noChange=false;
				$('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234F"]')[0].noChange=false;
			}

		$('[name="itr7.partBTTI.computationOfTaxLiability.intrstPay.totalIntrstPay"]')[0].value = getAmt('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234A') + getAmt('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234B') + getAmt('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234C')+ + getAmt('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234F');
		$('[name="itr7.partBTTI.computationOfTaxLiability.aggregateTaxInterestLiability"]')[0].value = zeroOrMore(getAmt('itr7.partBTTI.computationOfTaxLiability.netTaxLiability') + getAmt('itr7.partBTTI.computationOfTaxLiability.intrstPay.totalIntrstPay'));

		$('[name="itr7.partBTTI.taxPaid.taxesPaid.totalTaxesPaid"]')[0].value = getAmt('itr7.partBTTI.taxPaid.taxesPaid.advanceTax')+getAmt('itr7.partBTTI.taxPaid.taxesPaid.selfAssessmentTax')+getAmt('itr7.partBTTI.taxPaid.taxesPaid.tds')+getAmt('itr7.partBTTI.taxPaid.taxesPaid.tcs');

		$('[name="itr7.partBTTI.taxPaid.balTaxPayable"]')[0].value=rndOffNrsTen(zeroOrMore(getAmt('itr7.partBTTI.computationOfTaxLiability.aggregateTaxInterestLiability')-getAmt('itr7.partBTTI.taxPaid.taxesPaid.totalTaxesPaid')));
		showEpay();
		$('[name="itr7.partBTTI.refund.refundDue"]')[0].value=rndOffNrsTen(zeroOrMore(getAmt('itr7.partBTTI.taxPaid.taxesPaid.totalTaxesPaid')-getAmt('itr7.partBTTI.computationOfTaxLiability.aggregateTaxInterestLiability')));
                if(called !='scheduleSI'){
                    // schSIChangeIncome();
                	changeCYLA('titti');
                    // calcScheduleAMT('calculateTiTti');

                }
				// calcScheduleAMTC('scheduleAMTC');

              // calcMATCFromTTI();
		$('[name="itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates"]')[0].noChange=false;
		
}catch(e){
	alert('error in ='+ e.stack);

}
	}


function calculateOtherVC(){
    var volCon;
    volCon = getAmt('itr7.scheduleVC.totalContribution')-(getAmt('itr7.scheduleVC.local.corpusFundDonation')+getAmt('itr7.scheduleVC.foreign.corpusFundDonation"'));
	document.getElementsByName('itr7.partBTI.voluntaryContribVC')[0].value=volCon;
	document.getElementsByName('itr7.partBTI.aggregateIncome9AI')[0].value=getAmt('itr7.scheduleAI.schAITotalIncome');
	document.getElementsByName('itr7.partBTI.amountApplied24A')[0].value=getAmt('itr7.scheduleER.totalRevenuExp');
}


        function getExemption(){
		var taxPayer = $('[name="itr7.partAGEN1.orgFirmInfo.statusOrCompanyType"]')[0];
		var taxSubPayer = $('[name="itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType"]')[0];
                if( taxSubPayer.value=='5i' || taxSubPayer.value=='5v' || taxPayer.value=='6'){
                    return 250000;
                }else{
                    return 0;
                }
        }

        function calculateTaxAtMaxMarginalRate(){
             var prncpl = getAmt('itr7.partBTI.incChrgbleMaxMarginalRates');
             var status = $('[name="itr7.partAGEN1.orgFirmInfo.statusOrCompanyType"]')[0].value;
             if(status=='7ii'){
                 return Math.round(prncpl * 0.4);
             } else {
            	 return Math.round(prncpl * 0.3);
             }
             return 0;
        }

	function rndOffNrsTen(newVar){

            if(  parseInt(newVar.toString().charAt(newVar.toString().length-1),10) >= parseInt('5',10)){
                    newVar = eval(Math.floor(eval(parseInt(newVar,10) / parseInt('10',10))) * parseInt('10',10));
                    newVar = eval(parseInt(newVar,10) + parseInt('10',10));

                    return newVar;
            }else{
                    newVar = eval(Math.floor(eval(parseInt(newVar,10) / parseInt('10',10))) * parseInt('10',10));

                    return newVar;
            }

        }



	function calculateTaxPayableOnTotalInc(){

		var totalIncome = zeroOrMore(getAmt('itr7.partBTI.aggregateIncome') - getAmt('itr7.partBTI.donationsUs115BBC') - getAmt('itr7.partBTI.incChrgbleMaxMarginalRates'));

		var taxPayer = $('[name="itr7.partAGEN1.orgFirmInfo.statusOrCompanyType"]')[0];
		var taxSubPayer = $('[name="itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType"]')[0];
		// IN-01,HUF-02,AOP-06/07,DC-03,FC-04,FRM-05,LA-10,AJP-08,COP-09

		var netTxblIncome 		= totalIncome;
		var incTax 				= document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtNormalRates')[0];
		var surcharge 			= document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.surchargeOnTaxPayable')[0];
		// var trIncTax = document.getElementById('trIncTax');

		var incTaxTemp = 0;

		// var totTaxLiab = document.getElementsByName('totTaxLiab')[0]; var
		// trTotTaxLiab = document.getElementById('trTotTaxLiab');
		if(  taxSubPayer.value=='5i'  || taxSubPayer.value=='5v' || taxPayer.value=='6' ){

            if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('0',10) && parseInt(rndOffNrsTen(netTxblIncome),10) <= parseInt('250000',10)){
            	incTaxTemp = parseInt('0',10);
		}else if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('250001',10) && parseInt(rndOffNrsTen(netTxblIncome),10) <= parseInt('500000',10)){
			incTaxTemp = eval( eval(parseInt(rndOffNrsTen(netTxblIncome),10) - parseInt('250000',10) )  * parseFloat('0.05')) ;
		}else if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('500001',10) && parseInt(rndOffNrsTen(netTxblIncome),10) <= parseInt('1000000',10)){
			incTaxTemp = eval(eval(eval(parseInt(rndOffNrsTen(netTxblIncome),10) - parseInt('500000',10) )* parseFloat('0.2')) + parseInt('12500',10));
		}else if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('1000001',10)){
			incTaxTemp = eval(eval(eval(parseInt(rndOffNrsTen(netTxblIncome),10) - parseInt('1000000',10) )* parseFloat('0.3')) + parseInt('112500',10));
		}

	}else if(taxPayer.value=='7' || taxPayer.value=='4' || taxSubPayer.value=='5vii'){

		incTaxTemp = eval(parseInt(rndOffNrsTen(netTxblIncome),10) * parseFloat('0.3'));
		// for surcharge
		if(taxPayer.value=='7'){
			var taxOnTotInc =  parseInt(incTaxTemp,10);
			var taxOnCutOffInc = 10000000  * 0.3;

			if( rndOffNrsTen(netTxblIncome) > 10000000 ){
				var tempSurcharge = taxOnTotInc  * 0.07 ;

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

	}/*else if(taxSubPayer.value=='7ii'){

		incTaxTemp = eval(parseInt(rndOffNrsTen(netTxblIncome),10) * parseFloat('0.4'));
		// for surcharge
			var taxOnTotInc =  parseInt(incTaxTemp,10);
			var taxOnCutOffInc = 10000000  * 0.4;

			if( rndOffNrsTen(netTxblIncome) > 10000000 ){
				var tempSurcharge = taxOnTotInc  * 0.02 ;

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

	if(incTax.old !=  incTaxTemp){
		incTax.old = incTaxTemp;
		incTax.value = incTaxTemp;
	}

}

	function calculateAgriRebate(){
		var totalIncome = zeroOrMore(getAmt('itr7.partBTI.netAgricultureIncomeOrOtherIncomeForRate'));


		var taxPayer = $('[name="itr7.partAGEN1.orgFirmInfo.statusOrCompanyType"]')[0];
		var taxSubPayer = $('[name="itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType"]')[0];
		// IN-01,HUF-02,AOP-06/07,DC-03,FC-04,FRM-05,LA-10,AJP-08,COP-09

		var netTxblIncome 		= totalIncome;
		var incTax 				= document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.rebateOnAgricultureInc')[0];
		// var trIncTax = document.getElementById('trIncTax');

		// var totTaxLiab = document.getElementsByName('totTaxLiab')[0]; var
		// trTotTaxLiab = document.getElementById('trTotTaxLiab');

		if(  taxSubPayer.value=='5i' ||  taxSubPayer.value=='5v' || taxPayer.value=='6'){

		netTxblIncome = eval(netTxblIncome) + eval(parseInt('250000',10));
		if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('0',10) && parseInt(rndOffNrsTen(netTxblIncome),10) <= parseInt('250000',10)){
			incTax.value = parseInt('0',10);
		}else if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('250001',10) && parseInt(rndOffNrsTen(netTxblIncome),10) <= parseInt('500000',10)){
			incTax.value = eval( eval(parseInt(rndOffNrsTen(netTxblIncome),10) - parseInt('250000',10) )  * parseFloat('0.05')) ;
		}else if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('500001',10) && parseInt(rndOffNrsTen(netTxblIncome),10) <= parseInt('1000000',10)){
			incTax.value = eval(eval(eval(parseInt(rndOffNrsTen(netTxblIncome),10) - parseInt('500000',10) )* parseFloat('0.2')) + parseInt('12500',10));
		}else if(parseInt(rndOffNrsTen(netTxblIncome),10) >= parseInt('1000001',10)){
			incTax.value = eval(eval(eval(parseInt(rndOffNrsTen(netTxblIncome),10) - parseInt('1000000',10) )* parseFloat('0.3')) + parseInt('112500',10));
		}

	}else if(taxPayer.value=='7' || taxPayer.value=='4' ||  taxSubPayer.value=='5vii'){

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


	}
	return incTax.value;
}

	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)) ;
					}
			}
		}
		$('[name="itr7.partBTTI.taxPaid.taxesPaid.advanceTax"]')[0].value = advanceTax;
		$('[name="itr7.partBTTI.taxPaid.taxesPaid.selfAssessmentTax"]')[0].value = selfAssessmentTax;
		return advanceTax;
	}

function calculateAdvancedTax234A(date){
		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/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 calculateTDS2AmntFwd(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
							+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value;

			taxDeductedTDS = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;

			taxCreditedOwnHands = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxCreditedOwnHands')[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 calculateTDS3AmntFwd(el){
var mainTab = document.getElementById('scheduleTDS3');
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('scheduleTDS3.tDS3onOthThanSal[' + i
						+ '].totTDSOnAmtPaid')[0].value;

		taxDeductedOwnHands = document
				.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value;

		taxDeductedTDS = document
				.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;

		taxCreditedOwnHands = document
				.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0].value;

		taxCreditedTDS = document
				.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + 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('scheduleTDS3.tDS3onOthThanSal[' + i
				+ '].amntCarryForward')[0].value = sum;

	}
}
}


function calculateTDS(){
    var TDS = parseInt('0' ,10);
	var TDS2 = parseInt('0' ,10);
	var tab2 = document.getElementById('scheduleTDS2');
	var allInputTags = tab2.getElementsByTagName('input');
		for(var i = 0; i < allInputTags.length; i++) {
				if (allInputTags[i].name.match("taxCreditedOwnHands$")) {
				// eval(parseInt(TDS2 ,10) +
				// parseInt(isNVL(allInputTags[i].value) ,10));
					TDS2 = eval(parseInt(TDS2 ,10) + parseInt(isNVL(allInputTags[i].value) ,10));

				}
			}

	var TDS3 = parseInt('0' ,10);
	var tab3 = document.getElementById('scheduleTDS3');
	var allInputTagsTDS3 = tab3.getElementsByTagName('input');
		for(var i = 0; i < allInputTagsTDS3.length; i++) {
				if (allInputTagsTDS3[i].name.match("taxCreditedOwnHands$")) {

						TDS3 = eval(parseInt(TDS3 ,10) + parseInt(isNVL(allInputTagsTDS3[i].value) ,10));

				}
			}



	TDS=eval(parseInt(TDS2,10)+parseInt(TDS3,10));
	document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.tds')[0].value = parseInt(TDS,10);

	return TDS;
}
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
				+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0].value;

		sum = eval(parseInt(sum, 10) + parseInt(coalesce(taxCreditedOwnHands), 10));

	}

	document.getElementsByName('scheduleTDS2.tdSonOthThanSal.totalTDSonOthThanSals')[0].value = sum;

}


function calcTotalTDS3()
{

	var tdsTable = document.getElementById('scheduleTDS3');
	var noOfRows = tdsTable.rows.length;

	var sum = 0;

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

		var taxCreditedOwnHands =  document
		.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
				+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0].value;

		sum = eval(parseInt(sum, 10) + parseInt(coalesce(taxCreditedOwnHands), 10));

	}

	document.getElementsByName('scheduleTDS3.tDS3onOthThanSal.totalTDS3OnOthThanSal')[0].value = sum;

}
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
							+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value;

			var amt9 = document
					.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0];

			var tempVal = eval(parseInt(coalesce(amt6),10) + parseInt(coalesce(amt7),10));

			if (amt9.value > tempVal) {
				j
						.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i
								+ '].taxDeductCreditDtls.taxCreditedOwnHands',
								'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)');
				addErrorXHTML(
						document
								.getElementsByName('scheduleTDS2.tdSonOthThanSal['
										+ i
										+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0],
						'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)',
						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
					+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0];

	var tempVal =  eval(parseInt(coalesce(amt6),10) + parseInt(coalesce(amt8),10));

	if (amt9.value > tempVal) {
		j
				.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedOwnHands',
						'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)');
		addErrorXHTML(
				document
						.getElementsByName('scheduleTDS2.tdSonOthThanSal['
								+ i
								+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0],
				'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)',
				true);
	}


			}
	}
}

function validateIE3Grtthan34(){
	var mainTab = document.getElementById('scheduleIE3');

	var mainTabRows = mainTab.rows.length;


	for (var i = 0; i < mainTabRows - 4; i++) {

		var amt3 = document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC[' + i + '].totalContributionReceipts')[0].value;

		var amt4 = document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC[' + i + '].governmentGrants')[0].value;
		if (eval(parseInt(amt4 ,10)) > eval(parseInt(amt3 ,10))) {
			j.setFieldError('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].governmentGrants','Government Grants amount cannot be more than Total receipts including any voluntary contribution');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].governmentGrants')[0],'Government Grants amount cannot be more than Total receipts including any voluntary contribution',true);
		}

	}

}


function validateTDS39Grtthen67() {

	var mainTab = document.getElementById('scheduleTDS3');

	var mainTabRows = mainTab.rows.length;

	for (var i = 0; i < mainTabRows - 6; i++) {

		tDSCreditName = document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['
				+ i + '].tDSCreditName')[0].value;

		if (tDSCreditName == 'S') {

			var amt6 = document
					.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
							+ '].totTDSOnAmtPaid')[0].value;

			var amt7 = document
					.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value;

			var amt9 = document
					.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
							+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0];

			var tempVal = eval(parseInt(coalesce(amt6),10) + parseInt(coalesce(amt7),10));

			if (amt9.value > tempVal) {
				j
						.setFieldError('scheduleTDS3.tDS3onOthThanSal[' + i
								+ '].taxDeductCreditDtls.taxCreditedOwnHands',
								'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)');
				addErrorXHTML(
						document
								.getElementsByName('scheduleTDS3.tDS3onOthThanSal['
										+ i
										+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0],
						'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)',
						true);
			}
		}
		else
			{

			var amt6 = document
			.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].totTDSOnAmtPaid')[0].value;

	var amt8 = document
			.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value;

	var amt9 = document
			.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0];

	var tempVal = eval(parseInt(coalesce(amt6),10) + parseInt(coalesce(amt8),10));

	if (amt9.value > tempVal) {
		j
				.setFieldError('scheduleTDS3.tDS3onOthThanSal[' + i
						+ '].taxDeductCreditDtls.taxCreditedOwnHands',
						'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)');
		addErrorXHTML(
				document
						.getElementsByName('scheduleTDS3.tDS3onOthThanSal['
								+ i
								+ '].taxDeductCreditDtls.taxCreditedOwnHands')[0],
				'Amount entered in Column (9) cannot be more than amount entered in Column (6) or TDS field of Column (8)',
				true);
	}



			}
	}
}


function disableTDS2Fields() {
	var tdsTable = document.getElementById('scheduleTDS2');
	var noOfRows = tdsTable.rows.length;

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

		tDSCreditName = document.getElementsByName('scheduleTDS2.tdSonOthThanSal['
				+ i + '].tDSCreditName')[0].value;

		if (tDSCreditName == 'O') {

			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = true;
			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;
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].panofOtherPerson')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].disabled = false;
		} else if (tDSCreditName == 'S') {

			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[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.taxDeductedTDS')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].panofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].panofOtherPerson')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].value = "";
		} else {
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[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;
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].panofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].panofOtherPerson')[0].value = "";
			
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].disabled = true;
			document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i
					+ '].aadhaarofOtherPerson')[0].value = "";

		}

	}

}

function disableTDS3Fields() {
	var tdsTable = document.getElementById('scheduleTDS3');
	var noOfRows = tdsTable.rows.length;

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

		tDSCreditName = document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['
				+ i + '].tDSCreditName')[0].value;

		if (tDSCreditName == 'O') {

			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value = "";
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].value = "";
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].value = "";
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].value = "";
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].value = "";
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].PAN')[0].disabled = false;
		}

		else if (tDSCreditName == 'S') {

			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpouseAadhaar')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].value = "";
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].value = "";
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].PAN')[0].disabled = true;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].PAN')[0].value = "";
		}

		else {
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedOwnHands')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedIncome')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedTDS')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxCreditedSpousePAN')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedTDS')[0].disabled = false;
			
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i
					+ '].taxDeductCreditDtls.taxDeductedIncome')[0].disabled = false;

		}
	}
}



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 + '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value;
			var totTDSOnAmtPaid = document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i + '].totTDSOnAmtPaid')[0].value ;
			var totTDSOn32 = document.getElementsByName('scheduleTDS2.tdSonOthThanSal[' + i + '].taxDeductCreditDtls.taxDeductedTDS')[0].value ;
		if (taxDeductedOwnHands !='' && totTDSOnAmtPaid !=''){


			addErrorXHTML(
					'',
					'Unclaimed TDS brought forward and details of TDS of current FY should be provided in different rows in Sch TDS 1.');
			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 1.');


			}
		if (totTDSOnAmtPaid !='' && totTDSOn32 !=''){


			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('scheduleTDS2.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 TDS1');


			}
	}
}



function validateTDS3(){

	var mainTab = document.getElementById('scheduleTDS3');
	var mainTabRows = mainTab.rows.length;


	for (var i = 0; i < mainTabRows - 6; i++) {

			var taxDeductedOwnHands = document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i + '].taxDeductCreditDtls.taxDeductedOwnHands')[0].value;
			var totTDSOnAmtPaid = document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i + '].totTDSOnAmtPaid')[0].value ;
			var totTDSon32 = document.getElementsByName('scheduleTDS3.tDS3onOthThanSal[' + i + '].taxDeductCreditDtls.taxDeductedTDS')[0].value ;
		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.');
			j.setFieldError('scheduleTDS3.tDS3onOthThanSal[' + i+ '].totTDSOnAmtPaid','Unclaimed TDS brought forward and details of TDS of current FY should be provided in different rows in Sch TDS 2.');



			}
		if (totTDSOnAmtPaid !='' && totTDSon32 !=''){

			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 2');
			j.setFieldError('scheduleTDS3.tDS3onOthThanSal[' + 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 2');



			}
	}
}


function zeroOrLess(val){
	if(parseInt(val, 10) > 0 ){
		return 0;
	}
	return parseInt(val, 10);
}
function appendzeroto5or6TCS() {
	var mainTab = document.getElementById('scheduleTCS');
	var mainTabRows = mainTab.rows.length;
	for (var i = 0; i < mainTabRows - 5; i++) {
		if (document.getElementsByName('scheduleTCS.tcs['+i+'].totalTCS')[0].value != '') {
			if(document.getElementsByName('scheduleTCS.tcs['+i+'].amountBF')[0].value>parseInt('0', 10)){
				j.setFieldError('scheduleTCS.tcs['+i+'].amountBF','Unclaimed TCS brought forward and details of TCS of current FY should be provided in different rows');
		        addErrorXHTML(document.getElementsByName('scheduleTCS.tcs[' + i + '].amountBF')[0],'Unclaimed TCS brought forward and details of TCS of current FY should be provided in different rows',true);
			}
		}
	}
}
  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(parseInt(allInputTags[i].value,10) >  parseInt(coalesce(allInputTags[i-1].value),10) + parseInt(coalesce(allInputTags[i-2].value),10)){
					addErrorXHTML(allInputTags[i],'Amount claimed for this year cannot be more than total tax collected in schedule TCS',true);
					j.setFieldError(allInputTags[i].name,'Amount claimed for this year cannot be more than total tax collected 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 = zeroOrMore(parseInt(coalesce(allInputTags[i-2].value)) + parseInt(coalesce(allInputTags[i-1].value))
						- parseInt(coalesce(allInputTags[i].value)));
			}
		}
	$('[name="itr7.partBTTI.taxPaid.taxesPaid.tcs"]')[0].value = parseInt(TCS,10);
	$('[name="scheduleTCS.totalTcSSalary"]')[0].value = parseInt(TCS,10);
	return TCS;
}

	function calculateItr7Surcharge(){
		var status = $('[name="itr7.partAGEN1.orgFirmInfo.statusOrCompanyType"]')[0].value;
		var subStatus = $('[name="itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType"]')[0].value;
		
		var surcharge = 0;
		
			if((status=='6'|| subStatus=='5i' || subStatus=='5v' ||  subStatus=='5vi' ||  subStatus=='5vii')){
				var surchargeRate = 0.10;
				var taxOnCutOffInc = 5000000  * 0.185;
				return Math.round(surcharge);
			}
		return Math.round(surcharge);
	}

	function calcNormalSurcharge(){
		var taxPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];

		var netIncome = getAmt('itr7.partBTI.totalIncome');
        var netTxblIncome = zeroOrMore(netIncome);

		if((taxPayer.value=='7') && netTxblIncome > 100000000){

			return calculateItr7SurchargeFor10Crore();
		}
		return calculateItr7SurchargeTTI2f();
	}

	function calculateItr7SurchargeFor10Crore(){
		var surcharge = 0;
		var netIncome = getAmt('itr7.partBTI.totalIncome');
        var netTxblIncome = zeroOrMore(netIncome);
        var totalIncome = document.getElementsByName('itr7.partBTI.totalIncome')[0].value;
        var incChargeTaxSplRate111A112 = document.getElementsByName('itr7.partBTI.incChargeTaxSplRate111A112')[0].value;

		var dtaaInc = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRateInc')[0].value;
		var dtaaTax = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRateIncTax')[0].value;
		var surchargeOther115BBE = document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.surchargeonTI')[0];
		var tax = getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc');

		var taxAtSpecialRates = getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates');

			if(netTxblIncome > 100000000){

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

				var taxOnTotInc = eval(parseInt(calculateSlabbedTax(parseInt(totalIncome - incChargeTaxSplRate111A112)),10) +parseInt( taxAtSpecialRates,10));

				var toBeTaxed = 100000000 - coalesce(dtaaInc);

				var rowCount1 = countRowInTable('itr7.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('itr7.scheduleSI.splCodeRateTax[' + i + '].splRatePercent')[0].value;


					if (splRatePercent == 5) {

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

					} else if (splRatePercent == 10) {

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

					} else if (splRatePercent == 12.5) {

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

					}else if (splRatePercent == 15) {

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

					} else if (splRatePercent == 20) {

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

					} else if (splRatePercent == 25) {

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

					} else if (splRatePercent == 30) {

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

					} else if (splRatePercent == 50) {

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

					} else if (splRatePercent == 60) {

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

					}
				}

				var cgTax = 0;

				var cgTaxed = 0;

				var exmptn10 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[1].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[1].taxableInc');

				var exmptn15 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].taxableInc');

				var exmptn20 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[2].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[2].taxableInc');

				var exemption = getExemption() - exmptn10 - exmptn15 - exmptn20;

				var temp112A =0;
				if(parseInt(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].splRateInc'))<=100000){
					temp112A = 0;
				}else{
					temp112A = parseInt(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].taxableInc'))-parseInt(100000);
				}
				var exemption1125Ad = (-(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].taxableInc'))+temp112A) ;

				var exemptionUsed = 0;

				if (parseInt(totalIncome - incChargeTaxSplRate111A112) > 0) {
					if (parseInt(totalIncome - incChargeTaxSplRate111A112) >= getExemption()) {
						exemptionUsed = getExemption();
					} else {
						exemptionUsed = parseInt(totalIncome - incChargeTaxSplRate111A112);
					}

				}

				toBeTaxed = zeroOrMore(parseInt(toBeTaxed - exemptionUsed - exmptn10 - exmptn15 - exmptn20));


				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;
				}

				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 taxPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
				var taxSubPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0];
				var surchrgeRate = 0.12;
				var chargeOn1Crore = 0.07;
				if(taxPayer.value=='5'){
					surchrgeRate = 0.05;
					chargeOn1Crore = 0.02;
				}

				var temp1= used5BBE * 0.6  * 1.25;



				var taxOnCutOffInc =parseInt(cgTax) + (parseInt(cgTax - temp1)  + parseInt(dtaaTax)) * chargeOn1Crore;;


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

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


				// var tempSurcharge = tax * surchrgeRate;

					// 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);
						}



			}else{
				surcharge = 0;
			}


			var surchargeIT=  zeroOrMore(eval(surcharge- (parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),10) * 0.60* 0.25)));

			setEditableFieldValue(surchargeOther115BBE, Math.round(surchargeIT));


		return Math.round(surcharge);
	}

	function calculateItr7SurchargeTTI2f(){
		var status = $('[name="itr7.partAGEN1.orgFirmInfo.statusOrCompanyType"]')[0].value;
		var subStatus = $('[name="itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType"]')[0].value;
		var surcharge = 0;
		var netIncome = getAmt('itr7.partBTI.totalIncome');
        var netTxblIncome = zeroOrMore(netIncome);
        var totalIncome = document.getElementsByName('itr7.partBTI.totalIncome')[0].value;
        var incChargeTaxSplRate111A112 = document.getElementsByName('itr7.partBTI.incChargeTaxSplRate111A112')[0].value;

		var dtaaInc = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRateInc')[0].value;
		var dtaaTax = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRateIncTax')[0].value;

		var tax =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')[0].value;

		var taxAtSpecialRates = getAmt('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxAtSpecialRates');
		var surchargeOther115BBE = document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.surchargeonTI')[0];

			var taxPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
			if((taxPayer.value=='5' || taxPayer.value=='6')){
				var taxOnTotInc = parseInt(calculateSlabbedTax(totalIncome - incChargeTaxSplRate111A112)) + parseInt(taxAtSpecialRates);
				var normalInc = getSlabbedIncome(parseInt(totalIncome - incChargeTaxSplRate111A112));
				var toBeTaxed = 10000000 - coalesce(dtaaInc);
				if(netTxblIncome > 5000000 && netTxblIncome <= 10000000){
					toBeTaxed = 5000000 - coalesce(dtaaInc);
				}
				else if(netTxblIncome > 10000000 && netTxblIncome <= 20000000)
				{
					toBeTaxed = 10000000 - coalesce(dtaaInc);
				}
				else if(netTxblIncome > 20000000 && netTxblIncome <= 50000000)
				{
					toBeTaxed = 20000000 - coalesce(dtaaInc);
				}
				else
				{
					toBeTaxed = 50000000 - coalesce(dtaaInc);
				}
				var rowCount1 = countRowInTable('itr7.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('itr7.scheduleSI.splCodeRateTax[' + i + '].splRatePercent')[0].value;
					if (splRatePercent == 5) {

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

					}else if (splRatePercent == 10) {

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

					}else if (splRatePercent == 12.5) {

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

					}else if (splRatePercent == 15) {
						percent15SIInc = eval(parseInt(percent15SIInc, 10) + parseInt(document.getElementsByName('itr7.scheduleSI.splCodeRateTax[' + i + '].taxableInc')[0].value, 10));

					}else if (splRatePercent == 20) {

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

					}else if (splRatePercent == 25) {

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

					}else if (splRatePercent == 30) {

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

					}else if (splRatePercent == 50) {

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

					}else if (splRatePercent == 60) {

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

					}
				}


				var cgTax = 0;

				var cgTaxed = 0;

				var exmptn10 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[1].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[1].taxableInc');

				var exmptn15 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].taxableInc');

				var exmptn20 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[2].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[2].taxableInc');

				var exemption = getExemption() - exmptn10 - exmptn15 - exmptn20;

				var exemptionUsed = 0;

				var temp112A =0;
				if(parseInt(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].splRateInc'))<=100000){
					temp112A = 0;
				}else{
					temp112A = parseInt(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].taxableInc'))-parseInt(100000);
				}
				var exemption1125Ad = (-(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].taxableInc'))+temp112A) ;

				if (parseInt(totalIncome - incChargeTaxSplRate111A112) > 0) {
					if (parseInt(totalIncome - incChargeTaxSplRate111A112) >= getExemption()) {
						exemptionUsed = getExemption();
					} else {
						exemptionUsed = parseInt(totalIncome - incChargeTaxSplRate111A112);
					}

				}

				toBeTaxed = zeroOrMore(parseInt(toBeTaxed - exemptionUsed - exmptn10 - exmptn15 - exmptn20));
				percent5SIInc = parseInt(percent5SIInc, 10)+ parseInt(normalInc["10"], 10);

				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);

				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;
				}

				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 taxbefore60per = parseInt(coalesce(cgTax));


				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 taxableInc111A =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].taxableInc');
				var taxableInc112A =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].taxableInc');
				var taxableIncPTI10 =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[10].taxableInc');
				var taxableIncPTI15 =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[9].taxableInc');
				
				var splRateIncTax111A =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].splRateIncTax');
				var splRateIncTax112A =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].splRateIncTax');
				var splRateIncTaxPTI10 =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[10].splRateIncTax');
				var splRateIncTaxPTI15 =coalesceSetRet('itr7.scheduleSI.splCodeRateTax[9].splRateIncTax');
				
				if (rndOffNrsTen(netTxblIncome) > 20000000) {
					var f_111_112A=eval(parseInt(taxableInc111A,10)+
					parseInt(taxableIncPTI15,10)+
					parseInt(taxableInc112A,10)+
					parseInt(taxableIncPTI10,10));
					
					var f_111_112A_Othr=eval(parseInt(netTxblIncome,10)
							-((parseInt(taxableInc111A,10)+
							parseInt(taxableIncPTI15,10)+
							parseInt(taxableInc112A,10)+
							parseInt(taxableIncPTI10,10))));
					
					if(f_111_112A==0 && rndOffNrsTen(netTxblIncome) > 20000000 && rndOffNrsTen(netTxblIncome) <= 50000000)
					{

						var f_115BBE = eval(parseInt(
								coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
								10)
								- (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60));
						
						
						var tempSurcharge = eval((0.25 * parseInt(f_115BBE, 10))
								+ (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60 * 0.25));
						console.log("tempSurcharge"+tempSurcharge);

						var extraInc = rndOffNrsTen(netTxblIncome) - 20000000;

						console.log("extraInc"+extraInc);

						var surchargeOn1Cr = taxbefore60per * 0.15; // surcharge on 1 Cr tax
						console.log("surchargea"+surcharge);
						if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)) {
							console.log("surchargeaasdad");
							console.log("taxOnTotInc"+taxOnTotInc);
							console.log("tempSurcharge"+tempSurcharge);
							console.log("taxOnCutOffInc"+taxOnCutOffInc);
							console.log("extraInc"+extraInc);
							console.log("surchargeOn1Cr"+surchargeOn1Cr);

							var totaltax1 = eval(parseInt(coalesce(tempSurcharge))
									+ parseInt(coalesce(taxOnTotInc)));

							var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
									- (taxOnCutOffInc + extraInc + surchargeOn1Cr));

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

						} else {
							console.log("surchargeb"+surcharge);
							surcharge = tempSurcharge;
							surcharge = Math.round(surcharge);
						}
						console.log("surchargec"+surcharge);
					}
					else if(f_111_112A==0 && rndOffNrsTen(netTxblIncome) > 50000000)
					{

						var f_115BBE = eval(parseInt(
								coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
								10)
								- (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60));
						var tempSurcharge = eval((0.37 * parseInt(f_115BBE, 10))
								+ (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60 * 0.25));
						console.log("tempSurcharge"+tempSurcharge);

						var extraInc = rndOffNrsTen(netTxblIncome) - 50000000;

						console.log("extraInc"+extraInc);

						var surchargeOn1Cr = taxbefore60per * 0.25; // surcharge on 1 Cr tax
						console.log("surchargea"+surcharge);
						if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)) {
							console.log("surchargeaasdad");
							console.log("taxOnTotInc"+taxOnTotInc);
							console.log("tempSurcharge"+tempSurcharge);
							console.log("taxOnCutOffInc"+taxOnCutOffInc);
							console.log("extraInc"+extraInc);
							console.log("surchargeOn1Cr"+surchargeOn1Cr);

							var totaltax1 = eval(parseInt(coalesce(tempSurcharge))
									+ parseInt(coalesce(taxOnTotInc)));

							var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
									- (taxOnCutOffInc + extraInc + surchargeOn1Cr));

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

						} else {
							console.log("surchargeb"+surcharge);
							surcharge = tempSurcharge;
							surcharge = Math.round(surcharge);
						}
						console.log("surchargec"+surcharge);
					}
					else if(f_111_112A>0  && f_111_112A_Othr <= 20000000 && (parseInt(f_111_112A,10)+parseInt(f_111_112A_Othr,10))<=50000000)
					{
						var f_115BBE = eval(parseInt(
								coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
								10)
								- (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60) -(parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)));
						var tempSurcharge = eval((0.15 * parseInt(f_115BBE, 10))
								+ ((parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10)) * 0.60 * 0.25)+ ((parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)) * 0.15));
						console.log("tempSurcharge"+tempSurcharge);

						var extraInc = rndOffNrsTen(netTxblIncome) - 20000000;

						console.log("extraInc"+extraInc);
						
						var surchargeOn1Cr = taxbefore60per * 0.15; // surcharge on 1 Cr tax
						
						console.log("surchargea"+surcharge);
						if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)) {
							console.log("surchargeaasdad");
							console.log("taxOnTotInc"+taxOnTotInc);
							console.log("tempSurcharge"+tempSurcharge);
							console.log("taxOnCutOffInc"+taxOnCutOffInc);
							console.log("extraInc"+extraInc);
							console.log("surchargeOn1Cr"+surchargeOn1Cr);

							var totaltax1 = eval(parseInt(coalesce(tempSurcharge))
									+ parseInt(coalesce(taxOnTotInc)));

							var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
									- (taxOnCutOffInc + extraInc + surchargeOn1Cr));

							surcharge = zeroOrMore(tempSurcharge - marginalRelief);
							surcharge = Math.round(surcharge);
							
						} else {
							console.log("surchargeb"+surcharge);
							surcharge = tempSurcharge;
							surcharge = Math.round(surcharge);
						}
						console.log("surchargec"+surcharge);
					}
					else if(f_111_112A>0  && f_111_112A_Othr <= 20000000 && (parseInt(f_111_112A,10)+parseInt(f_111_112A_Othr,10))>50000000)
					{
						var f_115BBE = eval(parseInt(
								coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
								10)
								- (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60) -(parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)));
						var tempSurcharge = eval((0.15 * parseInt(f_115BBE, 10))
								+ ((parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10)) * 0.60 * 0.25)+ ((parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)) * 0.15));
						console.log("tempSurcharge"+tempSurcharge);

						var extraInc = rndOffNrsTen(netTxblIncome) - 50000000;

						console.log("extraInc"+extraInc);
						
						var surchargeOn1Cr = taxbefore60per * 0.15; // surcharge on 1 Cr tax
						
						console.log("surchargea"+surcharge);
						if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)) {
							console.log("surchargeaasdad");
							console.log("taxOnTotInc"+taxOnTotInc);
							console.log("tempSurcharge"+tempSurcharge);
							console.log("taxOnCutOffInc"+taxOnCutOffInc);
							console.log("extraInc"+extraInc);
							console.log("surchargeOn1Cr"+surchargeOn1Cr);

							var totaltax1 = eval(parseInt(coalesce(tempSurcharge))
									+ parseInt(coalesce(taxOnTotInc)));

							var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
									- (taxOnCutOffInc + extraInc + surchargeOn1Cr));

							surcharge = zeroOrMore(tempSurcharge - marginalRelief);
							surcharge = Math.round(surcharge);
							
						} else {
							console.log("surchargeb"+surcharge);
							surcharge = tempSurcharge;
							surcharge = Math.round(surcharge);
						}
						console.log("surchargec"+surcharge);
					}
					else if(f_111_112A>0 && f_111_112A_Othr > 20000000 && f_111_112A_Othr <= 50000000 && (parseInt(f_111_112A,10)+parseInt(f_111_112A_Othr,10))<=50000000)
					{
						
						var f_115BBE = eval(parseInt(
								coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
								10)
								- (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60) -(parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)));
						alert();
						var tempSurcharge = eval((0.25 * parseInt(f_115BBE, 10))
								+ ((parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10)) * 0.60 * 0.25) + ((parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)) * 0.15)) ;
						console.log("tempSurcharge"+tempSurcharge);
						
						var extraInc = rndOffNrsTen(netTxblIncome) - 20000000;

						console.log("extraInc"+extraInc);

						var surchargeOn1Cr = taxbefore60per * 0.15;// surcharge on 1 Cr tax
						console.log("surchargea"+surcharge);
						if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)) {
							console.log("surchargeaasdad");
							console.log("taxOnTotInc"+taxOnTotInc);
							console.log("tempSurcharge"+tempSurcharge);
							console.log("taxOnCutOffInc"+taxOnCutOffInc);
							console.log("extraInc"+extraInc);
							console.log("surchargeOn1Cr"+surchargeOn1Cr);

							var totaltax1 = eval(parseInt(coalesce(tempSurcharge))
									+ parseInt(coalesce(taxOnTotInc)));

							var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
									- (taxOnCutOffInc + extraInc + surchargeOn1Cr));

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

						} else {
							console.log("surchargeb"+surcharge);
							surcharge = tempSurcharge;
							surcharge = Math.round(surcharge);
						}
						console.log("surchargec"+surcharge);
					}
					else if(f_111_112A>0 && f_111_112A_Othr > 20000000 && f_111_112A_Othr <= 50000000 && (parseInt(f_111_112A,10)+parseInt(f_111_112A_Othr,10))>50000000)
					{
						var f_115BBE = eval(parseInt(
								coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
								10)
								- (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60) -(parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)));
						var tempSurcharge = eval((0.25 * parseInt(f_115BBE, 10))
								+ ((parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10)) * 0.60 * 0.25) + ((parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)) * 0.15)) ;
						console.log("tempSurcharge"+tempSurcharge);
						var extraInc = rndOffNrsTen(netTxblIncome) - 50000000;

						console.log("extraInc"+extraInc);
						var surchargeOn1Cr=0;
						var temp= eval(parseInt(splRateIncTax111A,10)+
								parseInt(splRateIncTaxPTI15,10)+
								parseInt(splRateIncTax112A,10)+
								parseInt(splRateIncTaxPTI10,10));
									if((parseInt('50000000',10)-parseInt(f_111_112A,10)) > 20000000)
									{
										 surchargeOn1Cr = eval(((parseInt(taxbefore60per,10)-parseInt(temp,10))*0.25)+ parseInt(temp,10)*0.15);// surcharge on 1 Cr tax
									}
									else
									{
										 surchargeOn1Cr = taxbefore60per * 0.15;// surcharge on 1 Cr tax
									}
						console.log("surchargea"+surcharge);
						if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)) {
							console.log("surchargeaasdad");
							console.log("taxOnTotInc"+taxOnTotInc);
							console.log("tempSurcharge"+tempSurcharge);
							console.log("taxOnCutOffInc"+taxOnCutOffInc);
							console.log("extraInc"+extraInc);
							console.log("surchargeOn1Cr"+surchargeOn1Cr);

							var totaltax1 = eval(parseInt(coalesce(tempSurcharge))
									+ parseInt(coalesce(taxOnTotInc)));

							var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
									- (taxOnCutOffInc + extraInc + surchargeOn1Cr));

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

						} else {
							console.log("surchargeb"+surcharge);
							surcharge = tempSurcharge;
							surcharge = Math.round(surcharge);
						}
						console.log("surchargec"+surcharge);
					}
					else if(f_111_112A>0 && f_111_112A_Othr >  50000000)
					{
						var f_115BBE = eval(parseInt(
								coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
								10)
								- (parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10) * 0.60) -(parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10)));
						var tempSurcharge = eval((0.37 * parseInt(f_115BBE, 10))
								+ ((parseInt(
										coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
										10)) * 0.60 * 0.25) + ((parseInt(splRateIncTax111A,10)+
												parseInt(splRateIncTaxPTI15,10)+
												parseInt(splRateIncTax112A,10)+
												parseInt(splRateIncTaxPTI10,10))* 0.15)) ;
						console.log("tempSurcharge"+tempSurcharge);

						var extraInc = rndOffNrsTen(netTxblIncome) - 50000000;

						console.log("extraInc"+extraInc);
						var temp= eval(parseInt(splRateIncTax111A,10)+
								parseInt(splRateIncTaxPTI15,10)+
								parseInt(splRateIncTax112A,10)+
								parseInt(splRateIncTaxPTI10,10));
						if((parseInt('50000000',10)-parseInt(f_111_112A,10)) > 20000000)
						{
							var surchargeOn1Cr = eval(((parseInt(taxbefore60per,10)-parseInt(temp,10))*0.25)+ parseInt(temp,10)*0.15);// surcharge on 1 Cr tax
						}
						else
						{
							var surchargeOn1Cr = taxbefore60per * 0.15;// surcharge on 1 Cr tax
						}
						console.log("surchargea"+surcharge);
						if ((taxOnTotInc + tempSurcharge) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)) {
							console.log("surchargeaasdad");
							console.log("taxOnTotInc"+taxOnTotInc);
							console.log("tempSurcharge"+tempSurcharge);
							console.log("taxOnCutOffInc"+taxOnCutOffInc);
							console.log("extraInc"+extraInc);
							console.log("surchargeOn1Cr"+surchargeOn1Cr);

							var totaltax1 = eval(parseInt(coalesce(tempSurcharge))
									+ parseInt(coalesce(taxOnTotInc)));

							var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge
									- (taxOnCutOffInc + extraInc + surchargeOn1Cr));

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

						} else {
							console.log("surchargeb"+surcharge);
							surcharge = tempSurcharge;
							surcharge = Math.round(surcharge);
						}
						console.log("surchargec"+surcharge);
					}
				}
				else if (rndOffNrsTen(netTxblIncome) > 10000000 && rndOffNrsTen(netTxblIncome) <= 20000000) {
					var f_115BBE = eval(parseInt(
							coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),
							10)
							- (parseInt(
									coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
									10) * 0.60));

					var tempSurcharge = eval((0.15 * parseInt(f_115BBE, 10))
							+ ((parseInt(
									coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
									10)) * 0.60 * 0.25));


					//check if eligible for marginal relief
					var extraInc = rndOffNrsTen(netTxblIncome) - 10000000;
					var surchargeOn1Cr = taxbefore60per * 0.10;   //surcharge on 1 Cr tax


					if( (taxOnTotInc + tempSurcharge ) > (taxOnCutOffInc + extraInc + surchargeOn1Cr)){


						var marginalRelief = zeroOrMore(taxOnTotInc + tempSurcharge - (taxOnCutOffInc + extraInc + surchargeOn1Cr));

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

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

				}

				else if( (rndOffNrsTen(netTxblIncome) > 5000000) && (rndOffNrsTen(netTxblIncome) < 10000001)){
					var f_115BBE = eval(parseInt(
							coalesceSetRet('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc'),10)
											- (parseInt(
													coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
													10) * 0.60));

					var tempSurcharge = eval((0.10 * parseInt(f_115BBE, 10))				+ ((parseInt(
							coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),
							10)) * 0.60 * 0.25));




					//check if eligible for marginal relief
					var extraInc = rndOffNrsTen(netTxblIncome) - 5000000;


					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);
						}

				}

				else {
					surcharge = parseInt('0' ,10);
				}


			}
			else if(netTxblIncome > 10000000){
				var taxOnTotInc = parseInt(calculateSlabbedTax(totalIncome - incChargeTaxSplRate111A112)) + parseInt(taxAtSpecialRates);
				var normalInc = getSlabbedIncome(parseInt(totalIncome - incChargeTaxSplRate111A112));
				var toBeTaxed = 10000000 - coalesce(dtaaInc);
				var rowCount1 = countRowInTable('itr7.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('itr7.scheduleSI.splCodeRateTax[' + i + '].splRatePercent')[0].value;

					if (splRatePercent == 5) {

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

					} else if (splRatePercent == 10) {

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

					} else if (splRatePercent == 12.5) {

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

					}else if (splRatePercent == 15) {

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

					} else if (splRatePercent == 20) {

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

					} else if (splRatePercent == 25) {

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

					} else if (splRatePercent == 30) {

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

					} else if (splRatePercent == 50) {

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

					}
					else if (splRatePercent == 60) {

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

					}
				}


				var cgTax = 0;

				var cgTaxed = 0;

				var exmptn10 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[1].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[1].taxableInc');

				var exmptn15 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[0].taxableInc');

				var exmptn20 = coalesceSetRet('itr7.scheduleSI.splCodeRateTax[2].splRateInc') -
				coalesceSetRet('itr7.scheduleSI.splCodeRateTax[2].taxableInc');

				var exemption = getExemption() - exmptn10 - exmptn15 - exmptn20;

				var temp112A =0;
				if(parseInt(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].splRateInc'))<=100000){
					temp112A = 0;
				}else{
					temp112A = parseInt(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].taxableInc'))-parseInt(100000);
				}
				var exemption1125Ad = (-(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].taxableInc'))+temp112A) ;

				var exemptionUsed = 0;

				if (parseInt(totalIncome - incChargeTaxSplRate111A112) > 0) {
					if (parseInt(totalIncome - incChargeTaxSplRate111A112) >= getExemption()) {
						exemptionUsed = getExemption();
					} else {
						exemptionUsed = parseInt(totalIncome - incChargeTaxSplRate111A112);
					}

				}

				toBeTaxed = zeroOrMore(parseInt(toBeTaxed - exemptionUsed - exmptn10 - exmptn15 - exmptn20));

				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;
				}

				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 taxPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
				var taxSubPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0];
				var surchrgeRate = 0.15;
				if(taxPayer.value=='4'){
					surchrgeRate = 0.12;
				}
				else if(taxPayer.value=='7')
				{
					surchrgeRate = 0.07;
				}

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


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



				// var surchargeOn1Cr = taxbefore60per*0.1;

				// var tempSurcharge = tax * surchrgeRate;


					// check if eligible for marginal relief
					var extraInc = rndOffNrsTen(netTxblIncome) - 10000000;
					
					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);
						}


			}

			else{
				surcharge = 0;
			}


			var surchargeIT=  zeroOrMore(eval(surcharge- (parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),10) * 0.60* 0.25)));

			setEditableFieldValue(surchargeOther115BBE, Math.round(surchargeIT));

		return Math.round(surcharge);
	}

	function calcAge(){
		var dob = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.dateOFFormOrIncorp')[0];
		var retVal = calcAgeCommon(dob);
		return retVal;
	}

	function getSlabbedIncome(totalIncome){

		var taxPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
		var taxSubPayer = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0];

		var netTxblIncome 		= totalIncome;

		var inc = {"10":0,"20":0,"30":0, "40":0};
		if( taxSubPayer.value=='5i'  || taxSubPayer.value=='5v' || taxPayer.value=='6'){
		// if((taxPayer.value=='1') || (taxPayer.value=='2')){

			if(parseInt(netTxblIncome,10) >= parseInt('0',10) && parseInt(netTxblIncome,10) <= parseInt('250000',10)){
				inc = {"10":0, "20":0, "30":0, "40":0};
			}else if(parseInt(netTxblIncome,10) >= parseInt('250001',10) && parseInt(netTxblIncome,10) <= parseInt('500000',10)){
				inc = {"10":(parseInt(netTxblIncome,10) - 250000), "20":0, "30":0, "40":0};
			}else if(parseInt(netTxblIncome,10) >= parseInt('500001',10) && parseInt(netTxblIncome,10) <= parseInt('1000000',10)){
				inc = {"10":250000, "20":(parseInt(netTxblIncome,10) - 500000), "30":0, "40":0};
			}else if(parseInt(netTxblIncome,10) >= parseInt('1000001',10)){
				inc = {"10":250000, "20":500000, "30":(parseInt(netTxblIncome,10) - 1000000), "40":0};
			}

		}else if(taxPayer.value=='7' ||  taxPayer.value=='4'|| taxSubPayer.value=='5vii'){
			inc = {"10":0, "20":0, "30":(parseInt(netTxblIncome,10)), "40":0};

		}
		return inc;
	}


	function calculateSlabbedTax(netTxblIncome){
		var incTax = 0;
		var status=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
		var subStatus=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0];
		if( subStatus.value=='5i'  || subStatus.value=='5v' || status.value=='6'){
			if(parseInt(netTxblIncome,10) >= parseInt('0',10) && parseInt(netTxblIncome,10) <= parseInt('250000',10)){
				incTax = parseInt('0',10);
			}else if(parseInt(netTxblIncome,10) >= parseInt('250001',10) && parseInt(netTxblIncome,10) <= parseInt('500000',10)){
				incTax = Math.round(eval( eval(parseInt(netTxblIncome,10) - parseInt('250000',10) )  * parseFloat('0.05'))) ;
			}else if(parseInt(netTxblIncome,10) >= parseInt('500001',10) && parseInt(netTxblIncome,10) <= parseInt('1000000',10)){
				incTax = Math.round(eval(eval(eval(parseInt(netTxblIncome,10) - parseInt('500000',10) )* parseFloat('0.2')) + parseInt('12500',10)));
			}else if(parseInt(netTxblIncome,10) >= parseInt('1000001',10)){
				incTax = Math.round(eval(eval(eval(parseInt(netTxblIncome,10) - parseInt('1000000',10) )* parseFloat('0.3')) + parseInt('112500',10)));
			}

		}else if(status.value=='7' ||  status.value=='4' || subStatus.value=='5vii'){
			incTax = parseInt(netTxblIncome,10) * 0.3;
		}
		return incTax;
	}


	function limitTo(field, limit, fieldDesc){

		if(field.value > limit){
			if(fieldDesc!=null && fieldDesc!='' && fieldDesc!=undefined){
				addErrorXHTML(null, 'Value of ' + fieldDesc + ' cannot be more than ' + limit,true);
			}

			if(limit>0){
				field.value = limit;
			}else{
				field.value = 0;
			}

		}
	}

        function limitToModified(field, limit, fieldDesc){

		if(field.value > limit){
			if(fieldDesc!=null && fieldDesc!='' && fieldDesc!=undefined){
				addErrorXHTML(null, 'Value of ' + fieldDesc + ' cannot be more than ' + limit,true);
			}
		}
	}

        function getDueDate234A(){
        	var duedate = '31/07/2020'; // Modified due to the due date
											// extended for filing the return
    		var auditFlag = document.getElementsByName('itr7.partAGEN2.liableSec44ABflg')[0].value;
    		var audit92EFlag = false;
    		var table=document.getElementById('AuditDetails');
    		var allInputTags1 = table.getElementsByTagName('select');
    		for(var i = 0; i < allInputTags1.length; i++) {
    			if (allInputTags1[i].name.match("auditedSection$")) {
    				if(allInputTags1[i].value=='92E'){
    						audit92EFlag =true;
    						break;
    						}
    			     }
    			}
    		var othIncTaxActFlag = document.getElementsByName('itr7.partAGEN2.othIncTaxActFlag')[0].value;
    		if(audit92EFlag){
    			duedate = '30/11/2020';
    		}
    		else if(auditFlag=='Y'){
    				duedate = "31/10/2020";
    		}

    		var tab = document.getElementById('othIncTaxActTab');
    		var allInputTags = tab.getElementsByTagName('select');

    		if(othIncTaxActFlag == 'Y'){
    		for(var i = 0; i < allInputTags.length; i++) {
    			if (allInputTags[i].name.match("act$")) {
    				if(allInputTags[i].value!=''){
    					    				duedate = "31/10/2020";
    						}
    			     }
    			}
    		}

        return duedate;
        }
        function getDueDate234ACompanyAudit(){
        	var duedate = '31/10/2020'; // Modified due to the due date
											// extended for filing the return
    		var auditFlag = document.getElementsByName('itr7.partAGEN2.liableSec44ABflg')[0].value;
    		var audit92EFlag = false;
    		var table=document.getElementById('AuditDetails');
    		var allInputTags1 = table.getElementsByTagName('select');
    		for(var i = 0; i < allInputTags1.length; i++) {
    			if (allInputTags1[i].name.match("auditedSection$")) {
    				if(allInputTags1[i].value=='92E'){
    						audit92EFlag =true;
    						break;
    						}
    			     }
    			}
    		var othIncTaxActFlag = document.getElementsByName('itr7.partAGEN2.othIncTaxActFlag')[0].value;
    		if(audit92EFlag){
    			duedate = '30/11/2020';
    		}
    		else if(auditFlag=='Y'){
    				duedate = "31/10/2020";
    		}

    		var tab = document.getElementById('othIncTaxActTab');
    		var allInputTags = tab.getElementsByTagName('select');

    		if(othIncTaxActFlag == 'Y'){
    		for(var i = 0; i < allInputTags.length; i++) {
    			if (allInputTags[i].name.match("act$")) {
    				if(allInputTags[i].value!=''){
    					    				duedate = "31/10/2020";
    						}
    			     }
    			}
    		}

        return duedate;
        }
        function getDueDate234AForLessthan(){
        	var duedate = '10/01/2021'; // Modified due to the due date
											// extended for filing the return
        	//var duedate = '01/01/2021'; 
    		var auditFlag = document.getElementsByName('itr7.partAGEN2.liableSec44ABflg')[0].value;
    		var audit92EFlag = false;
    		var table=document.getElementById('AuditDetails');
    		var allInputTags1 = table.getElementsByTagName('select');
    		for(var i = 0; i < allInputTags1.length; i++) {
    			if (allInputTags1[i].name.match("auditedSection$")) {
    				if(allInputTags1[i].value=='92E'){
    						audit92EFlag =true;
    						break;
    						}
    			     }
    			}
    		var othIncTaxActFlag = document.getElementsByName('itr7.partAGEN2.othIncTaxActFlag')[0].value;
    		if(audit92EFlag){
    			duedate = '15/02/2021';
    		}
    		else if(auditFlag=='Y'){
    				duedate = "15/02/2021";
    		}

    		var tab = document.getElementById('othIncTaxActTab');
    		var allInputTags = tab.getElementsByTagName('select');

    		if(othIncTaxActFlag == 'Y'){
    		for(var i = 0; i < allInputTags.length; i++) {
    			if (allInputTags[i].name.match("act$")) {
    				if(allInputTags[i].value!=''){
    					    				duedate = "15/02/2021";
    						}
    			     }
    			}
    		}

        return duedate;
        }
        function getDueDate234AForLessthanPlus1(){
        	var duedate = '11/01/2021'; // Modified due to the due date
											// extended for filing the return
        	//var duedate = '01/01/2021'; 
    		var auditFlag = document.getElementsByName('itr7.partAGEN2.liableSec44ABflg')[0].value;
    		var audit92EFlag = false;
    		var table=document.getElementById('AuditDetails');
    		var allInputTags1 = table.getElementsByTagName('select');
    		for(var i = 0; i < allInputTags1.length; i++) {
    			if (allInputTags1[i].name.match("auditedSection$")) {
    				if(allInputTags1[i].value=='92E'){
    						audit92EFlag =true;
    						break;
    						}
    			     }
    			}
    		var othIncTaxActFlag = document.getElementsByName('itr7.partAGEN2.othIncTaxActFlag')[0].value;
    		if(audit92EFlag){
    			duedate = '16/02/2021';
    		}
    		else if(auditFlag=='Y'){
    				duedate = "16/02/2021";
    		}

    		var tab = document.getElementById('othIncTaxActTab');
    		var allInputTags = tab.getElementsByTagName('select');

    		if(othIncTaxActFlag == 'Y'){
    		for(var i = 0; i < allInputTags.length; i++) {
    			if (allInputTags[i].name.match("act$")) {
    				if(allInputTags[i].value!=''){
    					    				duedate = "16/02/2021";
    						}
    			     }
    			}
    		}

        return duedate;
        }

        function getDueDate234ACompany(){
    		var duedate = '31/10/2020';
    		var auditFlag = document.getElementsByName('itr7.partAGEN2.liableSec44ABflg')[0].value;
    		var othIncTaxActFlag = document.getElementsByName('itr7.partAGEN2.othIncTaxActFlag')[0].value;
    		var audit92EFlag = false;
    		var table=document.getElementById('AuditDetails');
    		var allInputTags1 = table.getElementsByTagName('select');
    		for(var i = 0; i < allInputTags1.length; i++) {
    			if (allInputTags1[i].name.match("auditedSection$")) {
    				if(allInputTags1[i].value=='92E'){
    						audit92EFlag =true;
    						break;
    						}
    			     }
    			}
    		if(audit92EFlag){
    			duedate = '30/11/2020';
    		}
    		else if(auditFlag=='Y'){
    	    				duedate = "31/10/2020";
    		}

    		var tab = document.getElementById('othIncTaxActTab');
    		var allInputTags = tab.getElementsByTagName('select');

    		if(othIncTaxActFlag == 'Y'){
    		for(var i = 0; i < allInputTags.length; i++) {
    			if (allInputTags[i].name.match("act$")) {
    				if(allInputTags[i].value!=''){
    						duedate = "31/10/2020";
    						}
    			     }
    			}
    		}
        return duedate;
        }

function getDueDate234ACompanyAuditFlag(){
	
	var auditFlag234ACompany = false;
	var auditFlag = document.getElementsByName('itr7.partAGEN2.liableSec44ABflg')[0].value;
	var othIncTaxActFlag = document.getElementsByName('itr7.partAGEN2.othIncTaxActFlag')[0].value;
	var audit92EFlag = false;
	/*var table=document.getElementById('AuditDetails');
	var allInputTags1 = tab.getElementsByTagName('select');
	for(var i = 0; i < allInputTags1.length; i++) {
		if (allInputTags1[i].name.match("auditedSection$")) {
			if(allInputTags1[i].value=='92E'){
					audit92EFlag =true;
					auditFlag234ACompany= true;
					break;
					}
		     }
		}*/
	if(audit92EFlag){
		auditFlag234ACompany= true;
	}
	else if(auditFlag=='Y'){
		auditFlag234ACompany= true;
	}

	var tab = document.getElementById('othIncTaxActTab');
	var allInputTags = tab.getElementsByTagName('select');

	if(othIncTaxActFlag == 'Y'){
	for(var i = 0; i < allInputTags.length; i++) {
		if (allInputTags[i].name.match("act$")) {
			if(allInputTags[i].value!=''){
				auditFlag234ACompany= true;
					}
		     }
		}
	}
	var table=document.getElementById('AuditDetails');
	var allInputTags1 = tab.getElementsByTagName('select');
	for(var i = 0; i < allInputTags1.length; i++) {
		if (allInputTags1[i].name.match("auditedSection$")) {
			if(allInputTags1[i].value=='92E'){
					audit92EFlag =true;
					auditFlag234ACompany= true;
					break;
					}
		     }
		}
return auditFlag234ACompany;
}



	function calculate234Intrst(advanceTax){
                var status = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value;
                var subStatus = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0].value;
                var intrst234ATemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234A')[0];
                var intrst234BTemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234B')[0];
                var intrst234CTemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234C')[0];
                var intrst234FTemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234F')[0];


                if(status=='7'){
                    calculate234IntrstForCompany(advanceTax);
                    return;
                }

        var TCSToDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.tcs')[0];
		TCSToDisplay.value = coalesce(TCSToDisplay.value);
		var TCS = TCSToDisplay.value;

		var TDSToDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.tds')[0];
		TDSToDisplay.value = coalesce(TDSToDisplay.value);
		var tdsAndTcs = parseInt(TDSToDisplay.value,10)+parseInt(TCS,10);



		var balTaxPayable = document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.netTaxLiability')[0].value;
		balTaxPayable = coalesce(balTaxPayable);
		// var balTaxPayable = balTaxPayable;
		var tempIntrst234APrinciple = eval(parseInt(balTaxPayable, 10) - parseInt(advanceTax, 10) - parseInt(tdsAndTcs, 10));
		if(tempIntrst234APrinciple> parseInt('100000', 10))
		{
			var advanceTax234A = calculateAdvancedTax234A(getDueDate234A());
		}
		else
		{
			// extended for filing the return
			//var advanceTax234A = calculateAdvancedTax234A(Int_234A_IF_NO_dt);
			var advanceTax234A = calculateAdvancedTax234A(getDueDate234AForLessthan());
			
		}
		var intrst234Aprinciple	;
		if(parseInt(balTaxPayable ,10) - parseInt(advanceTax ,10) - parseInt(advanceTax234A ,10) - parseInt(tdsAndTcs ,10) < 0){
			intrst234Aprinciple = parseInt('0' ,10);
			}else {
			intrst234Aprinciple = parseInt(balTaxPayable ,10) - parseInt(advanceTax ,10) - parseInt(advanceTax234A ,10) - parseInt(tdsAndTcs ,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('itr7.verification.date')[0].value;
		if(isFirstDateBeforeOrEqual(currentDate,getCurDate())) {
			currentDate = getCurDate();
		}

                var filingType = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[0].value;

                var actualDate = currentDate;
                var originalFilingDate = document.getElementsByName('itr7.partAGEN1.filingStatus.origRetFiledDate')[0].value;
               
                // var returnType=document.getElementsByName('itr7.partAGEN1.filingStatus.returnType')[0].value;
                if((filingType=='17'|| filingType=='18' || filingType=='19') && originalFilingDate !=undefined && originalFilingDate!=null && originalFilingDate!=''){
                	currentDate = originalFilingDate;
                }
                if(parseInt(tempIntrst234APrinciple,10)> parseInt('100000', 10))
        		{
        			var duedate = getDueDate234A();
        			var MonthsAfterDueDate =  calcNoOfMonths(currentDate , duedate);
        			MonthsAfterDueDate = MonthsAfterDueDate - 1;
        		}
        	else
        	{
        		//var duedate=Int_start_date_234A;
        		//var duedate=getDueDate234AForLessthan();
        		var duedate = getDueDate234AForLessthanPlus1();
        		var MonthsAfterDueDate =  calcNoOfMonths(currentDate , duedate);
        		MonthsAfterDueDate = MonthsAfterDueDate;
        		
        	}


        		var intrst234A = zeroOrMore(eval(parseInt(intrst234Aprinciple,10) * parseFloat('0.01') * parseInt(MonthsAfterDueDate)));
              
             // ===============Interest234F calculation=======================
                setSecRespOnSave();
                var intrst234F = parseInt('0',10);
        		var filerType=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value;
               
        		var auditFlag= getDueDate234ACompanyAuditFlag();
                
        		if (filingType=='11' || filingType=='12' || filingType=='17' ||filingType=='18'||filingType=='13'  ){
         			var totInc = getAmt('itr7.partBTI.totalIncome');
         			var totalOtherInc=getAmt('itr7.partBTI.voluntaryContributions.totIncFromVC')+getAmt('itr7.partBTI.tiDeductions.totalDeductions')+getAmt('itr7.partBTI.exemptionUs10_21')+getAmt('itr7.partBTI.exemptionOtherthenUs10')+getAmt('itr7.partBTI.exemptionUs10_23C');
         		 	var GtInc = getAmt('itr7.partBTI.grossTotalIncome')+totalOtherInc;
        			//var currentDate234F = Int_234A_IF_NO_dt; // Modified due
																// to the due
																// date extended
																// for filing
																// the return
         		 	var currentDate234F = '11/01/2021';
         		 	alert('currentDate' +currentDate234F);
         		 	var subFilerType=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0].value;
         		if(document.getElementsByName('itr7.partBTTI.assetOutIndiaFlag')[0].value=='YES'){
         				if(checkFirstDateBefore(currentDate234F , currentDate)&& checkFirstDateBefore( currentDate , '31/12/2020' )){
        					if(parseInt(totInc,10)<= eval('500000')){
        						intrst234F= '1000';
        					}
        					else if(parseInt(totInc,10)> eval('500000')){
        						intrst234F= '5000';
        					}
        				}
        				else if(auditFlag && checkFirstDateBefore('16/02/2021', currentDate)){
        					if(parseInt(totInc,10)<= eval('500000')){
        						intrst234F= '1000';
        					}
        					else if(parseInt(totInc,10)> eval('500000')){
        						intrst234F= '10000';
        					}
        				}
        				else if(auditFlag== false && checkFirstDateBefore('11/01/2021', currentDate)){
        					if(parseInt(totInc,10)<= eval('500000')){
        						intrst234F= '1000';
        					}
        					else if(parseInt(totInc,10)> eval('500000')){
        						intrst234F= '10000';
        					}
        				}
        				
        				else{
        					intrst234F= parseInt('0',10);
        				}
        	}
        	else if(document.getElementsByName('itr7.partBTTI.assetOutIndiaFlag')[0].value=='NO'){
        		if(document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value=='OTH'&& (filerType!='3'&&filerType!='7')){
        			intrst234F = parseInt('0',10);
        		}
        		else{
        		if(filerType=='5'&&(subFilerType=='5i'||subFilerType=='5vii'||subFilerType=='5v')&&GtInc>250000){
        			if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '5000';
        				}
        			}
        			else if(auditFlag && checkFirstDateBefore('16/02/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else if(auditFlag == false && checkFirstDateBefore('11/01/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			
        			else{
        				intrst234F= parseInt('0',10);
        			}
        		}
        		if(filerType=='6'&&GtInc>250000){
        			
        			if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '5000';
        				}
        			}
        			else if(auditFlag && checkFirstDateBefore('16/02/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else if(auditFlag == false && checkFirstDateBefore('11/01/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			
        			else{
        				intrst234F= parseInt('0',10);
        			}
        		}
        		if(filerType=='4'&&GtInc>0){
        			
        			if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '5000';
        				}
        			}
        			else if(auditFlag && checkFirstDateBefore('16/02/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else if(auditFlag == false && checkFirstDateBefore('11/01/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else{
        				intrst234F= parseInt('0',10);
        			}
        		}
        		else{
        			if(!((filerType=='5'&&(subFilerType=='5i'||subFilerType=='5vii'))||((filerType=='6')||(filerType=='4')))){
        				if((subFilerType=='5vi'&&GtInc>0)||filerType=='7'){
        		if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '5000';
        				}
        			}
        			else if(auditFlag && checkFirstDateBefore('16/02/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else if(auditFlag == false && checkFirstDateBefore('11/01/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else{
        				alert('type4');
        				intrst234F= parseInt('0',10);
        			}
        	     				}

        		}

        		}
        	}
        	}
        	else{
        		alert('check3');
        		if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '5000';
        				}
        			}
        			else if(auditFlag && checkFirstDateBefore('16/02/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else if(auditFlag == false && checkFirstDateBefore('11/01/2021', currentDate)){
        				if(parseInt(totInc,10)<= eval('500000')){
        					intrst234F= '1000';
        				}
        				else if(parseInt(totInc,10)> eval('500000')){
        					intrst234F= '10000';
        				}
        			}
        			else{
        				alert('type5');
        				intrst234F= parseInt('0',10);
        			}
        		}
        	}

                var intrst234B = parseInt('0' ,10);
		var	intrst234C = parseInt('0' ,10);

		var slab1 = parseInt('0' ,10);
		var slab2 = parseInt('0' ,10);
		var slab3 = parseInt('0' ,10);
		var slab4 = parseInt('0' ,10);
		var slab5 = parseInt('0' ,10);

		var state = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.stateCode')[0];

			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 , 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 , slab4_end_date ) ){
						slab4 = eval(parseInt(slab4 ,10) + parseInt(isNVL(allInputTags[i+2].value) ,10));
					}

					else if(checkFirstDateBefore(slab5_start_date , allInputTags[i].value) && checkFirstDateBefore( allInputTags[i].value , slab5_end_date ) ){
						slab5 = eval(parseInt(slab5 ,10) + parseInt(isNVL(allInputTags[i+2].value) ,10));
					}



				}
			}


		var intrst234Ci = parseInt('0' ,10);
		var intrst234Cii = parseInt('0' ,10);
		var intrst234Ciii = parseInt('0' ,10);
		var intrst234Civ = parseInt('0' ,10);
		var intrst234Cv = parseInt('0' ,10);


		var advanceTaxToDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.advanceTax')[0];  advanceTaxToDisplay.value = coalesce(advanceTaxToDisplay.value);

		var SATtoDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.selfAssessmentTax')[0];
		SATtoDisplay.value = coalesce(SATtoDisplay.value);


		if(( eval(parseInt(balTaxPayable ,10) - parseInt(tdsAndTcs ,10)) >=  parseInt('10000',10))){

			var taxon15BDA0 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6'),10)));
			var taxon15BDA1 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/9'),10)+parseInt(taxon15BDA0,10)));
			var taxon15BDA2 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/12'),10)+parseInt(taxon15BDA1,10)));
			var taxon15BDA3 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/3'),10)+parseInt(taxon15BDA2,10)));
			var taxon15BDA4 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.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 surchargeonTI = document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.surchargeonTI')[0].value;
			var educationCess = document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.educationCess')[0].value;

			var taxPayableOnTotInc = document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')[0].value;
			var splRateIncTax7 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].splRateIncTax')[0].value;

			var tempDiff = eval(taxPayableOnTotInc - splRateIncTax7);

			var totalBBDAtax = eval(parseInt(taxon15BDA3,10)+parseInt(taxon15BDA4,10));

			var totalBBDAtax1 = coalesce((totalBBDAtax * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var totalBBDAtax2 = (totalBBDAtax1 + totalBBDAtax) * 0.04;

			totalBBDAtax = eval(totalBBDAtax + totalBBDAtax1 + totalBBDAtax2);


			var taxon15BDA0sc = coalesce((taxon15BDA0 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxon15BDA0c = (taxon15BDA0sc + taxon15BDA0) * 0.04;

			taxon15BDA0 = eval(taxon15BDA0 + taxon15BDA0sc + taxon15BDA0c);


			var taxon15BDA1sc = coalesce((taxon15BDA1 * parseInt(surchargeonTI ,10)) / tempDiff );

			var taxon15BDA1c = (taxon15BDA1sc + taxon15BDA1) * 0.04;

			taxon15BDA1 = eval(taxon15BDA1 + taxon15BDA1sc + taxon15BDA1c);


			var taxon15BDA2sc = coalesce((taxon15BDA2 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxon15BDA2c = (taxon15BDA2sc + taxon15BDA2) * 0.04;

			taxon15BDA2 = eval(taxon15BDA2 + taxon15BDA2sc + taxon15BDA2c);


			var taxon15BDA3sc = coalesce((taxon15BDA3 * parseInt(surchargeonTI ,10)) / tempDiff );

			var taxon15BDA3c = (taxon15BDA3sc + taxon15BDA3) * 0.04;

			taxon15BDA3 = eval(taxon15BDA3 + taxon15BDA3sc + taxon15BDA3c);


			var taxon15BDA4sc = coalesce((taxon15BDA4 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxon15BDA4c = (taxon15BDA4sc + taxon15BDA4) * 0.04;

			taxon15BDA4 = eval(taxon15BDA4 + taxon15BDA4sc + taxon15BDA4c);

			var taxonLottery0 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6'),10)));
			var taxonLottery1 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/9'),10)+parseInt(taxonLottery0,10)));
			var taxonLottery2 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/12'),10)+parseInt(taxonLottery1,10)));
			var taxonLottery3 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/3'),10)+parseInt(taxonLottery2,10)));
			var taxonLottery4 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.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));



			var totalLotteryTax1 = coalesce((totalLotteryTax * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var totalLotteryTax2 = (totalLotteryTax1 + totalLotteryTax) * 0.04;

			totalLotteryTax = eval(totalLotteryTax + totalLotteryTax1 + totalLotteryTax2);


			var taxonLottery0sc = coalesce((taxonLottery0 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxonLottery0c = (taxonLottery0sc + taxonLottery0) * 0.04;

			taxonLottery0 = eval(taxonLottery0 + taxonLottery0sc + taxonLottery0c);


			var taxonLottery1sc = coalesce((taxonLottery1 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxonLottery1c = (taxonLottery1sc + taxonLottery1) * 0.04;

			taxonLottery1 = eval(taxonLottery1 + taxonLottery1sc + taxonLottery1c);


			var taxonLottery2sc =coalesce( (taxonLottery2 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxonLottery2c = (taxonLottery2sc + taxonLottery2) * 0.04;

			taxonLottery2 = eval(taxonLottery2 + taxonLottery2sc + taxonLottery2c);


			var taxonLottery3sc = coalesce((taxonLottery3 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxonLottery3c = (taxonLottery3sc + taxonLottery3) * 0.04;

			taxonLottery3 = eval(taxonLottery3 + taxonLottery3sc + taxonLottery3c);


			var taxonLottery4sc = coalesce((taxonLottery4 * parseInt(surchargeonTI ,10)) / tempDiff) ;

			var taxonLottery4c = (taxonLottery4sc + taxonLottery4) * 0.04;

			taxonLottery4 = eval(taxonLottery4 + taxonLottery4sc + taxonLottery4c);

			// balTaxPayable= eval(parseInt(balTaxPayable,10) -
			// parseInt(totalBBDAtax ,10) - parseInt(totalLotteryTax ,10));
			var balTaxPayable234C = eval(parseInt(balTaxPayable,10) - parseInt(totalBBDAtax ,10) - parseInt(totalLotteryTax ,10));

			if(parseInt(slab1 ,10) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA0 ,10) + parseInt(taxonLottery0 ,10) - parseInt(tdsAndTcs ,10)) * parseFloat('0.12'))){
				var tempintrst234Ci = (((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA0 ,10) + parseInt(taxonLottery0 ,10)  - parseInt(tdsAndTcs ,10) ) * parseFloat('0.15')) - 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(slab1 ,10) + parseInt(slab2 ,10)) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA1 ,10) + parseInt(taxonLottery1 ,10)  - parseInt(tdsAndTcs ,10)) * parseFloat('0.36') )){
				var tempintrst234Cii = (((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA1 ,10) + parseInt(taxonLottery1 ,10)  - parseInt(tdsAndTcs ,10)) * parseFloat('0.45') ) -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) ;

			}

			if(eval(parseInt(slab1 ,10) + parseInt(slab2 ,10) + parseInt(slab3 ,10)) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA2 ,10) + parseInt(taxonLottery2 ,10)  - parseInt(tdsAndTcs ,10)) * parseFloat('0.75'))){
				var tempintrst234Ciii = (((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA2 ,10) + parseInt(taxonLottery2 ,10)  - parseInt(tdsAndTcs ,10))* parseFloat('0.75')) - 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('3' ,10) ;
			}
			if(eval(parseInt(slab1 ,10) + parseInt(slab2 ,10) + parseInt(slab3 ,10)+ parseInt(slab4 ,10)) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA3 ,10) + parseInt(taxonLottery3 ,10)  - parseInt(tdsAndTcs ,10)) * parseInt('1' ,10))){
				var tempintrst234Civ = ((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA3 ,10) + parseInt(taxonLottery3 ,10)  - parseInt(tdsAndTcs ,10)) - parseInt(slab1 ,10)- parseInt(slab2 ,10) - parseInt(slab3 ,10)- parseInt(slab4 ,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) ;
			}

			var balPayableTDSTCS = eval(parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA3 ,10) + parseInt(taxonLottery3 ,10));

			if(balPayableTDSTCS > parseInt(tdsAndTcs ,10)){
				tdsAndTcs.value = '0';
			}else{
				tdsAndTcs.value = eval(parseInt(tdsAndTcs ,10) - balPayableTDSTCS);
			}

			if(eval(parseInt(slab5 ,10)) < eval((parseInt(taxon15BDA4 ,10) + parseInt(taxonLottery4 ,10) - parseInt(tdsAndTcs ,10)) * parseInt('1' ,10))){
				var tempintrst234Cv = ((parseInt(taxon15BDA4 ,10) + parseInt(taxonLottery4 ,10) - parseInt(tdsAndTcs ,10)) - parseInt(slab5 ,10));

				if(parseInt(tempintrst234Cv,10) > 100){
					tempintrst234Cv= Math.floor(parseInt(tempintrst234Cv,10)/100)*parseInt('100' ,10);
				}
				intrst234Cv=parseInt(tempintrst234Cv,10)* parseFloat('0.01') * parseInt('1' ,10) ;
			}

		}
		else {
			 intrst234Ci = parseInt('0',10);
			 intrst234Cii = parseInt('0',10);
			 intrst234Ciii = parseInt('0',10);
			 intrst234Civ = parseInt('0',10);
			 intrst234Cv = parseInt('0',10);
		}

		intrst234C = eval(parseInt(intrst234Ci ,10) + parseInt(intrst234Cii ,10) + parseInt(intrst234Ciii ,10)+ parseInt(intrst234Civ ,10) + parseInt(intrst234Cv ,10));


		// ===============Interest234B calculation=======================

		var intrst234Bprinciple;
		var intrst234Bi=parseInt('0',10);
		var earliestSelfAsspaidDate=parseInt('0',10);
		var noOfMonthsTillSelfasst= parseInt('0',10);
		if(parseInt(balTaxPayable,10) - parseInt(tdsAndTcs,10) >= parseInt('10000' ,10)) {
			if(parseInt(advanceTax,10) < ((parseInt(balTaxPayable,10) - parseInt(tdsAndTcs,10)) * parseFloat('0.90'))) {

				intrst234Bprinciple = (parseInt(balTaxPayable ,10) - parseInt(advanceTax ,10) - parseInt(tdsAndTcs,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);

				var tab234B = document.getElementById('scheduleIT');
				var allInputTags234B = tab234B.getElementsByTagName('input');
				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++;
						}
					}
				}
			}

				// to sort all self assesment tax values according to date
				var selfAsspaidDatesSorted=new Array();
				var selfAsspaidAmtsSorted=new Array();

				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');
				}

				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 selfAsspart=parseInt('0',10);
				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, 10)
								- parseInt(advanceTax, 10)
								- parseInt(tdsAndTcs, 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
						var intrst234bflag=false;
						if(checkFirstDateBefore('01/04/2020',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);
		}

        if(intrst234ATemp.old !=  intrst234A){
        	intrst234ATemp.old = intrst234A;
        	intrst234ATemp.value = Math.round(intrst234A);
    	}
        if(intrst234BTemp.old !=  intrst234B){
        	intrst234BTemp.old = intrst234B;
        	intrst234BTemp.value = Math.round(intrst234B);
    	}
        if(intrst234CTemp.old !=  intrst234C){
        	intrst234CTemp.old = intrst234C;
        	intrst234CTemp.value = Math.round(intrst234C);
    	}
        if(intrst234FTemp.old !=  intrst234F){
        	intrst234FTemp.old = intrst234F;
        	intrst234FTemp.value = Math.round(intrst234F);
    	}


	}


	function calculate234IntrstForCompany(advanceTax){
		alert('testing12344');
		var Int_234A_IF_NO_dt='15/02/2021';

		 var intrst234ATemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234A')[0];
        var intrst234BTemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234B')[0];
        var intrst234CTemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234C')[0];
        var intrst234FTemp =  document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.intrstPay.intrstPayUs234F')[0];

		 var TCSToDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.tcs')[0];
		TCSToDisplay.value = coalesce(TCSToDisplay.value);
		var TCS = TCSToDisplay.value;

		var TDSToDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.tds')[0];
		TDSToDisplay.value = coalesce(TDSToDisplay.value);
		var tdsAndTcs = parseInt(TDSToDisplay.value,10)+parseInt(TCS,10);

		var balTaxPayable = document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.netTaxLiability')[0].value;
		balTaxPayable = coalesce(balTaxPayable);
	
		var tempIntrst234APrinciple = parseInt(balTaxPayable, 10) - parseInt(advanceTax, 10)
		- parseInt(tdsAndTcs, 10);
		if(tempIntrst234APrinciple> parseInt('100000', 10))
		{
			var advanceTax234A = calculateAdvancedTax234A(getDueDate234ACompany());
		}
		else
		{
			alert('testing0000');
			var advanceTax234A = calculateAdvancedTax234A(Int_234A_IF_NO_dt);
			//var advanceTax234A = calculateAdvancedTax234A(getDueDate234ACompanyForLessthan());
		}
		var intrst234Aprinciple	;
		if(parseInt(balTaxPayable ,10) - parseInt(advanceTax ,10)- parseInt(advanceTax234A ,10) - parseInt(tdsAndTcs ,10) < 0){
			intrst234Aprinciple = parseInt('0' ,10);
			}else {

			intrst234Aprinciple = parseInt(balTaxPayable ,10) - parseInt(advanceTax ,10) - parseInt(advanceTax234A ,10) - parseInt(tdsAndTcs ,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('itr7.verification.date')[0].value;
		if(isFirstDateBeforeOrEqual(currentDate,getCurDate())) {
			currentDate = getCurDate();
		}
               var filingType = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[0].value;

               var actualDate = currentDate;
               var originalFilingDate = document.getElementsByName('itr7.partAGEN1.filingStatus.origRetFiledDate')[0].value;
              // var returnType=document.getElementsByName('itr7.partAGEN1.filingStatus.returnType')[0].value;

               if((filingType=='17' ||  filingType=='18' || filingType=='19') && originalFilingDate !=undefined && originalFilingDate!=null && originalFilingDate!=''){
			currentDate = originalFilingDate;
		}
               if(parseInt(tempIntrst234APrinciple,10)> parseInt('100000', 10))
       		{
       			//var duedate = getDueDate234A();
            	  
       			var duedate = getDueDate234ACompanyAudit();
       			var MonthsAfterDueDate =  calcNoOfMonths(currentDate , duedate);
       			MonthsAfterDueDate = MonthsAfterDueDate - 1;
       		}
       	else
       	{
       		//var duedate=Int_start_date_234A;
       		alert('dueeeeedateee1'+duedate);
       		//var duedate= getDueDate234AForLessthan();
       		var duedate= '16/02/2021';
       		alert('dueeeeedateee2'+duedate);
       		var MonthsAfterDueDate =  calcNoOfMonths(currentDate , duedate);
       		MonthsAfterDueDate = MonthsAfterDueDate;
       	}


       		var intrst234A = zeroOrMore(eval(parseInt(intrst234Aprinciple,10) * parseFloat('0.01') * parseInt(MonthsAfterDueDate)));

        
       		 // ===============Interest234F calculation=======================
		var intrst234F = parseInt('0',10);
		var filerType=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value;
		
		if (filingType=='11' || filingType=='12' || filingType=='17' ||filingType=='18' ||filingType=='13' ){
			var totInc = document.getElementsByName('itr7.partBTI.totalIncome')[0].value;
			var totalOtherInc=getAmt('itr7.partBTI.voluntaryContributions.totIncFromVC')+getAmt('itr7.partBTI.tiDeductions.totalDeductions')+getAmt('itr7.partBTI.exemptionUs10_21')+getAmt('itr7.partBTI.exemptionOtherthenUs10')+getAmt('itr7.partBTI.exemptionUs10_23C');
			var GtInc = getAmt('itr7.partBTI.grossTotalIncome')+totalOtherInc;
			var currentDate234F = Int_234A_IF_NO_dt; // Modified due to the due date extended for filing the return
			//var currentDate234F = '01/01/2021';
			alert('checkkkkkkkk'+Int_234A_IF_NO_dt);
			var subFilerType=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0].value;

		if(document.getElementsByName('itr7.partBTTI.assetOutIndiaFlag')[0].value=='YES'){
   			if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
   					if(parseInt(totInc,10)<= eval('500000')){
   						intrst234F= '1000';
   					}
   					else if(parseInt(totInc,10)> eval('500000')){
   						intrst234F= '5000';
   					}
   				}
   				else if(checkFirstDateBefore('16/02/2021', currentDate)){
   					if(parseInt(totInc,10)<= eval('500000')){
   						intrst234F= '1000';
   					}
   					else if(parseInt(totInc,10)> eval('500000')){
   						intrst234F= '10000';
   					}
   				}
   				else{
   					intrst234F= parseInt('0',10);
   				}
	}
	else if(document.getElementsByName('itr7.partBTTI.assetOutIndiaFlag')[0].value=='NO'){
		if(document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value=='OTH'&& (filerType!='3'&&filerType!='7')){
			intrst234F = parseInt('0',10);
		}
		else{


		if(filerType=='5'&&(subFilerType=='5i'||subFilerType=='5vii'||subFilerType=='5v')&&GtInc>250000){
				if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
					if(parseInt(totInc,10)<= eval('500000')){
						intrst234F= '1000';
					}
					else if(parseInt(totInc,10)> eval('500000')){
						intrst234F= '5000';
					}
				}
				else if(checkFirstDateBefore('16/02/2021', currentDate)){
					if(parseInt(totInc,10)<= eval('500000')){
						intrst234F= '1000';
					}
					else if(parseInt(totInc,10)> eval('500000')){
						intrst234F= '10000';
					}
				}
				else{
					intrst234F= parseInt('0',10);
				}
		}
		if(filerType=='6'&&GtInc>250000){
			if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
				if(parseInt(totInc,10)<= eval('500000')){
					intrst234F= '1000';
				}
				else if(parseInt(totInc,10)> eval('500000')){
					intrst234F= '5000';
				}
			}
			else if(checkFirstDateBefore('16/02/2021', currentDate)){
				if(parseInt(totInc,10)<= eval('500000')){
					intrst234F= '1000';
				}
				else if(parseInt(totInc,10)> eval('500000')){
					intrst234F= '10000';
				}
			}
			else{
				intrst234F= parseInt('0',10);
			}
		}
		if(filerType=='4'&&GtInc>0){
			if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
				if(parseInt(totInc,10)<= eval('500000')){
					intrst234F= '1000';
				}
				else if(parseInt(totInc,10)> eval('500000')){
					intrst234F= '5000';
				}
			}
			else if(checkFirstDateBefore('16/02/2021', currentDate)){
				if(parseInt(totInc,10)<= eval('500000')){
					intrst234F= '1000';
				}
				else if(parseInt(totInc,10)> eval('500000')){
					intrst234F= '10000';
				}
			}
			else{
				intrst234F= parseInt('0',10);
			}
		}
		else{
			if(!((filerType=='5'&&(subFilerType=='5i'||subFilerType=='5vii'))||((filerType=='6')||(filerType=='4')))){
				if((subFilerType=='5vi'&&GtInc>0)||filerType=='7'){
					alert('filingType'+filerType+subFilerType);
		     if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
				if(parseInt(totInc,10)<= eval('500000')){
					intrst234F= '1000';
				}
				else if(parseInt(totInc,10)> eval('500000')){
					intrst234F= '5000';
				}
			}
			else if(checkFirstDateBefore('16/02/2021', currentDate)){
				if(parseInt(totInc,10)<= eval('500000')){
					intrst234F= '1000';
				}
				else if(parseInt(totInc,10)> eval('500000')){
					intrst234F= '10000';
				}
			}
			else{
				intrst234F= parseInt('0',10);
			}
		}
		}

		}
	}
	}
	else{
		if(checkFirstDateBefore(currentDate234F , currentDate) && checkFirstDateBefore( currentDate , '31/12/2020' )){
			if(parseInt(totInc,10)<= eval('500000')){
				intrst234F= '1000';
			}
			else if(parseInt(totInc,10)> eval('500000')){
				intrst234F= '5000';
			}
		}
		else if(checkFirstDateBefore('16/02/2021', currentDate)){
			if(parseInt(totInc,10)<= eval('500000')){
				intrst234F= '1000';
			}
			else if(parseInt(totInc,10)> eval('500000')){
				intrst234F= '10000';
			}
		}
		else{
			intrst234F= parseInt('0',10);
		}

		}
		
	}
       var intrst234B = parseInt('0' ,10);
		var	intrst234C = parseInt('0' ,10);

		var slab1 = parseInt('0' ,10);
		var slab2 = parseInt('0' ,10);
		var slab3 = parseInt('0' ,10);
		var slab4 = parseInt('0' ,10);
		var slab5 = parseInt('0' ,10);

		var state = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.stateCode')[0];

			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 , slab1_end_date ) ){
						slab1 = eval(parseInt(slab1 ,10) + parseInt(isNVL(allInputTags[i+2].value) ,10));
					}
					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 , slab4_end_date ) ){
						slab4 = eval(parseInt(slab4 ,10) + parseInt(isNVL(allInputTags[i+2].value) ,10));
					}
					else if(checkFirstDateBefore(slab5_start_date , allInputTags[i].value) && checkFirstDateBefore( allInputTags[i].value , slab5_end_date ) ){
						slab5 = eval(parseInt(slab5 ,10) + parseInt(isNVL(allInputTags[i+2].value) ,10));
					}
				}
			}


		var intrst234Ci = parseInt('0' ,10);
		var intrst234Cii = parseInt('0' ,10);
		var intrst234Ciii = parseInt('0' ,10);
		var intrst234Civ = parseInt('0' ,10);
		var intrst234Cv = parseInt('0' ,10);
		
		var advanceTaxToDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.advanceTax')[0];  advanceTaxToDisplay.value = coalesce(advanceTaxToDisplay.value);

		var SATtoDisplay = document.getElementsByName('itr7.partBTTI.taxPaid.taxesPaid.selfAssessmentTax')[0];
		SATtoDisplay.value = coalesce(SATtoDisplay.value);


		if(( eval(parseInt(balTaxPayable ,10) - parseInt(tdsAndTcs ,10)) >=  parseInt('10000',10))){
			
			var taxon15BDA0 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6'),10)));
			var taxon15BDA1 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/9'),10)+parseInt(taxon15BDA0,10)));
			var taxon15BDA2 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/12'),10)+parseInt(taxon15BDA1,10)));
			var taxon15BDA3 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/3'),10)+parseInt(taxon15BDA2,10)));
			var taxon15BDA4 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.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 surchargeonTI = document.getElementsByName('partBTTI.computationOfTaxLiability.taxPayableOnTI.surchargeonTI')[0].value;
			var educationCess = document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.educationCess')[0].value;
			
			var taxPayableOnTotInc = document.getElementsByName('itr7.partBTTI.computationOfTaxLiability.taxPayableOnTI.taxPayableOnTotInc')[0].value;
			var splRateIncTax7 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].splRateIncTax')[0].value;
			
			var tempDiff = eval(taxPayableOnTotInc - splRateIncTax7); 	

			var totalBBDAtax = eval(parseInt(taxon15BDA3,10)+parseInt(taxon15BDA4,10));
			
			var totalBBDAtax1 = (totalBBDAtax * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var totalBBDAtax2 = (totalBBDAtax1 + totalBBDAtax) * 0.04;
			
			totalBBDAtax = eval(totalBBDAtax + totalBBDAtax1 + totalBBDAtax2);		
			
			
			var taxon15BDA0sc = (taxon15BDA0 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxon15BDA0c = (taxon15BDA0sc + taxon15BDA0) * 0.04;
			
			taxon15BDA0 = eval(taxon15BDA0 + taxon15BDA0sc + taxon15BDA0c);
		
			
			var taxon15BDA1sc = (taxon15BDA1 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxon15BDA1c = (taxon15BDA1sc + taxon15BDA1) * 0.04;
			
			taxon15BDA1 = eval(taxon15BDA1 + taxon15BDA1sc + taxon15BDA1c);			
			
			
			var taxon15BDA2sc = (taxon15BDA2 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxon15BDA2c = (taxon15BDA2sc + taxon15BDA2) * 0.04;
			
			taxon15BDA2 = eval(taxon15BDA2 + taxon15BDA2sc + taxon15BDA2c);
			
			
			var taxon15BDA3sc = (taxon15BDA3 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxon15BDA3c = (taxon15BDA3sc + taxon15BDA3) * 0.04;
			
			taxon15BDA3 = eval(taxon15BDA3 + taxon15BDA3sc + taxon15BDA3c);
			
			
			var taxon15BDA4sc = (taxon15BDA4 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxon15BDA4c = (taxon15BDA4sc + taxon15BDA4) * 0.04;
			
			taxon15BDA4 = eval(taxon15BDA4 + taxon15BDA4sc + taxon15BDA4c);

			var taxonLottery0 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6'),10)));
			var taxonLottery1 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/9'),10)+parseInt(taxonLottery0,10)));
			var taxonLottery2 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/12'),10)+parseInt(taxonLottery1,10)));
			var taxonLottery3 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/3'),10)+parseInt(taxonLottery2,10)));
			var taxonLottery4 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.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));

					
			
			var totalLotteryTax1 = (totalLotteryTax * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var totalLotteryTax2 = (totalLotteryTax1 + totalLotteryTax) * 0.04;
			
			totalLotteryTax = eval(totalLotteryTax + totalLotteryTax1 + totalLotteryTax2);		
			
			
			var taxonLottery0sc = (taxonLottery0 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxonLottery0c = (taxonLottery0sc + taxonLottery0) * 0.04;
			
			taxonLottery0 = eval(taxonLottery0 + taxonLottery0sc + taxonLottery0c);
		
			
			var taxonLottery1sc = (taxonLottery1 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxonLottery1c = (taxonLottery1sc + taxonLottery1) * 0.04;
			
			taxonLottery1 = eval(taxonLottery1 + taxonLottery1sc + taxonLottery1c);			
			
			
			var taxonLottery2sc = (taxonLottery2 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxonLottery2c = (taxonLottery2sc + taxonLottery2) * 0.04;
			
			taxonLottery2 = eval(taxonLottery2 + taxonLottery2sc + taxonLottery2c);
			
			
			var taxonLottery3sc = (taxonLottery3 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxonLottery3c = (taxonLottery3sc + taxonLottery3) * 0.04;
			
			taxonLottery3 = eval(taxonLottery3 + taxonLottery3sc + taxonLottery3c);
			
			
			var taxonLottery4sc = (taxonLottery4 * parseInt(surchargeonTI ,10)) / tempDiff ;
			
			var taxonLottery4c = (taxonLottery4sc + taxonLottery4) * 0.04;
			
			taxonLottery4 = eval(taxonLottery4 + taxonLottery4sc + taxonLottery4c);

			var balTaxPayable234C = eval(parseInt(balTaxPayable,10) - parseInt(totalBBDAtax ,10) - parseInt(totalLotteryTax ,10));

			if(parseInt(slab1 ,10) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA0 ,10) + parseInt(taxonLottery0 ,10) - parseInt(tdsAndTcs ,10)) * parseFloat('0.12'))){
				var tempintrst234Ci = (((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA0 ,10) + parseInt(taxonLottery0 ,10)  - parseInt(tdsAndTcs ,10) ) * parseFloat('0.15')) - 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(slab1 ,10) + parseInt(slab2 ,10)) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA1 ,10) + parseInt(taxonLottery1 ,10)  - parseInt(tdsAndTcs ,10)) * parseFloat('0.36') )){
				var tempintrst234Cii = (((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA1 ,10) + parseInt(taxonLottery1 ,10)  - parseInt(tdsAndTcs ,10)) * parseFloat('0.45') ) -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) ;

			}


			if(eval(parseInt(slab1 ,10) + parseInt(slab2 ,10) + parseInt(slab3 ,10)) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA2 ,10) + parseInt(taxonLottery2 ,10)  - parseInt(tdsAndTcs ,10)) * parseFloat('0.75' ,10))){
				var tempintrst234Ciii = (((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA2 ,10) + parseInt(taxonLottery2 ,10)  - parseInt(tdsAndTcs ,10)) * parseFloat('0.75')) - 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('3' ,10) ;
			}

			if(eval(parseInt(slab1 ,10) + parseInt(slab2 ,10) + parseInt(slab3 ,10) +  parseInt(slab4 ,10)) < eval((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA3 ,10) + parseInt(taxonLottery3 ,10)  - parseInt(tdsAndTcs ,10)) * parseInt('1' ,10))){
				var tempintrst234Civ = ((parseInt(balTaxPayable234C ,10) + parseInt(taxon15BDA3 ,10) + parseInt(taxonLottery3 ,10)  - parseInt(tdsAndTcs ,10)) - parseInt(slab1 ,10)- parseInt(slab2 ,10) - parseInt(slab3 ,10) - parseInt(slab4 ,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) ;
			}
			
			if(eval(parseInt(slab5 ,10)) < eval((parseInt(taxon15BDA4 ,10) + parseInt(taxonLottery4 ,10) - parseInt(tdsAndTcs ,10)) * parseInt('1' ,10))){
				var tempintrst234Cv = ((parseInt(taxon15BDA4 ,10) + parseInt(taxonLottery4 ,10) - parseInt(tdsAndTcs ,10)) - parseInt(slab5 ,10));
				if(parseInt(tempintrst234Cv,10) > 100){
					tempintrst234Cv= Math.floor(parseInt(tempintrst234Cv,10)/100)*parseInt('100' ,10);
				}
				intrst234Cv=parseInt(tempintrst234Cv,10)* parseFloat('0.01') * parseInt('1' ,10) ;
			}

		}
		else {
			 intrst234Ci = parseInt('0',10);
			 intrst234Cii = parseInt('0',10);
			 intrst234Ciii = parseInt('0',10);
			 intrst234Civ = parseInt('0',10);
			 intrst234Cv = parseInt('0',10);
		}
		intrst234C = eval(parseInt(intrst234Ci ,10) + parseInt(intrst234Cii ,10) + parseInt(intrst234Ciii ,10) + parseInt(intrst234Civ ,10) + parseInt(intrst234Cv ,10));

		// ===============Interest234B calculation=======================

		var intrst234Bprinciple;
		var intrst234Bi=parseInt('0',10);
		var noOfMonthsTillSelfasst= parseInt('0',10);
		if(parseInt(balTaxPayable,10) - parseInt(tdsAndTcs,10) >= parseInt('10000' ,10)) {
			if(parseInt(advanceTax,10) < ((parseInt(balTaxPayable,10) - parseInt(tdsAndTcs,10)) * parseFloat('0.90'))) {

				intrst234Bprinciple = (parseInt(balTaxPayable ,10) - parseInt(advanceTax ,10) - parseInt(tdsAndTcs,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);

				var tab234B = document.getElementById('scheduleIT');
				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) ){

							selfAsspaidDates[x]=allInputTags[p].value;
							selfAsspaidAmts[x]=allInputTags[p+2].value;
							x++;
						}
					}
				}

				// to sort all self assesment tax values according to date

				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;
							}
						}
					}
				}

				if(selfAsspaidDates.length==0){
					noOfMonthsTillSelfasst=calcNoOfMonths(currentDate,'01/04/2020');
				}else{
					noOfMonthsTillSelfasst=calcNoOfMonths(selfAsspaidDates[0],'01/04/2020');
				}

				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(tdsAndTcs, 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
						var intrst234bflag=false;
						if(checkFirstDateBefore('01/04/2020',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);
		}


               if(intrst234ATemp.old !=  intrst234A){
               	intrst234ATemp.old = intrst234A;
               	intrst234ATemp.value = Math.round(intrst234A);
           	}
               if(intrst234BTemp.old !=  intrst234B){
               	intrst234BTemp.old = intrst234B;
               	intrst234BTemp.value = Math.round(intrst234B);
           	}
               if(intrst234CTemp.old !=  intrst234C){
               	intrst234CTemp.old = intrst234C;
               	intrst234CTemp.value = Math.round(intrst234C);
           	}
               if(intrst234FTemp.old !=  intrst234F){
               	intrst234FTemp.old = intrst234F;
               	intrst234FTemp.value = Math.round(intrst234F);
           	}


	}



function calcSchBPBalance() {
var profBfrTaxPL = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.profBfrTaxPL')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.profBfrTaxPL');
var netPLFromSpecBus = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLFromSpecBus')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLFromSpecBus');
var netProfLossSpecifiedBus = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netProfLossSpecifiedBus')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netProfLossSpecifiedBus');
var plUs44SChapXIIG = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.plUs44SChapXIIG');
var firmShareInc = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.firmShareInc')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.firmShareInc');
var aopboiSharInc = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.aopboiSharInc')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.aopboiSharInc');
var othExempInc = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.othExempInc')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.othExempInc');
var totExempInc = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.totExempInc')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.incCredPL.totExempInc');

calcculateAnyOtherInc();

var balancePLOthThanSpecBus = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.balancePLOthThanSpecBus')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.balancePLOthThanSpecBus');

var expDebToPLOthHeads = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.expDebToPLOthHeads');
var expDebToPLExemptInc = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.expDebToPLExemptInc')[0];  coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.expDebToPLExemptInc');
var totExpDebPL = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.totExpDebPL')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.totExpDebPL');

var adjustedPLOthThanSpecBus = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.adjustedPLOthThanSpecBus')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.adjustedPLOthThanSpecBus');

var deemIncUs3380HHD80IA = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.deemIncUs3380HHD80IA')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.deemIncUs3380HHD80IA');
var othItemDisallowUs28To44DA = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.othItemDisallowUs28To44DA')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.othItemDisallowUs28To44DA');
var anyOthIncNotInclInExpDisallowPL = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthIncNotInclInExpDisallowPL')[0];
var totAfterAddToPLDeprOthSpecInc =  document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.totAfterAddToPLDeprOthSpecInc')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.totAfterAddToPLDeprOthSpecInc');

var deductUs321Iii =  document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.deductUs321Iii')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.deductUs321Iii');
var anyOthAmtAllDeduct = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthAmtAllDeduct')[0];  coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthAmtAllDeduct');
var totDeductionAmts =  document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.totDeductionAmts')[0];  coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.totDeductionAmts');

var plAftAdjDedBusOthThanSpec =  document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.plAftAdjDedBusOthThanSpec')[0]; coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.plAftAdjDedBusOthThanSpec');

var section44AE = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44AE')[0];  coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.section44AE');
var totDeemedProfitBusUs = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.totDeemedProfitBusUs')[0];   coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.deemedProfitBusUs.totDeemedProfitBusUs');

// var profitLossBfrDeductUs10S =
// document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.profitLossBfrDeductUs10S')[0];
// coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.profitLossBfrDeductUs10S');
//
// var section10A =
// document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.deductionUs10S.section10A')[0];
// coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.deductionUs10S.section10A');
// var section10AA =
// document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.deductionUs10S.section10AA')[0];
// coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.deductionUs10S.section10AA');
// var totDeductionUs10S =
// document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.deductionUs10S.totDeductionUs10S')[0];
// coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.deductionUs10S.totDeductionUs10S');

var netPLAftAdjBusOthThanSpec =  document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLAftAdjBusOthThanSpec')[0];   coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLAftAdjBusOthThanSpec');

var netPLBusOthThanSpec7A7B7CI = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7CI')[0];   coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7CI');
var netPLBusOthThanSpec7A7B7C = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C')[0];   coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C');

var netPLFrmSpecBus = document.getElementsByName('itr7.corpScheduleBP.specBusinessInc.netPLFrmSpecBus')[0]; coalesceSetRet('itr7.corpScheduleBP.specBusinessInc.netPLFrmSpecBus');
var additionUs28To44DA = document.getElementsByName('itr7.corpScheduleBP.specBusinessInc.additionUs28To44DA')[0]; coalesceSetRet('itr7.corpScheduleBP.specBusinessInc.additionUs28To44DA');
var deductUs28To44DA = document.getElementsByName('itr7.corpScheduleBP.specBusinessInc.deductUs28To44DA')[0];  coalesceSetRet('itr7.corpScheduleBP.specBusinessInc.deductUs28To44DA');
var adjustedPLFrmSpecuBus = document.getElementsByName('itr7.corpScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus')[0];  coalesceSetRet('itr7.corpScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus');

var netPLFrmSpecifiedBus = document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.netPLFrmSpecifiedBus')[0];  coalesceSetRet('itr7.corpScheduleBP.incSpecifiedBusiness.netPLFrmSpecifiedBus');
var addSec28To44DA = document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.addSec28To44DA')[0]; coalesceSetRet('itr7.corpScheduleBP.incSpecifiedBusiness.addSec28To44DA');
var dedSec28To44DAOTDedSec35AD = document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.dedSec28To44DAOTDedSec35AD')[0];  coalesceSetRet('itr7.corpScheduleBP.incSpecifiedBusiness.dedSec28To44DAOTDedSec35AD');
var profitLossSpecifiedBusiness = document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusiness')[0]; coalesceSetRet('itr7.corpScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusiness');

var dedSec35AD = document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.dedSec35AD')[0]; coalesceSetRet('itr7.corpScheduleBP.incSpecifiedBusiness.dedSec35AD');
var profitLossSpecifiedBusFinal = document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal')[0]; coalesceSetRet('itr7.corpScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal');

var incChrgUnHdProftGain = document.getElementsByName('itr7.corpScheduleBP.incChrgUnHdProftGain')[0]; coalesceSetRet('itr7.corpScheduleBP.incChrgUnHdProftGain');
var incAsAccOfBusUndertaking = document.getElementsByName('itr7.corpScheduleBP.chargeableUs11.incAsAccOfBusUndertaking')[0]; coalesceSetRet('itr7.corpScheduleBP.chargeableUs11.incAsAccOfBusUndertaking');
var incChargeableUs11 = document.getElementsByName('itr7.corpScheduleBP.chargeableUs11.incChargeableUs11')[0]; coalesceSetRet('itr7.corpScheduleBP.chargeableUs11.incChargeableUs11');




totExempInc.value = eval(parseInt(coalesce(firmShareInc.value) ,10)) + eval(parseInt(coalesce(aopboiSharInc.value) ,10)) + eval(parseInt(coalesce(othExempInc.value),10));

var totExpDebPLTemp =  eval(parseInt(coalesce(expDebToPLOthHeads.value) ,10)) + eval(parseInt(coalesce(expDebToPLExemptInc.value) ,10));
if( parseInt(totExpDebPLTemp ,10) >0 ){
		totExpDebPL.value = totExpDebPLTemp;
	}else{
		totExpDebPL.value = parseInt(0,10);
	}


var totDeductionAmtsTemp = eval(parseInt(coalesce(deductUs321Iii.value) ,10)) + eval(parseInt(coalesce(anyOthAmtAllDeduct.value) ,10));
if( parseInt(totDeductionAmtsTemp ,10) >0 ){
		totDeductionAmts.value = totDeductionAmtsTemp;
	}else{
		totDeductionAmts.value = parseInt(0,10);
	}

var totDeemedProfitBusUsTemp = eval(parseInt(coalesce(section44AE.value) ,10));
if( parseInt(totDeemedProfitBusUsTemp ,10) >0 ){
		totDeemedProfitBusUs.value = totDeemedProfitBusUsTemp;
	}else{
		totDeemedProfitBusUs.value = parseInt(0,10);
	}
plUs44SChapXIIG.value = coalesce(totDeemedProfitBusUs.value);
// var totDeductionUs10STemp = eval(parseInt(coalesce(section10A.value) ,10)) +
// eval(parseInt(coalesce(section10AA.value) ,10));
// if( parseInt(totDeductionUs10STemp ,10) >0 ){
// totDeductionUs10S.value = totDeductionUs10STemp;
// }else{
// totDeductionUs10S.value = parseInt(0,10);
// }
netPLFrmSpecBus.value = coalesce(netPLFromSpecBus.value);
var adjustedPLFrmSpecuBusTemp = eval(parseInt(coalesce(netPLFrmSpecBus.value) ,10)) + eval(parseInt(coalesce(additionUs28To44DA.value) ,10)) - eval(parseInt(coalesce(deductUs28To44DA.value) ,10));

if( parseInt(adjustedPLFrmSpecuBusTemp ,10) >0 ){
	adjustedPLFrmSpecuBus.value = adjustedPLFrmSpecuBusTemp;
}else{
	adjustedPLFrmSpecuBus.value = parseInt(0,10);
}
netPLFrmSpecifiedBus.value = coalesce(netProfLossSpecifiedBus.value);
profitLossSpecifiedBusiness.value = eval(parseInt(coalesce(netPLFrmSpecifiedBus.value) ,10)) + eval(parseInt(coalesce(addSec28To44DA.value) ,10)) - eval(parseInt(coalesce(dedSec28To44DAOTDedSec35AD.value) ,10));



var profitLossSpecifiedBusFinalTemp = eval(parseInt(coalesce(profitLossSpecifiedBusiness.value) ,10)) - eval(parseInt(coalesce(dedSec35AD.value) ,10));

if( parseInt(profitLossSpecifiedBusFinalTemp ,10) >0 ){
	profitLossSpecifiedBusFinal.value = profitLossSpecifiedBusFinalTemp;
}else{
	profitLossSpecifiedBusFinal.value = parseInt(0,10);
}



        balancePLOthThanSpecBus.value = eval(parseInt(coalesce(profBfrTaxPL.value) ,10)) - eval(parseInt(coalesce(netPLFromSpecBus.value) ,10)) - eval(parseInt(coalesce(netProfLossSpecifiedBus.value),10)) - eval(parseInt(coalesce(plUs44SChapXIIG.value),10)) - eval(parseInt(coalesce(totExempInc.value),10));
        adjustedPLOthThanSpecBus.value = eval(parseInt(coalesce(balancePLOthThanSpecBus.value) ,10)) + eval(parseInt(coalesce(totExpDebPL.value) ,10));


        $('[name="itr7.corpScheduleBP.businessIncOthThanSpec.deemIncUs3380HHD80IA"]')[0].value =
    		getAmt('itr7.corpScheduleBP.businessIncOthThanSpec.deemIncUs3380HHD80IA.33AB')+
    		getAmt('itr7.corpScheduleBP.businessIncOthThanSpec.deemIncUs3380HHD80IA.33ABA')+
    		getAmt('itr7.corpScheduleBP.businessIncOthThanSpec.deemIncUs3380HHD80IA.35ABB');



        var totAfterAddToPLDeprOthSpecIncTemp = eval(parseInt(coalesce(adjustedPLOthThanSpecBus.value) ,10)) + eval(parseInt(coalesce(deemIncUs3380HHD80IA.value) ,10)) + eval(parseInt(coalesce(othItemDisallowUs28To44DA.value) ,10)) + eval(parseInt(coalesce(anyOthIncNotInclInExpDisallowPL.value) ,10));

		totAfterAddToPLDeprOthSpecInc.value = totAfterAddToPLDeprOthSpecIncTemp;


        var plAftAdjDedBusOthThanSpecTemp = eval(parseInt(coalesce(totAfterAddToPLDeprOthSpecInc.value) ,10)) - eval(parseInt(coalesce(totDeductionAmts.value) ,10));

		plAftAdjDedBusOthThanSpec.value = plAftAdjDedBusOthThanSpecTemp;

// var profitLossBfrDeductUs10STemp =
// eval(parseInt(coalesce(plAftAdjDedBusOthThanSpec.value) ,10)) +
// eval(parseInt(coalesce(totDeemedProfitBusUs.value) ,10));
// profitLossBfrDeductUs10S.value = profitLossBfrDeductUs10STemp;
          var netPLAftAdjBusOthThanSpecTemp = eval(parseInt(coalesce(plAftAdjDedBusOthThanSpec.value) ,10)) + eval(parseInt(coalesce(totDeemedProfitBusUs.value) ,10));
		netPLAftAdjBusOthThanSpec.value = netPLAftAdjBusOthThanSpecTemp;

       if($('[name="itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C"]')[0].flag!='Y' ) {
           netPLBusOthThanSpec7A7B7C.value = coalesce(netPLAftAdjBusOthThanSpec.value);
        }


   	coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7CI');

	if(coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7CI') != 0) {
		document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C')[0].value =
			coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7CI');
	} else {
		document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C')[0].value =
			coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.netPLAftAdjBusOthThanSpec');
	}
        incChrgUnHdProftGain.value = eval(parseInt(coalesce(netPLBusOthThanSpec7A7B7C.value) ,10)) + eval(parseInt(coalesce(adjustedPLFrmSpecuBus.value) ,10)) + eval(parseInt(coalesce(profitLossSpecifiedBusFinal.value) ,10));

        var incChargeableUs11Temp =  eval(parseInt(coalesce(incChrgUnHdProftGain.value) ,10)) - eval(parseInt(coalesce(incAsAccOfBusUndertaking.value) ,10));
        if( parseInt(incChargeableUs11Temp ,10) >0 ){
		// incChargeableUs11.value = incChargeableUs11Temp;
	}else{
		incChargeableUs11.value = parseInt(0,10);
	}

	changeCYLA();
        calculateTiTti();
}




function calcculateAnyOtherInc(){
	var totalOSIntGross = document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthIncNotInclInExpDisallowPL')[0];
	totalOSIntGross.value = eval(
			parseInt(coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthIncNotInc.Salary'),10)
			+ parseInt(coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthIncNotInc.Bonus'),10)
			+ parseInt(coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthIncNotInc.Interest'),10)
			+ parseInt(coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthIncNotInc.Others'),10)
			+ parseInt(coalesceSetRet('itr7.corpScheduleBP.businessIncOthThanSpec.anyOthIncNotInc.Commission'),10)
		);

}

function changeCYLA(called) {

	var hpIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead')[0]; hpIncOfCurYrUnderThatHead.value = coalesce(hpIncOfCurYrUnderThatHead.value);
	var hpBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.busLossSetoff')[0];  hpBusLossSetoff.value = coalesce(hpBusLossSetoff.value);
	var hpOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; hpOthSrcLossNoRaceHorseSetoff.value = coalesce(hpOthSrcLossNoRaceHorseSetoff.value);
	var hpIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.incOfCurYrAfterSetOff')[0]; hpIncOfCurYrAfterSetOff.value = coalesce(hpIncOfCurYrAfterSetOff.value);
	var busIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead')[0]; busIncOfCurYrUnderThatHead.value = coalesce(busIncOfCurYrUnderThatHead.value);
	var busHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')[0]; busHPlossCurYrSetoff.value = coalesce(busHPlossCurYrSetoff.value);
	var busOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; busOthSrcLossNoRaceHorseSetoff.value = coalesce(busOthSrcLossNoRaceHorseSetoff.value);
	var busIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff')[0]; busIncOfCurYrAfterSetOff.value = coalesce(busIncOfCurYrAfterSetOff.value);
	var specltvIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead')[0]; specltvIncOfCurYrUnderThatHead.value = coalesce(specltvIncOfCurYrUnderThatHead.value);
	var specltvHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')[0]; specltvHPlossCurYrSetoff.value = coalesce(specltvHPlossCurYrSetoff.value);
	var specltvOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; specltvOthSrcLossNoRaceHorseSetoff.value = coalesce(specltvOthSrcLossNoRaceHorseSetoff.value);
	var specltvIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.incOfCurYrAfterSetOff')[0]; specltvIncOfCurYrAfterSetOff.value = coalesce(specltvIncOfCurYrAfterSetOff.value);
	var specfidIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead')[0]; specfidIncOfCurYrUnderThatHead.value = coalesce(specfidIncOfCurYrUnderThatHead.value);
	var specfidHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')[0]; specfidHPlossCurYrSetoff.value = coalesce(specfidHPlossCurYrSetoff.value);
	var specfidOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; specfidOthSrcLossNoRaceHorseSetoff.value = coalesce(specfidOthSrcLossNoRaceHorseSetoff.value);
	var specfidIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.incOfCurYrAfterSetOff')[0]; specfidIncOfCurYrAfterSetOff.value = coalesce(specfidIncOfCurYrAfterSetOff.value);
	var stcgIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.incOfCurYrUnderThatHead')[0]; stcgIncOfCurYrUnderThatHead.value = coalesce(stcgIncOfCurYrUnderThatHead.value);
	var stcgHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.hPlossCurYrSetoff')[0]; stcgHPlossCurYrSetoff.value = coalesce(stcgHPlossCurYrSetoff.value);
	var stcgBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.busLossSetoff')[0]; stcgBusLossSetoff.value = coalesce(stcgBusLossSetoff.value);
	var stcgOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; stcgOthSrcLossNoRaceHorseSetoff.value = coalesce(stcgOthSrcLossNoRaceHorseSetoff.value);
	var stcgIncOfCurYrAfterSetOff  = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.incOfCurYrAfterSetOff')[0]; stcgIncOfCurYrAfterSetOff.value = coalesce(stcgIncOfCurYrAfterSetOff.value);
	var ltcgIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.incOfCurYrUnderThatHead')[0]; ltcgIncOfCurYrUnderThatHead.value = coalesce(ltcgIncOfCurYrUnderThatHead.value);
	var ltcgHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.hPlossCurYrSetoff')[0]; ltcgHPlossCurYrSetoff.value = coalesce(ltcgHPlossCurYrSetoff.value);
	var ltcgBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.busLossSetoff')[0]; ltcgBusLossSetoff.value = coalesce(ltcgBusLossSetoff.value);
	var ltcgOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.othSrcLossNoRaceHorseSetoff')[0];  ltcgOthSrcLossNoRaceHorseSetoff.value = coalesce(ltcgOthSrcLossNoRaceHorseSetoff.value);
	var ltcgIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.incOfCurYrAfterSetOff')[0]; ltcgIncOfCurYrAfterSetOff.value = coalesce(ltcgIncOfCurYrAfterSetOff.value);
	var othSrcIncOfCurYrUnderThatHead  = document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead')[0]; othSrcIncOfCurYrUnderThatHead.value = coalesce(othSrcIncOfCurYrUnderThatHead.value);
	var othSrcHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')[0]; othSrcHPlossCurYrSetoff.value = coalesce(othSrcHPlossCurYrSetoff.value);
	var othSrcBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')[0]; othSrcBusLossSetoff.value = coalesce(othSrcBusLossSetoff.value);
	var othSrcIncOfCurYrAfterSetOff= document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0];  othSrcIncOfCurYrAfterSetOff.value = coalesce(othSrcIncOfCurYrAfterSetOff.value);
	var profitFrmRaceHorseIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead')[0]; profitFrmRaceHorseIncOfCurYrUnderThatHead.value = coalesce(profitFrmRaceHorseIncOfCurYrUnderThatHead.value);
	var profitFrmRaceHorseHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')[0]; profitFrmRaceHorseHPlossCurYrSetoff.value = coalesce(profitFrmRaceHorseHPlossCurYrSetoff.value);
	var profitFrmRaceHorseBusLossSetoff= document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')[0]; profitFrmRaceHorseBusLossSetoff.value = coalesce(profitFrmRaceHorseBusLossSetoff.value);
	var profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff= document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value = coalesce(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);
	var profitFrmRaceHorseIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0]; profitFrmRaceHorseIncOfCurYrAfterSetOff.value = coalesce(profitFrmRaceHorseIncOfCurYrAfterSetOff.value);
	var totHPlossCurYrSetoff =  document.getElementsByName('itr7.scheduleCYLA.totalLossSetOff.totHPlossCurYrSetoff')[0]; totHPlossCurYrSetoff.value = coalesce(totHPlossCurYrSetoff.value);
	var totBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.totalLossSetOff.totBusLossSetoff')[0]; totBusLossSetoff.value = coalesce(totBusLossSetoff.value);
	var totOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.totalLossSetOff.totOthSrcLossNoRaceHorseSetoff')[0]; totOthSrcLossNoRaceHorseSetoff.value = coalesce(totOthSrcLossNoRaceHorseSetoff.value);
	var balHPlossCurYrAftSetoff = document.getElementsByName('itr7.scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff')[0]; balHPlossCurYrAftSetoff.value = coalesce(balHPlossCurYrAftSetoff.value);
	var balBusLossAftSetoff = document.getElementsByName('itr7.scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff')[0]; balBusLossAftSetoff.value = coalesce(balBusLossAftSetoff.value);
	var balOthSrcLossNoRaceHorseAftSetoff = document.getElementsByName('itr7.scheduleCYLA.lossRemAftSetOff.balOthSrcLossNoRaceHorseAftSetoff')[0]; balOthSrcLossNoRaceHorseAftSetoff.value = coalesce(balOthSrcLossNoRaceHorseAftSetoff.value);
	var balSCG = document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset.balSCG')[0]; balSCG.value = coalesce(balSCG.value);

	var totalIncomeChargeableUnHP = document.getElementsByName('scheduleHP.incomeUnderIncFrmHp')[0];


	var totHPlossCurYr = document.getElementsByName('itr7.scheduleCYLA.totalCurYr.totHPlossCurYr')[0];
	totHPlossCurYr.value = coalesce(totHPlossCurYr.value);
	var totBusLoss = document.getElementsByName('itr7.scheduleCYLA.totalCurYr.totBusLoss')[0];
	totBusLoss.value = coalesce(totBusLoss.value);

	var totOthSrcLossNoRaceHorse = document.getElementsByName('itr7.scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')[0];
	totOthSrcLossNoRaceHorse.value = coalesce(totOthSrcLossNoRaceHorse.value);

	var totalIncomeChargeableUnHP=document.getElementsByName('scheduleHP.incomeUnderIncFrmHp')[0];
	totalIncomeChargeableUnHP.value = coalesce(totalIncomeChargeableUnHP.value);
	var netPLBusOthThanSpec7A7B7C=document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C')[0];
	netPLBusOthThanSpec7A7B7C.value = coalesce(netPLBusOthThanSpec7A7B7C.value);
	var balanceNoRaceHorse=document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.balanceNoRaceHorse')[0];
	balanceNoRaceHorse.value = coalesce(balanceNoRaceHorse.value);
	var totalSTCG=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.totalSTCG')[0];
	totalSTCG.value = coalesce(totalSTCG.value);
	var totalLTCG=document.getElementsByName('itr7.scheduleCG.longTermCapGain.totalLTCG')[0];
	totalLTCG.value = coalesce(totalLTCG.value);
	var adjustedPLFrmSpecuBus=document.getElementsByName('itr7.corpScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus')[0];
	adjustedPLFrmSpecuBus.value = coalesce(adjustedPLFrmSpecuBus.value);
	var profitLossSpecifiedBusFinal=document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal')[0];
	profitLossSpecifiedBusFinal.value = coalesce(profitLossSpecifiedBusFinal.value);
	var balanceOwnRaceHorse=document.getElementsByName('itr7.scheduleOS.incFromOwnHorse.balanceOwnRaceHorse')[0];
	balanceOwnRaceHorse.value = coalesce(balanceOwnRaceHorse.value);

	var deemedSTCGDeprAsset=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.deemedSTCGDeprAsset')[0];
	deemedSTCGDeprAsset.value = coalesce(deemedSTCGDeprAsset.value);
	/*
	 * var
	 * exemptionUs111A=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.exemptionUs111A')[0];
	 * exemptionUs111A.value = coalesce(exemptionUs111A.value);
	 */
	var ptiStcg30=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg30')[0];
	ptiStcg30.value = coalesce(ptiStcg30.value);

	var balLTCGNo112=document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balLTCGNo112')[0];
	balLTCGNo112.value = coalesce(balLTCGNo112.value);

	var passThrInc20Per=document.getElementsByName('itr7.scheduleCG.longTermCapGain.passThrInc20Per')[0];
	passThrInc20Per.value = coalesce(passThrInc20Per.value);

	var ptiStcg15=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg15')[0];
	ptiStcg15.value = coalesce(ptiStcg15.value);

	var passThrInc10Per=document.getElementsByName('itr7.scheduleCG.longTermCapGain.passThrInc10Per')[0];
	passThrInc10Per.value = coalesce(passThrInc10Per.value);

	var balCG=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')[0];
	balCG.value = coalesce(balCG.value);
	var balLTCG112=document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetProviso112.balLTCG112')[0];
	balLTCG112.value = coalesce(balLTCG112.value);
	var balancCG112proviso = 0;
	var balancCG112A = 0;
	var noOfBody= $('#ltcg10pctTab tbody').length;
	for(var i = 0 ; i < noOfBody ; i++){
		if(document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].asstProvisoUndrSec112')[0].value=='112(1)')
		{
			balancCG112proviso = balancCG112proviso +getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].balanceCG');
		}
		if(document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].asstProvisoUndrSec112')[0].value=='112A')
		{
			balancCG112A = balancCG112A +getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+i+'].balanceCG');
		}
	}
	var A2eA3A4A5bRemain = 0;
	var B1eRemain = 0;
	var A1eRemain = 0;
	//var B2eRemain = 0;
	var B2d1Remain = 0;
	var B2d2Remain = 0;

	var B3bRemain = 0;
	var A5aRemain = 0;
	var B3aRemain = 0;
	if(balSCG.value>=0 && deemedSTCGDeprAsset.value>=0 && ptiStcg30.value>=0)
	{
		A2eA3A4A5bRemain = eval(balSCG.value)+eval(deemedSTCGDeprAsset.value) + eval(ptiStcg30.value);
	}
	if(balLTCGNo112.value>=0)
	{
		B1eRemain=balLTCGNo112.value;
	}
	if(balCG.value>=0)
	{
		A1eRemain=balCG.value;
	}
	
	//B2eRemain=balLTCG112.value;
	if(balancCG112proviso>=0)
	{
	B2d1Remain=balancCG112proviso;
	}
	if(balancCG112A>=0)
	{
	B2d2Remain=balancCG112A;
	}
	if(passThrInc20Per.value>=0)
	{
	B3bRemain=passThrInc20Per.value;
	}
	if(ptiStcg15.value>=0){
		A5aRemain=ptiStcg15.value;
	}
	if(passThrInc10Per.value>=0)
	{
		B3aRemain=passThrInc10Per.value;
	}
	

	var ltcg20Per = eval(B1eRemain + B3bRemain);

	// setOffOthSrcLossCYLA(A2eA3A4A5bRemain,ltcg20Per);

	if(totalSTCG.value < 0) {
		var tmp = totalSTCG.value;
		if(B3bRemain>0){
			B3bRemain = eval(parseInt(B3bRemain,10) + parseInt(tmp,10));
			tmp = zeroOrLess(B3bRemain);
			B3bRemain = zeroOrMore(B3bRemain);
		}
		if(tmp < 0 && B1eRemain>0){
			B1eRemain = eval(parseInt(B1eRemain,10) + parseInt(tmp,10));
			tmp = zeroOrLess(B1eRemain);
			B1eRemain = zeroOrMore(B1eRemain);
		}
		
		if(B3aRemain>0){
			B3aRemain = eval(parseInt(B3aRemain,10) + parseInt(tmp,10));
			tmp = zeroOrLess(B3aRemain);
			B3aRemain = zeroOrMore(B3aRemain);
		}
		/*if(tmp < 0 && B2eRemain>0){
			B2eRemain = eval(parseInt(B2eRemain,10) + parseInt(tmp,10));
			B2eRemain = zeroOrMore(B2eRemain);
		}*/
		if(B2d1Remain>0){
			B2d1Remain = eval(parseInt(B2d1Remain,10) + parseInt(tmp,10));
			tmp = zeroOrLess(B2d1Remain);
			B2d1Remain = zeroOrMore(B2d1Remain);
		}
		if(tmp < 0 && B2d2Remain>0){
			B2d2Remain = eval(parseInt(B2d2Remain,10) + parseInt(tmp,10));
			B2d2Remain = zeroOrMore(B2d2Remain);
		}
		/*if(B1eRemain>0){
			B1eRemain = eval(parseInt(B1eRemain,10) + parseInt(tmp,10));
			tmp = zeroOrLess(B1eRemain);
			B1eRemain = zeroOrMore(B1eRemain);
		}
		if(tmp < 0 && B2eRemain>0){
			B2eRemain = eval(parseInt(B2eRemain,10) + parseInt(tmp,10));
			B2eRemain = zeroOrMore(B2eRemain);
		}*/
	}
	        hpIncOfCurYrUnderThatHead.value=0;
	        totHPlossCurYr.value=0;
	        busIncOfCurYrUnderThatHead.value=0;
	        totBusLoss.value=0;
	        othSrcIncOfCurYrUnderThatHead.value=0;
	        totOthSrcLossNoRaceHorse.value=0;
	        specfidIncOfCurYrUnderThatHead.value=0;
	        stcgIncOfCurYrUnderThatHead.value=0;
	        ltcgIncOfCurYrUnderThatHead.value=0;
	        profitFrmRaceHorseIncOfCurYrUnderThatHead.value=0;
	        specltvIncOfCurYrUnderThatHead.value=0;

			if(eval(totalIncomeChargeableUnHP.value) >= 0){

				hpIncOfCurYrUnderThatHead.value=totalIncomeChargeableUnHP.value;
				totHPlossCurYr.value=0;

			}else{

				totHPlossCurYr.value=Math.abs(totalIncomeChargeableUnHP.value);
				hpIncOfCurYrUnderThatHead.value=0;

			}


			if(eval(balanceNoRaceHorse.value) >= 0){

				othSrcIncOfCurYrUnderThatHead.value=balanceNoRaceHorse.value;
				totOthSrcLossNoRaceHorse.value=0;

			}else{

				totOthSrcLossNoRaceHorse.value=Math.abs(balanceNoRaceHorse.value);
				othSrcIncOfCurYrUnderThatHead.value=0;

			}
			
			var netPLBusOthThanSpec7A7B7Ctemp;
			if(eval(adjustedPLFrmSpecuBus.value)>=0){
				
				if(eval(netPLBusOthThanSpec7A7B7C.value)<0){
					netPLBusOthThanSpec7A7B7Ctemp = eval(adjustedPLFrmSpecuBus.value) + eval(netPLBusOthThanSpec7A7B7C.value);
				} else {
					netPLBusOthThanSpec7A7B7Ctemp= eval(adjustedPLFrmSpecuBus.value);
				}
				if(eval(netPLBusOthThanSpec7A7B7Ctemp)>=0){
					specltvIncOfCurYrUnderThatHead.value=netPLBusOthThanSpec7A7B7Ctemp;
				}

			}
			if(eval(profitLossSpecifiedBusFinal.value)>=0){
				var adjustedPLFrmSpecifiedBusTemp;
					if(eval(netPLBusOthThanSpec7A7B7Ctemp)<0){
						adjustedPLFrmSpecifiedBusTemp = eval(profitLossSpecifiedBusFinal.value) + eval(netPLBusOthThanSpec7A7B7Ctemp);
					} else {
						adjustedPLFrmSpecifiedBusTemp= eval(profitLossSpecifiedBusFinal.value);
					}
					if(eval(adjustedPLFrmSpecifiedBusTemp)>=0){
						specfidIncOfCurYrUnderThatHead.value=adjustedPLFrmSpecifiedBusTemp;
						adjustedPLFrmSpecuBusTemp=0;
					}

				}
				
			/*if(eval(profitLossSpecifiedBusFinal.value)>=0){
				var netPLBusOthThanSpec7A7B7Ctemp;
				if(eval(netPLBusOthThanSpec7A7B7C.value)<0){
					netPLBusOthThanSpec7A7B7Ctemp = eval(profitLossSpecifiedBusFinal.value) + eval(netPLBusOthThanSpec7A7B7C.value);
				} else {
					netPLBusOthThanSpec7A7B7Ctemp= eval(profitLossSpecifiedBusFinal.value);
				}
				if(eval(netPLBusOthThanSpec7A7B7Ctemp)>=0){
					specfidIncOfCurYrUnderThatHead.value=netPLBusOthThanSpec7A7B7Ctemp;
				}

			}

			if(eval(adjustedPLFrmSpecuBus.value)>=0){
			var adjustedPLFrmSpecuBusTemp;
				if(eval(netPLBusOthThanSpec7A7B7Ctemp)<0){
					adjustedPLFrmSpecuBusTemp = eval(adjustedPLFrmSpecuBus.value) + eval(netPLBusOthThanSpec7A7B7Ctemp);
				} else {
					adjustedPLFrmSpecuBusTemp= eval(adjustedPLFrmSpecuBus.value);
				}
				if(eval(adjustedPLFrmSpecuBusTemp)>=0){
					specltvIncOfCurYrUnderThatHead.value=adjustedPLFrmSpecuBusTemp;
					adjustedPLFrmSpecuBusTemp=0;
				}

			}*/

			if(netPLBusOthThanSpec7A7B7C.value>=0) {
				busIncOfCurYrUnderThatHead.value=netPLBusOthThanSpec7A7B7C.value;
				totBusLoss.value=0;
			}else{
				totBusLoss.value=Math.abs(adjustedPLFrmSpecifiedBusTemp);
				busIncOfCurYrUnderThatHead.value=0;

			}


			if(eval(totalSTCG.value)>=0){

				stcgIncOfCurYrUnderThatHead.value=totalSTCG.value;

			}
			if(eval(totalSTCG.value)<0 ){

				if(eval(totalLTCG.value)+eval(totalSTCG.value)>0){

					ltcgIncOfCurYrUnderThatHead.value=eval(totalLTCG.value)+eval(totalSTCG.value);
				}

			}else{

				ltcgIncOfCurYrUnderThatHead.value=totalLTCG.value;

			}

			if(eval(ltcgIncOfCurYrUnderThatHead.value)<0){

				ltcgIncOfCurYrUnderThatHead.value=0;
			}

			if(eval(balanceOwnRaceHorse.value)>=0){

				profitFrmRaceHorseIncOfCurYrUnderThatHead.value=balanceOwnRaceHorse.value;

			}

			hpOthSrcLossNoRaceHorseSetoff.value=0;
			busOthSrcLossNoRaceHorseSetoff.value=0;
			specltvOthSrcLossNoRaceHorseSetoff.value=0;
			specfidOthSrcLossNoRaceHorseSetoff.value=0;
			stcgOthSrcLossNoRaceHorseSetoff.value=0;
			ltcgOthSrcLossNoRaceHorseSetoff.value=0;
			profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value=0;

			hpBusLossSetoff.value=0;
			stcgBusLossSetoff.value=0;
			ltcgBusLossSetoff.value=0;
			othSrcBusLossSetoff.value=0;
			profitFrmRaceHorseBusLossSetoff.value=0;

			busHPlossCurYrSetoff.value=0;
			specltvHPlossCurYrSetoff.value=0;
			specfidHPlossCurYrSetoff.value=0;
			stcgHPlossCurYrSetoff.value=0;
			ltcgHPlossCurYrSetoff.value=0;
			othSrcHPlossCurYrSetoff.value=0;
			profitFrmRaceHorseHPlossCurYrSetoff.value=0;

			if(eval(totOthSrcLossNoRaceHorse.value)>0){

				var osLossToBeAdjusted=totOthSrcLossNoRaceHorse.value;
				eval(profitFrmRaceHorseIncOfCurYrUnderThatHead.value) >=eval(osLossToBeAdjusted) ?
				(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value=osLossToBeAdjusted) :
				(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value=profitFrmRaceHorseIncOfCurYrUnderThatHead.value)

				osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);
				if(eval(osLossToBeAdjusted)>0){

					eval(hpIncOfCurYrUnderThatHead.value) >=eval(osLossToBeAdjusted) ?
					(hpOthSrcLossNoRaceHorseSetoff.value=osLossToBeAdjusted) :
					(hpOthSrcLossNoRaceHorseSetoff.value=hpIncOfCurYrUnderThatHead.value);

					osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(hpOthSrcLossNoRaceHorseSetoff.value);
					if(eval(osLossToBeAdjusted)>0){

						eval(busIncOfCurYrUnderThatHead.value) >=eval(osLossToBeAdjusted) ?
						(busOthSrcLossNoRaceHorseSetoff.value=osLossToBeAdjusted) :
						(busOthSrcLossNoRaceHorseSetoff.value=busIncOfCurYrUnderThatHead.value);

						osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(busOthSrcLossNoRaceHorseSetoff.value);
						if(eval(osLossToBeAdjusted)>0){

							eval(specltvIncOfCurYrUnderThatHead.value) >=eval(osLossToBeAdjusted) ?
							(specltvOthSrcLossNoRaceHorseSetoff.value=osLossToBeAdjusted) :
							(specltvOthSrcLossNoRaceHorseSetoff.value=specltvIncOfCurYrUnderThatHead.value);

							osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(specltvOthSrcLossNoRaceHorseSetoff.value);
							if(eval(osLossToBeAdjusted)>0){

								eval(specfidIncOfCurYrUnderThatHead.value) >=eval(osLossToBeAdjusted) ?
								(specfidOthSrcLossNoRaceHorseSetoff.value=osLossToBeAdjusted) :
								(specfidOthSrcLossNoRaceHorseSetoff.value=specfidIncOfCurYrUnderThatHead.value);

								osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(specfidOthSrcLossNoRaceHorseSetoff.value);
								if(eval(osLossToBeAdjusted)>0){

									if(stcgIncOfCurYrUnderThatHead.value>0){

										if(eval(A2eA3A4A5bRemain) <= eval(osLossToBeAdjusted)){

											stcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(A2eA3A4A5bRemain,stcgIncOfCurYrUnderThatHead.value));
											A2eA3A4A5bRemain = 0;

										}else{
											stcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(osLossToBeAdjusted,stcgIncOfCurYrUnderThatHead.value));
											A2eA3A4A5bRemain = eval(parseInt(A2eA3A4A5bRemain,10) - parseInt(stcgOthSrcLossNoRaceHorseSetoff.value,10));
										}
										osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(stcgOthSrcLossNoRaceHorseSetoff.value);
									}
									if(eval(osLossToBeAdjusted)>0){

										if(ltcgIncOfCurYrUnderThatHead.value>0){
											if(eval(B3bRemain)<=eval(osLossToBeAdjusted)){

												ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(B3bRemain,ltcgIncOfCurYrUnderThatHead.value));
												B3bRemain = 0;
											}else{

												ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(osLossToBeAdjusted,ltcgIncOfCurYrUnderThatHead.value));
												B3bRemain = parseInt(B3bRemain,10) - parseInt(ltcgOthSrcLossNoRaceHorseSetoff.value,10);
											}
										osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value);
										}

									if(eval(osLossToBeAdjusted) > 0){

										/*
										 * if(ltcgIncOfCurYrUnderThatHead.value>0){
										 * if(eval(B1eRemain)<=eval(osLossToBeAdjusted)){
										 * 
										 * ltcgOthSrcLossNoRaceHorseSetoff.value=B1eRemain;
										 * B1eRemain = 0; }else{
										 * 
										 * ltcgOthSrcLossNoRaceHorseSetoff.value=osLossToBeAdjusted;
										 * B1eRemain = parseInt(B1eRemain,10) -
										 * parseInt(ltcgOthSrcLossNoRaceHorseSetoff.value,10); }
										 * osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value); }
										 */

										if(ltcgIncOfCurYrUnderThatHead.value>0){
											if(eval(B1eRemain)<=eval(osLossToBeAdjusted)){
												ltcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value) + eval(B1eRemain),ltcgIncOfCurYrUnderThatHead.value));
												osLossToBeAdjusted=eval(osLossToBeAdjusted) - eval(B1eRemain);
												B1eRemain = 0;
											}else{
												ltcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value) + eval(osLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
												B1eRemain = eval(B1eRemain) - eval(osLossToBeAdjusted);
												osLossToBeAdjusted=0;
											}

										}
										if(eval(osLossToBeAdjusted)>0){

											if((eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value))>0){

												if(eval(A5aRemain) <= eval(osLossToBeAdjusted)){

													// stcgBusLossSetoff.value=eval(A5aRemain);
													// A5aRemain = 0;
													stcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(stcgOthSrcLossNoRaceHorseSetoff.value)+eval(A5aRemain),stcgIncOfCurYrUnderThatHead.value));
													osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(A5aRemain);
													A5aRemain = 0;

												}else{
													// stcgBusLossSetoff.value=eval(busLossToBeAdjusted);
													// A5aRemain =
													// eval(A5aRemain)-eval(stcgBusLossSetoff.value);
													stcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(stcgOthSrcLossNoRaceHorseSetoff.value) + eval(osLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
													A5aRemain = eval(A5aRemain) - eval(osLossToBeAdjusted);
													osLossToBeAdjusted=0;
												}
												// busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(stcgBusLossSetoff.value);
											}
											if(eval(osLossToBeAdjusted)>0){

											if((eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value))>0){

												if(eval(A1eRemain) <= eval(osLossToBeAdjusted)){

													stcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(stcgOthSrcLossNoRaceHorseSetoff.value)+eval(A1eRemain),stcgIncOfCurYrUnderThatHead.value));
													osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(A1eRemain);
													A1eRemain = 0;
												}else{

													stcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(stcgOthSrcLossNoRaceHorseSetoff.value) + eval(osLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
													A1eRemain =  parseInt(A1eRemain,10) - parseInt(osLossToBeAdjusted,10);
													osLossToBeAdjusted=0;

												}
											}
											}
											if(eval(osLossToBeAdjusted) > 0){

												if((ltcgIncOfCurYrUnderThatHead.value-ltcgOthSrcLossNoRaceHorseSetoff.value)>0){
													if(eval(B3aRemain)<=eval(osLossToBeAdjusted)){
														ltcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value)+eval(B3aRemain),ltcgIncOfCurYrUnderThatHead.value));
														osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(B3aRemain);
														B3aRemain = 0;
													}else{
														ltcgOthSrcLossNoRaceHorseSetoff.value = zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value) + eval(osLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
														B3aRemain = eval(B3aRemain) - eval(osLossToBeAdjusted);
														osLossToBeAdjusted=0;

													}

												}

											}

												/*if(eval(osLossToBeAdjusted) > 0){

													if((ltcgIncOfCurYrUnderThatHead.value-ltcgOthSrcLossNoRaceHorseSetoff.value)>0){

														if(eval(B2eRemain)<=eval(osLossToBeAdjusted)){

															ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value)+eval(B2eRemain),ltcgIncOfCurYrUnderThatHead.value));
															osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(B2eRemain);
															B2eRemain = 0;
														}else{

															ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value) + eval(osLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
															B2eRemain = parseInt(B2eRemain,10) - parseInt(osLossToBeAdjusted,10);
															osLossToBeAdjusted=0;
														}
													}



												}*/
												if(eval(osLossToBeAdjusted) > 0){

													if((ltcgIncOfCurYrUnderThatHead.value-ltcgOthSrcLossNoRaceHorseSetoff.value)>0){

														if(eval(B2d1Remain)<=eval(osLossToBeAdjusted)){

															ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value)+eval(B2d1Remain),ltcgIncOfCurYrUnderThatHead.value));
															osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(B2d1Remain);
															B2d1Remain = 0;
														}else{

															ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value) + eval(osLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
															B2d1Remain = parseInt(B2d1Remain,10) - parseInt(osLossToBeAdjusted,10);
															osLossToBeAdjusted=0;
														}
													}



												}
												if(eval(osLossToBeAdjusted) > 0){

													if((ltcgIncOfCurYrUnderThatHead.value-ltcgOthSrcLossNoRaceHorseSetoff.value)>0){

														if(eval(B2d2Remain)<=eval(osLossToBeAdjusted)){

															ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value)+eval(B2d2Remain),ltcgIncOfCurYrUnderThatHead.value));
															osLossToBeAdjusted=eval(osLossToBeAdjusted)-eval(B2d2Remain);
															B2d2Remain = 0;
														}else{

															ltcgOthSrcLossNoRaceHorseSetoff.value=zeroOrMore(Math.min(eval(ltcgOthSrcLossNoRaceHorseSetoff.value) + eval(osLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
															B2d2Remain = parseInt(B2d2Remain,10) - parseInt(osLossToBeAdjusted,10);
															osLossToBeAdjusted=0;
														}
													}



												}
										}

									}
								  }

								}

							}

						}

					}

				}

			}

			if(eval(totBusLoss.value)>0){

						var busLossToBeAdjusted=totBusLoss.value;

							if(eval(busLossToBeAdjusted)>0){

								(eval(hpIncOfCurYrUnderThatHead.value)-eval(hpOthSrcLossNoRaceHorseSetoff.value)) >=eval(busLossToBeAdjusted) ?
								(hpBusLossSetoff.value =busLossToBeAdjusted) :
								(hpBusLossSetoff.value =(eval(hpIncOfCurYrUnderThatHead.value)-eval(hpOthSrcLossNoRaceHorseSetoff.value)));

								busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(hpBusLossSetoff.value );

								if(eval(busLossToBeAdjusted)>0){

									eval(othSrcIncOfCurYrUnderThatHead.value) >=eval(busLossToBeAdjusted) ?
									(othSrcBusLossSetoff.value=busLossToBeAdjusted) :
									(othSrcBusLossSetoff.value=othSrcIncOfCurYrUnderThatHead.value);

									busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(othSrcBusLossSetoff.value);

									if(eval(busLossToBeAdjusted)>0){

										(eval(profitFrmRaceHorseIncOfCurYrUnderThatHead.value)-eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value)) >=busLossToBeAdjusted ?
										(profitFrmRaceHorseBusLossSetoff.value=busLossToBeAdjusted) :
										(profitFrmRaceHorseBusLossSetoff.value=(eval(profitFrmRaceHorseIncOfCurYrUnderThatHead.value)-eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value)));
										busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(profitFrmRaceHorseBusLossSetoff.value);

										if(eval(busLossToBeAdjusted)>0){

											// var tempStcg=
											// eval(balSCG.value)+eval(deemedSTCGDeprAsset.value)-eval(exemptionUs111A.value);
											var setOffRemain = eval(parseInt(stcgIncOfCurYrUnderThatHead.value,10)-parseInt(stcgOthSrcLossNoRaceHorseSetoff.value,10));

											if(parseInt(setOffRemain,10) >0 && parseInt(A2eA3A4A5bRemain,10)>0){

												if(eval(A2eA3A4A5bRemain) <= eval(busLossToBeAdjusted)){

													stcgBusLossSetoff.value=zeroOrMore(Math.min(A2eA3A4A5bRemain,stcgIncOfCurYrUnderThatHead.value));
													A2eA3A4A5bRemain=0;

												}else{

													stcgBusLossSetoff.value=zeroOrMore(Math.min(eval(busLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
													A2eA3A4A5bRemain=eval(parseInt(A2eA3A4A5bRemain,10) - parseInt(busLossToBeAdjusted,10));
												}
											busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(stcgBusLossSetoff.value);

											}


											if(eval(busLossToBeAdjusted) > 0){



												if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value))>0){

													if(eval(B3bRemain)<=eval(busLossToBeAdjusted)){

														ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(B3bRemain),ltcgIncOfCurYrUnderThatHead.value));
														B3bRemain = 0;

													}else{

														ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(busLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
														B3bRemain = eval(B3bRemain)-eval(ltcgBusLossSetoff.value);

													}
												busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(ltcgBusLossSetoff.value);
												}
												
												if(eval(busLossToBeAdjusted) > 0){
												if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgBusLossSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value))>0){

													if(eval(B1eRemain)<=eval(busLossToBeAdjusted)){

														ltcgBusLossSetoff.value = zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(B1eRemain),ltcgIncOfCurYrUnderThatHead.value));
														busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(B1eRemain);
														B1eRemain = 0;

													}else{

														ltcgBusLossSetoff.value = zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(busLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
														B1eRemain = eval(B1eRemain) - eval(busLossToBeAdjusted);
														busLossToBeAdjusted=0;

													}
												}
												}
												
												if(eval(busLossToBeAdjusted)>0){

													if((eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgBusLossSetoff.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value))>0){
														if(eval(A5aRemain)<=eval(busLossToBeAdjusted)){
															stcgBusLossSetoff.value = zeroOrMore(Math.min(eval(stcgBusLossSetoff.value)+eval(A5aRemain),stcgIncOfCurYrUnderThatHead.value));
															busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(A5aRemain);
															A5aRemain = 0;
														}else{
															stcgBusLossSetoff.value =zeroOrMore(Math.min(eval(stcgBusLossSetoff.value)+eval(busLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
															A5aRemain = eval(A5aRemain) - eval(busLossToBeAdjusted);
															busLossToBeAdjusted=0;
														}
													}



												if(eval(busLossToBeAdjusted)>0){

													if((eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgBusLossSetoff.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value))>0){

														if(eval(A1eRemain)<= eval(busLossToBeAdjusted)){

															stcgBusLossSetoff.value = zeroOrMore(Math.min(eval(stcgBusLossSetoff.value)+eval(A1eRemain),stcgIncOfCurYrUnderThatHead.value));
															busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(A1eRemain);
															A1eRemain = 0;
														}else{

															stcgBusLossSetoff.value = zeroOrMore(Math.min(eval(stcgBusLossSetoff.value)+eval(busLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
															A1eRemain = eval(A1eRemain) - eval(busLossToBeAdjusted);
															busLossToBeAdjusted=0;
														}

													}



													if(eval(busLossToBeAdjusted) > 0){

														if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgBusLossSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value))>0){
															if(eval(B3aRemain)<=eval(busLossToBeAdjusted)){
																ltcgBusLossSetoff.value = zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(B3aRemain),ltcgIncOfCurYrUnderThatHead.value));
																busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(B3aRemain);
																B3aRemain = 0;
															}else{
																ltcgBusLossSetoff.value =zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(busLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																B3aRemain = eval(B3aRemain) - eval(busLossToBeAdjusted);
																busLossToBeAdjusted=0;
															}
														}



														/*if(eval(busLossToBeAdjusted) > 0){

														if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgBusLossSetoff.value-ltcgOthSrcLossNoRaceHorseSetoff.value))>0){

															if(eval(B2eRemain)<=eval(busLossToBeAdjusted)){

																ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(B2eRemain),ltcgIncOfCurYrUnderThatHead.value));
																busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(B2eRemain);
																B2eRemain = 0;
															}else{

																ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(busLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																B2eRemain = eval(B2eRemain) - eval(busLossToBeAdjusted);
																busLossToBeAdjusted=0;
															}
														}
														}*/
														if(eval(busLossToBeAdjusted) > 0){

															if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgBusLossSetoff.value-ltcgOthSrcLossNoRaceHorseSetoff.value))>0){

																if(eval(B2d1Remain)<=eval(busLossToBeAdjusted)){

																	ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(B2d1Remain),ltcgIncOfCurYrUnderThatHead.value));
																	busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(B2d1Remain);
																	B2d1Remain = 0;
																}else{

																	ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(busLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																	B2d1Remain = eval(B2d1Remain) - eval(busLossToBeAdjusted);
																	busLossToBeAdjusted=0;
																}
															}
															}
														if(eval(busLossToBeAdjusted) > 0){

															if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgBusLossSetoff.value-ltcgOthSrcLossNoRaceHorseSetoff.value))>0){

																if(eval(B2d2Remain)<=eval(busLossToBeAdjusted)){

																	ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(B2d2Remain),ltcgIncOfCurYrUnderThatHead.value));
																	busLossToBeAdjusted=eval(busLossToBeAdjusted)-eval(B2d2Remain);
																	B2d2Remain = 0;
																}else{

																	ltcgBusLossSetoff.value=zeroOrMore(Math.min(eval(ltcgBusLossSetoff.value)+eval(busLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																	B2d2Remain = eval(B2d2Remain) - eval(busLossToBeAdjusted);
																	busLossToBeAdjusted=0;
																}
															}
															}


													}

												}
											}

											}


										}


									}

								}


							}

			}

			if(eval(totHPlossCurYr.value)>0){

				var hpLossToBeAdjusted=200000;
				if(totHPlossCurYr.value<=hpLossToBeAdjusted){
					hpLossToBeAdjusted=totHPlossCurYr.value;
				}


				(eval(busIncOfCurYrUnderThatHead.value)- eval(busOthSrcLossNoRaceHorseSetoff.value))>=eval(hpLossToBeAdjusted) ?
				(busHPlossCurYrSetoff.value=hpLossToBeAdjusted) :
				(busHPlossCurYrSetoff.value=(eval(busIncOfCurYrUnderThatHead.value)- eval(busOthSrcLossNoRaceHorseSetoff.value)));
				hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(busHPlossCurYrSetoff.value);

				if(eval(hpLossToBeAdjusted)>0){

					(eval(specltvIncOfCurYrUnderThatHead.value)-eval(specltvOthSrcLossNoRaceHorseSetoff.value)) >=hpLossToBeAdjusted ?
					(specltvHPlossCurYrSetoff.value=hpLossToBeAdjusted) :
					(specltvHPlossCurYrSetoff.value=(eval(specltvIncOfCurYrUnderThatHead.value)-eval(specltvOthSrcLossNoRaceHorseSetoff.value)));

					hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(specltvHPlossCurYrSetoff.value);

					if(eval(hpLossToBeAdjusted)>0){

						(eval(specfidIncOfCurYrUnderThatHead.value)-eval(specfidOthSrcLossNoRaceHorseSetoff.value)) >=eval(hpLossToBeAdjusted) ?
						(specfidHPlossCurYrSetoff.value=hpLossToBeAdjusted) :
						(specfidHPlossCurYrSetoff.value=(eval(specfidIncOfCurYrUnderThatHead.value)-eval(specfidOthSrcLossNoRaceHorseSetoff.value)));

						hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(specfidHPlossCurYrSetoff.value);

						if(eval(hpLossToBeAdjusted)>0){

							(eval(othSrcIncOfCurYrUnderThatHead.value)-eval(othSrcBusLossSetoff.value)) >=eval(hpLossToBeAdjusted) ?
							(othSrcHPlossCurYrSetoff.value=hpLossToBeAdjusted) :
							(othSrcHPlossCurYrSetoff.value=(eval(othSrcIncOfCurYrUnderThatHead.value)-eval(othSrcBusLossSetoff.value)));

							hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(othSrcHPlossCurYrSetoff.value);

							if(eval(hpLossToBeAdjusted)>0){

								(eval(profitFrmRaceHorseIncOfCurYrUnderThatHead.value)-eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value) -eval(profitFrmRaceHorseBusLossSetoff.value)) >=hpLossToBeAdjusted ?
								(profitFrmRaceHorseHPlossCurYrSetoff.value=hpLossToBeAdjusted) :
								(profitFrmRaceHorseHPlossCurYrSetoff.value=(eval(profitFrmRaceHorseIncOfCurYrUnderThatHead.value)-eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value)-eval(profitFrmRaceHorseBusLossSetoff.value)));

								hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(profitFrmRaceHorseHPlossCurYrSetoff.value);

								if(eval(hpLossToBeAdjusted)>0){
											var setOffRemainSTCG  = eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value)-eval(stcgBusLossSetoff.value);

											if(parseInt(setOffRemainSTCG,10) >0 && parseInt(A2eA3A4A5bRemain,10)>0){
												if(eval(A2eA3A4A5bRemain)<= eval(hpLossToBeAdjusted)){

													stcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(A2eA3A4A5bRemain),stcgIncOfCurYrUnderThatHead.value));
													A2eA3A4A5bRemain=0;

												}else{

													stcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(hpLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
													A2eA3A4A5bRemain=eval(parseInt(A2eA3A4A5bRemain,10) - parseInt(hpLossToBeAdjusted,10));
												}
												hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(stcgHPlossCurYrSetoff.value);

											}

											if(eval(hpLossToBeAdjusted) > 0){

												if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value)-eval(ltcgBusLossSetoff.value))>0){

													if(eval(B3bRemain)<=eval(hpLossToBeAdjusted)){
														ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(B3bRemain),ltcgIncOfCurYrUnderThatHead.value));
														hpLossToBeAdjusted=eval(hpLossToBeAdjusted) - eval(B3bRemain);
														B3bRemain = 0;
													}else{
														ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(hpLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
														B3bRemain = eval(B3bRemain)-eval(ltcgHPlossCurYrSetoff.value);
														hpLossToBeAdjusted=0;
													}

												}


												if(eval(hpLossToBeAdjusted) > 0){
												if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value)-eval(ltcgBusLossSetoff.value))>0){

													if(eval(B1eRemain)<=eval(hpLossToBeAdjusted)){
														
														ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value) + eval(B1eRemain),ltcgIncOfCurYrUnderThatHead.value));
														hpLossToBeAdjusted=eval(hpLossToBeAdjusted) - eval(B1eRemain);
														B1eRemain = 0;

													}else{

														ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(hpLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
														B1eRemain = eval(B1eRemain)-eval(hpLossToBeAdjusted);
														hpLossToBeAdjusted=0;
													}
												}
												}
												
												if(eval(hpLossToBeAdjusted)>0){

													if((eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgHPlossCurYrSetoff.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value)-eval(stcgBusLossSetoff.value))>0){
															if(eval(A5aRemain)<=eval(hpLossToBeAdjusted)){
																stcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(stcgHPlossCurYrSetoff.value)+eval(A5aRemain),stcgIncOfCurYrUnderThatHead.value));
																hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(A5aRemain);
																A5aRemain = 0;
															}else{
																stcgHPlossCurYrSetoff.value = zeroOrMore(Math.min(eval(stcgHPlossCurYrSetoff.value)+eval(hpLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
																A5aRemain = eval(A5aRemain) - eval(hpLossToBeAdjusted);
																hpLossToBeAdjusted=0;
															}
													}

												if(eval(hpLossToBeAdjusted)>0){

													if((eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgHPlossCurYrSetoff.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value)-eval(stcgBusLossSetoff.value))>0){

														if(eval(A1eRemain)<= eval(hpLossToBeAdjusted)){

															stcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(stcgHPlossCurYrSetoff.value)+eval(A1eRemain),stcgIncOfCurYrUnderThatHead.value));
															hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(A1eRemain);
															A1eRemain = 0;
														}else{

															stcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(stcgHPlossCurYrSetoff.value)+eval(hpLossToBeAdjusted),stcgIncOfCurYrUnderThatHead.value));
															A1eRemain = eval(A1eRemain) - eval(hpLossToBeAdjusted);
															hpLossToBeAdjusted=0;
														}


													}
													if(eval(hpLossToBeAdjusted) > 0){
														
														if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgHPlossCurYrSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value)-eval(ltcgBusLossSetoff.value))>0){
															if(eval(B3aRemain)<=eval(hpLossToBeAdjusted)){

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(B3aRemain),ltcgIncOfCurYrUnderThatHead.value));
																hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(B3aRemain);
																B3aRemain = 0;
															}else{

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(hpLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																B3aRemain = eval(B3aRemain) - eval(hpLossToBeAdjusted);
																hpLossToBeAdjusted=0;

															}
														}													
													
													/*if(eval(hpLossToBeAdjusted) > 0){

														if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgHPlossCurYrSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value)-eval(ltcgBusLossSetoff.value))>0){

															if(eval(B2eRemain)<=eval(hpLossToBeAdjusted)){

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(B2eRemain),ltcgIncOfCurYrUnderThatHead.value));
																hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(B2eRemain);
																B2eRemain = 0;
															}else{

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(hpLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																B2eRemain = eval(B2eRemain) - eval(hpLossToBeAdjusted);
																hpLossToBeAdjusted=0;

															}

														}

													}*/
													if(eval(hpLossToBeAdjusted) > 0){

														if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgHPlossCurYrSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value)-eval(ltcgBusLossSetoff.value))>0){

															if(eval(B2d1Remain)<=eval(hpLossToBeAdjusted)){

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(B2d1Remain),ltcgIncOfCurYrUnderThatHead.value));
																hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(B2d1Remain);
																B2d1Remain = 0;
															}else{

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(hpLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																B2d1Remain = eval(B2d1Remain) - eval(hpLossToBeAdjusted);
																hpLossToBeAdjusted=0;

															}

														}

													}
													if(eval(hpLossToBeAdjusted) > 0){

														if((eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgHPlossCurYrSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value)-eval(ltcgBusLossSetoff.value))>0){

															if(eval(B2d2Remain)<=eval(hpLossToBeAdjusted)){

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(B2d2Remain),ltcgIncOfCurYrUnderThatHead.value));
																hpLossToBeAdjusted=eval(hpLossToBeAdjusted)-eval(B2d2Remain);
																B2d2Remain = 0;
															}else{

																ltcgHPlossCurYrSetoff.value=zeroOrMore(Math.min(eval(ltcgHPlossCurYrSetoff.value)+eval(hpLossToBeAdjusted),ltcgIncOfCurYrUnderThatHead.value));
																B2d2Remain = eval(B2d2Remain) - eval(hpLossToBeAdjusted);
																hpLossToBeAdjusted=0;

															}

														}

													}
												}

												}

												}

											}
								}


							}


						}

					}

				}

			}

			totHPlossCurYrSetoff.value=eval(busHPlossCurYrSetoff.value)+eval(specltvHPlossCurYrSetoff.value)+eval(specfidHPlossCurYrSetoff.value)+eval(stcgHPlossCurYrSetoff.value)+eval(ltcgHPlossCurYrSetoff.value)+eval(othSrcHPlossCurYrSetoff.value)+eval(profitFrmRaceHorseHPlossCurYrSetoff.value);
			hpBusLossSetoff.value=parseInt(hpBusLossSetoff.value);

			totBusLossSetoff.value=eval(hpBusLossSetoff.value)+eval(stcgBusLossSetoff.value)+eval(ltcgBusLossSetoff.value)+eval(othSrcBusLossSetoff.value)+eval(profitFrmRaceHorseBusLossSetoff.value);

			totOthSrcLossNoRaceHorseSetoff.value =eval(hpOthSrcLossNoRaceHorseSetoff.value)+eval(busOthSrcLossNoRaceHorseSetoff.value)+eval(specltvOthSrcLossNoRaceHorseSetoff.value)+eval(specfidOthSrcLossNoRaceHorseSetoff.value)+eval(stcgOthSrcLossNoRaceHorseSetoff.value)+eval(ltcgOthSrcLossNoRaceHorseSetoff.value)+eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);


			hpIncOfCurYrAfterSetOff.value=eval(hpIncOfCurYrUnderThatHead.value)-eval(hpBusLossSetoff.value)-eval(hpOthSrcLossNoRaceHorseSetoff.value);

			busIncOfCurYrAfterSetOff.value=eval(busIncOfCurYrUnderThatHead.value)-eval(busOthSrcLossNoRaceHorseSetoff.value)-eval(busHPlossCurYrSetoff.value);


			specltvIncOfCurYrAfterSetOff.value =eval(specltvIncOfCurYrUnderThatHead.value)-eval(specltvHPlossCurYrSetoff.value)-eval(specltvOthSrcLossNoRaceHorseSetoff.value);

			specfidIncOfCurYrAfterSetOff.value=eval(specfidIncOfCurYrUnderThatHead.value )-eval(specfidHPlossCurYrSetoff.value)-eval(specfidOthSrcLossNoRaceHorseSetoff.value);

			stcgIncOfCurYrAfterSetOff.value=eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgHPlossCurYrSetoff.value)-eval(stcgBusLossSetoff.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value);

			ltcgIncOfCurYrAfterSetOff.value=eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgHPlossCurYrSetoff.value)-eval(ltcgBusLossSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value);

			othSrcIncOfCurYrAfterSetOff.value=eval(othSrcIncOfCurYrUnderThatHead.value)-eval(othSrcHPlossCurYrSetoff.value)-eval(othSrcBusLossSetoff.value);

			profitFrmRaceHorseIncOfCurYrAfterSetOff.value=eval(profitFrmRaceHorseIncOfCurYrUnderThatHead.value)-eval(profitFrmRaceHorseHPlossCurYrSetoff.value)-eval(profitFrmRaceHorseBusLossSetoff.value)-eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);



			balBusLossAftSetoff.value=eval(totBusLoss.value) -eval(totBusLossSetoff.value);

			balOthSrcLossNoRaceHorseAftSetoff.value=eval(totOthSrcLossNoRaceHorse.value)-eval(totOthSrcLossNoRaceHorseSetoff.value);

			var Inc7Remain = document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE')[0].value;
			var splRateInc7 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].splRateInc')[0]; splRateInc7.value = coalesce(splRateInc7.value);
			splRateInc7.value=zeroOrMore(Inc7Remain);

			var taxNRI115BBA = parseInt('0', 10);
			var taxNRI115BBD = parseInt('0', 10);

			var sum2d115A=0,sum2e115A=0,sum2dinRec115A=0,sum2einRec115A=0,sum2dParaEII=0,sum2eParaEII=0,sum2dintDebt=0,sum2eintDebt=0,sum2d194LC=0,sum2e194LC=0,sum2dUTIunit=0,sum2eUTIunit=0,sum2dShore=0,sum2d3=0,sum2e3=0,sum2d4=0,sum2e4=0;
			var sum2eShore=0,sum2dBBA=0,sum2eBBA=0,sum2dBBD=0,sum2eBBD=0,sum2dFIIAB=0,sum2eFIIAB=0,sum2dFIILD=0,sum2eFIILD=0,sum2dInt194LD=0,sum2eInt194LD=0,sum2dInt194LBA=0,sum2eInt194LBA=0,sum2d1=0,sum2e1=0,sum2d2=0,sum2e2=0,sum2d5=0,sum2e5=0;

			var divIncome115A = parseInt('0', 10);
			var intReceieved115A = parseInt('0', 10);
			var paraEIIofPart1 = parseInt('0', 10);
			var intDebtFund115A = parseInt('0', 10);
			var intAsPerSec194LC = parseInt('0', 10);
			var incRecvUTIUnit = parseInt('0', 10);
			var incwrtOfShoreFund = parseInt('0', 10);
			var taxNRI115BBA = parseInt('0', 10);
			var taxNRI115BBD = parseInt('0', 10);
			var incFII115AB = parseInt('0', 10);
			var incFII194LD = parseInt('0', 10);
			var interestFII194LD = parseInt('0', 10);
			var interestFII194LBA = parseInt('0', 10);
			var incGDR115AC = parseInt('0', 10);

			var table = document.getElementById('schduleOsinc');
			var rowCountOS = table.rows.length - 3;

			for (var i = 0; i < rowCountOS; i++) {
				var section = document.getElementsByName('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceDescription')[0].value;

				if (section == '5A1ai'){
					sum2d115A = sum2d115A + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5A1aii'){
					sum2dinRec115A = sum2dinRec115A + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'FA'){
					sum2dParaEII = sum2dParaEII + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5A1aiia'){
					sum2dintDebt = sum2dintDebt + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5A1aiiaa'){
					sum2d194LC = sum2d194LC + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5A1aiii'){
					sum2dUTIunit = sum2dUTIunit + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5AB1a'){
					sum2dShore = sum2dShore + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5BBA'){
					sum2dBBA = sum2dBBA + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5BBD'){
					sum2dBBD = sum2dBBD + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5AD1i'){
					sum2dFIIAB = sum2dFIIAB + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5AD1iP'){
					sum2dFIILD = sum2dFIILD + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5A1aiiab'){
					sum2dInt194LD = sum2dInt194LD + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5A1aiiac'){
					sum2dInt194LBA = sum2dInt194LBA + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5A1bA'){
					sum2d1 = sum2d1 + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5BBDA'){
					sum2d2 = sum2d2 + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5BBF'){
					sum2d3 = sum2d3 + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5BBG'){
					sum2d4 = sum2d4 + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == '5AC1ab'){
					sum2d5 = sum2d5 + coalesceSetRet('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls[' + i + '].sourceAmount');
				}

			}

			var sum2dPTI1=0,sum2ePTI1=0,sum2dPTI2=0,sum2ePTI2=0,sum2dPTI3=0,sum2ePTI3=0,sum2dPTI4=0,sum2ePTI4=0,sum2dPTI5=0,sum2ePTI5=0,sum2dPTI6=0,sum2ePTI6=0,sum2dPTI7=0,sum2ePTI7=0,sum2dPTI8=0,sum2ePTI8=0,sum2dPTI9=0,sum2ePTI9=0,sum2e6=0;
			var sum2dPTI10=0,sum2ePTI10=0,sum2dPTI11=0,sum2ePTI11=0,sum2dPTI12=0,sum2ePTI12=0,sum2dPTI13=0,sum2ePTI13=0,sum2dPTI14=0,sum2ePTI14=0,sum2dPTI15=0,sum2ePTI15=0,sum2dPTI16=0,sum2ePTI16=0,sum2dPTI17=0,sum2ePTI17=0,sum2dPTI18=0,sum2ePTI18=0;

			var table = document.getElementById('schduleOsincPti');
			var rowCountOS = table.rows.length - 3;

			for (var i = 0; i < rowCountOS; i++) {
				var section = document.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceDescription')[0].value;

				if (section == 'PTI_5A1ai'){
					sum2dPTI1 = sum2dPTI1 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5A1aii'){
					sum2dPTI2 = sum2dPTI2 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5A1aiia'){
					sum2dPTI3 = sum2dPTI3 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5A1aiiaa'){
					sum2dPTI4 = sum2dPTI4 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5A1aiiab'){
					sum2dPTI5 = sum2dPTI5 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5A1aiiac'){
					sum2dPTI6 = sum2dPTI6 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5A1aiii'){
					sum2dPTI7 = sum2dPTI7 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_FA'){
					sum2dPTI8 = sum2dPTI8 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5A1bA'){
					sum2dPTI9 = sum2dPTI9 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5AC1ab'){
					sum2dPTI10 = sum2dPTI10 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5AD1i'){
					sum2dPTI11 = sum2dPTI11 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5AD1iP'){
					sum2dPTI12 = sum2dPTI12 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5BBA'){
					sum2dPTI13 = sum2dPTI13 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5BBD'){
					sum2dPTI14 = sum2dPTI14 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5BBDA'){
					sum2dPTI15 = sum2dPTI15 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5BBF'){
					sum2dPTI16 = sum2dPTI16 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5BBG'){
					sum2dPTI17 = sum2dPTI17 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}else if(section == 'PTI_5AB1a'){
					sum2dPTI18 = sum2dPTI18 + coalesceSetRet('itr7.scheduleOS.schduleOsincPti.othersGrossDtls[' + i + '].sourceAmount');
				}


			}

			var table1 =  document.getElementById('scheduleOsNriIncTaxDtaa');
			var rowCount = table1.rows.length - 2;
			var residentialStatus = document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value;
			for (var i = 0; i < rowCount; i++) {
				var section = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].itemIncluded')[0].value;
				var taxResidCertFlag = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].taxResidCertFlag')[0].value;
				if(residentialStatus=='NRI')
				{
					if(taxResidCertFlag=='Y')
					{
					if (section == '5A1ai'){
						sum2e115A = sum2e115A + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aii'){
						sum2einRec115A = sum2einRec115A + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'FA'){
						sum2eParaEII = sum2eParaEII + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiia'){
						sum2eintDebt = sum2eintDebt + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiiaa'){
						sum2e194LC = sum2e194LC + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiii'){
						sum2eUTIunit = sum2eUTIunit + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AB1a'){
						sum2eShore = sum2eShore + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBA'){
						sum2eBBA = sum2eBBA + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBD'){
						sum2eBBD = sum2eBBD + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AD1i'){
						sum2eFIIAB = sum2eFIIAB + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AD1iP'){
						sum2eFIILD = sum2eFIILD + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiiab'){
						sum2eInt194LD = sum2eInt194LD + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiiac'){
						sum2eInt194LBA = sum2eInt194LBA + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1ai'){
						sum2ePTI1 = sum2ePTI1 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aii'){
						sum2ePTI2 = sum2ePTI2 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiia'){
						sum2ePTI3 = sum2ePTI3 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiiaa'){
						sum2ePTI4 = sum2ePTI4 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiiab'){
						sum2ePTI5 = sum2ePTI5 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiiac'){
						sum2ePTI6 = sum2ePTI6 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiii'){
						sum2ePTI7 = sum2ePTI7 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_FA'){
						sum2ePTI8 = sum2ePTI8 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1bA'){
						sum2ePTI9 = sum2ePTI9 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AC1ab'){
						sum2ePTI10 = sum2ePTI10 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AD1i'){
						sum2ePTI11 = sum2ePTI11 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AD1iP'){
						sum2ePTI12 = sum2ePTI12 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBA'){
						sum2ePTI13 = sum2ePTI13 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBD'){
						sum2ePTI14 = sum2ePTI14 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBDA'){
						sum2ePTI15 = sum2ePTI15 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBF'){
						sum2ePTI16 = sum2ePTI16 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBG'){
						sum2ePTI17 = sum2ePTI17 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AB1a'){
						sum2ePTI18 = sum2ePTI18 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1bA'){
						sum2e1 = sum2e1 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBDA'){
						sum2e2 = sum2e2 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBF'){
						sum2e3 = sum2e3 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBG'){
						sum2e4 = sum2e4 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AC1ab'){
						sum2e5 = sum2e5 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BB'){
						sum2e6 = sum2e6 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}
					
					}
				}
				else
				{
					if (section == '5A1ai'){
						sum2e115A = sum2e115A + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aii'){
						sum2einRec115A = sum2einRec115A + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'FA'){
						sum2eParaEII = sum2eParaEII + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiia'){
						sum2eintDebt = sum2eintDebt + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiiaa'){
						sum2e194LC = sum2e194LC + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiii'){
						sum2eUTIunit = sum2eUTIunit + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AB1a'){
						sum2eShore = sum2eShore + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBA'){
						sum2eBBA = sum2eBBA + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBD'){
						sum2eBBD = sum2eBBD + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AD1i'){
						sum2eFIIAB = sum2eFIIAB + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AD1iP'){
						sum2eFIILD = sum2eFIILD + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiiab'){
						sum2eInt194LD = sum2eInt194LD + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1aiiac'){
						sum2eInt194LBA = sum2eInt194LBA + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1ai'){
						sum2ePTI1 = sum2ePTI1 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aii'){
						sum2ePTI2 = sum2ePTI2 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiia'){
						sum2ePTI3 = sum2ePTI3 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiiaa'){
						sum2ePTI4 = sum2ePTI4 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiiab'){
						sum2ePTI5 = sum2ePTI5 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiiac'){
						sum2ePTI6 = sum2ePTI6 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1aiii'){
						sum2ePTI7 = sum2ePTI7 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_FA'){
						sum2ePTI8 = sum2ePTI8 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5A1bA'){
						sum2ePTI9 = sum2ePTI9 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AC1ab'){
						sum2ePTI10 = sum2ePTI10 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AD1i'){
						sum2ePTI11 = sum2ePTI11 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AD1iP'){
						sum2ePTI12 = sum2ePTI12 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBA'){
						sum2ePTI13 = sum2ePTI13 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBD'){
						sum2ePTI14 = sum2ePTI14 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBDA'){
						sum2ePTI15 = sum2ePTI15 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBF'){
						sum2ePTI16 = sum2ePTI16 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5BBG'){
						sum2ePTI17 = sum2ePTI17 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == 'PTI_5AB1a'){
						sum2ePTI18 = sum2ePTI18 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5A1bA'){
						sum2e1 = sum2e1 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBDA'){
						sum2e2 = sum2e2 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBF'){
						sum2e3 = sum2e3 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BBG'){
						sum2e4 = sum2e4 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5AC1ab'){
						sum2e5 = sum2e5 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}else if(section == '5BB'){
						sum2e6 = sum2e6 + coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa[' + i + '].amount');
					}
				}
			}

			var divIncPTI115A = parseInt('0', 10);
			var intRcvdPTI = parseInt('0', 10);
			var intFundPTI115A = parseInt('0', 10);
			var intPTI194LC = parseInt('0', 10);
			var intPTI194LD = parseInt('0', 10);
			var intPTI194LBA = parseInt('0', 10);
			var incUTIPTI115A = parseInt('0', 10);
			var paraEIIPTIFA = parseInt('0', 10);
			var incRoyaltyPTI115A = parseInt('0', 10);
			var incGDRPTI115AC = parseInt('0', 10);
			var incRcvdPTI115AB = parseInt('0', 10);
			var incRcvdPTI194LD = parseInt('0', 10);
			var incRcvdIndian = parseInt('0', 10);
			var inc115BBDA = parseInt('0', 10);
			var inc115BBF = parseInt('0', 10);
			var inc115BBG = parseInt('0', 10);
			var race115BB = parseInt('0', 10);
			var taxPTI115BBA = parseInt('0', 10);
			var taxPTI115BBD = parseInt('0', 10);
			var taxPTI115BBDA = parseInt('0', 10);
			var taxPTI115BBF = parseInt('0', 10);
			var taxPTI115BBG = parseInt('0', 10);
			var incRsptPTI115AB = parseInt('0', 10);

			// sum2dInt194LD
			divIncome115A = eval(parseInt(sum2d115A) - parseInt(sum2e115A));
			intReceieved115A = eval(parseInt(sum2dinRec115A) - parseInt(sum2einRec115A));
			paraEIIofPart1 = eval(parseInt(sum2dParaEII) - parseInt(sum2eParaEII));
			
			intDebtFund115A = eval(parseInt(sum2dintDebt) - parseInt(sum2eintDebt));
			intAsPerSec194LC = eval(parseInt(sum2d194LC) - parseInt(sum2e194LC));
			incRecvUTIUnit = eval(parseInt(sum2dUTIunit) - parseInt(sum2eUTIunit));
			incwrtOfShoreFund = eval(parseInt(sum2dShore) - parseInt(sum2eShore));
			taxNRI115BBA = eval(parseInt(sum2dBBA) - parseInt(sum2eBBA));
			taxNRI115BBD = eval(parseInt(sum2dBBD) - parseInt(sum2eBBD));
			incFII115AB = eval(parseInt(sum2dFIIAB) - parseInt(sum2eFIIAB));
			incFII194LD = eval(parseInt(sum2dFIILD) - parseInt(sum2eFIILD));
			interestFII194LD = eval(parseInt(sum2dInt194LD) - parseInt(sum2eInt194LD));
			
			interestFII194LBA = eval(parseInt(sum2dInt194LBA) - parseInt(sum2eInt194LBA));
			incRcvdIndian = eval(parseInt(sum2d1) - parseInt(sum2e1));
			inc115BBDA = eval(parseInt(sum2d2) - parseInt(sum2e2));
			inc115BBF = eval(parseInt(sum2d3) - parseInt(sum2e3));
			inc115BBG = eval(parseInt(sum2d4) - parseInt(sum2e4));
			incGDR115AC = eval(parseInt(sum2d5) - parseInt(sum2e5));

			divIncPTI115A = eval(parseInt(sum2dPTI1) - parseInt(sum2ePTI1));
			intRcvdPTI = eval(parseInt(sum2dPTI2) - parseInt(sum2ePTI2));
			intFundPTI115A = eval(parseInt(sum2dPTI3) - parseInt(sum2ePTI3));
			intPTI194LC = eval(parseInt(sum2dPTI4) - parseInt(sum2ePTI4));
			intPTI194LD = eval(parseInt(sum2dPTI5) - parseInt(sum2ePTI5));
			intPTI194LBA = eval(parseInt(sum2dPTI6) - parseInt(sum2ePTI6));
			incUTIPTI115A = eval(parseInt(sum2dPTI7) - parseInt(sum2ePTI7));
			paraEIIPTIFA = eval(parseInt(sum2dPTI8) - parseInt(sum2ePTI8));
			incRoyaltyPTI115A = eval(parseInt(sum2dPTI9) - parseInt(sum2ePTI9));
			incGDRPTI115AC = eval(parseInt(sum2dPTI10) - parseInt(sum2ePTI10));
			incRcvdPTI115AB = eval(parseInt(sum2dPTI11) - parseInt(sum2ePTI11));
			incRcvdPTI194LD = eval(parseInt(sum2dPTI12) - parseInt(sum2ePTI12));
			taxPTI115BBA = eval(parseInt(sum2dPTI13) - parseInt(sum2ePTI13));
			taxPTI115BBD = eval(parseInt(sum2dPTI14) - parseInt(sum2ePTI14));
			taxPTI115BBDA = eval(parseInt(sum2dPTI15) - parseInt(sum2ePTI15));
			taxPTI115BBF = eval(parseInt(sum2dPTI16) - parseInt(sum2ePTI16));
			taxPTI115BBG = eval(parseInt(sum2dPTI17) - parseInt(sum2ePTI17));
			incRsptPTI115AB = eval(parseInt(sum2dPTI18) - parseInt(sum2ePTI18));
			interestFII194LD = eval(parseInt(sum2dInt194LD) - parseInt(sum2eInt194LD));

			var splRateInc15 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[12].splRateInc')[0]; splRateInc15.value = coalesce(splRateInc15.value);
			splRateInc15.value=zeroOrMore(divIncome115A);
			var splRateIncTax15 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[12].splRateIncTax')[0]; splRateIncTax15.value = coalesce(splRateIncTax15.value);
			splRateIncTax15.value = Math.round((20*eval(parseInt(splRateInc15.value,10)))/parseInt('100' ,10));
			

			var splRateInc6 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[6].splRateInc')[0]; splRateInc6.value = coalesce(splRateInc6.value);
			splRateInc6.value=zeroOrMore(inc115BBDA);
			var splRateIncTax6 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[6].splRateIncTax')[0]; splRateIncTax6.value = coalesce(splRateIncTax6.value);
			splRateIncTax6.value = Math.round((10*eval(parseInt(splRateInc6.value,10)))/parseInt('100' ,10));

			var Inc6Remain = document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.winningFrmLotteries')[0].value;
			var splRateInc5 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[5].splRateInc')[0]; splRateInc5.value = coalesce(splRateInc5.value);
			splRateInc5.value=parseInt(zeroOrMore(Inc6Remain) - parseInt(sum2e6));
			var splRateIncTax5 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[5].splRateIncTax')[0]; splRateIncTax5.value = coalesce(splRateIncTax5.value);
			splRateIncTax5.value = Math.round((30*eval(parseInt(splRateInc5.value,10)))/parseInt('100' ,10));
		
			
			var Inc10Remain = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa.totAmtUnderDtaa')[0].value;
			var splRateInc10 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRateInc')[0]; splRateInc10.value = coalesce(splRateInc10.value);
			splRateInc10.value=zeroOrMore(Inc10Remain);

			var splRateInc16 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[13].splRateInc')[0]; splRateInc16.value = coalesce(splRateInc16.value);
			splRateInc16.value=zeroOrMore(intReceieved115A);
			var splRateIncTax16 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[13].splRateIncTax')[0]; splRateIncTax16.value = coalesce(splRateIncTax16.value);
			splRateIncTax16.value = Math.round((20*eval(parseInt(splRateInc16.value,10)))/parseInt('100' ,10));

			var splRateInc17 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[14].splRateInc')[0]; splRateInc17.value = coalesce(splRateInc17.value);
			splRateInc17.value=zeroOrMore(paraEIIofPart1);
			var splRateIncTax17 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[14].splRateIncTax')[0]; splRateIncTax17.value = coalesce(splRateIncTax17.value);
			splRateIncTax17.value = Math.round((50*eval(parseInt(splRateInc17.value,10)))/parseInt('100' ,10));

			var splRateInc18 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[15].splRateInc')[0]; splRateInc18.value = coalesce(splRateInc18.value);
			splRateInc18.value=zeroOrMore(intDebtFund115A);
			var splRateIncTax18 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[15].splRateIncTax')[0]; splRateIncTax18.value = coalesce(splRateIncTax18.value);
			splRateIncTax18.value = Math.round((5*eval(parseInt(splRateInc18.value,10)))/parseInt('100' ,10));

			var splRateInc19 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[16].splRateInc')[0]; splRateInc19.value = coalesce(splRateInc19.value);
			splRateInc19.value=zeroOrMore(intAsPerSec194LC);
			var splRateIncTax19 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[16].splRateIncTax')[0]; splRateIncTax19.value = coalesce(splRateIncTax19.value);
			splRateIncTax19.value = Math.round((5*eval(parseInt(splRateInc19.value,10)))/parseInt('100' ,10));

			var splRateInc20 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[17].splRateInc')[0]; splRateInc20.value = coalesce(splRateInc20.value);
			splRateInc20.value=zeroOrMore(incRecvUTIUnit);
			var splRateIncTax20 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[17].splRateIncTax')[0]; splRateIncTax20.value = coalesce(splRateIncTax20.value);
			splRateIncTax20.value = Math.round((20*eval(parseInt(splRateInc20.value,10)))/parseInt('100' ,10));

			var splRateInc22 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[19].splRateInc')[0]; splRateInc22.value = coalesce(splRateInc22.value);
			splRateInc22.value=zeroOrMore(incRcvdIndian);
			var splRateIncTax22 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[19].splRateIncTax')[0]; splRateIncTax22.value = coalesce(splRateIncTax22.value);
			splRateIncTax22.value = Math.round((10*eval(parseInt(splRateInc22.value,10)))/parseInt('100' ,10));

			var splRateInc23 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[20].splRateInc')[0]; splRateInc23.value = coalesce(splRateInc23.value);
			splRateInc23.value=zeroOrMore(incwrtOfShoreFund);
			var splRateIncTax23 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[20].splRateIncTax')[0]; splRateIncTax23.value = coalesce(splRateIncTax23.value);
			splRateIncTax23.value = Math.round((10*eval(parseInt(splRateInc23.value,10)))/parseInt('100' ,10));

			var splRateInc25 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[22].splRateInc')[0]; splRateInc25.value = coalesce(splRateInc25.value);
			splRateInc25.value=zeroOrMore(taxNRI115BBA);
			var splRateIncTax25 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[22].splRateIncTax')[0]; splRateIncTax25.value = coalesce(splRateIncTax25.value);
			splRateIncTax25.value = Math.round((20*eval(parseInt(splRateInc25.value,10)))/parseInt('100' ,10));

			var splRateInc26 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[23].splRateInc')[0]; splRateInc26.value = coalesce(splRateInc26.value);
			splRateInc26.value=zeroOrMore(taxNRI115BBD);
			var splRateIncTax26 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[23].splRateIncTax')[0]; splRateIncTax26.value = coalesce(splRateIncTax26.value);
			splRateIncTax26.value = Math.round((15*eval(parseInt(splRateInc26.value,10)))/parseInt('100' ,10));

			var splRateInc27 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[24].splRateInc')[0]; splRateInc27.value = coalesce(splRateInc27.value);
			splRateInc27.value=zeroOrMore(incFII115AB);
			var splRateIncTax27 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[24].splRateIncTax')[0]; splRateIncTax27.value = coalesce(splRateIncTax27.value);
			splRateIncTax27.value = Math.round((20*eval(parseInt(splRateInc27.value,10)))/parseInt('100' ,10));

			var splRateInc28 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[25].splRateInc')[0]; splRateInc28.value = coalesce(splRateInc28.value);
			splRateInc28.value=zeroOrMore(incFII194LD);
			var splRateIncTax28 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[25].splRateIncTax')[0]; splRateIncTax28.value = coalesce(splRateIncTax28.value);
			splRateIncTax28.value = Math.round((5*eval(parseInt(splRateInc28.value,10)))/parseInt('100' ,10));

			var splRateInc32 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[29].splRateInc')[0]; splRateInc32.value = coalesce(splRateInc32.value);
			splRateInc32.value=zeroOrMore(incGDR115AC);
			var splRateIncTax32 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[29].splRateIncTax')[0]; splRateIncTax32.value = coalesce(splRateIncTax32.value);
			splRateIncTax32.value = Math.round((10*eval(parseInt(splRateInc32.value,10)))/parseInt('100' ,10));

			var splRateInc33 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[30].splRateInc')[0]; splRateInc33.value = coalesce(splRateInc33.value);
			splRateInc33.value=zeroOrMore(interestFII194LD);
			var splRateIncTax33 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[30].splRateIncTax')[0]; splRateIncTax33.value = coalesce(splRateIncTax33.value);
			splRateIncTax33.value = Math.round((5*eval(parseInt(splRateInc33.value,10)))/parseInt('100' ,10));

			var splRateInc34 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[31].splRateInc')[0]; splRateInc34.value = coalesce(splRateInc34.value);
			splRateInc34.value=zeroOrMore(interestFII194LBA);
			var splRateIncTax34 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[31].splRateIncTax')[0]; splRateIncTax34.value = coalesce(splRateIncTax34.value);
			splRateIncTax34.value = Math.round((5*eval(parseInt(splRateInc34.value,10)))/parseInt('100' ,10));

			var splRateInc36 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[34].splRateInc')[0]; splRateInc36.value = coalesce(splRateInc36.value);
			splRateInc36.value=zeroOrMore(divIncPTI115A);
			var splRateIncTax36 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[34].splRateIncTax')[0]; splRateIncTax36.value = coalesce(splRateIncTax36.value);
			splRateIncTax36.value = Math.round((20*eval(parseInt(splRateInc36.value,10)))/parseInt('100' ,10));

			var splRateInc37 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[35].splRateInc')[0]; splRateInc37.value = coalesce(splRateInc37.value);
			splRateInc37.value=zeroOrMore(intRcvdPTI);
			var splRateIncTax37 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[35].splRateIncTax')[0]; splRateIncTax37.value = coalesce(splRateIncTax37.value);
			splRateIncTax37.value = Math.round((20*eval(parseInt(splRateInc37.value,10)))/parseInt('100' ,10));

			var splRateInc38 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[36].splRateInc')[0]; splRateInc38.value = coalesce(splRateInc38.value);
			splRateInc38.value=zeroOrMore(intFundPTI115A);
			var splRateIncTax38 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[36].splRateIncTax')[0]; splRateIncTax38.value = coalesce(splRateIncTax38.value);
			splRateIncTax38.value = Math.round((5*eval(parseInt(splRateInc38.value,10)))/parseInt('100' ,10));

			var splRateInc39 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[37].splRateInc')[0]; splRateInc39.value = coalesce(splRateInc39.value);
			splRateInc39.value=zeroOrMore(intPTI194LC);
			var splRateIncTax39 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[37].splRateIncTax')[0]; splRateIncTax39.value = coalesce(splRateIncTax39.value);
			splRateIncTax39.value = Math.round((5*eval(parseInt(splRateInc39.value,10)))/parseInt('100' ,10));

			var splRateInc40 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[38].splRateInc')[0]; splRateInc40.value = coalesce(splRateInc40.value);
			splRateInc40.value=zeroOrMore(intPTI194LD);
			var splRateIncTax40 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[38].splRateIncTax')[0]; splRateIncTax40.value = coalesce(splRateIncTax40.value);
			splRateIncTax40.value = Math.round((5*eval(parseInt(splRateInc40.value,10)))/parseInt('100' ,10));

			var splRateInc41 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[39].splRateInc')[0]; splRateInc41.value = coalesce(splRateInc41.value);
			splRateInc41.value=zeroOrMore(intPTI194LBA);
			var splRateIncTax41 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[39].splRateIncTax')[0]; splRateIncTax41.value = coalesce(splRateIncTax41.value);
			splRateIncTax41.value = Math.round((5*eval(parseInt(splRateInc41.value,10)))/parseInt('100' ,10));

			var splRateInc42 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[40].splRateInc')[0]; splRateInc42.value = coalesce(splRateInc42.value);
			splRateInc42.value=zeroOrMore(incUTIPTI115A);
			var splRateIncTax42 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[40].splRateIncTax')[0]; splRateIncTax42.value = coalesce(splRateIncTax42.value);
			splRateIncTax42.value = Math.round((20*eval(parseInt(splRateInc42.value,10)))/parseInt('100' ,10));

			var splRateInc43 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[41].splRateInc')[0]; splRateInc43.value = coalesce(splRateInc43.value);
			splRateInc43.value=zeroOrMore(paraEIIPTIFA);
			var splRateIncTax43 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[41].splRateIncTax')[0]; splRateIncTax43.value = coalesce(splRateIncTax43.value);
			splRateIncTax43.value = Math.round((50*eval(parseInt(splRateInc43.value,10)))/parseInt('100' ,10));

			var splRateInc44 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[42].splRateInc')[0]; splRateInc44.value = coalesce(splRateInc44.value);
			splRateInc44.value=zeroOrMore(incRoyaltyPTI115A);
			var splRateIncTax44 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[42].splRateIncTax')[0]; splRateIncTax44.value = coalesce(splRateIncTax44.value);
			splRateIncTax44.value = Math.round((10*eval(parseInt(splRateInc44.value,10)))/parseInt('100' ,10));

			var splRateInc45 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[43].splRateInc')[0]; splRateInc45.value = coalesce(splRateInc45.value);
			splRateInc45.value=zeroOrMore(incGDRPTI115AC);
			var splRateIncTax45 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[43].splRateIncTax')[0]; splRateIncTax45.value = coalesce(splRateIncTax45.value);
			splRateIncTax45.value = Math.round((10*eval(parseInt(splRateInc45.value,10)))/parseInt('100' ,10));

			var splRateInc46 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[44].splRateInc')[0]; splRateInc46.value = coalesce(splRateInc46.value);
			splRateInc46.value=zeroOrMore(incRcvdPTI115AB);
			var splRateIncTax46 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[44].splRateIncTax')[0]; splRateIncTax46.value = coalesce(splRateIncTax46.value);
			splRateIncTax46.value = Math.round((20*eval(parseInt(splRateInc46.value,10)))/parseInt('100' ,10));

			var splRateInc47 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[45].splRateInc')[0]; splRateInc47.value = coalesce(splRateInc47.value);
			splRateInc47.value=zeroOrMore(incRcvdPTI194LD);
			var splRateIncTax47 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[45].splRateIncTax')[0]; splRateIncTax47.value = coalesce(splRateIncTax47.value);
			splRateIncTax47.value = Math.round((5*eval(parseInt(splRateInc47.value,10)))/parseInt('100' ,10));

			var splRateInc48 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[46].splRateInc')[0]; splRateInc48.value = coalesce(splRateInc48.value);
			splRateInc48.value=zeroOrMore(taxPTI115BBA);
			var splRateIncTax48 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[46].splRateIncTax')[0]; splRateIncTax48.value = coalesce(splRateIncTax48.value);
			splRateIncTax48.value = Math.round((20*eval(parseInt(splRateInc48.value,10)))/parseInt('100' ,10));

			var splRateInc49 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[47].splRateInc')[0]; splRateInc49.value = coalesce(splRateInc49.value);
			splRateInc49.value=zeroOrMore(taxPTI115BBD);
			var splRateIncTax49 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[47].splRateIncTax')[0]; splRateIncTax49.value = coalesce(splRateIncTax49.value);
			splRateIncTax49.value = Math.round((15*eval(parseInt(splRateInc49.value,10)))/parseInt('100' ,10));

			var splRateInc50 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[48].splRateInc')[0]; splRateInc50.value = coalesce(splRateInc50.value);
			splRateInc50.value=zeroOrMore(taxPTI115BBDA);
			var splRateIncTax50 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[48].splRateIncTax')[0]; splRateIncTax50.value = coalesce(splRateIncTax50.value);
			splRateIncTax50.value = Math.round((10*eval(parseInt(splRateInc50.value,10)))/parseInt('100' ,10));

			var splRateInc53 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[49].splRateInc')[0]; splRateInc53.value = coalesce(splRateInc53.value);
			splRateInc53.value=zeroOrMore(incRsptPTI115AB);
			var splRateIncTax53 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[49].splRateIncTax')[0]; splRateIncTax53.value = coalesce(splRateIncTax53.value);
			splRateIncTax53.value = Math.round((10*eval(parseInt(splRateInc53.value,10)))/parseInt('100' ,10));

			// itr7.scheduleSI.splCodeRateTax[0].splRateInc
			// itr7.scheduleSI.splCodeRateTax[0].splRateIncTax
			var splRateInc00 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateInc')[0]; splRateInc00.value = coalesce(splRateInc00.value);
			var splRateIncTax00 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateIncTax')[0]; splRateIncTax00.value = coalesce(splRateIncTax00.value);

			var splRateInc01 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[1].splRateInc')[0]; splRateInc01.value = coalesce(splRateInc01.value);
			var splRateIncTax01 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[1].splRateIncTax')[0]; splRateIncTax01.value = coalesce(splRateIncTax01.value);

			var splRateInc02 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[2].splRateInc')[0]; splRateInc02.value = coalesce(splRateInc02.value);
			var splRateIncTax02 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[2].splRateIncTax')[0]; splRateIncTax02.value = coalesce(splRateIncTax02.value);

			var splRateInc03 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateInc')[0]; splRateInc03.value = coalesce(splRateInc03.value);
			var splRateIncTax03 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateIncTax')[0]; splRateIncTax03.value = coalesce(splRateIncTax03.value);

			
			 var splRateInc04 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[4].splRateInc')[0]; splRateInc04.value = coalesce(splRateInc04.value);
			 var splRateIncTax04 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[4].splRateIncTax')[0]; splRateIncTax04.value = coalesce(splRateIncTax04.value);
			 
			var splRateInc11 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].splRateInc')[0]; splRateInc11.value = coalesce(splRateInc11.value);
			var splRateIncTax11 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].splRateIncTax')[0]; splRateIncTax11.value = coalesce(splRateIncTax11.value);

			var splRateInc12 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].splRateInc')[0]; splRateInc12.value = coalesce(splRateInc12.value);
			var splRateIncTax12 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].splRateIncTax')[0]; splRateIncTax12.value = coalesce(splRateIncTax12.value);

			var splRateInc13 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].splRateInc')[0]; splRateInc13.value = coalesce(splRateInc13.value);
			var splRateIncTax13 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].splRateIncTax')[0]; splRateIncTax13.value = coalesce(splRateIncTax13.value);

			var totSplRateInc =0;

			// alert('totSplRateInctotSplRateInc '+totSplRateInc);

			var totSplRateIncTax =0;



			var noofRows = document.getElementById('scheduleSI').rows.length;
			
			for(var i=0; i<(noofRows-3);i++){
								
				totSplRateInc = totSplRateInc + getAmt('itr7.scheduleSI.splCodeRateTax['+i+'].splRateInc');
				totSplRateIncTax = totSplRateIncTax + getAmt('itr7.scheduleSI.splCodeRateTax['+i+'].splRateIncTax')
			}
			document.getElementsByName('itr7.scheduleSI.totSplRateInc')[0].value = zeroOrMore(totSplRateInc);
			document.getElementsByName('itr7.scheduleSI.totSplRateIncTax')[0].value = zeroOrMore(totSplRateIncTax);


			//schSIChangeIncome(B1eRemain,A1eRemain,B2eRemain,called);
			schSIChangeIncome(B1eRemain,A1eRemain,B2d1Remain,B2d2Remain,B3bRemain,A5aRemain,B3aRemain,stcgIncOfCurYrAfterSetOff,ltcgIncOfCurYrAfterSetOff,called);



			balHPlossCurYrAftSetoff.value=eval(totHPlossCurYr.value)-eval(totHPlossCurYrSetoff.value);

	}



function commonCalcCYLA(incOfCurrYr,lossToBeAdjusted,incRemainAftrSetoff,totalLossSetOff,fieldName){


	if(eval(incOfCurrYr) < eval(incRemainAftrSetoff) || eval(lossToBeAdjusted) < eval(totalLossSetOff)){

		fieldName.value=fieldName.oldvalue;

	}
}

function calculateCYLA(fieldName){

var hpIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.incOfCurYrUnderThatHead')[0]; hpIncOfCurYrUnderThatHead.value = coalesce(hpIncOfCurYrUnderThatHead.value);
var incomeUnderIncFrmHp = document.getElementsByName('scheduleHP.incomeUnderIncFrmHp')[0]; incomeUnderIncFrmHp.value = coalesce(incomeUnderIncFrmHp.value);
var hpBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.busLossSetoff')[0];  hpBusLossSetoff.value = coalesce(hpBusLossSetoff.value);
var hpOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; hpOthSrcLossNoRaceHorseSetoff.value = coalesce(hpOthSrcLossNoRaceHorseSetoff.value);
var hpIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.houseProperty.incCYLA.incOfCurYrAfterSetOff')[0]; hpIncOfCurYrAfterSetOff.value = coalesce(hpIncOfCurYrAfterSetOff.value);
var busIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrUnderThatHead')[0]; busIncOfCurYrUnderThatHead.value = coalesce(busIncOfCurYrUnderThatHead.value);
var busHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff')[0]; busHPlossCurYrSetoff.value = coalesce(busHPlossCurYrSetoff.value);
var busOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; busOthSrcLossNoRaceHorseSetoff.value = coalesce(busOthSrcLossNoRaceHorseSetoff.value);
var busIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.incOfCurYrAfterSetOff')[0]; busIncOfCurYrAfterSetOff.value = coalesce(busIncOfCurYrAfterSetOff.value);
var specltvIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.incOfCurYrUnderThatHead')[0]; specltvIncOfCurYrUnderThatHead.value = coalesce(specltvIncOfCurYrUnderThatHead.value);
var specltvHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff')[0]; specltvHPlossCurYrSetoff.value = coalesce(specltvHPlossCurYrSetoff.value);
var specltvOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; specltvOthSrcLossNoRaceHorseSetoff.value = coalesce(specltvOthSrcLossNoRaceHorseSetoff.value);
var specltvIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.speculativeInc.incCYLA.incOfCurYrAfterSetOff')[0]; specltvIncOfCurYrAfterSetOff.value = coalesce(specltvIncOfCurYrAfterSetOff.value);
var specfidIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.incOfCurYrUnderThatHead')[0]; specfidIncOfCurYrUnderThatHead.value = coalesce(specfidIncOfCurYrUnderThatHead.value);
var specfidHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff')[0]; specfidHPlossCurYrSetoff.value = coalesce(specfidHPlossCurYrSetoff.value);
var specfidOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; specfidOthSrcLossNoRaceHorseSetoff.value = coalesce(specfidOthSrcLossNoRaceHorseSetoff.value);
var specfidIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.specifiedInc.incCYLA.incOfCurYrAfterSetOff')[0]; specfidIncOfCurYrAfterSetOff.value = coalesce(specfidIncOfCurYrAfterSetOff.value);
var stcgIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.incOfCurYrUnderThatHead')[0]; stcgIncOfCurYrUnderThatHead.value = coalesce(stcgIncOfCurYrUnderThatHead.value);
var stcgHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.hPlossCurYrSetoff')[0]; stcgHPlossCurYrSetoff.value = coalesce(stcgHPlossCurYrSetoff.value);
var stcgBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.busLossSetoff')[0]; stcgBusLossSetoff.value = coalesce(stcgBusLossSetoff.value);
var stcgOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; stcgOthSrcLossNoRaceHorseSetoff.value = coalesce(stcgOthSrcLossNoRaceHorseSetoff.value);
var stcgIncOfCurYrAfterSetOff  = document.getElementsByName('itr7.scheduleCYLA.stcg.incCYLA.incOfCurYrAfterSetOff')[0]; stcgIncOfCurYrAfterSetOff.value = coalesce(stcgIncOfCurYrAfterSetOff.value);
var ltcgIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.incOfCurYrUnderThatHead')[0]; ltcgIncOfCurYrUnderThatHead.value = coalesce(ltcgIncOfCurYrUnderThatHead.value);
var ltcgHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.hPlossCurYrSetoff')[0]; ltcgHPlossCurYrSetoff.value = coalesce(ltcgHPlossCurYrSetoff.value);
var ltcgBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.busLossSetoff')[0]; ltcgBusLossSetoff.value = coalesce(ltcgBusLossSetoff.value);
var ltcgOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.othSrcLossNoRaceHorseSetoff')[0];  ltcgOthSrcLossNoRaceHorseSetoff.value = coalesce(ltcgOthSrcLossNoRaceHorseSetoff.value);
var ltcgIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.ltcg.incCYLA.incOfCurYrAfterSetOff')[0]; ltcgIncOfCurYrAfterSetOff.value = coalesce(ltcgIncOfCurYrAfterSetOff.value);
var othSrcIncOfCurYrUnderThatHead  = document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrUnderThatHead')[0]; othSrcIncOfCurYrUnderThatHead.value = coalesce(othSrcIncOfCurYrUnderThatHead.value);
var othSrcHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff')[0]; othSrcHPlossCurYrSetoff.value = coalesce(othSrcHPlossCurYrSetoff.value);
var othSrcBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff')[0]; othSrcBusLossSetoff.value = coalesce(othSrcBusLossSetoff.value);
var othSrcIncOfCurYrAfterSetOff= document.getElementsByName('itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0];  othSrcIncOfCurYrAfterSetOff.value = coalesce(othSrcIncOfCurYrAfterSetOff.value);
var profitFrmRaceHorseIncOfCurYrUnderThatHead = document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrUnderThatHead')[0]; profitFrmRaceHorseIncOfCurYrUnderThatHead.value = coalesce(profitFrmRaceHorseIncOfCurYrUnderThatHead.value);
var profitFrmRaceHorseHPlossCurYrSetoff = document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff')[0]; profitFrmRaceHorseHPlossCurYrSetoff.value = coalesce(profitFrmRaceHorseHPlossCurYrSetoff.value);
var profitFrmRaceHorseBusLossSetoff= document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff')[0]; profitFrmRaceHorseBusLossSetoff.value = coalesce(profitFrmRaceHorseBusLossSetoff.value);
var profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff= document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff')[0]; profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value = coalesce(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);
var profitFrmRaceHorseIncOfCurYrAfterSetOff = document.getElementsByName('itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.incOfCurYrAfterSetOff')[0]; profitFrmRaceHorseIncOfCurYrAfterSetOff.value = coalesce(profitFrmRaceHorseIncOfCurYrAfterSetOff.value);
var totHPlossCurYrSetoff =  document.getElementsByName('itr7.scheduleCYLA.totalLossSetOff.totHPlossCurYrSetoff')[0]; totHPlossCurYrSetoff.value = coalesce(totHPlossCurYrSetoff.value);
var totBusLossSetoff = document.getElementsByName('itr7.scheduleCYLA.totalLossSetOff.totBusLossSetoff')[0]; totBusLossSetoff.value = coalesce(totBusLossSetoff.value);
var totOthSrcLossNoRaceHorseSetoff = document.getElementsByName('itr7.scheduleCYLA.totalLossSetOff.totOthSrcLossNoRaceHorseSetoff')[0]; totOthSrcLossNoRaceHorseSetoff.value = coalesce(totOthSrcLossNoRaceHorseSetoff.value);
var balHPlossCurYrAftSetoff = document.getElementsByName('itr7.scheduleCYLA.lossRemAftSetOff.balHPlossCurYrAftSetoff')[0]; balHPlossCurYrAftSetoff.value = coalesce(balHPlossCurYrAftSetoff.value);
var balBusLossAftSetoff = document.getElementsByName('itr7.scheduleCYLA.lossRemAftSetOff.balBusLossAftSetoff')[0]; balBusLossAftSetoff.value = coalesce(balBusLossAftSetoff.value);
var balOthSrcLossNoRaceHorseAftSetoff = document.getElementsByName('itr7.scheduleCYLA.lossRemAftSetOff.balOthSrcLossNoRaceHorseAftSetoff')[0]; balOthSrcLossNoRaceHorseAftSetoff.value = coalesce(balOthSrcLossNoRaceHorseAftSetoff.value);

var totalIncomeChargeableUnHP = document.getElementsByName('scheduleHP.incomeUnderIncFrmHp')[0];


var totHPlossCurYr = document.getElementsByName('itr7.scheduleCYLA.totalCurYr.totHPlossCurYr')[0];
totHPlossCurYr.value = coalesce(totHPlossCurYr.value);

if (!isPostv('scheduleHP.incomeUnderIncFrmHp')) {
	document
			.getElementsByName('itr7.scheduleCYLA.totalCurYr.totHPlossCurYr')[0].value = Math
			.abs(coalescePath('scheduleHP.incomeUnderIncFrmHp'));
} else {
	document
			.getElementsByName('itr7.scheduleCYLA.totalCurYr.totHPlossCurYr')[0].value = 0;
}


var totBusLoss = document.getElementsByName('itr7.scheduleCYLA.totalCurYr.totBusLoss')[0];
totBusLoss.value = coalesce(totBusLoss.value);
var totOthSrcLossNoRaceHorse = document.getElementsByName('itr7.scheduleCYLA.totalCurYr.totOthSrcLossNoRaceHorse')[0];
totOthSrcLossNoRaceHorse.value = coalesce(totOthSrcLossNoRaceHorse.value);

var totalIncomeChargeableUnHP=document.getElementsByName('scheduleHP.incomeUnderIncFrmHp')[0];
totalIncomeChargeableUnHP.value = coalesce(totalIncomeChargeableUnHP.value);
var netPLBusOthThanSpec7A7B7C=document.getElementsByName('itr7.corpScheduleBP.businessIncOthThanSpec.netPLBusOthThanSpec7A7B7C')[0];
netPLBusOthThanSpec7A7B7C.value = coalesce(netPLBusOthThanSpec7A7B7C.value);
var balanceNoRaceHorse=document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.balanceNoRaceHorse')[0];
balanceNoRaceHorse.value = coalesce(balanceNoRaceHorse.value);
var totalSTCG=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.totalSTCG')[0];
totalSTCG.value = coalesce(totalSTCG.value);
var totalLTCG=document.getElementsByName('itr7.scheduleCG.longTermCapGain.totalLTCG')[0];
totalLTCG.value = coalesce(totalLTCG.value);
var adjustedPLFrmSpecuBus=document.getElementsByName('itr7.corpScheduleBP.specBusinessInc.adjustedPLFrmSpecuBus')[0];
adjustedPLFrmSpecuBus.value = coalesce(adjustedPLFrmSpecuBus.value);
var profitLossSpecifiedBusFinal=document.getElementsByName('itr7.corpScheduleBP.incSpecifiedBusiness.profitLossSpecifiedBusFinal')[0];
profitLossSpecifiedBusFinal.value = coalesce(profitLossSpecifiedBusFinal.value);
var balanceOwnRaceHorse=document.getElementsByName('itr7.scheduleOS.incFromOwnHorse.balanceOwnRaceHorse')[0];
balanceOwnRaceHorse.value = coalesce(balanceOwnRaceHorse.value);

var deemedSTCGDeprAsset=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.deemedSTCGDeprAsset')[0];
deemedSTCGDeprAsset.value = coalesce(deemedSTCGDeprAsset.value);
/*
 * var
 * exemptionUs111A=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.exemptionUs111A')[0];
 * exemptionUs111A.value = coalesce(exemptionUs111A.value);
 */
var balLTCGNo112=document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetNoProviso112.balLTCGNo112')[0];
balLTCGNo112.value = coalesce(balLTCGNo112.value);
var balCG=document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')[0];
balCG.value = coalesce(balCG.value);
var balLTCG112=document.getElementsByName('itr7.scheduleCG.longTermCapGain.otherAssetProviso112.balLTCG112')[0];
balLTCG112.value = coalesce(balLTCG112.value);



totHPlossCurYrSetoff.value=eval(busHPlossCurYrSetoff.value)+eval(specltvHPlossCurYrSetoff.value)+eval(specfidHPlossCurYrSetoff.value)+eval(stcgHPlossCurYrSetoff.value)+eval(ltcgHPlossCurYrSetoff.value)+eval(othSrcHPlossCurYrSetoff.value)+eval(profitFrmRaceHorseHPlossCurYrSetoff.value);

totBusLossSetoff.value=eval(hpBusLossSetoff.value)+eval(stcgBusLossSetoff.value)+eval(ltcgBusLossSetoff.value)+eval(othSrcBusLossSetoff.value)+eval(profitFrmRaceHorseBusLossSetoff.value);

totOthSrcLossNoRaceHorseSetoff.value =eval(hpOthSrcLossNoRaceHorseSetoff.value)+eval(busOthSrcLossNoRaceHorseSetoff.value)+eval(specltvOthSrcLossNoRaceHorseSetoff.value)+eval(specfidOthSrcLossNoRaceHorseSetoff.value)+eval(stcgOthSrcLossNoRaceHorseSetoff.value)+eval(ltcgOthSrcLossNoRaceHorseSetoff.value)+eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);


if(fieldName.name=='itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.hPlossCurYrSetoff'){
commonCalcCYLA(busIncOfCurYrUnderThatHead.value,totHPlossCurYr.value,eval(busOthSrcLossNoRaceHorseSetoff.value)+eval(busHPlossCurYrSetoff.value),totHPlossCurYrSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.speculativeInc.incCYLA.hPlossCurYrSetoff'){
commonCalcCYLA(specltvIncOfCurYrUnderThatHead.value,totHPlossCurYr.value,eval(specltvHPlossCurYrSetoff.value)+eval(specltvOthSrcLossNoRaceHorseSetoff.value),totHPlossCurYrSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.specifiedInc.incCYLA.hPlossCurYrSetoff'){
commonCalcCYLA(specfidIncOfCurYrUnderThatHead.value,totHPlossCurYr.value,eval(specfidHPlossCurYrSetoff.value)+eval(specfidOthSrcLossNoRaceHorseSetoff.value)+eval(specfidOthSrcLossNoRaceHorseSetoff.value),totHPlossCurYrSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.stcg.incCYLA.hPlossCurYrSetoff'){
commonCalcCYLA(stcgIncOfCurYrUnderThatHead.value,totHPlossCurYr.value,eval(stcgHPlossCurYrSetoff.value)+eval(stcgBusLossSetoff.value)+eval(stcgOthSrcLossNoRaceHorseSetoff.value),totHPlossCurYrSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.ltcg.incCYLA.hPlossCurYrSetoff'){
commonCalcCYLA(ltcgIncOfCurYrUnderThatHead.value,totHPlossCurYr.value,eval(ltcgHPlossCurYrSetoff.value)+eval(ltcgBusLossSetoff.value)+eval(ltcgOthSrcLossNoRaceHorseSetoff.value),totHPlossCurYrSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.hPlossCurYrSetoff'){
commonCalcCYLA(othSrcIncOfCurYrUnderThatHead.value,totHPlossCurYr.value,eval(othSrcHPlossCurYrSetoff.value)+eval(othSrcBusLossSetoff.value),totHPlossCurYrSetoff.value,fieldName);
}
if(fieldName.name=='itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.hPlossCurYrSetoff'){
commonCalcCYLA(profitFrmRaceHorseIncOfCurYrUnderThatHead.value,totHPlossCurYr.value,eval(profitFrmRaceHorseHPlossCurYrSetoff.value)+eval(profitFrmRaceHorseBusLossSetoff.value)+eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value),totHPlossCurYrSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.houseProperty.incCYLA.busLossSetoff'){
commonCalcCYLA(hpIncOfCurYrUnderThatHead.value,totBusLoss.value,eval(hpBusLossSetoff.value)+eval(hpOthSrcLossNoRaceHorseSetoff.value),totBusLossSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.stcg.incCYLA.busLossSetoff'){
commonCalcCYLA(stcgIncOfCurYrUnderThatHead.value,totBusLoss.value,eval(stcgHPlossCurYrSetoff.value)+eval(stcgBusLossSetoff.value)+eval(stcgOthSrcLossNoRaceHorseSetoff.value),totBusLossSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.ltcg.incCYLA.busLossSetoff'){
commonCalcCYLA(ltcgIncOfCurYrUnderThatHead.value,totBusLoss.value,eval(ltcgHPlossCurYrSetoff.value)+eval(ltcgBusLossSetoff.value)+eval(ltcgOthSrcLossNoRaceHorseSetoff.value),totBusLossSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.othSrcInclRaceHorse.incCYLA.busLossSetoff'){
commonCalcCYLA(othSrcIncOfCurYrUnderThatHead.value,totBusLoss.value,eval(othSrcHPlossCurYrSetoff.value)+eval(othSrcBusLossSetoff.value),totBusLossSetoff.value,fieldName);
}
if(fieldName.name=='itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.busLossSetoff'){
commonCalcCYLA(profitFrmRaceHorseIncOfCurYrUnderThatHead.value,totBusLoss.value,eval(profitFrmRaceHorseHPlossCurYrSetoff.value)+eval(profitFrmRaceHorseBusLossSetoff.value)+eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value),totBusLossSetoff.value,fieldName);
}



if(fieldName.name=='itr7.scheduleCYLA.houseProperty.incCYLA.othSrcLossNoRaceHorseSetoff'){
commonCalcCYLA(hpIncOfCurYrUnderThatHead.value,totOthSrcLossNoRaceHorse.value,eval(hpBusLossSetoff.value)+eval(hpOthSrcLossNoRaceHorseSetoff.value),totOthSrcLossNoRaceHorseSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.busProfInclSpecProf.incCYLA.othSrcLossNoRaceHorseSetoff'){
commonCalcCYLA(busIncOfCurYrUnderThatHead.value,totOthSrcLossNoRaceHorse.value,eval(busOthSrcLossNoRaceHorseSetoff.value)+eval(busHPlossCurYrSetoff.value),totOthSrcLossNoRaceHorseSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.speculativeInc.incCYLA.othSrcLossNoRaceHorseSetoff'){
commonCalcCYLA(specltvIncOfCurYrUnderThatHead.value,totOthSrcLossNoRaceHorse.value,eval(specltvHPlossCurYrSetoff.value)+eval(specltvOthSrcLossNoRaceHorseSetoff.value),totOthSrcLossNoRaceHorseSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.specifiedInc.incCYLA.othSrcLossNoRaceHorseSetoff'){
commonCalcCYLA(specfidIncOfCurYrUnderThatHead.value,totOthSrcLossNoRaceHorse.value,eval(specfidHPlossCurYrSetoff.value)+eval(specfidOthSrcLossNoRaceHorseSetoff.value)+eval(specfidOthSrcLossNoRaceHorseSetoff.value),totOthSrcLossNoRaceHorseSetoff.value,fieldName);
}
if(fieldName.name=='itr7.scheduleCYLA.stcg.incCYLA.othSrcLossNoRaceHorseSetoff'){
commonCalcCYLA(stcgIncOfCurYrUnderThatHead.value,totOthSrcLossNoRaceHorse.value,eval(stcgHPlossCurYrSetoff.value)+eval(stcgBusLossSetoff.value)+eval(stcgOthSrcLossNoRaceHorseSetoff.value),totOthSrcLossNoRaceHorseSetoff.value,fieldName);
}

if(fieldName.name=='itr7.scheduleCYLA.ltcg.incCYLA.othSrcLossNoRaceHorseSetoff'){
commonCalcCYLA(ltcgIncOfCurYrUnderThatHead.value,totOthSrcLossNoRaceHorse.value,eval(ltcgHPlossCurYrSetoff.value)+eval(ltcgBusLossSetoff.value)+eval(ltcgOthSrcLossNoRaceHorseSetoff.value),totOthSrcLossNoRaceHorseSetoff.value,fieldName);
}
if(fieldName.name=='itr7.scheduleCYLA.profitFrmRaceHorse.incCYLA.othSrcLossNoRaceHorseSetoff'){
commonCalcCYLA(profitFrmRaceHorseIncOfCurYrUnderThatHead.value,totOthSrcLossNoRaceHorse.value,eval(profitFrmRaceHorseHPlossCurYrSetoff.value)+eval(profitFrmRaceHorseBusLossSetoff.value)+eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value),totOthSrcLossNoRaceHorseSetoff.value,fieldName);
}

hpIncOfCurYrAfterSetOff.value=eval(hpIncOfCurYrUnderThatHead.value)-eval(hpBusLossSetoff.value)-eval(hpOthSrcLossNoRaceHorseSetoff.value);

busIncOfCurYrAfterSetOff.value=eval(busIncOfCurYrUnderThatHead.value)-eval(busOthSrcLossNoRaceHorseSetoff.value)-eval(busHPlossCurYrSetoff.value);

specltvIncOfCurYrAfterSetOff.value =eval(specltvIncOfCurYrUnderThatHead.value)-eval(specltvHPlossCurYrSetoff.value)-eval(specltvOthSrcLossNoRaceHorseSetoff.value);

specfidIncOfCurYrAfterSetOff.value=eval(specfidIncOfCurYrUnderThatHead.value )-eval(specfidHPlossCurYrSetoff.value)-eval(specfidOthSrcLossNoRaceHorseSetoff.value);

stcgIncOfCurYrAfterSetOff.value=eval(stcgIncOfCurYrUnderThatHead.value)-eval(stcgHPlossCurYrSetoff.value)-eval(stcgBusLossSetoff.value)-eval(stcgOthSrcLossNoRaceHorseSetoff.value);

ltcgIncOfCurYrAfterSetOff.value=eval(ltcgIncOfCurYrUnderThatHead.value)-eval(ltcgHPlossCurYrSetoff.value)-eval(ltcgBusLossSetoff.value)-eval(ltcgOthSrcLossNoRaceHorseSetoff.value);

othSrcIncOfCurYrAfterSetOff.value=eval(othSrcIncOfCurYrUnderThatHead.value)-eval(othSrcHPlossCurYrSetoff.value)-eval(othSrcBusLossSetoff.value);

profitFrmRaceHorseIncOfCurYrAfterSetOff.value=eval(profitFrmRaceHorseIncOfCurYrUnderThatHead.value)-eval(profitFrmRaceHorseHPlossCurYrSetoff.value)-eval(profitFrmRaceHorseBusLossSetoff.value)-eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);

totHPlossCurYrSetoff.value=eval(busHPlossCurYrSetoff.value)+eval(specltvHPlossCurYrSetoff.value)+eval(specfidHPlossCurYrSetoff.value)+eval(stcgHPlossCurYrSetoff.value)+eval(ltcgHPlossCurYrSetoff.value)+eval(othSrcHPlossCurYrSetoff.value)+eval(profitFrmRaceHorseHPlossCurYrSetoff.value);

totBusLossSetoff.value=eval(hpBusLossSetoff.value)+eval(stcgBusLossSetoff.value)+eval(ltcgBusLossSetoff.value)+eval(othSrcBusLossSetoff.value)+eval(profitFrmRaceHorseBusLossSetoff.value);

totOthSrcLossNoRaceHorseSetoff.value =eval(hpOthSrcLossNoRaceHorseSetoff.value)+eval(busOthSrcLossNoRaceHorseSetoff.value)+eval(specltvOthSrcLossNoRaceHorseSetoff.value)+eval(specfidOthSrcLossNoRaceHorseSetoff.value)+eval(stcgOthSrcLossNoRaceHorseSetoff.value)+eval(ltcgOthSrcLossNoRaceHorseSetoff.value)+eval(profitFrmRaceHorseOthSrcLossNoRaceHorseSetoff.value);
balHPlossCurYrAftSetoff.value=eval(totHPlossCurYr.value)-eval(totHPlossCurYrSetoff.value);
balOthSrcLossNoRaceHorseAftSetoff.value=eval(totOthSrcLossNoRaceHorse.value)-eval(totOthSrcLossNoRaceHorseSetoff.value);
balBusLossAftSetoff.value=eval(totBusLoss.value)-eval(totBusLossSetoff.value);



}


function coalesceString(val){
    if(val==undefined || val == null){
        return 0;
    }
    return val
}

function scheduleSiIncome(tableId)  {
	var noofRows = document.getElementById('scheduleSI').rows.length;
	for(var i=0; i<(noofRows-3);i++){
		document.getElementsByName('itr7.scheduleSI.splCodeRateTax['+i+'].taxableInc')[0].value=getAmt('itr7.scheduleSI.splCodeRateTax['+i+'].splRateInc');
	}
var secCode1A =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].secCode')[0]; secCode1A.value = coalesceString(secCode1A.value);
var splRatePercent1A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRatePercent')[0]; splRatePercent1A.value = coalesce(splRatePercent1A.value);
var splRateInc1A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateInc')[0]; splRateInc1A = coalesceString(splRateInc1A.value);
var taxableInc1A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].taxableInc')[0]; taxableInc1A.value = coalesce(taxableInc1A.value);
var splRateIncTax1A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateIncTax')[0]; splRateIncTax1A.value = coalesce(splRateIncTax1A.value);

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

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


var secCode21A =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].secCode')[0]; secCode21A.value = coalesceString(secCode21A.value);
var splRatePercent21A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRatePercent')[0]; splRatePercent21A.value = coalesce(splRatePercent21A.value);
var splRateInc21A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateInc')[0]; splRateInc21A.value = coalesce(splRateInc21A.value);
var taxableInc21A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].taxableInc')[0]; taxableInc21A.value = coalesce(taxableInc21A.value);
var splRateIncTax21A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateIncTax')[0]; splRateIncTax21A.value = coalesce(splRateIncTax21A.value);


  var secCode5B = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[4].secCode')[0];secCode5B.value = coalesceString(secCode5B.value); 
  var splRatePercent5B = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[4].splRatePercent')[0];splRatePercent5B.value = coalesce(splRatePercent5B.value); 
  var splRateInc5B = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[4].splRateInc')[0]; splRateInc5B.value = coalesce(splRateInc5B.value); 
  var taxableInc5B =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[4].taxableInc')[0]; taxableInc5B.value = coalesce(taxableInc5B.value); 
  var splRateIncTax5B = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[4].splRateIncTax')[0]; splRateIncTax5B.value = coalesce(splRateIncTax5B.value);
 
var secCode5BB =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[5].secCode')[0]; secCode5BB.value = coalesceString(secCode5BB.value);
var splRatePercent5BB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[5].splRatePercent')[0]; splRatePercent5BB.value = coalesce(splRatePercent5BB.value);
var splRateInc5BB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[5].splRateInc')[0]; splRateInc5BB.value = coalesce(splRateInc5BB.value);
var taxableInc5BB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[5].taxableInc')[0]; taxableInc5BB.value = coalesce(taxableInc5BB.value);
var splRateIncTax5BB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[5].splRateIncTax')[0]; splRateIncTax5BB.value = coalesce(splRateIncTax5BB.value);

var secCode5BBDA =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[6].secCode')[0]; secCode5BBDA.value = coalesceString(secCode5BBDA.value);
var splRatePercent5BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[6].splRatePercent')[0]; splRatePercent5BBDA.value = coalesce(splRatePercent5BBDA.value);
var splRateInc5BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[6].splRateInc')[0]; splRateInc5BBDA.value = coalesce(splRateInc5BBDA.value);
var taxableInc5BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[6].taxableInc')[0]; taxableInc5BBDA.value = coalesce(taxableInc5BBDA.value);
var splRateIncTax5BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[6].splRateIncTax')[0]; splRateIncTax5BBDA.value = coalesce(splRateIncTax5BBDA.value);

var secCode5BBE =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].secCode')[0]; secCode5BBE.value = coalesceString(secCode5BBE.value);
var splRatePercent5BBE = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].splRatePercent')[0]; splRatePercent5BBE.value = coalesce(splRatePercent5BBE.value);
var splRateInc5BBE = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].splRateInc')[0]; splRateInc5BBE.value = coalesce(splRateInc5BBE.value);
var taxableInc5BBE = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].taxableInc')[0]; taxableInc5BBE.value = coalesce(taxableInc5BBE.value);
var splRateIncTax5BBE = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[7].splRateIncTax')[0]; splRateIncTax5BBE.value = coalesce(splRateIncTax5BBE.value);

var secCodeDTAA =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].secCode')[0]; secCodeDTAA.value = coalesceString(secCodeDTAA.value);
var splRatePercentDTAA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRatePercent')[0]; splRatePercentDTAA.value = coalesce(splRatePercentDTAA.value);
var splRateIncDTAA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRateInc')[0]; splRateIncDTAA.value = coalesce(splRateIncDTAA.value);
var taxableIncDTAA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].taxableInc')[0]; taxableIncDTAA.value = coalesce(taxableIncDTAA.value);
var splRateIncTaxDTAA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[8].splRateIncTax')[0]; splRateIncTaxDTAA.value = coalesce(splRateIncTaxDTAA.value);

var secCodePTI15 =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].secCode')[0]; secCodePTI15.value = coalesceString(secCodePTI15.value);
var splRatePercentPTI15 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].splRatePercent')[0]; splRatePercentPTI15.value = coalesce(splRatePercentPTI15.value);
var splRateIncPTI15 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].splRateInc')[0]; splRateIncPTI15.value = coalesce(splRateIncPTI15.value);
var taxableIncPTI15 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].taxableInc')[0]; taxableIncPTI15.value = coalesce(taxableIncPTI15.value);
var splRateIncTaxPTI15 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].splRateIncTax')[0]; splRateIncTaxPTI15.value = coalesce(splRateIncTaxPTI15.value);

var secCodePTI10 =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].secCode')[0]; secCodePTI10.value = coalesceString(secCodePTI10.value);
var splRatePercentPTI10 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].splRatePercent')[0]; splRatePercentPTI10.value = coalesce(splRatePercentPTI10.value);
var splRateIncPTI10 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].splRateInc')[0]; splRateIncPTI10.value = coalesce(splRateIncPTI10.value);
var taxableIncPTI10 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].taxableInc')[0]; taxableIncPTI10.value = coalesce(taxableIncPTI10.value);
var splRateIncTaxPTI10 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].splRateIncTax')[0]; splRateIncTaxPTI10.value = coalesce(splRateIncTaxPTI10.value);

var secCodePTI20 =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].secCode')[0]; secCodePTI20.value = coalesceString(secCodePTI20.value);
var splRatePercentPTI20 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].splRatePercent')[0]; splRatePercentPTI20.value = coalesce(splRatePercentPTI20.value);
var splRateIncPTI20 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].splRateInc')[0]; splRateIncPTI20.value = coalesce(splRateIncPTI20.value);
var taxableIncPTI20 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].taxableInc')[0]; taxableIncPTI20.value = coalesce(taxableIncPTI20.value);
var splRateIncTaxPTI20 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].splRateIncTax')[0]; splRateIncTaxPTI20.value = coalesce(splRateIncTaxPTI20.value);

var secCode115A1ai =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[12].secCode')[0]; secCode115A1ai.value = coalesceString(secCode115A1ai.value);
var splRatePercent115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[12].splRatePercent')[0]; splRatePercent115A1ai.value = coalesce(splRatePercent115A1ai.value);
var splRateInc115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[12].splRateInc')[0]; splRateInc115A1ai.value = coalesce(splRateInc115A1ai.value);
var taxableInc115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[12].taxableInc')[0]; taxableInc115A1ai.value = coalesce(taxableInc115A1ai.value);
var splRateIncTax115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[12].splRateIncTax')[0]; splRateIncTax115A1ai.value = coalesce(splRateIncTax115A1ai.value);

var secCode115A1aii =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[13].secCode')[0]; secCode115A1aii.value = coalesceString(secCode115A1aii.value);
var splRatePercent115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[13].splRatePercent')[0]; splRatePercent115A1aii.value = coalesce(splRatePercent115A1aii.value);
var splRateInc115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[13].splRateInc')[0]; splRateInc115A1aii.value = coalesce(splRateInc115A1aii.value);
var taxableInc115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[13].taxableInc')[0]; taxableInc115A1aii.value = coalesce(taxableInc115A1aii.value);
var splRateIncTax115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[13].splRateIncTax')[0]; splRateIncTax115A1aii.value = coalesce(splRateIncTax115A1aii.value);

var secCodeParaEII =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[14].secCode')[0]; secCodeParaEII.value = coalesceString(secCodeParaEII.value);
var splRatePercentParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[14].splRatePercent')[0]; splRatePercentParaEII.value = coalesce(splRatePercentParaEII.value);
var splRateIncParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[14].splRateInc')[0]; splRateIncParaEII.value = coalesce(splRateIncParaEII.value);
var taxableIncParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[14].taxableInc')[0]; taxableIncParaEII.value = coalesce(taxableIncParaEII.value);
var splRateIncTaxParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[14].splRateIncTax')[0]; splRateIncTaxParaEII.value = coalesce(splRateIncTaxParaEII.value);

var secCode115A1aiia =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[15].secCode')[0]; secCode115A1aiia.value = coalesceString(secCode115A1aiia.value);
var splRatePercent115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[15].splRatePercent')[0]; splRatePercent115A1aiia.value = coalesce(splRatePercent115A1aiia.value);
var splRateInc115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[15].splRateInc')[0]; splRateInc115A1aiia.value = coalesce(splRateInc115A1aiia.value);
var taxableInc115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[15].taxableInc')[0]; taxableInc115A1aiia.value = coalesce(taxableInc115A1aiia.value);
var splRateIncTax115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[15].splRateIncTax')[0]; splRateIncTax115A1aiia.value = coalesce(splRateIncTax115A1aiia.value);

var secCode115A1aiiaa =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[16].secCode')[0]; secCode115A1aiiaa.value = coalesceString(secCode115A1aiiaa.value);
var splRatePercent115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[16].splRatePercent')[0]; splRatePercent115A1aiiaa.value = coalesce(splRatePercent115A1aiiaa.value);
var splRateInc115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[16].splRateInc')[0]; splRateInc115A1aiiaa.value = coalesce(splRateInc115A1aiiaa.value);
var taxableInc115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[16].taxableInc')[0]; taxableInc115A1aiiaa.value = coalesce(taxableInc115A1aiiaa.value);
var splRateIncTax115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[16].splRateIncTax')[0]; splRateIncTax115A1aiiaa.value = coalesce(splRateIncTax115A1aiiaa.value);

var secCode115A1aiii =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[17].secCode')[0]; secCode115A1aiii.value = coalesceString(secCode115A1aiii.value);
var splRatePercent115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[17].splRatePercent')[0]; splRatePercent115A1aiii.value = coalesce(splRatePercent115A1aiii.value);
var splRateInc115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[17].splRateInc')[0]; splRateInc115A1aiii.value = coalesce(splRateInc115A1aiii.value);
var taxableInc115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[17].taxableInc')[0]; taxableInc115A1aiii.value = coalesce(taxableInc115A1aiii.value);
var splRateIncTax115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[17].splRateIncTax')[0]; splRateIncTax115A1aiii.value = coalesce(splRateIncTax115A1aiii.value);

var secCode1121ciii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[18].secCode')[0]; secCode1121ciii.value = coalesceString(secCode1121ciii.value); 
var splRatePercent1121ciii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[18].splRatePercent')[0]; splRatePercent1121ciii.value = coalesce(splRatePercent1121ciii.value); 
var splRateInc1121ciii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[18].splRateInc')[0]; splRateInc1121ciii.value = coalesce(splRateInc1121ciii.value);
var taxableInc1121ciii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[18].taxableInc')[0]; taxableInc1121ciii.value = coalesce(taxableInc1121ciii.value);
var splRateIncTax1121ciii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[18].splRateIncTax')[0]; splRateIncTax1121ciii.value = coalesce(splRateIncTax1121ciii.value);
 
var secCode115A1b =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[19].secCode')[0]; secCode115A1b.value = coalesceString(secCode115A1b.value);
var splRatePercent115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[19].splRatePercent')[0]; splRatePercent115A1b.value = coalesce(splRatePercent115A1b.value);
var splRateInc115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[19].splRateInc')[0]; splRateInc115A1b.value = coalesce(splRateInc115A1b.value);
var taxableInc115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[19].taxableInc')[0]; taxableInc115A1b.value = coalesce(taxableInc115A1b.value);
var splRateIncTax115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[19].splRateIncTax')[0]; splRateIncTax115A1b.value = coalesce(splRateIncTax115A1b.value);

var secCode115AB1a =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[20].secCode')[0]; secCode115AB1a.value = coalesceString(secCode115AB1a.value);
var splRatePercent115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[20].splRatePercent')[0]; splRatePercent115AB1a.value = coalesce(splRatePercent115AB1a.value);
var splRateInc115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[20].splRateInc')[0]; splRateInc115AB1a.value = coalesce(splRateInc115AB1a.value);
var taxableInc115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[20].taxableInc')[0]; taxableInc115AB1a.value = coalesce(taxableInc115AB1a.value);
var splRateIncTax115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[20].splRateIncTax')[0]; splRateIncTax115AB1a.value = coalesce(splRateIncTax115AB1a.value);

var secCode115AC1c = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[21].secCode')[0]; secCode115AC1c.value = coalesceString(secCode115AC1c.value);
var splRatePercent115AC1c = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[21].splRatePercent')[0]; splRatePercent115AC1c.value = coalesce(splRatePercent115AC1c.value); 
var splRateInc115AC1c = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[21].splRateInc')[0]; splRateInc115AC1c.value = coalesce(splRateInc115AC1c.value); 
var taxableInc115AC1c = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[21].taxableInc')[0]; taxableInc115AC1c.value = coalesce(taxableInc115AC1c.value); 
var splRateIncTax115AC1c = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[21].splRateIncTax')[0]; splRateIncTax115AC1c.value = coalesce(splRateIncTax115AC1c.value);
 
var secCode115BBA =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[22].secCode')[0]; secCode115BBA.value = coalesceString(secCode115BBA.value);
var splRatePercent115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[22].splRatePercent')[0]; splRatePercent115BBA.value = coalesce(splRatePercent115BBA.value);
var splRateInc115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[22].splRateInc')[0]; splRateInc115BBA.value = coalesce(splRateInc115BBA.value);
var taxableInc115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[22].taxableInc')[0]; taxableInc115BBA.value = coalesce(taxableInc115BBA.value);
var splRateIncTax115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[22].splRateIncTax')[0]; splRateIncTax115BBA.value = coalesce(splRateIncTax115BBA.value);

var secCode115BBD =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[23].secCode')[0]; secCode115BBD.value = coalesceString(secCode115BBD.value);
var splRatePercent115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[23].splRatePercent')[0]; splRatePercent115BBD.value = coalesce(splRatePercent115BBD.value);
var splRateInc115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[23].splRateInc')[0]; splRateInc115BBD.value = coalesce(splRateInc115BBD.value);
var taxableInc115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[23].taxableInc')[0]; taxableInc115BBD.value = coalesce(taxableInc115BBD.value);
var splRateIncTax115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[23].splRateIncTax')[0]; splRateIncTax115BBD.value = coalesce(splRateIncTax115BBD.value);

var secCode115AD1i115AB =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[24].secCode')[0]; secCode115AD1i115AB.value = coalesceString(secCode115AD1i115AB.value);
var splRatePercent115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[24].splRatePercent')[0]; splRatePercent115AD1i115AB.value = coalesce(splRatePercent115AD1i115AB.value);
var splRateInc115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[24].splRateInc')[0]; splRateInc115AD1i115AB.value = coalesce(splRateInc115AD1i115AB.value);
var taxableInc115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[24].taxableInc')[0]; taxableInc115AD1i115AB.value = coalesce(taxableInc115AD1i115AB.value);
var splRateIncTax115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[24].splRateIncTax')[0]; splRateIncTax115AD1i115AB.value = coalesce(splRateIncTax115AD1i115AB.value);

var secCode115AD1i194LD =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[25].secCode')[0]; secCode115AD1i194LD.value = coalesceString(secCode115AD1i194LD.value);
var splRatePercent115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[25].splRatePercent')[0]; splRatePercent115AD1i194LD.value = coalesce(splRatePercent115AD1i194LD.value);
var splRateInc115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[25].splRateInc')[0]; splRateInc115AD1i194LD.value = coalesce(splRateInc115AD1i194LD.value);
var taxableInc115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[25].taxableInc')[0]; taxableInc115AD1i194LD.value = coalesce(taxableInc115AD1i194LD.value);
var splRateIncTax115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[25].splRateIncTax')[0]; splRateIncTax115AD1i194LD.value = coalesce(splRateIncTax115AD1i194LD.value);

var secCode115ADiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[26].secCode')[0]; secCode115ADiii.value = coalesceString(secCode115ADiii.value); 
var splRatePercent115ADiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[26].splRatePercent')[0]; splRatePercent115ADiii.value = coalesce(splRatePercent115ADiii.value); 
var splRateInc115ADiii =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[26].splRateInc')[0]; splRateInc115ADiii.value = coalesce(splRateInc115ADiii.value); 
var taxableInc115ADiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[26].taxableInc')[0];  taxableInc115ADiii.value = coalesce(taxableInc115ADiii.value); 
var splRateIncTax115ADiii =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[26].splRateIncTax')[0]; splRateIncTax115ADiii.value = coalesce(splRateIncTax115ADiii.value);

var secCode115AB1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[27].secCode')[0]; secCode115AB1b.value = coalesceString(secCode115AB1b.value); 
var splRatePercent115AB1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[27].splRatePercent')[0]; splRatePercent115AB1b.value = coalesce(splRatePercent115AB1b.value); 
var splRateInc115AB1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[27].splRateInc')[0]; splRateInc115AB1b.value = coalesce(splRateInc115AB1b.value); 
var taxableInc115AB1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[27].taxableInc')[0]; taxableInc115AB1b.value = coalesce(taxableInc115AB1b.value); 
var splRateIncTax115AB1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[27].splRateIncTax')[0]; splRateIncTax115AB1b.value = coalesce(splRateIncTax115AB1b.value);

var secCode115ADiiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[28].secCode')[0]; secCode115ADiiii.value = coalesceString(secCode115ADiiii.value); 
var splRatePercent115ADiiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[28].splRatePercent')[0]; splRatePercent115ADiiii.value = coalesce(splRatePercent115ADiiii.value); 
var splRateInc115ADiiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[28].splRateInc')[0]; splRateInc115ADiiii.value = coalesce(splRateInc115ADiiii.value); 
var taxableInc115ADiiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[28].taxableInc')[0]; taxableInc115ADiiii.value = coalesce(taxableInc115ADiiii.value); 
var splRateIncTax115ADiiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[28].splRateIncTax')[0]; splRateIncTax115ADiiii.value = coalesce(splRateIncTax115ADiiii.value);

var secCode115AC1ab =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[29].secCode')[0]; secCode115AC1ab.value = coalesceString(secCode115AC1ab.value);
var splRatePercent115AC1ab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[29].splRatePercent')[0]; splRatePercent115AC1ab.value = coalesce(splRatePercent115AC1ab.value);
var splRateInc115AC1ab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[29].splRateInc')[0]; splRateInc115AC1ab.value = coalesce(splRateInc115AC1ab.value);
var taxableInc115AC1ab= document.getElementsByName('itr7.scheduleSI.splCodeRateTax[29].taxableInc')[0]; taxableInc115AC1ab.value = coalesce(taxableInc115AC1ab.value);
var splRateIncTax115AC1ab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[29].splRateIncTax')[0]; splRateIncTax115AC1ab.value = coalesce(splRateIncTax115AC1ab.value);

var secCode115A1aiiab =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[30].secCode')[0]; secCode115A1aiiab.value = coalesceString(secCode115A1aiiab.value);
var splRatePercent115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[30].splRatePercent')[0]; splRatePercent115A1aiiab.value = coalesce(splRatePercent115A1aiiab.value);
var splRateInc115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[30].splRateInc')[0]; splRateInc115A1aiiab.value = coalesce(splRateInc115A1aiiab.value);
var taxableInc115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[30].taxableInc')[0]; taxableInc115A1aiiab.value = coalesce(taxableInc115A1aiiab.value);
var splRateIncTax115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[30].splRateIncTax')[0]; splRateIncTax115A1aiiab.value = coalesce(splRateIncTax115A1aiiab.value);

var secCode115A1aiiac =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[31].secCode')[0]; secCode115A1aiiac.value = coalesceString(secCode115A1aiiac.value);
var splRatePercent115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[31].splRatePercent')[0]; splRatePercent115A1aiiac.value = coalesce(splRatePercent115A1aiiac.value);
var splRateInc115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[31].splRateInc')[0]; splRateInc115A1aiiac.value = coalesce(splRateInc115A1aiiac.value);
var taxableInc115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[31].taxableInc')[0]; taxableInc115A1aiiac.value = coalesce(taxableInc115A1aiiac.value);
var splRateIncTax115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[31].splRateIncTax')[0]; splRateIncTax115A1aiiac.value = coalesce(splRateIncTax115A1aiiac.value);

var secCode115ADibiip = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[32].secCode')[0]; secCode115ADibiip.value = coalesceString(secCode115ADibiip.value); 
var splRatePercent115ADibiip = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[32].splRatePercent')[0]; splRatePercent115ADibiip.value = coalesce(splRatePercent115ADibiip.value); 
var splRateInc115ADibiip = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[32].splRateInc')[0]; splRateInc115ADibiip.value = coalesce(splRateInc115ADibiip.value); 
var taxableInc115ADibiip = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[32].taxableInc')[0]; taxableInc115ADibiip.value = coalesce(taxableInc115ADibiip.value); 
var splRateIncTax115ADibiip = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[32].splRateIncTax')[0]; splRateIncTax115ADibiip.value = coalesce(splRateIncTax115ADibiip.value);
 
var secCode115ADibii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[33].secCode')[0]; secCode115ADibii.value = coalesceString(secCode115ADibii.value); 
var splRatePercent115ADibii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[33].splRatePercent')[0]; splRatePercent115ADibii.value = coalesce(splRatePercent115ADibii.value); 
var splRateInc115ADibii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[33].splRateInc')[0]; splRateInc115ADibii.value = coalesce(splRateInc115ADibii.value); 
var taxableInc115ADibii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[33].taxableInc')[0]; taxableInc115ADibii.value = coalesce(taxableInc115ADibii.value); 
var splRateIncTax115ADibii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[33].splRateIncTax')[0]; splRateIncTax115ADibii.value = coalesce(splRateIncTax115ADibii.value);

var secCodePTI115A1ai =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[34].secCode')[0]; secCodePTI115A1ai.value = coalesceString(secCodePTI115A1ai.value);
var splRatePercentPTI115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[34].splRatePercent')[0]; splRatePercentPTI115A1ai.value = coalesce(splRatePercentPTI115A1ai.value);
var splRateIncPTI115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[34].splRateInc')[0]; splRateIncPTI115A1ai.value = coalesce(splRateIncPTI115A1ai.value);
var taxableIncPTI115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[34].taxableInc')[0]; taxableIncPTI115A1ai.value = coalesce(taxableIncPTI115A1ai.value);
var splRateIncTaxPTI115A1ai = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[34].splRateIncTax')[0]; splRateIncTaxPTI115A1ai.value = coalesce(splRateIncTaxPTI115A1ai.value);

var secCodePTI115A1aii =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[35].secCode')[0]; secCodePTI115A1aii.value = coalesceString(secCodePTI115A1aii.value);
var splRatePercentPTI115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[35].splRatePercent')[0]; splRatePercentPTI115A1aii.value = coalesce(splRatePercentPTI115A1aii.value);
var splRateIncPTI115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[35].splRateInc')[0]; splRateIncPTI115A1aii.value = coalesce(splRateIncPTI115A1aii.value);
var taxableIncPTI115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[35].taxableInc')[0]; taxableIncPTI115A1aii.value = coalesce(taxableIncPTI115A1aii.value);
var splRateIncTaxPTI115A1aii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[35].splRateIncTax')[0]; splRateIncTaxPTI115A1aii.value = coalesce(splRateIncTaxPTI115A1aii.value);

var secCodePTI115A1aiia =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[36].secCode')[0]; secCodePTI115A1aiia.value = coalesceString(secCodePTI115A1aiia.value);
var splRatePercentPTI115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[36].splRatePercent')[0]; splRatePercentPTI115A1aiia.value = coalesce(splRatePercentPTI115A1aiia.value);
var splRateIncPTI115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[36].splRateInc')[0]; splRateIncPTI115A1aiia.value = coalesce(splRateIncPTI115A1aiia.value);
var taxableIncPTI115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[36].taxableInc')[0]; taxableIncPTI115A1aiia.value = coalesce(taxableIncPTI115A1aiia.value);
var splRateIncTaxPTI115A1aiia = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[36].splRateIncTax')[0]; splRateIncTaxPTI115A1aiia.value = coalesce(splRateIncTaxPTI115A1aiia.value);

var secCodePTI115A1aiiaa =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[37].secCode')[0]; secCodePTI115A1aiiaa.value = coalesceString(secCodePTI115A1aiiaa.value);
var splRatePercentPTI115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[37].splRatePercent')[0]; splRatePercentPTI115A1aiiaa.value = coalesce(splRatePercentPTI115A1aiiaa.value);
var splRateIncPTI115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[37].splRateInc')[0]; splRateIncPTI115A1aiiaa.value = coalesce(splRateIncPTI115A1aiiaa.value);
var taxableIncPTI115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[37].taxableInc')[0]; taxableIncPTI115A1aiiaa.value = coalesce(taxableIncPTI115A1aiiaa.value);
var splRateIncTaxPTI115A1aiiaa = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[37].splRateIncTax')[0]; splRateIncTaxPTI115A1aiiaa.value = coalesce(splRateIncTaxPTI115A1aiiaa.value);

var secCodePTI115A1aiiab =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[38].secCode')[0]; secCodePTI115A1aiiab.value = coalesceString(secCodePTI115A1aiiab.value);
var splRatePercentPTI115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[38].splRatePercent')[0]; splRatePercentPTI115A1aiiab.value = coalesce(splRatePercentPTI115A1aiiab.value);
var splRateIncPTI115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[38].splRateInc')[0]; splRateIncPTI115A1aiiab.value = coalesce(splRateIncPTI115A1aiiab.value);
var taxableIncPTI115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[38].taxableInc')[0]; taxableIncPTI115A1aiiab.value = coalesce(taxableIncPTI115A1aiiab.value);
var splRateIncTaxPTI115A1aiiab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[38].splRateIncTax')[0]; splRateIncTaxPTI115A1aiiab.value = coalesce(splRateIncTaxPTI115A1aiiab.value);

var secCodePTI115A1aiiac =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[39].secCode')[0]; secCodePTI115A1aiiac.value = coalesceString(secCodePTI115A1aiiac.value);
var splRatePercentPTI115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[39].splRatePercent')[0]; splRatePercentPTI115A1aiiac.value = coalesce(splRatePercentPTI115A1aiiac.value);
var splRateIncPTI115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[39].splRateInc')[0]; splRateIncPTI115A1aiiac.value = coalesce(splRateIncPTI115A1aiiac.value);
var taxableIncPTI115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[39].taxableInc')[0]; taxableIncPTI115A1aiiac.value = coalesce(taxableIncPTI115A1aiiac.value);
var splRateIncTaxPTI115A1aiiac = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[39].splRateIncTax')[0]; splRateIncTaxPTI115A1aiiac.value = coalesce(splRateIncTaxPTI115A1aiiac.value);

var secCodePTI115A1aiii =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[40].secCode')[0]; secCodePTI115A1aiii.value = coalesceString(secCodePTI115A1aiii.value);
var splRatePercentPTI115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[40].splRatePercent')[0]; splRatePercentPTI115A1aiii.value = coalesce(splRatePercentPTI115A1aiii.value);
var splRateIncPTI115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[40].splRateInc')[0]; splRateIncPTI115A1aiii.value = coalesce(splRateIncPTI115A1aiii.value);
var taxableIncPTI115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[40].taxableInc')[0]; taxableIncPTI115A1aiii.value = coalesce(taxableIncPTI115A1aiii.value);
var splRateIncTaxPTI115A1aiii = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[40].splRateIncTax')[0]; splRateIncTaxPTI115A1aiii.value = coalesce(splRateIncTaxPTI115A1aiii.value);

var secCodePTIParaEII =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[41].secCode')[0]; secCodePTIParaEII.value = coalesceString(secCodePTIParaEII.value);
var splRatePercentPTIParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[41].splRatePercent')[0]; splRatePercentPTIParaEII.value = coalesce(splRatePercentPTIParaEII.value);
var splRateIncPTIParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[41].splRateInc')[0]; splRateIncPTIParaEII.value = coalesce(splRateIncPTIParaEII.value);
var taxableIncPTIParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[41].taxableInc')[0]; taxableIncPTIParaEII.value = coalesce(taxableIncPTIParaEII.value);
var splRateIncTaxPTIParaEII = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[41].splRateIncTax')[0]; splRateIncTaxPTIParaEII.value = coalesce(splRateIncTaxPTIParaEII.value);

var secCodePTI115A1b =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[42].secCode')[0]; secCodePTI115A1b.value = coalesceString(secCodePTI115A1b.value);
var splRatePercentPTI115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[42].splRatePercent')[0]; splRatePercentPTI115A1b.value = coalesce(splRatePercentPTI115A1b.value);
var splRateIncPTI115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[42].splRateInc')[0]; splRateIncPTI115A1b.value = coalesce(splRateIncPTI115A1b.value);
var taxableIncPTI115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[42].taxableInc')[0]; taxableIncPTI115A1b.value = coalesce(taxableIncPTI115A1b.value);
var splRateIncTaxPTI115A1b = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[42].splRateIncTax')[0]; splRateIncTaxPTI115A1b.value = coalesce(splRateIncTaxPTI115A1b.value);

var secCodePTI115AC1ab =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[43].secCode')[0]; secCodePTI115AC1ab.value = coalesceString(secCodePTI115AC1ab.value);
var splRatePercentPTI115AC1ab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[43].splRatePercent')[0]; splRatePercentPTI115AC1ab.value = coalesce(splRatePercentPTI115AC1ab.value);
var splRateIncPTI115AC1ab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[43].splRateInc')[0]; splRateIncPTI115AC1ab.value = coalesce(splRateIncPTI115AC1ab.value);
var taxableIncPTI115AC1ab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[43].taxableInc')[0]; taxableIncPTI115AC1ab.value = coalesce(taxableIncPTI115AC1ab.value);
var splRateIncTaxPTI115AC1ab = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[43].splRateIncTax')[0]; splRateIncTaxPTI115AC1ab.value = coalesce(splRateIncTaxPTI115AC1ab.value);

var secCodePTI115AD1i115AB =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[44].secCode')[0]; secCodePTI115AD1i115AB.value = coalesceString(secCodePTI115AD1i115AB.value);
var splRatePercentPTI115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[44].splRatePercent')[0]; splRatePercentPTI115AD1i115AB.value = coalesce(splRatePercentPTI115AD1i115AB.value);
var splRateIncPTI115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[44].splRateInc')[0]; splRateIncPTI115AD1i115AB.value = coalesce(splRateIncPTI115AD1i115AB.value);
var taxableIncPTI115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[44].taxableInc')[0]; taxableIncPTI115AD1i115AB.value = coalesce(taxableIncPTI115AD1i115AB.value);
var splRateIncTaxPTI115AD1i115AB = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[44].splRateIncTax')[0]; splRateIncTaxPTI115AD1i115AB.value = coalesce(splRateIncTaxPTI115AD1i115AB.value);

var secCodePTI115AD1i194LD =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[45].secCode')[0]; secCodePTI115AD1i194LD.value = coalesceString(secCodePTI115AD1i194LD.value);
var splRatePercentPTI115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[45].splRatePercent')[0]; splRatePercentPTI115AD1i194LD.value = coalesce(splRatePercentPTI115AD1i194LD.value);
var splRateIncPTI115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[45].splRateInc')[0]; splRateIncPTI115AD1i194LD.value = coalesce(splRateIncPTI115AD1i194LD.value);
var taxableIncPTI115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[45].taxableInc')[0]; taxableIncPTI115AD1i194LD.value = coalesce(taxableIncPTI115AD1i194LD.value);
var splRateIncTaxPTI115AD1i194LD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[45].splRateIncTax')[0]; splRateIncTaxPTI115AD1i194LD.value = coalesce(splRateIncTaxPTI115AD1i194LD.value);

var secCodePTI115BBA =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[46].secCode')[0]; secCodePTI115BBA.value = coalesceString(secCodePTI115BBA.value);
var splRatePercentPTI115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[46].splRatePercent')[0]; splRatePercentPTI115BBA.value = coalesce(splRatePercentPTI115BBA.value);
var splRateIncPTI115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[46].splRateInc')[0]; splRateIncPTI115BBA.value = coalesce(splRateIncPTI115BBA.value);
var taxableIncPTI115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[46].taxableInc')[0]; taxableIncPTI115BBA.value = coalesce(taxableIncPTI115BBA.value);
var splRateIncTaxPTI115BBA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[46].splRateIncTax')[0]; splRateIncTaxPTI115BBA.value = coalesce(splRateIncTaxPTI115BBA.value);

var secCodePTI115BBD =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[47].secCode')[0]; secCodePTI115BBD.value = coalesceString(secCodePTI115BBD.value);
var splRatePercentPTI115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[47].splRatePercent')[0]; splRatePercentPTI115BBD.value = coalesce(splRatePercentPTI115BBD.value);
var splRateIncPTI115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[47].splRateInc')[0]; splRateIncPTI115BBD.value = coalesce(splRateIncPTI115BBD.value);
var taxableIncPTI115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[47].taxableInc')[0]; taxableIncPTI115BBD.value = coalesce(taxableIncPTI115BBD.value);
var splRateIncTaxPTI115BBD = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[47].splRateIncTax')[0]; splRateIncTaxPTI115BBD.value = coalesce(splRateIncTaxPTI115BBD.value);

var secCodePTI115BBDA =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[48].secCode')[0]; secCodePTI115BBDA.value = coalesceString(secCodePTI115BBDA.value);
var splRatePercentPTI115BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[48].splRatePercent')[0]; splRatePercentPTI115BBDA.value = coalesce(splRatePercentPTI115BBDA.value);
var splRateIncPTI115BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[48].splRateInc')[0]; splRateIncPTI115BBDA.value = coalesce(splRateIncPTI115BBDA.value);
var taxableIncPTI115BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[48].taxableInc')[0]; taxableIncPTI115BBDA.value = coalesce(taxableIncPTI115BBDA.value);
var splRateIncTaxPTI115BBDA = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[48].splRateIncTax')[0]; splRateIncTaxPTI115BBDA.value = coalesce(splRateIncTaxPTI115BBDA.value);

var secCodePTI115AB1a =  document.getElementsByName('itr7.scheduleSI.splCodeRateTax[49].secCode')[0]; secCodePTI115AB1a.value = coalesceString(secCodePTI115AB1a.value);
var splRatePercentPTI115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[49].splRatePercent')[0]; splRatePercentPTI115AB1a.value = coalesce(splRatePercentPTI115AB1a.value);
var splRateIncPTI115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[49].splRateInc')[0]; splRateIncPTI115AB1a.value = coalesce(splRateIncPTI115AB1a.value);
var taxableIncPTI115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[49].taxableInc')[0]; taxableIncPTI115AB1a.value = coalesce(taxableIncPTI115AB1a.value);
var splRateIncTaxPTI115AB1a = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[49].splRateIncTax')[0]; splRateIncTaxPTI115AB1a.value = coalesce(splRateIncTaxPTI115AB1a.value);



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

// taxableInc115A1ai.value=zeroOrMore(splRateInc115A1ai.value);
// splRateIncTax115A1ai.value =
// Math.round((20*eval(parseInt(taxableInc115A1ai.value,10)))/parseInt('100'
// ,10));


// splRateInc5BB.value =
// zeroOrMore(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls[0].sourceAmount')[0].value));

// splRateInc5BBE.value =
// zeroOrMore(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.othersGrossDtls[7].sourceAmount')[0].value));

// splRateInc5BBF.value =
// zeroOrMore(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.sec11BBF')[0].value));

// splRateInc5BBG.value =
// zeroOrMore(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.sec11BBG')[0].value));

// splRateInc5BBDA.value =
// zeroOrMore(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incomeFromDomCompany')[0].value));

// splRateInc5BBDA.value = parseInt('0', 10);
// /*zeroOrMore(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incomeFromDomCompany')[0].value));*/

var exemptLimit=0;
exemptLimit = getExemptLimit();

if(eval(parseInt(totalIncome.value ,10)) > 0) {
var taxableIncome = eval(parseInt(totalIncome.value ,10)) - eval(parseInt(coalesce(incChargeTaxSplRate111A112.value) ,10));

if(taxableIncome>=0) {
	var remaining = eval(parseInt(exemptLimit ,10)) - eval(parseInt(taxableIncome ,10));

	if(remaining > 0) {
			if(splRateInc21.value>=remaining) {
					taxableInc21.value = splRateInc21.value - remaining;
					taxableInc1A.value = coalesce(splRateInc1A.value);
					taxableInc22.value = splRateInc22.value;
			} else {
					taxableInc21.value = 0;
					remaining = remaining - splRateInc21.value;
					if(coalesce(splRateInc1A.value) >= remaining) {
						taxableInc1A.value = coalesce(splRateInc1A.value) - remaining;
						taxableInc22.value = splRateInc22.value;
					} else {
						taxableInc1A.value = 0;
						remaining = remaining - coalesce(splRateInc1A.value);
						if(splRateInc22.value >= remaining) {
							taxableInc22.value = splRateInc22.value - remaining;
						} else {
							taxableInc22.value = 0;
							remaining = remaining - taxableInc22.value;
						}

					}
			}
		} else {
			taxableInc21.value = splRateInc21.value;
			taxableInc1A.value = coalesce(splRateInc1A.value);
			taxableInc22.value = splRateInc22.value;
		}
} else {
    var remaining = eval(parseInt(exemptLimit ,10));
     if(splRateInc21.value>=remaining) {
					taxableInc21.value = splRateInc21.value - remaining;
					taxableInc1A.value = coalesce(splRateInc1A.value);
					taxableInc22.value = splRateInc22.value;
			} else {
					taxableInc21.value = 0;
					remaining = remaining - splRateInc21.value;
					if(coalesce(splRateInc1A.value) >= remaining) {
						taxableInc1A.value = coalesce(splRateInc1A.value) - remaining;
						taxableInc22.value = splRateInc22.value;
					} else {
						taxableInc1A.value = 0;
						remaining = remaining - coalesce(splRateInc1A.value);
						if(splRateInc22.value >= remaining) {
							taxableInc22.value = splRateInc22.value - remaining;
						} else {
							taxableInc22.value = 0;
							remaining = remaining - taxableInc22.value;
						}

					}
			}
}
} else {
    var remaining = eval(parseInt(exemptLimit ,10));
     if(splRateInc21.value>=remaining) {
					taxableInc21.value = splRateInc21.value - remaining;
					taxableInc1A.value = coalesce(splRateInc1A.value);
					taxableInc22.value = splRateInc22.value;
			} else {
					taxableInc21.value = 0;
					remaining = remaining - splRateInc21.value;
					if(coalesce(splRateInc1A.value) >= remaining) {
						taxableInc1A.value = coalesce(splRateInc1A.value) - remaining;
						taxableInc22.value = splRateInc22.value;
					} else {
						taxableInc1A.value = 0;
						remaining = remaining - coalesce(splRateInc1A.value);
						if(splRateInc22.value >= remaining) {
							taxableInc22.value = splRateInc22.value - remaining;
						} else {
							taxableInc22.value = 0;
							remaining = remaining - taxableInc22.value;
						}

					}
			}
}

var splRateInc00 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateInc')[0]; splRateInc00.value = coalesce(splRateInc00.value);
var taxableInc00 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].taxableInc')[0]; taxableInc00.value = coalesce(taxableInc00.value);
var splRateIncTax00 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateIncTax')[0]; splRateIncTax00.value = coalesce(splRateIncTax00.value);
// Taxable income for the remaining 3 rows other than auto populate
taxableInc5BB.value = splRateInc5BB.value;
taxableInc5BBE.value = splRateInc5BBE.value;
taxableInc1A.value = splRateInc1A.value;
taxableInc22.value = splRateInc22.value;
taxableInc21A.value = splRateInc21A.value;
taxableInc5B.value = splRateInc5B.value;
taxableInc00.value = splRateInc00.value;
taxableInc115AC1c.value=splRateInc115AC1c.value;
taxableInc115ADiii.value=splRateInc115ADiii.value;
taxableInc115AB1b.value=splRateInc115AB1b.value;
taxableInc115ADibiip.value=splRateInc115ADibiip.value
taxableInc115ADibii.value=splRateInc115ADibii.value;
taxableInc5BBDA.value=splRateInc5BBDA.value;
// taxableInc5BBF.value=splRateInc5BBF.value;
// taxableInc5BBG.value=splRateInc5BBG.value;
taxableInc115A1ai.value=splRateInc115A1ai.value;
taxableInc115A1aii.value=splRateInc115A1aii.value;
taxableIncParaEII.value=splRateIncParaEII.value;
taxableInc115A1aiia.value=splRateInc115A1aiia.value;
taxableInc115A1aiiaa.value=splRateInc115A1aiiaa.value;
taxableInc115A1aiii.value=splRateInc115A1aiii.value;
taxableInc1121ciii.value=splRateInc1121ciii.value;
taxableInc115A1b.value=splRateInc115A1b.value;
taxableInc115AB1a.value=splRateInc115AB1a.value;
taxableInc115BBA.value=splRateInc115BBA.value;
taxableInc115BBD.value=splRateInc115BBD.value;
taxableInc115AD1i115AB.value=splRateInc115AD1i115AB.value;
taxableInc115AD1i194LD.value=splRateInc115AD1i194LD.value;
taxableInc115ADiiii.value=splRateInc115ADiiii.value;
taxableInc115AC1ab.value=splRateInc115AC1ab.value;
taxableInc115A1aiiab.value=splRateInc115A1aiiab.value;
taxableInc115A1aiiac.value=splRateInc115A1aiiac.value;
taxableIncPTI115A1ai.value=splRateIncPTI115A1ai.value;
taxableIncPTI115A1aii.value=splRateIncPTI115A1aii.value;
taxableIncPTI115A1aiia.value=splRateIncPTI115A1aiia.value;
taxableIncPTI115A1aiiaa.value=splRateIncPTI115A1aiiaa.value;
taxableIncPTI115A1aiiab.value=splRateIncPTI115A1aiiab.value;
taxableIncPTI115A1aiiac.value=splRateIncPTI115A1aiiac.value;
taxableIncPTI115A1aiii.value=splRateIncPTI115A1aiii.value;
taxableIncPTIParaEII.value=splRateIncPTIParaEII.value;
taxableIncPTI115A1b.value=splRateIncPTI115A1b.value;
taxableIncPTI115AC1ab.value=splRateIncPTI115AC1ab.value;
taxableIncPTI115AD1i115AB.value=splRateIncPTI115AD1i115AB.value;
taxableIncPTI115AD1i194LD.value=splRateIncPTI115AD1i194LD.value;
taxableIncPTI115BBA.value=splRateIncPTI115BBA.value;
taxableIncPTI115BBD.value=splRateIncPTI115BBD.value;
taxableIncPTI115BBDA.value=splRateIncPTI115BBDA.value;
// taxableIncPTI115BBF.value=splRateIncPTI115BBF.value;
// taxableIncPTI115BBG.value=splRateIncPTI115BBG.value;
taxableIncPTI115AB1a.value=splRateIncPTI115AB1a.value;
// taxableIncDTAA.value = splRateIncDTAA.value;
// taxableInc1.value = splRateInc5BBDA.value;

// Column 'Tax thereon' values for fixed rows
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));
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));
splRateIncTax5BBE.value = Math.round((60*eval(parseInt(taxableInc5BBE.value,10)))/parseInt('100' ,10));
splRateIncTax115AC1c.value = Math.round((10*eval(parseInt(taxableInc115AC1c.value,10)))/parseInt('100' ,10));
splRateIncTax115ADiii.value = Math.round((30*eval(parseInt(taxableInc115ADiii.value,10)))/parseInt('100' ,10));
splRateIncTax115AB1b.value=Math.round((10*eval(parseInt(taxableInc115AB1b.value,10)))/parseInt('100',10));

splRateIncTax115ADibiip.value = Math.round((15*eval(parseInt(taxableInc115ADibiip.value,10)))/parseInt('100' ,10));
splRateIncTax115ADibii.value = Math.round((15*eval(parseInt(taxableInc115ADibii.value,10)))/parseInt('100' ,10));
splRateIncTax5BBDA.value= Math.round((10*eval(parseInt(taxableInc5BBDA.value,10)))/parseInt('100' ,10));
// splRateIncTax5BBF.value=
// Math.round((10*eval(parseInt(taxableInc5BBF.value,10)))/parseInt('100' ,10));
// splRateIncTax5BBG.value=
// Math.round((10*eval(parseInt(taxableInc5BBG.value,10)))/parseInt('100' ,10));
splRateIncTax115A1ai.value= Math.round((20*eval(parseInt(taxableInc115A1ai.value,10)))/parseInt('100' ,10));
splRateIncTax115A1aii.value= Math.round((20*eval(parseInt(taxableInc115A1aii.value,10)))/parseInt('100' ,10));
splRateIncTaxParaEII.value= Math.round((50*eval(parseInt(taxableIncParaEII.value,10)))/parseInt('100' ,10));
// splRateIncTax21A.value =
// Math.round((10*eval(parseInt(taxableInc21A.value,10)))/parseInt('100' ,10));
splRateIncTax115A1aiia.value= Math.round((5*eval(parseInt(taxableInc115A1aiia.value,10)))/parseInt('100' ,10));
splRateIncTax115A1aiiaa.value= Math.round((5*eval(parseInt(taxableInc115A1aiiaa.value,10)))/parseInt('100' ,10));
splRateIncTax115A1aiii.value= Math.round((20*eval(parseInt(taxableInc115A1aiii.value,10)))/parseInt('100' ,10));
splRateIncTax1121ciii.value= Math.round((10*eval(parseInt(taxableInc1121ciii.value,10)))/parseInt('100',10));

splRateIncTax115A1b.value= Math.round((10*eval(parseInt(taxableInc115A1b.value,10)))/parseInt('100' ,10));
splRateIncTax115AB1a.value= Math.round((10*eval(parseInt(taxableInc115AB1a.value,10)))/parseInt('100' ,10));
splRateIncTax115BBA.value= Math.round((20*eval(parseInt(taxableInc115BBA.value,10)))/parseInt('100' ,10));
splRateIncTax115BBD.value= Math.round((15*eval(parseInt(taxableInc115BBD.value,10)))/parseInt('100' ,10));
splRateIncTax115AD1i115AB.value= Math.round((20*eval(parseInt(taxableInc115AD1i115AB.value,10)))/parseInt('100' ,10));
splRateIncTax115AD1i194LD.value= Math.round((5*eval(parseInt(taxableInc115AD1i194LD.value,10)))/parseInt('100' ,10));
splRateIncTax115ADiiii.value = Math.round((10*eval(parseInt(taxableInc115ADiiii.value,10)))/parseInt('100' ,10));
splRateIncTax115AC1ab.value= Math.round((10*eval(parseInt(taxableInc115AC1ab.value,10)))/parseInt('100' ,10));
splRateIncTax115A1aiiab.value= Math.round((5*eval(parseInt(taxableInc115A1aiiab.value,10)))/parseInt('100' ,10));
splRateIncTax115A1aiiac.value= Math.round((5*eval(parseInt(taxableInc115A1aiiac.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1ai.value= Math.round((20*eval(parseInt(taxableIncPTI115A1ai.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1aii.value= Math.round((20*eval(parseInt(taxableIncPTI115A1aii.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1aiia.value= Math.round((5*eval(parseInt(taxableIncPTI115A1aiia.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1aiiaa.value= Math.round((5*eval(parseInt(taxableIncPTI115A1aiiaa.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1aiiab.value= Math.round((5*eval(parseInt(taxableIncPTI115A1aiiab.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1aiiac.value= Math.round((5*eval(parseInt(taxableIncPTI115A1aiiac.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1aiii.value= Math.round((20*eval(parseInt(taxableIncPTI115A1aiii.value,10)))/parseInt('100' ,10));
splRateIncTaxPTIParaEII.value= Math.round((50*eval(parseInt(taxableIncPTIParaEII.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115A1b.value= Math.round((10*eval(parseInt(taxableIncPTI115A1b.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115AC1ab.value= Math.round((10*eval(parseInt(taxableIncPTI115AC1ab.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115AD1i115AB.value= Math.round((20*eval(parseInt(taxableIncPTI115AD1i115AB.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115AD1i194LD.value= Math.round((5*eval(parseInt(taxableIncPTI115AD1i194LD.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115BBA.value= Math.round((20*eval(parseInt(taxableIncPTI115BBA.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115BBD.value= Math.round((15*eval(parseInt(taxableIncPTI115BBD.value,10)))/parseInt('100' ,10));
splRateIncTaxPTI115BBDA.value= Math.round((10*eval(parseInt(taxableIncPTI115BBDA.value,10)))/parseInt('100' ,10));
// splRateIncTaxPTI115BBF.value=
// Math.round((10*eval(parseInt(taxableIncPTI115BBF.value,10)))/parseInt('100'
// ,10));
// splRateIncTaxPTI115BBG.value=
// Math.round((10*eval(parseInt(taxableIncPTI115BBG.value,10)))/parseInt('100'
// ,10));
splRateIncTaxPTI115AB1a.value= Math.round((10*eval(parseInt(taxableIncPTI115AB1a.value,10)))/parseInt('100' ,10));

if(taxableInc21A.value > 100000){
	splRateIncTax21A.value = coalesce(Math.round((10*eval(parseInt(taxableInc21A.value,10) - 100000))/parseInt('100' ,10)))
}else{
	splRateIncTax21A.value = '0';
}



splRateIncTax00.value = Math.round((15*eval(parseInt(taxableInc00.value,10)))/parseInt('100' ,10));
splRateIncTax5B.value = Math.round((12.5*eval(parseInt(taxableInc5B.value,10)))/parseInt('100' ,10));

// splRateIncTax115A1ai.value =
// Math.round((20*eval(parseInt(taxableInc115A1ai.value,10)))/parseInt('100'
// ,10));


// splRateIncTaxDTAA.value =
// Math.round((1*eval(parseInt(taxableIncDTAA.value,10)))/parseInt('100' ,10));
// splRateIncTax1.value =
// Math.round((10*eval(parseInt(taxableInc1.value,10)))/parseInt('100' ,10));
calculateSITotal();
	calculateTiTti('scheduleSI');

}




function getExemptLimit() {
	var limit=0;

	var status = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value;
	var residentialStatus = document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value;
	var dob = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.dateOFFormOrIncorp')[0].value;
	if(residentialStatus == 'NRI') {
		limit = 0;
	}

	return limit;
}

function selectToTextReadonly(selectField,textField,checkValue){
	var val=document.getElementsByName(selectField)[0].value;
	if(document.getElementsByName(textField)[0].type=='select-one'){
	if(val == checkValue){
		document.getElementsByName(textField)[0].disabled=false;
	}
	else{
		document.getElementsByName(textField)[0].disabled=true;
		if(document.getElementsByName(textField)[0].options[0].value == 0){
			document.getElementsByName(textField)[0].value="0";
		}else{
		document.getElementsByName(textField)[0].value="";
		}
	}
	}
	else{
	if(val == checkValue){
		document.getElementsByName(textField)[0].readOnly=false;
                document.getElementsByName(textField)[0].disabled=false;
	}
	else{
		document.getElementsByName(textField)[0].readOnly=true;
                document.getElementsByName(textField)[0].disabled=true;
		document.getElementsByName(textField)[0].value="";
	}
	}
}
function selectToTextReadonlySchLA(){
	if(document.getElementsByName('itr7.scheduleLA.accountsAudited')[0].value=='N'){
		document.getElementsByName('itr7.scheduleLA.auditFurnishDate')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.nameofAuditor')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.memNoAuditor')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.nameofFirm')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.firmRegistrationNo')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.firmPaNno')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.firmAdenum')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.auditReportDate')[0].disabled=true;
		document.getElementsByName('itr7.scheduleLA.auditFurnishDate')[0].value='';
		document.getElementsByName('itr7.scheduleLA.nameofAuditor')[0].value='';
		document.getElementsByName('itr7.scheduleLA.memNoAuditor')[0].value='';
		document.getElementsByName('itr7.scheduleLA.nameofFirm')[0].value='';
		document.getElementsByName('itr7.scheduleLA.firmRegistrationNo')[0].value='';
		document.getElementsByName('itr7.scheduleLA.firmPaNno')[0].value='';
		document.getElementsByName('itr7.scheduleLA.firmAdenum')[0].value='';
		document.getElementsByName('itr7.scheduleLA.auditReportDate')[0].value='';
	}
	else{
		document.getElementsByName('itr7.scheduleLA.auditFurnishDate')[0].disabled=false;
		document.getElementsByName('itr7.scheduleLA.nameofAuditor')[0].disabled=false;
		document.getElementsByName('itr7.scheduleLA.memNoAuditor')[0].disabled=false;
		document.getElementsByName('itr7.scheduleLA.nameofFirm')[0].disabled=false;
		document.getElementsByName('itr7.scheduleLA.firmRegistrationNo')[0].disabled=false;
		document.getElementsByName('itr7.scheduleLA.firmPaNno')[0].disabled=false;
		document.getElementsByName('itr7.scheduleLA.firmAdenum')[0].disabled=false;
		document.getElementsByName('itr7.scheduleLA.auditReportDate')[0].disabled=false;

	}

}

function isLetOut(){

	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);
	for ( var i = 0; i < totHp; i++) {
		var tempName = 'itr7.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('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = false;
		} 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('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = false;

		} 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('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = true;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].value = '';
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = true;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].value = '';
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = true;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].value = '';
		}

	}

}


function addRowToTableScheduleSI(tableId,noOfRow,last){

	addRowToTable(tableId,noOfRow,last);
	scheduleSiIncome (tableId);
	var table=document.getElementById(tableId);
	modifyRow(table);

}

function deleteRowToTableScheduleSI(tableId,noOfRow,last){

	deleteRowTableModifiedSI(tableId,noOfRow,last,14);
	scheduleSiIncome(tableId);

}


function checkTableEmpty(tableId){

	var tab = document.getElementById(tableId);
	var allInputTags = tab.getElementsByTagName('input');
	var allSelectTags = tab.getElementsByTagName('select');
	var allTextareaTags = tab.getElementsByTagName('textarea');
	var isTableBlank = 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(str!=''){
								isTableBlank = 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!=''){
				isTableBlank = false;
				break;
			}
		}
	}

	for ( var i = 0; i < allSelectTags.length; i++) {
		if(allSelectTags[i].value != '-1' && allSelectTags[i].value != ''){
			isTableBlank = false;
			break;
		}
	}

	return isTableBlank;
}


function validateXML(){

    var flag=true;
    flag=panStatusCheck();

    if(flag){
         flag=trAndFSICheck('scheduleFSI','scheduleTR');
    }
    return flag;

}

function trAndFSICheck(scheduleFSI,scheduleTR){

 var flag=true;

 var isFsiBlank = checkTableEmpty(scheduleFSI);
 var isTRBlank  = checkTableEmpty(scheduleTR);


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

 var residentStatus = document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value;
 var checkValue = 'RES';

 if(claimUs9090A91Flag=='YES' && isFsiBlank && isTRBlank){

	addErrorXHTML('','Please fill the TR and FSI Schedules, as you have selected claim under section 90/90A/91',true)
	flag=false;

 }

 if(isFsiBlank && !isTRBlank && residentStatus==checkValue){
	 showPage('page26');
	addErrorXHTML('','Please fill the details in Schedule FSI.');
	flag=false;

 }

 return flag;


}

function panStatusCheck(){
    var statusOfPerson       	= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value ;
    var panStatus		= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.panNumber')[0].value.substring(3,4);

         var statusCheck=true;

        var error = 'Please enter a valid PAN for the selected Status';

	if((statusOfPerson=="07") && !(panStatus == "C" || panStatus == "G")){
             addErrorXHTML('',error);
            showPage('page2');
            statusCheck = false;
        }
        else if(statusOfPerson=="08" && !(panStatus == "A" || panStatus == "B" || panStatus == "G")){
            addErrorXHTML('',error);
            showPage('page2');
            statusCheck = false;
        }
        /*
		 * else if(statusOfPerson=="03" && !(panStatus == "F" || panStatus ==
		 * "G")){ addErrorXHTML('',error); showPage('page2'); statusCheck =
		 * false; }
		 */
        else if(statusOfPerson=="05" && !(panStatus == "T" || panStatus == "A" || panStatus == "B" || panStatus == "G")){
             addErrorXHTML('',error);
            showPage('page2');
            statusCheck = false;
        }
        else if(statusOfPerson=="06" && !(panStatus == "A" || panStatus == "J" || panStatus == "G")){
             addErrorXHTML('',error);
            showPage('page2');
            statusCheck = false;
        }

        else if(statusOfPerson=="04" && !(panStatus == "L" || panStatus == "G")){
             addErrorXHTML('',error);
            showPage('page2');
            statusCheck = false;
        }

    return statusCheck;

}

function disableMATorAMT(){

	var statusOfPerson	= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value ;
	var panStatus		= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.panNumber')[0].value.substring(3,4);

	if(statusOfPerson==undefined || statusOfPerson =='' || statusOfPerson==null) {
		$('#itrScheduleAMT').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleAMT').find(':input').prop('disabled', true);
		$('#itrScheduleAMTC').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleAMTC').find(':input').prop('disabled', true);

		$('#itrScheduleMAT').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleMAT').find(':input').prop('disabled', true);
		$('#itrScheduleMATC').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleMATC').find(':input').prop('disabled', true);
	} else if(statusOfPerson=='7'){
		$('#itrScheduleAMT').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleAMT').find(':input').prop('disabled', true);
		$('#itrScheduleAMTC').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleAMTC').find(':input').prop('disabled', true);

		$('#itrScheduleMAT').find(':input').prop('disabled', false);
		$('#itrScheduleMATC').find(':input').prop('disabled', false);
		 // calcMATCFromTTI();
	}else{
		$('#itrScheduleMAT').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleMAT').find(':input').prop('disabled', true);
		$('#itrScheduleMATC').find(":input[type!='hidden']").prop('value', '');
		$('#itrScheduleMATC').find(':input').prop('disabled', true);

		$('#itrScheduleAMT').find(':input').prop('disabled', false);
		$('#itrScheduleAMTC').find(':input').prop('disabled', false);

	}

}




function converToZeroIfPositive(fieldValue){

	if(eval(fieldValue)>0){

		fieldValue=0;
	}

	return fieldValue;
}

function validatePage(){
	var statusOfPerson	= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value ;
	var panStatus		= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.panNumber')[0].value.substring(3,4);
	var pan          	= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.panNumber')[0].value;
	var doi          	= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.dateOFFormOrIncorp')[0].value;
    var resiStatus      = document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value ;
	var flag			= true;

        if(flag && panStatusCheck()){

            disableMATorAMT();

            // flag = isMATCorAMTCValid();

         }else{

             flag=false;
         }
       return flag;

}



function addAuditDetails(){
	var b = $('#auditDetailsButton')[0];
	var v = eval($('.auditDetailsRow').last()[0].cells[0].innerHTML);
	var cl = $('.auditDetailsRow').last().clone();
	cl.find(':input').val('');
	var dates = cl.find('.hasDatepicker').removeClass('hasDatepicker');
	var ins = cl.find(':input');
	cl = cl[0];
	b.parentElement.insertBefore(cl,b);
	$('.auditDetailsRow').last()[0].cells[0].innerHTML = (v+1);
	for(var i=0;i<ins.length;i++){
		ins[i].name='itr7.partAGEN2.auditDetails[' + v + ']' + ins[i].name.substr(ins[i].name.lastIndexOf(']')+1);
		ins[i].id=ins[i].name.replace(/([\.\[\]])/g,'_').replace(/(__)/g,'_');
		var blurAttr=ins[i].getAttribute('onblur');
		if(blurAttr!=null){
			blurAttr=blurAttr+";";
		}else{
			blurAttr="";
		}
		ins[i].setAttribute('onblur',blurAttr+'j.blur(this,this.name,this.value);');
	}
	dates.datepicker({	changeMonth : true,
						changeYear : true,
						yearRange: "-100:+5",
						dateFormat : "dd/mm/yy",
						buttonText : "Choose",
						showOtherMonths : true,
						selectOtherMonths : true
						});
	$('#deleteAuditBtnId').prop('disabled', false);
	var table=document.getElementById('AuditDetails');
	modifyRow(table);
	checkMaxLengthLimit();
}

function delAuditDetails(){
	if($('.auditDetailsRow').length>1){
		if($('.auditDetailsRow').length==2){
			$('#deleteAuditBtnId').prop('disabled', true);
		}
		$('.auditDetailsRow')[0].parentNode.deleteRow($('.auditDetailsRow').length);
	}else{
		$('#deleteAuditBtnId').prop('disabled', true);
	}
	var table=document.getElementById('AuditDetails');
	modifyRow(table);
}

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 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 getCurDate() {

	var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1;

    var yyyy = today.getFullYear();
    if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm}

    var today = dd+'/'+mm+'/'+yyyy;

    return today;
}

function isFirstDateBeforeOrEqual(firstDate,secondDate) {
	if((firstDate != null && firstDate != '') && (secondDate != null && secondDate != '')){
		if(eval(firstDate.substring(6,10)) < eval(secondDate.substring(6,10))){
			return true;
		} else if(eval(firstDate.substring(6,10)) == eval(secondDate.substring(6,10))){
			if(eval(firstDate.substring(3,5)) < eval(secondDate.substring(3,5))){
				return true;
			} else if(eval(firstDate.substring(3,5)) == eval(secondDate.substring(3,5))){
				if(eval(firstDate.substring(0,2)) < eval(secondDate.substring(0,2))){
					return true;
				} else {
					return false;
				}
			} else{
				return false;
			}
		} else {
			return false;
		}
	}else{
		return false;
	}
}

function checkSchFAMandatory() {
	if(document.getElementsByName('itr7.partBTTI.assetOutIndiaFlag')[0].value=='YES') {
		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(table1 && table2 && table3 && table4 && table5 && table6 && table7 && table8 && table9 && table10) {
			j.setFieldError('itr7.scheduleFA.detailsForiegnBank[0].countryCode','Please enter any one table in Schedule FA.');
			addErrorXHTML('','Please enter any one table in Schedule FA.',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 > 1){
					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;
				}
			}
		}
	}
	// To validate 30% of Annual value in Sch HP on Submit
	var totHp=eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent)-1);
	var total=0;
    var thirtyPercentOfBalanceTemp = 0;
	var thirtyPercentOfBalance = 0;

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

		thirtyPercentOfBalance = document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.thirtyPercentOfBalance')[0];

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

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


      	thirtyPercentOfBalanceTemp = zeroOrMore(coalesce(Math.round(eval(parseInt(document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.balanceALV')[0].value==""?0:coalesceSetRet('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.balanceALV')) * 0.3 ))));
      	if(coalesce(thirtyPercentOfBalance.value) > parseInt(thirtyPercentOfBalanceTemp ,10) ){
			addErrorXHTML(thirtyPercentOfBalance, 'Amount can not be more than 30% of Annual value i.e, '+thirtyPercentOfBalanceTemp+'.',true);
			j.setFieldError(thirtyPercentOfBalance,'Amount can not be more than 30% of Annual value i.e, '+thirtyPercentOfBalanceTemp+'.');

		}
	}
}

function validateTi(){


	var grossTotalIncome = document.getElementsByName('itr7.partBTI.grossTotalIncome')[0].value;
	var incChargeTaxSplRate111A112 = document.getElementsByName('itr7.partBTI.incChargeTaxSplRate111A112')[0].value;
	/*
	 * var deductionsUnderScheduleVIA =
	 * document.getElementsByName('itr7.partBTI.deductionsUnderScheduleVIA')[0].value;
	 * if(parseInt(deductionsUnderScheduleVIA, 0) >
	 * zeroOrMore(parseInt(grossTotalIncome, 0) -
	 * parseInt(incChargeTaxSplRate111A112, 0))){
	 * j.setFieldError('itr7.partBTI.deductionsUnderScheduleVIA','Deductions
	 * under chapter VIA is limited to (16-17)');
	 * addErrorXHTML(document.getElementsByName('itr7.partBTI.deductionsUnderScheduleVI')[0],'Deductions
	 * under chapter VIA is limited to (16-17)',true); }
	 */
}

function validateOnSubmit(){
	try{
	
	// validateReturnFilingType();
	// validateSI();
	schCgDdError();
	valOsDtaa();
	valRegSecCheckbox();
	valRetFurnishedSec();
	valExemptSec();
	aadhaarValidatorPartAGen();
	aadPanValidatorSchLA();
	calculatePercentageSharePrpty();
	schETFor6v();
	valAnnyDonation();
	validateTotReceipts();
	//validateIE2();
	restrictCostOfNewAsst();
	// validateObjInst();
	validateIE3ObjInst();
	validateIE4ObjInst();
	validateReqNewProv();
	validateSecHidden();
	validateSchVC();
	validateTi();
	validatePriceShare();
	validateOSPoint8a8b();
	setSecRespOnSave();
	mandatorySchI();
	validateOSd();
	validateOSc();
	validateTI4iii();
	validateTI4v();
	validateHPRent();
	validateHPLetOut();
	enableGrossAmtTDS3();
	enableGrossAmtTDS2();
	// calculatetotalRevenueExpenses();
	checkUniqAuditSec();
	otherProperty();
    checkSchFAMandatory();
	validateScheduleHP();
	priBankMandtry();
	checkNatureBusFilled();
	//checkClaimExMandatory();
	// isMATCorAMTCValid();
	calculateTDS();
	calculateTCS();
	validatePage();
	CheckHPShareProperty();
	validateFSI();
	// checkUniqueOSSec();
	validateOSSI();
	checkUniqueTableCol('scheduleFSI', 'countryCode$','Same Country cannot be selected more than once.');
	schVCAmtCheck();
	setTaxStatusVal();
	checkNoOfRowsFilled();
	// validatePartSec();
	validateReturnFurSec();
	// Always keep alertItr7User() as the last method
	alertItr7User();
	validateReturnFurSec();
	validateIE3Grtthan34();
	valTDSGrossAmt();
	validateTDS29Grtthen67();
	validateTDS39Grtthen67();
	validateTDS2();
	validateTDS3();
	validateER();
	validateEC();
	systemDateCompOfDOF();
	systemDateCompOfDateOfAdv();
	appendzeroto5or6TCS();
	validateOsBbdaLottery();
	mandateScheduleIE();
	validateSchTi();
	valTDSGrossAmt();
	emptyPTI();
	valCGDropDownOnSave();
	/* validateCT(); */
	var tab = document.getElementById('rejApprovalDtls');
	var len = tab.rows.length-2;

	for(var i = 0; i < len; i++) {
		if(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].secUnderRegistration')[0].value != ""){
			if(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].regSecExmpClaimed')[0].checked){
				document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].regSecExmpClaimed')[0].value='true';
			} else {
				document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].regSecExmpClaimed')[0].value='false';
			}
		}else{
			document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].regSecExmpClaimed')[0].value='';
		}
	}
	
	
	}catch(e){
		alert('exception in validateOnSubmit ::'+e);
	}
}

function validateER(){

	var tab1 = document.getElementById('otherExpensesSchER');
	var noOfRows=tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for ( var i = 0; i < (noOfRows-2); i++) {
		if(document.getElementsByName('itr7.scheduleER.otherExpenses['+i+'].nature')[0].value!=''){
		if(document.getElementsByName('itr7.scheduleER.otherExpenses['+i+'].amount')[0].value==''){
			addErrorXHTML('','Please enter Amount A or Amount B in Other expenses of Schedule ER ');
			j.setFieldError('','Please enter Amount A or Amount B in Other expenses of Schedule ER ');
		}
		}

	}

}
function validateEC(){

	var tab1 = document.getElementById('otherCapitalExpense');
	var noOfRows=tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for ( var i = 0; i < (noOfRows-2); i++) {
		if(document.getElementsByName('itr7.scheduleEC.otherExpenses['+i+'].nature')[0].value!=''){
		if(document.getElementsByName('itr7.scheduleEC.otherExpenses['+i+'].amount')[0].value==''&&document.getElementsByName('itr7.scheduleEC.otherExpenses['+i+'].amountB')[0].value==''){
			addErrorXHTML('','Please enter Amount A or Amount B in Other capital expenses of Schedule EC ');
			j.setFieldError('','Please enter Amount A or Amount B in Other capital expenses of Schedule EC ');
		}
		}
	}

}

function setTaxStatusVal() {
	var  taxStatus = document.getElementsByName('itr7.partAGEN1.filingStatus.taxStatus')[0];

	if(document.getElementsByName('itr7.partBTTI.taxPaid.balTaxPayable')[0].value > 0){
		taxStatus.value = 'TP';
	}else if(document.getElementsByName('itr7.partBTTI.refund.refundDue')[0].value > 0){
		taxStatus.value = 'TR';
	}else{
		taxStatus.value = 'NT';
	}
}

function validateOSSI(){
	var osmap = {'5BBE':0,'1':0,'5BBF':0,'5BBG':0,'5BBDA':0};
	schedueOsCalc(osmap);
	/*
	 * var simap = {}; getSIMap(simap);
	 * 
	 * var osSectionsOld = Object.keys(osmap); var siSections =
	 * Object.keys(simap); var osSectionsMap = {};
	 * 
	 * for(var i=0;i<osSectionsOld.length; i++){ if(!(osSectionsOld[i]==68 ||
	 * osSectionsOld[i]==69|| osSectionsOld[i]=='69A' || osSectionsOld[i]=='69B' ||
	 * osSectionsOld[i]=='69C' || osSectionsOld[i]=='69D' ||
	 * osSectionsOld[i]=='aggrtvaluewithoutcons562x' ||
	 * osSectionsOld[i]=='immovpropwithoutcons562x' ||
	 * osSectionsOld[i]=='immovpropinadeqcons562x' ||
	 * osSectionsOld[i]=='anyotherpropwithoutcons562x' ||
	 * osSectionsOld[i]=='anyotherpropinadeqcons562x' ||
	 * osSectionsOld[i]=='Tot562x')) { osSectionsMap[osSectionsOld[i]]=
	 * coalesce(osmap[osSectionsOld[i]].value); }
	 *  }
	 * 
	 * var osSections = Object.keys(osSectionsMap);
	 * 
	 * if(osSections.length!=siSections.length){ if(osSections.length >
	 * siSections.length) { for(var i=0;i<osSections.length; i++){
	 * if(!simap[osSections[i]]) {
	 * j.setFieldError(osmap[osSections[i]].name,"The sections added in Schedule
	 * OS must be present in Schedule SI.");
	 * addErrorXHTML(osmap[osSections[i]],"The sections added in Schedule OS
	 * must be present in Schedule SI.");
	 * 
	 *  } } } else { for(var i=0;i<siSections.length; i++){
	 * if(!osmap[siSections[i]] && osmap[siSections[i]] != 0) {
	 * j.setFieldError(simap[siSections[i]].name,"The sections added in Schedule
	 * SI must be present in Schedule OS.");
	 * addErrorXHTML(simap[siSections[i]],"The sections added in Schedule SI
	 * must be present in Schedule OS."); } } } } else{ for(var i=0;i<osSections.length;
	 * i++){ if(simap[osSections[i]]) { if(coalesce(osmap[osSections[i]].value) !=
	 * coalesce(simap[osSections[i]].value)){
	 * j.setFieldError(simap[osSections[i]].name,"The special rate income of "+
	 * osSections[i] +" shown in Schedule OS must be shown in Schedule SI or
	 * vice versa."); addErrorXHTML( simap[osSections[i]],"The special rate
	 * income of "+ osSections[i] +" shown in Schedule OS must be shown in
	 * Schedule SI or vice versa."); } } else {
	 * 
	 * j.setFieldError(osmap[osSections[i]].name,"The special rate income of "+
	 * osSections[i] +" shown in Schedule OS must be shown in Schedule SI or
	 * vice versa."); addErrorXHTML( osmap[osSections[i]],"The special rate
	 * income of "+ osSections[i] +" shown in Schedule OS must be shown in
	 * Schedule SI or vice versa.");
	 *  }
	 *  } }
	 */
}

var osSecs = ['5A1ai','5A1aii','5A1aiia','5A1aiiaa','5A1aiiab','5A1aiiac','5A1aiii','FA','5A1bA','5A1bB','5AC1ab','5ACA1a','5AD1i','5AD1iP','5BBA','5BBDA','5BBE','5BBF','5BBG','1','5Ea','5AB1a'];

function getSIMap(simap){
	var tabl = document.getElementById('scheduleSI');
	var length = tabl.rows.length-3;
	
	for(var i = 0; i < length; i++) {
		var sec = document.getElementsByName('itr7.scheduleSI.splCodeRateTax['+ i +'].secCode')[0];
		if(osSecs.indexOf(sec.value)!=-1){
			simap[sec.value] = document.getElementsByName('itr7.scheduleSI.splCodeRateTax['+i+'].splRateInc')[0];
		}
	}
}

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('itr7.scheduleHP.propertyDetails['+index+'].coOwners['+i+'].coOwnersSNo')[0].value=i+1;


	}
	}catch(e){
	alert('errror:' +e);
	}

}




function checkBA(){

	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;
			}
		}
		if (allInputTags[i].name.match("useForDigitalReceipts$")){
			if(allInputTags[i].value=="true"){
				allInputTags[i].checked=true;
			}
		}
	}

	var statusOrCompanyType=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0].value;
	var residentialStatus=document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value;


}



function prefixZero(){
	var tabl = document.getElementById('AuditDetails');
	var allInputTags = tabl.getElementsByTagName('input');

	for(i=0; i<allInputTags.length; i++) {
		if(document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value.length==5){
			document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value =
				'0'+document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value.length==4){
			document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value =
				'00'+document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value.length==3){
			document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value =
				'000'+document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value.length==2){
			document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value =
				'0000'+document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value.length==1){
			document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value =
				'00000'+document.getElementsByName('itr7.partAGEN2.auditDetails['+i+'].auditorMemNo')[0].value ;
		}
	}
}

function checkNatureBusFilled(){
	var incUnderHBP=document.getElementsByName('itr7.partaoi.incUnHeadBPFlag')[0].value;
	var natBusFilled= checkNatureBusRowBlank('natOfBustTradeTableId', 1, 1);

	if(incUnderHBP=='Y' && natBusFilled){
		addErrorXHTML('','Please provide atleast one detail for nature of business or profession',true);
		j.setFieldError('itr7.partaoi.natOfBus.natureOfBusiness[0].code','Please provide atleast one detail for nature of business or profession');

	}
}



function checkNatureBusRowBlank(tableId, noOfRow, last){
	var tab = document.getElementById(tableId);
	var rowCount = tab.rows.length;

	var allSelectTags = tab.getElementsByTagName('select');
	var isRowBlank = true;

	for ( var i = 0; i < (parseInt(rowCount,10)-2); i++) {
		if(allSelectTags[i].name.match("code$")){

		if(isRowBlank && allSelectTags[i].value != '-1' && allSelectTags[i].value != ''){

			isRowBlank = false;

			break;
		}
		}
	}
	return isRowBlank;
}

function checkClaimExMandatory(){

	// var partBiFilled= checkRowBlank('otherDetailsUs10I', 2, 1);
	var partBiiFilled=checkRowBlank('otherDetailsUs10II', 2, 1);
	// var
	// exemptionUs10Flag=document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs10.exemptionUs10Flag')[0].value;

}

function calculateTax(){
	
	clearOldValues();
	calcExemptUS10();
	calculateTiTti('netAgricultureIncomeOrOtherIncomeForRate');
}

function validateHPRent() {

	var tab = document.getElementById('scheduleHPMain');
	var allInputTags = tab.getElementsByTagName('input');

	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))
					||(parseInt(allInputTags[i + 1].value, 10) > 0 && allInputTags[i].value == "" )) {

				addError(allInputTags[i + 1],
						'Rent not realized cannot exceed Gross rent received or receivable or letable value in schedule HP',
						true);
				j.setFieldError(allInputTags[i + 1].name,
						'Rent not realized cannot exceed Gross rent received or receivable or letable value in schedule HP');
				break;
			}
			
			if((parseInt(allInputTags[i].value, 10) == 0 || allInputTags[i].value == "") 
					&& (parseInt(allInputTags[i + 2].value, 10) > 0)){
				addError(allInputTags[i + 2],
						'Tax paid to local authorities can be claimed only if income from house property is declared in schedule HP',
						true);
				j.setFieldError(allInputTags[i + 2].name,
						'Tax paid to local authorities can be claimed only if income from house property is declared in schedule HP');
				break;
			}
		}
	}
}


function getPan(){

var pan = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.panNumber')[0].value;
return pan;
}

function isLetOutEnable() {
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);
	for ( var i = 0; i < totHp; i++) {
		var tempName = 'itr7.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('itr7.scheduleHP.propertyDetails[' + i
					+ '].coTenants[0].coTenantsSNo')[0].value = 1;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = false;
			document.getElementsByName('itr7.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('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = false;
			document.getElementsByName('itr7.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('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].disabled = true;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.annualLetableValue')[0].value = '';
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].disabled = true;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.rentNotRealized')[0].value = '';
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].disabled = true;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.localTaxes')[0].value = '';
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.incomeChargbleOwnHands')[0].disabled = true;
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.incomeChargbleOwnHands')[0].value = '';
		}

	}

}

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 addRowToTableSchHp(tableId, noOfRow, last,elem) {

		addRowToTable(tableId,noOfRow,last);
		setSerialNumber(elem,2);

}

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+"].totalCountryWise.incFrmOutsideInd")[0].value=
	                 eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.incFrmOutsideInd")[0].value),10))+
	                     eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.incFrmOutsideInd")[0].value),10))+
	                         eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.incFrmOutsideInd")[0].value),10))+
	                         eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.incFrmOutsideInd")[0].value),10));




	              document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].totalCountryWise.taxPaidOutsideInd")[0].value=
	                 eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxPaidOutsideInd")[0].value),10))+
	                     eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxPaidOutsideInd")[0].value),10))+
	                         eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxPaidOutsideInd")[0].value),10))+
	                         eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxPaidOutsideInd")[0].value),10));




	                   document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].totalCountryWise.taxPayableinInd")[0].value=
	                 eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxPayableinInd")[0].value),10))+
	                     eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxPayableinInd")[0].value),10))+
	                         eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxPayableinInd")[0].value),10))+
	                        eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxPayableinInd")[0].value),10));


	                   if(eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxPaidOutsideInd")[0].value)<
	                    eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxPayableinInd")[0].value)){
	                 document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxReliefinInd")[0].value=
	                     document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxPaidOutsideInd")[0].value;
	                    }else{
	                         document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxReliefinInd")[0].value=
	                             document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxPayableinInd")[0].value;
	                    }


	                         if(eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxPaidOutsideInd")[0].value)<
	                    eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxPayableinInd")[0].value)){
	                 document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxReliefinInd")[0].value=
	                     document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxPaidOutsideInd")[0].value;
	                    }else{
	                         document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxReliefinInd")[0].value=
	                             document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxPayableinInd")[0].value;
	                    }


	                         if(eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxPaidOutsideInd")[0].value)<
	                    eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxPayableinInd")[0].value)){
	                 document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxReliefinInd")[0].value=
	                     document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxPaidOutsideInd")[0].value;
	                    }else{
	                         document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxReliefinInd")[0].value=
	                             document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxPayableinInd")[0].value;
	                    }

	                       if(eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxPaidOutsideInd")[0].value)<
	                    eval(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxPayableinInd")[0].value)){
	                 document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxReliefinInd")[0].value=
	                     document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxPaidOutsideInd")[0].value;
	                    }else{
	                         document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxReliefinInd")[0].value=
	                             document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxPayableinInd")[0].value;
	                    }


	                    document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].totalCountryWise.taxReliefinInd")[0].value=
	                 eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromHP.taxReliefinInd")[0].value),10))+
	                     eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incFromBusiness.taxReliefinInd")[0].value),10))+
	                         eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incCapGain.taxReliefinInd")[0].value),10))+
	                         eval(parseInt(coalesce(document.getElementsByName("itrScheduleFSI.scheduleFSI["+i+"].incOthSrc.taxReliefinInd")[0].value),10));
	        }
	        
	        var resStatus = document.getElementsByName("itr7.partAGEN1.filingStatus.residentialStatus")[0].value;
	        if(resStatus == "RES"){
	        	 populateTR();
	        }	       
		}catch(e){
			alert('error in calcScheduleFSI = '  +e.stack);
		}
}

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.');
	}

}

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('itr7.partAGEN1.filingStatus.claimUs9090A91Flag')[0].value=='YES' || 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+'].incFromHP.incFrmOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incFromHP.taxPaidOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incFromHP.taxPayableinInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incFromHP.dtaaReliefUs90or90A'],errors);
			empty3 = empty && !validateAllFilled(['itrScheduleFSI.scheduleFSI['+i+'].incCapGain.incFrmOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incCapGain.taxPaidOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incCapGain.taxPayableinInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incCapGain.dtaaReliefUs90or90A'],errors);
			empty4 = empty && !validateAllFilled(['itrScheduleFSI.scheduleFSI['+i+'].incOthSrc.incFrmOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incOthSrc.taxPaidOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incOthSrc.taxPayableinInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incOthSrc.dtaaReliefUs90or90A'],errors);
			empty5 = empty && !validateAllFilled(['itrScheduleFSI.scheduleFSI['+i+'].incFromBusiness.incFrmOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incFromBusiness.taxPaidOutsideInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incFromBusiness.taxPayableinInd',
			                                     'itrScheduleFSI.scheduleFSI['+i+'].incFromBusiness.dtaaReliefUs90or90A'],errors);
			if(empty2&&empty3&&empty4&&empty5){
	            j.setFieldError('itrScheduleFSI.scheduleFSI['+i+'].incFromHP.incFrmOutsideInd','Please fill atleast one income, as you have selected claim under section 90/90A/91');
	            addErrorXHTML(document.getElementsByName('itrScheduleFSI.scheduleFSI['+i+'].incFromHP.incFrmOutsideInd')[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 scheduleFSIAlert()
{
   var tableFSI = checkRowBlank('scheduleFSI', 8, 2);
   if(tableFSI==false){

   addErrorXHTML('','Please ensure that the incomes shown in Schedule FSI  are also reflected under respective income schedules.');

  }

}

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 = "";
								}
							}
						}
					}
				}
			}
		}
		// modifyRow(mytable);
	}catch(e){
		alert('exception caught in =' +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].totalCountryWise.taxPaidOutsideInd')[0].value;
		document.getElementsByName('scheduleTR1.scheduleTR[0].taxReliefOutsideIndia')[0].value = document.getElementsByName('itrScheduleFSI.scheduleFSI[0].totalCountryWise.taxReliefinInd')[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+'].totalCountryWise.taxPaidOutsideInd')[0].value;
				taxReliefOutsideIndia = document.getElementsByName('itrScheduleFSI.scheduleFSI['+i+'].totalCountryWise.taxReliefinInd')[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];


			}

		}

		totAmtOfSchedTR('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 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 = '';
		}
	}
	totAmtOfSchedTROnLoad();
}

function totAmtOfSchedTROnLoad(){

	var table=document.getElementById('scheduleTR');
    var noOfRows=table.rows.length;
    var totTaxPaidOutsideInd = parseInt('0' ,10);
	var totReliefAvailable = parseInt('0' ,10);

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

        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.totTaxPaidDeclaredInFSI')[0].value = totTaxPaidOutsideInd;
    document.getElementsByName('scheduleTR1.totReliefClaimUs9090A')[0].value = totReliefAvailable;

}

function totAmtOfSchedTR(){

	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;

    calculateTiTti();
}


function revisedSetFor7OnLoad(section,type){


	try{
			var fileSec=document.getElementsByName(section)[0].value;
			var fileType=document.getElementsByName(type)[0];

			if(fileSec!='18' && fileType.value=='T'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
				if(fileSec=='13' || fileSec=='14' || fileSec=='15' || fileSec=='16'){
					document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
					document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
				}else{
					document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
					document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
					document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
					document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
				}
				if(fileSec=='17'&&(fileType.value=='C'||fileType.value=='R')){
					document.getElementsByName(type)[0].value='';
				}
			}else if(fileSec=='17' || fileSec=='19'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;

			}else if(fileSec=='18'){
				document.getElementsByName(type)[0].value='C';
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;

			}else if((fileSec !='17' || fileType.value!='R')&& fileType.value!='T'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=true;
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=true;
				if(fileSec == '20'){
					document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
					document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
					document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
					document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
				}
			} else if(fileSec == '20' && fileType.value!='T'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=true;
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=true;
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
			}
			if((fileSec=='13' || fileSec=='14' || fileSec=='15' || fileSec=='16' || fileSec=='18' || fileSec=='20')&&fileType.value!='T'){
				enableField('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection',fileSec,'itr7.partAGEN1.filingStatus.noticeDateUnderSec');
				enableField('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection',fileSec,'itr7.partAGEN1.filingStatus.uniqueNumNoticeUs');
			}else if((fileSec=='11' || fileSec=='12' || fileSec=='17' || fileSec=='')&&fileType.value!='T'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
			}
			if((fileSec=='11' || fileSec=='12' || fileSec=='13' || fileSec=='14' || fileSec=='15' || fileSec=='16')&&fileType.value!='T'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value='';
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
				document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=true;
				document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=true;
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
				// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
			}

			 if(fileType.value==''&&fileSec==''){
		        	document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
		        }

			 if(fileType.value=='T'&&fileSec=='19'){
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
					document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
		        }

		}catch(e){
			alert('error in revisedset 7 onload:'+e);
		}
}

function revisedSetFor7(section,type){
	try{
		var fileSec=document.getElementsByName(section)[0].value;
		var fileType=document.getElementsByName(type)[0];

		if(fileSec!='18' && fileType.value=='T'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
			if(fileSec=='13' || fileSec=='14' || fileSec=='15' || fileSec=='16'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
			}
			if(fileSec=='17'&&(fileType.value=='C'||fileType.value=='R')){
				document.getElementsByName(type)[0].value='';
			}
		}else if(fileSec=='17' || fileSec=='19'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;

		}else if(fileSec=='18'){
			document.getElementsByName(type)[0].value='C';
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;

		}else if((fileSec !='17' || fileType.value!='R')&& fileType.value!='T'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=true;
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=true;
			if(fileSec == '20'){
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
			}
		} else if(fileSec == '20' && fileType.value!='T'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=true;
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=true;
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
		}
		if((fileSec=='13' || fileSec=='14' || fileSec=='15' || fileSec=='16' || fileSec=='18' || fileSec=='19')&&fileType.value!='T'){
			enableField('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection',fileSec,'itr7.partAGEN1.filingStatus.noticeDateUnderSec');
			enableField('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection',fileSec,'itr7.partAGEN1.filingStatus.uniqueNumNoticeUs');
		}else if((fileSec=='11' || fileSec=='12' || fileSec=='17' || fileSec=='')&&fileType.value!='T'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
		}
		if((fileSec=='11' || fileSec=='12' || fileSec=='13' || fileSec=='14' || fileSec=='15' || fileSec=='16')&&fileType.value!='T'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value='';
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=true;
			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=true;
		// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
		}

		 if(fileType.value==''&&fileSec==''){
	        	document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
	        }

		 if(fileType.value=='T'&&fileSec=='19'){
  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
	        }
		// Editable234F();

	}catch(e){
		alert('error in revisedset 7 onload:'+e);
	}
}



function sectionSetFor7(section,type){
	 var fileSec = document.getElementsByName(section)[0];
	    var fileType=document.getElementsByName(type)[0].value;	    

	        if(fileType=='R' && fileSec.value!='17'){
	            fileSec.value='17';	            
	        }
	        else if(fileType=='C' && fileSec.value!='18'){
	            fileSec.value='18';
	        }
	        else if(fileType=='T' && fileSec.value!='18'){
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
	  			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].value='';
	  			// document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.noticeNo")[0].disabled=true;
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
	  			if(fileSec.value=='13' || fileSec.value=='14' || fileSec.value=='15' || fileSec.value=='16'){
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
	  			}
	        }else{
	      	  fileSec.value='';
	        }

	        if(fileType=='R') {
	            document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].readOnly=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].readOnly=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
	            document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
	            document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;

	        } else if(fileType=='C'){
	      	  document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].readOnly=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].readOnly=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
	            document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
	            document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;

	        } else if(fileType=='T'){
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=false;
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=false;
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
	  			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
	  			if(fileSec.value=='13' || fileSec.value=='14' || fileSec.value=='15' || fileSec.value=='16'){
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
	  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
	  			}

	        } else{
	      	  	document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value='';
	            document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value='';
	            document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled=true;
	            document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled=true;
	        }

	        if(fileType==''&&fileSec.value==''){
	        	document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=true;
  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=true;
	        }
	        if(fileType=='T'&&fileSec.value=='19'){
  				document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
  				document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
	        }

}


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

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

		if(document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].propCoOwnedFlg')[0].value=='YES') {
			var count = i;
			var AssessPerc = document.getElementsByName('itr7.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('itr7.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('itr7.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 scheduleVCCalc(){

	document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund')[0].value=
		eval(parseInt(document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.grantsReceivedFormGovt')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.grantsReceivedFormGovt')[0].value)
				+
				parseInt(document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.grantsReceivedFromCompanie')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.grantsReceivedFromCompanie')[0].value)
				+
				parseInt(document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.otherDonation')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.otherDonation')[0].value)
				+
				parseInt(document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.otherSpecificGrants')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.otherSpecificGrants')[0].value));

	document.getElementsByName('itr7.scheduleVC.local.voluntaryContribution')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleVC.local.corpusFundDonation')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.local.corpusFundDonation')[0].value)+parseInt(document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund')[0].value));
	document.getElementsByName('itr7.scheduleVC.foreign.foreignContribution')[0].value=eval(parseInt(document.getElementsByName('itr7.scheduleVC.foreign.corpusFundDonation')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.foreign.corpusFundDonation')[0].value)+parseInt(document.getElementsByName('itr7.scheduleVC.foreign.otherThanCorpusFund')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.foreign.otherThanCorpusFund')[0].value));
	document.getElementsByName('itr7.scheduleVC.totalContribution')[0].value=eval(parseInt(coalesceSetRet('itr7.scheduleVC.local.voluntaryContribution')==""?0:coalesceSetRet('itr7.scheduleVC.local.voluntaryContribution'))+parseInt(coalesceSetRet('itr7.scheduleVC.foreign.foreignContribution')==""?0:coalesceSetRet('itr7.scheduleVC.foreign.foreignContribution')));

	var totalContribution=document.getElementsByName('itr7.scheduleVC.totalContribution')[0].value;
	var annonyAgr = document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].value;

	if(annonyAgr>0){
	if(zeroOrMore(coalesce(Math.round(eval(totalContribution)*0.05)))>100000){
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.totalDonationsReceived')[0].value=zeroOrMore(coalesce(Math.round(eval(totalContribution)*0.05)));
	}
	else{
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.totalDonationsReceived')[0].value=100000;
	}
	} else {
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.totalDonationsReceived')[0].value = parseInt('0' ,10);
	}

	if(coalesce(totalContribution)==0){

		document.getElementsByName('itr7.scheduleVC.anonymousDonations.totalDonationsReceived')[0].value=parseInt('0',10);

	}

	document.getElementsByName('itr7.scheduleVC.anonymousDonations.anonymousDonations115BBC')[0].value =zeroOrMore(coalesce(Math.round(eval(parseInt(document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].value)-parseInt(document.getElementsByName('itr7.scheduleVC.anonymousDonations.totalDonationsReceived')[0].value==""?0:document.getElementsByName('itr7.scheduleVC.anonymousDonations.totalDonationsReceived')[0].value)))));
}


function chkamtAccumulatedForCharitable(){
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	var sec_12a_12aa = "false";
	var sec_10_23c = "false";
	var sec = "";
	var checkbox = "";
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		checkbox = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].regSecExmpClaimed"]')[0].value;
		sec = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value;
		if(sec == "VI" && checkbox == "true"){
			sec_12a_12aa = "true";
			sec_10_23c = "false";
		}
		if(sec == "II" || sec == "III" || sec == "IV" || sec == "V"){
			if(checkbox == "true"){
				sec_12a_12aa = "false";
				sec_10_23c = "true";
			}
		}		
	}
	var amtAccumulatedForCharitable = parseInt(document.getElementsByName('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable')[0].value==""?0:document.getElementsByName('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable')[0].value);
	if(sec_12a_12aa == "true"){
		var comparedValue = zeroOrMore(coalesce(Math.round(eval(parseInt(document.getElementsByName('itr7.partBTI.aggregateIncomeUs1112')[0].value==""?0:document.getElementsByName('itr7.partBTI.aggregateIncomeUs1112')[0].value)+parseInt(document.getElementsByName('itr7.partBTI.vcCorpusSec11')[0].value==""?0:document.getElementsByName('itr7.partBTI.vcCorpusSec11')[0].value))* 0.15 )));;
		if(amtAccumulatedForCharitable>comparedValue){

			document.getElementsByName('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable')[0].value=comparedValue;
		}	
	}
	if(sec_10_23c == "true"){
		var comparedValue = zeroOrMore(coalesce(Math.round(eval(parseInt(document.getElementsByName('itr7.partBTI.aggregateIncomeUs1112')[0].value==""?0:document.getElementsByName('itr7.partBTI.aggregateIncomeUs1112')[0].value)+parseInt(document.getElementsByName('itr7.partBTI.vcCorpusSec11')[0].value==""?0:document.getElementsByName('itr7.partBTI.vcCorpusSec11')[0].value) + parseInt(document.getElementsByName('itr7.partBTI.voluntaryContributions.totIncFromVC')[0].value==""?0:document.getElementsByName('itr7.partBTI.voluntaryContributions.totIncFromVC')[0].value))* 0.15 )));;
		if(amtAccumulatedForCharitable>comparedValue){

			document.getElementsByName('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable')[0].value=comparedValue;
		}	
	}
}


function enableAggregateAnnualReceipts(){
	var activityNature215 =document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityNature215')[0].value;
	var activityRendering215 =document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.activityRendering215')[0].value;
	var table = document.getElementById('schedulePartAGEN2');
	var noOfRows = table.rows.length;
		if(activityRendering215=='Y' || activityNature215=='Y'){
			for ( var i = 0; i < eval(parseInt(noOfRows, 10) - 2); i++) {
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].disabled=false;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].readOnly=false;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].value='';

					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].disabled=false;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].readOnly=false;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].value='';
				}
		} else {
			for ( var i = 0; i < eval(parseInt(noOfRows, 10) - 2); i++) {
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].disabled=true;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].readOnly=true;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].value='';

					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].disabled=true;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].readOnly=true;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].value='';
				}
			}
	}



function populateClassificationCode(elem,subCatVal){
try{
	var index = elem.selectedIndex - 1;
	var name = elem.name;
	var row = name.substring(name.indexOf('[')+1,name.indexOf(']'));
	var subCat = document.getElementsByName('itr7.partAGEN1.projectOrInstDtls[' + row + '].classificationCode')[0];

	var tempVal = subCat.value;
	if(subCatVal!=undefined || subCatVal!=null){
		tempVal=subCatVal;
	}
	subCat.options.length=0;
	subCat.options[0] =new Option('Select','');


	if(index==0){
		subCat.options[1]=new Option('Relief of the poor','iA');
		subCat.options[2]=new Option('Education','iB');
		subCat.options[3]=new Option('Medical Relief','iC');
		subCat.options[4]=new Option('Preservation of environment (including watersheds, forests and wildlife)','iD');
		subCat.options[5]=new Option('Preservation of monuments or places or objects of artistic or historic interest','iE');
		subCat.options[6]=new Option('Object of general public utility','iF');
		// subCat.options[7]=new Option('Development of khadi or village
		// industries','iG');
		subCat.options[7]=new Option('Yoga','YOGA');
		subCat.options[8]=new Option('Religious','RELIGIOUS');
	}
	else if(index==1){
		subCat.options[1]=new Option('Scientific Research','iiiA');
		subCat.options[2]=new Option('Social Research','iiiB');
		subCat.options[3]=new Option('Statistical research','iiiC');
		subCat.options[4]=new Option('Any other research','iiiD');
	}
	/*
	 * else if(index==2){ subCat.options[1]=new Option('Scientific
	 * Research','iiiA'); subCat.options[2]=new Option('Social
	 * Research','iiiB'); subCat.options[3]=new Option('Statistical
	 * research','iiiC'); subCat.options[4]=new Option('Any other
	 * research','iiiD'); }
	 */
	else if(index==2){
		subCat.options[1]=new Option('News Agency','NEWSAGENCY');
	}
	else if(index==3){
		subCat.options[1]=new Option('Law','vA');
		subCat.options[2]=new Option('Medicine','vB');
		subCat.options[3]=new Option('Accountancy','vC');
		subCat.options[4]=new Option('Engineering','vD');
		subCat.options[5]=new Option('Architecture','vE');
		subCat.options[6]=new Option('Company secretaries','vF');
		subCat.options[7]=new Option('Chemistry','vG');
		subCat.options[8]=new Option('Materials management','vH');
		subCat.options[9]=new Option('Town planning','vI');
		subCat.options[10]=new Option('Any other profession','vJ');

	}
	else if(index==4){
		subCat.options[1]=new Option('Trade union','TRADEUNION');
	}
	else if(index==5){
		subCat.options[1]=new Option('Political party','POLITICAL_PARTY');
	}
	else if(index==6){
		subCat.options[1]=new Option('Electoral trust','ELECTORALTRUST');
	}
	else if(index==7){
		subCat.options[1]=new Option('Specified income arising to a body/authority/Board/Trust/Commission u/s 10(46)','ixA');
		subCat.options[2]=new Option('Infrastructure Debt fund u/s 10(47)','ixB');
		subCat.options[3]=new Option('Any other','OTH');
	}
	if(tempVal.length==0){
		subCat.value = "";
	}
	else{
	subCat.value = tempVal;
	}

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


function enableAggregateAnnualReceiptsOnLoad(activityNature215,activityRendering215){
	var table = document.getElementById('schedulePartAGEN2');
	var noOfRows = table.rows.length;
		if(activityNature215=='Y' || activityRendering215=='Y'){
			for ( var i = 0; i < eval(parseInt(noOfRows, 10) - 2); i++) {
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].disabled=false;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].readOnly=false;

					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].disabled=false;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].readOnly=false;

				}
		} else {
			for ( var i = 0; i < eval(parseInt(noOfRows, 10) - 2); i++) {
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].disabled=true;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].nameOfTheInstitution')[0].readOnly=true;


					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].disabled=true;
					document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsUs215.aggregateAnnualReceiptsofInstitution['+i+'].aggregateAnnualReceipts')[0].readOnly=true;

				}
			}
	}


function enableProjectOther(){
	var tab = document.getElementById('rejApprovalDtls');
	var len = tab.rows.length-2;

	for(var i = 0; i < len; i++) {
			if(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].secUnderRegistration')[0].value=='OTH'){
				document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].otherSourceDesc')[0].style.display='';
			} else {
				document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].otherSourceDesc')[0].style.display='none';
				document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].otherSourceDesc')[0].value='';
			}
	}

}

function populateClassificationCodeHidden(){
	try{
	var tab = document.getElementById('projDetails');
	var len = tab.rows.length-2;
	for(var i=0;i<len;i++){
	 populateClassificationCode(document.getElementsByName('itr7.partAGEN1.projectOrInstDtls['+ i +'].activityNature')[0]);
	 var classificationCodeHidden = document.getElementsByName('itr7.partAGEN1.projectOrInstDtls['+ i +'].classificationCodeHidden')[0].value;
	 if(classificationCodeHidden!=''){
		 document.getElementsByName('itr7.partAGEN1.projectOrInstDtls['+ i +'].classificationCode')[0].value = document.getElementsByName('itr7.partAGEN1.projectOrInstDtls['+i+'].classificationCodeHidden')[0].value;
	 }
	}
	}catch(e){
		alert(e.stack);
	}
}


function checkUniqueTableCol(tableId, colname,errorMesg){

	var tab = document.getElementById(tableId);
	var selects = tab.getElementsByTagName('SELECT');
	var arr = new Array();
	for(var i=0;i<selects.length;i++){
		if(selects[i].name.match(colname) && selects[i].value!=''){
			if(arr.indexOf(selects[i].value)==-1){
				arr.push(selects[i].value);
			}else if(selects[i].value!='Others'){
				var msg = errorMesg || 'A particular drop down cannot be selected twice';
				j.setFieldError(selects[i].name, msg);
				addErrorXHTML(selects[i], msg ,true);
			}
		}
	}
}

function checkUniqAuditSec(){

	checkUniqueTableCol('AuditDetails', 'auditedSection$','A Particular Section cannot be selected twice');
}

function disableScheduleFA(){

	var resStatus=document.getElementsByName('itr7.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 disableScheduleCT(){
	removeTableDataCT('schCTcashTransactions');
	removeTableDataCT('schCTreceiptOfAmountLimit');
	removeTableDataCT('schCTpaymentOfAmountLimit');
	removeTableDataCT('schCTrepaymentOfLoanOrDeposit');
	removeTableDataCT('schCTrepaymentOfLoanOrDepositrec');
}
function removeTableDataCT(tableID) {

	var tab = document.getElementById(tableID);
	var asstFlag = document.getElementsByName('itr7.partBTTI.transactionFlag')[0].value;

	if (!(asstFlag == '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 (asstFlag == '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 (asstFlag == 'Y') {
			selectTags[i].disabled = false;
		} else {
			selectTags[i].disabled = true;
			selectTags[i].value = "";

		}
	}
	if ( asstFlag == 'Y') {
		tabs.enableTabs(30);
	}
}

// to remove table data
function removeTableData(tableID, resStatus) {

	var tab = document.getElementById(tableID);
	var asstFlag = document.getElementsByName('itr7.partBTTI.assetOutIndiaFlag')[0].value;

	if (!((resStatus == 'RES' || resStatus == 'NOR') && 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' || resStatus == 'NOR') && 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' || resStatus == 'NOR') && asstFlag == 'YES') {
			selectTags[i].disabled = false;
		} else {
			selectTags[i].disabled = true;
			selectTags[i].value = "";

		}
	}
	if ((resStatus == 'RES' || resStatus == 'NOR') && asstFlag == 'YES') {
		tabs.enableTabs(30);
	}
}




function calcSchJ(){
	try{
		var tableB = document.getElementById('scheduleJB');
		var rowCount = tableB.rows.length;
		var sumTotalInvestmnt=0;
		var sumTotalMaturity=0;
		for(var i=0;i<rowCount-4;i++){
			sumTotalInvestmnt = eval(parseInt(sumTotalInvestmnt,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJUs115.scheduleJBDtls['+i+'].amtOfInvestment')[0].value),10));
			sumTotalMaturity = eval(parseInt(sumTotalMaturity,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJUs115.scheduleJBDtls['+i+'].maturityAmt')[0].value),10));
		}
		coalesceSetRet('itr7.itrScheduleJ.scheduleJUs115.totalInvestmentAmt');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJUs115.totalInvestmentAmt')[0].value  = parseInt(coalesce(sumTotalInvestmnt),10);

		coalesceSetRet('itr7.itrScheduleJ.scheduleJUs115.maturityAmount');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJUs115.maturityAmount')[0].value  = parseInt(coalesce(sumTotalMaturity),10);


		var tableC = document.getElementById('scheduleJC');
		var rowCount = tableC.rows.length;
		var sumShares=0;
		var sumNominalVal=0;
		var sumInvstInc=0;
		for(var i=0;i<rowCount-4;i++){
			sumShares = eval(parseInt(sumShares,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJUs133.scheduleJUs133Dtls['+i+'].noOfSharesHeld')[0].value),10));
			sumNominalVal = eval(parseInt(sumNominalVal,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJUs133.scheduleJUs133Dtls['+i+'].nominalaValueOfInvestment')[0].value),10));
			sumInvstInc = eval(parseInt(sumInvstInc,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJUs133.scheduleJUs133Dtls['+i+'].incFromInvestment')[0].value),10));
		}
		coalesceSetRet('itr7.itrScheduleJ.scheduleJUs133.totalNoOfShares');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJUs133.totalNoOfShares')[0].value  = parseInt(coalesce(sumShares),10);

		coalesceSetRet('itr7.itrScheduleJ.scheduleJUs133.totalValueOfInvestment');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJUs133.totalValueOfInvestment')[0].value  = parseInt(coalesce(sumNominalVal),10);

		coalesceSetRet('itr7.itrScheduleJ.scheduleJUs133.totalIncFromInvestment');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJUs133.totalIncFromInvestment')[0].value  = parseInt(coalesce(sumInvstInc),10);

		var tableD = document.getElementById('scheduleJD');
		var rowCount = tableD.rows.length;
		var sumTotalShares=0;
		var sumTotalNomVal=0;
		for(var i=0;i<rowCount-4;i++){
			sumTotalShares = eval(parseInt(sumTotalShares,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJOtherInvstmts.scheduleJOtherInvstmtsDtls['+i+'].noOfSharesHeld')[0].value),10));
			sumTotalNomVal = eval(parseInt(sumTotalNomVal,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJOtherInvstmts.scheduleJOtherInvstmtsDtls['+i+'].nominalaValueOfInvestment')[0].value),10));
		}
		coalesceSetRet('itr7.itrScheduleJ.scheduleJOtherInvstmts.totalNoOfShares');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJOtherInvstmts.totalNoOfShares')[0].value  = parseInt(coalesce(sumTotalShares),10);

		coalesceSetRet('itr7.itrScheduleJ.scheduleJOtherInvstmts.totalValueOfInvestment');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJOtherInvstmts.totalValueOfInvestment')[0].value  = parseInt(coalesce(sumTotalNomVal),10);

		var tableE = document.getElementById('scheduleJE');
		var rowCount = tableE.rows.length;
		var sumValContribtn=0;
		var sumValContributeObj=0;
		var sumAmtInvest=0;
		var sumBalUs113=0;
		for(var i=0;i<rowCount-4;i++){
			sumValContribtn = eval(parseInt(sumValContribtn,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.scheduleJVoluntaryContributionDtls['+i+'].valueOfContribution')[0].value),10));
			sumValContributeObj = eval(parseInt(sumValContributeObj,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.scheduleJVoluntaryContributionDtls['+i+'].valueOfContributionObjective')[0].value),10));
			sumAmtInvest = eval(parseInt(sumAmtInvest,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.scheduleJVoluntaryContributionDtls['+i+'].amtInvestedUs11')[0].value),10));
			sumBalUs113 = eval(parseInt(sumBalUs113,10) + parseInt(coalesce(document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.scheduleJVoluntaryContributionDtls['+i+'].balIncUs11')[0].value),10));
		}
		coalesceSetRet('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalValueOfContribution');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalValueOfContribution')[0].value  = parseInt(coalesce(sumValContribtn),10);

		coalesceSetRet('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalValueOfContributionObjective');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalValueOfContributionObjective')[0].value  = parseInt(coalesce(sumValContributeObj),10);

		coalesceSetRet('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalAmtInvestedUs11');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalAmtInvestedUs11')[0].value  = parseInt(coalesce(sumAmtInvest),10);

		coalesceSetRet('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalBalIncUs11');
		document.getElementsByName('itr7.itrScheduleJ.scheduleJVoluntaryContribution.totalBalIncUs11')[0].value  = parseInt(coalesce(sumBalUs113),10);

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



function natureOfBusChck(tableId){
	var noRows=4;
	var tab = document.getElementById(tableId);
	var rowCount = tab.rows.length;
	if(rowCount > noRows) {
	addErrorXHTML('','Cannot insert more than 3 rows');
	return false;
	}
	return true;

}



function schVCAmtCheck(){

var annonymsDon = document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0];
var totalContri = document.getElementsByName('itr7.scheduleVC.totalContribution')[0];

	if(parseInt(coalesce(annonymsDon.value),10)>parseInt(coalesce(totalContri.value),10)){
		j.setFieldError('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation','The value entered in Di cannot exceed the value in C');
		addErrorXHTML(annonymsDon ,"The value entered in Di cannot exceed the value in C");
	}
}

function getIfscBankName(field) {

	document.getElementsByName('itr.refund.depositToBankAccount.bankName')[0].value = main.getBankName(field.value);
}

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);
}


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];
		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];
		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];
		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 = '';
		}
	}
}

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-5); i++) {
		 amt =  document.getElementsByName('itr7.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);
}

function display92CDVerification(type) {

	var fileSec=document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;

	if(type != 'onload' && fileSec == '20'){
		addErrorXHTML('','Sec 139 read with section 119(2)(b) should be filed after expiry of due date mentioned in 139(1)/139(4).');
	}

	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" --> "Income Tax Return" and select the applicable AY, ITR and other options.');
	}

}


// To alert user
function alertItr7User() {

	var errText="";
	var i=1;
	var amountPayable = document.getElementsByName('itr7.partBTTI.taxPaid.balTaxPayable')[0].value;
	var fileSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[0].value;

	// var amtDeemedForCharitable =
	// document.getElementsByName('itr7.partBTI.tiDeductions.amtDeemedForCharitable')[0].value;

	var exercisedBfDueDateFlag = document.getElementsByName('itr7.partBTI.tiDeductions.exercisedBfDueDateFlag')[0].value;

	var amtFulfilledUs112 = document.getElementsByName('itr7.partBTI.tiDeductions.amtFulfilledUs112')[0].value;

	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";
	}
	if(fileSec=='20'){
		errText+=(i++)+". Sec139 read with section 119(2)(b) should be filed after expiry of due date mentioned in 139(1)/139(4).\n\n";
	}
	if(exercisedBfDueDateFlag=='N'){
		errText+=(i++)+". Please file Form 9A within the due date of filing return of income to claim exemption under clause (2) of Explanation to Section 11(1).\n\n";
	}

	if(amtFulfilledUs112 > 0){
		errText+=(i++)+". Please file Form 10 within the due date of filing return of income to claim exemption u/s 11 (2). Sch I and Sch J of the ITR-7 may also be appropriately filled.\n\n";
	}



	main.generateMsgDialogWithOk(errText,"");
}

// To open Save file dialog
function popupWithOk()
{
	  j.popup();
}

function checkNoOfRowsFilled() {
	var tab = document.getElementById('scheduleBA');
	var rowCount = tab.rows.length;
	var count = parseInt(0, 10);
	// var noOfBankAccounts =
	// document.getElementsByName('itr.scheduleBA.noOfBankAcc')[0].value;
	for ( var i = 0; i < (rowCount - 2); i++) {
		var IFSC = document.getElementsByName('itr.scheduleBA[' + i	+ '].ifscCode')[0].value;
		if (IFSC != "") {
			count = count + 1;
		}
	}

}

// to add rows to table sch PTI
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(((noOfRows - 3) / 15) + 1),10);
	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();
}
// to remove row from sch PTI
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)/15)>1) ){
							rowNumber = eval(parseInt(rowNumber,10) * 15 + 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) /15) + noOfHeader;
								// set the serial number;
								if((q-noOfHeader)%15==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)/15)==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 enableScheduleLA() {

	var tabl = document.getElementById('ScheduleLA');
	var allSelectTags = tabl.getElementsByTagName('select');
	var allInputTags = tabl.getElementsByTagName('input');

	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;

	for ( var i = 0; i < allInputTags.length; i++) {
		if (exemptClaimed == '13A'  ) {
			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 < allSelectTags.length; i++) {
		if (exemptClaimed == '13A'  ) {

			allSelectTags[i].disabled = false;
			allSelectTags[i].readOnly = false;

		} else {

			allSelectTags[i].disabled = true;
			allSelectTags[i].readOnly = true;
			allSelectTags[i].value = "";
		}
	}

}




function calculateSchAI(){
	calculateOtherTotalIncomeAI('otherIncomeInSchAI');
	calculateAITotalIncome();

}



function calculateOtherTotalIncomeAI(tableId){

	var tab1 = document.getElementById('otherIncomeInSchAI');
	var noOfRows=tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for ( var i = 0; i < (noOfRows-3); i++) {
		amt = document.getElementsByName('itr7.scheduleAI.otherIncome['+i+'].amount')[0].value;
		sum = eval(parseInt(sum,10) + parseInt(coalesce(amt),10));
	}
	document.getElementsByName('itr7.scheduleAI.otherTotalIncome')[0].value = parseInt(sum,10) + getAmt('itr7.scheduleAI.passThroughIncome');
}

function calculateAITotalIncome(){

	var totalAIIncome = document.getElementsByName('itr7.scheduleAI.schAITotalIncome')[0];
	totalAIIncome.value = eval(
			parseInt(getAmt('itr7.scheduleAI.receiptsFromMain'),10)
			+ parseInt(getAmt('itr7.scheduleAI.receiptsFromIncident'),10)
			+ parseInt(getAmt('itr7.scheduleAI.rent'),10)
			+ parseInt(getAmt('itr7.scheduleAI.commission'),10)
			+ parseInt(getAmt('itr7.scheduleAI.dividentIncome'),10)
			+ parseInt(getAmt('itr7.scheduleAI.interestIncome'),10)
			+ parseInt(getAmt('itr7.scheduleAI.agricultureIncome'),10)
			+ parseInt(getAmt('itr7.scheduleAI.netCapitalAsset'),10)
			+ parseInt(getAmt('itr7.scheduleAI.otherTotalIncome'),10)
		);
}

function calculateSchER(){
	calculateOtherTotalExpenseER('otherExpensesSchER');
	calculateOtherTotalExpenseERB('anyOtherExpensesSchER');
	calculateERTotalExpense();
	// calculateERTotalExpenseB();
	calculateERexpTrustInstitution();
	calculateDisallowableExpenditure();
	calculaterevenueExpenditure();
	calculateTotalRevenue();
}

function calculateOtherTotalExpenseER(tableId){

	var tab1 = document.getElementById('otherExpensesSchER');
	var noOfRows=tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for ( var i = 0; i < (noOfRows-2); i++) {
		amt = document.getElementsByName('itr7.scheduleER.otherExpenses['+i+'].amount')[0].value;
		sum = eval(parseInt(sum,10) + parseInt(coalesce(amt),10));
	}
	document.getElementsByName('itr7.scheduleER.otherExpensesTotal')[0].value = parseInt(sum,10);

}

function calculateOtherTotalExpenseERB(tableId){

	var tab1 = document.getElementById('anyOtherExpensesSchER');
	var noOfRows=tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for ( var i = 0; i < (noOfRows-2); i++) {
		amt = document.getElementsByName('itr7.scheduleER.anyOtherExpenses['+i+'].amount')[0].value;
		sum = eval(parseInt(sum,10) + parseInt(coalesce(amt),10));
	}
	document.getElementsByName('itr7.scheduleER.totOthIncome')[0].value = parseInt(sum,10);
}

function calculateERTotalExpense(){


	/*
	 * var donation = document.getElementsByName('itr7.scheduleER.donation')[0];
	 * var partbTicorp=
	 * document.getElementsByName('itr7partBTI.tiAdditions.incChargeableUs111i')[0];
	 * donation.value = eval( +
	 * parseInt(getAmt('itr7.scheduleER.donation.corpus'),10) +
	 * parseInt(getAmt('itr7.scheduleER.donation.othtthncorpus'),10) );
	 * 
	 * partbTicorp.value=parseInt(getAmt('itr7.scheduleER.donation.corpus'),10);
	 */

	var expensesTotal = document.getElementsByName('itr7.scheduleER.expensesTotal')[0];
	expensesTotal.value = eval(
			parseInt(getAmt('itr7.scheduleER.rent'),10)
			+ parseInt(getAmt('itr7.scheduleER.repairs'),10)
			+ parseInt(getAmt('itr7.scheduleER.compensationToEmp'),10)
			+ parseInt(getAmt('itr7.scheduleER.insurance'),10)
			+ parseInt(getAmt('itr7.scheduleER.workmenStaffWelExp'),10)
			+ parseInt(getAmt('itr7.scheduleER.entertainandHospitality'),10)
			+ parseInt(getAmt('itr7.scheduleER.advertisement'),10)
			+ parseInt(getAmt('itr7.scheduleER.rateTaxespayableToGovernment'),10)
			+ parseInt(getAmt('itr7.scheduleER.interest'),10)
			+ parseInt(getAmt('itr7.scheduleER.profConstlFeeTechServ'),10)
			+ parseInt(getAmt('itr7.scheduleER.conveyandTravelOtheExp'),10)
			// + parseInt(getAmt('itr7.scheduleER.ForeignExp'),10)
			+ parseInt(getAmt('itr7.scheduleER.remunerationTrusetee'),10)
			+ parseInt(getAmt('itr7.scheduleER.auditFee'),10)
			// + parseInt(getAmt('itr7.scheduleER.donation'),10)
			// + parseInt(getAmt('itr7.scheduleER.ratesTaxesPaidPayToGovt'),10)
			+ parseInt(getAmt('itr7.scheduleER.otherExpensesTotal'),10)
			+ parseInt(getAmt('itr7.scheduleER.depreciationPreviousYear'),10)
		);


}

function calculateERexpTrustInstitution(){

	var totalBTrustExpenditure = document.getElementsByName('itr7.scheduleER.totalBTrustExpenditure')[0];

	totalBTrustExpenditure.value = eval (
			+ parseInt(getAmt('itr7.scheduleER.donation.othtthncorpus'),10)
			+ parseInt(getAmt('itr7.scheduleER.religious'),10)
			+ parseInt(getAmt('itr7.scheduleER.reliefOfPoor'),10)
			+ parseInt(getAmt('itr7.scheduleER.educational'),10)
			+ parseInt(getAmt('itr7.scheduleER.yoga'),10)
			+ parseInt(getAmt('itr7.scheduleER.medicalRelief'),10)
			+ parseInt(getAmt('itr7.scheduleER.preserveEnvironment'),10)
			+ parseInt(getAmt('itr7.scheduleER.preserveMonuments'),10)
			+ parseInt(getAmt('itr7.scheduleER.genPublicUtility'),10)
			);

	calculateSumOfAB();
}

function calculateSumOfAB(){

var totalSumOfAB = document.getElementsByName('itr7.scheduleER.totalSumOfAB')[0];

	totalSumOfAB.value = eval(
			  parseInt(coalesceSetRet('itr7.scheduleER.badDebts'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleER.provisions'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleER.formingCorpus'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleER.otherDisallowable'),10)
		);
	calculaterevenueExpenditure();
}

function calculateDisallowableExpenditure(){

	calculaterevenueExpenditure();
}

function calculaterevenueExpenditure(){
	var totalRevenueExpenditure = document.getElementsByName('itr7.scheduleER.totalRevenueExpenditure')[0];

	totalRevenueExpenditure.value = eval(
			parseInt(coalesceSetRet('itr7.scheduleER.expensesTotal'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleER.totalBTrustExpenditure'),10)
			+ parseInt(coalesceSetRet('itr7.scheduleER.totalSumOfAB'),10)
	);
}


function calculateERTotalExpenseB(){
	var expensesTotal = document.getElementsByName('itr7.scheduleER.expensesTotalB')[0];
	expensesTotal.value = eval(
			parseInt(getAmt('itr7.scheduleER.rentB'),10)
			+ parseInt(getAmt('itr7.scheduleER.repairsB'),10)
			+ parseInt(getAmt('itr7.scheduleER.compensationToEmpB'),10)
			+ parseInt(getAmt('itr7.scheduleER.insuranceB'),10)
			+ parseInt(getAmt('itr7.scheduleER.workmenStaffWelExpB'),10)
			+ parseInt(getAmt('itr7.scheduleER.entertainandHospitalityB'),10)
			+ parseInt(getAmt('itr7.scheduleER.advertisementB'),10)
			+ parseInt(getAmt('itr7.scheduleER.interestB'),10)
			+ parseInt(getAmt('itr7.scheduleER.rateTaxespayableToGovernmentB'),10)
			+ parseInt(getAmt('itr7.scheduleER.profConstlFeeTechServB'),10)
			+ parseInt(getAmt('itr7.scheduleER.conveyandTravelOtheExpB'),10)
			+ parseInt(getAmt('itr7.scheduleER.remunerationTruseteeB'),10)
			// + parseInt(getAmt('itr7.scheduleER.scholarshipB'),10)
			+ parseInt(getAmt('itr7.scheduleER.auditFeeB'),10)
			+ parseInt(getAmt('itr7.scheduleER.ratesTaxesPaidPayToGovtB'),10)
			+ parseInt(getAmt('itr7.scheduleER.otherExpensesTotalB'),10)
			+ parseInt(getAmt('itr7.scheduleER.depreciationPreviousYearB'),10)
		);



	var totalAIIncome = document.getElementsByName('itr7.scheduleER.totalRevenuExpB')[0];
	totalAIIncome.value = eval(
			parseInt(getAmt('itr7.scheduleER.rentB'),10)
			+ parseInt(getAmt('itr7.scheduleER.repairsB'),10)
			+ parseInt(getAmt('itr7.scheduleER.compensationToEmpB'),10)
			+ parseInt(getAmt('itr7.scheduleER.insuranceB'),10)
			+ parseInt(getAmt('itr7.scheduleER.workmenStaffWelExpB'),10)
			+ parseInt(getAmt('itr7.scheduleER.entertainandHospitalityB'),10)
			+ parseInt(getAmt('itr7.scheduleER.advertisementB'),10)
			+ parseInt(getAmt('itr7.scheduleER.rateTaxespayableToGovernmentB'),10)
		    + parseInt(getAmt('itr7.scheduleER.interestB'),10)
			+ parseInt(getAmt('itr7.scheduleER.profConstlFeeTechServB'),10)
			+ parseInt(getAmt('itr7.scheduleER.conveyandTravelOtheExpB'),10)
			+ parseInt(getAmt('itr7.scheduleER.remunerationTruseteeB'),10)
			// + parseInt(getAmt('itr7.scheduleER.scholarshipB'),10)
			+ parseInt(getAmt('itr7.scheduleER.auditFeeB'),10)
			+ parseInt(getAmt('itr7.scheduleER.ratesTaxesPaidPayToGovtB'),10)
			+ parseInt(getAmt('itr7.scheduleER.otherExpensesTotalB'),10)
			+ parseInt(getAmt('itr7.scheduleER.badDebtsB'),10)
			+ parseInt(getAmt('itr7.scheduleER.provisionsB'),10)
			+ parseInt(getAmt('itr7.scheduleER.depreciationandAmortizationB'),10)
			+ parseInt(getAmt('itr7.scheduleER.depreciationPreviousYearB'),10)
		);
}
function calculateTotalRevenue(){
	var totalAIIncome = document.getElementsByName('itr7.scheduleER.totAmtDurPrvYr')[0];
	
	var sum = eval(
			parseInt(getAmt('itr7.scheduleER.expensesTotal'),10)
			+ parseInt(getAmt('itr7.scheduleER.totalBTrustExpenditure'),10)
			- parseInt(getAmt('itr7.scheduleER.incomeDeemedus111'),10)
			- parseInt(getAmt('itr7.scheduleER.incomeUpto15Per'),10)
			- parseInt(getAmt('itr7.scheduleER.borrowedFund'),10)
			- parseInt(getAmt('itr7.scheduleER.totOthIncome'),10)
			);
	
	if(sum >= 0 ){
		totalAIIncome.value = sum;
	}else{
		totalAIIncome.value = 0;
	}
	
}

function calculateSchEC(){
	// restrictCostOfNewAsst();
	calculateOtherTotalCapitalExpense('otherCapitalExpense');
	calculateA5TotalIncome('otherSourceOfFund');
	// calculateOtherTotalCapitalExpenseB('otherCapitalExpense');
	calculateECTotalExpense();
	calculatetotAmtPrevYrCA();
}



function calculateSch115TD(){
	// calculateOther115TD('otherCapitalExpense');
	calculateAdditionalTax();

	coalesceSetRet('itr7.schedule115TD.aggMarValueTotalAssTrustInst');
	coalesceSetRet('itr7.schedule115TD.lessTotalLiaTrustInst');
	coalesceSetRet('itr7.schedule115TD.fmvAssetAcqOutIncInSec101');
	coalesceSetRet('itr7.schedule115TD.fmvAssetAcqEstToEffDateOfRegus12AA');
	coalesceSetRet('itr7.schedule115TD.fmvAssetTransInAccSec115TD2');
	coalesceSetRet('itr7.schedule115TD.AddIncInterestPay');
	coalesceSetRet('itr7.schedule115TD.taxInterestPaid');
	coalesceSetRet('itr7.schedule115TD.AddIncPayus115TDMagRate');
	coalesceSetRet('itr7.schedule115TD.interestPayus115TE');
	// coalesceSetRet('itr7.schedule115TD.specifiedDateus115TD');

	var netValueAsset = document.getElementsByName('itr7.schedule115TD.netValueAsset')[0];

	var aggMarValueTotalAssTrustInst= document.getElementsByName('itr7.schedule115TD.aggMarValueTotalAssTrustInst')[0].value;
	var lessTotalLiaTrustInst= document.getElementsByName('itr7.schedule115TD.lessTotalLiaTrustInst')[0].value;

	netValueAsset.value =  zeroOrMore(eval(parseInt(aggMarValueTotalAssTrustInst,10)-(parseInt(lessTotalLiaTrustInst,10))));

	var fmvAssetAcqOutIncInSec101= document.getElementsByName('itr7.schedule115TD.fmvAssetAcqOutIncInSec101')[0].value;
	var fmvAssetAcqEstToEffDateOfRegus12AA= document.getElementsByName('itr7.schedule115TD.fmvAssetAcqEstToEffDateOfRegus12AA')[0].value;
	var fmvAssetTransInAccSec115TD2= document.getElementsByName('itr7.schedule115TD.fmvAssetTransInAccSec115TD2')[0].value;

	var fmvTotal = document.getElementsByName('itr7.schedule115TD.fmvTotal')[0];

	fmvTotal.value =  zeroOrMore(eval(parseInt(fmvAssetAcqOutIncInSec101,10)+parseInt(fmvAssetAcqEstToEffDateOfRegus12AA,10)+parseInt(fmvAssetTransInAccSec115TD2,10)));



	var AccIncAsPerSection115TD = document.getElementsByName('itr7.schedule115TD.AccIncAsPerSection115TD')[0];
	AccIncAsPerSection115TD.value = zeroOrMore(eval(
			 parseInt(coalesceSetRet('itr7.schedule115TD.netValueAsset'),10)
			- (parseInt(coalesceSetRet('itr7.schedule115TD.fmvTotal'),10)
			- parseInt(coalesceSetRet('itr7.schedule115TD.LiabRespAssat4Abv'),10))
		));

	
	
	
	document.getElementsByName('itr7.schedule115TD.AddIncInterestPay')[0].value=parseInt(document.getElementsByName('itr7.schedule115TD.AddIncPayus115TDMagRate')[0].value, 10)+parseInt(document.getElementsByName('itr7.schedule115TD.interestPayus115TE')[0].value, 10);
		
	var AddIncInterestPay= document.getElementsByName('itr7.schedule115TD.AddIncInterestPay')[0].value;
	var taxInterestPaid= document.getElementsByName('itr7.schedule115TD.taxInterestPaid')[0];
	
	var noOfRows = $('#depositTaxAccretedIncInsch115TD tr').length;
	var index = noOfRows - 2;
	var sum = 0;
	for(var i = 0 ; i < index ; i++){
		sum = sum + getAmt('itr7.schedule115TD.depositTaxAccretedInc[' + i + '].amt');
	}
	taxInterestPaid.value = sum;
	
	var NetPayRefund = document.getElementsByName('itr7.schedule115TD.NetPayRefund')[0];

	NetPayRefund.value =  eval(parseInt(zeroOrMore(AddIncInterestPay),10)-parseInt(zeroOrMore(taxInterestPaid.value),10));
	
	
	
	var tab = document.getElementById('depositTaxAccretedIncInsch115TD');
	var allInputTags = tab.getElementsByTagName('input');

	for(i=0; i<allInputTags.length; i++) {
		if(parseInt(document.getElementsByName('itr7.schedule115TD.AccIncAsPerSection115TD')[0].value, 10)>0)
		{
			allInputTags[i].disabled=false;
		}
		else
		{
			allInputTags[i].disabled=true;
			allInputTags[i].value='';
		}
		
	}
	
	document.getElementsByName('itr7.partBTTI.netTaxPayable')[0].value = getAmt('itr7.schedule115TD.NetPayRefund');
	
}



function calculateOtherTotalCapitalExpense(tableId){

	var tab1 = document.getElementById('otherCapitalExpense');
	var noOfRows=tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for ( var i = 0; i < (noOfRows-2); i++) {
		amt = document.getElementsByName('itr7.scheduleEC.otherExpenses['+i+'].amount')[0].value;
		sum = eval(parseInt(sum,10) + parseInt(coalesce(amt),10));
	}
	document.getElementsByName('itr7.scheduleEC.otherTotalExpense')[0].value = parseInt(sum,10);
}

function calculateA5TotalIncome(tableId){

	var tab1 = document.getElementById('otherSourceOfFund');
	var noOfRows=tab1.rows.length;
	var sum = 0;
	var amt = 0;

	for ( var i = 0; i < (noOfRows-2); i++) {
		amt = document.getElementsByName('itr7.scheduleEC.otherSourceOfFund['+i+'].amount')[0].value;
		sum = eval(parseInt(sum,10) + parseInt(coalesce(amt),10));
	}
	document.getElementsByName('itr7.scheduleEC.anyOtherIncome')[0].value = parseInt(sum,10);
}

function calculateECTotalExpense(){
	var totalAIIncome = document.getElementsByName('itr7.scheduleEC.totalCapitalExpense')[0];

	totalAIIncome.value = zeroOrMore(eval((
			parseInt(getAmt('itr7.scheduleEC.additionToCapitalWork'),10)
			+ parseInt(getAmt('itr7.scheduleEC.acqofFixedAssest'),10)
			+ parseInt(getAmt('itr7.scheduleEC.costNewAssetDeemed'),10))
			+ parseInt(getAmt('itr7.scheduleEC.otherTotalExpense'),10)
		));
}

function restrictCostOfNewAsst(){
	var costOfNewAsst = document.getElementsByName('itr7.scheduleEC.costNewAssetDeemed')[0];
	var netConsidrton = document.getElementsByName('itr7.scheduleAI.netCapitalAsset')[0];
	if(costOfNewAsst.value > netConsidrton.value){
		// costOfNewAsst.value = netConsidrton.value;
		//costOfNewAsst.value = 0;
		j.setFieldError('itr7.scheduleEC.costNewAssetDeemed','The amount should be restricted to the Net consideration entered in Sr.no. 8 of Schedule AI.');
		addErrorXHTML(document.getElementsByName('itr7.scheduleEC.costNewAssetDeemed')[0],'The amount should be restricted to the Net consideration entered in Sr.no. 8 of Schedule AI.',true);

	}
}
function calculatetotAmtPrevYrCA(){
	var totAmtPrevYrCA = document.getElementsByName('itr7.scheduleEC.totAmtPrevYrCA')[0];

	var sum = eval(
			parseInt(getAmt('itr7.scheduleEC.totalCapitalExpense'),10)
			- parseInt(getAmt('itr7.scheduleEC.incomeDeemedPrecedingYear'),10)
			- parseInt(getAmt('itr7.scheduleEC.incomeEarlierYears15Percent'),10)
			- parseInt(getAmt('itr7.scheduleEC.borrowedFund'),10)
			- parseInt(getAmt('itr7.scheduleEC.anyOtherIncome'),10)
		);
	if(sum >= 0){
		totAmtPrevYrCA.value = sum;
	}else{
		totAmtPrevYrCA.value = 0;
	}
}



function clearFields(){
	document
	.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.sec11BBDA')[0].value = 0;
	document
	.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBG_PTI')[0].value = 0;


}// To set Editable FieldValue
function setEditableFieldValue(element, newVal){
    if(element.oldvalue!=newVal){
    	element.value = newVal;
    	element.oldvalue = newVal;
    }
}

function mandatorySchI()
{	
	var greaterThaninGen = document.getElementsByName('itr7.partBTI.tiDeductions.amtFulfilledUs112')[0].value;
	var emptyRow =  document.getElementsByName('itr7.itrScheduleI.scheduleI[5].amountAccumlated')[0].value;
	var emptyRow1 =  document.getElementsByName('itr7.itrScheduleI.scheduleI[5].accumulationPurpose')[0].value;
	
		/*if (parseInt(greaterThaninGen, 10) > 0 && !(parseInt(emptyRow, 10) > 0)) {
			j.setFieldError(
							'itr7.itrScheduleI.scheduleI[5].amountAccumlated',
							'Please enter the Amount in Schedule I in FY 2019-20 row.');
			addErrorXHTML(
					document.getElementsByName('itr7.itrScheduleI.scheduleI[5].amountAccumlated')[0],
					'Please enter the Amount in Schedule I in FY 2019-20 row.',
					true);
		}*/
		/*if (parseInt(greaterThaninGen, 10) > 0 && emptyRow1 == "") {
			j.setFieldError(
							'itr7.itrScheduleI.scheduleI[5].accumulationPurpose',
							'Please enter the Purpose of Accumulation in Schedule I in FY 2019-20 row.');
			addErrorXHTML(
					document.getElementsByName('itr7.itrScheduleI.scheduleI[5].accumulationPurpose')[0],
					'Please enter the Purpose of Accumulation in Schedule I in FY 2019-20 row.',
					true);
		}*/
}

function subStatus()
{

	var statusCompany=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
	var statusCompany1 = statusCompany.value;

	var sub = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0];
	var sub1 = sub.value;

	/*
	 * if(statusCompany1 == '7'){ for(var i=0;sub.options.length > 0;i++){
	 * sub.options.remove(0); } sub.options[0] = new Option('Select','-1');
	 * sub.options[1] = new Option('Domestic Company','7i'); //sub.options[2] =
	 * new Option('Foreign Company','7ii');
	 * 
	 * }else
	 */ if(statusCompany1 == '5'){
		for(var i=0;sub.options.length > 0;i++){
			sub.options.remove(0);
		}
		sub.options[0] = new Option('Select','-1');
		sub.options[1] = new Option('Society Registered under Societies Registration Act-1860 or any law corresponding to that Act','5i');
		sub.options[2] = new Option('Public Charitable Trust','5v');
		// sub.options[3] = new Option('Other Trust/Institution','5vi');
		sub.options[3] = new Option('Any other AOP/BOI','5vii');

	}else{
		for(var i=0;sub.options.length > 0;i++){
			sub.options.remove(0);
		}
		sub.options[0] = new Option('Select','');
	}

}


function isselfOccupied() {

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

		var tempName = 'itr7.scheduleHP.propertyDetails[' + i + '].ifLetOut';
		var val = document.getElementsByName(tempName)[0].value;

		if (val == 'D' || val == 'Y') {
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.thirtyPercentOfBalance')[0].disabled = false;
		} else {

			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i
					+ '].rentdetails.thirtyPercentOfBalance')[0].disabled = true;
		}

	}

}

// To remove All dropdowns for the given select box.
function removeAll(selectbox) {

	for (var i = selectbox.options.length - 1; i > 0; i--) {
		selectbox.removeChild(selectbox[i]);

	}
}



// To get SI Section Text Map
function getSectionTextMap(key) {
	var sectionTextMap = {
		"1" : "111 - Tax on accumulated balance of recognised PF",
		"5A1ai" : "115A(1)(a)(i)- Dividends interest and income from units purchase in foreign currency",
		"5A1aii" : "115A(1)(a)(ii)- Interest received from govt/Indian Concerns recived in Foreign Currency",
		"5A1aiia" : "115A(1) (a)(iia) -Interest from Infrastructure Debt Fund",
		"5A1aiiaa" : "115A(1) (a)(iiaa) -Interest as per Sec. 194LC",
		"5A1aiiab" : "115A(1) (a)(iiab) -Interest as per Sec. 194LD",
		"5A1aiiac" : "115A(1)(a)(iiac) -Interest as per Sec. 194LBA",
		"5A1aiii" : "115A(1) (a)(iii) - Income received in respect of units of UTI purchased in Foreign Currency",
		"5A1bA" : "115A(1)(b)(A)- Income from royalty & technical services",
		"5A1bB" : "115A(1)(b)(B) Income from royalty & technical services",
		"5AC1ab" : "115AC(1)(a & b) - Income from bonds or GDR purchased in foreign currency - non-resident",
		"5ACA1a" : "115ACA(1)(a) - Income from GDR purchased in foreign currency -resident",
		"5AD1i" : "115AD(1)(i) -Income received by an FII in respect of securities (other than units as per Sec 115AB)",
		"5AD1iP" : "115AD(1)(i) -Income received by an FII in respect of bonds or government securities as per Sec 194LD ",
		"5BBA" : "115BBA - Tax on non-residents sportsmen or sports associations",
		"5BBDA" : "115BBDA - Dividend Income from domestic company that exceeds Rs.10 Lakh",
		"5BBF" : "115BBF - Tax on income from patent",
		"5BBG" : "115BBG - Income from the transfer of carbon credits",
		"5Ea" : "115E(a) - Investment income",
		"5AB1a" :"115AB(1)(a) - Income in respect of units - off -shore fund",
		"FA" : "Para E II of Part I of Ist Sch of FA - Income from royalty or technical services - Non-domestic company",
		"Others" : "Others"
	};

	return sectionTextMap[key];
}



function prefixZero92E(){
	var tabl = document.getElementById('AuditDetails92E');
	var allInputTags = tabl.getElementsByTagName('input');

	for(i=0; i<allInputTags.length; i++) {
		if(document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value.length==5){
			document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value =
				'0'+document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value.length==4){
			document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value =
				'00'+document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value.length==3){
			document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value =
				'000'+document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value.length==2){
			document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value =
				'0000'+document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value ;
		} else if(document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value.length==1){
			document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value =
				'00000'+document.getElementsByName('itr7.partAGEN2.auditDetails.auditorMemNo92E')[0].value ;
		}
	}
}


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 cashDeposit =
	 * document.getElementsByName('itr.refund.depositToBankAccount.depositAmount')[0].value;
	 */

	var countOfCheckBox = 0;
	var disbaledornot = true;

	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].disabled!=true){
				allInputTags[i].value=true;
				countOfCheckBox++;
			}else{
				if(allInputTags[i].disabled!=true){
					allInputTags[i].value=false;
				}else{
					disbaledornot = false;
					allInputTags[i].value="";
				}

			}
		}
		if (allInputTags[i].name.match("useForDigitalReceipts$")){
			if(allInputTags[i].checked==true&&allInputTags[i].disabled!=true){
				allInputTags[i].value=true;
			}else{
				if(allInputTags[i].disabled!=true){
					allInputTags[i].value=false;
				}else{
					allInputTags[i].value="";
				}

			}
		}
	}

	if(countOfCheckBox==0 && disbaledornot== true){
		addErrorXHTML('',
		'Please select atleast one account in which you prefer to get your refund');
			j.setFieldError('itr.scheduleBA[0].useForRefund',
				'Please select atleast one account in which you prefer to get your refund');
	}

	if(bankDtlflag=='N' )
	{
		if(bankName !="" && (ifscCode=="" || bankAcctNo=="")){

			addErrorXHTML('' ,'Please fill all the fields under Indian Bank Account details.');
			j.setFieldError('itr.refund.depositToBankAccount','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.refund.depositToBankAccount','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.refund.depositToBankAccount','Please fill all the fields under Indian Bank Account details.');
   }

}
}

function validateReturnFurSec(){

	var returnFurnishedSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;

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


	if(returnFurnishedSec =='OTH' && totalIncome>0){

		j.setFieldError('itr7.partBTI.totalIncome','Total income should be zero for retrun furnished under section OTHERS');
 		addErrorXHTML(document.getElementsByName('itr7.partBTI.totalIncome')[0],'Total income should be zero for retrun furnished under section OTHERS',true);

	}
}

function checkPinOnStateChangeVer()
{
	var state = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.stateCode')[0];

	if ( state.value == "99" )
		{
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode')[0].disabled=true;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode')[0].value="";
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].disabled=false;

		}
	else
		{
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled=true;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode')[0].disabled=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].disabled=true;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].value="";
		}

	populateZipCodeVer();

}

function populateZipCodeVer(){

	var zipCodeCheck= document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0];

	if(zipCodeCheck.checked==true){

		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].value="XXXXXX";
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly=true;
		zipCodeCheck.value=true;

	}else{

		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].value="";
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly=false;
		zipCodeCheck.value=false;
	}

}

function checkPinZipOnload()
{
	var state = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.stateCode')[0];
	var zipCode =document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].value
	if ( state.value != "99" ){
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled=true;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].value="";
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode')[0].disabled=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].disabled=true;


		}
	else
		{
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].disabled=false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode')[0].value="";
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode')[0].disabled=true;

		if(zipCode=="XXXXXX"){

			document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly=true;
			document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked=true;
		}else if ( state.value == "99" ){

			document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].readOnly=false;
			document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.zipCode')[0].disabled=false;
			document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0].checked=false;
		}



		}
}


function subStatusOnLoad()
{

	var statusCompany=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
	var statusCompany1 = statusCompany.value;

	var sub = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0];
	var sub1 = sub.value;

	/*if(statusCompany1 == '7'){
		for(var i=0;sub.options.length > 0;i++){
			sub.options.remove(0);
		}
		sub.options[0] = new Option('Select','-1');
		sub.options[1] = new Option('Domestic Company','7i');
		// sub.options[2] = new Option('Foreign Company','7ii');

	}else*/ 
	if(statusCompany1 == '5'){
		for(var i=0;sub.options.length > 0;i++){
			sub.options.remove(0);
		}
		sub.options[0] = new Option('Select','-1');
		sub.options[1] = new Option('Society Registered under Societies Registration Act-1860 or any law corresponding to that Act','5i');
		sub.options[2] = new Option('Public Charitable Trust','5v');
	//	sub.options[3] = new Option('Other Trust/Institution','5vi');
		sub.options[3] = new Option('Other AOP or BOI','5vii');

	}else{
		for(var i=0;sub.options.length > 0;i++){
			sub.options.remove(0);
		}
		sub.options[0] = new Option('Select','');
	}

	sub.value= sub1;

}

function enableTableForBank(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);
	}
}


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].disabled==true){
				allInputTags[i].checked=false;
			}
		}
		if (allInputTags[i].name.match("useForDigitalReceipts$")){
			if(allInputTags[i].disabled==true){
				allInputTags[i].checked=false;
			}
		}
	}
	
	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].bankAccountNo');
	enableField('itr.scheduleBA.bankDtlsFlag', 'N','itr.scheduleBA.foreignBankDtls[0].countryCode');

//	enableField('itr7.partAGEN1.filingStatus.residentialStatus','NRI','itr.scheduleBA.foreignBankDtls[0].ibanSwiftCode');
//	enableField('itr7.partAGEN1.filingStatus.residentialStatus','NRI','itr.scheduleBA.foreignBankDtls[0].bankName');
//	enableField('itr7.partAGEN1.filingStatus.residentialStatus','NRI','itr.scheduleBA.foreignBankDtls[0].countryCode');
//	enableField('itr7.partAGEN1.filingStatus.residentialStatus','NRI','itr.scheduleBA.foreignBankDtls[0].bankAccountNo');

}

function populateBankFlg()
{

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

	if(residentialStatus == 'RES' || residentialStatus == 'NOR')
		{
		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;
			}
	enableBankDtls();
}

function setPartAGen2PinZipOnLoad(){

	var table = document.getElementById('AOPTab');
	var rowCount = table.rows.length;
	var state ;
	var country ;

	for(var i=0 ;i<rowCount-4;i++){

		state = document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.stateCode')[0].value;
		country = document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.country')[0].value;

		if(country == '91' ){
			document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.zipCode')[0].value='';
			document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.zipCode')[0].disabled=true;
		}else if(state =='99'){
			document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.pinCode')[0].value='';
			document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.pinCode')[0].disabled=true;
		}else{
			document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.zipCode')[0].value='';
			document.getElementsByName('itr7.partAGEN2.partnerOrMemberInfo['+i+'].addressDetail.zipCode')[0].disabled=true;
		}
	}

}

function setStateOrCountry(tableId){
	var id=tableId;
	var table = document.getElementById(id);
	var rowCount = table.rows.length;
	var state ;
	var country ;
	if(id=='schCTcashTransactions'){
		for(var i=0 ;i<rowCount-4;i++){
			state = document.getElementsByName('scheduleCT.loanOrDeposit['+i+'].stateName')[0].value;
			country = document.getElementsByName('scheduleCT.loanOrDeposit['+i+'].countryCode')[0].value;

			if(country !='91'){
				document.getElementsByName('scheduleCT.loanOrDeposit['+i+'].stateName')[0].value='99';
				document.getElementsByName('scheduleCT.loanOrDeposit['+i+'].pinCode')[0].readonly=true;
			}if(state !='99'){
				document.getElementsByName('scheduleCT.loanOrDeposit['+i+'].countryCode')[0].value='91';
			}
		}
	}
	if(id=='schCTreceiptOfAmountLimit'){
		for(var i=0 ;i<rowCount-4;i++){
			state = document.getElementsByName('scheduleCT.receiptOfAmountLimit['+i+'].stateName')[0].value;
			country = document.getElementsByName('scheduleCT.receiptOfAmountLimit['+i+'].countryCode')[0].value;

			if(country !='91'){
				document.getElementsByName('scheduleCT.receiptOfAmountLimit['+i+'].stateName')[0].value='99';
			}if(state !='99'){
				document.getElementsByName('scheduleCT.receiptOfAmountLimit['+i+'].countryCode')[0].value='91';
			}
		}
	}
	if(id=='schCTpaymentOfAmountLimit'){
		for(var i=0 ;i<rowCount-4;i++){
			state = document.getElementsByName('scheduleCT.paymentOfAmountLimit['+i+'].stateName')[0].value;
			country = document.getElementsByName('scheduleCT.paymentOfAmountLimit['+i+'].countryCode')[0].value;

			if(country !='91'){
				document.getElementsByName('scheduleCT.paymentOfAmountLimit['+i+'].stateName')[0].value='99';
			}if(state !='99'){
				document.getElementsByName('scheduleCT.paymentOfAmountLimit['+i+'].countryCode')[0].value='91';
			}
		}
	}
	if(id=='schCTrepaymentOfLoanOrDeposit'){
		for(var i=0 ;i<rowCount-4;i++){
			state = document.getElementsByName('scheduleCT.repaymentOfLoanOrDeposit['+i+'].stateName')[0].value;
			country = document.getElementsByName('scheduleCT.repaymentOfLoanOrDeposit['+i+'].countryCode')[0].value;

			if(country != '91' ){
				document.getElementsByName('scheduleCT.repaymentOfLoanOrDeposit['+i+'].stateName')[0].value='99';
			}if(state !='99'){
				document.getElementsByName('scheduleCT.repaymentOfLoanOrDeposit['+i+'].countryCode')[0].value='91';
			}
		}
	}
	if(id=='schCTrepaymentOfLoanOrDepositrec'){
		for(var i=0 ;i<rowCount-4;i++){
			state = document.getElementsByName('scheduleCT.repaymentOfLoanOrDepositrec['+i+'].stateName')[0].value;
			country = document.getElementsByName('scheduleCT.repaymentOfLoanOrDepositrec['+i+'].countryCode')[0].value;

			if(country !='91'){
				document.getElementsByName('scheduleCT.repaymentOfLoanOrDepositrec['+i+'].stateName')[0].value='99';
			}if(state !='99'){
				document.getElementsByName('scheduleCT.repaymentOfLoanOrDepositrec['+i+'].countryCode')[0].value='91';
			}
		}
	}
}

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('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.stateCode')[0].value;
		country = document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.country')[0].value;

		if(country == '91' ){
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.zipCode')[0].value='';
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.zipCode')[0].disabled=true;
		}else if(state =='99'){
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.pinCode')[0].value='';
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.pinCode')[0].disabled=true;
		}else{
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.zipCode')[0].value='';
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.zipCode')[0].disabled=true;
		}
	}

}

function genWarningMsgForNRI() {

	var resStatus = document.getElementsByName('itr7.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.');
	}
}

// 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');
		deleteRowTable(tableId, 2, 1);
		$(tabId).find(':input').prop('disabled', true);
		$(tabId).find('.addbtn').prop('hidden', true);
	}
}

// AY 2019 - 20 Changes

// To enable or disable fields based on the return filed under section
function revisedSetFor6(section) {

	var fileSec = document.getElementsByName(section)[0].value;

	if (fileSec == '17' || fileSec == '19') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;

	} else if (fileSec == '18') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled = false;

	} else if (fileSec != '17') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		if(fileSec=='20'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
		}
	} else if (fileSec == '20') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
	}


	if (fileSec == '13' || fileSec == '14' || fileSec == '15'|| fileSec == '16' || fileSec == '18' || fileSec == '19') {
		enableField(section,fileSec, 'itr7.partAGEN1.filingStatus.noticeDateUnderSec');
		enableField(section,fileSec, 'itr7.partAGEN1.filingStatus.uniqueNumNoticeUs');
	} else if (fileSec == '11' || fileSec == '12' || fileSec == '17' || fileSec == '') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled = true;
	}
	if (fileSec == '11' || fileSec == '12' || fileSec == '13'
			|| fileSec == '14' || fileSec == '15' || fileSec == '16') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15' || fileSec == '16' || fileSec == '19'|| fileSec == '20') {
	document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = false;
	document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled = false;
}
	if (fileSec == '11' || fileSec == '12' || fileSec == '17' || fileSec == '19'|| fileSec == '20') 
	{
		document.getElementsByName("itr7.partAGEN1.filingStatus.returnFileSec.returnFileInResp")[0].value='';
	}


}

function revisedSetFor6OnLoad(section){

	var fileSec = document.getElementsByName(section)[0].value;

	if (fileSec == '17' || fileSec == '19') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;

	} else if (fileSec == '18') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled = false;

	} else if (fileSec != '17' || fileType.value != 'R') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		if(fileSec=='20'){
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled=false;
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value='';
			document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled=false;
		}
	} else if (fileSec == '20') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = false;
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled = false;
	}


	if (fileSec == '13' || fileSec == '14' || fileSec == '15'|| fileSec == '16' || fileSec == '18' || fileSec == '19') {
		enableField(section,fileSec, 'itr7.partAGEN1.filingStatus.noticeDateUnderSec');
		enableField(section,fileSec, 'itr7.partAGEN1.filingStatus.uniqueNumNoticeUs');
	} else if (fileSec == '11' || fileSec == '12' || fileSec == '17' || fileSec == '') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled = true;
	}
	if (fileSec == '11' || fileSec == '12' || fileSec == '13'
			|| fileSec == '14' || fileSec == '15' || fileSec == '16') {
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].value = '';
		document.getElementsByName("itr7.partAGEN1.filingStatus.receiptNo")[0].disabled = true;
		document.getElementsByName("itr7.partAGEN1.filingStatus.origRetFiledDate")[0].disabled = true;
	}
	if (fileSec == '13' || fileSec == '14' || fileSec == '15' || fileSec == '16' || fileSec == '19'|| fileSec == '20') {
	document.getElementsByName("itr7.partAGEN1.filingStatus.noticeDateUnderSec")[0].disabled = false;
	document.getElementsByName("itr7.partAGEN1.filingStatus.uniqueNumNoticeUs")[0].disabled = false;
	}
}

function returnSecCheck(Sec,Resp){
	var Sec = document.getElementsByName(Sec)[0];
	var Resp = document.getElementsByName(Resp)[0];
	var secHidden = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[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('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[0];
	if(Resp.value!=''){
		Sec.value='';
		secHidden.value=Resp.value;
	}

}

function setSecResp(){
	
	var HiddenSec=document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[0].value;
	
	var fileSec=document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0];
	
	var respSec=document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.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 setSecRespOnSave(){
	var HiddenSec=document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[0];
	var fileSec=document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;
	var respSec=document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.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('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection')[0];
	if(HiddenSec.value==''){
		j.setFieldError('itr7.partAGEN1.filingStatus.returnFileSec.hiddenSection','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 otherProperty(){
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);
	for (var i = 0; i < totHp; i++) {
		if(document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].ownerOfProperty')[0].value=='OTH'){
			// document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].otherOwnerOfProperty')[0].style.display='';
		}else{
			// document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].otherOwnerOfProperty')[0].style.display='none';
			// document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].otherOwnerOfProperty')[0].value='';
		}
	}
}

function calstcgNatOfIncome(){
	var totAmtStcgUnderPTI = document.getElementsByName('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.totAmtStcgUnderPTI')[0];

	var ptiStcg15 = coalesceSetRet('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg15');

	var ptiStcg30 = coalesceSetRet('itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg30');


	totAmtStcgUnderPTI.value = eval(parseInt(ptiStcg15,10)+parseInt(ptiStcg30,10));
}

function calltcgNatOfIncome(){

	var totAmtLtcgUnderPTI = document.getElementsByName('itr7.scheduleCG.longTermCapGain.passThrtotalIncome')[0];

	var ptiLtcg15 = coalesceSetRet('itr7.scheduleCG.longTermCapGain.passThrInc10Per');

	var ptiLtcg30 = coalesceSetRet('itr7.scheduleCG.longTermCapGain.passThrInc20Per');


	totAmtLtcgUnderPTI.value = eval(parseInt(ptiLtcg15,10)+parseInt(ptiLtcg30,10));

}


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('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.taxAccmltdBalRecPFDtls['
								+ i + '].incomeBenefit')[0].value), 10)
				+ parseInt(amt2, 10);
		amt2 = amt1;
	}

	document
			.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalIncomeBenefit')[0].value = amt1;
}

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('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.taxAccmltdBalRecPFDtls['
								+ i + '].taxBenefit')[0].value), 10)
				+ parseInt(amt2, 10);
		amt2 = amt1;
	}

	document
			.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.totalTaxBenefit')[0].value = amt1;
}

function removeIncomeDtls1() {

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

	if (status == 'NRI' || status == 'RES' || status == 'NOR') {
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA')[0].value = 0;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBF')[0].value = 0;
		document
				.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBG')[0].value = 0;
	}

}


function validateOsBbdaLottery(){

	var taxon15BDA0 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/6'),10)));
	var taxon15BDA1 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/9'),10)+parseInt(taxon15BDA0,10)));
	var taxon15BDA2 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/12'),10)+parseInt(taxon15BDA1,10)));
	var taxon15BDA3 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto15/3'),10)+parseInt(taxon15BDA2,10)));
	var taxon15BDA4 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.dividendIncome115BBDA.Upto31/3'),10)));


	var totalBBDAtax = eval(parseInt(taxon15BDA3,10)+parseInt(taxon15BDA4,10));


	var taxonLottery0 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6'),10)));
	var taxonLottery1 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/9'),10)+parseInt(taxonLottery0,10)));
	var taxonLottery2 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/12'),10)+parseInt(taxonLottery1,10)));
	var taxonLottery3 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/3'),10)+parseInt(taxonLottery2,10)));
	var taxonLottery4 = zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto31/3'),10)));

	var totalLotteryTax = eval(parseInt(taxonLottery3,10)+parseInt(taxonLottery4,10));

	var BBDA=zeroOrMore(eval(parseInt(coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA'),10)+parseInt(coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.dividendIncome115BBDA_PTI'),10)));


	if(BBDA<totalBBDAtax||BBDA>totalBBDAtax){
		addErrorXHTML(document.getElementsByName('itr7.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('itr7.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('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries'),10)+parseInt(coalesceSetRet('itr7.scheduleOS.incChargblSplRateOS.winningFrmLotteries_PTI'),10)));
	
	if(lottery<totalLotteryTax||lottery>totalLotteryTax){
		addErrorXHTML(document.getElementsByName('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6')[0],'Income from Lottery must be equal to 2a of Schedule OS+115BB dropdown of 2e-DTAA 115BB - DTAA 115BB PTI respectively.',true);
		j.setFieldError('itr7.scheduleOS.incFromOwnHorse.incomeFromLottery.Upto15/6',"Income from Lottery must be equal to 2a of Schedule OS+115BB dropdown of 2e-DTAA 115BB - DTAA 115BB PTI respectively.");
	}
}

function loadExemptSecs(){
	var returnFurnishedSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0];
	var returnFurnishedSec1 = returnFurnishedSec.value;

	var secUnderExemptionClaimed = document.getElementsByName("itr7.partAGEN1.filingStatus.secUnderExemptionClaimed")[0];
	var secUnderExemptionClaimed1 = secUnderExemptionClaimed.value;


	if(returnFurnishedSec1 == '139-4A'){
		// var secUnderExemptionClaimed =
		// document.getElementById("secUnderExemptionClaimed");
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		// secUnderExemptionClaimed.options.length = 0;
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1] = new Option('Section 11','11');

	}else if(returnFurnishedSec1 == '139-4B'){
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		// secUnderExemptionClaimed.options.length = 0;
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1] = new Option('Section 13A','13A');
		secUnderExemptionClaimed.options[2] = new Option('Section 13B','13B');

	}else if(returnFurnishedSec1 == '139-4D'){
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		// secUnderExemptionClaimed.options.length = 0;
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1]  = new Option('Section 10(21) read with section 35(1)','2135I');

	}else if(returnFurnishedSec1 == '139-4C'){
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		// secUnderExemptionClaimed.options.length = 0;
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1]  = new Option('Section 10(21)','21');
		secUnderExemptionClaimed.options[2]  = new Option('Section 10(22B)','22B');
		secUnderExemptionClaimed.options[3]  = new Option('Section 10(23A)','23A');
		secUnderExemptionClaimed.options[4]  = new Option('Section 10(23B)','23B');
		secUnderExemptionClaimed.options[5]  = new Option('Section 10(23C)(iiiab)','23CIIIAB');
		secUnderExemptionClaimed.options[6]  = new Option('Section 10(23C)(iiiac)','23CIIIAC');
		secUnderExemptionClaimed.options[7]  = new Option('Section 10(23C)(iiiad)','23CIIIAD');
		secUnderExemptionClaimed.options[8]  = new Option('Section 10(23C)(iiiae)','23CIIIAE');
		secUnderExemptionClaimed.options[9]  = new Option('Section 10(23C)(iv)','23CIV');
		secUnderExemptionClaimed.options[10] = new Option('Section 10(23C)(v)','23CV');
		secUnderExemptionClaimed.options[11] = new Option('Section 10(23C)(vi)','23CVI');
		secUnderExemptionClaimed.options[12] = new Option('Section 10(23C)(via)','23CVIA');
		secUnderExemptionClaimed.options[13] = new Option('Section 10(23D)','23D');
		secUnderExemptionClaimed.options[14] = new Option('Section 10(23DA)','23DA');
		secUnderExemptionClaimed.options[15] = new Option('Section 10(23FB)','23FB');
		secUnderExemptionClaimed.options[16] = new Option('Section 10(24)','24');
		secUnderExemptionClaimed.options[17] = new Option('Section 10(46)','26');
		secUnderExemptionClaimed.options[18] = new Option('Section 10(47)','47');
		secUnderExemptionClaimed.options[19] = new Option('Section 10(23AAA)','23AAA');
		secUnderExemptionClaimed.options[20] = new Option('Section 10(23EC)','23EC');
		secUnderExemptionClaimed.options[21] = new Option('Section 10(23ED)','23ED');
		secUnderExemptionClaimed.options[22] = new Option('Section 10(23EE)','23EE');
		secUnderExemptionClaimed.options[23] = new Option('Section 10(29A)','29A');

	}else if(returnFurnishedSec1 == 'OTH'){
	// }else{
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		// secUnderExemptionClaimed.options.length = 0;
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1]  = new Option('Section 10(20)','20');
		secUnderExemptionClaimed.options[2]  = new Option('Section 10(23AA)','23AA');
		secUnderExemptionClaimed.options[3]  = new Option('Section 10(23AAB)','23AAB');
		secUnderExemptionClaimed.options[4]  = new Option('Section 10(23BB)','23BB');
		secUnderExemptionClaimed.options[5]  = new Option('Section 10(23BBA)','23BBA');
		secUnderExemptionClaimed.options[6]  = new Option('Section 10(23BBC)','23BBC');
		secUnderExemptionClaimed.options[7]  = new Option('Section 10(23BBE)','23BBE');
		secUnderExemptionClaimed.options[8]  = new Option('Section 10(23BBG)','23BBG');
		secUnderExemptionClaimed.options[9]  = new Option('Section 10(23BBH)','23BBH');
		secUnderExemptionClaimed.options[10] = new Option('Section 10(23C)(i)','23CI');
		secUnderExemptionClaimed.options[11] = new Option('Section 10(23C)(ii)','23CII');
		secUnderExemptionClaimed.options[12] = new Option('Section 10(23C)(iii)','23CIII');
		secUnderExemptionClaimed.options[13] = new Option('Section 10(23C)(iiia)','23CIIIA');
		secUnderExemptionClaimed.options[14] = new Option('Section 10(23C)(iiiaa)','23CIIIAA');
		secUnderExemptionClaimed.options[15] = new Option('Section 10(23C)(iiiaaa)','23CIIIAAA');
		secUnderExemptionClaimed.options[16] = new Option('Section 10(23C)(iiiaaaa)','23CIIIAAAA');
		secUnderExemptionClaimed.options[17] = new Option('Section 10(25)(i)','25I');
		secUnderExemptionClaimed.options[18] = new Option('Section 10(25)(ii)','25II');
		secUnderExemptionClaimed.options[19] = new Option('Section 10(25)(iii)','25III');
		secUnderExemptionClaimed.options[20] = new Option('Section 10(25)(iv)','25IV');
		secUnderExemptionClaimed.options[21] = new Option('Section 10(25)(v)','25V');
		secUnderExemptionClaimed.options[22] = new Option('Section 10(25A)','25A');
		secUnderExemptionClaimed.options[23] = new Option('Section 10(26AAB)','26AAB');
		secUnderExemptionClaimed.options[24] = new Option('Section 10(26B)','26B');
		secUnderExemptionClaimed.options[25] = new Option('Section 10(26BB)','26BB');
		secUnderExemptionClaimed.options[26] = new Option('Section 10(26BBB)','26BBB');
		secUnderExemptionClaimed.options[27] = new Option('Section 10(44)','44');

	}else{
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		secUnderExemptionClaimed.options[0] = new Option('Select','');

	}

}

function enableSchET() {

	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;

	if (exemptClaimed == '13B'  ) {
		document.getElementsByName('itr7.scheduleET.booksOfAccMaintained')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.booksOfAccMaintained')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContribution')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContribution')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.recordsMaintainedWithPAN')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.recordsMaintainedWithPAN')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.accountsAudited')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.accountsAudited')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.auditReportDate')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.auditReportDate')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.reportAsPerRule17CA')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.reportAsPerRule17CA')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0].disabled = false;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0].readOnly = false;
// document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].disabled
// = false;
// document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].readOnly
// = false;
	}else{
		document.getElementsByName('itr7.scheduleET.booksOfAccMaintained')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.booksOfAccMaintained')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.booksOfAccMaintained')[0].value = "";
		document.getElementsByName('itr7.scheduleET.voluntaryContribution')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContribution')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContribution')[0].value = "";
		document.getElementsByName('itr7.scheduleET.recordsMaintainedWithPAN')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.recordsMaintainedWithPAN')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.recordsMaintainedWithPAN')[0].value = "";
		document.getElementsByName('itr7.scheduleET.accountsAudited')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.accountsAudited')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.accountsAudited')[0].value = "";
		document.getElementsByName('itr7.scheduleET.auditReportDate')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.auditReportDate')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.auditReportDate')[0].value = "";
		document.getElementsByName('itr7.scheduleET.reportAsPerRule17CA')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.reportAsPerRule17CA')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.reportAsPerRule17CA')[0].value = "";
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.openingBalance')[0].value = '';
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtDistToPoliticalParties')[0].value = '';
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0].disabled = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0].value = '';
// document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].disabled
// = true;
// document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].readOnly
// = true;
// document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].value
// = '';

		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAfterVoluntaryContribution')[0].value = '';
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.total')[0].value = '';
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.closingBalance')[0].value = '';
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.totalAmntExcepSec13B')[0].value = '';
		document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr')[0].value = '';
		document.getElementsByName('itr7.partBTI.exemptionUs13_B')[0].value = '';


	}

}

function enableSchAI(){

	var tabl = document.getElementById('otherIncomeInSchAI');
	var allInputTags = tabl.getElementsByTagName('input');

	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	
	if (exemptClaimed == '11' || exemptClaimed == '23CIV'  || exemptClaimed == '23CV'
			|| exemptClaimed == '23CVI' || exemptClaimed == '23CVIA') {
		document.getElementsByName('itr7.scheduleAI.receiptsFromMain')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.receiptsFromMain')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleAI.receiptsFromIncident')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.receiptsFromIncident')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleAI.rent')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.rent')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleAI.commission')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.commission')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleAI.dividentIncome')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.dividentIncome')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleAI.interestIncome')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.interestIncome')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleAI.agricultureIncome')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.agricultureIncome')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleAI.netCapitalAsset')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.netCapitalAsset')[0].readOnly = false;

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;
		}
		document.getElementsByName('itr7.scheduleAI.passThroughIncome')[0].disabled = false;
		document.getElementsByName('itr7.scheduleAI.passThroughIncome')[0].readOnly = true;
		populatePtiToAi();
	}else{
		document.getElementsByName('itr7.scheduleAI.receiptsFromMain')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.receiptsFromMain')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.receiptsFromMain')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.receiptsFromIncident')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.receiptsFromIncident')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.receiptsFromIncident')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.rent')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.rent')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.rent')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.commission')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.commission')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.commission')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.dividentIncome')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.dividentIncome')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.dividentIncome')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.interestIncome')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.interestIncome')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.interestIncome')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.agricultureIncome')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.agricultureIncome')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.agricultureIncome')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.netCapitalAsset')[0].disabled = true;
		document.getElementsByName('itr7.scheduleAI.netCapitalAsset')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleAI.netCapitalAsset')[0].value = 0;

		document.getElementsByName('itr7.scheduleAI.otherTotalIncome')[0].value = 0;
		document.getElementsByName('itr7.scheduleAI.schAITotalIncome')[0].value = 0;

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;

			allInputTags[i].value = '';
			// allInputTags[i].value = '0';
		}
	}
}

function enableSchEREC(){

	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;

	if (exemptClaimed == '11' || exemptClaimed == '23CIV'  || exemptClaimed == '23CV'
		|| exemptClaimed == '23CVI' || exemptClaimed == '23CVIA') {

		document.getElementsByName('itr7.scheduleER.rent')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.rent')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.repairs')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.repairs')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.compensationToEmp')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.compensationToEmp')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.insurance')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.insurance')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.workmenStaffWelExp')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.workmenStaffWelExp')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.entertainandHospitality')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.entertainandHospitality')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.advertisement')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.advertisement')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.profConstlFeeTechServ')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.profConstlFeeTechServ')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.conveyandTravelOtheExp')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.conveyandTravelOtheExp')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.remunerationTrusetee')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.remunerationTrusetee')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.rateTaxespayableToGovernment')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.rateTaxespayableToGovernment')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.interest')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.interest')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.auditFee')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.auditFee')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.depreciationPreviousYear')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.depreciationPreviousYear')[0].readOnly = false;

		var tabl = document.getElementById('otherExpensesSchER');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;
		}

		/*
		 * document.getElementsByName('itr7.scheduleER.donation.corpus')[0].disabled =
		 * false;
		 * document.getElementsByName('itr7.scheduleER.donation.corpus')[0].readOnly =
		 * false;
		 */
		document.getElementsByName('itr7.scheduleER.donation.othtthncorpus')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.donation.othtthncorpus')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.religious')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.religious')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.reliefOfPoor')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.reliefOfPoor')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.educational')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.educational')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.yoga')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.yoga')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.medicalRelief')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.medicalRelief')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.preserveEnvironment')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.preserveEnvironment')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.preserveMonuments')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.preserveMonuments')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.genPublicUtility')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.genPublicUtility')[0].readOnly = false;

		document.getElementsByName('itr7.scheduleER.badDebts')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.badDebts')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.provisions')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.provisions')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.formingCorpus')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.formingCorpus')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.otherDisallowable')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.otherDisallowable')[0].readOnly = false;

		document.getElementsByName('itr7.scheduleER.incomeEarnedPrevYear')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.incomeEarnedPrevYear')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.incomeDeemedus111')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.incomeDeemedus111')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.incomeUpto15Per')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.incomeUpto15Per')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleER.borrowedFund')[0].disabled = false;
		document.getElementsByName('itr7.scheduleER.borrowedFund')[0].readOnly = false;

		var tabl = document.getElementById('anyOtherExpensesSchER');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;
		}

		document.getElementsByName('itr7.scheduleEC.additionToCapitalWork')[0].disabled = false;
		document.getElementsByName('itr7.scheduleEC.additionToCapitalWork')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleEC.acqofFixedAssest')[0].disabled = false;
		document.getElementsByName('itr7.scheduleEC.acqofFixedAssest')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleEC.costNewAssetDeemed')[0].disabled = false;
		document.getElementsByName('itr7.scheduleEC.costNewAssetDeemed')[0].readOnly = false;

		var tabl = document.getElementById('otherCapitalExpense');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;

			// allInputTags[i].value = '';
		}

		document.getElementsByName('itr7.scheduleEC.incDerivedDuringPrevYear')[0].disabled = false;
		document.getElementsByName('itr7.scheduleEC.incDerivedDuringPrevYear')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleEC.incomeDeemedPrecedingYear')[0].disabled = false;
		document.getElementsByName('itr7.scheduleEC.incomeDeemedPrecedingYear')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleEC.incomeEarlierYears15Percent')[0].disabled = false;
		document.getElementsByName('itr7.scheduleEC.incomeEarlierYears15Percent')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleEC.borrowedFund')[0].disabled = false;
		document.getElementsByName('itr7.scheduleEC.borrowedFund')[0].readOnly = false;

		var tabl = document.getElementById('otherSourceOfFund');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;

			// allInputTags[i].value = '';
		}

	}else{
		document.getElementsByName('itr7.scheduleER.rent')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.rent')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.rent')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.repairs')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.repairs')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.repairs')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.compensationToEmp')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.compensationToEmp')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.compensationToEmp')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.insurance')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.insurance')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.insurance')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.workmenStaffWelExp')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.workmenStaffWelExp')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.workmenStaffWelExp')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.entertainandHospitality')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.entertainandHospitality')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.entertainandHospitality')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.advertisement')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.advertisement')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.advertisement')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.profConstlFeeTechServ')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.profConstlFeeTechServ')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.profConstlFeeTechServ')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.conveyandTravelOtheExp')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.conveyandTravelOtheExp')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.conveyandTravelOtheExp')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.remunerationTrusetee')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.remunerationTrusetee')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.remunerationTrusetee')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.rateTaxespayableToGovernment')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.rateTaxespayableToGovernment')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.rateTaxespayableToGovernment')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.interest')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.interest')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.interest')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.auditFee')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.auditFee')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.auditFee')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.depreciationPreviousYear')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.depreciationPreviousYear')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.depreciationPreviousYear')[0].value = 0;

		document.getElementsByName('itr7.scheduleER.otherExpensesTotal')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.expensesTotal')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.totalBTrustExpenditure')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.totalSumOfAB')[0].value = 0;


		var tabl = document.getElementById('otherExpensesSchER');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;

			allInputTags[i].value = '';
			// allInputTags[i].value = '0';
		}

	/*
	 * document.getElementsByName('itr7.scheduleER.donation.corpus')[0].disabled =
	 * true;
	 * document.getElementsByName('itr7.scheduleER.donation.corpus')[0].readOnly =
	 * true;
	 * document.getElementsByName('itr7.scheduleER.donation.corpus')[0].value =
	 * 0;
	 */
		document.getElementsByName('itr7.scheduleER.donation.othtthncorpus')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.donation.othtthncorpus')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.donation.othtthncorpus')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.religious')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.religious')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.religious')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.reliefOfPoor')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.reliefOfPoor')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.reliefOfPoor')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.educational')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.educational')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.educational')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.yoga')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.yoga')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.yoga')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.medicalRelief')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.medicalRelief')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.medicalRelief')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.preserveEnvironment')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.preserveEnvironment')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.preserveEnvironment')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.preserveMonuments')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.preserveMonuments')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.preserveMonuments')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.genPublicUtility')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.genPublicUtility')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.genPublicUtility')[0].value = 0;

		document.getElementsByName('itr7.scheduleER.badDebts')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.badDebts')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.badDebts')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.provisions')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.provisions')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.provisions')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.formingCorpus')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.formingCorpus')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.formingCorpus')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.otherDisallowable')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.otherDisallowable')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.otherDisallowable')[0].value = 0;

		document.getElementsByName('itr7.scheduleER.incomeEarnedPrevYear')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.incomeEarnedPrevYear')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.incomeEarnedPrevYear')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.incomeDeemedus111')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.incomeDeemedus111')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.incomeDeemedus111')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.incomeUpto15Per')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.incomeUpto15Per')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.incomeUpto15Per')[0].value = 0;
		document.getElementsByName('itr7.scheduleER.borrowedFund')[0].disabled = true;
		document.getElementsByName('itr7.scheduleER.borrowedFund')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleER.borrowedFund')[0].value = 0;
		
		document.getElementsByName('itr7.scheduleER.totalRevenueExpenditure')[0].value = '';
		document.getElementsByName('itr7.scheduleER.totOthIncome')[0].value = '';
		document.getElementsByName('itr7.scheduleER.totAmtDurPrvYr')[0].value = '';
		
		var tabl = document.getElementById('anyOtherExpensesSchER');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;

			allInputTags[i].value = '';
			// allInputTags[i].value = '0';
		}

		document.getElementsByName('itr7.scheduleEC.additionToCapitalWork')[0].disabled = true;
		document.getElementsByName('itr7.scheduleEC.additionToCapitalWork')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleEC.additionToCapitalWork')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.acqofFixedAssest')[0].disabled = true;
		document.getElementsByName('itr7.scheduleEC.acqofFixedAssest')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleEC.acqofFixedAssest')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.costNewAssetDeemed')[0].disabled = true;
		document.getElementsByName('itr7.scheduleEC.costNewAssetDeemed')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleEC.costNewAssetDeemed')[0].value = '';

		var tabl = document.getElementById('otherCapitalExpense');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;

			allInputTags[i].value = '';
		}


		document.getElementsByName('itr7.scheduleEC.incDerivedDuringPrevYear')[0].disabled = true;
		document.getElementsByName('itr7.scheduleEC.incDerivedDuringPrevYear')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleEC.incDerivedDuringPrevYear')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.incomeDeemedPrecedingYear')[0].disabled = true;
		document.getElementsByName('itr7.scheduleEC.incomeDeemedPrecedingYear')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleEC.incomeDeemedPrecedingYear')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.incomeEarlierYears15Percent')[0].disabled = true;
		document.getElementsByName('itr7.scheduleEC.incomeEarlierYears15Percent')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleEC.incomeEarlierYears15Percent')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.borrowedFund')[0].disabled = true;
		document.getElementsByName('itr7.scheduleEC.borrowedFund')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleEC.borrowedFund')[0].value = '';
		
		document.getElementsByName('itr7.scheduleEC.otherTotalExpense')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.totalCapitalExpense')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.anyOtherIncome')[0].value = '';
		document.getElementsByName('itr7.scheduleEC.totAmtPrevYrCA')[0].value = '';
		
		var tabl = document.getElementById('otherSourceOfFund');
		var allInputTags = tabl.getElementsByTagName('input');

		for ( var i = 0; i < allInputTags.length; i++) {
			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;

			allInputTags[i].value = '';
		}

	}

}


/*
 * function calculateEREC(){
 * 
 * var tempSumEREC =
 * getAmt('itr7.scheduleER.incomeDeemedus111')+getAmt('itr7.scheduleEC.incomeDeemedPrecedingYear');
 * 
 * var tempSumSchI =
 * getAmt('itr7.itrScheduleI.scheduleI[0].amountAppliedDuringYear') +
 * getAmt('itr7.itrScheduleI.scheduleI[1].amountAppliedDuringYear') +
 * getAmt('itr7.itrScheduleI.scheduleI[2].amountAppliedDuringYear') +
 * getAmt('itr7.itrScheduleI.scheduleI[3].amountAppliedDuringYear') +
 * getAmt('itr7.itrScheduleI.scheduleI[4].amountAppliedDuringYear') +
 * getAmt('itr7.itrScheduleI.scheduleI[5].amountAppliedDuringYear') ;
 * 
 * if(tempSumEREC > tempSumSchI){
 * addErrorXHTML(document.getElementsByName('itr7.scheduleER.incomeDeemedus111')[0],'itr7.scheduleER.incomeDeemedus111',true); }
 *  }
 */

function enableSchIESeries(){

	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var returnFiledSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;

	// IE-1
	var tabl = document.getElementById('scheduleIE1');
	var allInputTags = tabl.getElementsByTagName('input');

	for ( var i = 0; i < allInputTags.length; i++) {
		if((exemptClaimed == '21' || exemptClaimed == '23AAA'  || exemptClaimed == '22B' || exemptClaimed == '23B'
			|| exemptClaimed == '23D' || exemptClaimed == '23DA' || exemptClaimed == '23EC' || exemptClaimed == '23ED'
		    || exemptClaimed == '23EE' || exemptClaimed == '29A' || exemptClaimed == '26' || exemptClaimed == '47'
		    || exemptClaimed == '23FB' || exemptClaimed == '2135I') || (returnFiledSec == 'OTH'))  {

			allInputTags[i].disabled = false;
			allInputTags[i].readOnly = false;
		} else {
			allInputTags[i].disabled = true;
			allInputTags[i].readOnly = true;
			allInputTags[i].value = "";
		}
	}

	// IE-2
	if (exemptClaimed == '23A' || exemptClaimed == '24' ) {
		document.getElementsByName('itr7.scheduleIE2.totalReceiptsContribution')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.totalReceiptsContribution')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleIE2.incomeTowardsInstitution')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.incomeTowardsInstitution')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleIE2.accumulationIncome')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.accumulationIncome')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].readOnly = false;
	} else {
		document.getElementsByName('itr7.scheduleIE2.totalReceiptsContribution')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.totalReceiptsContribution')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.totalReceiptsContribution')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.incomeTowardsInstitution')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeTowardsInstitution')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeTowardsInstitution')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.accumulationIncome')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.accumulationIncome')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.accumulationIncome')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].value = "";
		
	}
	if (exemptClaimed == '23A') {
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].value = "";
	}else if(exemptClaimed == '24'){
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].disabled = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].readOnly = false;
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].value = "";
		
	} else {
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].value = "";
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].disabled = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].value = "";
	}
	/*
	 * var tabl = document.getElementById('scheduleIE2'); var allSelectTags =
	 * tabl.getElementsByTagName('select'); var allInputTags =
	 * tabl.getElementsByTagName('input');
	 * 
	 * for ( var i = 0; i < allInputTags.length; i++) { if (exemptClaimed ==
	 * '23A' || exemptClaimed == '24' ) { 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 < allSelectTags.length; i++) { if (exemptClaimed ==
	 * '23A' || exemptClaimed == '24' ) {
	 * 
	 * allSelectTags[i].disabled = false; allSelectTags[i].readOnly = false;
	 *  } else {
	 * 
	 * allSelectTags[i].disabled = true; allSelectTags[i].readOnly = true;
	 * allSelectTags[i].value = ""; } }
	 */
	
	// IE-3
	var tabl = document.getElementById('scheduleIE3');
	var allSelectTags = tabl.getElementsByTagName('select');
	var allInputTags = tabl.getElementsByTagName('input');
	var partBTIexemp23ciiiab=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].value; 
	var partBTIexemp23ciiiac=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].value; 
	for ( var i = 0; i < allInputTags.length; i++) {
		if (exemptClaimed == '23CIIIAB' || exemptClaimed == '23CIIIAC' /*
																		 * ||
																		 * partBTIexemp23ciiiab>0 ||
																		 * partBTIexemp23ciiiac>0
																		 */ ) {
			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 < allSelectTags.length; i++) {
		if (exemptClaimed == '23CIIIAB' || exemptClaimed == '23CIIIAC' /*
																		 * ||
																		 * partBTIexemp23ciiiab>0 ||
																		 * partBTIexemp23ciiiac>0
																		 */ ) {

			allSelectTags[i].disabled = false;
			allSelectTags[i].readOnly = false;

		} else {

			allSelectTags[i].disabled = true;
			allSelectTags[i].readOnly = true;
			allSelectTags[i].value = "";
		}
	}
	if (exemptClaimed == '23CIIIAB' || exemptClaimed == '23CIIIAC'){
		populateIE3ObjInst();
	}
	
	
	
	// IE-4
	var tabl = document.getElementById('scheduleIE4');
	var allSelectTags = tabl.getElementsByTagName('select');
	var allInputTags = tabl.getElementsByTagName('input');
	var partBTIexemp23ciiiad=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].value; 
	var partBTIexemp23ciiiae=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].value; 
	for ( var i = 0; i < allInputTags.length; i++) {
		if (exemptClaimed == '23CIIIAD' || exemptClaimed == '23CIIIAE' /*
																		 * ||
																		 * partBTIexemp23ciiiad>0 ||
																		 * partBTIexemp23ciiiae>0
																		 */ ) {
			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 < allSelectTags.length; i++) {
		if (exemptClaimed == '23CIIIAD' || exemptClaimed == '23CIIIAE' /*
																		 * ||
																		 * partBTIexemp23ciiiad>0 ||
																		 * partBTIexemp23ciiiae>0
																		 */ ) {

			allSelectTags[i].disabled = false;
			allSelectTags[i].readOnly = false;

		} else {

			allSelectTags[i].disabled = true;
			allSelectTags[i].readOnly = true;
			allSelectTags[i].value = "";
		}
	}
	if (exemptClaimed == '23CIIIAD' || exemptClaimed == '23CIIIAE'){
		populateIE4ObjInst();
	}
	populateIE4ObjInst
}

function calculateGrossIncCharge(){
	// 1
	var totalGrossIncomeOS = document.getElementsByName('itr7.scheduleOS.totalIncomeGross')[0];

	

	totalGrossIncomeOS.value = eval(
			parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.dividendGross'),10) // 1a
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.interestGross'),10) // 1b
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.sourceAmount'),10) // 1d
			// + parseInt(coalesceSetRet(amt),10)
		);

}

function calculateIncSpecialRates(){
	// 2
	var totalOSGross = document.getElementsByName('itr7.scheduleOS.totalOSGross')[0];

	/*
	 * var tab1 = document.getElementById('accumalatedBalance'); var noOfRows =
	 * tab1.rows.length; var amt1 = 0;
	 * 
	 * for (var i = 0; i < (noOfRows - 4); i++) { amt1 = parseInt(
	 * zeroOrMore(document
	 * .getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.taxAccumulatedBalRecPF.taxAccmltdBalRecPFDtls[' +
	 * i + '].incomeBenefit')[0].value), 10); }
	 */

	var tab1 = document.getElementById('schduleOsinc');
	var noOfRows = tab1.rows.length;
	var amt2 = 0;

	for (var i = 0; i < (noOfRows - 4); i++) {
		amt2 = parseInt(
				zeroOrMore(document
						.getElementsByName('itr7.scheduleOS.incomeChargableUnderSpc.othersGrossDtls['
								+ i + '].sourceAmount')[0].value), 10);
	}

	var tab1 = document.getElementById('schduleOsincPti');
	var noOfRows = tab1.rows.length;
	var amt3 = 0;

	for (var i = 0; i < (noOfRows - 4); i++) {
		amt3 = parseInt(
				zeroOrMore(document
						.getElementsByName('itr7.scheduleOS.schduleOsincPti.othersGrossDtls['
								+ i + '].sourceAmount')[0].value), 10);
	}

	var tab = document.getElementById('scheduleOsNriIncTaxDtaa');
	var inputs = tab.getElementsByTagName("INPUT");
	var amt4 = 0;
	for(var i=0;i<inputs.length;i++){
		if(inputs[i].name.match('amount$')){
			amt4 = parseInt(zeroOrMore(coalesce(inputs[i].value)), 10);
		}
	}

	// addCGDeductions('scheduleOsNriIncTaxDtaa');

	totalOSGross.value = eval(
			  parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.winningFrmLotteries'),10)	// 2a
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.incChargblSplRateOS.incChargeableUs115BBE'),10) // 2b
			+ parseInt(coalesceSetRet('itr7.scheduleOS.incOthThanOwnRaceHorse.sourceAmount'),10) // 1d
			+ amt2 + amt3 + amt4);
	
}


function addCGDeductions(tableId){
	var tab = document.getElementById(tableId);
	var inputs = tab.getElementsByTagName("INPUT");
	var sum = 0;
	for(var i=0;i<inputs.length;i++){
		if(inputs[i].name.match('amount$')){
			sum = parseInt(sum) + parseInt(coalesce(inputs[i].value));
		}
	}
	return sum;

}

function calculateAdditionalTax(){

	var sec115TD = document.getElementsByName('itr7.schedule115TD.AccIncAsPerSection115TD')[0].value;

	// document.getElementsByName('itr7.schedule115TD.AddIncPayus115TDMagRate')[0].value
	// = Math.round(eval(parseInt(coalesce(sec115TD), 10)) * eval('0.3588'));
	document.getElementsByName('itr7.schedule115TD.AddIncPayus115TDMagRate')[0].value = Math.round(eval(parseInt(coalesce(sec115TD), 10)) * eval('0.3494'));

}

function calcAnyOtherIncome(){
	var tab = document.getElementById('anyOtherIncome');
	var rowcount = tab.rows.length;
	var totalOtherIncome=document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.totalOtherIncome')[0];
	var temp=parseInt('0',10);
	for(var i=0;i<rowcount-4;i++){
		temp = eval(parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.otherIncome['+i+'].anyOtherIncomeAmount')[0].value),10)) + temp;
	}
	var anyOthIncExptUS10 = getAmt('itr7.scheduleOS.incOthThanOwnRaceHorse.anyOtherIncomeExemptUS10');
	totalOtherIncome.value=temp + anyOthIncExptUS10;
}

function validateSchOSDTAA1a1b() {
	// 1a
	var dividendGross = parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.dividendGross')[0].value),10);
	var interestGross = parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.interestGross')[0].value),	10);
	var rentGross = parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs')[0].value),10);
	var incomeGross = parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.sourceAmount')[0].value),10);

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

	var dividendGrossTot = parseInt('0', 10);
	var interestGrossTot = parseInt('0', 10);
	var rentGrossTot = parseInt('0', 10);
	var incomeGrossTot = parseInt('0', 10);

	for (var k = 0; k < rowCount; k++) {
		if (document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+k+ '].itemIncluded')[0].value == '56i') {

			dividendGrossTot = eval(dividendGrossTot 
					+ parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value), 10));

			if (eval(dividendGrossTot > dividendGross)) {
				if (document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value != '') {

					document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value = 0;

					addErrorXHTML(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0],
							'For Dividend - The sum of amount should not exceed amount entered in 1a.',	true);
					j.setFieldError('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount',
					'For Dividend - The sum of amount should not exceed amount entered in 1a.');
				}
			}
		} else if (document	.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].itemIncluded')[0].value == '56') {

			interestGrossTot = eval(interestGrossTot 
					+ parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value), 10));

			if (eval(interestGrossTot > interestGross)) {

				if (document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value != '') {

					document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value = 0;

					addErrorXHTML(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0],
							'For Interest - The sum of amount should not exceed amount entered in 1b.',true);

					j.setFieldError('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount',
					'For Interest - The sum of amount should not exceed amount entered in 1b.');
				}
			}
		}
		else if (document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].itemIncluded')[0].value == '562iii') {

			rentGrossTot = eval(rentGrossTot
					+ parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value), 10));

			if (eval(rentGrossTot > rentGross)) {

				if (document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value != '') {

					document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value = 0;

					addErrorXHTML(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0],
							'The sum of amount should not exceed amount entered in 1c.',true);
					j.setFieldError('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount',
					'The sum of amount should not exceed amount entered in 1c.');
				}
			}
		}
		else if (document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].itemIncluded')[0].value == '562x') {
			incomeGrossTot = eval(incomeGrossTot
					+ parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value), 10));

			if (eval(incomeGrossTot > incomeGross)) {

				if (document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value != '') {

					document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0].value = 0;

					addErrorXHTML(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount')[0],
							'The sum of amount should not exceed amount entered in 1d.',true);
					j.setFieldError('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ k + '].amount',
					'The sum of amount should not exceed amount entered in 1d.');
				}
			}
		}
	}

}



function schSIChangeIncome(B1eRemain,A1eRemain,B2d1Remain,B2d2Remain,B3bRemain,A5aRemain,B3aRemain,stcgIncOfCurYrAfterSetOff,ltcgIncOfCurYrAfterSetOff,called) {
	
	var splRateInc1A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateInc')[0];
	splRateInc1A.value = document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')[0].value;
	var splRateInc22 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[1].splRateInc')[0];
	splRateInc1A.value = document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')[0].value;
	var splRateInc2A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateInc')[0];
	splRateInc1A.value = document.getElementsByName('itr7.scheduleCG.shortTermCapGain.otherAsset111AApplicable.balCG')[0].value;
	
	
	var splRateInc1A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateInc')[0]; splRateInc1A.value = coalesce(splRateInc1A.value);
	var splRateInc22 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[1].splRateInc')[0]; splRateInc22.value = coalesce(splRateInc22.value);
	var splRateInc2A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateInc')[0]; splRateInc22.value = coalesce(splRateInc22.value);
	
	
	var splRateInc21 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[2].splRateInc')[0]; splRateInc21.value = coalesce(splRateInc21.value);

	var splRateInc11 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].splRateInc')[0]; splRateInc11.value = coalesce(splRateInc11.value);
	var splRateInc12 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].splRateInc')[0]; splRateInc12.value = coalesce(splRateInc12.value);
	var splRateInc13 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].splRateInc')[0]; splRateInc13.value = coalesce(splRateInc13.value);

	// var exemptionUs111A =
	// coalesce(document.getElementsByName('itr7.scheduleCG.shortTermCapGain.exemptionUs111A')[0].value);
	 // splRateInc1A.readOnly=true;
	/*
	 * if((splRateInc1A.old1 != A1eRemain || splRateInc1A.old2 !=
	 * exemptionUs111A) && (splRateInc1A.changed!=true|| exemptionUs111A==0)){
	 * splRateInc1A.old1 = zeroOrMore(A1eRemain); splRateInc1A.old2 =
	 * exemptionUs111A; splRateInc1A.value = zeroOrMore(A1eRemain);
	 * splRateInc1A.changed=false; } splRateInc22.value=zeroOrMore(B2eRemain);
	 * splRateInc21.value=zeroOrMore(B1eRemain);
	 */

	// Internal CYLA cals
	var stcgRem = stcgIncOfCurYrAfterSetOff.value;
	var ltcgRem = ltcgIncOfCurYrAfterSetOff.value;
	if(eval(parseInt(A1eRemain), 10)  >= stcgRem){
		A1eRemain = zeroOrMore(stcgRem) ;
	}else{
		A1eRemain = zeroOrMore(A1eRemain);
	}
	stcgRem = stcgRem - A1eRemain;

	if(eval(parseInt(A5aRemain), 10) >= stcgRem){
		A5aRemain = zeroOrMore(stcgRem) ;
	}else{
		A5aRemain = zeroOrMore(A5aRemain);
	}


	/*if(eval(parseInt(B2eRemain), 10) >= ltcgRem){
		B2eRemain = zeroOrMore(ltcgRem) ;
	}else{
		B2eRemain = zeroOrMore(B2eRemain);
	}
	ltcgRem = ltcgRem - B2eRemain;*/
	if(eval(parseInt(B2d1Remain), 10) >= ltcgRem){
		B2d1Remain = zeroOrMore(ltcgRem) ;
	}else{
		B2d1Remain = zeroOrMore(B2d1Remain);
	}
	ltcgRem = ltcgRem - B2d1Remain;
	if(eval(parseInt(B2d2Remain), 10) >= ltcgRem){
		B2d2Remain = zeroOrMore(ltcgRem) ;
	}else{
		B2d2Remain = zeroOrMore(B2d2Remain);
	}
	ltcgRem = ltcgRem - B2d2Remain;

	if(eval(parseInt(B3aRemain), 10)  >= ltcgRem){
		B3aRemain = zeroOrMore(ltcgRem) ;
	}else{
		B3aRemain = zeroOrMore(B3aRemain);
	}
	ltcgRem = ltcgRem - B3aRemain;

	if(eval(parseInt(B1eRemain), 10) >= ltcgRem){
		B1eRemain = zeroOrMore(ltcgRem) ;
	}else{
		B1eRemain = zeroOrMore(B1eRemain);
	}

	ltcgRem = ltcgRem - B1eRemain;


	if(eval(parseInt(B3bRemain), 10) >= ltcgRem){
		B3bRemain = zeroOrMore(ltcgRem) ;
	}else{
		B3bRemain = zeroOrMore(B3bRemain);
	}

	splRateInc11.value=zeroOrMore(A5aRemain);
	var splRateIncTax11 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[9].splRateIncTax')[0]; splRateIncTax11.value = coalesce(splRateIncTax11.value);
	splRateIncTax11.value = Math.round((15*eval(parseInt(splRateInc11.value,10)))/parseInt('100' ,10));

	splRateInc12.value=zeroOrMore(B3aRemain);
	var splRateIncTax12 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[10].splRateIncTax')[0]; splRateIncTax12.value = coalesce(splRateIncTax12.value);
	splRateIncTax12.value = Math.round((10*eval(parseInt(splRateInc12.value,10)))/parseInt('100' ,10));

	splRateInc13.value=zeroOrMore(B3bRemain);
	var splRateIncTax13 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[11].splRateIncTax')[0]; splRateIncTax13.value = coalesce(splRateIncTax13.value);
	splRateIncTax13.value = Math.round((20*eval(parseInt(splRateInc13.value,10)))/parseInt('100' ,10));

	splRateInc21.value=zeroOrMore(B1eRemain);
	var splRateIncTax21 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[2].splRateIncTax')[0]; splRateIncTax21.value = coalesce(splRateIncTax21.value);
	splRateIncTax21.value = Math.round((20*eval(parseInt(splRateInc21.value,10)))/parseInt('100' ,10));

	splRateInc1A.value=zeroOrMore(A1eRemain);
	var splRateIncTax1A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[0].splRateIncTax')[0]; splRateIncTax1A.value = coalesce(splRateIncTax1A.value);
	splRateIncTax1A.value = Math.round((15*eval(parseInt(splRateInc1A.value,10)))/parseInt('100' ,10));

	splRateInc22.value=zeroOrMore(B2d1Remain);
	var splRateIncTax22 = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[1].splRateIncTax')[0]; splRateIncTax22.value = coalesce(splRateIncTax22.value);
	splRateIncTax22.value = Math.round((10*eval(parseInt(splRateInc22.value,10)))/parseInt('100' ,10));
	
	splRateInc2A.value=zeroOrMore(B2d2Remain);
	var splRateIncTax2A = document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateIncTax')[0]; splRateIncTax2A.value = coalesce(splRateIncTax2A.value);
	splRateIncTax2A.value = Math.round((10*eval(parseInt(splRateInc2A.value,10)))/parseInt('100' ,10));
        
	scheduleSiIncome('scheduleSI');
        if(called!='titti') {
        	calculateTiTti('scheduleSI');
        }
}


function loadExemptSecsOnLoad(){

	var returnFurnishedSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0];
	var returnFurnishedSec1 = returnFurnishedSec.value;

	var secUnderExemptionClaimed = document.getElementsByName("itr7.partAGEN1.filingStatus.secUnderExemptionClaimed")[0];
	var secUnderExemptionClaimed1 = secUnderExemptionClaimed.value;


	if(returnFurnishedSec1 == '139-4A'){

		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1] = new Option('Section 11','11');

	}else if(returnFurnishedSec1 == '139-4B'){
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1] = new Option('Section 13A','13A');
		secUnderExemptionClaimed.options[2] = new Option('Section 13B','13B');

	}else if(returnFurnishedSec1 == '139-4D'){
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1]  = new Option('Section 10(21) read with section 35(1)','2135I');

	}else if(returnFurnishedSec1 == '139-4C'){
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1]  = new Option('Section 10(21)','21');
		secUnderExemptionClaimed.options[2]  = new Option('Section 10(22B)','22B');
		secUnderExemptionClaimed.options[3]  = new Option('Section 10(23A)','23A');
		secUnderExemptionClaimed.options[4]  = new Option('Section 10(23B)','23B');
		secUnderExemptionClaimed.options[5]  = new Option('Section 10(23C)(iiiab)','23CIIIAB');
		secUnderExemptionClaimed.options[6]  = new Option('Section 10(23C)(iiiac)','23CIIIAC');
		secUnderExemptionClaimed.options[7]  = new Option('Section 10(23C)(iiiad)','23CIIIAD');
		secUnderExemptionClaimed.options[8]  = new Option('Section 10(23C)(iiiae)','23CIIIAE');
		secUnderExemptionClaimed.options[9]  = new Option('Section 10(23C)(iv)','23CIV');
		secUnderExemptionClaimed.options[10] = new Option('Section 10(23C)(v)','23CV');
		secUnderExemptionClaimed.options[11] = new Option('Section 10(23C)(vi)','23CVI');
		secUnderExemptionClaimed.options[12] = new Option('Section 10(23C)(via)','23CVIA');
		secUnderExemptionClaimed.options[13] = new Option('Section 10(23D)','23D');
		secUnderExemptionClaimed.options[14] = new Option('Section 10(23DA)','23DA');
		secUnderExemptionClaimed.options[15] = new Option('Section 10(23FB)','23FB');
		secUnderExemptionClaimed.options[16] = new Option('Section 10(24)','24');
		secUnderExemptionClaimed.options[17] = new Option('Section 10(46)','26');
		secUnderExemptionClaimed.options[18] = new Option('Section 10(47)','47');
		secUnderExemptionClaimed.options[19] = new Option('Section 10(23AAA)','23AAA');
		secUnderExemptionClaimed.options[20] = new Option('Section 10(23EC)','23EC');
		secUnderExemptionClaimed.options[21] = new Option('Section 10(23ED)','23ED');
		secUnderExemptionClaimed.options[22] = new Option('Section 10(23EE)','23EE');
		secUnderExemptionClaimed.options[23] = new Option('Section 10(29A)','29A');

	}else if(returnFurnishedSec1 == 'OTH'){
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		secUnderExemptionClaimed.options[0] = new Option('Select','-1');
		secUnderExemptionClaimed.options[1]  = new Option('Section 10(20)','20');
		secUnderExemptionClaimed.options[2]  = new Option('Section 10(23AA)','23AA');
		secUnderExemptionClaimed.options[3]  = new Option('Section 10(23AAB)','23AAB');
		secUnderExemptionClaimed.options[4]  = new Option('Section 10(23BB)','23BB');
		secUnderExemptionClaimed.options[5]  = new Option('Section 10(23BBA)','23BBA');
		secUnderExemptionClaimed.options[6]  = new Option('Section 10(23BBC)','23BBC');
		secUnderExemptionClaimed.options[7]  = new Option('Section 10(23BBE)','23BBE');
		secUnderExemptionClaimed.options[8]  = new Option('Section 10(23BBG)','23BBG');
		secUnderExemptionClaimed.options[9]  = new Option('Section 10(23BBH)','23BBH');
		secUnderExemptionClaimed.options[10] = new Option('Section 10(23C)(i)','23CI');
		secUnderExemptionClaimed.options[11] = new Option('Section 10(23C)(ii)','23CII');
		secUnderExemptionClaimed.options[12] = new Option('Section 10(23C)(iii)','23CIII');
		secUnderExemptionClaimed.options[13] = new Option('Section 10(23C)(iiia)','23CIIIA');
		secUnderExemptionClaimed.options[14] = new Option('Section 10(23C)(iiiaa)','23CIIIAA');
		secUnderExemptionClaimed.options[15] = new Option('Section 10(23C)(iiiaaa)','23CIIIAAA');
		secUnderExemptionClaimed.options[15] = new Option('Section 10(23C)(iiiaaaa)','23CIIIAAAA');
		secUnderExemptionClaimed.options[16] = new Option('Section 10(25)(i)','25I');
		secUnderExemptionClaimed.options[17] = new Option('Section 10(25)(ii)','25II');
		secUnderExemptionClaimed.options[18] = new Option('Section 10(25)(iii)','25III');
		secUnderExemptionClaimed.options[19] = new Option('Section 10(25)(iv)','25IV');
		secUnderExemptionClaimed.options[20] = new Option('Section 10(25)(v)','25V');
		secUnderExemptionClaimed.options[21] = new Option('Section 10(25A)','25A');
		secUnderExemptionClaimed.options[22] = new Option('Section 10(26AAB)','26AAB');
		secUnderExemptionClaimed.options[23] = new Option('Section 10(26B)','26B');
		secUnderExemptionClaimed.options[24] = new Option('Section 10(26BB)','26BB');
		secUnderExemptionClaimed.options[25] = new Option('Section 10(26BBB)','26BBB');
		secUnderExemptionClaimed.options[26] = new Option('Section 10(44)','44');

	}else{
		for(var i=0;secUnderExemptionClaimed.options.length > 0;i++){
			secUnderExemptionClaimed.options.remove(0);
		}
		secUnderExemptionClaimed.options[0] = new Option('Select','');

	}
	secUnderExemptionClaimed.value= secUnderExemptionClaimed1;


}

function enableProjDtls(){
	try{
		enableTableProjDetails('itr7.partAGEN1.orgFirmInfo.address.projectinstitute', 'Y', 'projDetails');


		enableField('itr7.partAGEN1.orgFirmInfo.address.projectinstitute','Y','itr7.partAGEN1.projectOrInstDtls[0].nameOfProjectOrInst');
		enableField('itr7.partAGEN1.orgFirmInfo.address.projectinstitute','Y','itr7.partAGEN1.projectOrInstDtls[0].activityNature');
		enableField('itr7.partAGEN1.orgFirmInfo.address.projectinstitute','Y','itr7.partAGEN1.projectOrInstDtls[0].classificationCode');

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

// To enable tables for Project Details
function enableTableProjDetails(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);
	}
}

function enableFirmDtls(){

	try{
		enableTableProjDetails('itr7.partAGEN1.filingStatus.firmPartnerFlag', 'Y', 'firmPartner');


		enableField('itr7.partAGEN1.filingStatus.firmPartnerFlag','Y','itr7.partAGEN1.filingStatus.firmPartner[0].firmName');
		enableField('itr7.partAGEN1.filingStatus.firmPartnerFlag','Y','itr7.partAGEN1.filingStatus.firmPartner[0].pAN');

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

}


function enableOtherAct(){
	var partaoth = document.getElementById('othIncTaxActTab');

	var noOfRows = partaoth.rows.length;


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

		var nature = document.getElementsByName('itr7.partAGEN2.othIncTaxAct[' + i + '].act')[0].value;

		console.log('naturenature '+nature);

		if (nature == 'OTH') {
			document.getElementsByName('itr7.partAGEN2.othIncTaxAct['+i+'].auditReportActOthers')[0].disabled = false;
			document.getElementsByName('itr7.partAGEN2.othIncTaxAct['+i+'].auditReportActOthers')[0].readOnly = false;

		} 
		else {
			document.getElementsByName('itr7.partAGEN2.othIncTaxAct['+i+'].auditReportActOthers')[0].disabled =
				true;
			document.getElementsByName('itr7.partAGEN2.othIncTaxAct['+i+'].auditReportActOthers')[0].readOnly =
				true;

			document.getElementsByName('itr7.partAGEN2.othIncTaxAct['+i+'].auditReportActOthers')[0].value =
				''; }
			 
	}
}

function validatePriceShare(){
	try{
	var table = document.getElementById('unlistedEquityShares');
	var noOfRows = table.rows.length;
	for(var i=0;i<noOfRows-3;i++){
		var value = document.getElementsByName('itr7.partAGEN1.unlistedEquityShares['+i+'].purchasePriceShare')[0];
		var PriceShareName = value.name;
		var prefixValue = value.name.substring(0,value.name.lastIndexOf("."));
		var priceShareNameVal=parseInt(coalesce(document.getElementsByName(PriceShareName)[0].value));
		var issuePurcharseVal=parseInt(coalesce(document.getElementsByName(prefixValue+'.issuePriceShare')[0].value));
		if(priceShareNameVal>0&&issuePurcharseVal>0){
			j.setFieldError(document.getElementsByName(prefixValue+'.issuePriceShare')[0],'Please enter details of Issue Price & Purchase Price in separate Rows');
			addErrorXHTML('','Please enter details of Issue Price & Purchase Price in separate Rows',true);
		}
	}

	}catch(e){
		alert('error in func:validatePriceShare '+e);
	}
}

function calculateSchSI(){

	document.getElementsByName('itr7.partBTI.tiAdditions.incChargeableUs113')[0].value=getAmt('itr7.itrScheduleI.totAmountDeemedUs11');
}

function populateRateOS()
{
	var residentialSatus=document.getElementsByName('itr7.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('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ i +'].rateOfTax')[0].value);

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

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

	}

}

function enableShareTypeOthInSH(){
	var tableB1 = document.getElementById('scheduleSH1B');
	var rowCountB1 = tableB1.rows.length;
	var totRowB1= rowCountB1 - 3;

	for (var i = 0; i < totRowB1; i++) {
		if(document.getElementsByName('itr7.scheduleSH1B.equityShareDetails['+i+'].typeofShare')[0].value=='OT')
		{
				document.getElementsByName('itr7.scheduleSH1B.equityShareDetails['+i+'].shareTypeOthers')[0].disabled=false;
		}
		else
		{
			document.getElementsByName('itr7.scheduleSH1B.equityShareDetails['+i+'].shareTypeOthers')[0].value='';
			document.getElementsByName('itr7.scheduleSH1B.equityShareDetails['+i+'].shareTypeOthers')[0].disabled=true;
		}
		}
}

function fillSchI(){


	var tabl = document.getElementById('scheduleI');
	var allInputTags = tabl.getElementsByTagName('input');

	//for(i=0; i<allInputTags.length; i++) {
		/*if(document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAccumlated')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[0].accumulationPurpose')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAppliedPreviousYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountAppliedDuringYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountDeemedUs11')[0].value.length>1){

			document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountInvested')[0].value='0';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[0].accumlatedYear')[0].value='2014';
		}else{
			document.getElementsByName('itr7.itrScheduleI.scheduleI[0].accumlatedYear')[0].value='2014';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[0].amountInvested')[0].value='';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[0].balanceAmount')[0].value='';
		}

		if(document.getElementsByName('itr7.itrScheduleI.scheduleI[1].amountAccumlated')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[1].accumulationPurpose')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[1].amountAppliedPreviousYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[1].amountAppliedDuringYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[1].amountDeemedUs11')[0].value.length>1){

			document.getElementsByName('itr7.itrScheduleI.scheduleI[1].amountInvested')[0].value='0';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[1].accumlatedYear')[0].value='2015';

		}else{
			document.getElementsByName('itr7.itrScheduleI.scheduleI[1].accumlatedYear')[0].value='2015';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[1].amountInvested')[0].value='';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[1].balanceAmount')[0].value='';
		}


		if(document.getElementsByName('itr7.itrScheduleI.scheduleI[2].amountAccumlated')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[2].accumulationPurpose')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[2].amountAppliedPreviousYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[2].amountAppliedDuringYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[2].amountDeemedUs11')[0].value.length>1){

			document.getElementsByName('itr7.itrScheduleI.scheduleI[2].amountInvested')[0].value='0';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[2].accumlatedYear')[0].value='2016';

		}else{
			document.getElementsByName('itr7.itrScheduleI.scheduleI[2].accumlatedYear')[0].value='2016';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[2].amountInvested')[0].value='';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[2].balanceAmount')[0].value='';
		}

		if(document.getElementsByName('itr7.itrScheduleI.scheduleI[3].amountAccumlated')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[3].accumulationPurpose')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[3].amountAppliedPreviousYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[3].amountAppliedDuringYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[3].amountDeemedUs11')[0].value.length>1){

			document.getElementsByName('itr7.itrScheduleI.scheduleI[3].amountInvested')[0].value='0';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[3].accumlatedYear')[0].value='2017';
		}else{
			document.getElementsByName('itr7.itrScheduleI.scheduleI[3].accumlatedYear')[0].value='2017';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[3].amountInvested')[0].value='';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[3].balanceAmount')[0].value='';
		}

		if(document.getElementsByName('itr7.itrScheduleI.scheduleI[4].amountAccumlated')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[4].accumulationPurpose')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[4].amountAppliedPreviousYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[4].amountAppliedDuringYear')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[4].amountDeemedUs11')[0].value.length>1){

			document.getElementsByName('itr7.itrScheduleI.scheduleI[4].amountInvested')[0].value='0';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[4].accumlatedYear')[0].value='2018';
		}else{
			document.getElementsByName('itr7.itrScheduleI.scheduleI[4].amountInvested')[0].value='';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[4].accumlatedYear')[0].value='2018';
			document.getElementsByName('itr7.itrScheduleI.scheduleI[4].balanceAmount')[0].value='';
		}*/

		if(document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountAccumlated')[0].value.length > 0
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[6].accumulationPurpose')[0].value.length>1
				|| document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountInvested')[0].value.length > 0){

		document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountAppliedPreviousYear')[0].value='0';
		document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountAppliedDuringYear')[0].value='0';
		document.getElementsByName('itr7.itrScheduleI.scheduleI[6].accumlatedYear')[0].value='2019';
	}else{
		document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountAppliedPreviousYear')[0].value='';
		document.getElementsByName('itr7.itrScheduleI.scheduleI[6].amountAppliedDuringYear')[0].value='';
		document.getElementsByName('itr7.itrScheduleI.scheduleI[6].balanceAmount')[0].value='';
		document.getElementsByName('itr7.itrScheduleI.scheduleI[6].accumlatedYear')[0].value='2019';
	}
	//}
}


function enableDirecComp(){
	var unlistedShares = document.getElementsByName('itr7.partAGEN1.filingStatus.unlistedEquitySharesFlag')[0].value;

	 if(unlistedShares == "Y"){
		  enableTable('itr7.partAGEN1.filingStatus.unlistedEquitySharesFlag',
				  'Y', 'unlistedEquityShares');
	  }else{
		  var tabId = "#" + "unlistedEquityShares";
			$(tabId).find('[type=\"checkbox\"]').attr('checked', 'checked');
			deleteRowTable('unlistedEquityShares', 2, 1);
			$(tabId).find(':input').prop('disabled', true);
			$(tabId).find('.addbtn').prop('hidden', true);
	  }


	 var unlistedShares = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.projectinstitute')[0].value;

	 if(unlistedShares == "Y"){
		  enableTable('itr7.partAGEN1.orgFirmInfo.address.projectinstitute',
				  'Y', 'projDetails');
	  }else{
		  var tabId = "#" + "projDetails";
			$(tabId).find('[type=\"checkbox\"]').attr('checked', 'checked');
			deleteRowTable('projDetails', 1, 1);
			$(tabId).find(':input').prop('disabled', true);
			$(tabId).find('.addbtn').prop('hidden', true);
	  }
}

/*
 * function validateSI(){
 * 
 * if(coalesceSetRet('itr7.scheduleSI.splCodeRateTax[3].splRateInc')<=parseInt('0',10)){
 * j.setFieldError('itr7.scheduleSI.splCodeRateTax[3].splRateInc','Please enter
 * Tax thereon');
 * addErrorXHTML(document.getElementsByName('itr7.scheduleSI.splCodeRateTax[3].splRateInc')[0],'Please
 * enter Income at 4 th point',true); } }
 */

function validateSchVC(){

	var exemptionClaimed = document.getElementsByName("itr7.partAGEN1.filingStatus.secUnderExemptionClaimed")[0].value;

	if((exemptionClaimed == '23CIIIAB' || exemptionClaimed == '23CIIIAC') && coalesceSetRet('itr7.scheduleVC.local.otherThanCorpusFund.grantsReceivedFormGovt')<parseInt('1',10)){
		j.setFieldError('itr7.scheduleVC.local.otherThanCorpusFund.grantsReceivedFormGovt','Please enter the amount in Sch VC, Government of Grants');
		addErrorXHTML(document.getElementsByName('itr7.scheduleVC.local.otherThanCorpusFund.grantsReceivedFormGovt')[0],'Please enter the amount in Sch VC, Government of Grants',true);
	}
}

function disableOldFields(){
	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.regUnSEBI')[0].disabled = true;
	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.regUnSEBI')[0].readOnly = true;
	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.regUnSEBI')[0].value = "";

	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.registrationNo')[0].disabled = true;
	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.registrationNo')[0].readOnly = true;
	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.registrationNo')[0].value = "";

	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.dateOfRegistration')[0].disabled = true;
	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.dateOfRegistration')[0].readOnly = true;
	document.getElementsByName('itr7.partAGEN2.otherDetailsFor7.otherDetailsSEBI.dateOfRegistration')[0].value = "";
}

function validateOSd(){
	var tab = document.getElementById('schduleOsincPti');
	var selects = tab.getElementsByTagName("SELECT");

	var arr = new Array();
	for(var i=0;i<selects.length;i++){
		if(selects[i].name.match('sourceDescription') && selects[i].value!=''){
			if(arr.indexOf(selects[i].value)==-1){
				arr.push(selects[i].value);
			}else if(selects[i].value!='Others'){
				var msg = 'Drop down has already been selected in table 2d of schedule OS.' || 'Drop down has already been selected in table 2d of schedule OS.';
				j.setFieldError(selects[i].name, msg);
				addErrorXHTML(selects[i], msg ,true);
			}
		}
	}
}
function validateOSc(){
	var tab = document.getElementById('schduleOsinc');
	var selects = tab.getElementsByTagName("SELECT");
	var arr = new Array();
	for(var i=0;i<selects.length;i++){
		if(selects[i].name.match('sourceDescription') && selects[i].value!=''){
			if(arr.indexOf(selects[i].value)==-1){
				arr.push(selects[i].value);
			}else if(selects[i].value!='Others'){
				var msg = 'Drop down has already been selected in table 2c of schedule OS.' || 'Drop down has already been selected in table 2c of schedule OS.';
				j.setFieldError(selects[i].name, msg);
				addErrorXHTML(selects[i], msg ,true);
			}
		}
	}
}
function enableTIValues(){

	
	var tab = document.getElementById('rejApprovalDtls');
	var len = tab.rows.length-2;
	var flag = true;
	var secReg='';
	for(var i = 0; i < len; i++) {
		var secRegApproved=document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration')[0].value;

		if(secRegApproved == 'I')
		{
			secReg = 'I';
			flag = true;
			break;
		}
		else if(secRegApproved == 'II' || secRegApproved == 'III' || secRegApproved == 'IV' || secRegApproved == 'V' || secRegApproved == 'VI' || secRegApproved == 'VII' ||  secRegApproved == "VIII")
			{
			flag=false;
			}
	}	
		if(flag){
			document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].readOnly = false;

			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].readOnly = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].readOnly = false;

			document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].disabled = false;
			document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].readOnly = false;
			
			if(secReg == '')
				{
				document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].value = '';
				document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].value = '';
				
				}
			
		}else{
			document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].value = '';

			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].value = '';

			document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].value = '';
			document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].disabled = true;
			document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].readOnly = true;
			document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].value = '';

		}



	calculateTiTti();
}
function enableGrossAmtTDS2()
{

	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+'].taxDeductCreditDtls.taxCreditedOwnHands')[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;
			}

	}
	calcTotalTDS2();
}


function enableGrossAmtTDS3()
{

	var tdsTable = document.getElementById('scheduleTDS3');
	var noOfRows = tdsTable.rows.length;

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

		if(parseInt(document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['+i+'].taxDeductCreditDtls.taxCreditedOwnHands')[0].value)==0)
			{
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['+i+'].grossAmount')[0].value = '';
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['+i+'].headOfIncome')[0].value = '';
				document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['+i+'].grossAmount')[0].disabled = true;
				document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['+i+'].headOfIncome')[0].disabled = true;
			}
		else
			{
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['+i+'].grossAmount')[0].disabled = false;
			document.getElementsByName('scheduleTDS3.tDS3onOthThanSal['+i+'].headOfIncome')[0].disabled = false;
			}


	}
	calcTotalTDS3();
}

function validateOSPoint8a8b()
{
	var receipts = parseInt(document.getElementsByName('itr7.scheduleOS.incFromOwnHorse.receipts')[0].value);
	var deductSec57 = parseInt(document.getElementsByName('itr7.scheduleOS.incFromOwnHorse.deductSec57')[0].value);

	if(deductSec57>0 && receipts<=0)
		{
		j.setFieldError('itr7.scheduleOS.incFromOwnHorse.deductSec57','To claim deduction u/s 57 in point 8b, receipts in point 8a should be more than Zero in schedule OS');
		addErrorXHTML('itr7.scheduleOS.incFromOwnHorse.deductSec57','To claim deduction u/s 57 in point 8b, receipts in point 8a should be more than Zero in schedule OS');

		}

}
function calculateSITotal()
{
	var totSplRateInc =0;
	var totSplRateIncTax =0;
	var noofRows = document.getElementById('scheduleSI').rows.length;
	
	for(var i=0; i<(noofRows-3);i++){
		
		totSplRateInc = totSplRateInc + getAmt('itr7.scheduleSI.splCodeRateTax['+i+'].splRateInc');
		totSplRateIncTax = totSplRateIncTax + getAmt('itr7.scheduleSI.splCodeRateTax['+i+'].splRateIncTax')
	}
	document.getElementsByName('itr7.scheduleSI.totSplRateInc')[0].value = zeroOrMore(totSplRateInc);
	document.getElementsByName('itr7.scheduleSI.totSplRateIncTax')[0].value = zeroOrMore(totSplRateIncTax);
}

function validateHPLetOut() {

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

	for (var i = 0; i < totHp; i++) {
		var localTaxes = coalesceSetRet('itr7.scheduleHP.propertyDetails[' + i
				+ '].rentdetails.localTaxes');
		var annualLetableValue = coalesceSetRet('itr7.scheduleHP.propertyDetails['
				+ i + '].rentdetails.annualLetableValue');
		if (annualLetableValue < localTaxes && annualLetableValue == 0) {
			addErrorXHTML(
					'',
					'Tax paid to local authorities can be claimed only if income from house property is declared.');

			j
					.setFieldError(
							'itr7.scheduleHP.propertyDetails[' + i
									+ '].rentdetails.localTaxes',
							'Tax paid to local authorities can be claimed only if income from house property is declared.');

		}
	}
}

function setOffOthSrcLossCYLA(valCG,ltcg20per)
{
	var A2eA3A4A5bRemain = valCG;
	var amtSetOff = 0;

	if(ltcg20per < 0)
	{
		amtSetOff = setOffAgainststcgApp(parseInt(A2eA3A4A5bRemain, 10),ltcg20per);
	}

}

function setOffAgainststcgApp(value,ltcg20per){

	var amtSetOff = 0;

	if(parseInt(ltcg20per, 10) < 0 && parseInt(value, 10) > 0){

		if(parseInt(value, 10) >= Math.abs(parseInt(ltcg20per, 10))){
			value = eval( parseInt(value, 10) + parseInt(ltcg20per, 10));
			amtSetOff = Math.abs(parseInt(ltcg20per, 10));

		}else{
			amtSetOff = Math.abs(parseInt(value, 10));
			value = 0;
		}
	}

	return amtSetOff;
}

// To enable/disable tables based on the value for NRI's
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);
	}
}

function systemDateCompOfDOF(){
	
	var date = document.getElementsByName('itr7.partAGEN1.filingStatus.origRetFiledDate')[0].value;
	if (date!=getCurrentDate() && checkFirstDateBefore(getCurrentDate(), date)) {
		j.setFieldError('itr7.partAGEN1.filingStatus.origRetFiledDate','Filing Date can not be more than System Date.');
		addErrorXHTML( document.getElementsByName('itr7.partAGEN1.filingStatus.origRetFiledDate')[0],
				'Filing Date cannot be more than System Date.',	true);
	}
	
}

function systemDateCompOfDateOfAdv(){
	
	var date = document.getElementsByName('itr7.partAGEN1.filingStatus.noticeDateUnderSec')[0].value;
	if (date!=getCurrentDate() && checkFirstDateBefore(getCurrentDate(), date)) {
		j.setFieldError('itr7.partAGEN1.filingStatus.noticeDateUnderSec','Date of such notice/order or u/s 92CD enter date of advance pricing agreement can not be more than System Date.');
		addErrorXHTML( document.getElementsByName('itr7.partAGEN1.filingStatus.noticeDateUnderSec')[0],
				'Date of such notice/order or u/s 92CD enter date of advance pricing agreement cannot be more than System Date.',	true);
	}
}
function mandateScheduleIE()
{
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var partBTIexemp23ciiiab=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].value; 
	var partBTIexemp23ciiiac=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].value; 
	if (exemptClaimed == '23CIIIAB' || exemptClaimed == '23CIIIAC' || partBTIexemp23ciiiab>0 || partBTIexemp23ciiiac>0) {
		var schIE3 = checkRowBlank('scheduleIE3', 2, 1);
		if(schIE3)
		{
			j.setFieldError('itr7.scheduleIE3.incomeExpenditureStmt3ABC[0].objectiveInstitution','Please select objective in Schedule IE-3.');
			addErrorXHTML('','Please select objective in Schedule IE-3.',true);
		}
	}

	var partBTIexemp23ciiiad=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].value; 
	var partBTIexemp23ciiiae=document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].value; 
	if (exemptClaimed == '23CIIIAD' || exemptClaimed == '23CIIIAE' || partBTIexemp23ciiiad>0 || partBTIexemp23ciiiae>0) {
		var schIE4 = checkRowBlank('scheduleIE4', 2, 1);
		if(schIE4)
		{
			j.setFieldError('itr7.scheduleIE4.incomeExpenditureStmt3ADE[0].objective','Please select objective in Schedule IE-4.');
			addErrorXHTML('','Please select objective in Schedule IE-4.',true);
		}
	}
}

// Asst yr 2020-21 changes
// To add Row To scheudle CG
function addRowToCG(tableId) {
	try{
	var tab = document.getElementById(tableId);
	var len = tab.tBodies.length;
	if(len > 1)
	{
		return;
	}
	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 (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 (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);
	}
	if($('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[0].asstProvisoUndrSec112"]')[0].value == "Y"){
		$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="Y"]').remove();
	}
	if($('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[0].asstProvisoUndrSec112"]')[0].value == "N"){
		$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="N"]').remove();
	}
		
}
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 addRowToCGOnimportItr7(tableId) {
	try{
	var tab = document.getElementById(tableId);
	var len = tab.tBodies.length;
	if(len > 1)
	{
		return;
	}
	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 (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 (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);
	}
	if($('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[0].asstProvisoUndrSec112"]')[0].value == "Y"){
		$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="Y"]').remove();
	}
	if($('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[0].asstProvisoUndrSec112"]')[0].value == "N"){
		$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="N"]').remove();
	}
		
}
function enableRegSec(){
	try{
		var statusCompany=document.getElementsByName('itr7.partAGEN1.orgFirmInfo.statusOrCompanyType')[0];
		var statusCompany1 = statusCompany.value;
		
		var sub = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0];
		var sub1 = sub.value;
		if(statusCompany1 == '5' && sub1 == '5vii'){	
			var tab = document.getElementById('rejApprovalDtls');
			var len = tab.tBodies.length;
			var body = tab.tBodies[0];
			var inputs = body.getElementsByTagName('TR');
			
			for (var i = 0; i < (inputs.length - 2); i++) {
				var regSection = document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration')[0];
				var regSection1 = regSection.value;
				for(var j=0;regSection.options.length > 0;j++){
					regSection.options.remove(0);
				}
				regSection.options[0] = new Option('Select','');
				regSection.options[1] = new Option('Section 10(23AAA)','I');
				regSection.options[2] = new Option('Section 13B','VIII');
				regSection.options[3] = new Option('Section 35','IX');
				
			}
		}else{
			var tab = document.getElementById('rejApprovalDtls');
			var len = tab.tBodies.length;
			var body = tab.tBodies[0];
			var inputs = body.getElementsByTagName('TR');
			
			for (var i = 0; i < inputs.length - 2; i++) {
				var regSection = document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration')[0];
				var regSection1 = regSection.value;
	
				for(var j=0;regSection.options.length > 0;j++){
					regSection.options.remove(0);
				}
				regSection.options[0] = new Option('Select','');
				regSection.options[1] = new Option('Section 10(23AAA)','I');
				regSection.options[2] = new Option('Section 10(23C)(iv)','II');
				regSection.options[3] = new Option('Section 10(23C)(v)','III');
				regSection.options[4] = new Option('Section 10(23C)(vi)','IV');
				regSection.options[5] = new Option('Section 10(23C)(via)','V');
				regSection.options[6] = new Option('Section 12A/12AA','VI');
				regSection.options[7] = new Option('Section 13B','VIII');
				regSection.options[8] = new Option('Section 35','IX');
				
			}
		}
	}catch(e){
		alert(e);
	}
}
function aadhaarValidatorPartAGen()
{
	var table = document.getElementById('AuditDetails');
    var noOfRows = table.rows.length;
    for (var i = 0; i < (noOfRows-2); i++)
    {
    	var audited = document.getElementsByName('itr7.partAGEN2.auditDetails['+ i +'].auditedflag')[0];
    	var pan = document.getElementsByName('itr7.partAGEN2.auditDetails['+ i +'].audFrmPAN')[0];
    	var aadhaar = document.getElementsByName('itr7.partAGEN2.auditDetails['+ i +'].audFrmAadhaar')[0];
    	if(audited.value == 'Y' && pan.value == "" && aadhaar.value == "")
    	{
			j.setFieldError('itr7.partAGEN2.auditDetails['+ i +'].audFrmAadhaar','Please enter the PAN/ Aadhaar No.of the proprietorship in schedule Part A General.');
			addErrorXHTML(document.getElementsByName('itr7.partAGEN2.auditDetails['+ i +'].audFrmAadhaar')[0], 'Please enter the PAN/ Aadhaar No.of the proprietorship in schedule Part A General.',true);    
    	}
    }
}
function aadPanValidatorSchLA()
{
    	var audited = document.getElementsByName('itr7.scheduleLA.accountsAudited')[0];
    	var pan = document.getElementsByName('itr7.scheduleLA.firmPaNno')[0];
    	var aadhaar = document.getElementsByName('itr7.scheduleLA.firmAdenum')[0];
    	if(audited.value == 'Y' && pan.value == "" && aadhaar.value == "")
    	{
			j.setFieldError('itr7.scheduleLA.firmAdenum','Please enter the PAN/ Aadhaar of the proprietorship in schedule LA.');
			addErrorXHTML(document.getElementsByName('itr7.scheduleLA.firmAdenum')[0], 'Please enter the PAN/ Aadhaar of the proprietorship in schedule LA.',true);   
    	}
}
function schETFor6v(){
	
	var dateOFFormOrIncorp = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.dateOFFormOrIncorp')[0];
	var cmpDate = '01/04/2019'; 
	var volConRec = document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.voluntaryContributionDuringYr')[0];
	var amtSpentOnadmnstrtv = document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0];
	
	if(checkFirstDateBefore(cmpDate,dateOFFormOrIncorp.value)){
		if(amtSpentOnadmnstrtv.value > (volConRec.value*0.05) || amtSpentOnadmnstrtv.value > 500000){
			j.setFieldError('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs','As per rule 17CA, the expenditure cannot exceed 5% of total contributions and is restricted to Rs.5 Lakh in the first year of incorporation or Rs. 3 Lakh in the subsequest years');
			addErrorXHTML(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0], 'As per rule 17CA, the expenditure cannot exceed 5% of total contributions and is restricted to Rs.5 Lakh in the first year of incorporation or Rs. 3 Lakh in the subsequest years',true);
		}
		
	}else if(checkFirstDateBefore(dateOFFormOrIncorp.value,cmpDate)){
		if(amtSpentOnadmnstrtv.value > (volConRec.value*0.05) || amtSpentOnadmnstrtv.value > 300000){
			j.setFieldError('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs','As per rule 17CA, the expenditure cannot exceed 5% of total contributions and is restricted to Rs.5 Lakh in the first year of incorporation or Rs. 3 Lakh in the subsequest years');
			addErrorXHTML(document.getElementsByName('itr7.scheduleET.voluntaryContributionDtls.amtSpentOnManagingAffairs')[0], 'As per rule 17CA, the expenditure cannot exceed 5% of total contributions and is restricted to Rs.5 Lakh in the first year of incorporation or Rs. 3 Lakh in the subsequest years',true);
		}
	}
}
function valAnnyDonation(){
	var annoyDnt = document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0];
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var totalContribution = document.getElementsByName('itr7.scheduleVC.totalContribution')[0];
	if(annoyDnt.value > totalContribution.value){
		j.setFieldError('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation','Please enter the anonymous donation included in Sr.no. C - Total contribution');
		addErrorXHTML(document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0], 'Please enter the anonymous donation included in Sr.no. C - Total contribution',true);
	}
	if (exemptClaimed == '13B' && annoyDnt.value > 0 ) {
		j.setFieldError('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation','Anonymous donation u/s 115BBC is not allowable for an Electoral trust registered u/s 13B');
		addErrorXHTML(document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0], 'Anonymous donation u/s 115BBC is not allowable for an Electoral trust registered u/s 13B',true);	
	}
}
function enableSchVC(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;

	if (exemptClaimed == '13B'  ) {
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].disabled = true;
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].value = 0;
	}else{
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].disabled = false;
		document.getElementsByName('itr7.scheduleVC.anonymousDonations.aggregateAnonymousDonation')[0].readOnly = false;
	}
}
function validateTotReceipts(){
	var totalReceipts_elm = document.getElementsByName('itr7.scheduleIE1.totalReceipts')[0].disabled;
	var totalReceipts = getAmt('itr7.scheduleIE1.totalReceipts');
	var totalContribution = getAmt('itr7.scheduleVC.totalContribution');
	if( (totalReceipts < totalContribution) && (totalReceipts_elm == false)){
		j.setFieldError('itr7.scheduleIE1.totalReceipts','Please enter the total receipts including voluntary contribution');
		addErrorXHTML(document.getElementsByName('itr7.scheduleIE1.totalReceipts')[0], 'Please enter the total receipts including voluntary contribution',true);
	}
}
/*function schIE2incfrmhp(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var taxableflg = document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].value;
	var incfrmhp = document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0].value;
	var incHP =  document.getElementsByName('scheduleHP.incomeUnderIncFrmHp')[0].value;
	
	if(exemptClaimed == "23A" && taxableflg == "Y"){
		if(incfrmhp == "" ){
			j.setFieldError('itr7.scheduleIE2.incomeFromHP','Please enter the Income from House Property in Schedule IE-2.');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0], 'Please enter the Income from House Property in Schedule IE-2.',true);
		}else if(incHP != incfrmhp){
			j.setFieldError('itr7.scheduleIE2.incomeFromHP','Please fill schdedule HP. The income entered in this field should be equal to sr.no. 4 of schedule HP');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromHP')[0], 'Please fill schdedule HP. The income entered in this field should be equal to sr.no. 4 of schedule HP',true);	
		}
	}
}*/
/*function schIE2incfrmbp(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var taxableflg = document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].value;
	var incfrmbp = document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0].value;
	var incBP =  document.getElementsByName('itr7.corpScheduleBP.incChrgUnHdProftGain')[0].value;
	
	if(exemptClaimed == "24" && taxableflg == "Y"){
		if(incfrmbp == "" ){
			j.setFieldError('itr7.scheduleIE2.incomeFromBP','Please enter the Income from Business or Profession in Schedule IE-2.');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0], 'Please enter the Income from Business or Profession in Schedule IE-2.',true);
		}else if(incBP != incfrmbp){
			j.setFieldError('itr7.scheduleIE2.incomeFromBP','Please fill schdedule BP. The income entered in this field should be equal to sr.no.D34 of schedule BP');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromBP')[0], 'Please fill schdedule BP. The income entered in this field should be equal to sr.no.D34 of schedule BP',true);	
		}
	}
}*/
/*function schIE2incfrmcg(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var taxableflg = document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].value;
	var incfrmcg = document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0].value;
	var incCG =  document.getElementsByName('itr7.scheduleCG.incChargeableHeadCapGain')[0].value;
	
	if(exemptClaimed == "24" && taxableflg == "Y"){
		if(incfrmcg == "" ){
			j.setFieldError('itr7.scheduleIE2.incomeFromCG','Please enter the Income from Capital gains in Schedule IE-2.');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0], 'Please enter the Income from Capital gains in Schedule IE-2.',true);
		}else if(incCG != incfrmcg){
			j.setFieldError('itr7.scheduleIE2.incomeFromCG','Please fill schdedule CG. The income entered in this field should be equal to sr.no. C of schedule CG');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromCG')[0], 'Please fill schdedule CG. The income entered in this field should be equal to sr.no. C of schedule CG',true);	
		}
	}
}
function schIE2incfrmos(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var taxableflg = document.getElementsByName('itr7.scheduleIE2.anyTaxableIncomeFlag')[0].value;
	var incfrmos = document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0].value;
	var incOS =  document.getElementsByName('itr7.scheduleOS.incChargeableFrmOthSrc')[0].value;
	
	if(exemptClaimed == "23A" && taxableflg == "Y"){
		if(incfrmos == "" ){
			j.setFieldError('itr7.scheduleIE2.incomeFromOS','Please enter the Income from other Sources Amount in Schedule IE-2.');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0], 'Please enter the Income from other Sources Amount in Schedule IE-2.',true);
		}else if(incOS != incfrmos){
			j.setFieldError('itr7.scheduleIE2.incomeFromOS','Please fill schdedule OS. The income entered in this field should be equal to sr.no. 9 of schedule OS');
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE2.incomeFromOS')[0], 'Please fill schdedule OS. The income entered in this field should be equal to sr.no. 9 of schedule OS',true);	
		}
	}
}*/
/*function validateIE2(){
	schIE2incfrmhp();
	schIE2incfrmbp();
	schIE2incfrmcg();
	schIE2incfrmos();
}*/
function enableSchHP(){
	var retFurSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;
    var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var totHp=eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent)-1);
	
	for(var i=0;i<totHp;i++){
		if(exemptClaimed == '13A' || exemptClaimed == '13B'  || exemptClaimed == '23A' || retFurSec == '139-4C')  {
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.addrDetail')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.addrDetail')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.cityOrTownOrDistrict')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.cityOrTownOrDistrict')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.stateCode')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.stateCode')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.country')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.country')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.pinCode')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].addressDetail.pinCode')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].ownerOfProperty')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].ownerOfProperty')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].propCoOwnedFlg')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].propCoOwnedFlg')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].ifLetOut')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].ifLetOut')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.intOnBorwCap')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.intOnBorwCap')[0].readOnly = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.arrearsRent')[0].disabled = false;
			document.getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].rentdetails.arrearsRent')[0].readOnly = false;
			isCoOwned();
			isLetOut();
			isselfOccupied();
			
		}
	}
	
	if(exemptClaimed != '13A' && exemptClaimed != '13B' && exemptClaimed != '23A' && retFurSec != '139-4C' )  {
		for(var i=0;i<(totHp-1);i++){
			delScheduleHP();
		}
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.addrDetail')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.addrDetail')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.addrDetail')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.cityOrTownOrDistrict')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.cityOrTownOrDistrict')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.cityOrTownOrDistrict')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.stateCode')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.stateCode')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.stateCode')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.country')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.country')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.country')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.pinCode')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.pinCode')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].addressDetail.pinCode')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].ownerOfProperty')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].ownerOfProperty')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].ownerOfProperty')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].propCoOwnedFlg')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].propCoOwnedFlg')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].propCoOwnedFlg')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].ifLetOut')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].ifLetOut')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].ifLetOut')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].rentdetails.intOnBorwCap')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].rentdetails.intOnBorwCap')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].rentdetails.intOnBorwCap')[0].value = "";
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].rentdetails.arrearsRent')[0].disabled = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].rentdetails.arrearsRent')[0].readOnly = true;
		document.getElementsByName('itr7.scheduleHP.propertyDetails[0].rentdetails.arrearsRent')[0].value = "";
//		document.getElementsByName('scheduleHP.passThroughIncome')[0].disabled = true;
//		document.getElementsByName('scheduleHP.passThroughIncome')[0].readOnly = true;
//		document.getElementsByName('scheduleHP.passThroughIncome')[0].value = "";
		
		var tabl = document.getElementById('scheduleHPMain');
		var allInputTags = tabl.getElementsByTagName('input');
		for ( var i = 0; i < allInputTags.length; i++) {
			if(allInputTags[i].type != 'button' && allInputTags[i].type != 'hidden')
				allInputTags[i].value = "";	
		}
		
		isCoOwned();
		isLetOut();
		isselfOccupied();
	}else{
//		document.getElementsByName('scheduleHP.passThroughIncome')[0].disabled = false;
//		document.getElementsByName('scheduleHP.passThroughIncome')[0].readOnly = false;
		populatePtiToHp();
	}
		
}
function enableSchCG(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var retFurSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;

	var tabl = document.getElementById('scheduleCGMain');
	var allInputTags = tabl.getElementsByTagName('input');
	var allSelectTags = tabl.getElementsByTagName('select');
	
	if(exemptClaimed != '13A' && exemptClaimed != '13B' && exemptClaimed != '24')  {
		deleteRowToCG('ltcg10pctTab');
	}
	
	for ( var i = 0; i < allInputTags.length; i++) {
		if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '24' || retFurSec == '139-4C')  {
			if(allInputTags[i].className.search('readonly') == -1){				
				allInputTags[i].disabled = false;
				allInputTags[i].readOnly = false;
			}
		} else {
			if(allInputTags[i].type != 'hidden'){
				allInputTags[i].value = "";
			}
			if(allInputTags[i].className.search('readonly') == -1){								
				allInputTags[i].disabled = true;
				allInputTags[i].readOnly = true;
				
			}
			
		}
	}
	
	for ( var i = 0; i < allSelectTags.length; i++) {
		if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '24' || retFurSec == '139-4C')  {
			if(allSelectTags[i].className.search('readonly') == -1){				
				allSelectTags[i].disabled = false;
				allSelectTags[i].readOnly = false;
			}
		} else {
			allSelectTags[i].value = "";
			if(allSelectTags[i].className.search('readonly') == -1){								
				allSelectTags[i].disabled = true;
				allSelectTags[i].readOnly = true;
				
			}
			
		}
	}
	//calCGFrmPTI();retFurSec == '139-4C'
}
function enableSchBP(){  
	var retFurSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var tabl = document.getElementById('scheduleBPMain');
	var allInputTags = tabl.getElementsByTagName('input');
	var allselectTags = tabl.getElementsByTagName('select');
	
	if(exemptClaimed != '13A' && exemptClaimed != '13B' && exemptClaimed != '24')  {
		disableTable('relevantSec35AD',1,1);
		
	}
	for ( var i = 0; i < allInputTags.length; i++) {
		if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '24' || retFurSec == '139-4C')
		{
			if(allInputTags[i].className.search('readonly') == -1){				
				allInputTags[i].disabled = false;
				allInputTags[i].readOnly = false;
			}
		} else {
			if(allInputTags[i].type != 'hidden'){
				allInputTags[i].value = "";
			}
			if(allInputTags[i].className.search('readonly') == -1){								
				allInputTags[i].disabled = true;
				allInputTags[i].readOnly = true;
				
			}
			
		}
	}
	
	for ( var i = 0; i < allselectTags.length; i++) {
		if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '24')  {
			if(allselectTags[i].className.search('readonly') == -1){				
				allselectTags[i].disabled = false;
				allselectTags[i].readOnly = false;
			}
		} else {
			allselectTags[i].value = "";
			if(allselectTags[i].className.search('readonly') == -1){								
				allselectTags[i].disabled = true;
				allselectTags[i].readOnly = true;
				
			}
			
		}
	}
}
function disableTable(tabId,header,footer){
	var tableToDisable = document.getElementById(tabId);
	var rowCount = tableToDisable.rows.length;
	var rowToDelete = rowCount - header - footer - 1;
	var rowIndex =  eval( parseInt(rowCount,10) - parseInt(footer,10)- 1);
	
	for(var i = 0;i<rowToDelete;i++){
		tableToDisable.deleteRow(rowIndex);
	}
}
function calculateSchedulePTI(elem){
	var index = parseInt(elem.name.substring(elem.name.indexOf("[") + 1, elem.name.indexOf("]")));
	
	var incFromHPamtOfIncm= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromHP.amtOfIncm')[0];
	var incFromHPshareOfLoss= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromHP.shareOfLoss')[0];
	var incFromHPnetIncome= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromHP.netIncome')[0];
	var incFromHPtds= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromHP.tdsOnAmt')[0];
	incFromHPnetIncome.value=eval(parseInt(coalesce(incFromHPamtOfIncm.value),10))-eval(parseInt(coalesce(incFromHPshareOfLoss.value),10));
	if(incFromHPshareOfLoss.value ==''){
		incFromHPshareOfLoss.value = 0 ; 
	}
	if(incFromHPtds.value ==''){
		incFromHPtds.value = 0 ; 
	}
	
	
	var incFromCGShortTermtdsOnAmt111a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.tdsOnAmt111a')[0];
	var incFromCGShortTermtdsOnAmtOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.tdsOnAmtOthrs')[0];
	var incFromCGShortTermtdsOnAmt= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.tdsOnAmt')[0];
	incFromCGShortTermtdsOnAmt.value=eval(parseInt(coalesce(incFromCGShortTermtdsOnAmt111a.value),10))+eval(parseInt(coalesce(incFromCGShortTermtdsOnAmtOthrs.value),10));
	if(incFromCGShortTermtdsOnAmt111a.value ==''){
		incFromCGShortTermtdsOnAmt111a.value = 0 ; 
	}
	if(incFromCGShortTermtdsOnAmtOthrs.value ==''){
		incFromCGShortTermtdsOnAmtOthrs.value = 0 ; 
	}
	
	
	var incFromCGShortTermamtOfIncm111a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.amtOfIncm111a')[0];
	var incFromCGShortTermshareOfLoss111a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.shareOfLoss111a')[0];
	var incFromCGShortTermnetIncome111a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.netIncome111a')[0];
	incFromCGShortTermnetIncome111a.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncm111a.value),10))-eval(parseInt(coalesce(incFromCGShortTermshareOfLoss111a.value),10));
	if(incFromCGShortTermshareOfLoss111a.value ==''){
		incFromCGShortTermshareOfLoss111a.value = 0 ; 
	}
	
	var incFromCGShortTermamtOfIncmOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.amtOfIncmOthrs')[0];
	var incFromCGShortTermshareOfLossOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.shareOfLossOthrs')[0];
	var incFromCGShortTermnetIncomeOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.netIncomeOthrs')[0];
	incFromCGShortTermnetIncomeOthrs.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncmOthrs.value),10))-eval(parseInt(coalesce(incFromCGShortTermshareOfLossOthrs.value),10));
	if(incFromCGShortTermshareOfLossOthrs.value ==''){
		incFromCGShortTermshareOfLossOthrs.value = 0 ; 
	}
	
	var incFromCGShortTermamtOfIncm= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.amtOfIncm')[0];
	incFromCGShortTermamtOfIncm.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncm111a.value),10))+eval(parseInt(coalesce(incFromCGShortTermamtOfIncmOthrs.value),10));
	var incFromCGShortTermshareOfLoss= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.shareOfLoss')[0];
	incFromCGShortTermshareOfLoss.value=eval(parseInt(coalesce(incFromCGShortTermshareOfLoss111a.value),10))+eval(parseInt(coalesce(incFromCGShortTermshareOfLossOthrs.value),10));
	var incFromCGShortTermnetIncome= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGShortTerm.netIncome')[0];
	incFromCGShortTermnetIncome.value=eval(parseInt(coalesce(incFromCGShortTermamtOfIncm.value),10))-eval(parseInt(coalesce(incFromCGShortTermshareOfLoss.value),10));
	
	var incFromCGLongTermtdsOnAmt112a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.tdsOnAmt112a')[0];
	var incFromCGLongTermtdsOnAmtOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.tdsOnAmtOthrs')[0];
	var incFromCGLongTermtdsOnAmt= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.tdsOnAmt')[0];
	incFromCGLongTermtdsOnAmt.value=eval(parseInt(coalesce(incFromCGLongTermtdsOnAmt112a.value),10))+eval(parseInt(coalesce(incFromCGLongTermtdsOnAmtOthrs.value),10));
	if(incFromCGLongTermtdsOnAmt112a.value ==''){
		incFromCGLongTermtdsOnAmt112a.value = 0 ; 
	}
	if(incFromCGLongTermtdsOnAmtOthrs.value ==''){
		incFromCGLongTermtdsOnAmtOthrs.value = 0 ; 
	}
	
	
	var incFromCGLongTermamtOfIncm112a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.amtOfIncm112a')[0];
	var incFromCGLongTermshareOfLoss112a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.shareOfLoss112a')[0];
	var incFromCGLongTermnetIncome112a= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.netIncome112a')[0];
	incFromCGLongTermnetIncome112a.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncm112a.value),10))-eval(parseInt(coalesce(incFromCGLongTermshareOfLoss112a.value),10));
	if(incFromCGLongTermshareOfLoss112a.value ==''){
		incFromCGLongTermshareOfLoss112a.value = 0 ; 
	}
	
	var incFromCGLongTermamtOfIncmOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.amtOfIncmOthrs')[0];
	var incFromCGLongTermshareOfLossOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.shareOfLossOthrs')[0];
	var incFromCGLongTermnetIncomeOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.netIncomeOthrs')[0];
	incFromCGLongTermnetIncomeOthrs.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncmOthrs.value),10))-eval(parseInt(coalesce(incFromCGLongTermshareOfLossOthrs.value),10));
	if(incFromCGLongTermshareOfLossOthrs.value ==''){
		incFromCGLongTermshareOfLossOthrs.value = 0 ; 
	}
	
	var incFromCGLongTermamtOfIncm= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.amtOfIncm')[0];
	incFromCGLongTermamtOfIncm.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncm112a.value),10))+eval(parseInt(coalesce(incFromCGLongTermamtOfIncmOthrs.value),10));
	var incFromCGLongTermshareOfLoss= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.shareOfLoss')[0];
	incFromCGLongTermshareOfLoss.value=eval(parseInt(coalesce(incFromCGLongTermshareOfLoss112a.value),10))+eval(parseInt(coalesce(incFromCGLongTermshareOfLossOthrs.value),10));
	var incFromCGLongTermnetIncome= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromCGLongTerm.netIncome')[0];
	incFromCGLongTermnetIncome.value=eval(parseInt(coalesce(incFromCGLongTermamtOfIncm.value),10))-eval(parseInt(coalesce(incFromCGLongTermshareOfLoss.value),10));
	
	var incFromDividendtdsOnAmtDividend= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.tdsOnAmtDividend')[0];
	var incFromDividendtdsOnAmtOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.tdsOnAmtOthrs')[0];
	var incFromOStdsOnAmt= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromOS.tdsOnAmt')[0];
	incFromOStdsOnAmt.value=eval(parseInt(coalesce(incFromDividendtdsOnAmtDividend.value),10))+eval(parseInt(coalesce(incFromDividendtdsOnAmtOthrs.value),10));
	if(incFromDividendtdsOnAmtDividend.value ==''){
		incFromDividendtdsOnAmtDividend.value = 0 ; 
	}
	if(incFromDividendtdsOnAmtOthrs.value ==''){
		incFromDividendtdsOnAmtOthrs.value = 0 ; 
	}
	
	var incFromDividendamtOfIncmDividend= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.amtOfIncmDividend')[0];
	// coalesceSetRet('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.shareOfLossDividend');
	var incFromDividendnetIncomeDiviend= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.netIncomeDividend')[0];
	incFromDividendnetIncomeDiviend.value=eval(parseInt(coalesce(incFromDividendamtOfIncmDividend.value),10));
	
	var incFromDividendamtOfIncmOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.amtOfIncmOthrs')[0];
	// coalesceSetRet('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.shareOfLossOthrs');
	var incFromDividendnetIncomeOthrs= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromDividend.netIncomeOthrs')[0];
	incFromDividendnetIncomeOthrs.value=eval(parseInt(coalesce(incFromDividendamtOfIncmOthrs.value),10));
	
	var incFromOSamtOfIncm= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromOS.amtOfIncm')[0];
	incFromOSamtOfIncm.value=eval(parseInt(coalesce(incFromDividendamtOfIncmDividend.value),10))+eval(parseInt(coalesce(incFromDividendamtOfIncmOthrs.value),10));
	
	var incFromOSnetIncome= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromOS.netIncome')[0];
	incFromOSnetIncome.value=eval(parseInt(coalesce(incFromOSamtOfIncm.value),10));
	
	var incFromExemptSec10_23FBBamtOfIncm= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.amtOfIncm')[0];
	
	var incFromExemptSec10_23FBBnetIncome= document.getElementsByName('itr7SchedulePTI.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('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.amtOfIncm')[0];
	var incFromExemptSec10_23FBB1netIncome= document.getElementsByName('itr7SchedulePTI.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('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.amtOfIncm')[0];
	
	var incFromExemptSec10_23FBB2netIncome= document.getElementsByName('itr7SchedulePTI.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('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.amtOfIncm')[0];
	var incFromExemptSec10_23FBB1amtOfIncm= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.amtOfIncm')[0];
	var incFromExemptSec10_23FBB2amtOfIncm= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.amtOfIncm')[0];
	var incFromExemptSec10_23FBBamtOfIncmTotal= document.getElementsByName('itr7SchedulePTI.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('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.shareOfLoss')[0];
	 * var incFromExemptSec10_23FBB1shareOfLoss=
	 * document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.shareOfLoss')[0];
	 * var incFromExemptSec10_23FBB2shareOfLoss=
	 * document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.shareOfLoss')[0];
	 * var incFromExemptSec10_23FBBshareOfLossTotal=
	 * document.getElementsByName('itr7SchedulePTI.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('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.netIncome')[0];
	var incFromExemptSec10_23FBB1netIncome= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.netIncome')[0];
	var incFromExemptSec10_23FBB2netIncome= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.netIncome')[0];
	var incFromExemptSec10_23FBBnetIncomeTotal= document.getElementsByName('itr7SchedulePTI.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('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB.tdsOnAmt')[0];
	var incFromExemptSec10_23FBB1tdsOnAmt= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB1.tdsOnAmt')[0];
	var incFromExemptSec10_23FBB2tdsOnAmt= document.getElementsByName('itr7SchedulePTI.schedulePTI['+index+'].incFromExemptSec10_23FBB2.tdsOnAmt')[0];
	var incFromExemptSec10_23FBBtdsOnAmtTotal= document.getElementsByName('itr7SchedulePTI.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));
	if(incFromExemptSec10_23FBBtdsOnAmt.value ==''){
		incFromExemptSec10_23FBBtdsOnAmt.value = 0 ; 
	}
	
	populatePtiToAi();
	populatePtiToHp();
}
function fmtDate(dt,i){
	return ("00" + dt.getDate()).slice(-2) +  '/' + ("00" + (dt.getMonth()+i)).slice(-2)+ '/' + dt.getFullYear()  ;
}

function enableReqNewProv(){
	var dateOne = fmtDate( new Date(2021, 04, 01),0);
	//var dateOne = new Date(01, 04, 2021);
    var currentDate = document.getElementsByName('itr7.verification.date')[0].value;
   
	
    if(!currentDate || currentDate.trim() ==''){
    	currentDate = fmtDate( new Date(),1);
    }
    
	var newProvisionFlag= document.getElementsByName('itr7.partAGEN1.rejApprovalDtls[0].newProvisionFlag')[0];
	if(currentDate >= dateOne){
		newProvisionFlag.disabled = false;
	}else{		
		newProvisionFlag.disabled = true;
		newProvisionFlag.value = "";
	}	
}
function validateReqNewProv(){
	var dateOne = new Date(2021, 04, 01);
	var currentDate = new Date();
	  
	if(currentDate >= dateOne){
		var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
		for(var i = 0 ; i < noOfRowsRejApprovalDtls ; i++){
			var newProvisionFlag = document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i + '].newProvisionFlag')[0].value;
			var secUnderRegistration = document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i + '].secUnderRegistration')[0].value;
			
			if(secUnderRegistration == 'II' || secUnderRegistration == 'III' || secUnderRegistration == 'IV' 
				|| secUnderRegistration == 'V' || secUnderRegistration == 'VIA'){
				if(newProvisionFlag != "Y" && newProvisionFlag != "N"){

					addErrorXHTML(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i + '].newProvisionFlag')[0],
							'Please select an option from the drop down options of "Whether application for registration is made as per new provisions"  in Part A General (1)"',true);
					j.setFieldError('itr7.partAGEN1.rejApprovalDtls['+ i + '].newProvisionFlag',
									'Please select an option from the drop down options of "Whether application for registration is made as per new provisions"  in Part A General (1)"');
				}
			}
		}
		
	}
}
function enableNewProvision(){
	
	var noOfRows = $('#rejApprovalDtls tr').length
	
    var indexValue = eval(parseInt(noOfRows,10)-2);
    
    for(var i = 0 ; i < indexValue ; i++){
    	var newProvisionFlag = document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].newProvisionFlag')[0].value;
    		
    	if(newProvisionFlag == "Y"){
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUndrRegApplied')[0].disabled = false;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUndrRegApplied')[0].readOnly = false;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].dateOfRegNewProvision')[0].disabled = false;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].dateOfRegNewProvision')[0].readOnly = false;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secExemptOpted')[0].disabled = false;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secExemptOpted')[0].readOnly = false;
    	}else{
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUndrRegApplied')[0].disabled = true;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUndrRegApplied')[0].readOnly = true;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUndrRegApplied')[0].value = "";
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].dateOfRegNewProvision')[0].disabled = true;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].dateOfRegNewProvision')[0].readOnly = true;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].dateOfRegNewProvision')[0].value = "";
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secExemptOpted')[0].disabled = true;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secExemptOpted')[0].readOnly = true;
    		document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secExemptOpted')[0].value = "";
    	}
    }
	
}
/*function calCGFrmPTI(){
var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	
	if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '24')  {
	
		var noOfRows = $('#schedulePTI tr').length;
		var indexValue = eval(parseInt(((noOfRows - 3) / 15)));
		var sumStcg111A = 0;
		var sumStcgOth = 0;
		var sumLtcg112A = 0;
		for(var i = 0 ; i < indexValue ; i++){
			sumStcg111A = sumStcg111A + getAmt('itr7SchedulePTI.schedulePTI['+i+'].incFromCGShortTerm.netIncome111a');
			sumStcgOth = sumStcgOth + getAmt('itr7SchedulePTI.schedulePTI['+i+'].incFromCGShortTerm.netIncomeOthrs');
			sumLtcg112A = sumLtcg112A + getAmt('itr7SchedulePTI.schedulePTI['+i+'].incFromCGLongTerm.netIncome112a');
		}
		$('[name="itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg15"]')[0].value = sumStcg111A;
		$('[name="itr7.scheduleCG.shortTermCapGain.stcgUnderDtaa.ptiStcg30"]')[0].value = sumStcgOth;
		$('[name="itr7.scheduleCG.longTermCapGain.passThrInc10Per"]')[0].value = sumStcgOth;
		scheduleCGCalc();
	}
}*/
function enableTRCFlagOS()
{
	var tab = document.getElementById('scheduleOsNriIncTaxDtaa');
	var rowcount = tab.rows.length;
	for (var j = 0; j <parseInt(rowcount-2); j++) {
		if(document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value == 'NRI')
		{
			document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+j+'].taxResidCertFlag')[0].disabled=false;
		}
		else
		{
			document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+j+'].taxResidCertFlag')[0].disabled=true;
			document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+j+'].taxResidCertFlag')[0].value='';
		}
	}
	populateRateOS();
	
}
function enableDepreciation()
{
	var rentFromMachPlantBldgs = document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs')[0].value;
	if(parseInt(coalesce(document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.rentFromMachPlantBldgs')[0].value),10)>0)
	{
		document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation')[0].readOnly= false;
	}
	else
	{
		document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation')[0].readOnly= true;
		document.getElementsByName('itr7.scheduleOS.incOthThanOwnRaceHorse.deductions.depreciation')[0].value='';
	}
}
function enableSchOS(){  
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	var retFurSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;
	var tabl = document.getElementById('scheduleOS');
	var allInputTags = tabl.getElementsByTagName('input');
	var allselectTags = tabl.getElementsByTagName('select');
	
	for ( var i = 0; i < allInputTags.length; i++) {
		if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '23A' ||  retFurSec == '139-4C')  {
			if(allInputTags[i].className.search('readonly') == -1 && allInputTags[i].className.search('exmptus10') == -1){				
				allInputTags[i].disabled = false;
				allInputTags[i].readOnly = false;
				
			}
		} else {
			//allInputTags[i].value = "";
			if(allInputTags[i].className.search('exmptus10') != -1){
				allInputTags[i].value = getAmt('itr7.scheduleOS.incOthThanOwnRaceHorse.anyOtherIncomeExemptUS10');
			}else if(allInputTags[i].className.search('readonly') == -1){
				if(allInputTags[i].type != 'hidden'){
					allInputTags[i].value = "";
				}
				allInputTags[i].disabled = true;
				allInputTags[i].readOnly = true;
			}else{
				if(allInputTags[i].type != 'hidden'){
					allInputTags[i].value = "";
				}
			}
			
		}
	}
	
	for ( var i = 0; i < allselectTags.length; i++) {
		if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '23A')  {
			if(allselectTags[i].className.search('readonly') == -1){				
				allselectTags[i].disabled = false;
				allselectTags[i].readOnly = false;
			}
		} else {
			allselectTags[i].value = "";
			if(allselectTags[i].className.search('readonly') == -1){								
				allselectTags[i].disabled = true;
				allselectTags[i].readOnly = true;
				
			}
			
		}
	}
	if(exemptClaimed == '13A' || exemptClaimed == '13B' || exemptClaimed == '23A'){
		enableDepreciation();
	}
	enableTRCFlagOS();
	
}
function populateCheckbox(elem){
	// var zipCodeCheck=
	// document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.pinCode.pChosenCheckBox')[0];
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	if(elem == 'addrow'){
		noOfRowsRejApprovalDtls = noOfRowsRejApprovalDtls - 1;
		$('[name="itr7.partAGEN1.rejApprovalDtls['+noOfRowsRejApprovalDtls+'].regSecExmpClaimed"]')[0].checked = false;
		$('[name="itr7.partAGEN1.rejApprovalDtls['+noOfRowsRejApprovalDtls+'].regSecExmpClaimed"]')[0].value = "";
	}else{
		if(noOfRowsRejApprovalDtls > 1){
			for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
				
				$('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].regSecExmpClaimed"]')[0].checked = false;
				$('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].regSecExmpClaimed"]')[0].value = "";
			}
			elem.checked=true
		}
		if(elem.checked==true){
			elem.value="true";
		}else{
			elem.value="";
		}
	}
}
function loadCheckbox(){
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		if($('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].regSecExmpClaimed"]')[0].value == "true"){
			$('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].regSecExmpClaimed"]')[0].checked = true;
		}
	
	}
}
function populatePtiToAi(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	
	if (exemptClaimed == '11' || exemptClaimed == '23CIV'  || exemptClaimed == '23CV'
			|| exemptClaimed == '23CVI' || exemptClaimed == '23CVIA') {
		var noOfRows = $('#schedulePTI tr').length;
		var indexValue = eval(parseInt(((noOfRows - 3) / 15)));
		var sumPti = 0;

		for(var i = 0 ; i < indexValue ; i++){
			sumPti = sumPti + parseInt(document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].incFromHP.netIncome')[0].value);
			sumPti = sumPti + parseInt(document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].incFromCGShortTerm.netIncome')[0].value);
			sumPti = sumPti + parseInt(document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].incFromCGLongTerm.netIncome')[0].value);
			sumPti = sumPti + parseInt(document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].incFromOS.netIncome')[0].value);
		}
		if(sumPti > 0){
			$('[name="itr7.scheduleAI.passThroughIncome"]')[0].value = sumPti;
			calculateTiTti();
		}
	}
}
function populatePtiToHp(){
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	
	if (exemptClaimed == '13A' || exemptClaimed == '13B'  || exemptClaimed == '23A') {
		var noOfRows = $('#schedulePTI tr').length;
		var indexValue = eval(parseInt(((noOfRows - 3) / 15)));
		var sumPti = 0;
		for(var i = 0 ; i < indexValue ; i++){
			sumPti= sumPti + getAmt('itr7SchedulePTI.schedulePTI['+i+'].incFromHP.netIncome');
		}
		$('[name="scheduleHP.passThroughIncome"]')[0].value = sumPti;
	}
	scheduleHPCalc();
}
function populateIE3ObjInst(){
	var noOfRows = $('#scheduleIE3 tr').length - 4;
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
		
	for(var i = 0 ; i < noOfRows ; i++){
		if(exemptClaimed == '23CIIIAB'){
			document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].objectiveInstitution')[0].value = 'EDU';
		}
		if(exemptClaimed == '23CIIIAC'){
			document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].objectiveInstitution')[0].value = 'MED';
		}
	}
}
function populateIE4ObjInst(){
	var noOfRows = $('#scheduleIE4 tr').length - 4;
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
		
	for(var i = 0 ; i < noOfRows ; i++){
		if(exemptClaimed == '23CIIIAD'){
			document.getElementsByName('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+i+'].objective')[0].value = 'EDU';
		}
		if(exemptClaimed == '23CIIIAE'){
			document.getElementsByName('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+i+'].objective')[0].value = 'MED';
		}
	}
}
function validateIE3ObjInst(){
	var noOfRows = $('#scheduleIE3 tr').length - 4;
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
		
	for(var i = 0 ; i < noOfRows ; i++){
		if(exemptClaimed == '23CIIIAB'
			&& document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].objectiveInstitution')[0].value == 'MED'){
			
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+ i + '].objectiveInstitution')[0],
					'Please select the education dropdown under objective of the institution',true);
			j.setFieldError('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+ i + '].objectiveInstitution',
							'Please select the education dropdown under objective of the institution');
			
		}
		if(exemptClaimed == '23CIIIAC'
			&& document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].objectiveInstitution')[0].value == 'EDU'){
			
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+ i + '].objectiveInstitution')[0],
					'Please select the medical dropdown under objective of the institution',true);
			j.setFieldError('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+ i + '].objectiveInstitution',
							'Please select the medical dropdown under objective of the institution');
			
		}
	}
}
function validateIE4ObjInst(){
	var noOfRows = $('#scheduleIE4 tr').length - 4;
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
		
	for(var i = 0 ; i < noOfRows ; i++){
		if(exemptClaimed == '23CIIIAD'
			&& document.getElementsByName('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+i+'].objective')[0].value == 'MED'){
			
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+ i + '].objective')[0],
					'Please select the education dropdown under objective of the institution',true);
			j.setFieldError('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+ i + '].objective',
							'Please select the education dropdown under objective of the institution');
			
		}
		if(exemptClaimed == '23CIIIAE'
			&& document.getElementsByName('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+i+'].objective')[0].value == 'EDU'){
			
			addErrorXHTML(document.getElementsByName('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+ i + '].objective')[0],
					'Please select the medical dropdown under objective of the institution',true);
			j.setFieldError('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+ i + '].objective',
							'Please select the medical dropdown under objective of the institution');
			
		}
	}
}
function schCGDropDownVal(){
	var noOfBody= $('#ltcg10pctTab tbody').length;
	if(noOfBody > 1){
		var DD_1 = $('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[0].asstProvisoUndrSec112"]')[0].value;
		var DD_2 = $('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')[0].value;
		if(DD_2 == "112(1)" || DD_2 == "112A"){
			if(DD_1 == "112(1)" && DD_2 == "112(1)"){
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')[0].value = "";
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="112(1)"]').remove();
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="112A"]').remove();
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')
						.append('<option value="112A">Section 112A</option>');
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')[0].value = "112A";
			}
			if(DD_1 == "112A" && DD_2 == "112A"){
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')[0].value = "";
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="112A"]').remove();
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"] option[value="112(1)"]').remove();
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')
						.append('<option value="112(1)">Proviso under section 112(1) is applicable (without indexation)</option>');
				$('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')[0].value = "112(1)";
			}
		}
	}
}
function schCgDdError(){
	var noOfBody= $('#ltcg10pctTab tbody').length;
	if(noOfBody > 1){
		var DD_1 = $('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[0].asstProvisoUndrSec112"]')[0].value;
		var DD_2 = $('[name="itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112"]')[0].value;
		if(DD_1 == DD_2){
			addErrorXHTML('','Section cannot be same in dropdown From asset where proviso under section 112(1)/112A is applicable(without indexation) in Schedule CG',true);
			j.setFieldError('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A[1].asstProvisoUndrSec112','Section cannot be same in dropdown From asset where proviso under section 112(1)/112A is applicable(without indexation) in Schedule CG');
		
		}
	}
}
function enableSchTR(){  
	var resStatus = document.getElementsByName('itr7.partAGEN1.filingStatus.residentialStatus')[0].value;
	var noOfRows = $('#scheduleTR tr').length;
	var indexValue = eval(parseInt(noOfRows - 4));
	for ( var i = 0; i < indexValue; i++) {
		if(resStatus == 'RES')  {
			document.getElementsByName('scheduleTR1.scheduleTR['+i+'].relavantArticleDTAA')[0].disabled = false;
			document.getElementsByName('scheduleTR1.scheduleTR['+i+'].relavantArticleDTAA')[0].readonly = false;
			
		} else {
			document.getElementsByName('scheduleTR1.scheduleTR['+i+'].relavantArticleDTAA')[0].value = "";
			document.getElementsByName('scheduleTR1.scheduleTR['+i+'].relavantArticleDTAA')[0].disabled = true;
			document.getElementsByName('scheduleTR1.scheduleTR['+i+'].relavantArticleDTAA')[0].readonly = true;
				
		}		
	}
	if(resStatus == 'RES')  {
		document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].disabled = false;
		document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].readonly = false;
	}else{
		document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].value = "";
		document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].disabled = true;
		document.getElementsByName('scheduleTR1.taxPaidOutsideIndFlg')[0].readonly = true;
		adjustForm();
	}
}
function calcExemptUS10(){
	var IE1 = 0;
	var IE2 = 0;
	var IE3 = 0;
	var IE4 = 0;
	
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	//IE3
	var IE3_3 = 0;
	var IE3_4 = 0;
	var noOfRows = $('#scheduleIE3 tr').length;
	var indexValue = parseInt(noOfRows - 4);
	for(var i = 0 ; i < indexValue ; i++){
		IE3_3 = IE3_3 + getAmt('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].totalContributionReceipts');
		IE3_4 = IE3_4 + getAmt('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].governmentGrants');
	}
	//IE4
	var IE4_3 = 0;
	var IE4_4 = 0;
	var noOfRows = $('#scheduleIE4 tr').length;
	var indexValue = parseInt(noOfRows - 4);
	for(var i = 0 ; i < indexValue ; i++){
		IE4_3 = IE4_3 + getAmt('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+i+'].grossAnnualReceipts');
		IE4_4 = IE4_4 + getAmt('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+i+'].objectiveAmount');
	}
	//IE1
	var IE1_1 = 0;
	IE1_1 = getAmt('itr7.scheduleIE1.totalReceipts');
	//IE2
	var IE2_A1 = 0;
	IE2_A1 = getAmt('itr7.scheduleIE2.totalReceiptsContribution');
	//TI-TTI
	var ti8a = getAmt('itr7.partBTI.exemptionUs1021');
	var ti8b = getAmt('itr7.partBTI.exemptionUs10_22B');
	var ti8c = getAmt('itr7.partBTI.exemptionUs10_23A');
	var ti8d = getAmt('itr7.partBTI.exemptionUs10_23AAA');
	var ti8e = getAmt('itr7.partBTI.exemptionUs10_23B');
	var ti8f = getAmt('itr7.partBTI.exemptionUs10_23EC');
	var ti8g = getAmt('itr7.partBTI.exemptionUs10_23ED');
	var ti8h = getAmt('itr7.partBTI.exemptionUs10_23EE');
	var ti8i = getAmt('itr7.partBTI.exemptionUs10_29A');
	var ti9a = getAmt('itr7.partBTI.exemptionUs10_23Ciiiab');
	var ti9b = getAmt('itr7.partBTI.exemptionUs10_23Ciiiac');
	var ti9c = getAmt('itr7.partBTI.exemptionUs10_23Ciiiad');
	var ti9d = getAmt('itr7.partBTI.exemptionUs10_23Ciiiae');
	var ti9e = getAmt('itr7.partBTI.exemptionUs10_23D');
	var ti9f = getAmt('itr7.partBTI.exemptionUs10_23DA');
	var ti9g = getAmt('itr7.partBTI.exemptionUs10_23FB');
	var ti9h = getAmt('itr7.partBTI.exemptionUs10_24');
	var ti9i = getAmt('itr7.partBTI.exemptionUs10_46');
	var ti9j = getAmt('itr7.partBTI.exemptionUs10_47');
	var ti10 = getAmt('itr7.partBTI.exemptionOtherthenUs10');
	
		
	//Condition 1
	if(exemptClaimed == '23CIIIAB' || exemptClaimed == '23CIIIAC'){
		if(IE3_4 < (0.5 * IE3_3)){
			IE3 = IE3_3;
		}
	}
	//Condition 2
	if(exemptClaimed == '23CIIIAD' || exemptClaimed == '23CIIIAE'){
		if(IE4_3 > 10000000){
			IE4 = IE4_3;
		}
	}
	//condition 3
	
	var afterDueDate = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.incomeTaxSec')[0].value;
	
	if( exemptClaimed == '47'  && afterDueDate == '12'){
		IE1 = IE1_1;
	}
	//condition 4
	if(IE1_1 > 0){
		
		if(ti8a == 0 && ti8b == 0 && ti8d == 0 && ti8e == 0 && ti8f == 0 && ti8g == 0 && ti8h == 0 && 
				ti8i == 0 && ti9e == 0 && ti9f == 0 && ti9g == 0 && ti9i == 0 && ti9j == 0 && ti10 == 0){
			
			if(exemptClaimed == '21' || exemptClaimed == '22B' || exemptClaimed == '23AAA' || exemptClaimed == '23B' || exemptClaimed == '23D' ||
					exemptClaimed == '23DA' || exemptClaimed == '23EC' || exemptClaimed == '23ED' || exemptClaimed == '23EE' || exemptClaimed == '29A' ||
					exemptClaimed == '26' || exemptClaimed == '47' || exemptClaimed == '23FB' || exemptClaimed == '20' || exemptClaimed == '23AA' ||
					exemptClaimed == '23AAB' || exemptClaimed == '23BB' || exemptClaimed == '23BBA' || exemptClaimed == '23BBC' || exemptClaimed == '23BBE' ||
					exemptClaimed == '23BBG' || exemptClaimed == '23BBH' || exemptClaimed == '23CI' || exemptClaimed == '23CII' || exemptClaimed == '23CIII' ||
					exemptClaimed == '23CIIIA' || exemptClaimed == '23CIIIAA' || exemptClaimed == '23CIIIAAA' || exemptClaimed == '25I' || exemptClaimed == '25II' ||
					exemptClaimed == '25III' || exemptClaimed == '25IV' || exemptClaimed == '25V' || exemptClaimed == '25A' || exemptClaimed == '26AAB' ||
					exemptClaimed == '26B' || exemptClaimed == '26BB' || exemptClaimed == '26BBB' || exemptClaimed == '44' ){
				
				IE1 = IE1_1;
			}
		}
	}
	//condition 5
	if(IE2_A1 > 0){
		if(exemptClaimed == '23A' || exemptClaimed == '24'){
			if(ti8c == 0 && ti9h == 0){
				IE2 = IE2_A1;
			}
		}
	}
	//condition 6
	if(IE3_3 > 0){
		if(exemptClaimed == '23CIIIAB' || exemptClaimed == '23CIIIAC'){
			if(ti9a == 0 && ti9b == 0){
				IE3 = IE3_3;
			}
		}
	}	
	//condition 7
	if(IE4_3 > 0){
		if(exemptClaimed == '23CIIIAD' || exemptClaimed == '23CIIIAE'){
			if(ti9c == 0 && ti9d == 0){
				IE4 = IE4_3;
			}
		}
	}	
	//condition 8
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	var flag = false;
	
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		
		if( $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value == "VI"){
			flag = true;		
		}
	}
	if(flag == true){
		if(ti8a > 0 || ti8b > 0 || ti8c > 0 || ti8d > 0 || ti8e > 0 || ti8f > 0 || ti8g > 0 || ti8h > 0 || ti8i > 0
				|| ti9e > 0 || ti9f > 0 || ti9g > 0 || ti9h > 0 || ti9i > 0 || ti9j > 0 || ti10 > 0){
			
			IE1 = IE1_1
			IE2 = IE2_A1;
			
		}
	}
	
	//condition 9
	flag = false;
	var regSec = "";
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		regSec = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value;
		if( regSec == "II" || regSec == "III" || regSec == "IV" || regSec == "V" ){
			flag = true;		
		}
	}
	if(flag == true){
		if(ti8a > 0 || ti8b > 0 || ti8c > 0 || ti8d > 0 || ti8e > 0 || ti8f > 0 || ti8g > 0 || ti8h > 0 || ti8i > 0
				|| ti9a > 0 || ti9b > 0 || ti9c > 0 || ti9d > 0 || ti9e > 0 || ti9f > 0 || ti9g > 0 || ti9h > 0 || ti9i > 0 || ti9j > 0 || ti10 > 0){
			
			IE1 = IE1_1
			IE2 = IE2_A1;
			IE3 = IE3_3;
			IE4 = IE4_3;
		}
	}
	$('[name="itr7.scheduleOS.incOthThanOwnRaceHorse.anyOtherIncomeExemptUS10"]')[0].value = IE1 + IE2 + IE3 + IE4;
	schedueOsCalc();
}
function enableSchTi(){
	
	var exemptClaimed = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	//8a
	if(exemptClaimed == '21' || exemptClaimed == '2135I')  {
		document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs1021')[0].value = "";
	}
	
	//8b
	if(exemptClaimed == '22B')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0].value = "";
	}	
	
	//8c
	if(exemptClaimed == '23A')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0].value = "";
	}
	//8d
	var flag = false;
	if(exemptClaimed == '23AAA')  {
		var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
		for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
			
			if( $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value == "I"){
				flag = true;
				document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].disabled = false;
				document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].readOnly = false;
			}
		}
	}else if(flag == false){
		document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0].value = "";
	}
	
	//8e
	if(exemptClaimed == '23B')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0].value = "";
	}
	
	//8f
	if(exemptClaimed == '23EC')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0].value = "";
	}
	//8g
	if(exemptClaimed == '23ED')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0].value = "";
	}
	//8h
	if(exemptClaimed == '23EE')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0].value = "";
	}
	//8i
	if(exemptClaimed == '29A')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0].value = "";
	}
	
	//9A
	if(exemptClaimed == '23CIIIAB')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0].value = "";
	}
	//9b
	if(exemptClaimed == '23CIIIAC')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0].value = "";
	}
	//9c 
	if(exemptClaimed == '23CIIIAD')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0].value = "";
	}
	//9d
	if(exemptClaimed == '23CIIIAE')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0].value = "";
	}
	//9e
	if(exemptClaimed == '23D')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0].value = "";
	}
	//9f
	if(exemptClaimed == '23DA')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0].value = "";
	}
	//9g
	if(exemptClaimed == '23FB')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0].value = "";
	}
	//9h
	if(exemptClaimed == '24')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0].value = "";
	}
	//9i
	if(exemptClaimed == '26')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0].value = "";
	}
	//9j
	if(exemptClaimed == '47')  {
		document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0].value = "";
	}
	//10
	var retFurSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;
	if(retFurSec == 'OTH')  {
		document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0].value = "";
	}
	//11
	if(exemptClaimed == '21' || exemptClaimed == '2135I')  {
		document.getElementsByName('itr7.partBTI.incChargeableUs11_3')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.incChargeableUs11_3')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.incChargeableUs11_3')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.incChargeableUs11_3')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.incChargeableUs11_3')[0].value = "";
	}
	//12a
	if(exemptClaimed == '13A')  {
		document.getElementsByName('itr7.partBTI.exemptionUs13_A')[0].disabled = false;
		document.getElementsByName('itr7.partBTI.exemptionUs13_A')[0].readOnly = false;
	}else{
		document.getElementsByName('itr7.partBTI.exemptionUs13_A')[0].disabled = true;
		document.getElementsByName('itr7.partBTI.exemptionUs13_A')[0].readOnly = true;
		document.getElementsByName('itr7.partBTI.exemptionUs13_A')[0].value = "";
	}
	calculateTiTti();
}
function valSch_Ti_8(elm){
	IE1_1 = getAmt('itr7.scheduleIE1.totalReceipts');
	if(elm.value > IE1_1){
		j.setFieldError(elm.name,'Exemption claimed is greater than the receipts entered in IE1');
		addErrorXHTML(elm,'Exemption claimed is greater than the receipts entered in IE1',true);
	
	}
	/*var flag = false;	
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		
		if( $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value == "VI"){
			flag = true;
		}
	}
	if(flag == true  && elm.value > 0){
		j.setFieldError(elm.name,'Exemption u/s 10 is not allowable if assessee is registered u/s 12A/12AA. Refer section 11(7)');
		addErrorXHTML(elm,'Exemption u/s 10 is not allowable if assessee is registered u/s 12A/12AA. Refer section 11(7)',true);
	}
	
	flag = false;
	var secUdrAppr = "";
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		secUdrAppr = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value;
		
		if( secUdrAppr == "II" || secUdrAppr == "III" || secUdrAppr == "IV" || secUdrAppr == "V"){
			flag = true;
		}
	}
	if(flag == true  && elm.value > 0){
		j.setFieldError(elm.name,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).');
		addErrorXHTML(elm,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).',true);
	}*/
	
}
function valSch_Ti_8_IE2(elm){
	IE2_A1 = getAmt('itr7.scheduleIE2.totalReceiptsContribution');
	if(elm.value > IE2_A1){
		j.setFieldError(elm.name,'Exemption claimed is greater than the receipts entered in IE2');
		addErrorXHTML(elm,'Exemption claimed is greater than the receipts entered in IE2',true);
	
	}
	/*var flag = false;	
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		
		if( $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value == "VI"){
			flag = true;
		}
	}
	if(flag == true  && elm.value > 0){
		j.setFieldError(elm.name,'Exemption u/s 10 is not allowable if assessee is registered u/s 12A/12AA. Refer section 11(7)');
		addErrorXHTML(elm,'Exemption u/s 10 is not allowable if assessee is registered u/s 12A/12AA. Refer section 11(7)',true);
	}
	
	flag = false;
	var secUdrAppr = "";
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		secUdrAppr = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value;
		
		if( secUdrAppr == "II" || secUdrAppr == "III" || secUdrAppr == "IV" || secUdrAppr == "V"){
			flag = true;
		}
	}
	if(flag == true  && elm.value > 0){
		j.setFieldError(elm.name,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).');
		addErrorXHTML(elm,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).',true);
	}*/
	
}
function valSch_Ti_9_IE3(elm){
	var IE3_3 = 0;
	var noOfRows = $('#scheduleIE3 tr').length;
	var indexValue = parseInt(noOfRows - 4);
	for(var i = 0 ; i < indexValue ; i++){
		IE3_3 = IE3_3 + getAmt('itr7.scheduleIE3.incomeExpenditureStmt3ABC['+i+'].totalContributionReceipts');
	}
	
	if(elm.value > IE3_3){
		j.setFieldError(elm.name,'Exemption claimed is greater than the receipts entered in IE3');
		addErrorXHTML(elm,'Exemption claimed is greater than the receipts entered in IE3',true);
	
	}
	/*var flag = false;	
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	var secUdrAppr = "";
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		secUdrAppr = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value;
		
		if( secUdrAppr == "II" || secUdrAppr == "III" || secUdrAppr == "IV" || secUdrAppr == "V"){
			flag = true;
		}
	}
	if(flag == true  && elm.value > 0){
		j.setFieldError(elm.name,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).');
		addErrorXHTML(elm,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).',true);
	}*/
	
}
function valSch_Ti_9_IE4(elm){
	var IE4_3 = 0;
	var noOfRows = $('#scheduleIE4 tr').length;
	var indexValue = parseInt(noOfRows - 4);
	for(var i = 0 ; i < indexValue ; i++){
		IE4_3 = IE4_3 + getAmt('itr7.scheduleIE4.incomeExpenditureStmt3ADE['+i+'].grossAnnualReceipts');		
	}
	
	if(elm.value > IE4_3){
		j.setFieldError(elm.name,'Exemption claimed is greater than the receipts entered in IE4');
		addErrorXHTML(elm,'Exemption claimed is greater than the receipts entered in IE4',true);
	
	}
	/*var flag = false;	
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	var secUdrAppr = "";
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		secUdrAppr = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value;
		
		if( secUdrAppr == "II" || secUdrAppr == "III" || secUdrAppr == "IV" || secUdrAppr == "V"){
			flag = true;
		}
	}
	if(flag == true  && elm.value > 0){
		j.setFieldError(elm.name,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).');
		addErrorXHTML(elm,'Exemption u/s 10 is not allowable if assessee is approved u/s 10(23C)(iv)/(v)/(vi)/(via).',true);
	}*/
	
}
function schTti_sec35(elm){
	var flag = false;	
	var noOfRowsRejApprovalDtls = ($('#rejApprovalDtls tr').length - 2) ;
	var secUdrAppr = "";
	for(var i = 0; i < noOfRowsRejApprovalDtls; i++){
		secUdrAppr = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration"]')[0].value;
		
		if( secUdrAppr == "IX"){
			flag = true;
		}
	}
	if(flag == false  && elm.value > 0){
		j.setFieldError(elm.name,'Please enter the approval details u/s 35 in table "Details of registration or approval under the Income-tax Act"');
		addErrorXHTML(elm,'Please enter the approval details u/s 35 in table "Details of registration or approval under the Income-tax Act"',true);
	}
}

function validateTI4iii(){
	
	var table = document.getElementById('rejApprovalDtls');
	var noOfRows = table.rows.length;
	var flag = false;
	var validateTI4iiiFlag=false;
	var amtAppForCharitable = document.getElementsByName('itr7.partBTI.tiDeductions.amtAppForCharitablePurposeRepayment')[0].value;
	for(var i = 0; i < parseInt(noOfRows-2); i++)
	{
		var secRegApproved=document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration')[0].value;
		
		if((secRegApproved == "I" || secRegApproved == "VIII" || secRegApproved == "IX") && amtAppForCharitable>0){
			validateTI4iiiFlag = true;
			break;
		}
		
	}
	if(validateTI4iiiFlag)
	{
		addErrorXHTML('', 'Sr.no. 4iii of Part B-TI is  applicable for persons claiming exemption under sections 11 OR 10(23C)(iv) OR 10(23C)(v) OR 10(23C)(vi) OR 10(23C)(via) only');
		j.setFieldError('itr7.partBTI.tiDeductions.amtAppForCharitablePurposeRepayment','Sr.no. 4iii of Part B-TI is  applicable for persons claiming exemption under sections 11 OR 10(23C)(iv) OR 10(23C)(v) OR 10(23C)(vi) OR 10(23C)(via) only');
		
	}
	
	
}


function validateTI4v(){
	
	var table = document.getElementById('rejApprovalDtls');
	var noOfRows = table.rows.length;
	var flag = false;
	var validateTI4v12AA=false;
	var validateTI4v12Others=false;
	
	var tempPer1 = 0;
	var tempPer2 = 0;
	
	var temp1 = 0;
	var temp2 = 0;
	temp1 = eval(
			parseInt(coalesceSetRet('itr7.partBTI.vcCorpusSec11'),10)
			+ parseInt(coalesceSetRet('itr7.partBTI.aggregateIncomeUs1112'),10));
	temp2 = eval(
			parseInt(coalesceSetRet('itr7.partBTI.vcCorpusSec11'),10)
			+ parseInt(coalesceSetRet('itr7.partBTI.voluntaryContributions.totIncFromVC'),10)
			+ parseInt(coalesceSetRet('itr7.partBTI.aggregateIncomeUs1112'),10)
			);
	//tempPer1 = zeroOrMore(coalesce(Math.round(eval(parseInt(document.getElementsByName('temp1')[0].value==""?0:document.getElementsByName('temp1')[0].value) * 0.15 ))));
	tempPer1 = zeroOrMore(coalesce(Math.round(eval(parseInt((temp1)== "" ? 0 : (temp1)* 0.15)))));
	
	tempPer2 = zeroOrMore(coalesce(Math.round(eval(parseInt((temp2)== "" ? 0 : (temp2)* 0.15)))));
	
	var amtAppForCharitable = document.getElementsByName('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable')[0].value;
	for(var i = 0; i < parseInt(noOfRows-2); i++)
	{
		var checkbox = $('[name="itr7.partAGEN1.rejApprovalDtls['+i+'].regSecExmpClaimed"]')[0].value;		
		var secRegApproved=document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+i+'].secUnderRegistration')[0].value;
		
		if(secRegApproved == "VI"  && amtAppForCharitable>tempPer1 && checkbox=="true"){
			validateTI4v12AA = true;
			break;
		}
		
		if((secRegApproved == "II" || secRegApproved == "III" || secRegApproved == "IV" || secRegApproved == "V" ) && amtAppForCharitable>tempPer2 && checkbox=="true"){
			validateTI4v12Others = true;
			break;
		}
		
	}
	if(validateTI4v12AA)
	{
		addErrorXHTML('', 'The maximum amount accumulated cannot exceed 15 per cent of income derived from property under section 11(1)(a)/11(1)(b)');
		j.setFieldError('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable','The maximum amount accumulated cannot exceed 15 per cent of income derived from property under section 11(1)(a)/11(1)(b)');		
	}
	
	if(validateTI4v12Others)
	{
		addErrorXHTML('', 'The maximum amount accumulated cannot exceed 15 per cent of income derived from property under  third proviso to section 10(23C)');
		j.setFieldError('itr7.partBTI.tiDeductions.amtAccumulatedForCharitable','The maximum amount accumulated cannot exceed 15 per cent of income derived from property under  third proviso to section 10(23C)');		
	}
	
}
function validateSchTi(){
	
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs1021')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_22B')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23AAA')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23B')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23EC')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23ED')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23EE')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_29A')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23D')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23DA')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_23FB')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_46')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionUs10_47')[0]);
	valSch_Ti_8(document.getElementsByName('itr7.partBTI.exemptionOtherthenUs10')[0]);
	
	valSch_Ti_8_IE2(document.getElementsByName('itr7.partBTI.exemptionUs10_23A')[0]);
	valSch_Ti_8_IE2(document.getElementsByName('itr7.partBTI.exemptionUs10_24')[0]);
	
	valSch_Ti_9_IE3(document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiab')[0]);
	valSch_Ti_9_IE3(document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiac')[0]);
	
	valSch_Ti_9_IE4(document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiad')[0]);
	valSch_Ti_9_IE4(document.getElementsByName('itr7.partBTI.exemptionUs10_23Ciiiae')[0]);
	
	
	schTti_sec35(document.getElementsByName('itr7.partBTI.exemptionUs1021')[0]);
	schTti_sec35(document.getElementsByName('itr7.partBTI.incChargeableUs11_3')[0]);
}
function enableTDSGrossAmt(elem){
	var index = parseInt(elem.name.substring(elem.name.indexOf("[") + 1, elem.name.indexOf("]")));
	if(elem.value == "NA"){
		document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+index+'].grossAmount')[0].disabled = true;
		document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+index+'].grossAmount')[0].readOnly = true;
		document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+index+'].grossAmount')[0].value = "";
	}else{
		document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+index+'].grossAmount')[0].disabled = false;
		document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+index+'].grossAmount')[0].readOnly = false;
		
	}
}
function valTDSGrossAmt(){
	
	var noOfRows = $('#scheduleTDS2 tr').length;
	var index = noOfRows - 6;
	var headOfIncome = "";
	var taxCreditedOwnHands = 0;
	
	for (var i = 0; i < index ; i++){
		
		taxCreditedOwnHands = getAmt('scheduleTDS2.tdSonOthThanSal['+i+'].taxDeductCreditDtls.taxCreditedOwnHands');
		headOfIncome = document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+i+'].headOfIncome')[0].value;
		if(taxCreditedOwnHands > 0 && headOfIncome != "NA"){
			
			if(document.getElementsByName('scheduleTDS2.tdSonOthThanSal['+i+'].grossAmount')[0].value == ""){
				
				addErrorXHTML(
						document
								.getElementsByName('scheduleTDS2.tdSonOthThanSal['
										+ i
										+ '].grossAmount')[0],
						'Please enter the amount in Gross Amount field in schedule TDS1',
						true);
				j.setFieldError('scheduleTDS2.tdSonOthThanSal[' + i + '].grossAmount',
								'Please enter the amount in "Gross Amount" field in schedule TDS1');
			}
		}
	}
}
function emptyPTI(){
	
	var mytable = document.getElementById('schedulePTI');
	var listOfInputs = mytable.getElementsByTagName('input');
	
	var noOfRows = $('#schedulePTI tr').length;
	var indexValue = eval(parseInt(((noOfRows - 3) / 15)));
	
	for(var i = 0 ; i < indexValue ; i++){
		
		var investmntUs = document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].investmntUs')[0].value;
		var businessName = document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].businessName')[0].value;
		var pan = document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].pan')[0].value;
		
		if(investmntUs == "" && businessName == "" && pan == ""){
			document.getElementsByName('itr7SchedulePTI.schedulePTI['+i+'].chosenCheckBox')[0].checked = true;
			deleteRowPTI2('schedulePTI',1,2);
		}
	}
}
function enableProjectinstitute(){

	var subStatus = document.getElementsByName('itr7.partAGEN1.orgFirmInfo.substatusOrCompanyType')[0].value;
	if(subStatus == '5vii'){
		
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.projectinstitute')[0].value = '';
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.projectinstitute')[0].readOnly = true;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.projectinstitute')[0].disabled = true;
		enableProjDtls();
	}else{
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.projectinstitute')[0].readonly = false;
		document.getElementsByName('itr7.partAGEN1.orgFirmInfo.address.projectinstitute')[0].disabled = false;
	}

}

function valRegSecCheckbox(){
	var tab = document.getElementById('rejApprovalDtls');
	var len = tab.rows.length-2;
	var checkedFlag = false
	var secFlag = false
	for(var i = 0; i < len; i++) {
		
		if(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].regSecExmpClaimed')[0].value == 'true'){
			checkedFlag = true
		}
		if(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].secUnderRegistration')[0].value != ""){
			secFlag = true
		}
	}
	if(secFlag == true && checkedFlag == false){
		addErrorXHTML('', 'Please select the registration section for which exemption will be claimed in the return');
		j.setFieldError('itr7.partAGEN1.rejApprovalDtls[0].regSecExmpClaimed','Please select the registration section for which exemption will be claimed in the return');		

	}
}
function valRetFurnishedSec(){
	var tab = document.getElementById('rejApprovalDtls');
	var len = tab.rows.length-2;
	var section = ''
	for(var i = 0; i < len; i++) {
		
		if(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].regSecExmpClaimed')[0].value == 'true'){
			section = document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].secUnderRegistration')[0].value;
		}
	}
	var retFurSec = document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0].value;
	var exemptSec = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	
	if((section == 'VI') 
			&& (retFurSec == '139-4B' || retFurSec == '139-4D' || retFurSec == 'OTH')){
		
		addErrorXHTML(document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0], 'There is a mismatch of registration section selected in field "indicate the registration section based on which exemption is claimed in the return" and section selected in field "Return furnished under section":  Please  enter the correct details.');
		j.setFieldError('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec','There is a mismatch of registration section selected in field indicate the registration section based on which exemption is claimed in the return and section selected in field Return furnished under section:  Please  enter the correct details.');		
	
	}else if((section == 'I' ||section == 'II' ||section == 'III' ||section == 'IV' ||section == 'V')
			&& (retFurSec == '139-4A' || retFurSec == '139-4B' || retFurSec == '139-4D' || retFurSec == 'OTH')){
		
		addErrorXHTML(document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0], 'There is a mismatch of registration section selected in field "indicate the registration section based on which exemption is claimed in the return" and section selected in field "Return furnished under section":  Please  enter the correct details.');
		j.setFieldError('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec','There is a mismatch of registration section selected in field indicate the registration section based on which exemption is claimed in the return and section selected in field Return furnished under section:  Please  enter the correct details.');		
		
	}else if((section == 'VIII')
			&& (retFurSec == '139-4A' || retFurSec == '139-4C' || retFurSec == '139-4D' || retFurSec == 'OTH')){
		
		addErrorXHTML(document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0], 'There is a mismatch of registration section selected in field "indicate the registration section based on which exemption is claimed in the return" and section selected in field "Return furnished under section":  Please  enter the correct details.');
		j.setFieldError('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec','There is a mismatch of registration section selected in field indicate the registration section based on which exemption is claimed in the return and section selected in field Return furnished under section:  Please  enter the correct details.');		
		
	}else if((section == 'IX')
			&& (retFurSec == '139-4A' || retFurSec == '139-4B' || retFurSec == 'OTH')){
		
		addErrorXHTML(document.getElementsByName('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec')[0], 'There is a mismatch of registration section selected in field "indicate the registration section based on which exemption is claimed in the return" and section selected in field "Return furnished under section":  Please  enter the correct details.');
		j.setFieldError('itr7.partAGEN1.filingStatus.returnFileSec.returnFurnishedSec','There is a mismatch of registration section selected in field indicate the registration section based on which exemption is claimed in the return and section selected in field Return furnished under section:  Please  enter the correct details.');		
		
	}
}
function valExemptSec(){
	var tab = document.getElementById('rejApprovalDtls');
	var len = tab.rows.length-2;
	var section = ''
	for(var i = 0; i < len; i++) {
		
		if(document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].regSecExmpClaimed')[0].value == 'true'){
			section = document.getElementsByName('itr7.partAGEN1.rejApprovalDtls['+ i +'].secUnderRegistration')[0].value;
		}
	}
	
	var exemptSec = document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0].value;
	if(section == 'VIII' && exemptSec != '13B'){
		
		addErrorXHTML(document.getElementsByName('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed')[0], 'There is a mismatch of registration section selected in field indicate the registration section based on which exemption is claimed in the return and section selected in field Please specify the section under which the exemption is claime :  Please  enter the correct details.');
		j.setFieldError('itr7.partAGEN1.filingStatus.secUnderExemptionClaimed','There is a mismatch of registration section selected in field indicate the registration section based on which exemption is claimed in the return and section selected in field Please specify the section under which the exemption is claime :  Please  enter the correct details.');		
		
	}
	
}
function valCGDropDownOnSave(){
	var noOfBody= $('#ltcg10pctTab tbody').length;
	for (var i = 0 ; i < noOfBody ; i++){
		if(document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].asstProvisoUndrSec112')[0].value == ''){
			var cg2a = getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].fullConsideration');
			var cgbi = getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.aquisitCostNoIndex');
			var cgbii = getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.improveCostNoIndex');
			var cgbiii = getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.expOnTrans');
			var cgbiv = getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.totalDedn');
			var cg2c = getAmt('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].balanceCG');
			if(cg2a > 0 || cgbi > 0 || cgbii > 0 || cgbiii > 0 || cgbiv > 0 || cg2c > 0){
				addErrorXHTML('', 'Section is mandatory in dropdown From asset where proviso under section 112(1)/112A is applicable(without indexation),  if any value is more than zero in block B(2) of schedule CG.');
				j.setFieldError('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].asstProvisoUndrSec112','Section is mandatory in dropdown From asset where proviso under section 112(1)/112A is applicable(without indexation),  if any value is more than zero in block B(2) of schedule CG.');						
			}else if((cg2a == 0 && cgbiv == 0 && cg2c == 0 && cgbi == 0 && cgbii == 0 && cgbiii == 0)){
				document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].fullConsideration')[0].value = '';
				document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.aquisitCostNoIndex')[0].value = '';
				document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.improveCostNoIndex')[0].value = '';
				document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.expOnTrans')[0].value = '';
				document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].deductSec48.totalDedn')[0].value = '';
				document.getElementsByName('itr7.scheduleCG.longTermCapGain.assetProvisoUs112_112A['+ i +'].balanceCG')[0].value = '';
			}
		}
	}
		
}
function calculatePercentageSharePrpty()
{
	var totHp = eval(parseInt(document.getElementById('scheduleHPLast').cells[0].textContent) - 1);

	for (var i = 0; i < totHp; i++) {
		var tempName = 'itr7.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('itr7.scheduleHP.propertyDetails[' + i
						+ '].coOwners[' + j + '].percentShareProperty')[0].value)));
				
			}
			if(assessePercentShareProp < 0){
				assessePercentShareProp = 0;
				document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i + '].asseseeShareProperty')[0].value=assessePercentShareProp.toFixed(2);
				addErrorXHTML(document .getElementsByName('itr7.scheduleHP.propertyDetails['+i+'].asseseeShareProperty')[0],'Sum of Assessee Percentage and Co-owner(s) Percentage should be equal to 100 percent',true);
				j.setFieldError('itr7.scheduleHP.propertyDetails['+i+'].asseseeShareProperty','Sum of Assessee Percentage and Co-owner(s) Percentage should be equal to 100 percent');
			
			}
			document.getElementsByName('itr7.scheduleHP.propertyDetails[' + i + '].asseseeShareProperty')[0].value=assessePercentShareProp.toFixed(2);
		}
	}
}
function valOsDtaa(){
	var passThruInc =  getAmt('itr7.scheduleOS.incOthThanOwnRaceHorse.natPassThrIncome');
	
	if(passThruInc < 0){
		
		var noOfRows = $('#scheduleOsNriIncTaxDtaa tr').length;
		var rowCount = noOfRows - 2;
		
		for(var i = 0 ; i < rowCount ; i++){
			var itemIncluded = document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+ i +'].itemIncluded')[0].value
			if(itemIncluded == '56'){
				addErrorXHTML(document.getElementsByName('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+i+'].itemIncluded')[0],'If Interest from pass through income is negative, DTAA for interest should not be allowed',true);
				j.setFieldError('itr7.scheduleOS.incChargblSplRateOS.nriIncTaxDtaa['+i+'].itemIncluded','If Interest from pass through income is negative, DTAA for interest should not be allowed');
			
			}
		}
	}
}
function enableSchedules(){
	enableSchHP();
	enableScheduleLA();
	enableSchET();
	enableSchAI();
	enableSchVC();
	enableSchEREC();
	enableSchIESeries();
	enableSchCG();
	enableSchBP();
	enableSchOS();
	enableSchTi();
}

