/* Template Philoxenia - Is Open Source */
var goto_top_type = -1;
var goto_top_itv = 0;

function xenia_timer() {
	var xeniay = goto_top_type == 1 ? document.documentElement.scrollTop : document.body.scrollTop;
	var xeniamoveby = 15;
	xeniay -= Math.ceil(xeniay * xeniamoveby / 100);
	if (xeniay < 0) { xeniay = 0; }
	if (goto_top_type == 1) {
		document.documentElement.scrollTop = xeniay;
	} else {
		document.body.scrollTop = xeniay;
	}
	if (xeniay == 0) {
		clearInterval(goto_top_itv);
		goto_top_itv = 0;
	}
}

function xenia_gotop() {
	if (goto_top_itv == 0) {
		if (document.documentElement && document.documentElement.scrollTop) {
			goto_top_type = 1;
		} else if (document.body && document.body.scrollTop) {
			goto_top_type = 2;
		} else {
			goto_top_type = 0;
		}
		if (goto_top_type > 0) { goto_top_itv = setInterval('xenia_timer()', 25); }
	}
}
