function doOnScroll(){
	var scr = document.getElementById('scroller');
	var bot = document.getElementById('scrollerbot');
	var top = document.getElementById('scrollertop');
	var scrollTop = (navigator.userAgent.toLowerCase( ).indexOf('safari' ) != -1)?document.body.scrollTop:document.documentElement.scrollTop;

	if (bot.offsetTop < (top.offsetTop + scrollTop + scr.scrollHeight)){
		if (scr.style.position != 'absolute'){
			scr.style.top=(bot.offsetTop-scr.scrollHeight)+'px';
			scr.style.position='absolute';
		}
	}
	else{
		if (navigator.userAgent.toLowerCase( ).indexOf('ie 6' ) == -1){
			if (scr.style.position == 'absolute'){
				scr.style.position='fixed';
				scr.style.top='auto';
			}
		}
		else{
			scr.style.top=(top.offsetTop+scrollTop)+'px';
			scr.style.position='absolute';
		}
	}
}

window.onscroll = doOnScroll;
