﻿// JScript File


jQuery.fn.mezooOneBigGallery = function() {
  return this.each(function(){
    $(this).parent().append('<div class="gallery-big-photo captioned-photo"><img /><span class="caption"></span></div>');
    $(this).find('.gallery-big-photo img')
        .css({cursor: 'pointer'})
        .click(function(event) {
            if ($(this).parent().parent().find('a.presented').parent().next().find('a').length > 0)
                $(this).parent().parent().find('a.presented').parent().next().find('a').trigger("click");
            else
                $(this).parent().parent().find('a:first').trigger("click");
        });
    $(this).find('ul a').click(function(event) {
        $(this).parent().parent().parent().find('ul a').removeClass('presented');
        $(this).addClass('presented');
        $('.gallery-big-photo img').attr({src: $(this).attr('href')});
//        console.log($('.gallery-big-photo .caption').length);
//        console.log($(this).find('img').attr('title'));
        $('.gallery-big-photo .caption').html($(this).find('img').attr('title'));
        event.preventDefault();  
    });
    $(this).find('a:first').trigger("click");
  });
};