//open popup window
function MM_openBrWindow(theURL, winName, features)
{ window.open(theURL, winName, features); }

//simple custom lightbox
function initLightbox()
{
    $("document").ready(function ()
    {

        //get path
        $(".gallery a").click(function ()
        {
            var bigImage = $(this).attr('href');

            $("#flashLightBox #imageDetail").attr('src', bigImage);
            $("#flashLightBox").fadeTo("slow", 1);
            $("#flashLightBox #imageDetail").fadeTo("slow", 0);                                     //fade current image out
            $("#flashLightBox #imageDetail").bind("load", function ()
                {
                    var myParentW = $(this).width() + 30;
                    var picH = $(this).height();
                    var windowH = $(window).height();
                    var topMargin = (windowH / 2) - (picH/2) -50                                      //vertically center image on screen

                $("#flashLightBox #imageDetail").fadeTo("slow", 1);                                 //fade in new image
                $("#flashLightBox .lightBoxImgCont").css({ width: myParentW + "px" });              //after image has loaded use its height to modify its container
                $("#flashLightBox .lightBoxImgCont").css({ "margin-top": topMargin + "px" });
                });

            _gaq.push(['_trackPageview', bigImage]);                                                //count the path of the big image as a page viewed
            return false;
        });

        //add close event
        $("#flashLightBox").click(function ()
        {
            $("#flashLightBox").fadeOut("normal");
        });
    });
}




