/* Popular phrases - VERMONTTEDDYBEAR - 21:58:39, Mon Feb 8, 2010 */
__SLI_ClientDefaults =
[
    ['TextBoxIDCustom', ['wSearchText'] ],
    ['TargetURL', ['http://great-gifts.vermontteddybear.com/search?ts=v2&w='] ]
];
var asPhrases=new Array ('design your own bear','nurse','valentine','army','custom','valentines day','military','outfits','get well','classic','pregnant','teacher','biker bear','biker','birthday','princess','pirate','angel','police','panda','nurse bear','cooking','horse','romance your valentine bear','love bandit','army bear','motorcycle','prince charming','star trek','puppy love','elvis','pajama bear','doctor','classic bear','i heart you','i love you','chocolate','firefighter','cowboy','chef','gift tag','camo','cubs','guitar','knight','tattoo','bowtie','fireman','panda bear','expecting mother','heart throb','i heart','marine','ballerina','huggable hunk','angel bear','lawyer','sailor','cheerleader','military bear','nurse teddy bear','romeo','hockey','bears','superhero','cupid','donations','loverboy','navy','spock','baseball','bear hospital','bear gram','doctor bear','soccer','red rose bouquet bear','navy bear','pilot','chef bear','pajamas','tennis','bear cubs','emt','stand','motorcycle bear','bowtie bear','pregnant bear','purple','cat','premium','graduation','cowboy bear','pink roses','clothes for bears','air force','personalized','fire','cow','pink','get well bear','koala','mom','new baby','be my valentine','dance','wedding','polar bear','bandit','alien','say anything','36','puppy love bear','princess bear','karate','devil','pink bear','broken leg','fishing','classic teddy bear','computer','soldier','coupon','basketball','hospital','playboy','harley','puppy','t shirt','artist','pajama gram','i love you beary much','romeo and juliet','birthday suit','dentist','cast','scrubs','coco','clip art','teacher bear','sweetheart','redneck','baby','huggable','personalized tattoo bears','construction bear','baby bear','i heart horses','elvis bear','ski','motorcycle mama','football','twins','mother bear','valentine bear','broken leg bear','golf','pregnancy','snowboard','yoga','super hero','softball','snowboard bear','cooking bear','marine bear','crazy for you','navy teddy bear','nascar','sports','roses','i love you bear','ultimate lover','music','cupid bear','ballerina bear','big hug bears','cancer','wizard','tatoo','tshirt','sailor bear','harley bear','all bears','beary','conversation hearts','knight in shining armor','broken arm bear','race','purple teddy bear','birthday bear','personalized bears','anniversary','irish','fishing bear','coast guard','hair dresser','pharmacist','ballet','i love you bowtie','hooked on you','grandma','accountant','teddy bears','conversation','love rider','mother to be','mechanic','football bear','birthday suit bear','fairy','plain bear','graduation bear','kaleidoscope','pirate bear','misfit','rocker','business','swim','prince charming bear','t-shirt','baseball bear','big hug','big bear','blue','overalls','holstein','garden','bowling','bride and groom','mamacita','juliet','accessories','good wishes','soft bears','hunk','cheerleader bear','prince','crutch','red hot redneck','hockey bear','ive fallen for you','colors','mad about you','fallen','soccer bear','princess teddy bear','fallen for you','equestrian bear','wildlife bears','cow bear','geek','fisherman','purple bear','aviator','guitar bear','dancer','grandmother','t shirt bear','basketball bear','sash','1st birthday','sorry','bow tie bear','custom bears','soldier bear','equestrian','scuba','farmer bear','moon bear','peace','patchwork','karate bear','fur colors','snow','beautician','dog','hooked on you bear','sweetheart bear','ka0108','police bear','nascar bear','school','feel better','redneck bear','secretary','sewing bear','polar','tag','cowgirl','22','fairytale','i heart you bear','vermonter','amethyst','school teacher','glasses','sale','artist bear','business woman','fireman bear','workout','camo bear','giant teddy bears','irish bear','cop','udderly in love','happy birthday','country','great catch','wedding bears','romantic at heart','hero','poker','camouflage','ems','pillow','martial arts','blue without you','udderly','pastel','pregnancy bear','farmer','lawyer bear','train','aviator bear','snow princess','pharmacist bear','koala bear','bunny','scrubs bear','prison','te amo','bride','heart','mma bear','alien bear','patchwork bear','lumberjack','get well soon','twin bears','pastel bear','grandmother bear','workout bear','vet','create a bear','baker','black bear','hiker','15','fireman teddy bears','musician','hockey player','boots','teacher teddy bear','monkey','moon','woolen bears','babys first birthday','15 angel bear','engagement','bear-gram','leather','soft','rebel','beary much','lacrosse','red hot lover','firefighter bear','first birthday','heart throb bear','desert camouflage bear','star trek bear','i love you beary','giant','gardening bear','martial arts bear','pink rose bouquet bear','occupations','police officer','handy','volleyball','go green','amor','bingo','bow tie','cheer','blue bear','computer bear','toughguy','giant bears','camouflage bear','tattoo bear','grandma bear','woolen','emt bear','elvis presley','heart gift tag','over the hill','mother','sunglasses','prisoner of love','quilt','large bears','cupid t-shirt','love bandit bear','stylist','bandit bear','leopard','big sister','superstar','tattooed toughguy','valentines day bear','boxer','medical','racing bear','be my valentine bear','dad','scuba diving','clown bear','white t-shirt','rainbow','hair','dental','vest','bear stand','librarian','broken arm','sports bear','halloween','flowers','grizzly','grizzly bear','mothers day','smiley scrubs','mohair','big','beautician bear','retirement','engagement bear','pilot teddy bear','white bear','family bears','rebel bear','loverboy bear','scrapbook','student','personalized t-shirt','card messages','patriotic bear','golfer','espresso','friend','waitress','rocker bear','crazy about you','red hat bear','groom','spock bear','papi chulo','racecar','love rider bear','nerd','racecar bear','suit','train engineer','veterinarian','wizard bear','dog lover','lab','red teddy bear','mother to be bear','hiker bear','surfer','grandpa','retro','skier','candy','holstein bear','mohair bears','ultimate','pilot bear','marry me','latino','baseball player','fairy bear','make your own','conversation hearts pj bear','bowler','boxing','i love','retro bear','religious','tracking','surf','great catch bear','hair stylist','coco bear','shopping','attorney','jeans','construction','good wishes fairy','red neck bear','shopper','classic teddy','yoga bear','heartthrob','singing bear','christmas','i heart bear','birthday parties','returns','maple','love','black','dentist bear','big sister bear','carpenter','leather biker','japan','bear colors','jail','maternity','super bear','papi','maple syrup','tools','playbear','shoes','bear hat','red','quilting bear','15 classic','baby bear pink','rock','expecting','knitting','name tag','vermont teddy bear pajamas','mom to be','swim suit','day at the spa','personalized card','bahama','boxing bear','i love you bowtie teddy bear','t-shirt bear','valentine gift tag','for him','personalized t-shirt teddy','romantic','cancer bear','thank you','camping','tough guy','mom and one baby','spanish bear','dancer bear','lady luck','kirk','new baby bear','pink rose bouquet','engineer','captain kirk','mom bear','dress','love bandit teddy bear','chic shopper','new mom','business woman bear','handy bear','hooked','large','hiking bear','tuxedo','easter','waitress bear','cupid t-shirt bear','fairytale princess','hug','clown','bandana','15 bear','doctor teddy bear','ice hockey','pajama outfit','witch bear','lady lawyer','rock star','sister','ruby bear','train bear','feel better bear','mama','sweetheart teddy bear','fisherman bear','everything grows','gambling','golf bear','best friend','bar mitzvah','beargram','green bear','bear outfits','apron','baby\'s first valentine','classic sash bear','will you marry me','say anything bear','huggable bear','tough','i love horses','wear it bear it','robe','i love you beary much bear','carpenter bear','kiss me','fitness bear','bandage','puppy love bear with puppy','field hockey','lawyer teddy bear','skier bear','volleyball bear','pj','birthday cake bear','latin lover','bare bear','bear foot','chef teddy bear','make your own bear','winter','witch','pink rose bear','cupid tshirt','communion','business bear','crazy','bowling bear','15 prince charming','big teddy bears','baby\'s first valentine\'s day','christmas bears','i have fallen for you','purple passion','sling','my order','tough bear','music bear','hat','cat lover','big brother','police badge','papa bear','astrology','small bears','papa','shamrock','president','baptism','quilter','art','bathing suit','railroad','bib','22 big hug','premium fur','biker mama','bunny bear','brother','guarantee','spa','scuba bear','catch','grandpa bear','art bear','laptop','tshirt bear','fur','all','baking','plain','father','country loving','bear foot and pregnant','lab coat','sundress','misfit bear','groom bear','st patricks day','flag','wedding anniversary','special occasion','tee shirt','gym','knight in shining','safe baby bears','sweetest','expectant mom','say any','your cute','baby blanket','friend for life','toothbrush','goatee','snow bear','classic sash','camping bear','valentines day outfits','ive fallen','i love beary much','plumber','air force bear','veterinarian bear','spanish','cupid t shirt','sympathy','summer','gifts for him','small heart box','black teddy bear','owl','shirt','attitude','employment','bat mitzvah','skateboard bear','be mine bear','personalized t-shirt bear','shorts','20','bear with cat','pj\'s','elephant','father bear','you\'re a knockout','scottish','polarbear','jesus bear','air force teddy bear','line man bear','italy','wild','bearfoot and pregnant','blanket','15 pajama bear','sewing','hunter bear','heart horses','guard','hawaiian','place order','good wishes bear','bear pillow','amor bear','cat lady','friendship','wildlife','bouquet','i love you personalized t-shirt','bear fur colors','15 classic sash bear','scuba diver','dental hygenists','racecar driver','wool','plaid','running','tatoo bear','vermont bear','i heart mom','bears for babies','surfer bear','birthday cake','superstar bear','work out bear','peace bear','tennis bear','chemosabe','victorian','valentine birthday bear','diamond','large teddy bear','skateboard','eye color','knight bear','playboy bunny bear','first valentine','dancing bears','ufc','smiley','life guard','executive','book','bones','diving','astrological bears','baby sweater','milk','11','get well pillow','rose bouquet','briefs','clip art bear','barack bear','good luck','i heart grandma','jack frost','red neck','heartthrob bear','surgeon','mma','lollipop','attorney bear','french','udderly love','painter','magic','bears for him','love bear','denim','volley ball','spa bear','im sorry','birthday sash','bow ties','chic shopper bear','basic','baby shower','bunny ears','trek','secret admirer','outfits for bears','i love bear','bear t-shirts','american','sweater','kids','cuddle','habeardashers','jewish bear','poker bear','worlds greatest grandmother','vermont premium collection bear','i love dogs','brown bear','playboy bear','work out','business suit','kids bears','volley','playbear bunny','red hat','first birthday bear','chemo','horse lover','hair stylist bear','ka0066','i love you bowtie bear','wrestler bear','candle','overall bear','animals','polka dot','brown teddy bear','construction worker','bride bear','11 bear','ski bear','jacket','hypoallergenic','bear sized roses','design your own','skin','cuddle cub','new mother','car','udder','birthday princess','bow','how to order','mommy','cop bear','huggable teddys','marry','name','life saver','happy anniversary','under 50','care bear','mad about','lacrosse bear','red bear','basic bear with jeans','22 bear','premium collection','barefoot and pregnant','happy birthday bear','french bear','basebal','kung fu','red rose','artist teddy bear','puppy bear','baby outfit','gambler','knockout','super','kiss me im irish','mamacita bear','bearfoot','classic bowtie','bride and groom bear','sapphire','smile','heart box','15 huggable hunk','pregnant mom','pride','christmas tree lumberjack','giant teddy','diva bear','i heart t-shirt','bear with puppy','ultimate lover bear','in love','red hot','ultimate fighter','accessories for bears','wrestling','paw pad','love you beary much','best friend bear','romantic heart','nametag','washing','heart pajamas','conversation heart bear','leather bear','valentine teddy bears','teddy bears jeans','germany','36 big hug','heart pajama bear','t-shirts','valentine\'s bear','bike','valentine tag','get well gifts','business man bear','baby valentine','purple fur','baby bear green','fashion','recycle','valentine cards','baby\'s first valentines day','mothers day bouquet bear','grinch','cupid tshirt bear','country lovin','sale bears','cake','teddy bear pillow','classic bowtie bear','i heart dogs','astrology bear','15 puppy love bear with puppy','huge bear','climbing','mother goose','ballet bear','pumpkin','volley ball bear','polka dot pajama','clown care','lady golfer bear','bears on the air','cancer survivor','blue eyes','christening','sailing','prego bear','50','army outfit','race car bear','ice cream','phone','charming','backpack','race car driver','occupation bear','custom t shirt','easter bear','15 teddy','kiss me im irish bear','sienna','hiking','chinese','boxer bear','sleep','i love mom','bare','bear with roses','i love music','we come in peace','india','bridal','i heart my cat','15 pregnancy bear','cap','bear with baby','talking','amor tattoo','ka0065','box of chocolates','mom valentine bear','biker teddy bears','army teddy bear','motor','personalized tshirt','15 be my valentine bear','banker bear','gray','football player','military teddy','soldier teddy bear','lady bowler','graduation outfit','15 be my valentine','15 coco','heart throb tattoo','heart box of chocolate','i love you tshirt','fallen for her','buddha','15 clown care bear','bear-foot and pregnant','ive fallen for you bear','mom to be bear','blue teddy bear','flag bear','bahama mama','addison','i love you teddy bear','shopper bear','tutu','thanksgiving','wedding teddy bear','fallen for you bear','valentine\'s','go green bear','red fur','jewish','bah humbear','huge','kirk bear','i heart you personalized t shirt','jumbo','lover bear','hard hat','cello','camper','bedtime','mexico','pj bear','st nick','cancer sucks','electrician','actress','plain teddy bear','duck','dark chocolate','race car','varsity jacket','bingo bear','i heart you t-shirt bear','first valentines day','soccer teddy','i love t shirt','messages','personalized teddy bear','pin','beret','medium heart box','bear sweaters','te amo bear','hockey teddy bear','pink dress','broken heart','american bear','animal lover','softball bear','bridal shower','play','birthday accessories','i love you t shirt','surf\'s up','happy birthday gift tag','valentine anniversary','15 romantic at heart','vanilla','bear with sunglasses','valentine boxes','valentine\'s card','harley teddy','15 huggable hunk teddy bear','rock star bear','hair dresser bear','get well bow tie bear','cook teddy bear','balloons','purple teddy','little teddy bears','pisces','i love heart','love happiness heart','pink velvet roses','motorcyclemama','hygenist','bear for mom','poker player bear','name teddy bears','tooth','babyboybear','red fur bears','aries','medium chocolates','police teddy','i heart you t shirt bear','romeo juliet bears','pink bouquet','nautical bear','bear in camo','bears for children','digital','we love you','15 sweetheart','hot redneck','cake hat','teacher outfit','everything grows with love','everything grows with love bear','15 pajama','winter wonderland mom','be mine','36 big hug collection','chemo bear','hip hop','stocking','good fairy','15 i\'ve fallen for you bear','tee','biker bear no boots','pink teddy','15 pastel patchwork bear','fitness','gauze','society lady','red velvet roses','set','paint','vermont premium collection','hot chocolate','special','lumberjack bear','good luck bear','st nick bear','b flat','your a knockout','pastel patchwork','pride bear','i love you mom','skirt','pajama bear outfit','gifts for her','summer bear','desert camo','bride teddy bear','eyes','design own bear','white tee shirt','scary','birthday t-shirt','varsity','france','order','latino bear','german shepherd','lake champlain','high school','mom-to-be','i heart t shirt','mom and cubs','baby 1st birthday','kickboxing','personalized bear shirt','happy valentines day tag','mother and cubs','mother and child','for guys','pirate teddy bear','chulo','teddy bear shop','shamrock sweetheart outfit','fisherman outfit','happy valentines day gift tag','knight and shining armor','22 huggable','pcnch0073','team','chick','heart throb bear with tatoo','i am a survivor','under wear','no bow tie','saxophone','red hot red neck','congratulations sash','bears with wings','fire bear','red neck teddy bear','cookingbear','i heart tshirt','mom-to-be bear','black fur','bear eye color','36 big bear','usa flag','wool bears','display stand','labcoat','36 hug','lifesaver','knight and shining armor bear','sick','soldier teddy','police officer bear','classic bow tie','celebration','15 udderly in love bear','running bear','knitting bear','accountant bear','tech','captain kirk bear','valentine outfits','band aid','peace sign','star','bear in robe','mama bear','im sorry bear','denim jeans','tee shirt bear','graduation cap','new christmas bears','captain','bears for men','little bears','red hat society bear','beard','boston terrier','bowtie teddy bear','skeleton','dog bear','plush bear','new baby gift','air hole','clogs','60 birthday','talking bear','love you bowtie','surf board','15 birthday suit bear','cupid t shirt bear','fabric teddy bear','fighter','busness','medium box chocolates','flower tag','wish bear','order time','camo outfit','star bear','i heart personalize','roller','marine teddy','ups','valentine\'s gift tag','knight in','valentine\'s for mom','emt teddy bear','engineer bear','heart you','biggest','t shirt teddy bear','stuffing','rain','lady accountant','mother goose bear','hanukkah','nativity','barack','bowler bear','throb','wooden stand','big teddy','judge','your my hero','kitchen bear','santa claus bear','children\'s bears','huggable hunk bear','cycling','proposal','badge','feliz','angel wings','love you','sick bear','bicycle','gift card','poet','that bear','jiu jitsu','tank','22 premium bears','happy day bear','22 premium maple bear','monkey bear','alien teddy bear','grows with love','tech bear','animal lover bears','heart tattoo','china','this stud\'s for you','tank top','baseball teddy bear','heart chocolate','tennis racket','free vermont teddy bear','barbecuing','hearts pj','8 bears','make up','first teddy bear','gone fishin bear','airline pilot','valentine bear for him','mixed bear','15 woolen bear','smaller bears','3 feet teddy bear','latin','on sale','tattooed tough','sapphire bear','cocoa wool','rolling','necklace','satin','first communion','playing cards','valentine accessories','momma','1st birthday bear','apology','15 puppy love','fishing outfit','real boss','digital camo bear','syrup','pink ribbon','plumber bear','mad','baby gifts','surgeon bear','lifesaver bear','20 black bear','dental bear','clown care bear','scrapbooking bear','day spa','sash bear','happy 1st birthday','playboy bunny','australia','whisk','super star bear','smiley scrubs bear','bear with jeans','collectable bears','feather','valentines day tag','women','religion','get well bear with cast','anniversary pillow','under 3','star trek teddy bear','vtb','tatooed tough','basic overalls','sailor teddy bear','teddy pillow','vet bear','baby\'s first teddy bear','brownstone bear','hope bear','thank you bear','get better','kaleidoscope bear','premium fur bear','denim bear','baby bib','wish','i heart music','blue dress','mommy bear','lucky in love bear','custom shirt','birthday bowtie','bear in blue dress','life','tie','day at the spa gift set','get well bowtie bear','bear with name on it','new baby valentine','crazy for you vermont teddy bear','chemo brain','hunk bear','valentines sash','white tee','sweetheart teddy','be my','cupcake bear','star of david necklace','36 in','ice','railroad bear','valentines day gift tag','shopping bear','cocoa','holiday bears','special edition','knockout bear','happy camper','maple bear','jumbo bears','i love grandma','wizard outfit','lucky lady','cocoa woolen','patch','message bears','t shirt birthday bear','i miss you bear','vday','baby accessories','father to be bear','jeans tshirt','valentine bears for mom','bears that care','t shirt bear chemo brain','sailor suit','anniversary bear','rattle','cuddly','illness','cool','gone fishin','snow day','classic bear colors','knight in shining armor bear','pink bouquet bear','for kids','shining','small heart box of chocolates','horse t shirt','white tshirt','pouch','help','teacher dress','big sis','bath','flat bear','i love you shirt','german bear','baby bunting','cell phone','snow day bears','white t shirt','cat whisperer','fairytale princess bear','mom for president','martial arts outfit','romantic at heart bear','survivor','valentine for him','army teddy','black teddy','bath bear','rebel santa','wedgwood','lady','diva','what\'s cooking','retro lady','brief case','embroidery','biker babe bear','teddy hospital','hot for you','purple passion bear','recycled bear','party','tooth fairy','romantic heart bear','baby first valentine','huggable hunk teddy','redhot lover','society bear','hypoallergenic bear','biker babe','get well soon gift tag','apply','rider','beating heart bear','better','lovebandit','birthday cake slice','blue gown','child bear','bunting','santa bear','logo bears','chanukah','bear bib','birthday cake hottie','first','3','your a lifesaver','winter family','motorcycle mom','veil','lifetime','mama\'s','hook on','bandaid bear','gift card ideas','prison bear','birthday celebration','espresso bear','madaboutyou','prince teddy bear','jesus','black and white','st patrick','life saver bear','snow mom','bears with attitude','baby christmas','everything','tattoo teddy bear','holstein cow','back to school bear','desert','silver','fashionista','teddy bear outfits','hockey outfit','nativity set','send bear to hospital','arabian','shining armor','bride outfit','godmother','personalized t shirt','bow ties colors','pregnant teddy','i love t-shirt bears','bandanna','luck','i love you personalized t-shirt bear','martial bear','white shirt','free','t shirt music','thankyoubear','grandad','workoutbear','get well soon bear','bald','motorcycle rider','crazy over you','bear with arm cast','mugs','colors for bears','pajama pillow','bear pajama pillow','skateboarder outfits','magic bear','holiday hunk','baby bear bib','snow family','equestrian teddy bear','baby\'s first christmas','pictures of vermont teddy bears','big huge','make you own bear','construction teddy','pcnch0050','super star student','culinary','super star','gone fishing','ovarian cancer','men','bear with sash','cancer sucks bear','health and hope','camper bear','cyclist','bear fur','tree','toughguy bear','woman','plain classic bear','get well gift tag','baby bear bunting','born in vermont','play bunny','pink ballerina','heart get well','poland','cuddle cub toddler wear','rolling pin','you\'re my hero','warm','basic jeans','christmas kisses','cow teddy','st nick bear with reindeer','sail boat','straight jacket bear','i heart christmas','celebration outfit','chemotherapy','big sister teddy bear','history of vermont teddy bears','check','chemo brain bear','railroad engineer','pastel furs','spa gift set','happy new year','feeling blue','special fur','bear with pink bow','sling bear','big bro','super teddy','holiday heart throb','bridal shower bear','bears with t-shirts','ballroom dancing','cream bear','chef\'s hat','marker','sundress bear','birthday t shirt','bear with tie','send a bear card','biggest teddy bear','santa little','bearfoot and pregnant bear','bear with a book','christmas classic bear','chefbear','baby\'s','big brown bear','shag fur bears','snow cub','snow bear family','harley motorcycles','basic bear with overalls','chocolate teddy bear','barack t-shirt','st patricks day gifts bears','santa clause bear','sending a gram','bib outfit','shag fur','christmas ornaments','sage go green','short outfit','boo boo','bears with stars','present','pcnch0075','bear dress','craft','chenille bear','parka','cargo pants','christmas puppy','santa\'s hat','christmas clothes','classic colors','hair dryer','best boss','cribbage','heart christmas bear','baby bear outfits','snow fur','brush','spanish valentine','bears breaking news','boxers for bears','stuffed pandas','christmas angel','bear to the bone','cake candle','special coupons','birthdaygirl','people','classicteddybear','bears under 50','pink bib','best of','painting bear','bear list','bear in love','birthday pillow','chocolate teddy','bear in bikini','b bear','baby blue','category','baker hat','blue bear with bow','bear cap','can i wash my bear','bear bunting','special birthday','bear in tuxedo','career woman','blue floral dress','cart','#1 fan','bridge player','super soft','bear hug bear','pgf334','pink top','pencil','birthday gifts','big brother 2009','bridge playing bear','big brother color block','black sunglasses','box candy','christmas elvis','cat lovers teddy bears','#1 dad','cap and gown','baby valentine bear','personalized gift tag','blank bear','pink shorts','survive','perfect overall','blue rose','childrens clothing','she works hard','baby 1 year','capoeira','be my bear','be valentine bear','superstar student bear','cupidbear','pink flowers','babys first valentine\'s','sash i love','bear for a baby birthday','separate boxes','big brother t shirt bear','#36','perfect','break','benefits offer','biden obama','bear with reindeer','pgf338','bear humbug','blue red','bear with stocking');
/* $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);
    }