"),h=b.add(a),d=function(j,i,l,k){this.opt=i;this.idx=l;this.all=k;this.len=k.length;this.end=this.len>l+1;this.img=f("img:first",j);this.lnk=j.addclass("phzoom").unbind("click").bind(this.imgfn()).append(this.hov=f("
").hide())[0];this.cap=f("",{css:{color:i.capcolor},id:"ph_cap",html:f([f("",{id:"ph_txt",text:this.img[0].title||this.lnk.title||"no title"})[0],f("",{id:"ph_idx",text:l+1+" / "+this.len})[0]])}).add(this.nav=f("",{id:"ph_nav",css:{color:i.navcolor},html:(l?""+i.prevtext+"":"")+(this.end?""+i.nexttext+"":"")}));h.click(f.proxy(this,"imgquit"));window.xmlhttprequest||j.height(this.img.height())};d.prototype={imgfn:function(){var j=this,i=function(){return j.hov.not(".loading").stop(0,1)};return{mouseover:function(){i().fadein()},mouseout:function(){i().fadeout()},click:function(){j.imgload();return false}}},imgpos:function(k,m){var j=this.img,i=c.scrollleft(),l=c.scrolltop(),n=[c.width(),c.height(),j.width(),j.height(),j.offset().left,j.offset().top];this.opt.limitwidth&&k>n[0]&&(m=m/k*(k=n[0]));return n.concat(k,m,(n[0]-k)/2+i,(n[1]-m)/2+l,(n[0]-n[2])/2+i,(n[1]-n[3])/2+l)},imgload:function(){b.fadeto(this.opt.laydur,this.opt.layopacity);var i=this,j=new image;this.hov.addclass("loading");j.classname="zoomed";j.onload=function(){j.onload=null;i.hov.hasclass("loading")&&(a.height(g.height()).append(j).show(),i.imganim(j),i.preload())};j.src=this.lnk.href},imganim:function(n){var k=this,j=f(n),m=this.imgpos(n.width||+j.attr("width"),n.height||+j.attr("height")),i=m[0]j/2,l.idx?l.end?l.imgchange(o||-1):o||l.imgchange(-1):!o||l.imgchange(1))},mouseout:function(){m.hide()},mousemove:function(p,o){p=p.pagex,o=p>j/2;l.idx?(m.eq(o).show(),m.eq(1-o).hide()):m[o?"show":"hide"]();n||(p=pj*2/3?i:i/2)==k.position().left||k.not(":animated").animate({left:p},200)}}}};f.phzoom=function(j,i,k){i=f.extend({layopacity:0.7,laydur:300,animdura:300,animdurb:300,navcolor:"#cf0",capcolor:"#cf0",prevtext:"prev",nexttext:"next",limitwidth:false,returnorigin:true},i),(k=j.has("img"))[0]&&(f("#ph_lay")[0]||f("body").append(h),k.each(function(m,l){f.data(l,"phzoom",new d(f(l),i,m,k))}));return i.returnorigin?j:k};f.fn.phzoom=function(i){return f.phzoom(this,i)}}(jquery);