/*
// A little script to clean up the gallery.

var thumbnailWidth = 142;
var thumbnailHeight = 142;
var thumbnailPart = "-" + thumbnailWidth + "x" + thumbnailHeight;



function onThumbNailClick() {
    
    var mainGalleryItem = $(this).parents("div.post").find("div.gallery dl").first();
    var thumbNailUrl = $(this).find("img").attr("src");
    var mainImageUrl = $(mainGalleryItem).find("img").attr("src");
    $(this).find("img").attr("src", getThumbnailUrlOf(mainImageUrl));    
    $(mainGalleryItem).find("img").attr("src", getFullImageUrlOf(thumbNailUrl));
    return false;
}

function getThumbnailUrlOf(url) {
    var periodIndex = url.lastIndexOf(".");
    var leftPart = url.substr(0, periodIndex)
    var rightPart = url.substr(periodIndex);
    return leftPart + thumbnailPart + rightPart;
}

function getFullImageUrlOf(url) {
    return url.replace(thumbnailPart, "");
}*/

$(document).ready(function() {

    // Add a textual class to the text links so that we can style them
    $("ul.bannerList li a").each(function() {
        if ($(this).find("img").length == 0)
            $(this).parent().addClass("textual");          
    });

    // Move the header above the text links
    $("ul.bannerList li.textualHeader").each(function() {
        $("ul.bannerList li.textual:first").before(this);
        //$(this).remove();
    });

    /*
    $("div.gallery").each(function() {

        var galleryItems = $(this).find("dl");
        var mainGalleryItem = galleryItems.first();
    
        // Find the image of the first gallery item, and display the full version of the image
        var img = mainGalleryItem.find("img");
        var src = img.attr("src");
        var newSrc =  src.replace(thumbnailPart, "");
        img.attr("src",newSrc);

        // Let the browser manage size, we're lazy...
        img.removeAttr("height");
        img.removeAttr("width");
        mainGalleryItem.css("float", "none");

        var post = mainGalleryItem.parents("div.post");
        var postPermaLink = post.find("h2 a").attr("href");
        mainGalleryItem.find("a").attr("href", postPermaLink );

        var thumbNails = $(mainGalleryItem).siblings();
        thumbNails.first().css("float", "left");
        thumbNails.find("a").click(onThumbNailClick);

    });
    */

    
});




