/**
				*Helper object for keeping context data for each scrolling pane
				*The object has to have relative positioning 
				*@param id - the html dom id of the element to scroll 
				*/
				var Scrollable = function(id, height){
					this.id = id;
					//calculate offset
					this.offset = dojo.byId(id).offsetTop;				
					this.height = height;					
					this.isScrolling = false;
				} 
				
				var registeredPanes = new Array();
				var scrollingStarted = false;
				function registerScrollingPane(id, height){
					registeredPanes.push(new Scrollable(id, height));
					if(!scrollingStarted){
						dojo.connect(window, "onscroll", this, scrollAfter);
						scrollingStarted = true;
					}
				}
				var scrollers = new Array();
				function isScrolling(){
					return scrollers.length > 0 ? true : false;
				}
				
				function pushScroller(){
					scrollers.push();
				}
				
				function popScroller(){
					scrollers.pop();
				}
				
				function getClientHeight(){
					// summary: returns a viewport size (visible part of the window)
				
					// FIXME: need more docs!!
					var d = dojo.doc, dd = d.documentElement, w = window, b = dojo.body();
					if(dojo.isMozilla){
						return w.innerHeight;	// Object
					}else if(!dojo.isOpera && w.innerWidth){
						return w.innerHeight;		// Object
					}else if (!dojo.isOpera && dd && dd.clientWidth){
						return dd.clientHeight;	// Object
					}else if (b.clientWidth){
						return b.clientHeight;	// Object
					}
					return null;	// Object
				};
				
				function scrollAfter(){
					if(isScrolling())
						return;
					
					for(a in registeredPanes){
						//get the amount of scrolled space
						var fromTop = dojo._docScroll().y;
						var top = parseInt(dojo.byId(registeredPanes[a].id).style.top);
						if(isNaN(top)){
							top=0;
						}
						var offset = registeredPanes[a].offset + top; 
						
						//only scroll if the pane is out of the screen at the top
						if(fromTop > offset){
							
							pushScroller();
							var scrollAmount = fromTop - offset + 10;	
							
							var offset = registeredPanes[a].offset - fromTop;
							//alert("scroll " + offset);
							
							
							dojox.fx.slideBy({ 
								node: dojo.byId(registeredPanes[a].id), 
								duration:400, 
								top: scrollAmount,
								left: 0,
								easing: dojox.fx.easing.easeIn,
								onEnd:function(){
									popScroller();
								}
							}).play();
						}else if(offset + registeredPanes[a].height > fromTop + getClientHeight() && top > 0){
							
							pushScroller();
							var scrollAmount = offset + registeredPanes[a].height - (fromTop + getClientHeight());
							if(top - scrollAmount < 0){
								scrollAmount = top;
							}
							
							dojox.fx.slideBy({ 
								node: dojo.byId(registeredPanes[a].id), 
								duration:400, 
								top: scrollAmount*-1,
								left: 0,
								easing: dojox.fx.easing.easeIn,
								onEnd:function(){
									popScroller();
								}
							}).play();
						}
						/*else{
							alert(offset +"," + registeredPanes[a].height)
							alert(fromTop +","+ getClientHeight())
						}*/
						
						
						
						//dojo.query("#"+registeredPanes[a].id).style("top", "100px");
					}
				}