/* Popular phrases - ASKDIRECT - 11:29:22, Sat Jan 28, 2012 */
__SLI_ClientDefaults =
[

];
var asPhrases=new Array ('7','toshiba','projector','optoma','toshiba netbook','canon','pioneer','ipad','tripod','17.3','denon','sony','manfrotto','pentium','32 inch','panasonic','140','laptops','hdmi','hard drive','17.3 toshiba','asus','eco sensor','sennheiser','netbook','r830','sound bars','gx1','external hard drive','camera case','46 inch tv','500d','exr','toshiba r830','walkman dock','37 inch','sonos','tv','samsung','sony vaio laptops','olympus','headphones','13.3 laptop','fpxs1','legria','jamo','canon lens','pioneer 2.1','aa rechargeable batteries','lenovo','belkin','gopro','samsung stand','samsung dongle','tz20','canon 24mm','gesture control','keyword','logitech','backpack','15.6','500gb','notebook 13.3','ati','tm900','external hdd','2.1 speakers','ipad 2','minidisc','dvd burner','qosmio','at100-100','canon 5d','tablet','pure','portable dvd player','3d','scart','go pro','beachtek','mini dv tapes','ipad 2 32gb','13.3','600d','rotolight','monitors','toshiba nb550d','cell phones','panasonic sound bar','bd wise','jvc everio hd','g3','go pro hd','lumix','audio technica','dvd vhs','ipod touch','u500','canon eos 1000d','flash sync','32 panasonic led tv','bridge camera','htc','np-50','apple tv','c660','21 9','g2','ixus','hdd hifi','voice recorder','lowepro','ps3','mkv','5.1 speakers','7.1 pioneer speakers','broadband','2010','fujifilm finepix z33wp','camcorder','toshiba satellite','garmin','gps','peerless','elinchrom','gopro hero 2','athlon','filter','px10','toshiba satellite r830','kp108in','intel','hdmi cables','samsung surround sound','in car dvd player','optoma panoview','sigma','gigajuke','hdctm900','nikon','manfrotto plate','memory card','nb550d','home server','notebook','canon 50d','keyboard','canon eos 550d','lg dp581','sennheiser mm','toshiba r830-182','eos 1100d','roberts radio','dmcgf1','10 inch netbook','warranty','freeview','pioneer subwoofer','gopro battery','sandisk','ds211','battery','subwoofer','nb-2lh','flash','vga cable','64gb','garmin map','canon g10','i5 laptop bluray','64gb sdxc card','roberts','hama','jvc','dx730-101','drift','lumix tz20','canon lens hood','altec lansing','lowepro apex','hdc-sd10','dmcgf2','hdc-tm700','2.1','ixus 100 is','nikon 18-200mm','fujifilm finepix xp10','a3','nikon flash','ixus 110','s3100','returns','mini hifi','txp42vt30b','tx-p50st30b','major','turbo','3.5mm extensions','logitech one','ms500','r830-182','pentax','audio-technica','toshiba laptop','microsoft office','earphones','le32c650l1k','vpceh1s8e b','playstation','pk120','nikon p300','portable dvd','apple','ipod','blu ray players','pc speakers','led tv','canon s100','opening times','pico','lacie','freesat','lens','fuji','toploader','dvd player','radio','eos550d1855iskit','av receiver','sony kdl46hx823','digital photo frames','at100','digital cameras','home cinema','pk301','router','x100','television','philips','ecologic 1','dmc-tz20','lenses','canon 50mm','nikon coolpix l120','txp50st30','panasonic 3d glasses','charger','extender','samsung le46c750','binoculars','gh2','dictation','tv stands','dvd recorder','photo frame','roberts stream 202','enel19','camera bag','3d-xl','multiregion','case logic','dsc-w570','firewire cable','7d','repair','panasonic freesat recorder','laptop cases','sennheiser hd 215','ue46d7000','canon xf100','d4','toshiba t130','nikon s3100','pen drive','nikon d3100','txp42gt30','ds329','lcd tv','s100','nikon d3000','bdp','navigation','studio lights','sd card','18.4','sony laptop','nb520','pmx60','profigold','37','panasonic lumix tz8','stream83i','pss100','l750-16z','western digital','rp-cdhs15','bdc6500','cp800','nikon coolpix s6200','cable','chat','panasonic dmr-bs880ebk','apple ipod nano 16gb','mc775b a','bags','lumix gf1','speakers','toshiba i5','bdp-s560','nb4l','ue40d6530','ht-d5500','hard disk','panasonic lumix gf2','gt750','netbook case','canon 24-70mm lens','nikon s3000','soundbar','lcd','acwac1','canon s95','16-35mm','coolpixs3100b','ue40c6530','dvdls86ebk','blu-ray player','lg tv','hdmi 2m','wifi radio','ixus 300','dmc-fs10','hdc-tm10','l350','hwd570','ecologic 4','ntg2','dmc-tz10','led projector','lowepro flipside','c20','hs20','apple ipod nano 8gb','multimedia','lumix dmc-fx70','nikon memory card','ue32c5800','hm-ta1','l650-1dg','finepix hs10','16gb sd','hdv tapes','s81k','cashback','nikon v1','32gb sd','fuji film','samsung led tv','ue55c9000zk','dlp','4gb','canon dslr cases','le46c750','marshall','qosmio x770-107','lg','bdp-s760','tx-l37dt30','humax','rd60','ue40c7000','ft3','satellite p750','bdps470','toshiba nb550d-10t','turion','wii','vwvbg260','canon 600d','17-40mm','benq','sennheiser hd','l650-igd','85mm','logitech pure-fi','olympus tp-7','sv9370','dmcgx1xeb','av cables','dmcft10','sony camcorder','plasma','jobs','mp3 player','47lw550t','nikon bag','r830-10c','camera','home cinema system','panasonic sc-htb520','hd33','ue55d8000','panasonic dvd burner','hx9v','igo','professional camcorder','nikon l120','wireless headphones','panasonic dmr-bw780ebk','tv mount','pure siesta','panasonic sd700','dcc60','panasonic battery','txp42vt30','toshiba camileo s20','lens protector','lg ht805sh','sony xdrs55dabb','lumix dmc-gx1','fujifilm finepix f80exr','computers','bdd8200','sony mdr-v700dj','panasonic fz45','toshiba sdp94dt','s9100','portable hard drive','onkyo','printer','bluray recorder','gf1','nikon j1','canon lenses','ixus 115 hs','casio','optoma projector','mouse','jamo speakers','toshiba tablet','nikon coolpix s3100','nikon s9100','sharp','dvd writer','qed','sensia','laptop bag','d5000','dvpfx770','txl37e30b','lg 47lx9900','pioneer lx72','hdrxr160eb','canon eos 600d','hdrcx700vebdi','xdrs55dabb','panasonic sd90','kaspersky','gopro lcd','dscw530b','hd448','l110','dmc-gx1xeb-k','nikon coolpix s6150','bluray','dab radio','slr','surround system','b w','computer speakers','panasonic camcorder','lapel microphone','sony portable dvd','ue46d8000','ue32d4003bw','aerial','mini speakers','roberts internet radio','dlc-hem15','vaio','txp50vt30','lumix gx1','nikon 1 j1','video camera','dvpfx770b','vhs','swallow','tx-l37dt30b','nb-5l','component','datavideo','samsung ue27d5000','ps50c6900','panasonic hdc-sdt750','sub401su','ipad 2 16gb wifi','hdv','r9995','reader','rode','nikon case','contact','webcam','mk100','ipod docking station','hdctm900ebk','usb dvd','stand','hp laptop','camcorder battery','sony mdr-v500dj','kp 108in','personal cd players','pxc 250','samsung smart tv','ask electronics','sony mdr','nb550d-10t','digital frame','3d camcorder','roberts cd radio','digital camcorder','video light','fpf550exr','p500','waterproof','toshiba qosmio','srsm50b','42pw450t','external hd','nikon d5100','c660d-26g','xf100','videomic','txl32e3b','panasonic sd','ie80','wireless speakers','ue46d6530','optoma 3d-xl','hdc-hs900','samsung blu ray','bdd7500','samsung st90','projector screen','canon g12','f750-10q','panasonic tv','headset','mdr','10','timer remote','case','d5100','kdl22cx32d','photographic','samsung soundbar','panasonic lumix lens','samsung q330','sony hdrcx115eb','leads','multi region','led camera light','cga','dmc-tz18','internet radio','schtb520','j110','dmcgx1kebk','panasonic gx1','kdl-55hx923','w100','p770','hfm41','roberts mp53','r9994','r9914','xf305','dmrez49vebk','sx230','hs10','garmin zumo','f750-12p','lumix gf3','txp50gt30','panasonic tm900','cx200iiblack','dmw-bcj13','gf3','3d glasses','roberts ecologic','pk320','eos 550d','txl32e30b','l775','sx220','panasonic lumix','samsung ue40d8000','ue32d6100','panasonic sc-htb10','txp46st30','pmx60ii','panasonic hdc-tm900','zoom','samsung 3d','3d-rf','teenypod','txl42e30b','kdl32cx523','wx7','ew112pg3','hahnel mk100','x300-15u','ue46c9000','panasonic lumix tz10','vwps65xek','dmrpwt500','sony strdh100','r630','canon mg6150','panasonic tm80','videomic pro','i10','toshiba p500 1jf','toshiba libretto','dscwx7b','samsung ue32d6530','giottos','a1','hd300x','aw100','dcc 1500','hdc-sd40','battery grip','slingshot','owle','waterproof camera','nikon d90','tx-l37e30','42lw550t','txl42e30','x770','dmcgx1','davtz135','dmc-gx1ebk','speaker cable','kdl40cx523','kdl46ex723','sbg-d1v','panasonic dmc tz20','vwvbn130ek','samsung sbg-d1v battery grip','tx-p42gt30b','tm900 battery','47ld950','amplifier','19lu5000','nexvg10','refurbished','sony 3d glasses','ue55d8000yu','bcs303','touch screen laptop','optimum','mv800','fpx100','toshiba camileo s30','tz18','thuraya','canon powershot sx230 hs','dscwx7','htis100','lg 55lx9900','toshiba qosmio laptop','h4n','sennheiser hd500a headphones','wireless microphone','canon hf s20','canon xf300','sony bdve280','sbs-1','eos60d1855iskit','coloud','kdl22cx32dbu','tx-p50vt30b','3d blu ray player','cannon g12','ps42c450','panasonic tm700','radio alarm','panasonic skype','sennheiser hd 25-1 ii','sony ht','gzhm440','samsung le32b450c4','nikon d700','430exii','samsung ue26c4000','panasonic hdc tm900','jvc projector','panasonic lumix dmc-gf3','b w 77mm','samsung wifi','panasonic tz20','lg 42lx6900','cx680','en-el5','samsung st600','sony bluray','p750','sony ht-is100','mixer','satellite a660','roberts expression','sony ipod','pxc310bt','sennheiser cx 400','sony iphone','pure sensia','z-2300','panasonic g3','s5100','speaker stands','sony dab ipod','pioneer bcs 212','sony 32','samsung wb2000','samsung tv','panasonic tz18','sc-htb10eb-k','pmx90','sennheiser hd 202','samsung ht-c5500','samsung 32','panasonic txp50vt30','satellite c660-1k9','swac1','panasonic viera','sony icf','samsung ht-c6930w','panasonic projector','samsung ps43d450','portable blu-ray','pioneer sub','toshiba dvr20','p42st30','sennheiser pxc 310','pocket camcorder hd','panasonic vw-vbg130','toshiba dvd recorder','pvr','csp05','casio exilim','canon powershot','sale','panasonic lumix fz48','swas1 bk','panasonic blu-ray','htpfs510','stzd10z-r','hmxe10bp','htp100','sandisk fuze','satellite p750-135','ppf bk','cannon lense','sd card reader','portable video','ps43d450a2w','panasonic hdc tm80','st80zzbpb','sirocco150','pioneer bdp-lx52','hd25spmkii','himd','px360','panasonic dmp-bd75','hp','sony xdr','scbt230ebk','p110','hdr-xr520ve','htp200bd','srs-d25','slr camera','s302','photo printers','smp-n100','splitter','hd hero 2','toshiba satellite t130-11h 13.3 notebook','canon paper','shower radio','toshiba l775','hb905da','s-air','hb905pa','panasonic 32','hero 2','camcorder bracket','sc-hc55db','canon sx210 is','sony cd player','canon flash','camcorder microphone','sony dvd','sony battery charger','canon ixus 130','samsung 3d glasses','s-51w','projector ceiling mount','sx150','surveillance','sound 66','samsung 37','canon 550d case','sony ss speakers','sf4n4','canon powershot sx130 is','canon canoscan lide 200','sony hdr-td10e 64gb memory full hd 3d camcorder','s20','cga-du21','sound system','pioneer amplifier','schtx500','camlink','hdrcx700ve','sound recorder','dmc-tz7eb-k','samsung photo frame','sony rht','camcorder repair','s70','sennheiser pmx','srsd25bc','dc adaptors','2300','st600','sony 3d','st5000bpa','50pk350','se-clx40','19lu7000','schc05','sony mdrxb700','sony tripod','slta55vl','sony 5.1','sony kdl-52','screwdriver','panasonic home cinema system','sony xdr-c706dbp','sony led','pdkts28','pioneer ipod dock','panasonic dmr-ex773ebk 160gb hdd dvd recorder with freeview','pmx','panasonic dvd recorder','panasonic dmr-xw380','sony vrd mc6','samsung camcorder','cb-2lxe','sd card 8gb','samsung 7000','pink laptop','sennheiser px 360','ssg','samsung 8000','canon speedlite 580ex ii','canon 200mm','sony xdr s55','canon e2','sony computer','sony dvd rw','sony touch','sony dsc-w380 14.1mp digital still camera','sony dscw570','px','coolpix l23','panasonic lumix dmc-g3','canon ef-s 55-250mm f 4-5.6 is','samsung wall mount','panasonic leather case','core i','canon r18','panasonic lens','sony nwz-e453','shotgun mic','cb','professional camcorder bags','samsung wb610','daewoo','sony handycam','duologic','sony bdv e870','canon ink','panasonic sc-pm38db','dmw-cgl2','sony nas-e300hd','sony rdrdc205b','sony dsc w350','samsung ps50c450','dmc fz45','dvi cable','canon bp827','sleep and music','samsung pl80 12.2mp compact digital camera','sony dsc-h20','cannon g9','sony hdr-cx130e full hd memory card camcorder','panasonic hdctm900ebk','sony bp-u60','sony wide','srf59','scbt735','schc30dbebs','sony hd camcorder','satellite l755-13k 15.6 notebook','sony str dh810','panasonic camcorder battery','canon strap','canon ef 70-200mm f 4.0 l usm lens','samsung yp-q2','pentax optio l70','panasonic dmw-mctz7e','panasonic fs','panasonic dy-wl10','panasonic btt350','sony mhc-ec69','s-31','camera plates','sony dvd recorder','pixma-mp495','canon 400mm','tv headphones','camcorder accessories','cx355','toshiba satellite r630-155 13.3 notebook','tc 80n3','stc1100','cath kidston','samsung ue19c4000 19 hd ready led tv','proa4801','compact camera','sony dsc t900','pioneer bdp-430','sony camcorder case','sony handycam hdr-tg7ve','paws412','sony kdl-32ex403','surround','cs115','panasonic dmc-tz18 14.1 megapixel digital compact camera','computer monitor','sony dpf x800','ds','sony dcr-hc51','dv camcorder','pdplx5090','processor i5','cinema','dvdls84','canon 16','pocket camcorder','portable printer','toshiba satellite l670d-13f 17.3 notebook','samsung bluray','canon hood','chargepak','cr123a','panasonic txl37d25','canon wide angle','tg7ve','camcorder housing','txp42v20','coolpixp100','toshiba netbook nb305-10f','perfect portrait system','sd card class 6','canon bg-e2n battery grip','sony s470','tx-l37s10b','sony dcr-sr78','pixmaip100','panasonic hdc-tm700 32gb flash memory hd camcorder','dmw-ms1','toshiba nb500-108','sony ac adaptor','panasonic g30','panasonic sc-hc40db','samsung c6930','toshiba satellite l670','canon 130','toshiba camileo p30','dcs-590','sleep-and-charge','panasonic memory card','canon pixma mp990','dmcgh1','sony nas','pxc 350','sony digital media port','canon mx860','canon 400d charger','sport headphones','panasonic hd camcorder','panasonic burner','sdr s50','smxk40sp','panasonic sd80','panasonic blu ray recorder','sony camcorder batteries','s31ck','camcorder wireless mics','sdp74','txp42x20','pioneer bcs','panasonic dmw-cgl2se-k','panasonic hdc-sd700 sd card hd camcorder','sennheiser bluetooth','dpfd820','tx-l42d25b','canon pixma ip4700','sony prs-acl1','schc7','panasonic dmc-fs11','prs350s','sony nwz-b142f','satellite l630-16l','camera remote','panasonic dmc-gf2','sd camcorder','samsung x420','panasonic lumix zx3','tx-p42s20b','toshiba satellite a660-1h4','pioneer dv-120-k','tx-p42x20b','sony hdmi','toshiba satellite a660-1f4','touch screen camera','tx-l37v20','panasonic tv lcd','pews211','toshiba c650 110 laptop','pioneer dcs','sennheiser battery','canon pixma mp560','sony bdp-s760','txp42v10b','toshiba satellite l500-1xj','clear voice 2','cx505','toshiba qosmio x300','cx 680','pendrive16gb','sony cinema','panasonic dmr-ex769eb-k','pioneer blu','c5550','panasonic cinema stand','sony htas5 5.1 channel satellite speaker surround sound system','sony dpfd85','s370','sony x laptop','sony cmt-fx350i','canon hot shoe','s2800hd','toshiba camileo s10 hd camcorder','samsung sm2033hd','panasonic dmw-lvf1e live view finder for lumix gf1','sony rdp','camcorder chargers','sony cmt','sr78','lifespace','dmwfl220e','panasonic ls86','dmcfx70','dmcfx550','samsung ue37c6530','canon sock','sennheiser hd 212','toshiba p500-14l','panasonic fx550','panasonic tx-p50vt20','sony dpp-fp95','dmc gh2','canon nb-4l','toshiba satellite t130-16w','dscwx1','toshiba camcorder');
/* $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);
    }
