$(document).ready(function() {
  
  if ($('.b-num').length) {
    $('.b-num li').each(function(index) {
      $(this).prepend('<span>' + (index + 1) + '</span>');
    });   
  };
  
  if ($('dl.b-faq').length) {
    $('dl.b-faq dd').hide();
    $('dl.b-faq').each(function() {
      $(this).find('dt').each(function(index) {
        $(this)
          .wrapInner('<span></span>')
          .prepend((index + 1) + '. ');
      });
    });
    $('dl.b-faq dt span').click(function() {
      $(this)
        .parent()
        .next()
        .slideToggle('fast');
    });
  };
  
  if ($('.b-gallery').length) {
    
    if ($('.b-gallery .caption').length) {
      $('.b-gallery .caption').each(function() {
        $(this).parents('div:first').find('a').attr('title', $(this).html());
      });
    }
    
    $('.b-gallery ul').each(function() {
      $(this).find('a').lightBox({
        imageBlank: 'img/lightbox/blank.gif',
        imageLoading: 'img/lightbox/loading.gif',
        imageBtnPrev: 'img/lightbox/prev.gif',
        imageBtnNext: 'img/lightbox/next.gif',
      	imageBtnClose: 'img/lightbox/close.gif',
      	containerResizeSpeed: 350,
      	txtImage: 'Фотография',
      	txtOf: 'из'
      });
    });
    
  };
  
});
