function makeScrollable(wrapper, scrollable){


    
	// Get jQuery elements
	var wrapper = $(wrapper), scrollable = $(scrollable);
	
	// Hide images until they are not loaded
	scrollable.hide();
	var loading = $('<div class="loading">Loading...</div>').appendTo(wrapper);
	
	// Set function that will check if all images are loaded
	var interval = setInterval(function(){
		var images = scrollable.find('img');
		var completed = 0;
		
		// Counts number of images that are succesfully loaded
		images.each(function(){
			if (this.complete) completed++;	
		});
		
		if (completed == images.length){
			clearInterval(interval);
			// Timeout added to fix problem with Chrome
			setTimeout(function(){
				
				loading.hide();
				// Remove scrollbars	
				wrapper.css({overflow: 'hidden'});						
				
				scrollable.slideDown('slow', function(){
					enable();	
				});					
			}, 1000);	
		}
	}, 100);
	
	function enable(){
		// height of area at the top at bottom, that don't respond to mousemove
		var inactiveMargin = 99;					
		// Cache for performance
		var wrapperWidth = wrapper.width();
		var wrapperHeight = wrapper.height();
		// Using outer height to include padding too
		var scrollableHeight = scrollable.outerHeight() + 2*inactiveMargin;
		// Do not cache wrapperOffset, because it can change when user resizes window
		// We could use onresize event, but it's just not worth doing that 
		// var wrapperOffset = wrapper.offset();
		
	
		// Save menu titles
		scrollable.find('a').each(function(){				
			$(this).data('tooltipText', this.title);				
		});
		
		// Remove default tooltip
		scrollable.find('a').removeAttr('title');		
		// Remove default tooltip in IE
		scrollable.find('img').removeAttr('alt');	
		
		var lastTarget;
		//When user move mouse over menu			
		wrapper.mousemove(function(e){
			// Save target
			lastTarget = e.target;

			var wrapperOffset = wrapper.offset();
		
			// Scroll menu
			var top = (e.pageY -  wrapperOffset.top) * (scrollableHeight - wrapperHeight) / wrapperHeight - inactiveMargin;
			if (top < 0){
				top = 0;
			}			
			wrapper.scrollTop(top);
		});
		
	}
}
	
$(function(){	
	    makeScrollable("div#seznam_vyrobku", "ul.kosik");
        });
        
        
function ukaz(id){
document.getElementById(id).style.display='block';
}

function zmiz(id){
document.getElementById(id).style.display='none';
}

function plus(id){
document.getElementById(id).style.display='block';
}

function minus(id){
document.getElementById(id).style.display='block';
}

function barva_tam(id){
document.getElementById(id).style.color='#008000';
}

function barva_zpet(id){
document.getElementById(id).style.color='#000000';
}

function ukaz_top_menu(id){
document.getElementById(id).style.display='block';
}

function ukryj_top_menu(id){
document.getElementById(id).style.display='none';
}


$(document).ready(function(){

//Page Flip on hover

	$("#pageflip").hover(function() {
		$("#pageflip img , .msg_block").stop()
			.animate({
				width: '160px', 
				height: '160px'
			}, 500); 
		} , function() {
		$("#pageflip img").stop() 
			.animate({
				width: '140px', 
				height: '140px'
			}, 220);
		$(".msg_block").stop() 
			.animate({
				width: '140px', 
				height: '130px'
			}, 200);
	});

	
});


