	$(document).ready( 
	function(){

	Cufon.replace('#texts_move h1', {fontSize: '21px'});
	Cufon.replace('#info h2', {fontSize: '21px', color:'#383838',textShadow:"1px 1px #f1f1f1"});
  
  var flashvars = {};
  var params = {wmode:"transparent"};
  var attributes = {};
  
  swfobject.embedSWF("/img/kometa.swf", "kometa", "367", "231", "9.0.0","/img/expressInstall.swf",flashvars,params,attributes);

	//Zaznaczanie strony prezentacji
	$("#show_pages a").mouseenter(function(){
			$(this).stop().animate({backgroundPosition: '0 -29px'}, 300);
	}).mouseleave(function(){
				if($(this).attr("class")!="akt"){
					$(this).stop().animate({backgroundPosition: '0 0'}, 300);
				}
	}).click(function(){
		ktory=$("#show_pages a").index(this);
		przewin("do");
	})

	//inicjalizacja przesuwania slajdow
	var ktory = 0;
	$("#texts_move").css({'width': $("#texts_move div").length*475 });
	$("#pictures_ruch").css({'width': $("#pictures_ruch div").length*367 });

	przewin = function(akcja){
	
		if(akcja=="wlewo"){
				--ktory;
				if(ktory<0){
						ktory=$("#texts_move div").length-1;
						$("#pictures").css({'opacity':'1'}).animate({'opacity':'0.3'},150).animate({'opacity':'0.3'},200).animate({'opacity':'1'},150);
						$("#texts").css({'opacity':'1'}).animate({'opacity':'0.3'},150).animate({'opacity':'0.3'},200).animate({'opacity':'1'},150);
				}
				$("#texts_move").animate({'left':-475*(ktory)},500);
				$("#pictures_ruch").animate({'left':-367*(ktory)},500);
		}
		
		if(akcja=="wprawo"){
				++ktory;
				if(ktory>=$("#texts_move div").length){
						ktory=0;
						$("#pictures").css({'opacity':'1'}).animate({'opacity':'0.3'},150).animate({'opacity':'0.3'},200).animate({'opacity':'1'},150);
						$("#texts").css({'opacity':'1'}).animate({'opacity':'0.3'},150).animate({'opacity':'0.3'},200).animate({'opacity':'1'},150);
				}
				$("#texts_move").animate({'left':-475*(ktory)},500);
				$("#pictures_ruch").animate({'left':-367*(ktory)},500);
		}
		
		if(akcja=="do"){
				$("#texts_move").animate({'left':-475*(ktory)},500);
				$("#pictures_ruch").animate({'left':-367*(ktory)},500);
		}
		
		//zaznaczanie aktywneg na panelu
		$("#show_pages a.akt").animate({backgroundPosition: '0 0'}, 400).removeClass("akt");
		$("#show_pages a").eq(ktory).animate({backgroundPosition: '0 -29px'}, 400).addClass("akt");

	}


	$("#show_right").click(function(){
		przewin("wprawo");
	})

	$('html').keydown(function(event) {
  if (event.keyCode == '39') {przewin("wprawo");}
	})
	
	
	$("#show_left").click(function(){
		przewin("wlewo");
	})

	$('html').keydown(function(event) {
  if (event.keyCode == '37') {przewin("wlewo");}
	})





	$(".wiecej").click(function(){
  //$(this).prev('.ukryte').slideToggle();
  $(this).prev('.ukryte').toggle();

		if( $(this).html()=='zamknij'){
        $(this).html('czytaj więcej');
    } else {
        $(this).html('zamknij');
    }

	})


















	
	})
