var overlapviewer={thumbclass:"jkimagelarge",startopacity:1,endopacity:0.5,increment:0.2,loadingmsg:"Loading...",isContained:function(a,b){var b=window.event||b;var d=b.relatedTarget||((b.type=="mouseover")?b.fromElement:b.toElement);while(d&&d!=a){try{d=d.parentNode}catch(b){d=a}}if(d==a){return true}else{return false}},dim_and_reveal:function(f,c,b){var d={w:$(window).width(),h:$(window).height()};var a={x:f.pageX-f.clientX,y:f.pageY-f.clientY};$(c).fadeTo("normal",overlapviewer.endopacity,function(){b.$popupdiv.html('<img id="jkpopupimage" src="'+c.getAttribute("targetimage")+'" border="0" width="100" />');var h=c.childNodes.length==1&&c.firstChild.tagName=="IMG";var e=(h)?$(c.firstChild):$(c);var g=e.offset();$("#jkpopupimage").one("load",function(){var i=b.$popupdiv.get(0);g.left=(d.w<g.left-a.x+i.offsetWidth)?g.left-i.offsetWidth+e.width():g.left;b.$popupdiv.css({left:g.left+90,top:g.top-50,visibility:"visible"})})})},undim_and_hide:function(c,b,a){$(b).fadeTo("normal",overlapviewer.startopacity);a.$popupdiv.empty().css({left:0,top:0,visibility:"hidden"})},init:function(a){$(document).ready(function(){a.$thumbnails=$("."+overlapviewer.thumbclass);a.$popupdiv=$('<div id="overlappopup"></div>').prependTo("body");a.$thumbnails.each(function(b){$(this).attr("targetimage",this.getAttribute("title")).attr("title","");$(this).bind("mouseenter",function(c){if(!overlapviewer.isContained(a.$popupdiv.get(0),c)){overlapviewer.dim_and_reveal(c,this,a)}});$(this).bind("mouseleave",function(c){if(!overlapviewer.isContained(a.$popupdiv.get(0),c)){overlapviewer.undim_and_hide(c,this,a)}})});a.$popupdiv.bind("mouseleave",function(b){a.$thumbnails.stop().fadeTo("normal",overlapviewer.startopacity);a.$popupdiv.empty().css({left:0,top:0,visibility:"hidden"})})})}};overlapviewer.init({});