﻿
/*
* jQuery UI Autocomplete Select First Extension
*
* Copyright 2010, Scott González (http://scottgonzalez.com)
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* http://github.com/scottgonzalez/jquery-ui-extensions
*
* Updated 10-2010 by Stacey Shindo.
*/
(function ($) {

    $(".ui-autocomplete-input").live("autocompleteopen", function () {

        try {

            var autocomplete = $(this).data("autocomplete"),
	    	menu = autocomplete.menu;

            if (!autocomplete.options.selectFirst) {
                return;
            }

            //  menu.activate($.Event({ type: "mouseenter" }), menu.element.children().first());
            menu.activate($.Event({ type: "mouseenter" }), menu.element.children());
        }
        catch (e) {
           
        }
    });

} (jQuery));
