var bannersObject;
var bannersDestination;
var bannersAutoScroll;

function fuc_bannerPrepare() {
	if (document.getElementById("banners")) {
		bannersObject = document.getElementById("banners");
		bannersDestination = 0;
		setInterval("fuc_bannerScroll()", 50);
		bannersAutoScroll = setInterval("fuc_bannerAutoScroll()", 5000);
	}
}

function fuc_bannerMove(direction, clear) {
	if (clear) clearInterval(bannersAutoScroll);
	if (direction > 0) {
		bannersDestination -= 670;
		if (bannersDestination < -2680) {
			bannersDestination = 0;
		}
	} else {
		bannersDestination += 670;
		if (bannersDestination > 0) {
			bannersDestination = -2680;
		}
	}
}

function fuc_bannerScroll() {
	bannersCurrent = parseInt(bannersObject.style.left.substring(0, bannersObject.style.left.indexOf("px")));
	if (Math.abs(bannersCurrent - bannersDestination) > 5) {
		bannersCurrent += (bannersDestination - bannersCurrent) / 3;
	} else {
		bannersCurrent = bannersDestination;
	}
	bannersObject.style.left = bannersCurrent + "px";
}

function fuc_bannerAutoScroll() {
	fuc_bannerMove(1);
}