/*
 * Simplified version of jQIR
 * Copyright (c) 2006/2007 Sam Collett (http://www.texotela.co.uk)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 */

jQuery.fn.jQIR = function(format, path, width, height) {
    if(!document.images) return this;
    path = path || "";
    this.each(function() {
        var img = $("<img>"), el = jQuery(this);
        var file = path + this.id + "." + format;
        jQuery(img).attr({src: file, alt: el.text(), width: width, height: height}).load();
        var a = el.find("a");
        var toAppend = a.length ? a.empty().append(img) : img;
        el.empty().append(toAppend);
    })
    return this;
}
