﻿// ** SIMILAR to bc.thumbsgalleryphotos-5.0.0.js **


//
// init
//
$(document).ready(function() {

    // thumb click (using .live() so it works across callbacks)
    $(".tnLNK").live("click", function() { return bcShowModalPhoto(this) });
    $(".tnLNK").live("contextmenu", function() { return bcShowModalPhoto(this) });
    
    // sshow click? (2 per page)
    $("a.pgrSShow").live("click", function() {
        // first click?
        if ($("#divSShow").is(":empty")) {
            // build sshow elements
            $("img.mpPic").each(function(idx, elm) {
                var sUrl = $(this).attr("src");
                // only avail thumbs
                if (sUrl.indexOf("/thumbs/") > -1) {
                    sUrl = sUrl.replace("/thumbs/", "/prot/");
                    $("#divSShow").append($("<a>").attr("href", sUrl).attr("rel", "SShowPics")); //.html(idx));
                }
            });
        }
        // bind colorbox
        $("#divSShow a").colorbox({
            slideshow: true,
            slideshowSpeed: 3000,
            rel: "SShowPics",
            preloading: false
        });
        // trigger sshow w/ script-click of 1st element        
        $('#divSShow a[rel=SShowPics]:first').click();
        return false;
    });

    // right-click = standard click
    if (document.location.href.indexOf("localhost") < 0) { // skip for dev
        $(".tnLNK").live("contextmenu", function(e) {
            $(this).click();
            return false;
        });
    }

});



//
// callback: update page trail w/ show filter (js must be above callback for this event handler to work!)
//
function bcUpdadePageTrail(sender, args) {
    var sShow = $(".pgrFilter:first select[name='show']").val();
    if (sShow != null) $(".topSubHead h3").html(sShow.toUpperCase());
}

