﻿/// <reference path="..\jquery-1.4.2-vsdoc.js"/>
/// <reference path="TypeAhead.js"/>

(function($) {
	var ProgramOptions = {
		_baseOptions: {
			minLength: 1,
			selectFirst: true,
			noDataMessage: "No matching programs available.  Please use the official name of the program.",
			parseItem: function(program, highlighter) {
				var programName = program.Name;
				return {
					data: program,
					value: programName,
					label: highlighter.highlightSearchTerm(programName),
					isReadOnly: false
				};
			}
		},

		getProgramOptions: function(url) {
			var options = ProgramOptions._baseOptions;
			options.sourceUrl = url;
			return $.getTypeAheadOptions().extendBaseServerOptions(options);
		}
	};

	$(function() {
		$.getTypeAheadOptions().addTypeAheadOptions(ProgramOptions);
	});
})(jQuery);
if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();