/* Popular phrases - SMITHBROTHERS - 15:48:9, Fri Nov 20, 2009 */
var asPhrases=new Array ('saddles','spurs','bits','saddle pads','headstalls','halters','bell boots','spur straps','chaps','reins','ropes','saddle blankets','jackets','cooler','hay bag','belts','boots','rope can','custom spurs','barrel saddles','horse boots','goat string','helmet','breastcollar','rope halter','wormer','ladies boots','saddle rack','classic equine saddle pad','quirt','hackamore','ariat boots','clippers','calf ropes','goat tying dummy','vest','rope bag','roping dummy','big d','splint boots','bridle bag','western saddles','shipping boots','stirrups','ariat','lead rope','cinch','blankets','bareback pad','bosal','tack bags','bridles','leather halter','down jacket','snaffle bit','sleazy','rambo','show shirts','barrel reins','garment bag','ranch rope','sheet','pads','classic equine boots','mens boots','straw hats','hats','breakaway rope','professional choice boots','hat can','saddle bags','girth','flank cinch','skid boots','correction bit','hobbles','show saddles','one ear headstall','martingale','tail wrap','myler bits','hay net','chinks','turquoise','curb strap','caveson','split reins','polo wraps','classic equine','horn wraps','mayatex blankets','lunge line','bronc halter','caps','mules','winter blankets','personalized halters','latigo','saddle carrier','concho\'s','back cinch','smb elite','marlene mcrae','shin guards','pro equine boots','cowboy magic','leather split reins','rowels','kids boots','fatbaby boots','show halters','boot bag','knives','turnout blanket','bag','browband headstall','side pull','piggin strings','tie down','justin boots','black belt','nylon halter','draw reins','blanket rack','custom rope cans','perfect bit','saddle cover','horse blankets','bumper spurs','sleazy\'s','pole bending bases','wool saddle pads','romal reins','ariat mules','magnetic sheets','roping gloves','closeouts','custom halter','grooming tote','fly sheet','magnet','dewormer','barrel saddle pads','german martingale','classic equine bell boots','belt buckles','fly','double j headstall','stable blanket','gypsy cowgirl boots','seat saver','tack sets','roping reins','down vest','boots for men','hobby horse','chain bit','tail bag','kids rope bags','martin saddle','monogrammed halters','bailey hats','youth saddles','over and under whip','ariat terrain','gag','nylon sheet','wool pad','nose band','ladies ariat boots','ariat fatbaby','classic equine legacy system','5 star pads','smb','oster','off billet','angora','noseband','hoof boots','trailer','hay bale bag','tail','sleazy sleepwear','reinsman saddles','canvas duck blanket','monogram','troxel','big d cooler','waterproof blanket','goat can','carry all collection','show bridle','saddle carry','martha josey bit','rain sheet','leather skid boots','gear bags','cowboy hat','open range','roper reins','ariat probaby','polka dot','open range blankets','nylon reins','breakaway','cross tie','slinky','barrel','charmayne james saddles','cosequin','fatbaby','necklace','barrel racing bits','small mesh hay net','bosal set','1849','knotted halter','left handed ropes','grand hoof','youth boots','turnout sheet','boots for horses','roping saddles','bucket','mayatex','resistol','pink saddle pad','twisted x','charmayne james saddle pad','youth spurs','francois gauthier bits','kids rope','timer','twisted snaffle','bailey','steer head','smx air ride pad','tie strap','davis bell boots','pulling collar','trailer accessories','barbwire','zipper pad','chair','number magnets','justin pad','western boots','gypsy','fork','alamo','ladies vests','fly mask','slobber straps','weaver headstall','reining saddle','western spurs','tucker saddles','hyla rx','jerkline','heel ropes','barrel racing breastcollars','gloves','yearling','kaminski','foal blanket','cones','bio fit','roper boots','bareback','tyler magnus ropes','showmanship top','brushes','double ear','cross headstall','triple e custom halters','myler','rope halter with lead','professionals choice','camo','western saddle pads','wade saddle','flag','reinsman x series','charmayne james','whip','outerwear','ariat jacket','ariat belt','treats','bareback saddle pads','alpaca','blanket pins','5 star','leg wraps','scarf','rope organizer','shirts','esp pad','million dollar bit','roping spurs','stirrup pads','latigo strap','justin aqha boots','shoes','hock','cinch hobble','protective vest','davis splint boots','sport boots','polo','show headstall','legacy','kids hats','dark oil','cowgirl boots','front boots','youth spur straps','bucking rolls','reinsman bit','barrel racing reins','stampede string','nylon headstall','kensington','concho belt','goat tying string','billet','sweet iron','sidepull','wither pad','circle y headstall','stable sheet','quick change','thrush','show pants','fleece cooler','resistol 20x','pink patron rope','msm','horn bags','rhinestone belt','weatherbeeta','cashel saddle','show bits','cashel','mecate reins','cinch jeans','mecate','headset tiedown','blocker lead','sherry cervi bits','riser pad','cross ties','cactus saddlery','magnus','hock wraps','glitter','kiwi','callaway','rope bags and cans','martha josey reins','open range sheet','camo sheet','calf head','cinchas','headstall with brass','horse collar','rack','tacky too pad','flag carrier','training fork','mens western shirts','hat rack','classic equine legacy boot','buddy seat','gag bit','leather reins','trailer screens','vaquero headstall','stran smith calf rope','rambo blankets','strongid','driftwood','pro equine nylon sheet','browband','showbaby','mohair cinch','sherry cervi','children boots','buckle','cribbing','probaby','impact gel saddle pads','alamo saddles','toklat','pink','bosal hanger','badlands','sure seat','mountain horse jacket','cactus ropes','myler comfort snaffle','fast back','hood','rawhide tiedown','bridle rack','bob avila correction bit','knife','weaver cinch','spur rowels','western chaps','hay rack','roper cinch','billy cook roping saddle','gt4','tie ring','felt pad','neon headstalls','saddle stand','gypsy boot','show tops','braided barrel rein','neoprene girth','tony lama boots','blanket bar','chill chaser','curb','chin strap','gag bit and bridle','big d halter','ariat probaby boots','pro equine sports boots','braided reins','5star saddle pads','blanket bag','down','gumball spurs','brannaman','hanger','curb bit','protective boots','sport tech','orange sheet','pretzel bit','bosal reins','lamina saver','5 star cinch','silver','trophy halter','sharon camarillo saddle pad','psyllium','mane tamer','backpack','saddle cushion','wool felt saddle pad','dog bone snaffle','joint supplement','orange boots','shim pad','ballistic overreach boots','fleece jacket','lime','mens ariat boots','string trainer','esp','show of faith','charmayne james bits','smb boots','naughty nighties','aluminum stirrups','wonder gag','double ear silver headstall','halter bag','cactus saddle','night latch','equitation','nippers','hobby','magnetic number holders','equine legacy','tucker','bonnie the goat','triple e','healthy coat','purple breastcollar','barrel racing pad','lead','teal','pink sheet','greg darnall','ostrich boots','platform','thrush buster','value pack','basket headstall','ariat carson','habanero','24','classic saddle pad','tail hair mecates','20x extreme','halter kathy\'s','1000 denier blankets','3 piece snaffle bit','cowboy hat caddy','carryalls','curb chain','mtg','wahl','contour saddle pads','barrel stirrups','goat tying','kodiak','training bit','phone','sheepskin saddle pad','over under','jeans','mens vest','double j','vet wrap','oster blades','darnall','socks','chock','lyles','black green','equitation spurs','western helmet','wonder bit','neck cover','bale bag','horse sheets','wade','ranch saddle','crepe boot','striker','ultimate four','stirrup hobbles','pink shirt','halter bridle','smb value pack','halter lead','wrangler jeans','youth roping saddle','dally','winter boots','custom saddle pad','roper horseshoes','alpaca cinch','supplements','hott wash','duck blanket','marlene','trailer organizer','show spurs','safe guard','hat size','pony tail holder','green','orthosport','flex','cribbing strap','twenty x','tapaderos','show belt','knotted reins','light oil','bridle headstall','ariat barnyard','red halters','lyles pink poison','hurricane blue','vitamin e','mens down vest','drag','cooler sheet','nylon tie down','big d blanket','hoof pick','cowperson','quick wrap bell boots','turquoise headstall','junior cowhorse bit','goat rope','back girth','ariat legend boots','chicago screws','stall fork','stirrup leathers','barrel pads','1 2 pad','closed front blanket','roping stirrups','phoenix','horse coolers','impact gel','nu image','reining spurs','mens jackets','saddle pads with pockets','probaby boots','anderson bean','hollis gag','western saddle pad bag','close contact saddle pad','spyderco','barn boots','waterproof sheet','heritage stockman','d ring snaffle bit','turquoise halter','round roper rein','barrell reins','heavy reins','ladies down jacket','vaquero bridle','hair on headstalls','14 saddle','hot pink','3 piece','copper twist snaffle','no turn boots','leather headstall','youth','ariat vest','chestnut','hair-on','trailer accessory bag','short shank correction bit','coffee gator','cognac ostrich','show curb','pink rope','weapon rope','dot diva','electric blue','small gear bag','fast stop','stainless steel spurs','antique spurs','horse pads','cordless clippers','support boots','knotted barrel reins','muck cart','pink reins','pro tech boots','headstall reins mecate','cross concho','round pad','popper','harness','ladies down vest','western show shirt','barrell saddles','training headstall','wool saddle blankets','calf roping saddles','trail saddle','fenders','buckaroo boots','hoof pick holder','smx air ride','royal blue saddle pad','rolling hay bag','splint','mens shirts','canvas blanket','panacur','western girth','wax','stockman','diamond spur','stirrup buckles','saddle fit','3 8 scant','pink stable sheets','pistol headstall','clipmaster','bucket straps','western hat','hay','high country plastics','silver halter','head ropes','cooler blanket','cellphone','saddle strings','tom thumb','show blankets','joint combo','martin wade','ladies belts','rambo quarter horse','jim warner','k bar j','tough enough to wear pink','riser','thermometer','bale','western saddle bag','cricket','rolled reins','monogrammed jackets','poker','size 11','pro boots','impact pad','heart concho','diamond wool pad','nylon breastcollar','showmanship','wonpad','tote','sand clear','pro equine','foal','vegas tunic top','esp wool pad','sharon camarillo','wraps','kids stirrups','poles','twinkle toes','tory','horseshoes','western bits','turtle','overreach boots','twisted snaffle bits','avila','saddlebags','hoof care','tucker trail saddle','spur pins','tender touch bit','braided lead','mens jeans','rope bronc halter','little s hackamore','shank bits','window art','george strait ladies','fiador','viper','big d all american','dale fredricks','hot wash','riding boots','cowboy boots','dog bone bit','smith brothers saddle pad','goat','neck rope','butterfly top','no turn bell boots','liniment','pro equine camo','pink saddle blanket','slicker','flame','smb elite boots','custom rope can cover','ostrich saddle','nylon billet','terrain','split ear headstall','ekto 7','allen bach','justin saddle pads','box','youth vest','muck','boots for children','roping cinch','purple saddle pads','cowhorse','show tank','utility hook','weaver tack','harness leather headstall','pink bridles','cool back','mens down jacket','bmb cooler','mens','ekto','aubergine','tough-1','barrel racing saddle pads','water','trunk','earrings','orange saddle blanket','davis','orange','blanket liner','western legend saddle pad','bucket heater','trailer door caddy','pad rack','sweet six bit','smx','over reach boots','round pen','purse','heated bucket','aluminum bit','quick release','neoprene breastcollar','anderson bean boots','poultice','pepi','lime green','hoof polish','muck bucket cart','high withers','lacer boots','custom rope','luke jones','green camo','apache','pro sling boot','professionals choice smb ii','pink and black','earth','bay','ladies riding boots','wells 5 star pads','insulated boots','bumper','horse wraps','rawhide headstall','wrangler pad','dally wrap','neon','pro tech','ladies 3 in 1 jacket','cowboy headstall','turnout','feed buckets','pole bending','cowboy decor','roughout saddle','quick change headstall','mirror','slobber','california pleasure bit','darnall spurs','double diamond','boot covers','pocket halter','sand','ladies jacket','smith brother bags','ariat heritage','twisted wire bit','pants','blue saddle blanket','ladies ropers','rodeo','ariat cobalt xr','tack cart','skid','orange saddle pad','fleece','low port bit','hollis','rolls','tall','rambo cooler','saddle blanket 30 x 30','canyon','weaver girths','calf roper','wonder','tom balding','training reins','headstall with noseband','tom balding bits','headin rope','blevins buckle','orthopedic pads','saddle pad liner','show pads','smith brothers open range blanket','rubber','absorbine','ivermectin wormer','tush cushion','dmso','detangler','twill shirts','cactus magnet','cutter pads','double weave saddle blanket','cutting reins','cutter collection pad','pyrantel','rockies','hobby horse chaps','wellington boots','roping pads','smooth snaffle','1200 denier','big d custom','saddle horn bags','international','sure grip saddle seat cover','chaparrel','big d stable blanket','cowboy magic shampoo','david motes saddle','wrangler hay bag','tom thumb bit','kids chaps','vaquero','horn knot','big d turnout','hypnotic head rope','classic equine skid boot','numbers','crystal','easy boot','screws','midweight','whistler','flarida','rosebud spurs','lace up ropers','camo halter','basketweave breastcollar','shapleys','tugs','1849 ranchwear showmanship top','nettles','poker design black spurs','barrel racing spurs','professional\'s choice horse boots','davis boots','x3-3342','ladies boots red','mane and tail growth','heart spurs','blue bridles','brass','aqua dish','davis splint','bridle leather spur straps','ustrc','flower bell boots','ported chain bit','resistol straw','western shirts','decals','small mesh hay bag','todd slone saddle pads','schutz','wildfire belts','feed scoop','hoodie','window screen','turquoise breastcollar','tie dummies','stall guard','rolling bale bag','holder','fly control','flank','rawhide','bay apache','pocket knives','cutting bit','ladies gypsy','reversible','borderland','andis clippers','ariat manzanita mules','bot','selenium','step','breastcollar tugs','collar','chondrogen','training saddle','zipper','heeling','windmill headstall','reining bit','water bottle','camo blankets','braid tail wrap','medium weight blankets','rawhide stirrups','ranger belt','special effx','kyle','horse wormer','classic equine cinch','miracle groom','bio plus','mcnasty','ariat bags','horns','stud chain','horse tack','smith brother barrel saddle','southern cross belt','heated water buckets','rope bridle','felt','strongid c','rawhide braided nosebands','ladies show shirts','cashel trail saddle','shampoo','honda','cowboy spur strap','toklat cinch','blouse','professional choice pad','valance','ostrich','mohair roper cinch','rein chains','feeder','hooks','hammer','calming','stall chain','absorbine gel','santa fe spray','ladies jeans','buckaroo spur strap','pistol','martha josey pole bending bases','molly powell','dura wrap','quarter','chocolate hat','satin cooler','tucker bridle','maltese cross','braided rope halter','turtleneck','telluride h2o','hoof supplements','san juan','cactus headstall','roughout','mens justin boots','cotton sheet','felt liner','lime saddle pad','vacuum','smarty pants','lime green reins','german','billy allen bit','accel','training halter','slone','lexol','charmayne','wool','jolly ball','horse clippers','andis blades','davis designer','horse splint boots','hobby horse show blouses','hampton','waterproof winter blanket','jinglebob spurs','rancher gloves','ariat carson mules','praying cowboy','orange tack','waterproof boots','winter riding apparel','riding helmet','double concho','german reins','dvd','powerline','soft rope','mane','cobalt','combination bit','side reins','rattler','neon barrel rein','cowperson headstall','martin all around','overlay halter','horsehair','spoon','feed bins','sherri','charmayne james smx','chondrogen eq','silver show reins','blades','mcrae','double end snap','loomis shank','abetta buddy seat','finish line fluid action','vetrap','kelly kaminski barrel saddles','blocker tie ring','classic equine pad','soft touch','tack','likit','orange pad','neoprene saddle pad','bmb','little s','cactus saddlery headstall','mohair girth','rope training halters','sheath','nylon trophy halter','pink halter','mullen','ariat showbaby','spur hangers','rain','pvc cinch','training','dry storage','vetrolin detangler','abetta buddy','mini mag','rosin','pad liner','weaver halter','leather chaps','roper shoes','quarter horse blanket','mach 3','rust','kodiak big d blanket','ring snaffle','smb elite value pack','bucket hook','aura','cough free','justin blanket','red cell','grand','hay hook','engraved spurs','winter riding boots','co-flex bandage','show touch up','rambo turnout','kensington 420 denier blanket','leg','latigo tie strap','red shirt','saddle pad case','combo boots','vetrolin','conquer','training lead','horse trailers','turquoise saddle','green hornet','eqyss','yellow bell boots','gypsy cowgirl','oster tail brush','purple sheets','crusader fly mask','gel saddle pads','iron silk ropes','justin remuda boots','hot shot','ladies roping saddles','show slinky','navajo blanket','smb 3','ariat ladies belt','neck sweat','horse bits','instinct','caution sign','heart concho collection','turtle neck sheet','acorn oak','cowperson nickel cross','turtleneck blanket','cross bridle','blocker halter','microfleece','1200 denier horse blankets','roping breastcollars','camarillo pad','training surcingle','martin barrel saddle','todd slone','heavyweight turnout blanket','justin glove','colt','no bow','charmayne james barrel cinch','cruel','ride right','airflex','cinch latigo','cob','ladies ostrich boots','embroidered','spur accents','vitamin c','spur buttons','sunset','initial spurs','3 in 1','inverter','pvc pad','quarter horse sheet','headstall with hair','sweat','bridle carrier','equimax','big d sheets','leather cross','body protector','replacement slides','leather over and under','oxbow','stampede','blue','rowdy the roping toy','bob\'s saddle','black breastcollar','purple show shirt','mustang','dorrance','chill','centaur','t shirts','corner hay bag','thinline','showsheen','contoured wool saddle pads','ariat terraine waterproofer roper','alamo headstall','big d hood','surcingle','open range stable blanket','26 cinch','bucket holder','cactus breastcollar','draw headstall','josey','hot stuff','color girth','rope can strap','pistol belt','easy stop','smb combo','circle y show saddle','tiedown holder','probaby lacer','rockies jeans','calf strings','rally','stable cart','contour pad','5 star saddle pad','fluid flex','ice packs','pyranha','shank snaffle','charlie','calm coat','cervi bit','men\'s roper','hyaluronic acid','stifle','diamond concho halter','fringe breastcollar','headstall bag','reining dvd','simple minds rollin ropin tuffy','hair on hide','rowel belt','low port','power curb chain','fence feeder','orange reins','kopertox','jewelry','source','rope noseband','custom saddle','b-l','pink camo blanket','concho headstall','b-l solution','twisted wire','games','western jackets','headstall with bit','carry case','kathys halter','gussets','rope nose tie down','ice','big d turnout blanket','sorrel spray','george strait mens boots','water heater','quilt wraps','ariat crossfire','bio pad','next level','toklat girths','braided poly lead','ariat telluride','hector','pms pants','yellow','the perfect pattern','roper slip-on shoes','soft cinch','charlie the smart dummy','pro equine sheet','tyler magnus','bob avila bits','leather splint boots','rapid rain','bale cover','turquoise reins','stall front bag','herculon','nylon barrel reins','justin chukka','magnetic number pins','blanket monogram','ariat lacers','cutter','neon breastcollar','sidepull halter','hampton lead','economy shipping boots','mane growth','texas star','martha josey million dollar bit','hind boots','custom sheet','tuff stuff','30 x 30 saddle pad','elite value pack','navajo felt pad','detergent','zebra hay bag','surgical scrubs','orange neon','fold it cart','work pad','mens western boots','casa zia','hoof','black training bit','caspian','five star pad','brindle hair','yellow saddle pads','trail halter','twisted x ladies','performance boots','d ring bits','split ear','max flex','chocolate chaps','shaped ear','green saddle','chew','rubber bucket','calf roping ropes','martin wade saddle','conway','box pads','california pleasure','feed','folding dura cart','welly warmers','u-gard','adjustable halter','smb sport medicine boots','polo bandage','twitch','purple reins','chap bag','carlos combo saddle','antique','gaming reins','knotted training halter','case','heart headstall','weight builder','mule bit','vitamin e and selenium','kathy\'s','stran smith','quick bit','navajo saddle pad','ariat crepe','nose','ice blue','long latigo','barrel reins turquoise','ariat chaparrel jacket','cutback','motes','star concho','pull on bell boots','driving reins lines','hobby horse tucson','pad bag','aisle','magnum','wendals','youth stirrups','mesh bag','hoof nipper','western hat can','scarf slides','quietex','faith','saddle blanket case','simple boot','champion tail','anderson boot','10.5 4 strand calf rope','grand complete','red eye','slip on','snaffle port','cactus saddle pad','sierra rope can','stall drapes','big d grand prix','whitener','telluride','cactus xplosion rope','handy horns','coil hose','burgundy','lister','george strait','tub','fetlock boots','mountain horse boots','ladies roper boots','barb wire','start to finish bit','roping stand','performance shirt','mosquito spray','mens lace up boots','classic equine top load hay bags','elite','smith brothers ropes','revolution','montrose','scoop','ramrod','classic equine esp contour saddle pad','ariat purse','colt bit','flex joint','no turn dl','shoer\'s friend','soft store dry','ariat black','cotton roping glove','open range hood','billy cook barrel saddle','million dollar','classic equine bag','tri tec 14','pink brush','soft dry storage system','pro equine sport','rubber bit','batwing','pink belt','cotton roping reins','customize your saddle','magnet rope','barrel covers','deo lotion','grooming cart','western pads','kelsey jeans','custom blanket','stirrup strap','record breaker','smith brothers blanket','neighlox','hoofmaker','net','bl solution','feed storage','leather noseband','tail brush','yellow headstalls','cinch buckle','custom saddle bag','smith brothers zipper ii pad','open range turnout sheet','sling boots','tory oklahoma rein','tory headstalls','cactus pad','electro-groom','leather tack sets','big d nylon hood','mirage tank','jean jacket','mohair saddle blanket','western legends pad','trailer window','soaking boot','western turtle stable blanket','memory foam pad','aqha','classic gold','wells saddle pads','scrunchie','touch up spray','5 16','reinsman mississippi','moisturizer','cashel stirrup cushion','boker','oster clipper blades','e-z mount stirrup','blade wash','ration plus','fluid action','maltese','raised pad','saddle set','white poly','orange halters','winning numbers','headstall rack','show stirrups','x3-2507','antacid','black and white saddle pad','tunic show top','drapes','cowboy hat helmet','windmill','syn-felt liner','custom horse blankets','sm boots','white bridle','turquoise sheet','scraper','cactus noseband','shin','purple halter','rope bosal','classic equine biofit saddle pad','10.25','white shirts','excalibur','black reins','card','southwest','ortho sport','rio concho','blanket storage','star racer','western show jackets','leather curb chain','flex hook','london','floral headstall','latigo rein','polar','b calm','off','fly spray concentrate','combination boots','casa','pulley','clincher','traditions west','martha','cotton hay net','ladies outerwear','profession choice cinch','red lead','engraved stirrups','shank','boredom breaker','pendant','hand painted belt','beaded headstall','comfort snaffle','replacement stirrup','team roping dvd','saddle cinch','repair','mb 04','quitt','charmayne saddle','folding cart','spring bit','ring snaffle bit','equisect','futurity','martin reins','ssg pro-tex heeler','back brace','hanging bags','classic equine pro tech','justin remuda','crepe','sharon','western legend','health','build up saddle pad','black split reins','summit jacket','george','throat sweat','ice horse','sensorflex','pool dummie','coil tie','scamper saddle','fan','fortiflex','supersweat','base','dress sheets','international helmet','wooden stirrups','smith brothers calf rope','skid boot ed galemba','dot spur','half wonder bit','wrangler skid boot','cotton shirt','bigeloil','grand flex','bonnie','cinch knives','classic equine knee boot','pink star saddle','lime pad','paisley','smx saddle pads','high wither pad','wheat germ oil','day sheet','coral saddle blanket','big d nylon sheet','stifle ice boot','todd','eyelet tank','sussex','ranger star','full bars','ladies crepe boots','hay bale','horse bell boots','honeycomb','pink wrap','classic rope bag','handozer','pro equine super sling boots','crepe sole square toe','designed rope cans','it\'s a cinch pro series','big d magnum','leather browband headstall','tangerine','leather lead','net scrunchie','foundation','medication','orthosport pad','succeed','latch','harness leather split reins','body','professionals choice blankets','coral','wells','colored tack','lime green bell boots','mens white shirt','freedom','cuffs','x3-0432','conditioner','rear boots','hobby horse ultrasuede belt','knee support','blue classic equine boots','denero','impact','equitation chaps','fan holder','supreme turnout sheet','left handed gloves','justin equine','orange polo wrap','black show shirts','trail shoes','twill','tacky','simple','trail reins','brush pad','old timer','electric orange','destiny calf rope','spirit','flowers','plastic burner','pastern boots','iron silk calf ropes','trailer caddies','windmill horse hair','b12','red reins','cactus saddlery rawhide braided','canvas sheet','smith brother show top','latigo headstall','horse hoof boots','mohair blanket','magnesium','size 14 boots','cook','ladies anderson bean','show snaffle','hobby horse hat','braided goat strings','low rise','blocker training halter','zoom rope','sore','pro equine bell boots','zipper ii pad','carlos combo','summer sheet','leather curb','folding saddle rack','latigo split reins','wipe and spray','pepi spray','saddle blanket liners','leather bundle','natural fly spray','barrell saddle pads','martin noseband','grip','royal blue halter','tyler','pink helmet','teal boots','wool saddle','collapsible tack rack','horse ear plugs','royal','mad dog','old west','original head rope','reversible saddle blanket','harness reins','dee ring snaffle','headin','windmill horse hair headstall','double j ranger','pleasure bit','horse masks','cactus back cinch','pink camo hay bag','hitch cover','black ariat boots','mike','fortiflex bucket','show vest','braided nylon quirt','hollis gag bit','clipmaster blades','blue halter','one-ear headstall','smith brother turnout','tail conditioner','james bit','neck fly sheet','white spray','dy no turn','shaped steer roper','performance roper','twill oxford','deluxe rope bag','james','simple horse boots','justin bell boots','nu-image','equigest','san saba','cool boot','lamina','mach 3 plus','floatin','o s','reiner saddles','rosie gag','1.87%','float','nylon nose band','tekno crepe','western ties','slotted conchos','classic equine saddle','classic powerline rope','pro shipping boots','classic equine sensor flex pad','wine','proven stone','leather stampede strings','x3-2405','horse skid boots','classic equine hind boots','show pins','tory show halter','big d bag','inlay','paste','ranger 2000','duane latimer','nylon camo halter','door organizer','cowtown','medium oil','lime bell boots','transition bit','solocomb','ranchwear pants','western star','champions choice rope bag','youth tapaderos','latigo boots','green spot','burgundy headstall','collared shirts','rear saddle bags','lifted bit','cricket bit','pink blouse','toddler pants','calf collar','contender','slick and easy','hyalun','saddle rope strap','dura cart','men\'s jean','show tunic','bean','barrel knee guards','tea tree oil','high tree saddles','letters','stitches reins','dl boots','converter','neck fly','wall bracket','mach 4 rope','congress','rope honda','troxel sport','blue saddle','corta','orange cones','saddle under pads','sage','corner plates','knotted headstalls','black rope reins','pocket pro','ex stress','horse stalls','replacement clipper blades','nylon lunge','thin','suede chaps','hot pink halter','electro-plex','tory oklahoma','basic turnout fly sheet','vita','xxl shirts','rawhide halter','record','pink cinch','classic equine no turn bell','nylon browband headstall','roughout fenders','simplicity bit','smith pad','rattler inverter','supply bag','d l reiner','ez trap','seven bit','classic equine square pad','hay cart','d&l reiner','cactus felt saddle pad','grand ha synergy','western riding boots','synergy ha','gentle bits','purple belt','tri-tec','ruffstock','pink hats','leather quirt','panic snap','san saba boots','american hat','barrel roping combo saddle','western hat straw','panache show top','cotton quilts','black satin bumper spurs','blue belt','hobby hors','engraved bit','ky rotary bits','rosanna tunic','pms','select i','horse show numbers','uv','q crepe','sleeveless slinky','orthopedic','hanging feeders','saddle blanket pins','bound edge','u gard','classic equine contour','james saddle','black bosal','boot laces','yellow shirt','berry concho','beaver','laced reins','hobby horse show do pony tail','delmar','foam pads','effx','lavender show shirt','blanket carry','arm band','bach','clover','hunter wellies','black leather reins','applicator mitt','pro equine hind boots','ariat eyelet','cinco concho','troxell','hyaluronic','pool','seven','pressure relief pocket saddle pad by diamond wool','deo-lotion','kelly kaminski','twisted sweet iron','lift','proven','fold it','equimedic','wheat germ','ladies buckaroo','pink rope halter','groom boots','rawhide steer head','dale','khaki shirts','natural reins','classic spur','irh helmet','super sling boots','confidence plus','rope split reins','cactus felt pad','relax','economy poly halter','tooled roper breastcollar','sure','jiffy','wide bits','oneear headstalls','felt smart cinch','smarty','folding','roper bling mule','flat roper rein','priscilla microfleece jacket','custome made chaps','spotted crossover collection','mirage','smb two tone','emergency','blueberry','lyte','bub tate','saddle liner','carolina vest','ssg rancher gloves','acculytes','classic equine rope bags','pro heeler','acorn','welly socks','shooter cinch','work glove','mad dog 3','horse reins','smith wool pad','ariat taos','classic pro','congress-cut','stress','classic splint boots','ariat cottonwood','rope powder','card concho belt','whole bit better','aluminum cart','jelly scrubber','pink horse blanket','leave in conditioner','nfr','ariat square toe','horse health','leather show halters','ladies bling bling chunks','black show pants','dl','patron','smith brother roping saddles','plastic barrels','black ropers','touch plus bit','pro header','tech boots','allen','red sheet','corner','star dee','heavyweight turnout','cottonwood','reversible vests','x3-0486','thermal pro hoodie','relaxher','classic equine esp 32 x 32','pendant cross','wmd','cactus harness','pastel','mite spray','mx-4','bob feist','ladies winter boots','mens ariat cobalt xr','spandex gloves','western equitation spurs','ariat gator boots','black lead','astm western helmet','trailer-aid','ladies western show pants','the proven stone barrel saddle','coil','burgundy horse blanket','tooled saddles','tine fork');
/* $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);
    }