

<!--

<!--
<!--
$(document).ready(function() {
/* galeria */
 $('body').append('<div id="galleryPopupWrapper">&nbsp;</div>'+
   '<div id="galleryPopup">'+
   '<div id="layerContent"><div class="content"><a title="zamknij" class="close" id="closeGalleryPopup" href="#close"><span style="display: block; width: 11px; height: 11px;">X</span></a>'+
   '<a href="#" class="prev left">poprzednie</a>'+
   '<div id="imgContainer"><img src="" alt="" width="323" height="323"/></div><a href="#" class="next right">następne</a>'+
   '<div id="txtContainer"><h2><span></span> <a href="#" class="goToProject" title="Przejdź do projektu">(przejdź do projektu)</a></h2>'+
   '<p></p>'+
   '<h3>Komentarze: <span id="commentsCount"></span></h3>'+
   //'<form>'+
   //'<textarea name="commentText"></textarea>'+
   //'<input type="submit" value="Dodaj komentarz"/>'+
   //'</form>'+
     '</div></div><div class="shadow"></div></div></div>');
 /* galeria popup */
 
 var currentImg = 0;
 var show = document.location.href.split("&show=")[1];
 var nextLink = $('.pagination li.selected').next().children().attr('href');
 var prevLink = $('.pagination li.selected').prev().children().attr('href');
 
 var imgsCount = $('#galleryList li.galleryItem').size();
 $('#galleryContainer').delegate('li.galleryItem a.openPopup', 'click', function(){
  var galleryItem = $(this).parent();
  currentImg = $('li.galleryItem').index(galleryItem);
  if( currentImg == 0 ) $('#galleryPopup').find('a.prev').addClass('paginatePrev').attr('href',prevLink+'&show=0');;
  if( currentImg == imgsCount-1 ) $('#galleryPopup').find('a.next').addClass('paginateNext').attr('href',nextLink+'&show=1');
  
  updateGalleryPopup( galleryItem );
  $('#galleryPopupWrapper').fadeIn('fast', function(){
   $('#galleryPopup').fadeIn('fast');
  });
  return false;
 });
 
 if (show == 1) {
 $('li.galleryItem:first a.openPopup').click(); 
}
 if (show == 0) {
 $('li.galleryItem:last a.openPopup').click();
}
 $('#galleryPopup').delegate('.next', 'click', function(){
  if( imgsCount-1 > currentImg ){
   cleanGalleryPopup();
   currentImg += 1;
   updateGalleryPopup(currentImg);
   if( currentImg == imgsCount-1 ) {$(this).addClass('paginateNext').attr('href',nextLink+'&show=1');}
   if( $(this).siblings('a.prev').hasClass('paginatePrev') ) $(this).siblings('a.prev').removeClass('paginatePrev').addClass('prev');
   return false;
  }
  if (typeof nextLink == 'undefined') {$(this).addClass('nextInactive'); return false};
 });
 $('#galleryPopup').delegate('.prev', 'click', function(){
  if( 0 < currentImg ){
   cleanGalleryPopup();
   currentImg -= 1;
   updateGalleryPopup(currentImg);
   if( currentImg == 0 ) {$(this).addClass('paginatePrev').attr('href',prevLink+'&show=0');}
   if( $(this).siblings('a.next').hasClass('paginateNext') ) $(this).siblings('a.next').removeClass('paginateNext').addClass('next');
   return false;
  }
 if (typeof prevLink == 'undefined') {$(this).addClass('prevInactive'); return false};
 });
 $('#galleryPopup').delegate('#closeGalleryPopup', 'click', function(){
  $('#galleryPopup').fadeOut('fast',function(){
   $('#galleryPopupWrapper').fadeOut('fast');
   cleanGalleryPopup();
  });
  return false;
 });
 
});
function updateGalleryPopup(newItem){
 var galleryItem =  typeof newItem == 'number' ? $('li.galleryItem').eq(newItem) : newItem;
 $('#galleryPopup h2 span').text(galleryItem.find('h2').text());
 //$('#galleryPopup h2 a').attr('href',galleryItem.find('a.openPopup').attr('href'));
 $('#imgContainer img').attr({src: galleryItem.find('a.openPopup').attr('rel'), alt: galleryItem.find('h2').text()});
 $('#txtContainer h2 a').attr({href: galleryItem.find('a.username').attr('rel')});
 $('#galleryPopup p').html( galleryItem.find('ul.itemMeta li:first').html() );
 $('#galleryPopup h2').after(galleryItem.find('a.rating').clone());
 $('#commentsCount').text( galleryItem.find('.count').text() );
}
function cleanGalleryPopup(){
 $('#galleryPopup h2 span').text('');
 //$('#galleryPopup h2 a').attr('href','#');
 $('#galleryPopup a.next').attr('href','#').removeClass('paginateNext').removeClass('nextInactive');
 $('#galleryPopup a.prev').attr('href','#').removeClass('paginatePrev').removeClass('prevInactive');
 $('#imgContainer img').attr({src: '', alt: ''});
 $('#txtContainer h2 a').attr({href: ''});
 $('#galleryPopup p').html( '' );
 $('#galleryPopup a.rating').remove();
 $('#commentsCount').text( '' );
}
//-->
//-->
//-->

