/* Popular phrases - SIZZIX - 17:36:9, Mon Jan 26, 2009 */
__SLI_ClientDefaults =
[
    ['Alignment', true ],
    ['ShowBrandingFooter', false ],
    ['TextBoxIDCustom', ['s'] ]
];
var asPhrases=new Array ('hello kitty','alphabet','flowers','alphabet sets','box','texture plates','die cuts','hearts','embossing folder','christmas','valentine','hello kitty dies','storage','snowflake','dies','frames','movers and shapers','circle','alphabet dies set','texturz','shipping','cupcake','paper','impressions pad','sizzlits alphabet','sizzlits','impressions pad and silicone rubber','butterfly','baby','card','bigz xl','bag','big shot machine','scallop circle','die cutting machine','impressions','cutting pads','embossing','dress ups','textured impressions','animals','alphabet dies','tags','decorative strips','bigz','scallop','birthday','bird','star','pillow box','easter','envelope dies','halloween','storage case','numbers','flourish','silicone rubber pads','flower dies','winter','machines','storage for sizzix','circle dies','movers and shakers kits','envelope','bigz dies','daisy','texturz texture plates','monkey','bear','kitty','christmas tree','box die cuts','serif essentials','scallop circle bigz die','snowflake dies','christmas dies','go slim','giraffe','sizzix bigz','train','endless love','folder','heart dies','box #2','xl','frog','premium crease pad','dog','crease pad use','star die cut','wedding','shamrock','animal dress ups','movers and shapers dies','oval','clearance','new products','happy birthday','snowman','purse','crease pad','birds and branches','teddy bear','tag die cut','poinsettia die','bags and boxes','oval die','lace','snow','letter sets','doll','original dies','thank you','embosslits','big shot','swirls','idea book','multipurpose platform','calendar','cross','wingo zingo','pirate','textured impressions embossing folders','reindeer','leaves','extended cutting pad','original sizzix dies','cardstock','extended spacer platform','love','strip dies','circus','letters','ornament','silicone rubber','cupcake holder','serif','box dies','pumpkin','bunny','bigz alphabet','angel','dies for original sizzix','sizzix strips','heart shapes','clear stamps','adapter','pillow box bigz die','flip flop','go slim alphabet','holiday','movers and shakers','rub ons','beach','build a flower','clearlits','peek a boo','fish','stamps','flower daisy','rectangle','valentines day','ice skate','sister','sizzix storage','castle','cheer','fence','sidekick','sizzlits storage','photo corners','elephant','texturz starter kit','envelope die cut','sizzix dies','roller machine','square die','movers shapers kits','alphabet letters','broadway melody alphabet','night and day alphabet','texturz plate kits','sizzix frames','monogram alphabet','puzzle','gingerbread','bell','snowflake #2','decorative accents','baseball','texture','frame scallop oval','wallflower','mittens','apple','palm tree','penguin die cuts','embossing plates','butterfly dies','square','go go boots','snowman die cut','broadway melody','window','sizzix originals die','flower die cuts','book','cow','calendar set','cake','takeout box','xl dies','address','texturz plates','onesie','envelope and card','converter','address card','texture folders','buttons','holly','sizzix machine','phrases','scallop card','sparkle','scallop bag','people','egg','candles','crab','crease','swirly','strips','sizzix originals','peek-a-boo','sheep','sizzix alphabets','shaker','fringed flower','decorative strip dies','eiffel tower','balloons','pig','flower layers 3','circle die','tree','border','fleur de lis','movie','baby dies','slim','bird die','cupcake die','daisy die cuts','coffee','fun serif alphabet','key','scribbles','popcorn','set','ornate cross','poinsettia','heart die cut','graduation','clown','ladybug','bloom','lollipop alphabet','lilac','picture frames','puzzle maker','penguin','be mine','vines','chicken','baby buggy','get well','silicone','fast food','circle die cut','movers','santa','spider','faces for the doll','frills','sizzix texturz','strawberry','faces','summer','crown','halloween dies','sizzlits sets','valentine set','sandal','poodle','buckles','tiara','pillow','silicone pad','cardmaking set','alphabet strips','thanksgiving','duck','platform','pea pod','rolling tote','train die cut','bigkick machine','music notes','shoe die cut','apron','grass','clear','pad','adhesive','scrap pink kit','sports','cat','owl','filmstrip','originals','leaf','ribbon','sizzix adapter','ring','family','mango tango','corners','scrappy cat','friends','shaker box','bigkick','frog dies','cat n mouse','specials','hippo','music','daisy #2 flower thick cuts','starter kit','movers and shapers magnetic','dena designs','tab','horseplay','bugs','fonts','number sets','fancy','build','advent calendar','bathtub','border strips','latches','puzzle die','twinkle toes alphabet','snowman #2','flower vine','scallop frame','skeleton','small sizzlits','purse die cut','candy cane','cooking','hearts set','value pack','bat','me my big ideas','round a bout','key die','plates','truck','telephone','gingerbread man','megaphone','cotton candy','doily','38-0604','doctors bag','home','magnetic','extended','kitty cat','tulip','christmas ornaments','pocket','sock hop','flower layers','christmas texture plates','window die cut','hearts primitive','sidekick machine','monogram','hat','adhesive paper','sizzlits plastic storage case','bird die cut','pink','texture starter kit','christmas stocking','heart decorative','bookplates','die','cross die','flower blossom','hunky dory','ballerina','frame #4','curlz','sizzix bag','scallop circle #2','bigz xl dies','tag present','stencil','cross ornate 2','turkey','flower strip','cherry','textured embossing folders','vase','bigz storage','frame die','scallop circle die','accents','heart frame','envelope die','clear circle','snowman dies','shapers','bag die','chick','bigz clear die','body','pillow box die','house','card telephone','starburst hanging','decorative strip die','bigz frame','cocoa','bigz pillow','13 cutting pads','build a buddy','shapes','cuttlebug','all dies','christmas advent','simple impressions','wedding invitation','curlz alphabet dies','hanging snowflake','bigz xl die box','candy','spooky house','sparrow','animal dies','stars #3','mom','bird leaves','scarf','snowflake hanging 3-d','skooshy','totes','sizzix texturz starter kit','cheerleader','broadway','rubber pad','heart strip','phone','lady bug','nested star','texture plates kit','curlie','caterpillar','sizzix textured impressions embossing folders','rachael bright','scout','boot','sizzix texturz texture plates kit 6','dress up body','spring','skateboard','journal','night and day','love bugs set','love letter','skull','skate','go go boots alphabets','alphabet die cuts','cookie','tab #1','cap','tree christmas #2','berry','impression plates','swirly die','eiffel','alphabet die sets','chocolatey goodness','decorative set','flip flop die cut','coffee time','hello','wings','extended spacer platform and a pair of 13 cutting pads','texture plates kit #4','easy peasy','spooky','border dies','pink ribbon','bone','witch','sizzix sizzlits die set 4pk','alphabet 35','rose die','police','ghost','dress','bigz clear dies','bigz scalloped','sizzlits snowflakes','stuffed bunny','build a flower set #2','3pk','fringe','sunset alphabet','girlie','sizzlet storage','3 circle','cutting pads for big shot','duck dies','spacer platform','hair','baking','oval frame','wagon','spring flowers set','die storage','accent dies','party','baby says yeah','cherish alphabet','sun','slide mount die','bee','clothes','pea','mug','advent','sizzix texturz texture plates kit #4','loogathat','dress up faces','naturally serif alphabet','dena','pocket die','christmas sizzlits','monde de blonde','tag set','sizzlits decorative strips','trixie','seasonal','big shot cutting pads','so me','stuffed animals','essentials platform','scouting set','box 2','yarn','sizzlits halloween','knockout','sizzix rub ons','kit #1','teen mania','slim alphabet','elephant die','santa head','cupcake sizzlit','pep squad alphabet','sailboat','palm','die cut sets','nature set','deer','birthday candles','dots','6 x 6 papers','firefighter','photo corner die','soccer','baby animals','brooke','gift box dies','pilgrim','storage for bigz','alpha bubbles','sizzlits buttons','38-0943','mackenzie','karate','box die','rubber embossing pad','spiral','rat-a-tat','baby announcement','rubber duck','fleur','fire truck','ooh la la','cup','big shot extended cutting pad','fabric','autumn','sizzix faces','impression folders','heart border','frame with heart','compatible dies','bundle','sizzix bigz die frame','lion','fry box','tulip dance','movers&shapers','top note die','xl die','little sizzles','you\'re my cupcake','sizzix borders','embossed alphabets','it\'s your day','book plates','mitten die','quickutz','pumpkins w crow','impressions silicon pad','booklet purse','slobbery kiss','snowmen','mount','ducky','system converter','purse die','peas in a pod','clock hands','sizzix little sizzles','fairy tale','slide','fall','flower die','ideas','glue tabs','3 d','bigz machine','trick','halloween stamps','heart die','large cutting pad','buggy','thank you die cut','edging','bigz letters','easter sizzlits','bigz monkey','storage carousel','whisk','phrase dies','sizzix originals frame','body dies','reindeer die','retro metro alphabet','pea pea pod','umbrella','cancer ribbon','banner','nature','sidekick handbag','retro metro','flowers wild','night','hawaii','original frames','scrap pink','embossing rubber','storage boxes','favor','telephone address','stamp mount','rocket','months of the year','sizzix texturz texture plates','favor bag','chipboard','food','baby shower','ducky wucky','cases','original circle die','watering can','clear acrylic blocks','booklet purse pages','jesus','sizzix bigkick','cuts n folds','kite','embosslit xl','feet','bigz die frame','monkey tails alphabet set','animal set','kit #3 card','cross ornate #2','pocket sizzix','french poodle','snowflake #1','toothbrush','calendar die','haunted house','sizzlits cutting pads','thick cuts','invitation','scalloped square','baby bottle','sizzix cutting pad','die storage case','picket fence','sandcastle','neon mini','naturally serif','hunky dory alphabet','gift tag','santa claus','turtle','mother','texture plates #10','heart double','garden delight','sizzix','square card','st patricks','starfish','kids teens','hair for dolls','dice','snow set','enjoy','sizzix calendar','pumpkin vine strip','award','sizzix embosslits','embossing folder flower','sizzix sizzlits dies','architectural','medium sizzlits','laugh','scalloped shapes','letters machine','rooster','easter set','scribbles swirls sizzlit die','anniversary','boo','yarn alphabet','flower layers #4','die cut bag','christmas tree die','handbag','pansy','carry all','winter #3','scallop envelope','present','monde','sizzix movers shapers die','baby sizzlit','die cutter','scallop box','charms','folder die','embellishments','sizzix originals die pumpkins #2','scribbles #7','funky brush sizzix','materials','sizzix originals die dress ups baseball uniform','baby cards','plumeria','stocking w teddy bear','bigkick dies','communion','die storage racks','wedding die','christmas set 6','snowman w skates','sizzix texturz texture plates kit #6','baby onesie','hibiscus flower','foliage','bigz die','champ','bigz die storage','infinity','cut boxes','merry christmas','round-a-bout','bigz purse','die cuts rectangles','note card envelope kit #4','texturz 3','sizzlits corners','rabbit','#10','sizzix big shot','grasshopper','ribbon die','winter set #3','brand new baby','avery','bigz serif','travel','winter sizzlits set','you rock','butterfly dragonfly','sizzix bigz xl extended cutting pad','groom','butterfly die','love decorative strip','santa #3','sizzix sizzlits die set 3pk','sun die cut','ladybugs #2','paris','postage stamp','die-cut','magnetic die cuts','build a flower #2','calendar die set','robot','toys','holly and berries','bigz xl cutting pads','serif alphabet','fireman','vertical card','sizzix system converter','shapers dies','cookie exchange','rocking horse','tall and gorgeous','snow flake','sandal die','standard cutting pad','metal','noel','dove','extended spacer','sizzlit letters','heart locket','bigz flowers','sidekick cutting pad','pod','decorative accent #2','greeting cards','chicken eggs','embosslit flower','kit 9','ellison dies','sizzix months','kit 8','sizzix idea book make it your style','snowflake die cut','brother','emboss starter kit','snowflake die','cardmaking','flower layers 2','ducky wucky alphabet','acrylic mounts','brackets','decorative strip storage','christmas sizzix','flower petal','cup cake','cat latte','gingerbread man die cut','rub on faces','indian','38-9614','trick or treat','crossbones','teddy','gift','lovebird','snail','xl cutting pads','first steps','shirt','boxer','dee do','texture starter','flower and vine 2','frame strip','take','hearts wings','spider set','texture plate #4','xyron 250','flower beauty bloom','hearts sweet treat','small','rubber','twinkle','timber','boss','note card and envelope','rub on dress up faces','belt buckle','nurse','original snowflake','tree die cut','flower garden','joyous','plastic storage case','wreath','bubbles','elegant enhancements','a2 card','cuttlebug dies','lily','acrylic stamp mount','cat die','christmas set','rachael','bird sparrow','big dies','sizzlits hearts','circle ornament','shield','stroller','die-cut bag','party favor','sizzix machine accessory','long strips','red dies','haunted','queen','bath','mouse','garland','french fry box','twinkle toes','kendra','embossed flowers','hollywood','cutting plates','brenda pinnick','emily humble','nestabilities','swim','fire engine','clearance packs','ginger','lovey','nutcracker','mitten die cut','background','sizzix bigz xl','christmas embossing','july','bag #2','animal dress ups kitty','alphabet single letters','sizzix dog die','book making','diecut machine','sizzix paper','animal dress ups bear','melody','baby bib','bigz decorative accents','rabbit dies','stocking die cut','holiday dies','express','zoo','sandpaper','happy anniversary','bigz envelope','french fry','pet set','leaf dies','seahorse','tag-a-long machine','bird w swirls','die storage box','12','heart card','layers','rattle','hat die','sizzlit converter','neet knacks','chick w bow','scallop circle 2','baby stroller','pie die cut','slide mount #1','embossed tag','border die','doodle with dazzle','pajamas','santa claus original','paint','sizzix idea book','ruler','frame #2','stamp die','starburst','bang','flower set #3','multipurpose','flower wedding','congrats','phrase brother','bird swirl','sizzlit scribbles','big top','scalloped heart','happy tags','sizzix texturz texture plates kit 3','small case','winter wishes','circus animals','christmas set 2','cut and fold','decorative strip alphabet die slobbery kiss','ornament die','circle #3','hibiscus','gingerbread man #2','card making','sidekick dies','fence die cut','corner design','spiral garland','sizzix bigz circle scallop','movers shapers die kit','silver paper','cuttlebug machine','heart movers shaper','build a flower die','cornucopia','sizzix sizzlits decorative strip','christmas die cuts','easter basket','tina thinks you\'re cute alphabet','embossing pad','love alphabet','kit #14','sizzix movers and shapers','snowflake set','sizzlits calendar','diaper','january','baby cars','fabric cutting','flower heart','big impressions','boss-o','wedding bands','die cuts lilac','spring set 2','4 dies','tina','lollipop numbers','metallic paper','star strip','photo frame','bang zoom','santa hat','frame scallop w holly','sizzles','overalls','sizzix movers shapers die kit #4 envelope note card','circle #1','sizzix bigz xl dies','book die cut','flower stem','doctor','gift #2','christmas ornament light stocking','lindsey','candy cane bow','original die cuts','sizzlits bear','using cuttlebug dies','circus lion','fin','12 dies','traditional tag','mobile','tag a long','bigz bird','bigz card','texture pads','tag crescent','merry','ginchiest','multi-purpose platform','stickers','easter bunny','circus clown','apron kitchen','3-d star bigz','flake','using big shot','flower with swirl center','kit #5','scrapbooking','revolution','stu kilgour','pink sizzix','ho','christmas winter','alphabars set','baby stamps','tag set small','sea shells','packages','bug in a rug','circus tent','balloon die','skittle','circle scallop frame','love bugs','abbie lovers duvers','carriage','folksy','crest swirly','journal round strip die','neon','skull and crossbones','christmas advent calendar','sizzix texturz texture plates kit #5','kit #4','grass decorative strip','kit 14','space','alphabet die','kit 13','goodness','38-9000','scallop flowers','acrylic pad','kit #10','sizzlits gift','sail boat','kit #8','you','sizzlits valentines','a pair of 13 cutting pads','christmas die','happy holidays','original duck','north pole','dahlia flower','big shot extended pad','bigz heart','leather','sizzlits phrase','sizzix bigz dies','gift #4','sizzix sidekick machine','joyful','pot','zoo set','bag bigz','impressions starter kit','seal','texture plate #9','easy','decorative strips phrase','extended adapter','big die cuts','gingerbread men','debi adams','holiday sizzlits','gift 2','tis the season','rectangle envelope','branch','bigz snowflake','angel 2','cookie sheet','rat','baby says','38-0236','scallop combo','sizzix tote','designers','sizzix originals die leaves #2 by stu kilgour','birthday ideas','38-0140','originals leaves','birthday card','month dies','big die','manger','event','12 die','game','decorative metal','sizzix bigz xl die bag w scallops','scrappy','original people','daisy doily','owl w witch hat','hope','products','jersey','frame curly','texture plate #8','thank you thinking of love','hand die','window pane 4','jessie tucker','snow men','at the beach','i do','shopping','flower layer 4','sizzix circle','vest','side kick dies','winter set','night and day sizzlits','humble','sizzix envelopes','pumpkin costume','clearlits die oval 1 1 4 x 1 7 8','purse clearlit','simple impressions stars and swirls','textured plate set','38-8056','bright cardstock','bubble alphabet','sizzlit die storage','3d snowflake','best friends','measurements','trick or treat bag','tiara #3','fleur-de-lis','joy','sizzix bigz xl die','sizzix die tags','dazzle','kilgour','recipe card','medical','pregnant','doodle dies','big','cookies cookie sheet and spatula','zingo','3','hanging','sleep over','alphabet set boss-o','my big idea alphabet','christmas words','silver','l','card ideas','metallic','flower #4','big shot xl cutting pad','sizzix clearlites','christmas originals','ida lou\'s flower box','dahlia','celtic','sizzix lollipop alphabet','sizzix squares','witch shoe','puzzle set endless','christmas card ideas','kit 5','bow and arrow','bigz frame scallop','baby set 4','stocking #2','die cuts for sidekick','flower lily','fine mess','get','doodle flowers','sizzlits birds','sizzix multipurpose platform','bat strip','angel heart','circle 3d ornament','bigz circle scallop','argyle','fry','pep squad','rugby','naughty nice','card w flower','rub on alphabet','bigz reindeer','big shot die cutting','machine pad','sizzix bigz die box pillow','frame 3','sizzlit birthday','kit card','sizzix doll','texture ideas','sizzix sizzlits die photo corners #2','pad premium','christmas holly','sizzix embosslits xl die','kathy','big ideas','christmas bell','phrase sister','bigz spiral garland','snowman die','bigz key','go go','flower center','50s','texturz silicone rubber','lucky','halloween texture plates','extender pads for bigz','little sizzles 6 x 6 shantung texture pad','cutie','french fries box','bigz dress up','kit #2','spoon','sizzix originals die puzzle maker #2','bigz shapes','sizzix bigz alphabet serif essentials','press','flower pot','baby set 5','spacer plate','tug boat','christmas flower','october','die gingerbread','bigz teddy bear','sizzix texturz accessory impressions pad','hombre','decorative alphabets','decorative strip case','black adhesive','kit 1','photo card','die scallop tag','flower cuts','sizzlits mittens','sizzlet paper','baby jesus','13','sizzix scallop circle','3-d vase','baby set #5','3 d ornaments','flower accent','sizzix swirls','sizzix big shot die-cut emboss machine','sizzix dies specials','bigz penguin','scallop die cut','frame folder','sizzix bigkick die-cut machine','big tag','sizzix seasonal','strip storage','ginger bread','original pumpkins','occupations','holly w berries','single phrases','christmas textures','sizzix daisy','neet nack','bigz flower layers','my cupcake','sizzlits boxed brush alphabet','baby phrase','celtic knot','baby elephant','gold paper','sizzlit tree','sizzix carry bag','35 die','snowman 2','flower bouquet','texture plates #6','beware','frosting','cut letters','sizzix originals die ribbon','go-go','sizzix adhesive paper','sizzix shaker box','sizzlits present tag','starter','sizzix christmas die cuts','sizzlits 12-die alphabet set go go boots','black big shot','ho ho','sizzix originals die tree christmas w decorations','sand pail','holiday die','mum','sizzix die envelope','christmas ball ornament','#5','#144','night&day');
/* $Revision: 2106 $
 *
 */

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; }

    __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
                };
    /* 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 (!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' ] && document.body)
        {
            theDropDown.style.position = 'absolute';
            document.body.insertBefore(theDropDown, document.body.nextSibling);
        }
        else
        {
            theSearchbox.parentNode.insertBefore(theDropDown, theSearchbox);
        }
        
        // Position it
        theDropDown.style.left       = left + 'px';
        theDropDown.style.top        = top + 'px';
        theDropDown.style.width      = width + 'px';
        theDropDown.style.zIndex     = '99999';
        theDropDown.style.visibility = 'hidden';

        __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]);
        }


        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
        */
        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' ])
            {
               __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;
    }


    /**
    * 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'];
                  	}
                	
                    if( __SLI_customisations[ __SLI_ApplicationName ][ 'DomainToReplace' ] )
                    {
                    	if(document.domain != __SLI_customisations[__SLI_ApplicationName ][ 'DomainToReplace' ])
                    	{
                	    	__SLI_customisations[__SLI_ApplicationName ][ 'TargetURL' ] = __SLI_customisations[__SLI_ApplicationName ][ 'TargetURL' ].replace(__SLI_customisations[__SLI_ApplicationName ][ 'DomainToReplace' ], 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;
    }

    // register with onLoad(er...
    _sli_init.push( AutoComplete_init );