/* Popular phrases - SMITHBROTHERS - 9:56:8, Fri Jan 27, 2012 */
var asPhrases=new Array ('wool saddle pads','saddle pads','spurs','bits','spur straps','cowboy spurs','pole bending','ropes','cinch','stirrups','tough 1','saddles','headstalls','dog blanket','chaps','roping dummy','belts','barrel saddles','reins','breastcollar','bell boots','wormer','cactus ropes','halters','hay bag','calf ropes','boots','saddle blankets','spurs and spur straps','splint boots','weatherbeeta','mayatex','bumper spurs','quirt','rope can','navajo saddle blankets','hay net','gloves','barrel racing reins','barrel racing saddle pads','bridles','saddle rack','rowels','flag','goat tying dummy','dewormer','zebra','hackamore','polo wraps','classic equine boots','pads','noseband','rattler','rope bag','hats','rope halter','flank cinch','barrel','classic equine','split reins','helmet','german martingale','rawhide headstall','blankets','hobbles','barrel reins','goat string','correction bit','fly sheet','goat tying string','bit guards','mohair cinch','roping gloves','shipping boots','horse boots','cooler','mayatex saddle blanket','caveson','dummy','silver mesa','horn wraps','saddle bags','kids rope','back cinch','pink','winter blankets','knotted barrel reins','impact gel saddle pads','curb chain','calf tying dummy','sheet','professional choice boots','barrel pads','one ear headstall','jeans','bosal','ariat','myler bits','dog','sport horse boots','ariat boots','western saddles','ranch rope','big d','classic equine saddle pad','piggin strings','giraffe','snaffle bit','lead rope','supplements','sherry cervi','custom spurs','training halter','chain bit','trailer','clippers','tie down','legacy boots','calf roping dummy','martingale','breakaway rope','blanket rack','chinks','hat rack','fenders','draw reins','show headstall','bareback pad','billet','back on track','open range blanket','head ropes','youth spurs','wade saddle','roping saddles','hat can','lime green horse boots','jewelry','turquoise headstall','classic equine spurs','roping reins','pole bending bases','dark oil headstall','show halters','mecate','crooked stirrups','roping steer head','nylon headstall','impact gel','rein chains','skid boots','show clothes','western spurs','barrel saddle pads','grooming','esp saddle pads','chair','slobber straps','brannaman','barrel racing bits','giraffe tack','girth','curb strap','hood','piggin','hat caddy','diamond wool saddle pad','professionals choice','reining saddle','show pants','ladies boots','left handed ropes','barrel racing saddles','aluminum stirrups','open range','good medicine saddle pad','knife','caps','chin strap','pole bases','ladies spurs','black chaps','pony','poles','tail bag','1849','zebra tack','tom thumb bit','big d horse blankets','zebra boots','browband headstall','stirrup buckles','turquoise reins','show saddles','off billet','over under','saddle carrier','5 star saddle pad','leather halter','professional choice saddle pad','absorbine','dally wrap','rawhide reins','small mesh hay net','hay','water bucket cozy','box pads','pulling collar','tough 1 dog blanket','cowboy hat','bob avila bits','bucket straps','wade','ariat ladies','tyler magnus','boot bag','spur pins','bucket','womens boots','lime green saddle blankets','bronc halter','director chair','training bit','rubber','show shirts','stable blanket','waterproof','roper shoes','custom rope cans','whip','fleece cooler','dale fredricks','joint supplement','roping spurs','flex turn barrels','spur buttons','dally master','high wither pad','tyler magnus bits','double diamond','francois gauthier bits','halters and lead ropes','roper cinch','mayatex san juan solid blanket','breastcollar with cross','turquoise saddle pad','knives','wonder bit','bridle bag','gel saddle pads','zebra gone wild','trailer door caddy','shirts','mike johnson','mtg','fleece','double j','scalloped browband headstall','turnout blanket','gag bit','rope can covers','classic equine bell boots','cooler blanket','rope organizer','jackets','surcingle','gypsy','nylon reins','calf dummy','rack','bit hobble','charmayne james bits','tiedown','latigo strap','western girth','magnetic number pins','cotton twill shirt','saddle stand','circle y','shin guards','heart','breakaway','troxel','number pins','zebra saddle pad','tender touch','felt pad','show apparel','sports medicine boots','shin','latigo laced barrel rein','impact gel pads','bucking rolls','lunge line','nylon sheet','cactus pad','hobby horse','ball','circle y saddles','charmayne james','slinky','draw gag bit','smx air ride saddle pads','quick release','weatherbetta orican turnout blanket','oster','garment bag','fly mask','cotton sheet','dogbone bit','snaffle','heelin ropes','dog collar','smb','zimecterin gold paste','hair on headstalls','cj jeans','moneymaker rope','twill shirts','pink zebra headstall','soft rope','nylon bit hobble','rattler ropes','chicago screws','pants','over and under whip','sleazy','curve bit','black as knight','buffalo leather','green zebra horse tack','hoof boots','roper horseshoe boots','roping stirrups','headstalls scalloped','revolution ropes','left','smx','western show pants','dog bone bit','mach','martha josey bit','wool felt pad','gauthier','supreme','vet wrap','magnet','sweet 6 bit','roper','personalized halters','bareback pad with stirrups','large stand','wraps','todd slone','braided headstall','blue saddle pads','left handed calf rope','knee boots','green hornet','circle y breastcollar','classic equine no turn bell boots','true love tack','toklat cinch','cactus headstall','mecate reins','twisted snaffle bits','justin ladies gypsy boots','charmayne james saddles','reinsman bit','1200 denier','memory foam','trophy halter','closed front sheet','blevins','outback','double j headstall','xxs','heel ropes','knotted halter','batwing chaps','charmayne james saddle pad','mike beers bits','silver mesa blanket','million dollar bit','biofit','martin','abetta','brittany pozzi breastcollar','relentless','childrens chaps','pink saddle blanket','magnetic holder','esp','pink boots','trailer accessories','speed steer','saddlesmith','smb elite','sandals','filigree','show pads','barrel racing','front boots','calf strings','myler correction bit','sleazy sleepwear','horn','true love','goostree','horse wormer','pole bending sets','purple stable blanket','spur rowels','zebra horse tack','curb','mesh hay net','legacy','safe guard','pony halter','angled stirrups','back cinch connector','riser pad','sport boots','mules','straw hats','back support','hoof pick','cactus breastcollar','5 star','zebra reins','rubber bell boots','crystal concho headstall','brushes','dark oil spur straps','flank girth','canvas blanket','fiador','weatherbetta','professional choice smb combo boots','wells saddle pads','rawhide stirrups','wool pad','training flag','chap carrier','high withers','billy allen','diamond wool','cutting spurs','ventech elite sport medicine boots','cross wool pad','ivermectin','tie down holder','darnall bit','black correction bit','casa zia blanket','freedom mesh hay bag','men western spurs','classic equine pad','saddle blanket bag','saxon','trigger snap','cactus reins','classic ropes','heavy reins','cross concho','showsheen','german martingale reins','black bridle','leather ties','small stand','offset spurs','wool girth','hair','rawhide tack','3r boots','cinch hobble','headsetter','short shank ported bit','stetson','justin boots','casting','ortho saddle pad','blanket bar','trailer window screen','tory show headstall','western show shirt','mohair girth','headset tiedown','x3-2553','classic equine girth','extra extra','bridle and bit','trigger','trevor brazil','suede headstall','pvc pad','chain bit with port','pulley','leg straps','praying cowboy','sleezy','tony lama','horse blankets','dogbone','equimax','spur straps with crosses','orange','twisted wire','top load hay bag','crystal inlay cross','orange saddle blanket','tie','mens shirts','xr4','clay tryan bit','leather splint boots','mens ariat boots','hoof supplements','molly powell','cervi saddle','x3-0454','barrel racing spurs','grass calf ropes','gullet','troxel helmet','training fork','classic equine legacy','high heeler','black boots','headstall with silver','custom halter','saddle horn wrap','leg protection','reining spurs','zebra bag','legacy front boots','draw bit','professional choice cinch','rope strap','rowdy the roping toy','big d halter','pick','square toe boots','classic equine top load hay bags','nylon halter','sidepull','loomis gag bit','100% wool pad','contender show saddle','myler comfort snaffle','relentless boots','first aid kit','flank','tying dummy','rope keepers','tie strap','cj riding jeans','justin ladies','trailer tie','weaver smart cinch','kyle reins','5 16 ropes','cactus saddlery saddle pad','beaded headstall','big d sussex','horse health ivermectin','1 split reins','quest gel','tony lama square toe','stirrup leathers','pins','basket stamped headstall','original mountain horse jacket','no turn bell boots','black show pants','simplicity bit','barrel racing stirrups','coats','leather barrel racing reins','goat','lunge','electrolytes','hooks','water','clothing','contour saddle pads','headstall rack','pro ortho saddle pad','rodie the calf','myler','26 dog blanket','cactus saddle pad','youth stirrups','bag','straps','giraffe boots','reinsman','latigo','justin roping gloves','crystal concho','back pack','casa zia','kids stirrups','vaquero headstall','horn knot','feeder','ladies spur straps','floral headstall','correction','original steer head','combination bit','horse craft','purple headstall','tight turn barrel','headin rope','wool cinch','molly powell bits','flag carrier','waterproof saddle cover','no bow wraps','square toe boots mens','red','blanket number pin','black','automatic waterer','k bar j show chaps','mounting step','rubber bucket','big d magnum','nylon tie','western collection pretty in pink','ariat ladies quickdraw','breakaway dvd','hair on zebra gone wild','cinch girth','cream pink','5 star cinch','brittany pozzi barrel saddle','neck rope','pad bag','cross concho headstall','saddle blanket carry case','window screen','cactus','cotton roping glove','pink zebra saddle pad','roper slip on','coflex','pro shipping boots','rm-1962b','teal saddle pad','tapaderos','blanket bag','wither riser','ovation zocks','ladies shirts','big d shipping boots','classic equine felt pad','western belts','socks','red saddle pad','big d magnum blanket','cross','jim warner','silver mesa star stable blanket','mohair roper cinch','bridle rack','bio-fit pad','water buckets','fly spray','big d nylon halter','bridle sets','blanket wash','billy cook saddle','haymaker','wide tree saddle','heavy harness leather tiedown','front cinch','heavy split reins','padded bridle bag','tombstone','myler combination','barrel cinch','cinchas','hay bale bag','pvc','quick release headstall','western saddle pads','riding helmet','nose band','cellphone','cowboy magic','zebra saddle','western bridle','crystal','spotted','low port with cricket','crystal canyon show pants','shoes','hoodie','waterproof sheet','zipper saddle pad','vaquero','neoprene cinch','lime saddle pad','mountain horse winter jacket','rock grinder spurs','cantle bag','leg wraps','leather strings','esp pad','ventech','rolling bale bag','water loops','purple horse blankets','clover spur','ariat legend','1849 ranchwear','cross bridle','cinch connector','sensorflex','cutting saddle','classic equine sensor flex pad','vaquero tack','cowboy','helmet cover','smb elite value pack','left handed heel ropes','mens ropers','leather','hat saver','1200 denier blankets','honda','hay bale','big d fly sheet','clogs','clipper blades','orange saddle pad','saddle strings','billy cook barrel racing saddle','cashel trail','old timer bridle','fast stop','roughout fenders','tight turn flex barrel','record breaker saddle','spur tie down','snaps','dog bone','todd slone pads','riser','team roping saddles','dog coat','martha josey pole bending bases','ranch','romal reins','pad liner','zebra headstall','leather tie strap','ariat black','toklat','american saddlery barrel','red eye','cosequin','genero','round pad','fork','batwing','bareback saddle','quick change bridle','harness','stopping bits','cheeta','brown halter','star saddle','cord draw reins','fork head','mayatex riverland','pyranha','zebra horse blanket','sport boot covers','san juan solid saddle blankets','three tier saddle rack','rubber boots','gator headstall','cross breastcollar','copper roller bit','futurity','air ride saddle pads','oxford shirt','western chaps','black spur straps','alpaca cinch','yellow saddle blankets','mayatex saddle pads','youth','smb sport boots','boot tote','turnout','nose band zebra','custom tack','professional choice combo boots','romal','over','rope bronc halter','black training bit','ported chain bit','pink patron','classic equine no-turn dl boots','ivermectin dewormer','martha josey million dollar bit','overreach boots','bridals','non slip saddle pad','bucket hook','lime green','cowhide cross inlay noseband','fly leg wraps','two ear headstall','endure','mountain horse rocky ridge winter jacket','retractable cone','braided barrel rein','leather headset','mayatex flintlock blanket','classic knee boot','breakaway eyes','mane','buffalo','rookie','circle y headstall','ariat billie','fetlock support boots','bar h','strongid wormer','american hat','tie dye','smith brothers open range supreme midweight turnout blanket','green headstalls','waterproof horse blanket','chill chaser','pozzi saddles','teal','headstall breastcollar sets','1200d','dura cart','oxford','airflex','sleazy sheet','pink spur straps','new zealand wool blanket','cowboy hat rack','schaefer','esp wool top pads','lead','kensington','20x','replacement clipper blades','terrain','14 saddle','show reins','mullen','bullseye','contour pedic pad','wells pad','professional choice ballistic','catalog','200 grams','bell stirrups','sedona','top','winter','turnout sheet','contoured wool saddle pads','king ropes','steer head','aluminum','monogram','vetrap','smokey mountain boots','goat can','vetericyn','abetta blankets','lukky the calf','training','grooming tote bag','stable sheet','equine boots','naughty nighties','step','sale','steer roping dummy','oster a5','mountain horse jacket','roping dummy head','moneymaker','hobble straps','horse blankets and sheets','tony lama boots','carol goostree bit','show blouses','buck','youth spur straps','sherry','5 1 2 bit','cutting','ulcer','spur tiedown','charmayne james record breaker','hair on saddle pad','burgundy','heeling','reinsman orthopedic','roping bits','racing','colored splint boots','running martingale','saddle cart','gag bit headstall','stand','classic equine legacy boot','rope training halters','quick change headstall','team roping spurs','stetson burnout','poly calf rope','organizer','praying cowboy spurs','riding boots','zocks','tom thumb','pozzi','purple saddle blanket','port','stirrup hobbles','bucket cozy','german','smart cinch','spur hangers','schutz','pro equine sport sling boots','popper','smith brothers ropes','replacement slides','josey bit','martin breastcollar','avila','roper bit','cool cinch','5 1 2 mouth','greg darnall snaffle bit','gun','connector','can','zebra barrel racing saddle','hanger','cavalry','1982','reinsman junior cowhorse bit','engraved','john deere','braided reins','pink plaid','cinch strap','lime green saddle pad','hair on tack','pro equine ultra sport boots','horse cooler','star concho','hay net bag','quick change ends','fastback','lightweight turnout blanket','big d hood','turquoise bell boots','blanket case','viper calf ropes','zebra rope bag','youth chaps','spoon bit','dark oil breastcollar','hock boots','western boots','sharon camarillo','triple e halter','dally','roller bit','charmayne james pad','star','francois gauthier','square toed boots','farnam','salt block holder','420 denier stable blanket','black reins','rope cheek hobble','rope headset tiedown','smith brothers hood','professional choice rope bag','blanket with neck','string trainer martingale','utility bucket','trailer aid','weaver halter','barrel spurs','crystal breastcollar','bogs','roping flank cinch','knee guard','toys','elite boots','biothane','3d spur straps','hobby horse chaps','soft shell jacket','mounting block','necklace','aluminum barrel stirrups','hoof care','smb 3 boots','elite','big d stable blanket','martha josey reins','tiedown holder','classic equine splint boots','tote bags','cross headstall','twisted snaffle','support boots','professional choice bell boots','poly rope','crimson','roper stirrups','insulated boots','justin cotton rope gloves','5 cantle','blanket pins','show tops','rate and turn','saddle pad protector','fleece cooler sheet','harness leather','trevor','show stirrups','california pleasure','jinglebobs','giraffe headstall','eggbutt snaffle','heavyweight turnout blanket','cowboy hat caddy','bucket buddy','saddle package','nylon trainer lead','martin saddle','chestnut headstall','quick','cowboy magic detangler','tie dye boots','buck brannaman','k bar j chaps','zipper ii saddle pad','30 x 30','show numbers','steer rope','hammer','horse pads','pepi','burner','mullen bit','quilted vest','classic equine bell','shank snaffle','blanket straps','reinsman snaffle','neck','stop','beetle','work saddle pads','equigrip chaps','custom buckles','professional choice smb','cricket bit','hose','tack','fat baby','heated hose','reversible vest','classic gold','orange zebra','gear bags','leather overlay with dots nylon halter','million dollar','martin latigo','scalloped','strongid','diamond','roping wraps','gag','mens spurs','string','felt cinch','bale bag','bonnie the goat','skull','pyrantel pamoate','cowboy toy','tiger','true love breastcollar','gt4','horse hair reins','scarf','canvas duck blanket','big d open front','panacur paste','pink barrel reins','yellow','long shank gag','silver halter','5x','fly predators','bucket heater','custom breastcollars','houndstooth','perfect','bosal bridle','leopard','double j breastcollar','stamped string','geocity','clinton anderson','charlie smart roping dummy','liniment','trail saddle','tie ring','bolt snap','leather girth','kyle','turn out blankets','purple sheets','rodie','knee','classic equine cinch','cooling sheet','calf','horse bits','charmayne','saddle pads wither','tough one dog blanket','pistol bit','smith brothers open range sheet','charmayne james spurs','deer','blouse','baby boots','three','ultrasuede chaps','pink bridles','leopard print','oster clipmaster','tights','hind boots','tee','inlay cowhide cross','riding sport quilted vest','loomis','beetle hackamore','smith brothers','robinhood','transition bit','calf roping supplies','open range sheet','dark oil bridle','billy cook breastcollar','horse sheets','canvas turnout blanket','yearling rope halter','western show chaps','pro equine','deluxe grooming tote bag','simplicity','blue streak','ultimate 4','ring snaffle','blocker tie','wormer gold','custom lead','bandage wraps','ariat fat baby','basket weave','ez knees','quest','stainless steel spurs','insulated bucket','safe-guard','tough 1 blanket','trailer screens','panacur','team roping dvd','air ride pad','day planner','engraved spurs','flame','mens jackets','splint','horse hood','mens spur straps','cheetah bell boots','stirrup pads','blocker tie ring','camarillo','buckaroo','slide','mask','30 x 32','3 piece bit','mens chaps','quarter horse blanket','line','professional choice blanket','stacy westfall','charlie','ballistic overreach','tiger boots','breastcollar tugs','d ring','genero medium weight turnout blanket','dura wrap','training surcingle','zebra pad','smb 3','freedom','gambler stirrups','mountain','oak leaf','dog fleece','easy on rope halter','western pants','sliding bit','build up pad','long shank','rope back pack','saddle pads 34 x 34','riding gloves','mountain horse','ariat clogs','stampede string','roper vest','winged cross','western saddle carrier','gumball spurs','tugs','ultra sport boots','ez mount','classic equine esp pad','latigo tie strap','equigest','western hat','wide boots','6 bit','martha josey saddle','cowboy hat can','nylon strap','roper girth','black leather reins','chap sizes','chapparal','worlds greatest goat','hoof pick holder','carry case','roper gloves','windy ryon','cones','wool blanket','rope powder','open range 680','comfort grip pad','farriers formula','king','accessory bag','sweet iron snaffle bit','training dvd','latigo keeper','roper square toe boot','0536','protective horse boots','horsehair','royal blue saddle pad','resistol black gold hat','waterford bit','justin gypsy square toe','blue streak gloves','green tack','show chaps','rhinestone','pink camo rope bag','turquoise saddle blanket','double barrel breakaway','cross ties','anthelcide','saddle pads for high withers','nylon trophy halter','size 8 hat','alpaca','zimecterin gold','trail reins','blanket pads','1833','rodeo','olive','phone holder','double j pozzi','calf roping saddles','collapsible barrels','five star saddle pads','prime time','blue','shapleys','hat nanny','star headstall','calf roping pulley','edge','tough enough to wear pink','saddle pad bag','flower','orange bell boots','orange shirt','martha josey pole bases','black split reins','custom stamps','ssg roping gloves','saddle rack system','classic equine horse blanket','saddle pads 34','original cowboy toy','big d custom','paste wormer','mounting','wool felt saddle pad','roping round reins','double j turquoise cross headstall','halter carrier','back in black','pink helmet','desert breeze','pleasure','true love headstall','cowhide inlay collection cross browband headstall','one ear','ulcerguard','dancing arrows navajo blanket','rowdy','western weave collection','quest plus','gator tack','co-flex','baby doll','rolls','pink zebra bell boots','antique rowels','equine pad','peasant','professional choice bag','mayatex solid','hydrahorse','aluminum roper stirrup','david motes','value pack','trimmer','striker','carlos combo saddle','rp4','rawhide curb','snaffle gag bit','mens oxford shirts','mayatex san juan','chute','magnetic conchos','rope ties','double j turquoise cross','9.5 breakaway rope','hair on','stetson jeans','blue spur straps','blanket leg straps','sherry cervi saddles','honeycomb chill chaser','knife scabbard','basketweave','avila bits','men\'s jeans','lace boots','lyrca','velcro','motes saddle','rope bag back pack','classic equine contour pad','western fold away saddle cover','26 mohair cinch','pink headstall','husky liners','teal zebra','plaid boots','a knotted','pink headin rope','hair on hide spur','dog sheet','roper candy floral baby doll','lukky','initial spurs','fenbendazole','legacy hind boots','three piece bits','biotin plus','wildfire','orange boots','cross nose band','sports medicine','fortiflex 8-quart utility bucket','two tone','easy knee','stetson floral','cross tie','charlie dummy','muck bucket cart','riding sport jacket','pole bag','cheetah boots','yacht rope','down coat','stran smith 9.0','cheeta horse boots','classic equine legacy system','designer collection plaid sheet','steer string','upland turnout sheet','tied and twisted','floral belt','x3-0385','phone','purple pad','rope halter with leather noseband leather','5star pads','reinsman argentine','3 in 1 jacket','planner','notebook','calf rope 9.5','jiffy jack','show tie','striker ropes','thrush buster','professional choice sports medicine boots','men\'s boots','medium port','cheetah roping bag','mane hood','15 saddle','zebra gone','mud guards','brent lewis','cowboy headstall','cotton rope','red rope','white reins','justin chukka','lyles piggin strings','bangora hats','classic equine esp','roper saddles','smith brothers roping saddles','smb value','youth aluminum stirrups','large horse headstall','red sheet','black satin bumper spurs','heavyweight','cook','ariat zebra','conway buckle','mach 4 rope','russet leather headstalls','barncoat','junior rope bag','rowdy roping','clover','zebra barrel reins','purple zebra tack','whoababy','breakaway roping dvd','classic legacy boots','riding sport','contour wool','waterproof jacket','the original calf head','braided rawhide cross over browband headstall','rubber barn boots','colored rawhide headstall','cowboy spur straps','rocky mountain jacket','the original mountain horse winter jacket','therapy','heeling dvd','cowhide inlay cross roper breastcollar','pink western saddle pads','leather cross','denier blanket','basket weave spur strap','sheath cleaner','contoured felt pad','spirit helmet','black cross','martin barrel','men\'s stainless steel spurs','blazer','daily wormer','custom motif saddle pad with swarovski crystals','camarillo bit','barrel dvd','burnout tee','cordura','hair spur straps','wool saddle pads zebra','ssg pro tex','soft dry storage system','peace halter','mini mag','red splint boots','pink ostrich','hooey loop honda','roper bag','francios gauthier engraved show spur','resistol ranch','cactus barrel','smx air ride','turtle print','floral tool with silver','blue rope','sporteze','cowboy halter','spinner steer','black and pink cowgirl boots','men\'s','chill','dark oil saddle','carry saddle bags','classic kid ropes','heelin','classic equine sensor flex','pressure relief pad','weaver lil dude stirrups','floral','red calf rope','scrunchie','trailer bag','light oil','stable fork','mens tony lama','mens western belts','cowhide inlay cross bridle','day','meadow creek saddle','three cross spurs','mayatex half hitch','one-ear headstall','cross tack','diamond wool saddle blankets','futurity reins','mayatex pads','rancher gloves','chocolate chaps','blue barrel reins','black ropers','western apparel','master saddles','big','cheyenne','running p ropes','rolled reins','pimple gloves','black square toe boot','corta','cowboy hat helmet','colored rawhide curb strap','cutback','treatment boots','team roper saddle','felt wool','ranger','saddle fenders','san juan marbled','women western hat','classic equine bio fit pad','cinch set','supermask','riding helmet covers','large bridle','dallas roper hat','cut out saddle pad','pastern wrap','wool barrel pad','big d sussex turnout blanket','cheeta boots','saddle mayatex','red lead ropes','roper ladies vest','cinch buckle cover','mayatex ranger','freedom hay bag','ranger bit','lightweight','round toe','shaped ear headstall','comfort snaffle','string can','port roller bits','silver hat','purple lead rope','cactus team roper','hobby horse belt','shearling cinch','tree','overlay halter','braided rope halter','waffle','double diamond trail halter','pro equine ultra','western bell crooked stirrups','rawhide horns','pro equine bell boots','black with red cross','rope bosal','rope nose','pirate spurs','mens rubber boots','mb04','designer collection solid sheet','deluxe nylon halter','mayatex barrel','butter soft','light turnout sheet','training snaffle bit','blue blanket','billy cook barrel','horse supplements','mayatex ramrod double weave blanket','baby blue','ceramic','cactus gag bit','ladies tony lama boots','pro equine ultra sport boots front','carry','blue plaid','big d turnout sheet','closed','mayatex ramrod double','cactus wool pad','heel strap','western riding boots','professional\'s choice ballistic bell boots','snake','red helmet','pro equine bell','steel noseband','100% mohair','horse wraps','shapley original','slow','training hackamore','professional\'s choice hay bag','colored double hat can','clinton','pink sheet','wonder dust','square toe gypsy','black rope','sportote','western split reins','oralx','chocolate cowboy hat','bar-h','simple horse boots','smith brothers harness leather','bockius','wool navajo saddle pad','1.87% ivermectin wormer','stars boots','classic legacy','black cross belt','soft bit','lady stetson','plaid','stockman bits','professionals choice ballistic overreach boots','ring slide','harness leather caveson','barbed wire concho','stall waterer','horse shipping boots','black show pad','square correction','start','ss gag bit','combo','ten','rawhide strap','black leather spur straps','pro equine sport','turquoise cross breastcollar','leather cinch straps','wingtip','classic equine wool top pad','smart cart','comfort bit','cashel reins','barrel racing crooked stirrups','pro blanket','tough blanket','black viper','big d lead','ladies square toe','water loop reins','dee','purple show shirt','cactus skid boots','stacy show shirt','starting a head horse','burnout','caspian casuals','chocolate saddle pad','show of faith light oil noseband','pk-2572','show gloves','bug eye','maltese','s bits','ladies riding boots','horse dewormer','cool pad','bubble','stretch eye saver','maverick','ball chain','leather off billet','pro pad','supplies','red chaps','plain breastcollars','colored show pad','heading dvd','trap','traveling saddle racks','solid','pro saddle pads','comfy rump','magnetic tie','leather collar','crusader mask','ring master','spirit','classic equine no turn xt','classic equine esp felt top pad','ladies floral spur','men boot size 15','black and white saddle pad','western blouses','shannon','stretch show pants','black wool pad','hind','classic equine tiger','western fenders','periwinkle','pink and lime green','celeste','sit','cj','black and white','closed cell','cool crusader fly mask','roper saddlery','hobby horse chantilly','classic bio fit','classic equine gloves','ss brushed','rapid scrub','short skid boot','classic bag','hobby horse santana','tall','saddle pins','wicked','california','rhinestone cross','pink show','caspian','rk-0517','chili pepper spurs','pink zebra tiedown','classic equine sheet','size 14 boots','short trailer door caddy','classic cinch','horse pants','classic pvc','mens calf roper lacer boot','cool cold','bike chain bits','professional boots','black deer tan','tied n twisted','distressed brown mossy oak','pink turnout blankets','double wire','diamond youth spur','motor','purple belt','parasites','pink polo','three in one','horse rope halters','martin 1 2 breed crown sherry cervi barrel racer saddle','simulator','metro vac','leather over','synergy ha','smith brothers open range 420 denier stable sheet','leather knot');
/* $Revision: 3828 $
 *
 */

if(typeof(_sli_init )!='object'){var _sli_init=new Array();}
if(typeof(sli_init )!='function'){function sli_init(){ for(var x=0;x<_sli_init.length;x++) _sli_init[x]();}}
if(typeof(asPhrases)!='object'){ var asPhrases = new Array(); }
if(typeof(__SLI_customisations)!='object'){var __SLI_customisations = new Object();}
if(typeof(__SLI_ClientDefaults)!='object'){ var __SLI_ClientDefaults=[]; }
if(typeof(__SLI_validSearchBoxes)!='object'){ var __SLI_validSearchBoxes = new Array(); }
if(typeof(__SLI_asug_used_flag)!='object'){ var __SLI_asug_used_flag = false; }
if(typeof(__SLI_width)!='object'){ var __SLI_width = 0; }
if(typeof(sli_targeturl)!='object'){ var sli_targeturl = ""; }


    __AutoComplete = new Object(); //namespace...
    __AutoComplete_mouseMoved=false;

    // Basic UA detection
    isIE = document.all ? true : false;
    isGecko = navigator.userAgent.toLowerCase().indexOf('gecko') != -1;
    isOpera = navigator.userAgent.toLowerCase().indexOf('opera') != -1;

    /* defaults and options */

    var __SLI_ApplicationName = 'AutoSuggest';
        __SLI_customisations[ 'AutoSuggest' ] =
                {
                    'ShowBrandingFooter' : true
                    ,
                    'TextBoxIDPrefix' : 'sli_search_'
                    ,
                    'BrandingFooterImagePath' : 'http://assets.resultspage.com/autosuggest/sli_systems-powered_150_15.gif'
                    ,
                    'BrandingFooterTitleTooltip' : 'AutoSuggest Powered by SLI Systems'
                    ,
                    'DropListMinWidth' : 150
                    ,
                    'MaxListItems' : 10
                    ,
                    'Alignment' : true
                    ,
                    'TextBoxIDCustom' : []
                    ,
                    'ValidSearchBoxes' : false 
                    ,
                    'IE6SelectBox' : false 
                    ,
                    'IE6SelectBoxPadding' : 0
                    ,
                    'TargetURL' : ''
                    ,
                    'IframeAlignment' : false
                    ,
                    'AlignmentBorderBug' : false
                    ,
                    'IE6OnFocus' : false
                };
    /* 0 = keyname, 1 = value */
    for( defaultValuePair in __SLI_ClientDefaults )
    {
        __SLI_customisations[__SLI_ApplicationName][__SLI_ClientDefaults[defaultValuePair][0]]=__SLI_ClientDefaults[defaultValuePair][1];
    }

    /* pre-fetch branding footer image if being used...
     */
    if( __SLI_customisations[ __SLI_ApplicationName ][ 'ShowBrandingFooter' ] )
    {
        
        if(location.protocol == "https:")
        {
            __SLI_customisations[ __SLI_ApplicationName ][ 'BrandingFooterImagePath' ] = __SLI_customisations[ __SLI_ApplicationName ][ 'BrandingFooterImagePath' ].replace(/http:/i, 'https:');
        }
    
        var __AutoCompleteBranding = new Image();
        __AutoCompleteBranding.src=__SLI_customisations[ __SLI_ApplicationName ][ 'BrandingFooterImagePath' ];
    }


    function AutoComplete_init()
    {
        if(!isOpera)
        {
            var oldonresize=function(){};
            if(typeof(window.onresize)=='function')
                oldonresize = window.onresize;//play nicely with other people's toys
            window.onresize= function(){ oldonresize(); AutoComplete_HideAll(); AutoComplete_Create( asPhrases ); }

            AutoComplete_Create( asPhrases );
            
            var els = document.getElementsByTagName('input');
            if(els)
            {
               for ( i = 0; i < els.length; i++ )
               {
                  if(els[i].name == "asug")
                  {
                     els[i].disabled = true;
                  }
               }
            }
        }
    }




    /**
    * Attachs the autocomplete object to a form element. Sets
    * onkeypress event on the form element.
    *
    * @param string formElement Name of form element to attach to
    * @param array  data        Array of strings of which to use as the autocomplete data
    */
    //function AutoComplete_Create (id, data)
    /*
     * iterate over 'sli_search_*' assumes one or more search boxes numbered from 1...
    */
    function AutoComplete_Create( data )
    {
        var idx=1, e, id, searchBoxPrefix=__SLI_customisations[ __SLI_ApplicationName ][ 'TextBoxIDPrefix' ];
        while( e = document.getElementById(searchBoxPrefix+idx) )
        {
            AutoComplete_AttachHandlers(e, data);
            if( __SLI_customisations[ __SLI_ApplicationName ][ 'ValidSearchBoxes' ] )
            {
                __SLI_validSearchBoxes.push(searchBoxPrefix+idx);
            }
            idx++;
        }
        
        
        //this array comes from the customised list
        var otherTextBoxIdList = __SLI_customisations[ __SLI_ApplicationName ][ 'TextBoxIDCustom' ];
        if( otherTextBoxIdList)
        {
            for(idx=0;idx<otherTextBoxIdList.length;idx++)
            {
                e = document.getElementById(otherTextBoxIdList[idx]);
                if(e)
				{
					if( __SLI_customisations[ __SLI_ApplicationName ][ 'ValidSearchBoxes' ] )
                	{
	                    __SLI_validSearchBoxes.push( otherTextBoxIdList[idx] );
                	}
					AutoComplete_AttachHandlers(e, data);
				}
            }
        }
        
    } 

    function AutoComplete_AttachHandlers(e, data){
        var iframe,id;
        id=e.id;


        __AutoComplete[id] = {'data':data,
                              'isVisible':false,
                              'element':document.getElementById(id),
                              'dropdown':null,
                              'highlighted':null};

        __AutoComplete[id]['element'].setAttribute('autocomplete', 'off');
        __AutoComplete[id]['element'].onkeydown = function(e) {if (!e) e = window.event; return AutoComplete_KeyDown(this.getAttribute('id'), e);}
        __AutoComplete[id]['element'].onkeyup = function(e) {if (!e) e = window.event; return AutoComplete_KeyUp(this.getAttribute('id'), e);}
        // The function call on the next line was changed by Andrew Grieve April 2008
        __AutoComplete[id]['element'].onkeypress = function(e) {if (!e) e = window.event; return AutoComplete_KeyPress(this.getAttribute('id'), e);}
        __AutoComplete[id]['element'].onclick = function(e)
        {
            if( __SLI_customisations[ __SLI_ApplicationName ][ 'IE6OnFocus' ] )
            {
                __AutoComplete[id]['element'].focus();
            }
            if (!e) e = window.event; e.cancelBubble = true; e.returnValue = false;
        }



        // Hides the dropdowns when document clicked
        var docClick = function()
        {
            if( __SLI_customisations[ __SLI_ApplicationName ][ 'ValidSearchBoxes' ] )
            {
               for(var i=0; i < __SLI_validSearchBoxes.length; i++)
               {
                   if(document.getElementById(__SLI_validSearchBoxes[i]))
                   {
                       AutoComplete_HideDropdown(__SLI_validSearchBoxes[i]);
                   }
               }
            }
            else
            {
                for (id in __AutoComplete)
                {
                   AutoComplete_HideDropdown(id);
                }
            }
        }

        if (document.addEventListener) {
            document.addEventListener('click', docClick, false);
        } else if (document.attachEvent) {
            document.attachEvent('onclick', docClick, false);
        }


        // Max number of items shown at once
        if (arguments[2] != null) {
            __AutoComplete[id]['maxitems'] = arguments[2];
            __AutoComplete[id]['firstItemShowing'] = 0;
            __AutoComplete[id]['lastItemShowing'] = arguments[2] - 1;
        }

        AutoComplete_CreateDropdown(id);

        // Prevent select dropdowns showing thru
        if (isIE) {
            iframe = document.createElement('iframe');
            __AutoComplete[id]['iframe'] = iframe;
                iframe.id = id +'_iframe';
                iframe.style.position = 'absolute';
                iframe.style.top = '0';
                iframe.style.left = '0';
                iframe.style.width = '0px';
                iframe.style.height = '0px';
                iframe.style.zIndex = '98';
                iframe.style.visibility = 'hidden';
                
                if(location.protocol == "https:")
                {
                   iframe.src = 'https://assets.resultspage.com/autosuggest/blank.html';
                }
                
                if( __SLI_customisations[ __SLI_ApplicationName ][ 'IE6SelectBox' ] )
                {
                  iframe.style.width = __SLI_width  + __SLI_customisations[ __SLI_ApplicationName ][ 'IE6SelectBoxPadding'];
                }

            if( __SLI_customisations[ __SLI_ApplicationName ][ 'IframeAlignment' ] )
            {
                document.body.insertBefore( iframe );
            }
            else
            {
                __AutoComplete[id]['element'].parentNode.insertBefore( iframe, __AutoComplete[id]['element'] );
            }
        }
    }

    /**
    * Creates the dropdown layer
    *
    * @param string id The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_CreateDropdown(id)
    {
        var theSearchbox = __AutoComplete[id]['element'];
        var theDropDown;
        var left_top = AutoComplete_getPos( theSearchbox );
        var left  = left_top[0];
        var top   = left_top[1] + theSearchbox.offsetHeight;
        var width = theSearchbox.offsetWidth;

        if ( width < __SLI_customisations[ __SLI_ApplicationName ][ 'DropListMinWidth' ] )
        {
            width = __SLI_customisations[ __SLI_ApplicationName ][ 'DropListMinWidth' ];
        }

        theDropDown = document.createElement('div');
        theDropDown.className = 'autocomplete'; // Don't use setAttribute()


        if(__SLI_customisations[ __SLI_ApplicationName ][ 'Alignment' ] == true && document.body)
        {
            theDropDown.style.position = 'absolute';
            document.body.insertBefore(theDropDown, document.body.nextSibling);
            
            // Position it
            theDropDown.style.visibility = 'hidden';
            theDropDown.style.left       = left + 'px';
            theDropDown.style.top        = top + 'px';
            theDropDown.style.width      = width + 'px';
            theDropDown.style.zIndex     = '99999';
        }
        else if(__SLI_customisations[ __SLI_ApplicationName ][ 'Alignment' ] == "offsetrelative" && document.body)
        {
          theSearchbox.parentNode.insertBefore(theDropDown, theSearchbox);
          // Position it
          if(sli_getStyle(theSearchbox.offsetParent, 'position') != "absolute")
          {
            theSearchbox.offsetParent.style.position = 'relative';
          }
          theDropDown.style.position = 'absolute';
          theDropDown.style.left = (theSearchbox.offsetLeft) + 'px';
          theDropDown.style.top = (theSearchbox.offsetTop + theSearchbox.offsetHeight) + 'px';
          theDropDown.style.width = (theSearchbox.clientWidth) + 'px';
          theDropDown.style.visibility = 'hidden';
          theDropDown.style.zIndex     = '99999999';
        }
        else
        {
            theSearchbox.parentNode.insertBefore(theDropDown, theSearchbox);
            // Position it
            theDropDown.style.visibility = 'hidden';
            theDropDown.style.left       = left + 'px';
            theDropDown.style.top        = top + 'px';
            theDropDown.style.width      = width + 'px';
            theDropDown.style.zIndex     = '99999';
        }
        

        __AutoComplete[id]['dropdown'] = theDropDown;
        __SLI_width = width;
    }

    function /* array [ left, top ] */ AutoComplete_getPos( obj )
    {
        var curleft = curtop = 0;
        var sli_flag = 0;

        if (obj.offsetParent)
        {
           do
           {
              if ( __SLI_customisations[ __SLI_ApplicationName ][ 'AlignmentBorderBug' ] )
              {         
                
                if(sli_flag == 1)
                {
                    var clientTop = (obj.offsetHeight - obj.clientHeight) / 2;
                    curtop += clientTop;

                    var clientLeft = (obj.offsetWidth - obj.clientWidth) / 2;
                    curleft += clientLeft;
                }
                sli_flag = 1;
              }
           
              curleft += obj.offsetLeft;
              curtop += obj.offsetTop;
           }
           while (obj = obj.offsetParent);
        }
        return [curleft,curtop];
    }

    /**
    * Shows the dropdown layer
    *
    * @param string id The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_ShowDropdown(id)
    {

        AutoComplete_HideAll();



        var value = __AutoComplete[id]['element'].value;
        var toDisplay = new Array();
        var newDiv    = null;
        var text      = null;
        var numItems  = __AutoComplete[id]['dropdown'].childNodes.length;

        __AutoComplete_mouseMoved=false;
        // SLI Code Modification - Start - Andrew Grieve April 08
        // Trim the textbox so that if is starts with a space then the feature will still work
        //value = value.replace(/^\s+|\s+$/g,"");
        value = value.replace(/^\s+/g,"");

        if(value.length == "")
        {
            // If Textbox length is nothing (after the trim) then don't show dropdown.
            return;
        }
        // SLI Code Modification - End

        // Remove all child nodes from dropdown
        while (__AutoComplete[id]['dropdown'].childNodes.length > 0) {
            __AutoComplete[id]['dropdown'].removeChild(__AutoComplete[id]['dropdown'].childNodes[0]);
        }


        var count=0;
        // Go thru data searching for matches
        for (i=0; i<__AutoComplete[id]['data'].length; ++i)
        {
            // SLI Code Modification - Start - Andrew Grieve April 08 - Added lower casing
            if (__AutoComplete[id]['data'][i].substr(0, value.length).toLowerCase() == value.toLowerCase())
            {
                // SLI Code Modification - End
                toDisplay[toDisplay.length] = __AutoComplete[id]['data'][i];
                count++;
                /* how many to display? */
                if(count == __SLI_customisations['AutoSuggest']['MaxListItems'] ) /* Code inserted to keep list to a maximum of 10 values (was 20 or 30) */
                {
                    break;
                }
            }
        }

        // No matches?
        if (toDisplay.length == 0) {
            AutoComplete_HideDropdown(id);
            return;
        }



        // Add data to the dropdown layer
        for (i=0; i<toDisplay.length; ++i) {
            newDiv = document.createElement('div');
            newDiv.className = 'autocomplete_item'; // Don't use setAttribute()
            newDiv.setAttribute('id', 'autocomplete_item_' + i);
            newDiv.setAttribute('index', i);
            newDiv.style.zIndex = '99999';

             // Scrollbars are on display ?
            if (toDisplay.length > __AutoComplete[id]['maxitems'] && navigator.userAgent.indexOf('MSIE') == -1) {
                newDiv.style.width = __AutoComplete[id]['element'].offsetWidth - 22 + 'px';
            }

            newDiv.onmouseover =
        function()
        {
            if( __AutoComplete_mouseMoved )
                AutoComplete_HighlightItem(__AutoComplete[id]['element'].getAttribute('id'), this.getAttribute('index'));
        };

            newDiv.onclick     =    function()
                                    {
                                    	  __SLI_asug_used_flag = true;
                                                                           
                                        AutoComplete_SetValue(__AutoComplete[id]['element'].getAttribute('id'));
                                        AutoComplete_HideDropdown(__AutoComplete[id]['element'].getAttribute('id'));
                                        AutoComplete_submitForm(id);
                                    }



            text   = document.createTextNode(toDisplay[i]);
            newDiv.appendChild(text);
            newDiv.title='Search for ' + toDisplay[i];

            /* ellipsis for IE only */
            if( isIE )
            {
                newDiv.style.textOverflow = 'ellipsis';
                newDiv.style.width = '100%';
                newDiv.style.whiteSpace = 'nowrap';
                newDiv.style.overflow = 'hidden';

            }
            __AutoComplete[id]['dropdown'].appendChild(newDiv);
        }
        /*
         * append DIV containing footer branding...
         */
        if(__SLI_customisations['AutoSuggest']['ShowBrandingFooter'])
        {
            i = toDisplay.length;
            newDiv = document.createElement('div');
            newDiv.className = 'autocomplete_footer'; // Don't use setAttribute()
            newDiv.setAttribute('id', 'autocomplete_item_' + i);
            newDiv.setAttribute('index', i);
            newDiv.style.zIndex = '99999';
            newDiv.innerHTML = '<a href="http://www.sli-systems.com/powered-by.php" title="' +
                                __SLI_customisations[ __SLI_ApplicationName ][ 'BrandingFooterTitleTooltip' ] +
                                '"><img class="autocomplete_footer_branding" src="'+__AutoCompleteBranding.src+'" /></a>';

            __AutoComplete[id]['dropdown'].appendChild(newDiv);
        }


        // Too many items?
        if (toDisplay.length > __AutoComplete[id]['maxitems']) {
            __AutoComplete[id]['dropdown'].style.height = (__AutoComplete[id]['maxitems'] * 15) + 2 + 'px';

        } else {
            __AutoComplete[id]['dropdown'].style.height = '';
        }


        /**
        * Set left/top in case of document movement/scroll/window resize etc
        */
        if(__SLI_customisations[ __SLI_ApplicationName ][ 'Alignment' ] == "true" || __SLI_customisations[ __SLI_ApplicationName ][ 'Alignment' ] == "false")
        {
            var left_top = AutoComplete_getPos( __AutoComplete[id]['element'] );
            __AutoComplete[id]['dropdown'].style.left = left_top[0];
            __AutoComplete[id]['dropdown'].style.top  = left_top[1] + __AutoComplete[id]['element'].offsetHeight;
        }


        // Show the iframe for IE
        if (isIE) {
            
            if(!__SLI_customisations[ __SLI_ApplicationName ][ 'Alignment' ] == true)
            {
               __AutoComplete[id]['iframe'].style.width  = __AutoComplete[id]['dropdown'].offsetWidth;
            }
            
            
            __AutoComplete[id]['iframe'].style.top    = __AutoComplete[id]['dropdown'].style.top;
            __AutoComplete[id]['iframe'].style.left   = __AutoComplete[id]['dropdown'].style.left;
            __AutoComplete[id]['iframe'].style.height = __AutoComplete[id]['dropdown'].offsetHeight;

            __AutoComplete[id]['iframe'].style.visibility = 'visible';
        }

    e =  __AutoComplete[id]['dropdown'];

    e.onmousemove =
        function()
        {
            if(!__AutoComplete_mouseMoved){__AutoComplete_mouseMoved=true;}
            this.onmousemove = null;
        }

        // Show dropdown
        if (!__AutoComplete[id]['isVisible']) {
            __AutoComplete[id]['dropdown'].style.visibility = 'visible';
            __AutoComplete[id]['isVisible'] = true;
        }


        // If now showing less items than before, reset the highlighted value
        if (__AutoComplete[id]['dropdown'].childNodes.length != numItems) {
            __AutoComplete[id]['highlighted'] = null;
        }
    }



    /**
    * Hides the dropdown layer
    *
    * @param string id The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_HideDropdown(id)
    {
        if (__AutoComplete[id]['iframe'])
        {
            __AutoComplete[id]['iframe'].style.visibility = 'hidden';
        }
        
        if (__AutoComplete[id]['dropdown'])
        {
            __AutoComplete[id]['dropdown'].style.visibility = 'hidden';
        }

        __AutoComplete[id]['highlighted'] = null;
        __AutoComplete[id]['isVisible']   = false;
    }


    /**
    * Hides all dropdowns
    */
    function AutoComplete_HideAll()
    {
         if( __SLI_customisations[ __SLI_ApplicationName ][ 'ValidSearchBoxes' ] )
         {
               for(var i=0; i < __SLI_validSearchBoxes.length; i++)
               {
                   if(document.getElementById(__SLI_validSearchBoxes[i]))
                   {
                       AutoComplete_HideDropdown(__SLI_validSearchBoxes[i]);
                   }
               }
         }
         else
         {
                for (id in __AutoComplete)
                {
                   AutoComplete_HideDropdown(id);
                }
         }
    }


    /**
    * Highlights a specific item
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    * @param int    index The index of the element in the dropdown to highlight
    */
    function AutoComplete_HighlightItem(id, index) // mouseover, index is the list element index, zero-based
    {
        if (__AutoComplete[id]['dropdown'].childNodes[index]) {
            for (var i=0; i<__AutoComplete[id]['dropdown'].childNodes.length; ++i) {
                if (__AutoComplete[id]['dropdown'].childNodes[i].className == 'autocomplete_item_highlighted') {
                    __AutoComplete[id]['dropdown'].childNodes[i].className = 'autocomplete_item';
                }
            }

            __AutoComplete[id]['dropdown'].childNodes[index].className = 'autocomplete_item_highlighted';
            __AutoComplete[id]['highlighted'] = index;

            //also see below...
            //__AutoComplete[id]['element'].value = __AutoComplete[id]['dropdown'].childNodes[index].innerHTML;
            //AutoComplete_SetValue(id);
        }
    }


    /**
    * Highlights the menu item with the given index
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    * @param int    index The index of the element in the dropdown to highlight
    */
    function AutoComplete_Highlight(id, index) // keyboard up/down - index is the direction of travel, 1==down,-1=up
    {
        var childNodes = __AutoComplete[id]['dropdown'].childNodes;
        if(childNodes.length)
        {
	        var lastItem = ( ( childNodes[ childNodes.length - 1 ].className != 'autocomplete_footer' ) ? childNodes.length - 1 : childNodes.length - 2 );

            // Out of bounds checking
            //if (index == 1 && __AutoComplete[id]['highlighted'] == __AutoComplete[id]['dropdown'].childNodes.length - 1) {
            if (index == 1 && __AutoComplete[id]['highlighted'] == lastItem ) {
                childNodes[__AutoComplete[id]['highlighted']].className = 'autocomplete_item';
                __AutoComplete[id]['highlighted'] = null;

            } else if (index == -1 && __AutoComplete[id]['highlighted'] == 0) {
                childNodes[0].className = 'autocomplete_item';
                __AutoComplete[id]['highlighted'] = lastItem;
                index = 0;//hack!
            }

            // Nothing highlighted at the moment
            if (__AutoComplete[id]['highlighted'] == null) {

                childNodes[0].className = 'autocomplete_item_highlighted';
                __AutoComplete[id]['highlighted'] = 0;
                newIndex = 0;
                
            } else {

                if (childNodes[__AutoComplete[id]['highlighted']]) {
                
                    childNodes[__AutoComplete[id]['highlighted']].className = 'autocomplete_item';
                }

                var newIndex = parseInt( __AutoComplete[id]['highlighted'] ) + parseInt(index);

                if (childNodes[newIndex]) {

                    childNodes[newIndex].className = 'autocomplete_item_highlighted';

                    __AutoComplete[id]['highlighted'] = newIndex;
                }
            }

            //populate textbox with currently highlighted term...
            //__AutoComplete[id]['element'].value = __AutoComplete[id]['dropdown'].childNodes[newIndex].innerHTML;
            AutoComplete_SetValue(id);
        }
    }


    /**
    * Sets the input to a given value
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_SetValue(id)
    {
        __AutoComplete[id]['element'].value = __AutoComplete[id]['dropdown'].childNodes[__AutoComplete[id]['highlighted']].innerHTML.replace(/&amp;/, "&");
    }


    /**
    * Checks if the dropdown needs scrolling
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_ScrollCheck(id)
    {
        // Scroll down, or wrapping around from scroll up
        if (__AutoComplete[id]['highlighted'] > __AutoComplete[id]['lastItemShowing']) {
            __AutoComplete[id]['firstItemShowing'] = __AutoComplete[id]['highlighted'] - (__AutoComplete[id]['maxitems'] - 1);
            __AutoComplete[id]['lastItemShowing']  = __AutoComplete[id]['highlighted'];
        }

        // Scroll up, or wrapping around from scroll down
        if (__AutoComplete[id]['highlighted'] < __AutoComplete[id]['firstItemShowing']) {
            __AutoComplete[id]['firstItemShowing'] = __AutoComplete[id]['highlighted'];
            __AutoComplete[id]['lastItemShowing']  = __AutoComplete[id]['highlighted'] + (__AutoComplete[id]['maxitems'] - 1);
        }

        __AutoComplete[id]['dropdown'].scrollTop = __AutoComplete[id]['firstItemShowing'] * 15;
    }


    /**
    * Function which handles the keypress event
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_KeyDown(id, e)
    {
        var result = true;

       var event;
       event = e;
       if(!event) event = window.event;

        var keyCode = event.keyCode;

        switch (keyCode) {

            // Return/Enter
            case 13:
                if (__AutoComplete[id]['highlighted'] != null) {
                    AutoComplete_SetValue(id);
                    AutoComplete_HideDropdown(id);
					
                    __SLI_asug_used_flag = true;
					
                    if( e = __AutoComplete[id]['element'].form['asug'] )
                    {
                        
                        e.disabled=false;
                        e.value = __AutoComplete[id]['asug'];
                    }

                }

                result = AutoComplete_submitForm(id);

                break;

            // Escape
            case 27:
                AutoComplete_HideDropdown(id);
                event.returnValue = false;
                event.cancelBubble = true;
                break;

            // Up arrow
            case 38:
                if (!__AutoComplete[id]['isVisible']) {
                    AutoComplete_ShowDropdown(id);
                }

                AutoComplete_Highlight(id, -1);
                AutoComplete_ScrollCheck(id, -1);
                
                if( e = __AutoComplete[id]['element'].form['asug'] )
                {
                   e.disabled=false;
                   e.value = __AutoComplete[id]['asug'];
                }

                                
                result = false;
                break;

            // Tab
            case 9:
                if (__AutoComplete[id]['isVisible']) {
                    AutoComplete_HideDropdown(id);
                }
                return;

            // Down arrow
            case 40:

                if (!__AutoComplete[id]['isVisible']) {
                    AutoComplete_ShowDropdown(id);
                }

                AutoComplete_Highlight(id, 1);
                //AutoComplete_ScrollCheck(id, 1);

                if( e = __AutoComplete[id]['element'].form['asug'] )
                {
                   e.disabled=false;
                   e.value = __AutoComplete[id]['asug'];
                }

                result = false;
                break;
        }
        return result;
    }


    /**
    * Function which handles the keyup event
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_KeyUp(id, e)
    {
       var event;
       event = e;
       if(!event) event = window.event;

        var keyCode = event.keyCode;

        switch (keyCode) {
            case 13:
                event.returnValue = false;
                event.cancelBubble = true;
                
                break;

            case 27:
                AutoComplete_HideDropdown(id);
                event.returnValue = false;
                event.cancelBubble = true;
                break;

            case 38:
            case 40:
                return false;
                break;

            default:
                AutoComplete_ShowDropdown(id);
                
                __AutoComplete[id]['asug']=__AutoComplete[id]['element'].value;

                if( e = __AutoComplete[id]['element'].form['asug'] )
                {
                   e.disabled=true;
                   e.value = "";
                }  
                
                break;
        }
    }

    /**
    * Function which handles the keypress event
    * This function added April 2008 by Andrew Grieve
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */

    // SLI Code Modification - Start - Andrew Grieve April 08
    function AutoComplete_KeyPress(id, e)
    {
        var event = e;
        if(!event) event = window.event;
        var keyCode = event.keyCode;

        if (keyCode == 13 && isGecko || isOpera)
        {
            return false;
        }
        
        if( __SLI_customisations[ __SLI_ApplicationName ][ 'TargetURL' ] )
        {
            if (keyCode == 13 && isIE)
            {
                return false;
            }
        }
        
    }
    // SLI Code Modification - End

    /**
    * Returns whether the dropdown is visible
    *
    * @param string id    The form elements id. Used to identify the correct dropdown.
    */
    function AutoComplete_isVisible(id)
    {
        return __AutoComplete[id]['dropdown'].style.visibility == 'visible';
    }

    function AutoComplete_submitForm(id)
    {
        var e, f, result=true;
        if( f = __AutoComplete[id]['element'].form )
        {
            if( __AutoComplete[id]['element'].value != '' )
            {
            	if(__SLI_asug_used_flag == true)
            	{
                   if( e = f['asug'])
                   {
                      e.value = __AutoComplete[id]['asug'];
                      e.disabled=false;
                   }
                }
                
                if( __SLI_customisations[ __SLI_ApplicationName ][ 'TargetURL' ] )
                {
                	asugvar = "";
                	if(__SLI_asug_used_flag == true)
                	{
                	  asugvar = '&asug=' + __AutoComplete[id]['asug'];
                  	}
                    
                    sliRegex = /resultsdemo\.com/;
                    if(sliRegExArray = sliRegex.exec(document.domain))
                    {
                    	sliRegex = /^http:\/\/(.*)\//;
                    	sliTargetDomain = sliRegex.exec(__SLI_customisations[__SLI_ApplicationName ][ 'TargetURL' ]);
                    	__SLI_customisations[__SLI_ApplicationName ][ 'TargetURL' ] = __SLI_customisations[__SLI_ApplicationName ][ 'TargetURL' ].replace(sliTargetDomain[1], document.domain);
                    }
                    
                	document.location.href = __SLI_customisations[__SLI_ApplicationName ][ 'TargetURL' ] + __AutoComplete[id]['element'].value + asugvar;
                }
                else
                {
                	f.submit();
                }
                
                AutoComplete_HideAll();
            }
            else
                result = false;
        }
        return result;
    }
    
    // get the style that will be applied by the browser, including stylesheets
    function sli_getStyle(el,styleProp)
    {
      if (el.currentStyle)
        var y = el.currentStyle[styleProp];
      else if (window.getComputedStyle)
        var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
      return y;
    }

    // register with onLoad(er...
    _sli_init.push( AutoComplete_init );
    
    function sli_addEvent(obj, evType, fn) {
    	if (obj.addEventListener) {
    		obj.addEventListener(evType, fn, false);
    		return true;
    	} else if (obj.attachEvent) {
    		var r = obj.attachEvent("on" + evType, fn);
    		return r;
    	} else {
    		return false;
    	}
    }
    
    function sli_load()
    {
    	sli_addEvent(window, 'load', sli_init);
    }
