var slideTime = 1000, topMargin;

var myWidth = 0, myHeight = 0;

window.onload = function(){
	set1kFloater();
	set1kFloater();
}

window.onResize = function(){
	set1kFloater();
	set1kFloater();
}


function set1kFloater()
{
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}

  topMargin = myHeight / 2;
  winOnResize(); // set initial position
  xAddEventListener(window, 'resize', winOnResize, false);
  xAddEventListener(window, 'scroll', winOnScroll, false);
  return;
}
function winOnResize() {
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}

  xMoveTo('floater', myWidth - 30, topMargin);
  xShow('floater');
  winOnScroll(); // initial slide
}
function winOnScroll() {
  xSlideTo('floater', xLeft('floater'), xScrollTop() + topMargin, slideTime);
}
document.write("<div id='floater' style='position:absolute;	visibility:hidden; width:30px; height:auto; color:#330; margin:0;'><a href='#top'><img src='images/top.bmp' alt='top' width='20' height='21' border='0'></a></div>");