
// show warning
function _globalSetupBrowserWarning() {
    $(function () {
        var bIsMSIE6orless = /MSIE (5\.5|6)/.test(navigator.userAgent);
        if (bIsMSIE6orless) {
            $("#browser-warning").html("<div style='background-color: white; color: red; font-weight: bold; font-size: 14px; padding: 10px; text-align: center;'>You are viewing this website with a browser that is no longer supported.<br/>As a result, some functionality of this website may not work for you. Please upgrade to a more recent version of your browser.</div>");
        }
    });
}

// extract photos and setup fancy box
function _globalSetupFancyBox() 
{
    $(function () {
        var imgArray = new Array();
        $("#photo-slideshow .caption").css("background-color", "#eee");
        $("#photo-slideshow img").each(function (index, img) {
            var imgSrc = $(img).attr("src");
            var imgTitle = $(img).attr("title");
            var imgSrcTokens = imgSrc.split("_");
            var trueSrc = "";
            if (imgSrcTokens.length > 1) {
                // always 2 tokens => [fitbox] [size]
                for (var i = 0; i < imgSrcTokens.length - 2; i++) {
                    if (i > 0) trueSrc += "_";
                    trueSrc += imgSrcTokens[i];
                }
                trueSrc += "." + imgSrcTokens[imgSrcTokens.length - 1].split(".")[1];
            } else {
                trueSrc += imgSrcTokens[0];
            }
            trueSrc = trueSrc.replace("/thumb", "");
            imgArray.push({ 'href': trueSrc, 'title': imgTitle });
            $(img).attr('index', index);
        });
        if (imgArray.length > 0) {
            for (var i = 0; i < imgArray.length; i++) {
                if (imgArray[i].title != "") {
                    imgArray[i].title += "<br/><br/>";
                }
				if (imgArray.length > 1) {
					imgArray[i].title += "<small>Use your mouse wheel, or click near the border of the photos to move between photos.</small>";
				}
            }
        }
        var options = {
            'padding': 10,
            'titlePosition': 'inside',
            'transitionIn': 'none',
            'transitionOut': 'none',
            'type': 'image',
            'changeFade': 0
        };
        $("#show-lightbox").css('cursor', 'pointer').click(function () {
            $.fancybox(imgArray, options);
        });
        $("#photo-slideshow img").css('cursor', 'pointer').click(function () {
            options['index'] = $(this).attr('index');
            $.fancybox(imgArray, options);
        });
    });
}



