

    $(document).ready(function() {

        //Init lightbox
        $(function() {
            $('#featuredPicasaPhoto a').lightBox();
        });

    });



    function change_photo(photo_id, url, full_image_url, picasa_link, description, is_owner)
    {
        $('#preLoadedImage').attr('src', url);

        $('.mainPhoto img').fadeOut(300, function() {
            $('.mainPhoto img').attr('src', url);
            $('#featuredPicasaPhoto a').attr('href', full_image_url);
            $('.mainPhoto .info .description').text(description);
            $('.mainPhoto .info a').attr('href', picasa_link);
            $('.mainPhoto img').fadeIn(300);
        });

        return false;
    }

    function next_gallery_pic(direction)
    {
        var leftChange = '';

        numImages = $('.photoCarousel .photosVisible img').length;
        endOffset = Math.floor((numImages-1)/4) * 544 * -1;
        maxOffset = endOffset + "px"

        if($('.photoCarousel .photosVisible').css('left') == "0px" && direction == -1)
        {
          //numImages = $('#gallery_photos img').length;
          //endOffset = (numImages-1) * 416 * -1;
          //leftChange = endOffset + "px";
          leftChange = maxOffset;

        }
        else if($('.photoCarousel .photosVisible').css('left') == maxOffset && direction == 1)
        {
            leftChange = "0px";
        }
        else {
            leftChange = (direction == -1) ? "+=544" : "-=544";
        }

        $('.photoCarousel .photosVisible').animate( { left:leftChange }, 500);
    }
