					Spry.Widget.SlidingPanels.prototype.attachBehaviors = function()
					{
						var ele = this.element;
						if (!ele)
							return;

						if (this.enableKeyboardNavigation)
						{
							var focusEle = null;
							var tabIndexAttr = ele.attributes.getNamedItem("tabindex");
							if (tabIndexAttr || ele.nodeName.toLowerCase() == "a")
								focusEle = ele;
						
							if (focusEle)
							{
								var self = this;
								Spry.Widget.SlidingPanels.addEventListener(focusEle, "focus", function(e) { return self.onFocus(e || window.event); }, false);
								Spry.Widget.SlidingPanels.addEventListener(focusEle, "blur", function(e) { return self.onBlur(e || window.event); }, false);
								Spry.Widget.SlidingPanels.addEventListener(focusEle, "keydown", function(e) { return self.onKeyDown(e || window.event); }, false);
							}
						}

						if (this.currentPanel)
						{
							// Temporarily turn off animation when showing the
							// initial panel.

							var ea = this.enableAnimation;
							this.enableAnimation = false;
							this.showPanel(this.currentPanel);
							this.enableAnimation = ea;
						}
						
						if (this.automatic){
							this.start();
						}
					};

					Spry.Widget.SlidingPanels.prototype.start = function(){
						var self = this; // reference to this, so we can use it inside our function
						this.automaticStarted = setInterval(function(){
								var panels = self.getContentPanels(),
									panelcount = panels.length,
									current = self.getCurrentPanel(),
									newpanel;
								
								// locate the current panel index, and check if we need to increase or decrease the panel
								for(var i = 0; i < panelcount; i++){
									if(panels[i] == current){
										
										// set the correct panel index based on the direction
										self.direction == 1 ? (i++) : (i--);
										
										// check if we want to do 1 2 3 2 1 .. looping instead of 1 2 3 1 2 3 ..
										if(self.backAndForth){
											if(self.direction == 1 && i >= (panelcount -1)){
												self.direction = 0;	// reset the direction
												i = panelcount;
											} else if(self.direction == 0 && i == 0) {
												self.direction = 1; // reset direction
												i = 0;
											}
										}					
										self.showPanel( self.direction == 1 ? (i >= panelcount ? 0 : i) : (i < 0 ? panelcount -1 : i));
										
										break; // stop looping, we already found and are displaying our new panel
									}
								}
						}, this.each || 3000);
					};

					Spry.Widget.SlidingPanels.prototype.showPreviousPanel = function()
					{
						var index = this.getContentPanelIndex(this.currentPanel) - 1;
						return this.showPanel(index < 0 ? this.getContentPanels().length -1 : index);
					};

					Spry.Widget.SlidingPanels.prototype.showNextPanel = function()
					{
						var index = this.getContentPanelIndex(this.currentPanel) + 1
						return this.showPanel(index >= this.getContentPanels().length ? 0 : index);
					};


					Spry.Widget.SlidingPanels.prototype.stop = function(){
						if(this.automaticStarted && typeof this.automaticStarted == 'number'){
							clearInterval(this.automaticStarted);
							this.automaticStarted = null;
						}
					};

					Spry.Widget.SlidingPanels.prototype.setDirection = function(direction){
						this.direction = direction;
					};
