
/* - ++resource++ws.tinygallery.plugin/common.js - */
$(document).ready(function() {
	$('.gallery .images').cycle({
        fx:     'fade',
        speed:   700,
        timeout: 4000,
        next:   '.gallery .next',
        prev:   '.gallery .prev'
	});
    
    $('.imageLeft').each(function(idx, elem) {
        var img = $('img', elem)[0]; // Get my img elem
        var pic_real_width, pic_real_height;
        $("<img/>").attr("src", $(img).attr("src")).load(function() {
            pic_real_width = this.width;   // Note: $(this).width() will not
            pic_real_height = this.height; // work for in memory images.
            $('.caption', elem).css({width: pic_real_width});
        });    
    });
    
    $('.imageRight').each(function(idx, elem) {
        var img = $('img', elem)[0]; // Get my img elem
        var pic_real_width, pic_real_height;
        $("<img/>").attr("src", $(img).attr("src")).load(function() {
            pic_real_width = this.width;   // Note: $(this).width() will not
            pic_real_height = this.height; // work for in memory images.
            $('.caption', elem).css({width: pic_real_width});
        });    
    });
});

