
$(document).ready(function() {
        
// Direct gallery link sniffer

var media_id = gup('galleryid');
//console.log('media id:', media_id);

if (media_id) {
        getGallery(media_id);
}

});

function getGallery(media_id) {
        // Let's go ahead and empty the big slideshow just to be sure
        $('#big_slideshow_box').empty();
        
        // Use AJAX to get the slideshow
        $.get('/700/v-gallery_image/gallery/'+ media_id + '.html', function(slideshow){
                $("#big_slideshow_box").html(slideshow);
                window.scrollTo(0,0);
                });

}


function gup(name) {
        name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var results = regex.exec( window.location.href );
        if( results == null )
        return "";
else
return results[1];
}
