(function($){$.fn.bezoom=function(options){var settings={identifier:'bezoom',height:536,width:350,titleSource:'title',imgSource:'href',bgColor:'#5398EE',color:'#ffffff',size:'0em'};options=options||{};$.extend(settings,options);this.each(function(i){var title=$(this).attr(settings.titleSource);var imgBig=$(this).attr(settings.imgSource);var titleAttribute=$(this).attr("title");var img=$(this).find('img');$(this).mouseenter(function(e){$('#'+settings.identifier).remove();$(this).attr("title","");var imgSmallHeight=$(this).find('img').height();var imgSmallWidth=$(this).find('img').width();var pos=$(this).position();var y=imgSmallHeight;var x=Math.ceil(pos.left-0)+imgSmallWidth+settings.marginLeft;$('.image-table').append('<div id="'+settings.identifier+'" style="background-color:white; float:left; margin-left:356px; margin-top:4px; z-index:200;  border:2px solid #ececec; position:absolute; width:'+settings.width+'px;"><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();var imgSmallWidth=$(this).find('img').width();var imgBigWidth=$('#'+settings.identifier+'_img').width();var imgBigHeight=$('#'+settings.identifier+'_img').height();var widthRel=imgSmallWidth/imgBigWidth;var heightRel=imgSmallHeight/imgBigHeight;var offset=img.position();var mouseX=e.pageX-offset.left;var mouseY=e.pageY-offset.top;var 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*0.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);
