$(document).ready(function() { // wykonaj po załadowaniu strony

// Rotacja zdjęć
  var imagesRotationImage = 1;
  var imagesRotationAmount = 6;
  imagesRotationInterval = setInterval(function() { changeImageRotation() }, 7000);
  function changeImageRotation( id ) {
		$("#item"+imagesRotationImage).fadeOut("slow");
		$("a.item"+imagesRotationImage).removeClass("active");
		
		if( id ) {
			imagesRotationImage = id;
			clearInterval(imagesRotationInterval);
			imagesRotationInterval = setInterval(function() { changeImageRotation() }, 7000);
		} else {
			if( imagesRotationImage < imagesRotationAmount) {
        imagesRotationImage++;
			} else {
        imagesRotationImage = 1;
      }
		}
		
		$("#item"+imagesRotationImage).fadeIn("slow");
		$("a.item"+imagesRotationImage).addClass("active");
  }
  
  $('#navigator li a[title]').click(function(){
    changeImageRotation( $(this).attr('title') );
    return false;
  });

	$('#gototop').click(function(){
		$.scrollTo(0, 200, { easing:'swing' });
		return false;
	});
  
	$(".fancybox[rel=group], .fancybox, .lightbox, .lightbox[rel=group]").fancybox({
		'titleShow'     : false,
		'autoScale'     : false
		});
  $(".fancybox_iframe").fancybox({
  	'width'				: 710,
  	'height'			: 510,
    'autoScale'     	: false,
    'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
  });
} );

