		var num_items = 0;
		var page_container = null;
		var anim_running = false;
	
		function init()
		{
			
			// hide foooter
			$('end').d(false);
			
			// pokracujte
			$('pokracujte_klavesou').t('Pokračujte klávesou <span style="position: relative; top: 8px; left: 2px;"><img src="'+webroot+'img/btn.sipka-vpravo.png" width="21" height="20" alt="&rarr;" title=""></span>');
			//$('pokracujte_klavesou').pos(true).y( Math.floor( fry.ui.info.page.height/2 ) ).x( Math.floor( fry.ui.info.page.width-(fry.ui.info.page.width/3) ) );

			if ( 0 == fry.ui.info.page.width )
			{
				setTimeout('init()', 200);
				return;
			}
			
			// IE 7 and Gecko use document.documentElement for scrolling coordinates
			page_container = $__tune.isGecko || -1 != navigator.appVersion.indexOf('MSIE') ? document.documentElement : document.body;
			// parsing items
			var w = fry.ui.info.page.width;
			var h = fry.ui.info.page.height;
			$foreach ( $('items').g('div'), function(div)
			{
				if ( 'display_item' == div.n() )
				{
					var container = $().a($$()).pos(true).w(w).h(h).y(0).x(w*num_items++);
					var ix = Math.floor((w-div.w())/2);
					var iy = Math.floor((h-div.h())/2);
					//container.a(div).pos(true).x(ix).y(iy);
					container.a(div).pos(true).x(ix-15).y(0);
					//container.a(div).pos(true).y(0);
					
					// obsah
					div.w(w).h(h);
					var obsah = $(div).g('div:0');
					//obsah.s('border: 1px solid red')
					var iix = (w-780)/2;
					//console.debug(iix);
					if ( 'front' != div.i() ) obsah.pos(true).x(iix);
					
				}
			});
			
			// front
			//console.debug(h);
			$('front').h(h).w(w);
			
			
			// key listener
			var last_pressed = 0;
			$(document.documentElement).e('keyup', function(evt)
			{
				if ( anim_running || 200 > fry.ui.util.getMillis() - last_pressed )
				{
					return;
				}
				last_pressed = fry.ui.util.getMillis();
				if ( evt.KEY_ARR_RIGHT == evt.keyCode )
				{
					move_right();
				}
				else if ( evt.KEY_ARR_LEFT == evt.keyCode )
				{
					move_left();
				}
			})
		}
		
		function get_actual_item_index()
		{
			var x = page_container.scrollLeft;
			var page_width = fry.ui.info.page.width;
			var index = Math.floor((x + page_width/2 ) / page_width);
			return index;
		}
		
		function move_left()
		{
			var item_index = get_actual_item_index();
			if ( 0 < item_index )
			{
				var page_width = fry.ui.info.page.width;
				animate((item_index-1)*page_width);
			}
		}
		
		function move_right()
		{
			var item_index = get_actual_item_index();
			if ( num_items -1 > item_index )
			{
				var page_width = fry.ui.info.page.width;
				animate((item_index+1)*page_width);
			}
		}
		
		function animate(x)
		{
			anim_running = true;
			var start_x = page_container.scrollLeft;
			var num_steps = 10;
			var diff = x - start_x;
			$runinterval(1, num_steps, 50, function(step)
			{
				if ( num_steps == step )
				{
					page_container.scrollLeft = x;
					anim_running = false;
				}
				else
				{
					diff = Math.floor(diff / 2);
					page_container.scrollLeft += diff;
				}
			});
		}
