﻿/// <reference path="jquery-1.4.1.min-vsdoc.js" />

$.fn.thumbnail = function(options) {
    //global
    var loader = $(this);
    var url = loader.attr("href") + " #imagecontainer a";
    var container = $('<div class="image_thumbnails">&nbsp;</div>');
    var lbselector = ".lightbox_selector";
    container.load(url).ajaxStop(function() {
        $(this).children("a").each(function() {
            $(this).addClass(lbselector.replace(".", ""));
        });
        $('<div class="clear">&nbsp;</div>').appendTo(container);
        loader.replaceWith($(this));
        $(lbselector).lightBox();
    });

    return this;
};


//image copy
function imagecopy() {
    var table = $('<table style="width:100%;margin-left:10px;background:#fff"></table>');
    var nr = 1;
    $('<caption>Image count: ' + $('#presentation img').length + '</caption>').appendTo(table);
    $('#presentation img').each(function() {
        $('<tr><td>' + nr + '</td><td><input style="width:97%" type="text" value="' + this.src.substring(this.src.indexOf('/assets')).replace('blesser%20', 'blesser_').replace('%20', ' ') + '" /></td><td>' + nr + '</td><td><input style="width:97%" type="text" value="' + this.alt + '" /></td></tr>').appendTo(table);
        $(this).remove();
        nr++;
    });
    table.prependTo('body');
}

//$(document).ready(function() {
    //imagecopy();
//});
