
$(document).ready(function() {

	//Sifr - strona glowna, newsy
	$('#content_container_main h2.sifr, #content_container_main h3.sifr, .content h3.sifr').sifr({
	font: '/theme/js/MyriadProRegular',
		color: '#000'
	});
	
	//Sifr - podstrony
	$('.content h2.sifr').sifr({
	font: '/theme/js/MyriadProRegular',
		color: '#686868'
});

// do zrobienia automatyczne przewijanie

/*   var ilosc = $('#gallery_images li').length;
	var liczba;
	liczba = 0;
	$('#gallery_images li').hide();
	$('#gallery_images li:eq(0)').show();
    $.timer(4000, function (timer) {
        if (liczba >= ilosc-3) {liczba = 0} else {liczba ++;}
         $('#gallery_images li:visible').slideUp('normal',function () {
         if (koniec < ilosc) {
            $('#gallery_images a.prev').removeClass("prev_disabled");
            $("#gallery_images_list li").hide();
            start = start + na_stronie;
            koniec = start + na_stronie;
            $("#gallery_images_list li").slice(start, koniec).fadeIn("slow");
            if (koniec >= ilosc) {
               $(this).addClass("next_disabled");
            }
         };
         return false;
      });
	});*/
   
   /* GALERIA */
	// Pokazywanie, ukrywanie calej galerii
	var wysokosc = $("#gallery_images_list li").height();
	var wysokosc_outer = $("#gallery_images_list li").outerHeight({margin:true});
	var ilosc = $("#gallery_images_list li").length;
	var na_stronie = 3;
	var ilosc_li = Math.ceil(ilosc / na_stronie);
	var start = 0;
	var koniec = na_stronie;
	var wysokosc_new = ilosc_li * wysokosc_outer;
	if ( ilosc <= na_stronie ) {
		$("#gallery_images").addClass("no_buttons");
		$('a#all_gallery_switcher').hide();
	}
	$('a#all_gallery_switcher').toggle(
		function () {
		    $(this).children("em").css("display","inline");
		    $(this).children("span").css("display","none");
			$("#gallery_images_list li").show();
			$("#gallery_images_list").height(wysokosc_new);
			$("#gallery_images").addClass("no_buttons");
		},
		function () {
		    $(this).children("span").css("display","inline");
		    $(this).children("em").css("display","none");
			$("#gallery_images_list li").hide();
			$("#gallery_images_list li").slice(start, koniec).show();
			$("#gallery_images_list").height(wysokosc);
			$("#gallery_images").removeClass("no_buttons");
		}
	);
	
	// Nastepna porcja zdjec
	$('#gallery_images a.next').click(function(){
		if (koniec < ilosc) {
			$('#gallery_images a.prev').removeClass("prev_disabled");
			$("#gallery_images_list li").hide();
			start = start + na_stronie;
			koniec = start + na_stronie;
			$("#gallery_images_list li").slice(start, koniec).fadeIn("slow");
			if (koniec >= ilosc) {
				$(this).addClass("next_disabled");
			}
		};
		return false;
	});
	
	// Poprzednia porcja zdjec
	$('#gallery_images a.prev').click(function(){
		if (start > 0) {
			$('#gallery_images a.next').removeClass("next_disabled");
			$("#gallery_images_list li").hide();
			start = start - na_stronie;
			koniec = koniec - na_stronie;
			$("#gallery_images_list li").slice(start, koniec).fadeIn("slow");
			if (start == 0) {
				$(this).addClass("prev_disabled");
			}
		};
		return false;
	});
	
	// Wyrzucanie akcji z poprzedni i nastepny
	$('#gallery_images a.prev_disabled, #gallery_images a.next_disabled').click(function(){
		return false;
	});

	
});