
function ScrollHandler()
{this.element=null;this.origYPos=0;};ScrollHandler.prototype={getCssRuleName:function(name)
{name=name.split('-');for(var i=1;i<name.length;++i)
name[i]=name[i].charAt(0).toUpperCase()+name[i].substring(1);return name.join('');},getStyle:function(element,rule)
{if(document.defaultView&&document.defaultView.getComputedStyle)
return document.defaultView.getComputedStyle(element,'').getPropertyValue(rule);if(element.currentStyle)
return element.currentStyle[this.getCssRuleName(rule)];return null;},getOffsetTop:function(element)
{var result=0;var parent;parent=element;while(parent.offsetParent)
{result+=parent.offsetTop;parent=parent.offsetParent;}
parent=element;while(parent.parentNode)
{result-=parent.scrollTop;parent=parent.parentNode;}
return result;},initialise:function(element)
{if(typeof(element)!='object')
return false;this.element=element;this.origYPos=this.getOffsetTop(element)-75;if(this.getStyle(element,'position')!='relative')
this.element.style.position='absolute';return true;},keepVisible:function(interval)
{var parent=this;if(typeof window.onscroll!='undefined')
{window.onscroll=function()
{parent.setPosition()};}
else
{window.setInterval(function()
{parent.setPosition();},interval);}},setPosition:function()
{var scrollY=(typeof window.scrollY!='undefined')?window.scrollY:document.documentElement.scrollTop;if(scrollY>this.origYPos)
{var windowHeight=(typeof window.innerHeight!='undefined')?window.innerHeight:document.documentElement.clientHeight;if(this.element.offsetHeight<windowHeight)
this.element.style.top=scrollY+'px';}
else
this.element.style.top=this.origYPos+'px';}};