// Copyright (c) 2008 Yahoo! Inc. All rights reserved.
// Licensed under the Yahoo! Search BOSS Terms of Use
// (http://info.yahoo.com/legal/us/yahoo/search/bosstos/bosstos-2317.html)

/**
 * Create 2 very similar autocomplete controls and search buttons for the splash page and the result page.
 */

var myDataSource = YQL.datasource("use 'http://www.w3nerds.com/xml/suggest.xml' as suggest; select * from suggest where query=@query", ["query.results.s", "k"]);

var myAutoComp = new YAHOO.widget.AutoComplete("query", "myContainer", myDataSource);

// Container will expand and collapse vertically
myAutoComp.animVert = true;
myAutoComp.animHoriz = true;
myAutoComp.animSpeed = 2;
myAutoComp.scriptCallbackParam = "query";

// Require user to type at least 3 characters before triggering a query
myAutoComp.minQueryLength = 1;

// Disable type ahead
myAutoComp.typeAhead = false;
myAutoComp.autoHighlight = false;

// Use a custom class for LI elements
myAutoComp.highlightClassName = "ac-highlight";


var myAutoComp2 = new YAHOO.widget.AutoComplete("query2", "myContainer2", myDataSource);
myAutoComp2.scriptCallbackParam = "query";

// Container will expand and collapse vertically
myAutoComp.animVert = true;
myAutoComp.animSpeed = 2;
myAutoComp.scriptCallbackParam = "query";

// Require user to type at least 3 characters before triggering a query
myAutoComp.minQueryLength = 1;

// Disable type ahead
myAutoComp.typeAhead = false;
myAutoComp.autoHighlight = false;

// Use a custom class for LI elements
myAutoComp.highlightClassName = "ac-highlight";