jQuery.fn.extend({
    ajaxImageLoad: function(loading, autoShow, callback) {
        var panel = this;
        if (panel.length > 0) {
            var img = $("img[src]", panel[0]);
            if (img.length == 1 && img.attr("src") == "") {
                if (loading) {
                    panel.hide();
                    loading.show();
                }
                img.load(function() {
                    if (loading && autoShow) {
                        panel.show();
                        loading.show();
                    }
                    if (callback) {
                        callback();
                    }
                });
                var imgsrc = $("input[type=hidden].img_src", panel[0]);                
                img.attr("src", imgsrc.val());
            } else {
                if (callback) {
                    callback();
                }
            }
        }
    }
});