dojo.addOnLoad(function() {
    yq_product_gallery_init();
});


function yq_product_gallery_init(){
    dojo.query("a.lightbox").forEach(function(node, index, arr){
        dojo.query("img", node).forEach(function(img){
            var lb = new dojox.image.Lightbox(
                    {title: img.getAttribute("alt"),
                     group:"gallery",
                     href:node.getAttribute("href")}
            );
            lb.startup();
            dojo.connect(node,'onclick',function(e){
                    e.preventDefault();
                    lb.show();
            });
        });
    });
}