﻿// JScript File


jQuery.fn.mezooOneBigGallery = function() {
  return this.each(function(){
    $(this).prepend('<div class="big-picture"><img /><span></span></div>');
    $(this).find('.big-picture 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');
        $(this).parent().parent().parent().find('.big-picture img').attr({src: $(this).attr('href')});
        $(this).parent().parent().parent().find('.big-picture span').html($(this).find('img').attr('alt'));
        event.preventDefault();  
    });
    $(this).find('a:first').trigger("click");
  });
};