/**
 * @author filip
 */
if (typeof(jQuery) != 'undefined') {
	
	
	/* stridani upoutavek na titulni strane - START */
	jQuery(document).ready(function () {
		var cycle_elements = new Array('#actionBeer', '#actionFood');
		jQuery(cycle_elements).each(function (i, elm) {
			if (jQuery(elm + ' ul li').length > 1) {
				jQuery(elm + ' ul').cycle({
					fx: 'fade',
					timeout:  5000
				});
			}
		});
	});
	/* stridani upoutavek na titulni strane - END */
	
	
	
	/* scrollovani aktualnich jidel/piti na titulu - START */
	jQuery(document).ready(function () {
		var scroller_elements = new Array('#scrollerBeer', '#scrollerFood');
		var timeout = 2000;
		jQuery(scroller_elements).each(function (i, elm) {
			window.setTimeout('scrollUnorderedList("' + elm + ' ul"' + ', ' + timeout + ')', timeout);
		})
	});
	/* scrollovani aktualnich jidel/piti na titulu - START */
	
	
	/* funkce pro scrolovani teckovaneho seznamu - START */
	function scrollUnorderedList(list_elm, timeout) {
		var item = jQuery(list_elm + ' li:first');
		item.slideUp('slow', function () {
			jQuery(this).insertAfter(jQuery(this).parent().children('li:last'));
			jQuery(this).parent().children('li:last').slideDown('slow');
		});
		
		window.setTimeout('scrollUnorderedList("' + list_elm + '"' + ', ' + timeout + ')', timeout);
	}
	/* funkce pro scrolovani teckovaneho seznamu - END */
	
}