(function($){$.fn.bezoom=function(options){var settings={marginLeft:210,identifier:"bezoom",height:200,width:200,titleSource:"title",imgSource:"jqimg",bgColor:"#ffffff",color:"#ffffff",size:"0.8em"};options=options||{};$.extend(settings,options);this.each(function(){var title=$(this).attr(settings.titleSource),imgBig=$(this).attr(settings.imgSource),titleAttribute=$(this).attr("title"),img=$(this).find("img");img.removeAttr("title");$(this).mouseenter(function(){$("#"+settings.identifier).remove();$(this).attr("title","");var imgSmallHeight=$(this).find("img").height(),imgSmallWidth=$(this).find("img").width(),pos=$(this).position(),y=Math.ceil(pos.top-0)-imgSmallHeight,x=Math.ceil(pos.left-0)-settings.marginLeft;$("body").append('<div id="'+settings.identifier+'" style="z-index:9999;background-color:'+settings.bgColor+";border:1px solid black; position:absolute; top:"+y+"px;left:"+x+"px;width:"+settings.width+'px;"><div style="background-color:'+settings.bgColor+";color:"+settings.color+";font-size:"+settings.size+';">'+title+'</div><div style="width:'+settings.width+"px;height:"+settings.height+'px;overflow:hidden;position:relative;"><img id="'+settings.identifier+'_img" src="'+imgBig+'" style="position:relative;"></div></div>')}).mouseleave(function(){$("#"+settings.identifier).remove();$(this).attr("title",titleAttribute)});$(this).mousemove(function(e){var imgSmallHeight=$(this).find("img").height(),imgSmallWidth=$(this).find("img").width(),imgBigWidth=$("#"+settings.identifier+"_img").width(),imgBigHeight=$("#"+settings.identifier+"_img").height(),widthRel=imgSmallWidth/imgBigWidth,heightRel=imgSmallHeight/imgBigHeight,offset=img.position(),mouseX=e.pageX-offset.left,mouseY=e.pageY-offset.top,imgBigX=Math.ceil(mouseX/widthRel-settings.width/2)*-1;imgBigX=Math.max(-1*imgBigWidth+settings.width,imgBigX);imgBigX=Math.min(0,imgBigX);var imgBigY=Math.ceil(mouseY/heightRel-settings.height*.5)*-1;imgBigY=Math.min(0,imgBigY);imgBigY=Math.max(-1*imgBigHeight+settings.height,imgBigY);$("#"+settings.identifier+"_img").css("left",imgBigX);$("#"+settings.identifier+"_img").css("top",imgBigY)})});return this}})(jQuery);
