﻿function InitializeThumbnails() {
    var isIE7 = $.browser.msie && parseInt($.browser.version, 10) <= 7;

    $("img.thumbnail").each(function () {
        var $img = $(this);
        if ($img.size() > 0) {
            var imageUrl = $img.attr("imageurl");
            $img.bind("load", function () {
                var containerIsTheFirstElementWithName = "div";
                ImageHandler.ResizeImage(this, containerIsTheFirstElementWithName);
            }).attr("src", imageUrl);
        }
        if (isIE7) {
            $img.click(function () {
                window.location.href = $(this).closest("a").attr("href");
            }); 
        }
    });

    if (isIE7) {
        $("img.thumbnailDefault").each(function () {
            var $img = $(this);
            $img.click(function () {
                window.location.href = $(this).closest("a").attr("href");
            });
            $img.css('cursor', 'pointer');
        });
    }
}
