function addChild(numChildren, trID, tblID, tdW, showVA) {
	var tblName = document.getElementById(tblID);
	var numRows = tblName.rows.length;

	var mmNames = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");

	if (numChildren.length == 0 || numChildren == 0) {
		for (i=0; i<(numRows - numChildren); i++) {
			tblName.deleteRow();
		}

		//document.getElementById(trID).style.display = 'none';
		$(tblName).removeClass('hideMe').addClass('hideMe');
	}
	else {
		var objTR;
		var objTD;
		
		var now = new Date();
		var thisYear = now.getFullYear();
		var thisHTML = "";
		
		numChildren = parseInt(numChildren) + 1;
		
		if (numChildren > numRows) {
			numChildren = numChildren - numRows;
			for (i=0; i<numChildren; i++) {
				objTR = tblName.insertRow(-1);

				objTD = objTR.insertCell(-1);
				objTD.style.width = tdW +"px";
				objTD.style.paddingBottom = "3px";
				thisHTML = "<input type='text' name='child_name' title='Child Name "+ (numRows+i+1) +"' style='width: 100%' value='Child Name "+ (numRows+i+1) +"' onclick='this.select()' accesskey=''";
				if (navigator.appName.indexOf("Microsoft") >= 0) {
					thisHTML = thisHTML +" class='text c-name'";
				}
				else {
					thisHTML = thisHTML +" class='c-name'";
				}
				thisHTML = thisHTML +" tabindex='1'/>";
				objTD.innerHTML = thisHTML;

				objTD = objTR.insertCell(-1);
				objTD.style.paddingLeft = "5px";
				objTD.style.paddingBottom = "3px";
				thisHTML = "<select name='child_dd' title='Child Date of Birth (day)' tabindex='1' class='c-dob'>";
				thisHTML = thisHTML +"<option value=''>--</option>";
				for (j=1; j<32; j++) {
					thisHTML = thisHTML +"<option value='"+ j +"'>"+ j +"</option>";
				}
				thisHTML = thisHTML +"</select>";
				objTD.innerHTML = thisHTML;
				
				objTD = objTR.insertCell(-1);
				objTD.style.paddingLeft = "5px";
				objTD.style.paddingBottom = "3px";
				thisHTML = "<select name='child_mm' title='Child Date of Birth (month)' tabindex='1' class='c-dob'>";
				thisHTML = thisHTML +"<option value=''>--</option>";
				for (j=1; j<13; j++) {
					thisHTML = thisHTML +"<option value='"+ j +"'>"+ mmNames[j-1] +"</option>";
				}
				thisHTML = thisHTML +"</select>";
				objTD.innerHTML = thisHTML;
				
				objTD = objTR.insertCell(-1);
				objTD.style.paddingLeft = "5px";
				objTD.style.paddingBottom = "3px";
				thisHTML = "<select name='child_yy' title='Child Date of Birth (year)' tabindex='1' class='c-dob'>";
				thisHTML = thisHTML +"<option value=''>----</option>";
				for (j=(thisYear-16); j<(thisYear+5); j++) {
					thisHTML = thisHTML +"<option value='"+ j +"'>"+ j +"</option>";
				}
				thisHTML = thisHTML +"</select>";
				objTD.innerHTML = thisHTML;
				
				if (showVA) {
					objTD = objTR.insertCell(-1);
					objTD.style.width = "100px";
					objTD.style.paddingBottom = "3px";
					objTD.style.textAlign = "center";
					thisHTML = "<input type='hidden' name='child_va' id='child_va"+ (numRows+i) +"' value='0'>";
					thisHTML = thisHTML +"<input type='checkbox' onclick='setVA(this.checked, "+ (numRows+i) +")' tabindex='1'/>";
					objTD.innerHTML = thisHTML;
				}
			}
		}
		else {
			for (i=0; i<(numRows - numChildren); i++) {
				tblName.deleteRow(-1);
			}
		}

		//document.getElementById(trID).style.display = '';
		$(tblName).removeClass('hideMe');
	}
	
	return true;
}

function setVA(isChecked, index) {
	if (isChecked) {
		document.getElementById('child_va'+ index).value = 1
	}
	else {
		document.getElementById('child_va'+ index).value = 0
	}
}
	
