(function(b){if(window.log==undefined)window.log={toggle:function(){},move:function(){},resize:function(){},clear:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},profile:function(){}};b.fn.extend({autocomplete:function(d,a){var f=typeof d=="string";a=b.extend({formatEditableResult:function(g){return'<a contenteditable="false" href="#" tabindex="-1" >@'+g[a.jsonterm]+"</a>&nbsp;"},formatResult:function(g){return g[a.jsonterm]},formatItem:function(g){return g[a.jsonterm]}},
b.Autocompleter.defaults,{url:f?d:null,data:f?null:d,delay:f?b.Autocompleter.defaults.delay:10,max:a&&!a.scroll?10:150},a);a.highlight=a.highlight||function(g){return g};a.formatMatch=a.formatMatch||a.formatItem;return this.each(function(){new b.Autocompleter(this,a)})},result:function(d){return this.bind("result",d)},search:function(d){return this.trigger("search",[d])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(d){return this.trigger("setOptions",[d])},unautocomplete:function(){return this.trigger("unautocomplete")},
notfound:function(){return this.trigger("ace_notfound")}});b.Autocompleter=function(d,a){function f(){var c=j.selected();if(!c)return false;var e=c.result;h=e;if(a.multiple){var v=p(q());if(v.length>1){var B=a.multipleSeparator.length,F=b(d).selection().start,G,D=0;b.each(v,function(H,P){D+=P.length;if(F<=D){G=H;return false}D+=B});v[G]=e;e=v.join(a.multipleSeparator)}e+=a.multipleSeparator}else if(a.hotkeymode){I=false;e=q();e=e.substring(0,C-1);log.info("found Data! "+c.data[0]+" "+c.data[1]);e=
e+a.formatResult(c.data);if(d.value==undefined)e+='<span id="cursorStart">\u2014</span>'}q(e);k();t.trigger("result",[c.data,c.value]);a.hotkeymode&&d.value==undefined&&g();return true}function g(){setTimeout(function(){var c=document.getElementById("cursorStart");document.getElementById("cursorEnd");if(window.getSelection){N=window.getSelection();var e=document.createRange();e.selectNode(c);N.removeAllRanges();N.addRange(e);document.execCommand("delete",false,null)}else if(document.body.createTextRange){e=
document.body.createTextRange();e.moveToElementText(c);e.select();document.selection.clear()}},10)}function s(c,e){if(O==u.DEL)j.hide();else{c=q();if(!(!e&&c==h)){h=c=w(c);log.debug("onChange curVal = "+c);if(c.length>=a.minChars){t.addClass(a.loadingClass);a.matchCase||(c=c.toLowerCase());l(c,i,k)}else{log.debug("in else");y();if(a.startmsg!=null){j.emptyList();j.display({},null);j.show()}else j.hide()}}}}function p(c){if(!c)return[""];if(!a.multiple&&!a.hotkeymode)return[b.trim(c)];else if(a.multiple)return b.map(c.split(a.multipleSeparator),
function(e){return b.trim(c).length?b.trim(e):null});else if(a.hotkeymode){log.error("should not get here, remove this section, not user");return fake.raise.error}}function w(c){if(!a.multiple&&!a.hotkeymode)return c;else if(a.multiple){var e=p(c);if(e.length==1)return e[0];e=b(d).selection().start;e=e==c.length?p(c):p(c.replace(c.substring(e),""));return e[e.length-1]}else{if(c&&c.lastIndexOf("@")>0)C=c.lastIndexOf("@")+1;else{log.error("found no @ in hotkeymode?"+c);C=c.length+2}c=c.substring(C);
log.info("findSearchTerm: cursorStart,val "+C+", "+c);return c}}function r(c,e){if(a.autoFill&&w(q()).toLowerCase()==c.toLowerCase()&&O!=u.BACKSPACE){q(q()+e.substring(w(h).length));b(d).selection(h.length,h.length+e.length)}}function q(c){if(t[0].value!=undefined)return c!=undefined?t.val(c):t.val();else if(c!=undefined)return t.html(c);else{c=t.html();c=c!=undefined&&c.length!=undefined&&c.length>0?b.trim(c):"";var e="";e=0;if(c.lastIndexOf("@")>0||c.length>10){e=c.lastIndexOf("@")>0?c.lastIndexOf("@")+
1:c.length-10;e=c.substring(e);c=c.substring(0,c.length-e.length)}else{e=c;c=""}e=e.replace("<br>","").replace("<br/>","").replace("&nbsp;"," ");c+=e;return c}}function x(){clearTimeout(m);m=setTimeout(k,200)}function k(){j.visible();I=false;j.hide();clearTimeout(m);y();a.mustMatch&&t.search(function(c){if(!c)if(a.multiple){c=p(q()).slice(0,-1);q(c.join(a.multipleSeparator)+(c.length?a.multipleSeparator:""))}else{q("");t.trigger("result",null)}})}function i(c,e){if(e&&e.length&&z){y();j.display(e,
c);r(c,e[0].value);j.show()}else k()}function l(c,e,v){log.debug("in request term = "+c);a.matchCase||(c=c.toLowerCase());log.debug("in request term2 = "+c);var B=n.load(c);log.debug("in request term3 = "+B);if(B&&B.length){log.debug("found cache, not loading "+c);e(c,B)}else{if(typeof a.url=="string"&&a.url.length>0){var F={timestamp:+new Date};b.each(a.extraParams,function(D,H){F[D]=typeof H=="function"?H():H});var G=false;log.debug("calling ajax, term = "+c," dataType = "+a.dataType);b.ajax({mode:"abort",
port:"autocomplete"+d.name,dataType:a.dataType,url:a.url,data:b.extend({q:c,limit:a.max},F),success:function(D){if(D.length>0){G=true;D=a.parse&&a.parse(D)||A(D);n.add(c,D);e(c,D)}}});if(G===true){log.debug("returning?");return}}log.debug("after load in request?");j.emptyList();if(a.noresultsmsg!=null){y();j.display({},c);j.show()}else v(c)}}function A(c){var e=[];log.debug("parsing json, len="+c.length);for(var v=0,B=c.length;v<B;v++)e[v]={data:c[v],value:c[v][a.jsonterm],result:a.formatResult&&
a.formatResult(c[v])||c[v][a.jsonterm]};return e}function y(){t.removeClass(a.loadingClass)}var u={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,SHIFT:16,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8,SPACE:32,LEFT:37,RIGHT:39,AT:50,POUND:34,DOLLAR:52,SEMIC:59},t=b(d).attr("autocomplete","off").addClass(a.inputClass),m,h="",n=b.Autocompleter.Cache(a),z=0,C=0,K=null,N,O,Q,R,I=a.hotkeymode?false:true,T={mouseDownOnSelect:false},j=b.Autocompleter.Select(a,d,f,T),L;if(a.hotkeymode)a.multiple=false;b.browser.opera&&
b(d.form).bind("submit.autocomplete",function(){if(L)return L=false});if(d.value==undefined&&a.width<1){K=b(d)[0];a.width=b(d).parent().parent().width();a.left=b(d).parent().parent().offset().left}t.bind((b.browser.opera?"keypress":"keydown")+".autocomplete",function(c){z=1;var e=c.keyCode||c.which;e==u.RETURN&&log.debug("in k = "+e+" options.supressReturn ="+a.supressReturn);R=Q;Q=O;O=e;if(a.hotkeymode&&I===false){if(e==u.AT&&c.shiftKey&&(u.SPACE==R||R==undefined)){I=true;log.debug("AutoComplete now active in Hotkey mode");
clearTimeout(m);m=setTimeout(s,a.delay)}}else switch(e){case u.UP:c.preventDefault();j.visible()?j.prev():s(0,true);break;case u.DOWN:c.preventDefault();j.visible()?j.next():s(0,true);break;case u.PAGEUP:c.preventDefault();j.visible()?j.pageUp():s(0,true);break;case u.PAGEDOWN:c.preventDefault();j.visible()?j.pageDown():s(0,true);break;case a.multiple&&b.trim(a.multipleSeparator)==","&&u.COMMA:case u.TAB:case u.RETURN:case u.RIGHT:case u.SEMIC:e==u.RETURN&&c.preventDefault();if(f()){log.debug("in k = "+
e+" options.supressReturn ="+a.supressReturn);e==u.RETURN&&a.supressReturn&&c.preventDefault();L=true;k();if(a.hotkeymode||a.multiple===true){log.debug("in return false");return false}}else{log.debug("nada found?  trigger notfound?");t.trigger("ace_notfound",{});k();e==u.RETURN&&a.supressReturn&&c.preventDefault()}if(e==u.TAB||e==u.RETURN)log.debug("was tab");break;case u.ESC:j.hide();break;default:if(I===true){clearTimeout(m);m=setTimeout(s,a.delay)}break}}).focus(function(){log.debug("has focus");
z++;if(I===true&&a.hotkeymode)s(0,true);else if(!a.hotkeymode){I||(I=true);s(0,true)}}).blur(function(){z=0;T.mouseDownOnSelect||x()}).click(function(){if(z++>1&&!j.visible())s(0,true);else{log.debug("hasfocus = "+z);log.debug("hasfocus = "+(z>1));log.debug("visible()"+!j.visible());log.debug("visible()"+j.visible())}}).bind("result",function(){z=0;x()}).bind("search",function(){function c(v,B){var F;if(B&&B.length)for(var G=0;G<B.length;G++)if(B[G].result.toLowerCase()==v.toLowerCase()){F=B[G];break}typeof e==
"function"?e(F):t.trigger("result",F&&[F.data,F.value])}var e=arguments.length>1?arguments[1]:null;b.each(p(q()),function(v,B){l(B,c,c)})}).bind("flushCache",function(){n.flush()}).bind("setOptions",function(c,e){b.extend(a,e);"data"in e&&n.populate()}).bind("unautocomplete",function(){j.unbind();t.unbind();b(d.form).unbind(".autocomplete")})};b.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,live:false,startmsg:"Start typing to get options...",
msgonenter:false,endmsg:null,noresultsmsg:null,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,supressReturn:false,max:100,mustMatch:false,extraParams:{},jsonterm:0,formatResult:null,formatItem:null,dataType:"json",selectFirst:true,formatMatch:null,autoFill:false,width:0,left:0,multiple:false,multipleSeparator:", ",hotkeymode:false,highlight:function(d,a){return d.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+a.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)",
"gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};b.Autocompleter.Cache=function(d){function a(r,q){d.matchCase||(r=r.toLowerCase());var x=r.indexOf(q);if(d.matchContains=="word")x=r.toLowerCase().search("\\b"+q.toLowerCase());if(x==-1)return false;return x==0||d.matchContains}function f(r,q){w>d.cacheLength&&s();p[r]||w++;p[r]=q}function g(){if(!d.data)return false;var r={},q=0;if(!d.url)d.cacheLength=1;r[""]=[];for(var x=0,k=d.data.length;x<k;x++){var i=d.data[x];i=typeof i=="string"?
[i]:i;var l=d.formatMatch(i,x+1,d.data.length);if(!(l===false||l===undefined)){var A=l.charAt(0).toLowerCase();r[A]||(r[A]=[]);i={value:l,data:i,result:d.formatResult&&d.formatResult(i)||l};r[A].push(i);q++<d.max&&r[""].push(i)}}b.each(r,function(y,u){d.cacheLength++;f(y,u)})}function s(){p={};w=0}var p={},w=0;setTimeout(g,25);return{flush:s,add:f,populate:g,load:function(r){if(!d.cacheLength||!w)return null;if(!d.url&&d.matchContains){var q=[];for(var x in p)if(x.length>0){var k=p[x];b.each(k,function(i,
l){a(l.value,r)&&q.push(l)})}return q}else if(p[r])return p[r];else if(d.matchSubset)for(x=r.length-1;x>=d.minChars;x--)if(k=p[r.substr(0,x)]){q=[];b.each(k,function(i,l){if(a(l.value,r))q[q.length]=l});return q}return null}}};b.Autocompleter.Select=function(d,a,f,g){function s(){if(u){t=b("<div/>").hide().addClass(d.resultsClass).css("position","absolute").appendTo(document.body);m=b("<ul/>").appendTo(t).css({width:typeof d.width=="string"||d.width>0?d.width-2:b(a).width()-2}).mouseover(function(h){if(p(h).nodeName&&
p(h).nodeName.toUpperCase()=="LI"){l=b("li",m).removeClass(k.ACTIVE).index(p(h));b(p(h)).addClass(k.ACTIVE)}}).click(function(h){b(p(h)).addClass(k.ACTIVE);f();a.focus();return false}).mousedown(function(){g.mouseDownOnSelect=true}).mouseup(function(){g.mouseDownOnSelect=false});d.width>0&&t.css("width",d.width);u=false}}function p(h){for(h=h.target;h&&h.tagName!="LI";)h=h.parentNode;if(!h)return[];return h}function w(h){i.slice(l,l+1).removeClass(k.ACTIVE);r(h);h=i.slice(l,l+1).addClass(k.ACTIVE);
if(d.scroll){var n=0;i.slice(0,l).each(function(){n+=this.offsetHeight});if(n+h[0].offsetHeight-m.scrollTop()>m[0].clientHeight)m.scrollTop(n+h[0].offsetHeight-m.innerHeight());else n<m.scrollTop()&&m.scrollTop(n)}}function r(h){l+=h;if(l<0)l=i.size()-1;else if(l>=i.size())l=0}function q(h){return d.max&&d.max<h?d.max:h}function x(h){m.empty();for(var n=q(A.length),z=0;z<n;z++)if(A[z]){var C=d.formatItem(A[z].data,z+1,n,A[z].value,y);if(C!==false){C=b("<li/>").html(d.highlight(C,y)).addClass(z%2==
0?"ac_even":"ac_odd").appendTo(m)[0];b.data(C,"ac_data",A[z])}}i=m.find("li");if(d.selectFirst){i.slice(0,1).addClass(k.ACTIVE);l=0}if(d.startmsg&&(n==0||n==undefined)&&h==null){C=b("<li/>").html(d.startmsg).click(function(){b(a).trigger("ac_start_msg_click")}).addClass("start_msg").appendTo(m)[0];b.data(C,"start_msg",A[n+1])}if(d.noresultsmsg&&(n==0||n==undefined)&&h!=null){z=d.noresultsmsg;if(typeof d.noresultsmsg=="function")z=fn(h);else if(d.noresultsmsg.indexOf("{q}">0))z=z.replace("{q}",h);
C=b("<li/>").html(z).click(function(){b(a).trigger("ac_noresult_click",h)}).addClass("noresult_msg").appendTo(m)[0];b.data(C,"noresult_msg",A[n+1])}if(d.endmsg&&n!=undefined&&n>0){C=b("<li/>").html(d.endmsg).click(function(){b(a).trigger("ac_end_message_click",h)}).addClass("end_msg").appendTo(m)[0];b.data(C,"end_msg",A[n+1])}b.fn.bgiframe&&m.bgiframe()}var k={ACTIVE:"ac_over"},i,l=-1,A,y="",u=true,t,m;return{display:function(h,n){s();A=h;y=n;x(n)},next:function(){w(1)},prev:function(){w(-1)},pageUp:function(){l!=
0&&l-8<0?w(-l):w(-8)},pageDown:function(){l!=i.size()-1&&l+8>i.size()?w(i.size()-1-l):w(8)},hide:function(){log.info("hiding?");t&&t.hide();i&&i.removeClass(k.ACTIVE);l=-1},visible:function(){return t&&t.is(":visible")},current:function(){return this.visible()&&(i.filter("."+k.ACTIVE)[0]||d.selectFirst&&i[0])},show:function(){var h=b(a).offset();t.css({width:typeof d.width=="string"||d.width>0?d.width:b(a).width(),top:h.top+a.offsetHeight,left:d.left>0?d.left:h.left}).show();if(d.scroll){m.scrollTop(0);
m.css({maxHeight:d.scrollHeight,overflow:"auto"});if(b.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var n=0;i.each(function(){n+=this.offsetHeight});h=n>d.scrollHeight;m.css("height",h?d.scrollHeight:n);h||i.width(m.width()-parseInt(i.css("padding-left"))-parseInt(i.css("padding-right")))}}},selected:function(){var h=i&&i.filter("."+k.ACTIVE).removeClass(k.ACTIVE);return h&&h.length&&b.data(h[0],"ac_data")},emptyList:function(){m&&m.empty()},unbind:function(){t&&t.remove()}}};
b.fn.selection=function(d,a){if(d!==undefined){log.debug("in selection, no start/end");return this.each(function(){if(this.createTextRange){var w=this.createTextRange();if(a===undefined||d==a)w.move("character",d);else{w.collapse(true);w.moveStart("character",d);w.moveEnd("character",a)}w.select()}else if(this.setSelectionRange)this.setSelectionRange(d,a);else if(this.selectionStart){this.selectionStart=d;this.selectionEnd=a}})}var f=this[0];if(f.createTextRange){log.debug("in selection with createTextRange");
var g=document.selection.createRange(),s=f.value,p=g.text.length;g.text="<->";g=f.value.indexOf("<->");f.value=s;this.selection(g,g+p);return{start:g,end:g+p}}else if(f.selectionStart!==undefined)return{start:f.selectionStart,end:f.selectionEnd};else f.getRangeAt!==undefined?log.error("ah, getRangeAt, ?"):log.error("ah, none of above, ?")}})(jQuery);
(function(b){b.fn.tipsy=function(d){d=b.extend({fade:false,gravity:"n",title:"title",fallback:""},d||{});this.hover(function(){b.data(this,"cancel.tipsy",true);var a=b.data(this,"active.tipsy");if(!a){a=b('<div class="tipsy"><div class="tipsy-inner"/></div>');a.css({position:"absolute",zIndex:1E5});b.data(this,"active.tipsy",a)}if(this.hasAttribute("title")||!this.hasAttribute("original-title"))b(this).attr("original-title",b(this).attr("title")||"").removeAttr("title");b(this).bind("cancel-tipsy",
function(){a.remove()});var f;if(typeof d.title=="string")f=b(this).attr(d.title=="title"?"original-title":d.title);else if(typeof d.title=="function")f=d.title.call(this);a.find(".tipsy-inner").text(f||d.fallback);f=b.extend({},b(this).offset(),{width:this.offsetWidth,height:this.offsetHeight});a.get(0).className="tipsy";a.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var g=a[0].offsetWidth,s=a[0].offsetHeight;switch((typeof d.gravity=="function"?d.gravity.call(this):
d.gravity).charAt(0)){case "n":a.css({top:f.top+f.height,left:f.left+f.width/2-g/2}).addClass("tipsy-north");break;case "s":a.css({top:f.top-s,left:f.left+f.width/2-g/2}).addClass("tipsy-south");break;case "e":a.css({top:f.top+f.height/2-s/2,left:f.left-g}).addClass("tipsy-east");break;case "w":a.css({top:f.top+f.height/2-s/2,left:f.left+f.width}).addClass("tipsy-west");break}d.fade?a.css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:0.8}):a.css({visibility:"visible"})},function(){b.data(this,
"cancel.tipsy",false);var a=this;setTimeout(function(){if(!b.data(this,"cancel.tipsy")){var f=b.data(a,"active.tipsy");d.fade?f.stop().fadeOut(function(){b(this).remove()}):f.remove()}},100)})};b.fn.tipsy.autoNS=function(){return b(this).offset().top>b(document).scrollTop()+b(window).height()/2?"s":"n"}})(jQuery);
(function(b){b.fn.hoverIntent=function(d,a){var f={sensitivity:7,interval:100,timeout:0};f=b.extend(f,a?{over:d,out:a}:d);var g,s,p,w,r=function(k){g=k.pageX;s=k.pageY},q=function(k,i){i.hoverIntent_t=clearTimeout(i.hoverIntent_t);if(Math.abs(p-g)+Math.abs(w-s)<f.sensitivity){b(i).unbind("mousemove",r);i.hoverIntent_s=1;return f.over.apply(i,[k])}else{p=g;w=s;i.hoverIntent_t=setTimeout(function(){q(k,i)},f.interval)}},x=function(k,i){i.hoverIntent_t=clearTimeout(i.hoverIntent_t);i.hoverIntent_s=0;
return f.out.apply(i,[k])};d=function(k){for(var i=(k.type=="mouseover"?k.fromElement:k.toElement)||k.relatedTarget;i&&i!=this;)try{i=i.parentNode}catch(l){i=this}if(i==this)return false;var A=jQuery.extend({},k),y=this;if(y.hoverIntent_t)y.hoverIntent_t=clearTimeout(y.hoverIntent_t);if(k.type=="mouseover"){p=A.pageX;w=A.pageY;b(y).bind("mousemove",r);if(y.hoverIntent_s!=1)y.hoverIntent_t=setTimeout(function(){q(A,y)},f.interval)}else{b(y).unbind("mousemove",r);if(y.hoverIntent_s==1)y.hoverIntent_t=
setTimeout(function(){x(A,y)},f.timeout)}};return this.mouseover(d).mouseout(d)}})(jQuery);
(function(b){b.fn.popeye=function(d){function a(s){log.debug(s)}var f=b(this),g=b.extend({},b.fn.popeye.defaults,d);return this.each(function(){function s(o,E){E=E||false;var J={backgroundImage:"url("+j.small[o]+")",backgroundPosition:"center"};if(E){m.addClass(g.lclass);h.fadeTo(100,0,function(){p(o);h.css(J)})}else{h.css(J);p(o)}l.onload=function(){m.removeClass(g.lclass);if(E){h.fadeTo(100,1);x(j.title[o])}};if(D)r(o);else{l.src=j.small[o];log.debug(l.src);A.onload=function(){};A.src=j.large[o]}}
function p(o){R.text(" "+v);Q.text(o+1+" ")}function w(o){var E=o;if(E<v-1)E++;else E=0;y.onload=function(){};y.src=j.large[E];o=o;if(o<=0)o=v-1;else o--;u.onload=function(){};u.src=j.large[o]}function r(o){D=true;m.addClass(g.lclass);h.fadeTo(g.duration/2,0);f.addClass(g.eclass);l.onload=function(){m.removeClass(g.lclass);var E={width:l.width,height:l.height},J={backgroundImage:"url("+j.large[o]+")",backgroundPosition:"left top"};k(true);h.animate(E,{queue:false,duration:g.duration,easing:g.easing,
complete:function(){K.removeClass("ppy-enlarge");K.addClass("ppy-compact");K.unbind("click");K.click(function(){q(e);return false});m.click(function(){q(e);return false});m.attr("title",g.clabel);p(o);b(this).css(J).fadeTo(g.duration/2,1);x(j.title[o]);w(o)}})};l.src=j.large[o];b(l).load()}function q(o){D=false;k(true);h.fadeTo(g.duration/2,0).animate(F,{queue:false,duration:g.duration,easing:g.easing,complete:function(){f.removeClass(g.eclass);K.addClass("ppy-enlarge");K.removeClass("ppy-compact");
K.unbind("click");K.click(function(){r(e);return false});m.removeAttr("title");m.unbind("click");s(e);b(this).fadeTo(g.duration/2,1,function(){x(j.title[o])})}})}function x(o){T.text(o);g.countpos=="caption"&&p(e);if(o){o={visibility:"visible",width:h.outerWidth()};N.css(o);N.animate({height:I.outerHeight()},{queue:false,duration:90,easing:g.easing})}else k(true)}function k(o){o=o||false;var E={visibility:"hidden",overflow:"hidden",width:L},J=false;J=o?70:0;N.animate({height:"0px"},{queue:false,duration:J,
easing:g.easing,complete:function(){N.css(E)}})}function i(){f.find("li").each(function(M){var S=b(this).find("img");if(S[0].naturalWidth!=undefined){j.width[M]=S[0].naturalWidth;j.height[M]=S[0].naturalHeight}else if(S.width()>25){j.width[M]=S[0].width();j.height[M]=S[0].height()}else{j.width[M]=0;j.height[M]=0}if(parseInt(j.height[M])==0){b(this).remove();v--;a("removed entry ")}else{if(L>j.width[M]||L==0)L=j.width[M];if(c>j.height[M]||c==0)c=j.height[M]}});if(L>g.maxWidth)L=g.maxWidth;if(L>g.maxHeight)c=
g.maxHeight;F={width:L,height:c};G={opacity:0};a("$.fn.popeye.init -> Starting in COMPACT MODE");f.find("ul").remove();g.nojsclass&&f.find("."+g.nojsclass).remove();f.append(m);m.append(h);h.append(n);g.countpos=="overlay"&&h.append(O);n.append(z);n.append(K);n.append(C);g.caption&&m.after(N);O.append(Q);O.append(R);Q.after(g.oflabel);N.append(I);g.countpos=="caption"&&I.prepend(O);I.append(T);g.jsclass&&f.addClass(g.jsclass);if(g.direction=="left")n.addClass(g.dlclass);else g.direction=="right"&&
n.addClass(g.drclass);h.css(F);n.css(G);if(e<j.small.length)s(e);else{log.error("in init, no valid images - Hiding");f.hide()}k();var o=m.outerHeight(),E=m.outerWidth(),J=f.offset().top-parseInt(f.css("marginTop"),10),U=f.offset().left-parseInt(f.css("marginLeft"),10),V=b(window).width()-(f.offset().left+E)-parseInt(f.css("marginRight"),10),W=f.css("float"),X=f.css("margin-top"),Y=f.css("margin-right"),Z=f.css("margin-bottom"),$=f.css("margin-left");o={height:o,width:E,"float":W,marginTop:X,marginRight:Y,
marginBottom:Z,marginLeft:$};J={position:"absolute",top:J,zIndex:"100"};if(g.direction=="left")J.left=U;else if(g.direction=="right")J.right=V;t.css(o);f.after(t);f.appendTo(b("body"));f.css(J);h.hover(function(){n.stop().fadeTo(100,g.opacity)},function(){n.stop().fadeTo(500,0)});n.mouseleave(function(){n.stop().fadeTo(500,0)});n.mouseenter(function(){n.stop().fadeTo(100,g.opacity)});f.hover(function(){x(j.title[e])},function(){k(true)});z.click(function(){if(e<=0)e=v-1;else e--;s(e,true);return false});
C.click(function(){if(e<v-1)e++;else e=0;s(e,true);return false});K.click(function(){r(e);return false})}var l=new Image,A=new Image,y=new Image,u=new Image,t=b('<div class="ppy-placeholder" />'),m=b('<div class="ppy-stagewrap" />'),h=b('<div class="ppy-stage" />'),n=b('<div class="ppy-tools" />'),z=b('<div class="ppy-prev">'+g.plabel+"</div>"),C=b('<div class="ppy-next">'+g.nlabel+"</div>"),K=b('<div class="ppy-enlarge">'+g.blabel+"</div>"),N=b('<div class="ppy-cap" />'),O=b('<div class="ppy-count" />'),
Q=b('<em class="ppy-cur" />'),R=b('<em class="ppy-total" />'),I=b('<div class="ppy-textwrap" />'),T=b('<span class="ppy-text" />'),j={small:[],title:[],large:[],width:[],height:[]},L=0,c=0,e=0,v=f.find("img").length,B=v;a("$.fn.popeye -> "+v+" thumbnails found.");var F={},G={},D=false,H=0,P=null;f.find("li").each(function(){P=b(this).find("img").load();if(P[0].naturalWidth!=undefined&&P[0].naturalWidth>0||P.width()>25){j.small[H]=b(this).find("img").attr("src");j.title[H]=b(this).find("img").attr("title");
j.large[H]=b(this).find("a").attr("href");log.debug(j.small[H]);b(this).find("img").load().attr("src",j.small[H]);H++}else b(this).remove();B-=1;if(B<1){a("$.fn.popeye -> All thumbnails loaded!");i()}});v=H})};b.fn.popeye.defaults={jsclass:"ppy-js",nojsclass:"ppy-no-js",eclass:"ppy-expanded",lclass:"ppy-loading",dlclass:"ppy-left",drclass:"ppy-right",direction:"left",duration:250,opacity:0.7,countpos:"overlay",caption:true,easing:"swing",nlabel:"",plabel:"",oflabel:"of",blabel:"",clabel:"Click to close",
debug:false,maxWidth:280,maxHeight:280}})(jQuery);

