(function() {

    /**
    *
    * By Marco van Hylckama Vlieg (marco@i-marco.nl)
    * Some inspiration taken from the YUI TabView widget
    *
    * THIS IS A WORK IN PROGRESS
    *
    * Many, many thanks go out to Daniel Satyam Barreiro!
    * Please read his article about YUI widget development
    * http://yuiblog.com/blog/2008/06/24/buildingwidgets/
    * Without his excellent help and advice this widget would not
    * be half as good as it is now.
    */
    
    /**
    * The accordionview module provides a widget for managing content bound to an 'accordion'.
    * @module accordionview
    * @requires yahoo, dom, event, element, animation
    */
    var idClickeado=0
	
    var YUD = YAHOO.util.Dom, YUE = YAHOO.util.Event, YUA = YAHOO.util.Anim;
    
    /**
    * A widget to control accordion views.
    * @namespace YAHOO.widget
    * @class AccordionView
    * @extends YAHOO.util.Element
    * @constructor
    * @param {HTMLElement | String} el The id of the html element that represents the AccordionView. 
    * @param {Object} oAttr (optional) A key map of the AccordionView's 
    * initial oAttributes.  
    */

    var AccordionView = function(el, oAttr) {
        
        el = YUD.get(el);
        
        // some sensible defaults
        
        oAttr = oAttr || {};
        if(!el) {
            el = document.createElement('ul');
        }
        if (el.id) {oAttr.id = el.id; }
        YAHOO.widget.AccordionView.superclass.constructor.call(this, el, oAttr); 

        /**
        * Accordion events
        *
        * panelOpen: before a panel opens. Returns the panel element when it fires
        * panelClose: before a panel closes. Returns the panel element when it fires
        * afterPanelOpen: after a panel has finished opening. Returns the panel element when it fires
        * afterPanelClose: after a panel has finished closing. Returns the panel element when it fires
        * beforeStateChange: before a state change occurs
        * stateChanged: fires after the acordion has changed state completely
        *
        */

        this._initList(el, oAttr);
                
        // This refresh forces all defaults to be set
         
        this.refresh(['id', 'width','hoverActivated'],true);  
        
    };

    YAHOO.widget.AccordionView = AccordionView;
    
    YAHOO.extend(AccordionView, YAHOO.util.Element, {
                
        /**
        * Initialize attributes for the Acordion
        * @param {Object} oAttr attributes key map
        * @method initAttributes
        */
        
        initAttributes: function (oAttr) {
            AccordionView.superclass.initAttributes.call(this, oAttr);
            var bAnimate = (YAHOO.env.modules.animation) ? true : false;    
            this.setAttributeConfig('id', {
                writeOnce: true,
                validator: function (value) {
                    return (/^[a-zA-Z][\w0-9\-_.:]*$/.test(value));
                },
                value: YUD.generateId(),
                method: function (value) {
                    this.get('element').id = value;
                }
            });
            this.setAttributeConfig('width', {
                value: '400px',
                method: function (value) {
                    this.setStyle('width', value);
                    }
                }
            );
            this.setAttributeConfig('animationSpeed', {
                value: 0.7
                }
            );
            this.setAttributeConfig('animate', {
                value: bAnimate,
                validator: YAHOO.lang.isBoolean
                }
            );          
            this.setAttributeConfig('collapsible', {
                value: false,
                validator: YAHOO.lang.isBoolean
                }
            );
            this.setAttributeConfig('expandable', {
                value: false,
                validator: YAHOO.lang.isBoolean
                }
            );
            this.setAttributeConfig('effect', {
                value: YAHOO.util.Easing.easeBoth,
                validator: YAHOO.lang.isString

                }
            );
            this.setAttributeConfig('hoverActivated', {
                    value: false,
                    validator: YAHOO.lang.isBoolean,
                    method: function (value) {
                            if (value) {
                                    YUE.on(this, 'mouseover', this._onMouseOver, this, true);                        
                            } else {
                                    YUE.removeListener(this, 'mouseover', this._onMouseOver);
                            }        
                    }
            });
            this.setAttributeConfig('_hoverTimeout', {
                value: 500,
                validator: YAHOO.lang.isInteger
                }
            );
        },
        
        /**
        * The className to add when building from scratch. 
        * @property CLASSNAME
        * @default "yui-accordionview"
        * @type String
        */

        CLASSNAME : 'yui-accordionview',
        
        /**
        * Prefix to use for any other classnames
        * @property PREFIX
        * @default "yui-accordion-"
        * @type String
        */
        
        PREFIX : 'yui-accordion-',
        
        /**
        * Internal counter to make sure id's stay unique
        * @property _idCounter
        * @private
        * @type Integer
        */
        
        _idCounter : '1',
        
        /**
        * Holds the timer for hover activated accordions
        * @property _hoverTimer
        * @private
        */
        
        _hoverTimer : null,      

        /**
        * Holds references to all accordion panels (list elements) in an array
        * @property _panels
        * @private
        * @type Array
        */

        _panels : null,
        
        /**
        * Keeps track of whether a panel is currently in the process of opening.
        * Used to time when a full change is finished (open and close panel)
        * @property _opening
        * @private
        * @type Boolean
        */        
        
        _opening : false,
        
        /**
        * Keeps track of whether a panel is currently in the process of closing.
        * Used to time when a full change is finished (open and close panel)
        * @property _closing
        * @private
        * @type Boolean
        */        
        
        _closing : false,
                
        /**
        * Whether we're running FF2 or older (or another derivate of Gecko < 1.9)
        * @property _ff2
        * @private
        * @type Boolean
        */
        
        _ff2 : (YAHOO.env.ua.gecko > 0 && YAHOO.env.ua.gecko < 1.9),

        /**
        * Whether we're ARIA capable (currently only IE8 ad FF3)
        * @property _ARIACapable
        * @private
        * @type Boolean
        */
        
        _ARIACapable : (YAHOO.env.ua.ie > 7 || YAHOO.env.ua.gecko >= 1.9),
        
        /**
        * Initialize the list / accordion
        * @param {HTMLElement} el The element for the accordion
        * @param {Object} oAttr attributes key map
        * @method _initList
        * @private
        */

        _initList : function(el, oAttr) {  
            YUD.addClass(el, this.CLASSNAME);
            this._setARIA(el, 'role', 'tree');
            var aCollectedItems = [];
            var aListItems = el.getElementsByTagName('LI');

            for(var i=0;i<aListItems.length;i++) {           
                if(YUD.hasClass(aListItems[i], 'nopanel')) {         
                    aCollectedItems.push({label: 'SINGLE_LINK', content: aListItems[i].innerHTML.replace(/^\s\s*/, '').replace(/\s\s*$/, '')});
                }
                else {
                    if(aListItems[i].parentNode === el) {
                                for (var eHeader = aListItems[i].firstChild; eHeader && eHeader.nodeType != 1; eHeader = eHeader.nextSibling) {
                        // This loop looks for the first non-textNode element
                        }
                        if (eHeader) {
                            for (var eContent = eHeader.nextSibling; eContent && eContent .nodeType != 1; eContent = eContent .nextSibling) {
                            // here we go for the second non-textNode element, if there was a first one
                            }
                        aCollectedItems.push({label: eHeader.innerHTML, content: (eContent && eContent.innerHTML)});
                        }
                    }
                }
            }
            el.innerHTML = '';
            if(aCollectedItems.length > 0) {
                this.addPanels(aCollectedItems);
            }
            
            if((oAttr.expandItem === 0) || (oAttr.expandItem > 0)) {                                   
                var l = this._panels[oAttr.expandItem].firstChild;
                var c = this._panels[oAttr.expandItem].firstChild.nextSibling;
                YUD.removeClass(c, 'hidden');
                if(l && c) {
                    YUD.addClass(l, 'active');
                    l.tabIndex = 0;
                    this._setARIA(l, 'aria-expanded', 'true');
                    this._setARIA(c, 'aria-hidden', 'false');
                }
            }

            if(true === this.get('hoverActivated')) {
                    YUE.on(el, 'mouseover', this._onMouseOver, this, true);        
                    YUE.on(el, 'mouseout', this._onMouseOut, this, true);         
            }   
            this.on('click', this._onClick, this, true);
			
            this.on('keydown', this._onKeydown, this, true);
            this.on('panelOpen', function(){this._opening = true;}, this, true);
            this.on('panelClose', function(){this._closing = true;}, this, true);
            this.on('afterPanelClose', function(){
                this._closing = false;
                if(!this._closing && !this._opening) {
                    this._fixTabIndexes();
                }
            }, this, true);
            this.on('afterPanelOpen', function(){
                this._opening = false;
                if(!this._closing && !this._opening) {
                    this._fixTabIndexes();
                }
            }, this, true);
            
            /*
            This is needed when the hrefs are removed from links
            to be able to still hit enter to follow the link
            We only do this when we have ARIA support
            */
            
            if(this._ARIACapable) {
                this.on('keypress', function(ev){
                    var currentPanel = YUD.getAncestorByClassName(YUE.getTarget(ev), 'yui-accordion-panel');
                    var keyCode = YUE.getCharCode(ev);
					
                    if(keyCode === 13) {
                        this._onClick(currentPanel.firstChild);
						
                        return false;
                    }
                });
            }
        },
        
        /**
        * Wrapper around setAttribute to make sure we only set ARIA roles and states
        * in browsers that support it
        * @ethod _setARIA
        * @param {HTMLElement} el the element to set the attribute on
        * @param {String} sAttr the attribute name
        * @param {String} sValue the value for the attribute
        * @private
        */
        
        _setARIA : function(el, sAttr, sValue) {
            if(this._ARIACapable) {
                el.setAttribute(sAttr, sValue);
            }
        },
        
        /**
        * Closes all panels 
        * @method _collapseAccordion
        * @private
        */

        _collapseAccordion : function() {
            YUD.batch(this._panels, function(e) {
                var elContent = this.firstChild.nextSibling;
                if(elContent) { 
                    YUD.removeClass(e.firstChild, 'active');
                    YUD.addClass(elContent, 'hidden');
                    this._setARIA(elContent, 'aria-hidden', 'true');
                }
            }, this);
        },

        /**
        * Set tabIndex to 0 on the first item in case all panels are closed
        * @method _fixTabIndexes
        * @private
        */

        _fixTabIndexes : function() {
            var aLength = this._panels.length;
            var allClosed = true;
            for(var i=0;i<aLength;i++) {
                if(YUD.hasClass(this._panels[i].firstChild, 'active')) {
                    this._panels[i].firstChild.tabIndex = 0;
                    allClosed = false;
                }
                else {
                    this._panels[i].firstChild.tabIndex = -1;
                }
            }
            if(allClosed) {
                this._panels[0].firstChild.tabIndex = 0;
            }
            this.fireEvent('stateChanged');
        },

        /**
        * Adds an Accordion panel to the AccordionView instance.  
        * If no index is specified, the panel is added to the end of the tab list.
        * @method addPanel
        * @param {Object} oAttr A key map of the Panel's properties
        * @param {Integer} nIndex The position to add the tab. 
        */

        addPanel : function(oAttr, nIndex) {
            var oPanelParent = document.createElement('li');
            this._setARIA(oPanelParent, 'role', 'presentation');
            YUD.addClass(oPanelParent, this.PREFIX + 'panel');
            
            if(oAttr.label === 'SINGLE_LINK') {
                oPanelParent.innerHTML = oAttr.content;
                YUD.addClass(oPanelParent.firstChild, this.PREFIX + 'toggle');
                YUD.addClass(oPanelParent.firstChild, 'link');
            }
            else {
                var elIndicator = document.createElement('span');
                YUD.addClass(elIndicator, 'indicator');
                this._setARIA(elIndicator, 'role', 'presentation');
                var elPanelLink = oPanelParent.appendChild(document.createElement('a'));
                elPanelLink.id = this.get('element').id + '-' + this._idCounter + '-label';
                this._setARIA(elPanelLink, 'role', 'treeitem');
                elPanelLink.innerHTML = oAttr.label || '';
                elPanelLink.appendChild(elIndicator);
                if(this._ARIACapable) {
                    if(oAttr.href) {
                        elPanelLink.href = oAttr.href;
                    }
                }
                else {
                    elPanelLink.href = oAttr.href || '#toggle';    
                }
                
                elPanelLink.tabIndex = -1;
                YUD.addClass(elPanelLink, this.PREFIX + 'toggle');
                var elPanelContent = document.createElement('div');
                elPanelContent.innerHTML = oAttr.content || '';
                this._setARIA(elPanelContent, 'aria-labelledby', elPanelLink.id);
                YUD.addClass(elPanelContent, this.PREFIX + 'content');
                oPanelParent.appendChild(elPanelContent);
            }
            this._idCounter++;
            if(this._panels === null) {
                this._panels = [];
            }
            if((nIndex !== null) && (nIndex !== undefined)) {
                var panelBefore = this.getPanel(nIndex);
                this.insertBefore(oPanelParent, panelBefore);             
                var newPanels = this._panels.slice(0,nIndex);
                var newPanelsAfter = this._panels.slice(nIndex);
                newPanels.push(oPanelParent);
                for(i=0;i<newPanelsAfter.length;i++) {
                    newPanels.push(newPanelsAfter[i]);
                }
                this._panels = newPanels;
                
            }
            else {
                this.appendChild(oPanelParent);
                if(this.get('element') === oPanelParent.parentNode) {
                    this._panels[this._panels.length] = oPanelParent;
                }
            }
            if(oAttr.label !== 'SINGLE_LINK') {
                if(oAttr.expand) {
                    if(!this.get('expandable')) {
                        this._collapseAccordion();
                    }
                    YUD.removeClass(elPanelContent, 'hidden');
                    YUD.addClass(elPanelLink, 'active');
                    this._setARIA(elPanelContent, 'aria-hidden', 'false');
                    this._setARIA(elPanelLink, 'aria-expanded', 'true');
                }
                else {
                    YUD.addClass(elPanelContent, 'hidden');
                    this._setARIA(elPanelContent, 'aria-hidden', 'true');
                    this._setARIA(elPanelLink, 'aria-expanded', 'false');
                }
            }
            var t= YAHOO.lang.later(0, this, function(){this._fixTabIndexes();this.fireEvent('stateChanged');});
        },

        /**
        * Wrapper around addPanel to add multiple panels in one call
        * @method addPanels
        * @param {Array} oPanels array holding all individual panel configs
        */

        addPanels : function(oPanels) {
            for(var i=0;i<oPanels.length;i++) {
                this.addPanel(oPanels[i]);
            }
        },

        /**
        * Removes the specified Panel from the AccordionView.
        * @method removePanel
        * @param {Integer} index of the panel to be removed
        */

        removePanel : function(index) {
            this.removeChild(YUD.getElementsByClassName('yui-accordion-panel', 'li', this)[index]); 
            var newPanels = []; 
            for(var i=0;i<this._panels.length;i++) {
                if(i !== index) {
                    newPanels.push(this._panels[i]);
                }
            }
            this._panels = newPanels;
            var t= YAHOO.lang.later(0, this, function(){this._fixTabIndexes();this.fireEvent('stateChanged');});
        },

        /**
        * Returns the HTMLElement of the panel at the specified index.
        * @method getPanel
        * @param {Integer} nIndex The position of the Panel.
        * @return {HTMLElement} the requested panel element
        */

        getPanel : function(nIndex) {
            return this._panels[nIndex];
        },

        /**
        * Returns the Array containing all panels
        * @method getPanels
        * @return {Array} An array with references to the panels in the correct order
        */

        getPanels : function() {
            return this._panels;
        },

        /**
        * Open a panel
        * @method openPanel
        * @param {Integer} nIndex The position of the Panel.
        * @return {Boolean} whether action resulted in opening a panel
        * that was previously closed
        */

        openPanel : function(nIndex) {
			
            var ePanelNode = this._panels[nIndex];
            if(!ePanelNode) {return false;} // invalid node
            if(YUD.hasClass(ePanelNode.firstChild, 'active')) {return false;} // already open
          
		   this._onClick(ePanelNode.firstChild);
			
            return true;
        },


        /**
        * Close a panel
        * @method closePanel
        * @param {Integer} nIndex The position of the Panel.
        * @return {Boolean} whether action resulted in closing a panel or not
        * that was previously open
        *
        * This method honors all constraints imposed by the properties collapsible and expandable
        * and will return false if the panel can't be closed because of a constraint in addition
        * to if it was already closed
        *
        */

        closePanel : function(nIndex) {
            var aItems = this._panels;
            var ePanelNode = aItems[nIndex];
            if(!ePanelNode) {return false;} // invalid node
            var ePanelLink = ePanelNode.firstChild;
            if(!YUD.hasClass(ePanelLink, 'active')) {return true;} // already closed
            if(this.get('collapsible') === false) {
                if(this.get('expandable') === true) {
                    this.set('collapsible', true);
                    for(var i=0;i<aItems.length;i++) {
                        if((YUD.hasClass(aItems[i].firstChild, 'active') && i !== nIndex)) {
                            this._onClick(ePanelLink);
                            this.set('collapsible', false);            
                            return true;
                        }
                    }
                    this.set('collapsible', false);                
                }
            } // can't collapse
            this._onClick(ePanelLink);
            return true;
        },

        /**
        * Keyboard event handler for keyboard control of the widget
        * @method _onKeydown
        * @param {Event} ev The Dom event
        * @private
        */

        _onKeydown : function(ev) {
            var currentPanel = YUD.getAncestorByClassName(YUE.getTarget(ev), 'yui-accordion-panel');
            var keyCode = YUE.getCharCode(ev);
            if(keyCode === 37 || keyCode === 38) {
                for(i=0;i<this._panels.length;i++) {
                    if((currentPanel === this._panels[i]) && i>0) {
                        this._panels[i-1].firstChild.focus();
                        return;
                    } 
                }
            }
            if(keyCode === 39 || keyCode === 40) {
                for(i=0;i<this._panels.length;i++) {
                    if((currentPanel === this._panels[i]) && i<this._panels.length-1) {
                        this._panels[i+1].firstChild.focus();
                        return;
                    } 
                }
            }
        },

        /**
        * Mouseover event handler
        * @method _onMouseOver
        * @param {Event} ev The Dom event
        * @private
        */

        _onMouseOver : function(ev) {
            YUE.stopPropagation(ev);
            // must provide the TARGET or IE will destroy the event before we can
            // use it. Thanks Nicholas Zakas for pointing this out to me
            var target = YUE.getTarget(ev);
            this._hoverTimer = YAHOO.lang.later(this.get('_hoverTimeout'), this, function(){
                this._onClick(target);
             });
        },

        /**
        * Mouseout event handler
        * Cancels the timer set by AccordionView::_onMouseOver
        * @method _onMouseOut
        * @param {Event} ev The Dom event
        * @private
        */
        
        _onMouseOut : function() {
            if (this._hoverTimer) { 
                this._hoverTimer.cancel();
                this._hoverTimer = null;
            }
        },
        
        /**
        * Global event handler for mouse clicks
        * This method can accept both an event and a node so it can be called internally if needed
        * @method _onClick
        * @param {HTMLElement|Event} arg The Dom event or event target
        * @private
        */
		
		
		
        _onClick : function(arg) {
            var ev;
			
			
            if(arg.nodeType === undefined) {
				
                ev = YUE.getTarget(arg);
				
                if(!YUD.hasClass(ev, 'yui-accordion-toggle') && !YUD.hasClass(ev, 'indicator')) {
                    return false;
                }
                if(YUD.hasClass(ev, 'link')) {
                    
					return true;
                }
                YUE.preventDefault(arg);
                YUE.stopPropagation(arg);
            }
            else {
                ev = arg;
            }

            var elClickedNode = ev;
			
           
			
            /**
            *
            * helper function to fix IE problems with nested accordions
            * still looking for something better but for now this will have to do
            * @param {Object} el element to apply the fix to
            * @param {String} sHide whether to set visibility to hidden or visible
            *
            */

            function iehide(el, sHide) {
                if(YAHOO.env.ua.ie < 7 && YAHOO.env.ua.ie > 0) {
                    var aInnerAccordions = YUD.getElementsByClassName('yui-accordionview', 'ul', el);
                    if(aInnerAccordions[0]) {
                        YUD.setStyle(aInnerAccordions[0], 'visibility', sHide);
                    }
                }
            }

            /**
            *
            * Toggle an accordion panel
            * @param {Object} el element to toggle
            * @param {Object} elClicked the element that was clicked to toggle the corresponding panel
            *
            */

            function toggleItem(el, elClicked) { 
			
			
                var that = this;
                function fireEvent(type,panel) {
                    if (!YUD.hasClass(panel,'yui-accordion-panel')) {
                        panel = YUD.getAncestorByClassName(panel,'yui-accordion-panel');
                    }
                    for (var i = 0, p = panel; p.previousSibling; i++) {
                        p = p.previousSibling;
                    }
                    return that.fireEvent(type, {panel: panel, index: i});
                }
                      
                if(!elClicked) {
					
                    if(!el) {
						return false ;
					}
                    elClicked = el.parentNode.firstChild;
					
					
					//
					
                }
					onClickSwf(elClicked.id)
					//alert(elClicked.id)
				
				
				
                var oOptions = {};
                var bHideAfter = false;
                var nHeight = 0;
                var bIsHidden = YUD.hasClass(el, 'hidden');
                if(!YUD.hasClass(el, 'hidden')) {
                    bHideAfter = true;
                }

                if(this.get('animate')) {
                    if(YUD.hasClass(el, 'hidden')) {
                        // still a bit experimental. trying to eliminate mild flash sometimes seen in FF
                        if(this._ff2) {
                            YUD.addClass(el, 'almosthidden');
                            YUD.setStyle(el, 'width', this.get('width'));
                            }
                        YUD.removeClass(el, 'hidden');
                        nHeight = el.offsetHeight;
                        YUD.setStyle(el, 'height', 0);
                        if(this._ff2) {
                            YUD.removeClass(el, 'almosthidden');
                            YUD.setStyle(el, 'width', 'auto');
                            }
                        oOptions = {height: {from: 0, to: nHeight}};
                    }
                    else {
                        nHeight = el.offsetHeight;
                        oOptions = {height: {from: nHeight, to: 0}};
                    }
                    var nSpeed = (this.get('animationSpeed')) ? this.get('animationSpeed') : 0.5;
                    var sEffect = (this.get('effect')) ? this.get('effect') : YAHOO.util.Easing.easeBoth;
                    var oAnimator = new YUA(el, oOptions, nSpeed, sEffect);
                    if(bHideAfter) {
                        if (this.fireEvent('panelClose', el) === false) { return; }
                        YUD.removeClass(elClicked, 'active');
                        elClicked.tabIndex = -1;
                        iehide(el, 'hidden');
                        that._setARIA(el, 'aria-hidden', 'true');
                        that._setARIA(elClicked, 'aria-expanded', 'false');
                        oAnimator.onComplete.subscribe(function(){
                            YUD.addClass(el, 'hidden');
                            YUD.setStyle(el, 'height', 'auto');
                            fireEvent('afterPanelClose', el);
                        });
                    }
                    else {
                        if (fireEvent('panelOpen', el) === false) { return; }
                        //changed from visible to hidden so it doesn't show up behind the parent accordion until after the animation
                        iehide(el, 'hidden');
						//onClickSwf(elClicked.id)
                        oAnimator.onComplete.subscribe(function(){
                            YUD.setStyle(el, 'height', 'auto');
                            //Added to make the inner accordion visible again
                            iehide(el, 'visible');
                            that._setARIA(el, 'aria-hidden', 'false');
                            that._setARIA(elClicked, 'aria-expanded', 'true');
                            elClicked.tabIndex = 0;
							
							//onClickSwf(elClicked.id)
                            fireEvent('afterPanelOpen', el);
                        });                 
                        YUD.addClass(elClicked, 'active');
                    }
                    oAnimator.animate();
                }
                else {
                    if(bHideAfter) {
                        if (fireEvent('panelClose', el) === false) { return; }
                        YUD.addClass(el, 'hidden');
                        YUD.setStyle(el, 'height', 'auto');
                        YUD.removeClass(elClicked, 'active');
                        that._setARIA(el, 'aria-hidden', 'true');
                        that._setARIA(elClicked, 'aria-expanded', 'false');
                        elClicked.tabIndex = -1;
                        fireEvent('afterPanelClose', el);
                    }
                    else {
                        if (fireEvent('panelOpen', el) === false) { return; }
                        YUD.removeClass(el, 'hidden');
                        YUD.setStyle(el, 'height', 'auto');
                        YUD.addClass(elClicked, 'active');
                        that._setARIA(el, 'aria-hidden', 'false');
                        that._setARIA(elClicked, 'aria-expanded', 'true');
                        elClicked.tabIndex = 0;
                    }
                }
                return true;
            }
            var eTargetListNode = (elClickedNode.nodeName.toUpperCase() === 'SPAN') ? elClickedNode.parentNode.parentNode : elClickedNode.parentNode;

            var containedPanel = YUD.getElementsByClassName('yui-accordion-content', 'div', eTargetListNode)[0]; 
            if (this.fireEvent('beforeStateChange', this) === false) { return; }
            if(this.get('collapsible') === false) {
                if (!YUD.hasClass(containedPanel, 'hidden')) {
                    return false;
                }
            }
            else {
                if(!YUD.hasClass(containedPanel, 'hidden')) {
                    toggleItem.call(this, containedPanel);
                    return false;               
                }
            }
                    
            if(this.get('expandable') !== true) {
                for(var i=0; i<this._panels.length; i++) {
                    var bMustToggle = YUD.hasClass(this._panels[i].firstChild.nextSibling, 'hidden');
                    if(!bMustToggle) {
                        toggleItem.call(this,this._panels[i].firstChild.nextSibling);
                    }
                }
            }
            
            if(elClickedNode.nodeName.toUpperCase() === 'SPAN')  {
                toggleItem.call(this, containedPanel, elClickedNode.parentNode);
            }
            else {
                toggleItem.call(this, containedPanel, elClickedNode);
            }
            return true;
        },
        
        /**
        * Provides a readable name for the AccordionView instance.
        * @method toString
        * @return {String} String representation of the object 
        */
        toString : function() {
            var name = this.get('id') || this.get('tagName');
            return "AccordionView " + name; 
        }
    });    
})();
YAHOO.register("accordionview", YAHOO.widget.AccordionView, {version: "0.99", build: "31"});