/* Popular phrases - BLOCKANDCOMPANY - 12:23:16, Tue Feb 7, 2012 */
__SLI_ClientDefaults =
[
    ['ShowBrandingFooter', false ]
];
var asPhrases=new Array ('height markers','currency straps','dual control key cabinet','safe deposit box key envelope','safe deposit box plugs','envelopes','coin bags','holiday closing signs','perpetual calendar','coin wrappers','counterfeit pens','pens','document jackets','key envelopes','coin trays','atm signage','shipping labels','currency counter','dual lock key cabinet','currency bags','plastic coin bags','key cabinet','business card holder','drive up envelopes','currency bundle bags','check registers','drive-up teller envelopes','file box','hooded locking security bag','archelon','stapler','nameplates','stamps','time cards','tamper evident deposit bags','teller envelopes','key box','ncua signs','leatherette wallets','cleaning cards','key hole signals','teller transfer ticket','31-0421-20','tellermate','gunshell coin wrappers','accubanker','deposit bags','counter signs','sign holders','glass mounted sign holder','safe deposit envelopes','calendar','coin tote shipping labels','atm decals','deflecto','coin counter','maverick encoder ribbon','labels','snap-lock vault key envelopes','card protectors','canvas coin bags','quarter trays','micr correction labels','locking security bags','name badges','double faced perpetual calendar','holiday sign set 2012','shelving','perpetual calendar inserts','fingerprint pads','bsn28650','key keeper bag','encoder ribbon','coin totes','security seals','currency deposit bags','fdic signs','brandt ribbons','door height markers','rubber bands','document carriers','vault key envelopes','brochure holders','replacement nameplate insert engraved','vinyl document jackets','hooded bags','home mortgage','wrapped coin trays','receipt paper rolls','desk nameplates','holiday currency envelopes','trash bags','single pouch deposit bags','micr encoder ribbon','smd74264','jackets','copy paper','chairs','bundle bags','cash bags','fed deposit bags','micr','58-0302','date stamps','trays','custom signs','cash tray','micr encoder','all purpose seals','laser checks','classification folders','expansion file','dime tags','cork board','gunshell','expandable transit sac','atm envelopes','fdic signage','seals','fire resistant safes','coin boxes','tags','quarter wrappers','patriot act sign','standard register','floor mats','safe deposit box','temporary liquidity guarantee program','fraudstopper','adding machine paper','countex trays','counterfeit detector','self-sealing single handle coin totes','coin cups','next window please sign','funds availability signs','brochure racks','drawcord bags','drive up teller envelopes','bill counter','swabs','green seals','gold tester','shipping tags','apron','check encoder','currency bands','mobile roll files','adhesive pads 3 x 3','all purpose security seal','dum dums','waffletechnology','semacon currency counters','file cabinets','cart','currency tray','lanyard','straps','anti fatigue mats','seal press','dual control single tag system key cabinet','self inking stamps','rolled coin tray','magnetic strips','atm deposit','sprbs100wk','coin envelopes','check protector','security ties','post binders','security box','date','tamper evident clear bags','locking envelopes','gift envelopes','ink pads','twin pouch tamper evident deposit bags','atm seals','acrylic box','safe deposit key envelopes','atm card protectors','holiday signs','storage lockers','verifone 900','currency counter cleaning card','teller pedestal','gunshell wrappers','suction cups','m-610','acrylic compliance sign frame for acrylic signs','counterfeit','equal housing','key rack','locking cash drawer','strap bags','pre-glued currency straps','currency strap tray','coin tote labels','forms holder','atm fee notice sign','exterior pamphlet dispensers','clear vinyl jackets','clear view bags','paymaster 9000','vault key-hole signal','locking bags','all purpose seal blue','locking tray','porcelain magnetic whiteboard','fraudstopper bags','slim security case','maverick','desk bar','coin','lock box','carrier tube','drive-up envelopes','double handle','safe deposit box envelopes','magazine holder','coin storage','brass fastener','letters','staples','wrist coils','check writer','paymaster','teller bins','tamper-evident deposit bags','thumb print','expanding file','bags','penny wrappers','time card racks','paid stamp','epson erc-38b','holiday cling on','storage boxes','gray register','trash can','ncua decals','vault key hole signals','penny boxes','semacon','teller receipts','deposit tickets','counterfeit detector pens','key rings','vault','tamper evident bags','bill straps','digiprint','chair mats','thermal paper rolls','hyosung','vault envelopes','pmc05064','hud booklets','ladder','procoin','rate display','cotton tipped applicators','mail sorter','maverick m366','accordion','tab dividers','bill strap tray rack','digital timer','glass cleaner','display','d0195011100','atm registers','wall signs','maverick micr encoder','cash transmittal bags','security pens','xst40330','fire proof bags','c6602a','locking deposit bag','brown currency straps','nameplate insert','batch tickets','thermal paper','plastic bags','spr06120ct','j710a','stool','biotru','panini check scanner cleaning card','to vault','semacon coin counters','ncua share insurance signs','spr01447','clasp envelopes','citizen','white out','currency bundle bags 8','craden printer ribbons','drive up tube carriers','perforated paper','canvas shipping bags','pre glued currency straps','calculator paper','coin paper rolls','calculator ribbon','dollar coin trays','id badge holder','geo45333','dry erase calendar','calculators','locking security mail bag','ab5500','cash box','dog biscuits','techbag','currency envelopes','mmf','frames','interoffice envelope','mach 6','mighty badge','coin counter sorter','time clock','countex','gold','no smoking signs','steelmaster','locks','white board','canvas bags','padlocking mail bag','currency straps purple','hand sanitizer','9x12 tamper evident bags','jumbo jogger pen refills','pad locks','paper','ncua','rulers','s1450','jumbo paper clips','plastic forms holder','double-faced perpetual calendar with insert storage','magner','counter pens','tri-test','ipad','transit sacs','money mints','$2000 bill strap','magner 35','cash in tickets','audit envelopes','exit signs','patriot act','mag','$100 currency straps','wrapper','plasti seal','83-709404','bristol','purple ball point pens','fire proof filing cabinet','clear signs','erc 11','clear view zipper wallet','custom easel desk sign','dime wrappers','smead','acrylic frames','blue seals','vault keyhole','encoder','lock box key envelopes','locking key envelopes','courier bags','register paper','lorell 86000','fingertip moisteners','change of address forms','tamper-evident deposit bags 9x12','gbc3200720','coin labels','cash straps','gbc3200715','spr01018','receipt paper','llr86200','plastic currency trays','paper clips','jumbo jogger ballpoint refills','erc30 34 38','carrier','lockers','mxbr50','christmas club signs','permanent-lock vault key envelopes','teller form holder','ccs24218','yellow seals','cash storage units','nickel boxes','d64','visa','business hours sign','screw posts','compressed air','funds availability signage','stamps with date','wlj36544w','atm deposit envelopes','fingerprint','legal pads','typewriter','suckers','key lock box','thumb print pads','monitor riser','folders','scissors','carry all bags','magner currency counter','3 x 3 floor mats','te1910','portfolio','mats','s1425','atm fee notice','folding cart','security mirrors','laminator','trodat 4912','sharpie','mmm684ast1','tip box','eve357bpz3','gjo24080','currency cleaning cards','courier case','safe deposit','reis cs-3320','correction labels','windex','lollipops','suggestion box','countertop calendars','check organizer','canned air','dry erase board','scanner cleaning cards','ultima seven satchel','wiz machine','currency straps with aba color bar denomination','atm covers','steelmaster forms holder','reis','plastic ties','organizers','labor law poster','equal housing lender','pennie coin boxes','post its','card reader cleaning card','accubanker ab5500','ncr 5875','ribbons','acrylic sign holder','paper towels','cable ties','engraved square nameplates','accubanker ab5000plus','money straps','s530','sondscw530','semacon s1115','hand cast bronze name sign','erc-30','canon cr-180','universal briefcase','red key envelopes','spr25346','calendar dry erase boards','g19','alcohol swabs','foreign','mmf bags','sherpa','padlock seals','postit notes','toilet paper','ccs59351','key tags','magnetic nameplate','check 21','micr correction','charm','letter opener','hud','currency authenticator','seal security ties','mmm680nz2','10 pocket brochure holder','60 key dual control key cabinet','opteva 500','carton copy paper','teller signs','seal security plastic ties','money candy','$2000 money straps','next teller please','drop box','zipper wallet','atm receipt rolls','outgoing letter of collection','privacy screen','bill bands','teller transfer','ink roller','check batch bands','drawer','night deposit bags','counterfeit currency detector','atm cassette bag','restroom','money bands','data binders','mmf2330881w08','toner cartridge','open close sign','red bag','engraved nameplate','ncua nameplate','wallets','passbook jacket','register','d500','equal housing opportunity','flat coin wrappers','tri test','straps $100','coin rolls','red seals','air','ncua signage','cool coil','binders','all20165','brochure displays','handilok','rolled coin cabinet','hooded locking bag','bsxvl561mm10','hamilton','soliciting','cable pen','acrylic signs','atm receipt','standard security bags','dice','hanging file folders','cassette seals','forms organizer','currency straps with solid color bar','reg cc','ipad enclosures','transaction registers','perpetual calendars and pens','spr25348','folgers','trodat 5440','coin sorting wallet','double handle coin tote','ties','plastic silver bags','money counter','clear deposit bags','currency sorter','return address stamps','clean ups','security tint envelope','saf7765gr','gift certificates','steel cashier pad rack','ncr 5588','rcpsh12eplsm','candy canes','b00011349','bau38010','jogger refill','deposit envelope','dime tray','catalog','paper rolls','tamper resistant bags','fax machine','nameplate frame','3 thermal paper rolls','rsifs2d','zipper bags','bvccab00000011','2 part tellers transfer tickets','dual control single-tag system key cabinet','napkins','zipper','erc23','black ink pads','cloth coin bags','self adhesive numbers','flat transit sac','3 hole punch','atm','locking tip box','s120','crowd','perpetual holiday signs','led signs','semacon 1025','7 pin','letterhead','wall mounted sign holder','penny trays','zipper wallet leatherette vinyl','cotton duck','atm card','polyethylene passbook jackets','wall mount calendar','diebold carrier','aagsk240012','check tray','color desk nameplate and frame','mouse','aage2100','micr correction fluid','unisys','ultima seven','3 ring binders','epson erc-32','padlocks','heavy duty staples','box cash security lock','slotted key tags','mobile security','tv','money handling','ratchet','copier','security key cabinet','small locking tip box','stamp ink','clip board','correction tape','next window','tamper evident coin bags','transfer tickets','magner 75m','coin and bill tray','marble desk sign','saf4050','moistener','manila folders','dater stamps','check storage boxes','single handle coin tote','countertop signs','bs100wk','laminating sheets','currency gift envelopes','table throw','san30001','fbi signs','radius nameplate','ang1420p10','opteva','mesh bags','pctd28100','starbucks via','uv pen','scotch tape','post-it','rubber stamps','a gift for you','check 21 image replacement documents','rope posts','folder tabs','clorox wipes','led traffic controllers','teller proof of cash','ab550','reversible slide-post teller signs','d450','texba','magnifier','no soliciting','batteries','cash strap bags','mortgage folders','micr cleaning card','semacon 1415','rolling transport bag','laminating machine','automatic coin wrapper','ncr 5223','4 tier brochure holders','simple calculators','compliance magnetic signs','balance sheets','compucessory','black ink','sugar','thank you envelopes','security counter pens','jumbo jogger','tensabarrier','mxbec70','s-1400','key hole','aagk150','ink pens','coin roll wrappers','axiohm','i display','coil','mini counterfeit detector','bau47810','half dollar coin wrappers','bag ties','napkin bands','magnetic','s-1100','sprcs60459','atm cassette','copy stamp','semacon s-530','shrxea206','clear plastic currency bags','thank you','red snap envelopes','money trays','dog','holiday signage','rac78849ea','ess20222','s1115','spr01651','spr71435','ess299','magnetic radius corner nameplate','crimp','one strap bag','aage7125012','rcm25160800','heavy duty stapler','dra2900504ea','ofx00002','ash can','mrc6495','dxefm517','tray coin extra capacity','shred bags','automatic coin rolls','podium','cpm46112','laminated nylon transit sac','labor posters','blue document carrier','erc-38b','single faced perpetual calendar','erc-38','sticquik 2012','tubes','padded envelopes','atm ribbons','fol00367ea','sprsp111133','flashlights','mmm654144b','master key','zip lock bags','buying your home','loan envelope','aagsk22-50','hud settlement','osp1337n20d','report covers','gold nameplate','literature','single handle coin bags','vinyl passbook jackets','deposit correction notice','stanchion','semacon s-520','cash tickets','time date stamp','vinyl document sleeve','cotton duck coin','9x12','coin tote bags','christmas currency envelopes','saw tooth currency straps','tote bag','sof48100','coin scale','cleaning swab','nf-30','fdic nameplate','nickel coin trays','shelf labels','receipt books','wall calendar','kiosk','cling-on holiday sign','vat carrier','as100','ab5000','16 bundle','ab300','ab1100','ab4000','safety sign','file pocket','gn2-d','automatic coin wrap rolls','trodat','countercache','logo mats','lint free wipes','community reinvestment act sign','christmas envelopes','tnnj478lgy','journal','scanner cleaner','reserve vault cash','tubular coin wrappers','pad rack','fanny pack','counterfeit lights','advice of credit','tuffy','lthe7100','diskette','extruded desk signs','shredder oil','straps $50','fujitsu','single-faced perpetual calendar','coin machine','burkhart','tuffy cash trays','do not enter','stickquik martin luther king day','rubber bands 84','xstamper','fraud','day planners','hew51604a','paper folders','envelope moistener','classix','$50 penny tag','eveen91','aag5035','coin tubes','currency tray locking cover','citizen printer','holiday teller receipts','ultima 7','single-faced perpetual calendar with 2-pens','spr02040','coin cup insert','notice of returned item','r1000','clips','smoking','reversible radius corner teller bar','notary book','credit card decals','cash out','correction strips','currency requisition','uslb1514','tce-125','pack n ship coin transport boxes','rbc3100','spr39250','checking deposit','currency scale','zeb17100','revised stamp','red ties','tie tapes','pedestal desk bar frame for radius corner inserts','te1916','sk14-00','reversible teller bars','savings deposit','contemporary wall frames','phone cord','pads','three ring binders','pamphlet dispenser','card cleaner','numbering stamp','saf4232bl','coin roll opener','saf 4231','tug tight seals','cash tray bag','ultima','sentry safe','card and dice','pre inked stamps','pack and ship coin box','nyce','wlj0395-11','shrlc52d78un','seasonal envelopes','teller machine rolls','transit','thermoplastic forms organizers','scanner cleaning','security signs','card reader','spr6414lb','spr161lb','ccs24305','notepads','casino','semacon model s-1450','zipper wallet bags','wastebaskets','shrel2192rii','please enter here','cr80','qua63574','canon mp11dx','sonkdl55ex500','spr86000','tce209','rolling bag','shredder bags','semacon s-120','reversible teller signs','def70801','cirrus','coin sorter wallet','swingline staplers','office snax','saf1856bl','snap on replacement pen','wipes','daily audit tape envelopes','cubicle signs','card cabinet','printer stand','saf4234cl','credit card reader','slant back sign holders','urgent stamp','color harmony','clear dry erase board','tce202','clear document sleeves','cones','skins','sign bracket','replacement insert for slide post teller signs blank on reverse side','saf-t','replacement kit','spr26901','sprbs2000wk','tce207','sou13c','micr strips','sase1920x','cassette recorders','victor calculators','open signs','tce210','texbaiiplus','checking forms','xer3r2047','check tray bag','seepv26180','sign bracket for roping systems','smead pressboard mortgage','dymo','small silver tag id bags','simple green','check transport cleaning card','savings withdrawal','spr11876','telephone cord','tom62202','cash till','drive up','currency bin','typewriter correction tape','sonkdl22bx320','sasscx5635fnta','tce-183','carabiner','wheeled cart','s-1000','smd13700','tce 183','traditional captain chairs','tack board','spr-bs50wk','traffic control posts','spr02074','folding machine','spr95002','d0197550','s60900','ccs60060','coupons','tmu375','regulatory signage','canon check transport cleaning card','computer screen','size e','cotton swabs','shan05','spr64120','cup dispenser','spr73504','standard locking','shaj11','spr80077','senx055','cotton duck shipping bags flat bottom','slips','clbmrp6272','contemporary floor display','cotton coin bag','steno pad','tce211','top locking tip bag','check caution signal','shrvx2652h','cash tray storage bag','consumer handbook on adjustable rate mortgages','counteasy','s45','saf5261','saf9728gr','consumer handbook','c-line sorter','c8543x','scanned stamp','soap refill','san3597t','self contained cash drawers','clorox','saf4053nc','smoke detector','clock camera','smd67371','silver nameplate frame','safe direction','smd19230','swi48209','smd10330','staple cassettes','customer number','square corner desk bar','slotted key tags numbered','size 16 rubber bands','s-140 coin counter','cordura olive','currency card','sho9991910','saf4233gr','currency tamper bag','single-ply teller receipts','single ply teller receipts','sha11357','desktop stapler','tag key slotted rack number','smd73550','shan14','check reader','single key lock','smd70804','canon calculator','cnmp170dh','deposit stamps','chimes','shan77','$500 quarter tags','cutters','daxn17000n','service cart','spr26537','spr1614lb','counter top sign holder top loading','swi1757392','slot punch','smd89661','currency coin tray','dbl821619','spr01341','dummy camera','shae12','dbl821419','clearance','spr01901','saf3433bl','slwkblkhd','sha81041','desktop calculators','shan85','currency wrap','spr51120','cash register ribbon','cardboard','d400','shap','thermometer','tept91410','cross pens','clbmrp6209','currency strap ones','tco58200','saf3254bl');
/* $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);
    }
