var substringMatcher = function(strs) { return function findMatches(q, cb) { var matches, substringRegex; // an array that will be populated with substring matches matches = []; // regex used to determine if a string contains the substring `q` substrRegex = new RegExp(q, 'i'); // iterate through the pool of strings and for any string that // contains the substring `q`, add it to the `matches` array $.each(strs, function(i, str) { if (substrRegex.test(str)) { matches.push(str); } }); cb(matches); }; }; var products = ['9" Paint Brush With Tray','ABS PLASTIC DIAMOND FACED FLOATS – STANDARD, WIDE & LONG','APU Window Frame Seal Beads','Arch Bead 6mm','Base Track','Base Track Joint Clip (100 Qty)','Black builders foil','Bond it Exterior Pregrit 10L','Bond It High Strength Brick Acid 5L','Bond It Monster Mesh 50Mx1M','Bond It Professional Foam Gun','Bond it Rubber Bitumen Emulsion 5L','Clip On Beads','Compression Tape 10mm x 12.5m','Drop film Tape','ECO PRIM GRIP PLUS 10kg','EJOT H1 (Various Sizes)','EJOT N1 (various sizes)','EJOT NK U 45 (100 per box)','EJOT SBH-T 65/25 Washer','EJOT SW8RT 4.8x120','Everbuild 401 Brick & Patio Cleaner 5 Litre','Foam Gun Bundle','Hand held expansion foam B3 - 750ml','House Bundle','JABLITE GREY EPS BOARD','MAPEI Base Coat Primer 25kg','MAPEI MALECH 10kg','MAPEI NET','Mapei Nivoplan Grey 25KG','MAPEI Silancolor Tonachino 1.5mm (Anthracite Grey) 25kg','MAPEI Silancolor Tonachino 1.5mm (Whites & Off Whites) 25kg','Mapei Silancolor Tonachino AC 1.5mm','MapeTherm AR1GG Grey 25kg','Mapetherm AR1GG White 25kg','MAPEWALL GPR 25kg','Mesh Corner Bead','Mesh Stop Bead 6mm','Midget Trowel, Pointed 8"','MONDELIN 1.25M I Beam Profile Render Scraper','MONDELIN DOUBLE PAD (15mm) Long Toothed Scraper','MONDELIN Serrated Straight Edge 1.25m','MONDELIN Spatula 50cm (Rounded Edge)','MONDELIN STANDARD PAD (15mm) Long Toothed Scraper','MONDELIN STANDARD PAD (8mm) Short Toothed Scraper','Mould Stop 5L','Nylon Cable Ties Various Sizes','Optolith PDA Silicone Render Accelerator','OX Knife Bundle Pack','OX Notched SpeedSkim 450mm','OX Notched SpeedSkim 600mm','OX Notched SpeedSkim 900mm','Ox plasterers/renderers tool bundle','Ox Pro 5 Row Water Brush (Timber Handle)','Ox Pro 5m/16ft Pro Dual Auto Lock Tape Twinpack','OX Pro Aluminium Hawk','OX Pro Drywall Hammer','OX Pro Fixed Folding Knife','OX Pro Heavy Duty Knife Blades And Dispenser 10pk','OX Pro Internal Corner Trowel (60×80)','OX Pro Pipe Aluminium Trowel','Ox Pro Sealant Gun 400ml','OX Pro Snips','OX Pro Stainless Steel Bucket Trowel 7','OX Pro Stainless Steel Trowel 14 X 5','OX Retractable Utility Knife','OX Tools Pro Polymer Sponge Float','OX Tools Pro Sponge Float','OX Trade Render Scratcher (8mm / Short Tooth)','Plastic Spiral fixings (15 pack)','Power Spray - 1Ltr','Professional Applicator gun','ProTec Blue Window Film (500mm X 100 Metres)','ProTec Brick Tape (50m)','ProTec Fir tree fixings','PU Palm Glove pack of 10','PVC ANGLE/CORNER BEAD','PVC BELLCAST BEAD','PVC EXPANSION / MOVEMENT BEAD','PVC STOP BEAD','Red Gorilla tub 38 Litre','REFINA 1.25M I Beam Profile Render Scraper','REFINA 10" Scraper Twist (15mm) Long Toothed','REFINA 10" Scraper Twist (8mm) Short Toothed','REFINA 11" Plastic Trowel Grey Blade','REFINA 11" Plastic Trowel White Nylon Blade','Refina 15" PLASTIC RASP','Refina 15" Sand disc P24 with Velcro','Refina 16 Velcro Sponge Disc | Orange | Fine | 15mm','Refina 16 Velcro Sponge Disc | Tan | Medium | 50mm','Refina Angle Plane 18"','Refina Bucket Scoop 7"','Refina float 11" hydro uncut','Refina Internal Corner Trowel 3"','Refina Lattice Plain 11"','Refina long sponge 18" med/orange','Refina Mack Alu Bucket Scoop','Refina Midget Trowel 0.4mm Flex 8"','Refina Midget Trowel, Rounded Corners 8"','Refina Plastic Float 15" Diamond Face','Refina Plaziflex Trowel','Refina Scarifier','Refina scratch render tool bundle','REFINA Serrated Spatula - Various sizes','REFINA Serrated Straight Edge 1.25m','Refina silicone render tool bundle','REFINA Skimming Spatula Various Sizes','REFINA Sponge Float 10" Fine','REFINA Sponge Float 11" Coarse','Refina sponge float 11" extra porous uncut','REFINA Sponge Float 11" Medium','Refina Sponge float 11" porous uncut','REFINA Sponge Float 16" Fine','REFINA Sponge Float 16" Medium','Refina Square End Bucket Trowel 7" - 225118','Refina Trowel & Square Tool','Refina Wash Bucket 16L Dbl Roller','Refina X-2 mixing tub - Black - Various sizes','Retractable Knife','Rough exterior surface tape (48mm X 50m)','RTRMAX Diamond Cutting Blade 115 x 22.2','RTRMAX Paint Brush With Wooden Handle ( Various Sizes)','RTRMAX Scrapers Various Sizes','RTRMAX SDS Plus 8mm Drill Bit 210mm','RTRMAX Thermal Gloves (Waterproof) Large','RTRMAX Wire Brush Set (5 Piece)','RTRMAX Wire Hand Brush','Silancolor Pittura zero 20KG','Snip off - The cartridge tool','Soudal exterior frame silicone - Various colours (Box of 12)','Soudal foam & gun cleaner','Soudal Foil Safe Spray Cleaner','Soudal glass and mirror cleaner','Soudal Grip All(Box of 12)','Soudal Gun grade expanding foam','Soudal PVCu solvent cleaner','Spatula & Taping Knife','Spatula Trowel 4 x 1.5','Spatula Trowel 4x3','Stanley Lightweight Retractable Knife','Swipex Wipes','Tarp & Stucco Exterior Masking Tape (48mm X 50m)','Temp Downpipe','TEXTURE FLOAT 2MM WHITE PLASTIC TROWEL 11"','Ultra Grime XXL Multi Wipes','UNDERCILL END CAPS (PAIRS)','Undercill various sizes','Value Mesh','Verge Trim End Caps (Pair)','Verge Trim various sizes','Waterproof Latex Gloves (Large)' ]; var productsIDs = [ ]; $('#our-products .typeahead').typeahead({ hint: true, highlight: true, minLength: 1 }, { name: 'products', limit: 40, source: substringMatcher(products) });