    /* Vulpine 2008 - Author Joe Fox */
    
    /* Already in scope? let the interpreter skip execution again
     */
    if (!ebayHandler) {
        /* constants
         */
        var kDEBUG      = false;
    
        var kASSET_UNSUPPORTED =    1;
        var kASSET_NOCONNECT   =    2;
        var kASSET_READY       =    4;
        var kASSET_MALFORMED   =    8;
        var kASSET_NOINIT      =   16;
        var kASSET_FOUND       =   32;
        var kASSET_NOTFOUND    =   64;
    
        var kCOMPAT_GECKO      =    1;
        var kCOMPAT_TRITON     =    2;
        var kCOMPAT_KHTML      =    3;
    
        var kHTTP_NOCACHE      = true;

        /* Widget Handler Class
         */
        var ebayHandler = function( aInstanceID ) {
            this.oContext = this;
            this.mCompat = kCOMPAT_GECKO;
            this.oScript;
            this.oConfig;
            this.mInstanceID;
            this.mInstanceNumber;
            
            /* Basic capability detection - gecko, triton and khtml/webkit
             */
            if (document.all && !self.opera) {
                this.mCompat = kCOMPAT_TRITON;
            } else if ( navigator.vendor == "KDE"
                     || ( document.childNodes 
                       && !document.all
                       && !navigator.taintEnabled
                       && !navigator.accentColorName ) ) {
                this.mCompat = kCOMPAT_KHTML;
            };
            
            /* Create or retrieve a unique widget reference. We'll use this
             * to make sure each widget recieves the correct data and events for
             * its remote file requests.
             */
            this.getInstance = function() {
                if (!this.mInstanceID) {
                    /* Create a global scope widget handler collection
                     */
                    if (!window['ebayhandlers']) {
                        window['ebayhandlers'] = { 
                            'instances': 0
                        };
                    };
                    
                    this.mInstanceNumber = ++ebayhandlers.instances;
                    this.mInstanceID     = ( aInstanceID ? aInstanceID : 'instance_' + this.mInstanceNumber ) ;
                    /* Add a reference to the new instance into the global widget collection.
                     */
                    ebayhandlers[this.mInstanceID] = this;
                    window['callbackNames_' + this.mInstanceID] = this;
                };
                return ebayhandlers[this.mInstanceID];        
            };
            
            /* prep and create a widget instance when the class is
             * instantiated
             */
            this.init();
            
            return this.getInstance();
        };
    
        /* Widget handler methods
         */
        ebayHandler.prototype = {
            /* (Re)initialise class members and event handlers
             */
            'init': function() {
                this.mState   = kASSET_NOINIT;
                this.mCounter = 0;
                this.mEvents  = {
                    'onError':    null,
                    'onSuccess':  null,
                    'onStart':    null,
                    'onFailure':  null,
                    'onLoad':     null,
                    'onComplete': function(asset) {
                        /* Basic asset onload event handler
                         * onFailure is called if the asset is malformed.
                         */
                        if (asset) {
                            if (asset.status = kASSET_READY) {
                                this.fire(this.mEvents.onSuccess,[asset.response]);
                            } else if (asset.status = kASSET_MALFORMED) {
                                this.fire(this.mEvents.onFailure,[kASSET_MALFORMED]);
                            };
                        } else {
                            this.fire(this.mEvents.onFailure,[kASSET_NOTFOUND]);
                        };
                    }
                };
            },
            /* Text node helper that wraps createElement. (below)
             */
            'createText': function(aText,aDomain) {
                return this.createElement(null,null,aText,aDomain);
            },
            /* Helper function that allows creation of DOM elements, attributes
             * and contents using one easy function call. Calls can be nested
             * to build whole DOM hierarchies.
             * Should also take account of several browser & tag caveats
             */
            'createElement': function(aElement, aAttributes, aContents, aDomain) {
                var type     = typeof aContents;
                var oElement = null;
                var oDoc     = aDomain || document;
                /* Contents is a string, and there's no tagname define, return
                 * a text node
                 */
                if (!aElement && type == 'string') {
                    return oDoc.createTextNode(aContents);
                };
                /* Workaround for IE bug where dynamic input elements can't have 
                 * their name attribute set
                 */
                if ( aElement == 'input'
                  && ( this.mCompat == kCOMPAT_TRITON )
                  && aAttributes
                  && aAttributes.name) {
                    oElement = oDoc.createElement('<' + aElement + ' name="' + aAttributes.name + '" />');
                } else {
                    oElement = oDoc.createElement(aElement);
                };
                /* Iterate through the attributes object and apply each one in
                 * turn to the element object
                 */
                if (aAttributes) {
                    for (var i in aAttributes) {
                        if (aAttributes[i]) {
                            if (i == 'class') {
                                /* setAttribute('class'... doesn't work in all
                                 * cases. Use className instead.
                                 */
                                oElement.className = aAttributes[i];
                            } else if (i == 'style' && this.mCompat == kCOMPAT_TRITON ) {
                                /* IE requires a special way of setting tag
                                 * level style attributes
                                 */
                                oElement.style.cssText = aAttributes[i]; 
                            } else {
                                oElement.setAttribute(i,aAttributes[i]);
                            };
                        };
                    };
                };
                /* If the contents parameter is an object, append it to the
                 * element, otherwise assume it's text.
                 */
                if (type == 'object') {
                    oElement.appendChild(aContents);
                } else if (type == 'string') {
                    if (aElement == 'style' && this.mCompat == kCOMPAT_TRITON ) {
                        /* IE has an unusual method for setting style
                         * tag contents. IE5.5 needs to wait for the style
                         * object to initialise first.
                         */
                        if (document.implementation) {
                            oElement.styleSheet.cssText = aContents;
                        } else {
                            setTimeout(function() {
                                oElement.styleSheet.cssText = aContents;
                                oElement = null;
                            },1);
                        };
                    } else if (aElement == 'script' && this.mCompat == kCOMPAT_TRITON ) {
                        /* IE also has its own ideas about script content creation
                         */
                        oElement.text = aContents;
                    } else {
                        oElement.appendChild(this.createElement(null,null,aContents,aDomain));
                    };
                };
                return oElement;
            },
            /* Dynamically add style declarations to the document
             */
            'setStyle': function(aStyle, aOptions) {
                var aOptions       = aOptions || {};
                var oStyle         = null;          
                var id             = aOptions.id || this.mInstanceID;
                var oHead          = document.getElementsByTagName('head');
                
                /* Check if the style tag associated with our widget already
                 * exists. If so, we can reuse it.
                 */
                if (id) {
                    oStyle = this.getTarget(id + '-style');
                };
                if (oStyle) {
                    /* Clear existing styles if option is set
                     */
                    if (aOptions.overwrite) {
                        oStyle.parentNode.removeChild(oStyle);
                    } else {
                        return oStyle;
                    };
                };
                       
                if (oStyle) {
                    /* Append styles to existing stylesheet
                     */
                    if (this.mCompat == kCOMPAT_TRITON ) {
                        oStyle.styleSheet.cssText += aStyle;
                    } else {
                        oStyle.appendChild(this.createText(aStyle));
                    };
                } else {
                    /* Create a new stylesheet and add it to the document head
                     * if it exists or otherwise place it before the script tag.
                     * Note: webkit requires styles to be placed in the head
                     */
                    oStyle = this.createElement('style', {
                        'type':  'text/css',
                        'media': 'all',
                        'id':    id + '-style'
                    }, aStyle);
                    
                    if (oHead[0]) {
                        oHead[0].appendChild(oStyle); 
                    };   
                };

                return oStyle;
            },
            /* Fetch an asset from a remote location - browser security means
             * we can't use ajax, so we'll use dynamic script tags with 
             * callbacks instead.
             */
            'fetch': function(aURI, aOptions) {
                var oContext = this.oContext;
                var aOptions = aOptions || {};
                var oLoader  = this.getTarget(this.mInstanceID + '-loader') || null;
                var oHead    = document.getElementsByTagName('head');
                
                if (oLoader) {
                    oLoader.parentNode.removeChild(oLoader);
                }
                                
               // this.init();
    
                var oConfig = {
                    'target':     aOptions.target     || null,
                    'fetchuri':   aOptions.fetchuri   || aURI
                };
                
                this.mEvents.onSuccess  = aOptions.onSuccess  || null;
                this.mEvents.onFailure  = aOptions.onFailure  || null;
               // this.mEvents.onComplete = aOptions.onComplete || null;          
                    
                var oLoader = this.createElement('script', {
                    'type':  'text/javascript',
                    'src':   oConfig.fetchuri,
                    'id':    this.mInstanceID + '-loader'
                });         
               
                if (oHead[0]) {
                    oHead[0].appendChild(oLoader);
                };
                            
                this.fire(this.mEvents.onStart, [oConfig]);
            },
            
            /* Wrapper for getElementById that doesn't care if you specify an
             * id or a dom object.
             */
            'getTarget': function(target, domain) {
                var container = null;
                var doc       = domain || document;
                switch (typeof target) {
                    case 'string':
                        container = doc.getElementById(target);
                    break;
                    case 'object':
                        if ( target.nodeType
                          && target.nodeType == 1) {
                            container = target;
                        };
                    break;
                };
                return container;
            },
            /* Event handler which attempts to fire events in the widget's scope
             */
            'fire': function(aEventFunction,aProperties) {
                var type = typeof aEventFunction;
    
                switch (typeof aEventFunction) {
                    case 'undefined':
                        return false;
                    break;
                    case 'function':
                        return aEventFunction.apply(this,aProperties);
                    break;
                    default:
                        if (window[aEventFunction]) {
                            return window[aEventFunction].apply(this,aProperties);
                        };
                    break;
                };
            },
            /* Simple debug handler than can generate alerts or fire an error
             * handler callback
             */
            'debug': function(aException, aOptions) {
                var aOptions = aOptions || {};
                if (kDEBUG === true) {
                    alert('Error in ' + aException);
                };
                if (this.mEvents.onError) {
                    this.fire(this.mEvents.onError, [aException]);
                };
                return false;
            }
        };   
    
        ebayHandler.prototype.apiCall = function(aCall, aOptions) {
            var oConfig   = aOptions;
            var fetchOpts = {};
            var sURI      = 'http://open.api.ebay.com/Shopping?callname=' + (aCall || 'FindItemsAdvanced');
            
            oConfig.appid            = aOptions.appid     || 'eByayde21-2372-42e6-bd2c-308e98523c4';
            oConfig.version          = aOptions.version   || '561';
            oConfig.siteid           = aOptions.siteid    || '3';
            oConfig.responseencoding = aOptions.encoding  || 'JSON';
            
            if (!aOptions.callbackname) {
                oConfig.callbackname = 'ebayhandlers.' + this.mInstanceID + '.handleResponse';
            };

            for (var option in oConfig) {
                if (/^on(Success|Start|Failure)$/.test(option)) {
                    fetchOpts[option] = oConfig[option];
                    continue;
                };
                sURI += '&' + option + '=' + escape(oConfig[option]);
            };

            this.fetch(sURI,fetchOpts);
        };
        
        ebayHandler.prototype.handleResponse = function( response ) {
            if (response) {
                if (response.Ack && response.Ack == 'Success') {
                    this.fire(this.mEvents.onSuccess,[response]);
                } else if (response.Ack && response.Ack != 'Success') {
                    this.fire(this.mEvents.onFailure,[response.Errors[0].ErrorCode,response.Errors[0].LongMessage]);
                } else {
                    this.fire(this.mEvents.onFailure,[kASSET_MALFORMED]);
                };
            } else {
                this.fire(this.mEvents.onFailure,[kASSET_NOTFOUND]);
            };     
        };
   
        ebayHandler.prototype.renderItemList = function( aItems, aID, aTitle ) {
            var oItem      = {};
			var oContainer = this.getTarget(aID + '_container');
            
            if (oContainer) {
				oContainer.innerHTML = '';
			};
            
            var itemContainer = this.createElement('div',{
                'class': 'item-container'
            });
            
            for (var idx in aItems) {
            
                oItem = aItems[idx];
                
                if (!oItem.TimeLeft) {
                    continue;
                };
                
                var item = this.createElement('div',{
                    'class': 'item'
                });
                
                var itemThumbnail = this.createElement('div', {
                    'class': 'item-thumbnail'
                },  this.createElement('a', {
                        'href':   oItem.ViewItemURLForNaturalSearch,
                        'title':  'click to view item'
                    },  this.createElement('img', {
                            'src':   oItem.GalleryURL,
                            'border': '0',
                            'alt':   oItem.Title
                        })
                    )
                );

                var itemDetail = this.createElement('div', {
                    'class': 'item-detail'
                });
                
                var titleLink = this.createElement('a', {
                    'href':   oItem.ViewItemURLForNaturalSearch,
                    'title':  'click to view item'
                },  oItem.Title + ' ');
                
                titleLink.appendChild(this.createElement('img', {
                    'src': 'http://pics.ebaystatic.com/aw/pics/icons/charityicon_16x16.gif',
                    'alt': 'eBay for Charity',
                    'width': '16px',
                    'height': '16px',
                    'border': '0',
                    'style': 'vertical-align: middle'
                }));
                
                var itemTitle = this.createElement('div', {
                    'class': 'item-title'
                }, titleLink);
                
                var itemPrice = this.createElement('div', {
                    'class': 'item-price'
                }, addCurrencySymbol(oItem.ConvertedCurrentPrice.Value, oItem.ConvertedCurrentPrice.CurrencyID) + ' ');
                
                if (typeof oItem.BidCount != 'undefined') {        
                    itemPrice.appendChild(this.createElement('span', {
                        'class': 'item-bids'
                    }, '(' + oItem.BidCount + ' bid' + (oItem.BidCount == 1 ? '' : 's') + ')'));
                };
                
                var itemTimeLeft = this.createElement('div', {
                    'class': 'item-timeleft'
                }, durationToStr(oItem.TimeLeft) + ' remaining');
                
                itemDetail.appendChild(itemTitle);
                itemDetail.appendChild(itemPrice);
                itemDetail.appendChild(itemTimeLeft);
                
                item.appendChild(itemThumbnail);
                item.appendChild(itemDetail);
                
                itemContainer.appendChild(item);                
            };
            
            oContainer.appendChild(itemContainer);
            oContainer.appendChild(this.createElement('div',{
                'class':'clear'
            }));
            
            delete oContainer;    
            
			var auctionTabs = this.getTarget('auction_tabs');

            if (itemContainer.hasChildNodes()) {
               
                if (!this.getTarget(aID)) {

                    var newTab = this.createElement('li', {
                        'id': aID
                    },  this.createElement('a', {
                           'href': 'javascript:switchTabs(\'' + aID + '\');void(0);'
                        }, aTitle)
                    );

					if (aID == 'special_auctions') {
                	    auctionTabs.insertBefore(newTab,auctionTabs.firstChild);
                        switchTabs(aID);
                	} else {
                        if (auctionTabs.firstChild && auctionTabs.firstChild.id != 'ending_auctions' && auctionTabs.firstChild.id != 'special_auctions') {
                            auctionTabs.insertBefore(newTab,auctionTabs.firstChild);
                            switchTabs(aID);
                        } else {
                            auctionTabs.appendChild(newTab);
                            if (aID == 'ending_auctions') {
                                switchTabs(aID);
                            };
                        };
                	};
                };                
            } else {
            
				if (auctionTabs && this.getTarget(aID)) {
                    if (this.getTarget('ending_auctions')) {
    					switchTabs('ending_auctions');
                    };
				    auctionTabs.removeChild(this.getTarget(aID));
                };
                
                return false;
			};
            
            return true;        
        };
    };
 
    var morelinks = {
        'special_auctions':  'http://search.ebay.co.uk/_W0QQsachaZ1',
        'ending_auctions':   'http://search.ebay.co.uk/_W0QQsachaZ1',
        'bigbucks_auctions': 'http://search.ebay.co.uk/_W0QQsachaZ1'
    };
    var specialAuctions = document.getElementById('special_auctions_container');
    
    if (specialAuctions) {
        var ebh = new ebayHandler('special_list');
        
		var updateSpecialList = function() {
            ebh.fetch('http://pages.ebay.co.uk/ebayforcharity/js/special_items.jgz', {
                'onSuccess': function(special) {
					if (special.items && special.items.length >= 1) {
                        
                    	fetchSpecialItems(special.items.join());
					};
                    if (special.see_more_link) {
                        morelinks['special_auctions'] = special.see_more_link;
                    };
                },
                'onFailure': function(code, msg) {
                    //alert(code + ': ' + msg);
                    schedule('updateSpecialList',60000);
                }
            
            });
         };
         
         var ebh5 = new ebayHandler();
         
         var fetchSpecialItems = function(items) {
            ebh5.apiCall('GetMultipleItems', {
                'ItemID': items,
                'onSuccess': function(results) {
                
                    if (results.Item && this.renderItemList(results.Item, 'special_auctions', 'Special Auctions')) {
                        
                        schedule('updateSpecialList',20000);
                    } else {
                        specialAuctions.id = 'bigbucks_auctions_container';
                        bigbucksAuctions = specialAuctions;
                        fetchBigBucks();
                    };
                },
                'onFailure': function(code, msg) {
                    //alert(code + ': ' + msg);
                    //schedule('updateSpecialList',60000);
                    specialAuctions.id = 'bigbucks_auctions_container';
                    bigbucksAuctions = specialAuctions;
                    fetchBigBucks();         
                }
            });
         };
/*
        ebh.fetch('http://qa-charities.ebaydevelopment.co.uk/cache/special_items.jgz', {
            'onSuccess': function(special_items) {
                
                ebh.apiCall('GetMultipleItems', {
                    'ItemID': special_items.join(),
                    'onSuccess': function(results) {
                        if (results.Item) {
                            this.renderItemList(results.Item, 'special_auctions', 'Special Auctions!');
                            switchTabs('special_auctions');
                        };
                        
                    }
                });
            },
            'onFailure': function(code, msg) {
                alert(code + ': ' + msg);
            }
        });*/
        updateSpecialList();
    };
    
    var endingAuctions = document.getElementById('ending_auctions_container');

    if (endingAuctions) {
        var ebh2 = new ebayHandler();
    
        var fetchEndingItems = function() {
            var itemCount = endingAuctions.className.match(/max_entries-([0-9]*)/);
    
            ebh2.apiCall('FindItemsAdvanced',{
                'SearchFlag': 'Charity,Gallery',
                'QueryKeywords': '*',
                'MaxEntries': ( itemCount ? itemCount[1] : 3 ),
                'ItemsLocatedIn': 'GB',
                'PreferredLocation': 'ListedInCurrencyImplied',
                'ItemSort': 'EndTime',
                'SortOrder': 'Descending',
                'onSuccess': function(results) {
                    if (results.SearchResult[0].ItemArray.Item) {
                        if (this.renderItemList(results.SearchResult[0].ItemArray.Item, 'ending_auctions', 'Ending Soon')) {
                            schedule('fetchEndingItems',20000);
                        };
                    };
                },
                'onFailure': function(code, msg) {
                    //alert(code + ': ' + msg);
                    schedule('fetchEndingItems',60000);
                }
            });
        };
        fetchEndingItems();
        //var endingAuctionsTimer = window.setInterval(function() { fetchEndingItems(); }, 20000);
    };
    
    var bigbucksAuctions = document.getElementById('bigbucks_auctions_container');
    
    
    var ebh3 = new ebayHandler();

    var fetchBigBucks = function() {
        var itemCount = bigbucksAuctions.className.match(/max_entries-([0-9]*)/);
        
        ebh3.apiCall('FindItemsAdvanced',{
            'SearchFlag': 'Charity,Gallery',
            'QueryKeywords': '*',
            'MaxEntries': ( itemCount ? itemCount[1] : 3 ),
            'BidCountMin': '3',
            'ItemType': 'AuctionItemsOnly',
            'ItemsLocatedIn': 'GB',
            'PreferredLocation': 'ListedInCurrencyImplied',
            'ItemSort': 'PricePlusShipping',
            'SortOrder': 'Descending',
            'onSuccess': function(results) {
                if (results.SearchResult[0].ItemArray.Item) {
                    if (this.renderItemList(results.SearchResult[0].ItemArray.Item, 'bigbucks_auctions', 'Splash Out!')) {
                        schedule('fetchBigBucks',20000);
                    };
                };
            },
            'onFailure': function(code, msg) {
                //alert(code + ': ' + msg);
                schedule('fetchBigBucks',60000);
            }
        });
    };
        
    if (bigbucksAuctions) {
        fetchBigBucks();
    };


    var categoryList = document.getElementById('categories_content');
    
    if (categoryList) {
        var ebh4 = new ebayHandler();
    
        ebh4.apiCall('GetCategoryInfo',{
            'CategoryID': '-1',
            'IncludeSelector': 'ChildCategories',
            'onSuccess': function(results) {
                var oCat   = {};
                
                var itemContainer = this.createElement('ul',{
                    'class': 'category-container-col1'
                });
                
                if (results.CategoryArray.Category) {
                    var catCount = results.CategoryArray.Category.length || 0;
                    
                    var modCat = Math.floor(catCount / 2);
                                                            
                    for (var idx in results.CategoryArray.Category) {
                        if (idx != 1 && idx % modCat == 1) {
                            categoryList.appendChild(itemContainer);
                            itemContainer = this.createElement('ul',{
                                'class': 'category-container-col2'
                            });
                        };
                        oCat = results.CategoryArray.Category[idx];
                        if (oCat.CategoryID == '-1') {
                            continue;
                        };
                        
                        var cat = this.createElement('li',{
                            'class': 'category'
                        },  this.createElement('a', {
                                'href':   'http://search.ebay.co.uk/ws/search/SaleSearch?sofocus=bs&satitle=&sacat=' + oCat.CategoryID + '%26catref%3DC5&fbd=1&%3Bsspagename=h%3Ah%3Aadvsearch%3AUk&from=R6&nojspr=y&pfid=0&fswc=1&few=&saprclo=&saprchi=&fss=0&saslop=1&sasl=&fls=4%26floc%3D1&sargn=-1%26saslc%3D0&salic=3&saatc=3&sadis=200&fpos=&fsct=&sacur=0&sacqyop=ge&sacqy=&ga10244=10425&sacha=1&saslt=2&ftrt=1&ftrv=1&sabdlo=&sabdhi=&saaff=afdefault&afmp=&afcj=&fsop=1%26fsoo%3D1&fcl=3&frpp=50',
                                'title':  'click to view category'
                            }, oCat.CategoryName)
                        );
                                    
                        itemContainer.appendChild(cat);                
                    };
                };
                categoryList.appendChild(itemContainer);
                categoryList.appendChild(this.createElement('div', {
                    'class': 'clear'
                }));
                
            }
        });
    };

function schedule(aCallback, aInterval) {
        window.clearTimeout(window[aCallback + '_timer']);     
        window[aCallback + '_timer'] = window.setTimeout(function() { window[aCallback](); }, aInterval);
};
    
function durationToStr(duration) {
    var output   = '';
    var unit     = '';
    var matches  = duration.match(/P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9\.]*)S)?)?/);
    
    var oDuration = {
        'y':  matches[1],
        'mn': matches[2],
        'd':  matches[3],
        'h':  matches[4],
        'm':  matches[5],
        's':  matches[6]
    };
    
    for ( var idx in oDuration ) {
        if (!oDuration[idx] || oDuration[idx] < 1) {
            continue;
        };
        output += ( output != '' ? ' ' : '' ) + unit;
        
        if (idx == 'second') {
            oDuration[idx] = Math.floor(oDuration[idx]);
        };
        unit = oDuration[idx] + idx;
    };
    output += ( output != '' ? ' and ' : '' ) + unit;

    return output;
};

function addCurrencySymbol(price, code) {
    price = price.toFixed(2);
    var symbol = price + ' ' + code;
    
    switch (code) {
        case 'GBP':
            symbol = '£' + price;
        break;
        case 'EUR':
            symbol = '€' + price;
        break;
        case 'USD':
            symbol = '$' + price;
        break;
    };
    return symbol;
};


function switchTabs(elID) {
    var elTab;
    var elPanel;
    var morelink = document.getElementById('see_more_link');
    
    var elTabsContainer = document.getElementById('auction_tabs');
    
    if (elTabsContainer) {
        var elTabs = elTabsContainer.getElementsByTagName('li');
        
        for (var i = 0; i < elTabs.length; i++) {
            elTabs[i].className = ( elTabs[i].id == elID ? elTabs[i].className + ' active' : elTabs[i].className.replace(/\s?active/g,'') );

            if (elPanel = document.getElementById(elTabs[i].id + '_container')) {
                if ( elTabs[i].id == elID ) {
                    elPanel.style.display = 'block';
                    if (morelink && morelinks[elID]) {
                        morelink.href = morelinks[elID];
                    };
                } else {
                    elPanel.style.display = 'none';
                };
            };
        };
    };
};
