swfobject.registerObject("slideshow", "9.0.0", "/other/expressInstall.swf");

$(document).ready(function() {

    $("a.trigger").click(function() {
        $.ajax({
            type: "POST",
            cache: false,
            url: "/gallery.aspx",
            data: "path=" + this.href,
            success: function(data) {
                $.fancybox(data.split('|'), { 'type': 'image' });
            }
        });
        return false;
    });

    $("a.iframe").click(function() {
        $.fancybox({
            'autoScale': false,
            'width': 440,
            'height': 380,
            'href': this.href,
            'transitionIn': 'elastic',
            'transitionOut': 'elastic',
            'type': 'iframe'
        });
        return false;
    });

    $(".boxWithFrame img").click(function() {
    	var path = $(this).parents('tbody').find('.contents a').attr('href');
        $.ajax({
            type: "POST",
            cache: false,
            url: "/gallery.aspx",
            data: "path=/" + path,
            success: function(data) {
                $.fancybox(data.split('|'), { 'type': 'image' });
            }
        });
    });

	$("a.swf").fancybox({
		'type':'swf',
		'width':640,
		'height':480,
		'padding':0,
		'autoScale':false,
		'transitionIn':'none',
		'transitionOut':'none'
	});

    $('a[rel=gallery]').fancybox({
        'transitionIn':'none',
        'transitionOut':'none',
        'titlePosition':'over',
        'titleFormat':function(title, currentArray, currentIndex, currentOpts) {
            return '<span id="fancybox-title-over">Immagine ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
        }
    });

});

