
function setPreviews() {

    $$('.previewdata').each(function(i){

        loadSqueezeBox();

        var data = null;
        try {
            var data = Base64.decode(i.get('html'));
            data = JSON.decode(data);
        } catch (e) {
            return;
        }

        if (data) {

            var links = i.getParent().getElements('.preview');
            links.each(function(p){
                p.addEvent('click', (function(){

                    SqueezeBox.open(this.link, {
                        handler: (this.type == 'swf' ? this.type : null),
                        size: {
                            x: this.width,
                            y: this.height
                        }
                    });


                    return false;

                }).bind(data));
            });
        }

    });

}




window.addEvent('domready', function() {
        setPreviews();
});

window.addEvent('ajaxready', function() {
        setPreviews();
});


