			function clearSelect(obj) {
				eval('len = document.ThisForm.' + obj + '.options.length;');
				for(i=len-1; i>0; i--) {
					eval('document.ThisForm.' + obj + '.options[i] = null;');
				}
			}
			
			function buildShift() {
				clearSelect('Shift');
				len = selectArray.length;
				for(i=0; i<len; i++) {
					Counter = i + 1;
					document.ThisForm.Shift.options[Counter] = new Option(selectArray[i][1], selectArray[i][0], 0, 0);
				}
				len = document.ThisForm.Shift.options.length;
				for(i=0; i<len; i++) {
					if(document.ThisForm.Shift.options[i].value == currentShift) {
						document.ThisForm.Shift.selectedIndex = i;
						break;
					}
				}
				buildLocation();
			}
			
			function buildLocation() {
				clearSelect('Location');
				i = document.ThisForm.Shift.selectedIndex;
				if(i == 0){
					// output all locations
					len = selectArray.length;
					Counter = 1;
					for(ii=0;ii<len;ii++) {
						len2 = selectArray[ii][2].length;
						for(iii=0; iii<len2; iii++) {
							isFound = 0;
							for(iiii=0; iiii<document.ThisForm.Location.options.length; iiii++) {
								if(document.ThisForm.Location.options[iiii].text == selectArray[ii][2][iii][0]){
									isFound = 1;
									break;
								}
							}
							if(!isFound) {
								document.ThisForm.Location.options[Counter] = new Option(selectArray[ii][2][iii][0], selectArray[ii][2][iii][0], 0, 0);
								Counter++;
							}
						}
					}
				}else {
					// output all locations at given shift
					ii = i - 1;
					len = selectArray[ii][2].length;
					for(iii=0; iii<len; iii++) {
						Counter = iii + 1;
						document.ThisForm.Location.options[Counter] = new Option(selectArray[ii][2][iii][0], selectArray[ii][2][iii][0], 0, 0);
					}
				}
				// Sort Select
				sortSelect('Location');
				// Try to set selectedIndex back to the current value
				selectDefault('Location', currentLocation);
	
				buildTitle();
			}
			
			function buildTitle() {
				clearSelect('Title');
				i = document.ThisForm.Shift.selectedIndex
				ii = document.ThisForm.Location.selectedIndex
				if(i == 0){
					if(ii == 0){
						// output all titles
						len = selectArray.length;
						Counter = 1;
						for(iii=0;iii<len;iii++) {
							len2 = selectArray[iii][2].length;
							for(iiii=0; iiii<len2; iiii++) {
								len3 = selectArray[iii][2][iiii][1].length;
								for(iiiii=0; iiiii<len3; iiiii++) {
									isFound = 0;
									for(iiiiii=0; iiiiii<document.ThisForm.Title.options.length; iiiiii++) {
										if(document.ThisForm.Title.options[iiiiii].text == selectArray[iii][2][iiii][1][iiiii]){
											isFound = 1;
											break;
										}
									}
									if(!isFound) {
										document.ThisForm.Title.options[Counter] = new Option(selectArray[iii][2][iiii][1][iiiii], selectArray[iii][2][iiii][1][iiiii], 0, 0);
										Counter++;
									}
								}
							}
						}
					}else {
						// output all titles at given location
						value = document.ThisForm.Location.options[ii].value;
						len = selectArray.length;
						Counter = 1;
						for(iii=0;iii<len;iii++) {
							len2 = selectArray[iii][2].length;
							for(iiii=0; iiii<len2; iiii++) {
								if(selectArray[iii][2][iiii][0] == value) {
									len3 = selectArray[iii][2][iiii][1].length;
									for(iiiii=0; iiiii<len3; iiiii++) {
										isFound = 0;
										for(iiiiii=0; iiiiii<document.ThisForm.Title.options.length; iiiiii++) {
											if(document.ThisForm.Title.options[iiiiii].text == selectArray[iii][2][iiii][1][iiiii]){
												isFound = 1;
												break;
											}
										}
										if(!isFound) {
											document.ThisForm.Title.options[Counter] = new Option(selectArray[iii][2][iiii][1][iiiii], selectArray[iii][2][iiii][1][iiiii], 0, 0);
											Counter++;
										}
									}
								}
							}
						}
					}
				}else {
					if(ii == 0){
						// output all title at given shift
						iii = i - 1;
						len = selectArray[iii][2].length;
						Counter = 1;
						for(iiii=0;iiii<len;iiii++) {
							len2 = selectArray[iii][2][iiii][1].length;
							for(iiiii=0; iiiii<len2; iiiii++) {
								isFound = 0;
								for(iiiiii=0; iiiiii<document.ThisForm.Title.options.length; iiiiii++) {
									if(document.ThisForm.Title.options[iiiiii].text == selectArray[iii][2][iiii][1][iiiii]){
										isFound = 1;
										break;
									}
								}
								if(!isFound) {
									document.ThisForm.Title.options[Counter] = new Option(selectArray[iii][2][iiii][1][iiiii], selectArray[iii][2][iiii][1][iiiii], 0, 0);
									Counter++;
								}
							}
						}
					}else {
						// output all titles at give shift and location
						iii = i - 1;
						value = document.ThisForm.Location.options[ii].value;
						len = selectArray[iii][2].length;
						Counter = 1;
						for(iiii=0;iiii<len;iiii++) {
							if(selectArray[iii][2][iiii][0] == value) {
								len2 = selectArray[iii][2][iiii][1].length;
								for(iiiii=0; iiiii<len2; iiiii++) {
									isFound = 0;
									for(iiiiii=0; iiiiii<document.ThisForm.Title.options.length; iiiiii++) {
										if(document.ThisForm.Title.options[iiiiii].text == selectArray[iii][2][iiii][1][iiiii]){
											isFound = 1;
											break;
										}
									}
									if(!isFound) {
										document.ThisForm.Title.options[Counter] = new Option(selectArray[iii][2][iiii][1][iiiii], selectArray[iii][2][iiii][1][iiiii], 0, 0);
										Counter++;
									}
								}
							}
						}
					}
				}
				// Sort Select
				sortSelect('Title');
				// Try to set selectedIndex back to the current value
				selectDefault('Title', currentTitle);
			}
			
			function selectDefault(selectObj, selectValue) {
				found = 0;
				len = document.ThisForm[selectObj].options.length;
				for(i=0; i<len; i++) {
					if(document.ThisForm[selectObj].options[i].value == selectValue) {
						document.ThisForm[selectObj].selectedIndex = i;
						found = 1;
						break;
					}
				}
				if(found == 0) {
					document.ThisForm[selectObj].selectedIndex = 0;
				}
			}
			
			function sortSelect(obj) {
				options = new Array (document.ThisForm[obj].options.length);
				for(var i = 0; i < options.length; i++) {
					text = document.ThisForm[obj].options[i].text;
					value = document.ThisForm[obj].options[i].value;
					options[i] = new Option (text,value,false,false);
				}
				options.sort(compareText);
				document.ThisForm[obj].options.length = 0;
				for(var i = 0; i < options.length; i++) {
					document.ThisForm[obj].options[i] = options[i];
				}
			}
			
			function compareText(option1, option2) {
				return option1.text < option2.text ? -1 :
					option1.text > option2.text ? 1 : 0;
			}
			
			function setDefaults() {
				currentShift = document.ThisForm.Shift.options[document.ThisForm.Shift.selectedIndex].value;
				currentLocation = document.ThisForm.Location.options[document.ThisForm.Location.selectedIndex].value;
				currentTitle = document.ThisForm.Title.options[document.ThisForm.Title.selectedIndex].value;
			}