document.write ('<div class="topRightScrolling" id="divStayTopRight">');
document.write ('<a href="#top"><img name="top_link" src="' + img_root + 'images/go_to_top.gif" onmouseover="image_changer(\'top_link\',\'go_to_top_highlight.gif\')" onmouseout="image_changer(\'top_link\',\'go_to_top.gif\')"/></a>');
//document.write ('<a href="#top" class="underline">Go To Top</a>');
document.write ('</div>');

function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;		
		} 
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;		
		} 
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;		
  		}
	return [scrOfX, scrOfY];
	}

function getWindowWidth() {
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
    		}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
  		}
	return myWidth;
	}


function FloatTopRight() {
	var startY = -20;	
	var offsetX = 81;
	var d = document;	
	function ml(id)
	{		
		var el= d.getElementById ? d.getElementById(id) : d.all ? d.all[id] : d.layers[id];	
		if (d.layers) el.style=el;	
		el.setPos= function(x, y) {				
				this.style.top=y+"px";				
				this.style.left=x+"px";
				};		
		var arr = getScrollXY();
		el.x = 	getWindowWidth() - offsetX;			
		el.y = arr[1];
		el.y -= startY;					
		return el;	
		
	}
	var c=0; 
	var c1=0;
	var prevScroll=0;
	var prevWindowInnerWidth = 0;
	window.stayTopRight=function()	
	{			
		var arr = getScrollXY();		
		var pX = arr[0];
		var pY = arr[1];
		var winWidth = getWindowWidth();		
		if (prevWindowInnerWidth != winWidth) {
			fblObj.x += winWidth - prevWindowInnerWidth;
			}
		if (pX > prevScroll) {	
			fblObj.x += pX - prevScroll;
			}
		else if (pX < prevScroll) {
			fblObj.x -= prevScroll - pX;
			}
		else if (pX==0) {
			fblObj.x = winWidth - offsetX;
			}
		prevScroll = pX;
		prevWindowInnerWidth = winWidth;		
		fblObj.y += (pY - startY - fblObj.y) / 8;
		if (pY <= 10) {							
			fblObj.setPos(fblObj.x, fblObj.y);			
			setTimeout("stayTopRight()", 40);						
			}
		else {	
			fblObj.setPos(fblObj.x, fblObj.y);			
			setTimeout("stayTopRight()", 40);			
			}
	}
	fblObj = ml("divStayTopRight");	
	window.stayTopRight();	
}
FloatTopRight();
