

  
  
$(function() {
  $('#piclist').click(function(){
   $('#menuhiv').animate({top:'0%'},{queue:false,duration:300});
   $('#piclist').animate({opacity:'0.0'},300);
  });
 });
 
 
 
 $(function() {
  $('#menu-le').click(function(){
   $('#menuhiv').animate({top:'100%'},{queue:false,duration:300});
   $('#piclist').animate({opacity:'1.0'},300);
  });
 });
 
 

 
 $(function() {
  $('#menu-ki').hover(function(){
   $('#menu').animate({left:'0px'},{queue:false,duration:300});
  });
  $('#menu').mouseleave(function(){
   $('#menu').animate({left:'-80px'},{queue:false,duration:300});
  });
 });
 
 
 
 
  $(function() {
  $('#write').hover(function(){
   $('#primary').animate({right:'-70px'},{queue:false,duration:300});
  });
  $('#primary').mouseleave(function(){
   $('#primary').animate({right:'-400px'},{queue:false,duration:300});
  });
 });
 
 
 
  
$(function() {
  $('.menu-al').hover(function(){
   $(this).find('.menu-al-ala').animate({opacity:'1.0'},{queue:false,duration:100});
   $(this).find('.menu-al-ala').css({background:'#ffffff'});
   $(this).find('.menu-al-leir').animate({left:'80px'},{queue:false,duration:300});
   $(this).find('img').animate({marginLeft:'30px'},{queue:false,duration:300});
   $(this).find('.fek').css({display:'block'},{queue:false,duration:300});
   $(this).find('.feh').css({display:'none'},{queue:false,duration:300});
  }, function(){
	$(this).find('.menu-al-ala').animate({opacity:'1.0'},{queue:false,duration:300});  
	$(this).find('.menu-al-ala').css({background:'#141414'});
    $(this).find('.menu-al-leir').animate({left:'-140px'},{queue:false,duration:300});
	$(this).find('img').animate({marginLeft:'20px'},{queue:false,duration:300});
	$(this).find('.fek').css({display:'none'},{queue:false,duration:300});
   $(this).find('.feh').css({display:'block'},{queue:false,duration:300});
  });
 });
  
  

$(function() {
  $('#sub-content-2 a').hover(function(){
   $(this).find('.cim').animate({bottom:'0px'},{queue:false,duration:300});
   $(this).find('.alatet').animate({top:'0px'},100);
  }, function(){
    $(this).find('.cim').animate({bottom:'-40px'},{queue:false,duration:300});
	$(this).find('.alatet').animate({top:'30px'},300);
  });
 });
 
 
 
 
 
 
 
 
$(function() {
  $('#prev').hover(function(){
   $(this).animate({opacity:'1.0'},{queue:false,duration:300});
  }, function(){
	$(this).animate({opacity:'0.6'},{queue:false,duration:300});
  });
 }); 
 
 
 
 $(function() {
  $('#menu-le').hover(function(){
   $(this).animate({opacity:'1.0'},{queue:false,duration:300});
  }, function(){
	$(this).animate({opacity:'0.6'},{queue:false,duration:300});
  });
 }); 
 
 
 
 
 $(function() {
  $('#next').hover(function(){
   $(this).animate({opacity:'1.0'},{queue:false,duration:300});
  }, function(){
	$(this).animate({opacity:'0.6'},{queue:false,duration:300});
  });
 }); 
 
 
  
  
  
  
  
  
  $(function() {
  $('li a').hover(function(){
   $(this).find('.logo').animate({opacity:'0.0'},{queue:false,duration:1});
   $(this).find('.cimkep').animate({opacity:'1.0'},{queue:false,duration:500});
   $(this).find('.logo-f').animate({opacity:'0.9'},{queue:false,duration:1});
   $(this).find('.sh-ver').animate({opacity:'1.0'},{queue:false,duration:100});
   $(this).find('.sh-hor').animate({opacity:'1.0'},{queue:false,duration:100});
  }, function(){
	$(this).find('.logo').animate({opacity:'1.0'},{queue:false,duration:1});
	$(this).find('.cimkep').animate({opacity:'0.0'},{queue:false,duration:500});
	$(this).find('.logo-f').animate({opacity:'0.0'},{queue:false,duration:1});
	$(this).find('.sh-ver').animate({opacity:'0.0'},{queue:false,duration:100});
   $(this).find('.sh-hor').animate({opacity:'0.0'},{queue:false,duration:100});
  });
 });
  
  
  
  
  
  $('#menuhiv').css({top:'100%'});
  
   $('.cim').animate({bottom:'-40px'});
  


  
  
function makeScrollable(wrapper, scrollable){
	// Get jQuery elements
	var wrapper = $(wrapper), scrollable = $(scrollable);
	
	// Hide images until they are not loaded
	scrollable.hide();
	var loading = $('<span class="loading"></span>').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();	
				});					
			}, 500);	
		}
	}, 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();
		
		// Create a invisible tooltip
		var tooltip = $('<span class="sc_menu_tooltip"></span>')
			.css('opacity', 0)
			.appendTo(wrapper);
	
		// 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();
		
			var tooltipLeft = e.pageX - wrapperOffset.left;
			// Do not let tooltip to move out of menu.
			// Because overflow is set to hidden, we will not be able too see it 
			tooltipLeft = Math.min(tooltipLeft, wrapperWidth - 75); //tooltip.outerWidth());
			
			var tooltipTop = e.pageY - wrapperOffset.top + wrapper.scrollTop() - 40;
			// Move tooltip under the mouse when we are in the higher part of the menu
			if (e.pageY - wrapperOffset.top < wrapperHeight/2){
				tooltipTop += 80;
			}				
			tooltip.css({top: tooltipTop, left: tooltipLeft});				
			
			// Scroll menu
			var top = (e.pageY -  wrapperOffset.top) * (scrollableHeight - wrapperHeight) / wrapperHeight - inactiveMargin;
			if (top < 0){
				top = 0;
			}			
			wrapper.scrollTop(top);
		});
		
		// Setting interval helps solving perfomance problems in IE
		var interval = setInterval(function(){
			if (!lastTarget) return;	
										
			var currentText = tooltip.text();
			
			if (lastTarget.nodeName == 'IMG'){					
				// We've attached data to a link, not image
				var newText = $(lastTarget).parent().data('tooltipText');

				// Show tooltip with the new text
				if (currentText != newText) {
					tooltip
						.stop(true)
						.css('opacity', 0)	
						.text(newText)
						.animate({opacity: 1}, 1000);
				}					
			}
		}, 200);
		
		// Hide tooltip when leaving menu
		wrapper.mouseleave(function(){
			lastTarget = false;
			tooltip.stop(true).css('opacity', 0).text('');
		});			
		
		/*
		//Usage of hover event resulted in performance problems
		scrollable.find('a').hover(function(){
			tooltip
				.stop()
				.css('opacity', 0)
				.text($(this).data('tooltipText'))
				.animate({opacity: 1}, 1000);
	
		}, function(){
			tooltip
				.stop()
				.animate({opacity: 0}, 300);
		});
		*/			
	}
}
	
$(function(){	
	makeScrollable(".sc_menu_wrapper", ".sc_menu");
});


















