(function(a){a.fn.thumbPopup=function(d){settings=jQuery.extend({popupId:"thumbPopup",popupCSS:{border:"1px solid #000000",background:"#FFFFFF"},imgSmallFlag:"_t",imgSmallFlag1:"_t",imgLargeFlag:"_l",imgLargeFlag1:"_l",cursorTopOffset:15,cursorLeftOffset:15,loadingHtml:"<span style='padding: 5px;'>Loading</span>"},d);popup=a("<div />").css(settings.popupCSS).attr("id",settings.popupId).css("position","absolute").appendTo("body").hide();a(this).hover(c).mousemove(e).mouseout(b);function c(i){var h=a(this).attr("imgzoom");console.debug(" FULLIMGURL : "+h);a(this).data("hovered",true);a("<img />").bind("load",{thumbImage:this},function(j){if(a(j.data.thumbImage).data("hovered")==true){a(popup).empty().append(this);e(j)}a(j.data.thumbImage).data("cached",true)}).attr("src",h);if(a(this).data("cached")!=true){a(popup).append(a(settings.loadingHtml));a(popup).show()}e(i)}function e(i){var h=g();var j=f();if(h.width+h.scrollLeft<i.pageX+j.width+settings.cursorLeftOffset){a(popup).css("left",i.pageX-j.width-settings.cursorLeftOffset)
}else{a(popup).css("left",i.pageX+settings.cursorLeftOffset)}if(h.height+h.scrollTop<i.pageY+j.height+settings.cursorTopOffset){a(popup).css("top",i.pageY-j.height-settings.cursorTopOffset)}else{a(popup).css("top",i.pageY+settings.cursorTopOffset)}a(popup).show()}function b(h){a(this).data("hovered",false);a(popup).empty().hide()}function g(){return{scrollLeft:a(window).scrollLeft(),scrollTop:a(window).scrollTop(),width:a(window).width(),height:a(window).height()}}function f(){return{width:a(popup).width(),height:a(popup).height()}}return this}})(jQuery);
