$(function(){
    $("#thumbcontainer a").click(function()
        {
        var imageSource = $(this).children("img").attr("id");
        var imageTitle = $(this).children("img").attr("title");
        arr = imageTitle.split("|");
        var oldHeight = $("#painting").height();
       
        $("#painting").addClass("loading");
        $("#painting").css({"min-height" : oldHeight});
        // height and wight are removed because they may be present from 
        // initial image loaded, and we don't have the new h&w here, so
        // not removing h&w results in distorted images.
        $("#painting img")
          .hide()
          .attr({"src": "/web_images/artists/"+imageSource, 
		"title": arr[0],
		"alt": arr[0] })
          .removeAttr("height")
          .removeAttr("width");
        $("#painting_title").html(arr[0]);
        $("#painting_media").html(arr[1]);
        return false;
        });
      $("#painting>img").load(function(){
          $("#painting>img").fadeIn("slow");
          $("#painting").removeClass("loading");
        });
});
