<!-- Original:  Jerome Caron (jerome.caron@globetrotter.net) -->

// Build Array of Categories & Subcategories

	subcategory = new Array(
	
		new Array(
		new Array("Another Site", "Another Site"),
		new Array("Google", "Google"),
		new Array("Yahoo", "Yahoo"), 
		new Array("Other", "Other")
		),
	
		new Array(
		new Array("Newspaper", "Newspaper"), 
		new Array("Mailer", "Mailer")
		),
		
		new Array(
		new Array("Bell", "Bell"),
		new Array("The Phone Guide", "The Phone Guide")
		),
	
		new Array(
		new Array("Patient", "Patient"), 
		new Array("Optometrist", "Optometrist")
		)
	
	);

	function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
		var i, j;
		var prompt;
		// empty existing items
		for (i = selectCtrl.options.length; i >= 0; i--) {
			selectCtrl.options[i] = null; 
		}
		prompt = (itemArray != null) ? goodPrompt : badPrompt;
		if (prompt == null) {
			j = 0;
		} else {
			selectCtrl.options[0] = new Option(prompt);
			j = 1;
		}
		if (itemArray != null) {
		// add new items
			for (i = 0; i < itemArray.length; i++) {
				selectCtrl.options[j] = new Option(itemArray[i][0]);
				if (itemArray[i][1] != null) {
					selectCtrl.options[j].value = itemArray[i][1]; 
				}
				j++;
			}
			// select first item (prompt) for sub list
			selectCtrl.options[0].selected = true;
   		}
	}

