(function ($) {
    $.fn.simpleLightbox = function (options) {

        var settings = {
            width: 500
        }
        $.extend(settings, options);

        // Set up wrapping div (the black background, the button, the holding div, etc)


        /*container.css({
        position: 'absolute',
        top: 0,
        left: 0,
        height: $(document).height(),
        width: $(document).width(),
        background: 'rgba(0,0,0,0.7)',
        'z-index': 999999
        });*/

        /*container.append('<div class="simpleLightboxContent">');
        var containerContent = container.children('.simpleLightboxContent');*/


        var lightbox = $('.lightbox');
        var open = lightbox.prev('a.simpleLightbox');
        var close = lightbox.find('.close');

        open.click(function (e) {
            e.preventDefault();
            lightbox.css({
                left: ($(window).width() / 2) - (500 / 2)
            });
            lightbox.fadeIn();
        });

        close.click(function (e) {
            e.preventDefault();
            lightbox.fadeOut();
        });


        return $(this).each(function () {



            //            var rand = Math.floor(Math.random() * 1000)
            //            $('body').append('<div class="simpleLightboxContainer' + rand + '"></div>'); var container = $('.simpleLightboxContainer' + rand);

            //            container.css({
            //                position: 'fixed',
            //                top: 50,
            //                left: ($(window).width() / 2) - (settings.width / 2),
            //                'margin-left': 'auto',
            //                'margin-right': 'auto',
            //                width: settings.width,
            //                height: 'auto',
            //                background: '#FFFFFF',
            //                padding: '10px',
            //                'padding-right': 40,
            //                border: '5px solid rgba(0,0,0,0.5)',
            //                'border-radius': '7px',
            //                'z-index': 999999
            //            });

            //            container.append('<a href="#" class="close">&times;</a>'); // Style to push to the right
            //            var close = $(container).find('.close');
            //            close.css({
            //                position: 'absolute',
            //                top: 0,
            //                right: 0,
            //                height: 40,
            //                width: 40,
            //                'text-align': 'center',
            //                background: '#FFFFFF',
            //                'text-decoration': 'none',
            //                'font-size': '36px'
            //            });

            //            var link = $(this); // Get the  link
            //            var content = $(link.attr('href')); // Get the relevant content div

            //            container.addClass('lightbox');

            //            content.hide(); // Hide all '.simpleLightboxes' on page load

            //            container.append(content.html());

            //            container.hide();

            //            link.click(function () {
            //                container.fadeIn();
            //            });

            //            close.click(function () {
            //                container.fadeOut();
            //            });

        });


    };
})(jQuery);
