Error
Home » Page not found

Page not found

Sorry, but that page is unavailable. If you're sure it's the right address, please let us know, or else use the menu to continue browsing the site.

"England" },{ id: 24, countryName: "Northern Ireland" },{ id: 24, countryName: "Scotland" },{ id: 24, countryName: "Wales" },{ id: 1, countryName: "Andorra" },{ id: 44, countryName: "Argentina" },{ id: 2, countryName: "Australia" },{ id: 27, countryName: "Austria" },{ id: 45, countryName: "Brazil" },{ id: 4, countryName: "Canada" },{ id: 43, countryName: "Chile" },{ id: 41, countryName: "Croatia" },{ id: 5, countryName: "Czech Republic" },{ id: 6, countryName: "Denmark" },{ id: 40, countryName: "Estonia" },{ id: 7, countryName: "Finland" },{ id: 8, countryName: "France" },{ id: 9, countryName: "Germany" },{ id: 31, countryName: "Greece" },{ id: 32, countryName: "Hong Kong" },{ id: 34, countryName: "Indonesia" },{ id: 10, countryName: "Ireland" },{ id: 11, countryName: "Israel" },{ id: 12, countryName: "Italy" },{ id: 13, countryName: "Japan" },{ id: 38, countryName: "Latvia" },{ id: 39, countryName: "Lithuania" },{ id: 14, countryName: "Mexico" },{ id: 15, countryName: "Netherlands" },{ id: 16, countryName: "Norway" },{ id: 37, countryName: "Poland" },{ id: 17, countryName: "Portugal" },{ id: 30, countryName: "Romania" },{ id: 18, countryName: "Russia" },{ id: 29, countryName: "Singapore" },{ id: 19, countryName: "Slovenia" },{ id: 20, countryName: "South Korea" },{ id: 21, countryName: "Spain" },{ id: 22, countryName: "Sweden" },{ id: 23, countryName: "Switzerland" },{ id: 26, countryName: "Taiwan" },{ id: 24, countryName: "UK" },{ id: 46, countryName: "Uruguay" },{ id: 25, countryName: "USA" } ]; // Define a custom search function for the DataSource var matchNames = function(sQuery) { // Case insensitive matching var query = sQuery.toLowerCase(), country, i = 0, l = myCountries.length, matches = []; // Match against each name of each country for (; i < l; i++) { country = myCountries[i]; if ((country.countryName.toLowerCase().indexOf(query) > -1)) { matches[matches.length] = country; } } return matches; }; // Use a FunctionDataSource var oDS = new YAHOO.util.FunctionDataSource(matchNames); oDS.responseSchema = { fields: ["id", "countryName"] } // Instantiate AutoComplete var oAC = new YAHOO.widget.AutoComplete("myInput", "myContainer", oDS); oAC.useShadow = true; oAC.resultTypeList = false; // Custom formatter to highlight the matching letters oAC.formatResult = function(oResultData, sQuery, sResultMatch) { var query = sQuery.toLowerCase(), countryName = oResultData.countryName, query = sQuery.toLowerCase(), countryNameMatchIndex = countryName.toLowerCase().indexOf(query), displaycountryName; if (countryNameMatchIndex > -1) { displaycountryName = highlightMatch(countryName, query, countryNameMatchIndex); } else { displaycountryName = countryName; } return displaycountryName; }; // Helper function for the formatter var highlightMatch = function(full, snippet, matchindex) { return full.substring(0, matchindex) + "" + full.substr(matchindex, snippet.length) + "" + full.substring(matchindex + snippet.length); }; // Define an event handler to populate a hidden form field // when an item gets selected and populate the input field var mYField = YAHOO.util.Dom.get("mY"); var myHandler = function(sType, aArgs) { var myAC = aArgs[0]; // reference back to the AC instance var elLI = aArgs[1]; // reference to the selected LI element var oData = aArgs[2]; // object literal of selected item's result data // update hidden form field with the selected item's ID mYField.value = oData.id; myAC.getInputEl().value = oData.countryName; }; oAC.itemSelectEvent.subscribe(myHandler); return { oDS: oDS, oAC: oAC }; } ();