function getScrollTop() {
	return document.body.scrollTop || document.documentElement.scrollTop;
}

function getBrowserHeight() { 
	return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
}

function isOldIE() {
	var jscript/*@cc_on=@_jscript_version@*/;
	return jscript < 5.7;
}

function smoothScroll(position) {
	var speed = position / 5;
	point = parseInt(position - speed);
	scrollTo(0, point);
	
	if (point > 0) {
		setTimeout("smoothScroll(point)", 1);
	}
}

function fixedPosition() {
	name = arguments[0];
	margin = arguments[1];
	isBottom = arguments[2];
	
	if (isOldIE()) {
		absoluteScroll();
	} else {
		var obj = document.getElementById(name);
		
		if (isBottom) {
			obj.style.bottom = margin + "px";
		} else {
			obj.style.top = margin + "px";
		}
	}
}

function absoluteScroll() {
	var obj = document.getElementById(name);
	var scrollTop = getScrollTop();
	var browserHeight = getBrowserHeight();
	obj.style.position = "absolute";
	
	if (isBottom) {
		obj.style.top = scrollTop + browserHeight - obj.offsetHeight - margin + "px";
	} else {
		obj.style.top = scrollTop + margin + "px";
	}
	
	setTimeout("absoluteScroll(name, margin, isBottom)", 10);
}

function pageup() {
	smoothScroll(getScrollTop());
}

window.onload = function() {
	fixedPosition("page-up", 10, true);
}

