/*
// до тук беше красивия код. сега трябва да го осера..
window.cx = {
	l: function(x, y, z, t) {
		if (!cx.moving&&parseInt($(x).style.left||0) < 0) {
			cx.moving = true;
			new Effect.Move(x, {
				x: y,
				duration: z||0.66,
				afterFinishInternal: function() { cx.moving = false; }
			});
		}
	},
	r: function(x, y, z, t) {
		if (!cx.moving&&($(x).select('li').length-(t||3))*y+parseInt($(x).style.left||0)) {
			cx.moving = true;
			new Effect.Move(x, {
				x: -y,
				duration: z||0.66,
				afterFinishInternal: function() { cx.moving = false; }
			});
		}
	}
}
*/

Event.observe(window, 'load', function() {
	var container = $('x'),
		children = container.getElementsByTagName('li'),
		count = children.length,
		loop = true,
		x = 0,
		w = 0;

	container.observe('mouseout', function() { loop = true; });
	container.observe('mouseover', function() { loop = false; });
	container.style.position = 'absolute';

	for (x = 0; x < count; ++x) {
		container.appendChild(children[x].cloneNode(true));
		w += children[x].offsetWidth;
	}

	x = 0;
	setInterval(function() {
		var y = false;

		if (loop) {
			if (-x >= w) {
				x = 0;
			}

			container.style.left = x + 'px';
			x -= 1;
		}
	}, 50);
});
