function slideSwitch() {
    
	// zmiana obrazka
	var $active = $('#horizontal img.active');
    if ( $active.length == 0 ) $active = $('#horizontal img:last');

    var $next =  $active.next().length ? $active.next()
        : $('#horizontal img:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
    });
	
	// zmiana tekstu
	$('#leftGray div').hide();
	
	var $activeText = $('#leftGray div.active');
    if ( $activeText.length == 0 ) $activeText = $('#leftGray div:last');

    var $nextText =  $activeText.next().length ? $activeText.next() : $('#leftGray div:first');

    $activeText.addClass('last-active')
		.hide(function() 
		{
		$nextText.toggle()
        .addClass('active')
        .show(function() {
            $activeText.removeClass('active last-active');
    });
		});
	
	
	
    
	
	// $('#leftGray h2').fadeOut(400).fadeIn(600);
}
	

$(document).ready(function(){


	$("#slider").css("overflow","hidden");
	$("#content").css({
		left:1000
	});
	$("#search-pl").hide();
	$("#search-en").hide();

	$("#horizontal img").css({
		height:335,
		width:941,
		opacity:0,
		top:0 //167
	});
	
	$("#leftSlider").css({
		position:"relative",
		right:300
	});	
	

	jQuery(function($){ 
		var e = $('#content'); 
		 
		e.queue(function(){ 
		  setTimeout(function(){ 
			e.dequeue(); 
		  }, 200 ); 
		}); 
		e.animate({
			left:0},
			600, // tempo
			//'swing', // ease
			function(){ // callback
				
				$("#kurtyna").animate({
					height:0,
					top:335}, 600);
				
				$("#horizontal img:first").animate({
					height:335,
					width:941,
					opacity:1,
					top:0},600,function() {
					
					$("#search-pl").fadeIn(400);
					$("#search-en").fadeIn(400);
					if($("#leftSlider img").length) {
						// jesli jest obrazek - animuj po wczytaniu go
						var path = $("#leftSlider img").attr('src');
						$(".#leftSlider img").attr('src', path).load(function(){
							$("#leftSlider").animate({
								right:0},400
							);
						});
						
					} else {
									 
							// jesli nie ma obrazków w lewej animacji:
							$("#leftSlider").animate({
								right:0},400, function(){
									$(function() {
								setInterval( "slideSwitch()", 4000 );
							});
									$("#horizontal img").css({
										opacity:1,
										zindex:4
									});
									$("#horizontal img").css({
										position:'absolute',
										top:0,
										left:0,
										height:335
									});
								}
							);
							
							
							
			
							
							
							
							
											
							
					}
				
				});
				
				
				
				
		});  
	}); 
	
  
});
