jQuery.noConflict();

(function(jQ){

    function Gallery(imgs){
        this.imgs = imgs
        this.imgs.click( this.open )
    }
    Gallery.prototype = {
        open: function(ev){ 

        },
        test:  function(){ alert("test") }
    }




    jQ(window).load( function(){
        function getImgIds(imgs){
            var ids = []
            var idFinder = /&id=(\d*)/
            imgs.parent().each(function(){
                if (this.href != undefined ){
                this.href.match(idFinder)
                ids.push(RegExp.$1)
                }
            })
            return ids.join(",")
        }

        var imgs = jQ(".content .spirito-image-popup")
        if (imgs.length){
            imgIds = getImgIds(imgs)
            imgs.parent().each(function(){
                this.href = this.href + "&gallerymembers=" + imgIds

            })
        }
    })
})(jQuery)

