<!--
	function repopulateChildSelect(ParentSelect, childSelect, ParentArrayName) {	
		var lngListIndex=0;

		if (typeof(childSelect.length) == "undefined"){  }
		else {
			// clear Child department list box's
			for (var i = 0 ; i < childSelect.length ;i++) {
				childSelect.options[i] = null;
				childSelect.options.length = 0;
			}						

			var lngDeptID =  ParentSelect.options[ParentSelect.selectedIndex].value

			var arrChildren = eval(ParentArrayName + "['" + lngDeptID + "']");
			var lngChildrenCount = 0;
			if (typeof(arrChildren)!= "undefined") { lngChildrenCount = arrChildren.length;}

			if (lngDeptID =='0' || lngChildrenCount == 0){ //CASE : Selected is All
				childSelect.options[0]  = new Option('All', '0');
				// Add for "ALL"			
				for (var k=0; k < lngChildrenCount; k++) {
					var arrDetails = arrChildren[k].split("_");
					childSelect.options[1 + lngListIndex++] = new Option(arrDetails[1], arrDetails[0]);
				}
			}else{
				for (var k=0; k < lngChildrenCount; k++) {
					var arrDetails = arrChildren[k].split("_");
					childSelect.options[lngListIndex++] = new Option(arrDetails[1], arrDetails[0]);
				}					
			}//END OF CASE : Selected is All
		} // end of childSelect is defined case
	}	
	
	function repopulateListBoxChildSelect(ParentSelect, childSelect, ParentArrayName) {	
		var lngListIndex=0;

		if (typeof(childSelect.length) == "undefined"){  }
		else {
			// clear Child department list box's
			for (var i = 0 ; i < childSelect.length ;i++) {
				childSelect.options[i] = null;
				childSelect.options.length = 0;
			}						

			var lngDeptGroupID =  ParentSelect.options[ParentSelect.selectedIndex].value
			var lngDeptID
			var arrChildren
			var lngChildrenCount
			var intPos
			var lngDeptGroup

			for(i=0;i<ParentSelect.options.length;i++)
			{
				if(ParentSelect.options[i].selected){
					lngDeptGroupID = ParentSelect.options[i].value
					intPos = lngDeptGroupID.indexOf("|")
					if(intPos > 0) {

						lngDeptID = lngDeptGroupID.substring(intPos + 1, intPos + (lngDeptGroupID.length - (intPos)))

						if(lngDeptID.substring(1,2) =='|0'){
							//do nothing
						}else{
							
							arrChildren = eval(ParentArrayName + "['" + lngDeptID + "']");
							
							lngChildrenCount = 0;
							if (typeof(arrChildren)!= "undefined") { lngChildrenCount = arrChildren.length;}

							for (var k=0; k < lngChildrenCount; k++) {
								var arrDetails = arrChildren[k].split("_");
								if(k==0){
									//force 1st value to "All"
									intPos = arrDetails[0].indexOf("|")
									lngDeptGroup = arrDetails[0].substring(0, intPos)
									childSelect.options[0]  = new Option('All', lngDeptGroup + '|0'); 
								}
								childSelect.options[++lngListIndex] = new Option(arrDetails[1], arrDetails[0]);
							}		
						}
					}
				}
			}
		} // end of childSelect is defined case
	}

//KYCHUA VOG Internship
/**********************************************************************************************************
' Function Desc: 
' Created by: Chua Kian Yang
' Date: 09 Sep 2010
' Input : ProgType
' Used In: forms2\Careers-Gov\programmex.asp
' Modified By: Khoo Chen Hau (Copy From: agena\_include\multiLevelSelect.js)
***********************************************************************************************************/
function repopulateChildSelectProgType(ParentSelect, childSelect, ParentArrayName, SelectedValue) {	
		var lngListIndex=0;								
				
		if (typeof(childSelect.length) == "undefined"){  }
		else {
			// clear Child list box's
			for (var i = 0 ; i < childSelect.length ;i++) {				
				childSelect.options[i] = null;
				childSelect.options.length = 0;
			}						
			var arrEncryptedParentId = ParentSelect.options[ParentSelect.selectedIndex].value.split("|");
			var lngDecryptedId = arrEncryptedParentId[arrEncryptedParentId.length-1];		
			
			var arrChildren = eval(ParentArrayName + "['" + lngDecryptedId + "']");
			var lngChildrenCount = 0;
			if (typeof(arrChildren)!= "undefined") { lngChildrenCount = arrChildren.length; }
			
			if (lngDecryptedId =='0' || lngChildrenCount == 0){ //CASE : Selected is All				
				childSelect.options[0]  = new Option('[Select one]', '');
			}else{															
				// reconstruct child list under department								
				if (lngChildrenCount != 0) {// CASE: Parent has children
					for (var k=0; k < lngChildrenCount; k++) {					
						var arrDetails = arrChildren[k].split("_");
						childSelect.options[lngListIndex++] = new Option(arrDetails[1], arrDetails[0]);									
					}					
				}// END OF CASE: Parent has children
			}//END OF CASE : Selected is All
			if (SelectedValue > 0) {
				childSelect.value = SelectedValue
			}
		} // end of childSelect is defined case
}
//-->
