function buildChildrenAges() {
	
	var xChildren = document.getElementById("cChildren");
	var xChildIdx = xChildren.selectedIndex;
	var cCount = xChildren[xChildIdx].value;
	var setChild = cSetChildren;
	var txt = itxt = "";
	
	if (cCount == 0) {
		document.getElementById("cChildAgeCount").value = 0;
		document.getElementById("divChildren").innerHTML = "<select class=\"bSelA\" name=\"cChildAge0\" id=\"cChildAge0\" style=\"margin-right: 5px\" disabled=\"disabled\"><option value=\"0\">No Children</option></select>";
	} else {	
		document.getElementById("cChildAgeCount").value = cCount;
		var y = 0;
		itxt = itxt + "<option value=\"0\">&nbsp;</option>";
		for (y = 2; y < 19; y++) itxt = itxt + "<option value=\"" + y + "\">" + y + "</option>";
			
		var x = 0;
		for (x = 0; x < cCount; x++) {
			txt = txt + "<select class=\"bSelA\" name=\"cChildAge" + x + "\" id=\"cChildAge" + x + "\" style=\"margin-right: 5px\">" + itxt + "</select>";
		}
		txt = txt + "<input type=\"hidden\" id=\"cChildAge\" name=\"cChildAge\" value=\"\" />";
		document.getElementById("divChildren").innerHTML = txt;
	}

	if (setChild.length > 0) {
		var setArray = setChild.split("|");
		for (x =0; x < cCount; x++){
			setValue(1, "cChildAge" + x, setArray[x]);
		}
	}

}

function popChildrenAges(inChildrenAges) {
	
	var xChildren = document.getElementById("cChildren");
	var xChildIdx = xChildren.selectedIndex;
	var cArray = inChildrenAges.split("|");
	var txt = itxt = "";
	var cCount = xChildren[xChildIdx].value;
	var setChild = cSetChildren;

	if (cCount == 0) {
		document.getElementById("cChildAgeCount").value = 0;
		document.getElementById("divChildren").innerHTML = "<select class=\"bSelA\" name=\"cChildAge0\" id=\"cChildAge0\" style=\"margin-right: 5px\" disabled=\"disabled\"><option value=\"0\">No Children</option></select><input type=\"hidden\" name=\"cChildAge\" value=\"\" />";
	} else {	
		document.getElementById("cChildAgeCount").value = cCount;
		var y = 0;
		itxt = itxt + "<option value=\"0\">&nbsp;</option>";
		for (y = 2; y < 19; y++) itxt = itxt + "<option value=\"" + y + "\">" + y + "</option>";
			
		var x = 0;
		for (x = 0; x < cCount; x++) {
			txt = txt + "<select class=\"bSelA\" name=\"cChildAge" + x + "\" id=\"cChildAge" + x + "\" style=\"margin-right: 5px\">" + itxt + "</select>";
		}
		txt = txt + "<input type=\"hidden\" id=\"cChildAge\" name=\"cChildAge\" value=\"\" />";
		document.getElementById("divChildren").innerHTML = txt;
		for (x = 0; x < cCount; x++) {
			setValue(1, "cChildAge" + x, cArray[x], 0)	;
		}
		
	}

	if (setChild.length > 0) {
		var setArray = setChild.split("|");
		for (x =0; x < cCount; x++){
			setValue(1, "cChildAge" + x, setArray[x]);
		}
	}
}