(function(b){b.tools=b.tools||{};b.tools.expose={version:"1.0.5",conf:{maskId:null,loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,color:"#456",api:false}};function a(){if(b.browser.msie){var f=b(document).height(),e=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,f-e<20?e:f]}return[b(window).width(),b(document).height()]}function c(h,g){var e=this,k=b(this),d=null,f=false,j=0;b.each(g,function(l,m){if(b.isFunction(m)){k.bind(l,m)}});b(window).resize(function(){e.fit()});b.extend(this,{getMask:function(){return d},getExposed:function(){return h},getConf:function(){return g},isLoaded:function(){return f},load:function(o){if(f){return e}j=h.eq(0).css("zIndex");if(g.maskId){d=b("#"+g.maskId)}if(!d||!d.length){var m=a();d=b("<div/>").css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:0,zIndex:g.zIndex});if(g.maskId){d.attr("id",g.maskId)}b("body").append(d);var l=d.css("backgroundColor");if(!l||l=="transparent"||l=="rgba(0, 0, 0, 0)"){d.css("backgroundColor",g.color)}if(g.closeOnEsc){b(document).bind("keydown.unexpose",function(p){if(p.keyCode==27){e.close()}})}if(g.closeOnClick){d.bind("click.unexpose",function(p){e.close(p)})}}o=o||b.Event();o.type="onBeforeLoad";k.trigger(o);if(o.isDefaultPrevented()){return e}b.each(h,function(){var p=b(this);if(!/relative|absolute|fixed/i.test(p.css("position"))){p.css("position","relative")}});h.css({zIndex:Math.max(g.zIndex+1,j=="auto"?0:j)});var n=d.height();if(!this.isLoaded()){d.css({opacity:0,display:"block"}).fadeTo(g.loadSpeed,g.opacity,function(){if(d.height()!=n){d.css("height",n)}o.type="onLoad";k.trigger(o)})}f=true;return e},close:function(l){if(!f){return e}l=l||b.Event();l.type="onBeforeClose";k.trigger(l);if(l.isDefaultPrevented()){return e}d.fadeOut(g.closeSpeed,function(){l.type="onClose";k.trigger(l);h.css({zIndex:b.browser.msie?j:null})});f=false;return e},fit:function(){if(d){var l=a();d.css({width:l[0],height:l[1]})}},bind:function(l,m){k.bind(l,m);return e},unbind:function(l){k.unbind(l);return e}});b.each("onBeforeLoad,onLoad,onBeforeClose,onClose".split(","),function(l,m){e[m]=function(n){return e.bind(m,n)}})}b.fn.expose=function(d){var e=this.eq(typeof d=="number"?d:0).data("expose");if(e){return e}if(typeof d=="string"){d={color:d}}var f=b.extend({},b.tools.expose.conf);d=b.extend(f,d);this.each(function(){e=new c(b(this),d);b(this).data("expose",e)});return d.api?e:this}})(jQuery);(function(h){h.tools=h.tools||{};h.tools.overlay={version:"1.1.2",addEffect:function(c,b,a){e[c]=[b,a]},conf:{top:"10%",left:"center",absolute:false,speed:"normal",closeSpeed:"fast",effect:"default",close:null,oneInstance:true,closeOnClick:true,closeOnEsc:true,api:false,expose:null,target:null}};var e={};h.tools.overlay.addEffect("default",function(a){this.getOverlay().fadeIn(this.getConf().speed,a)},function(a){this.getOverlay().fadeOut(this.getConf().closeSpeed,a)});var g=[];function f(t,p){var a=this,c=h(this),b=h(window),q,r,s,v=p.expose&&h.tools.expose.version;var u=p.target||t.attr("rel");r=u?h(u):null||t;if(!r.length){throw"Could not find Overlay: "+u}if(t&&t.index(r)==-1){t.click(function(j){a.load(j);return j.preventDefault()})}h.each(p,function(k,j){if(h.isFunction(j)){c.bind(k,j)}});h.extend(a,{load:function(j){if(a.isOpened()){return a}var m=e[p.effect];if(!m){throw'Overlay: cannot find effect : "'+p.effect+'"'}if(p.oneInstance){h.each(g,function(){this.close(j)})}j=j||h.Event();j.type="onBeforeLoad";c.trigger(j);if(j.isDefaultPrevented()){return a}s=true;if(v){r.expose().load(j)}var k=p.top;var l=p.left;var o=r.outerWidth({margin:true});var n=r.outerHeight({margin:true});if(typeof k=="string"){k=k=="center"?Math.max((b.height()-n)/2,0):parseInt(k,10)/100*b.height()}if(l=="center"){l=Math.max((b.width()-o)/2,0)}if(!p.absolute){k+=b.scrollTop();l+=b.scrollLeft()}r.css({top:k,left:l,position:"absolute"});j.type="onStart";c.trigger(j);m[0].call(a,function(){if(s){j.type="onLoad";c.trigger(j)}});if(p.closeOnClick){h(document).bind("click.overlay",function(x){if(!a.isOpened()){return}var y=h(x.target);if(y.parents(r).length>1){return}h.each(g,function(){this.close(x)})})}if(p.closeOnEsc){h(document).unbind("keydown.overlay").bind("keydown.overlay",function(w){if(w.keyCode==27){h.each(g,function(){this.close(w)})}})}return a},close:function(j){if(!a.isOpened()){return a}j=j||h.Event();j.type="onBeforeClose";c.trigger(j);if(j.isDefaultPrevented()){return}s=false;e[p.effect][1].call(a,function(){j.type="onClose";c.trigger(j)});var k=true;h.each(g,function(){if(this.isOpened()){k=false}});if(k){h(document).unbind("click.overlay").unbind("keydown.overlay")}return a},getContent:function(){return r},getOverlay:function(){return r},getTrigger:function(){return t},getClosers:function(){return q},isOpened:function(){return s},getConf:function(){return p},bind:function(k,j){c.bind(k,j);return a},unbind:function(j){c.unbind(j);return a}});h.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(k,j){a[j]=function(l){return a.bind(j,l)}});if(v){if(typeof p.expose=="string"){p.expose={color:p.expose}}h.extend(p.expose,{api:true,closeOnClick:p.closeOnClick,closeOnEsc:false});var d=r.expose(p.expose);d.onBeforeClose(function(j){a.close(j)});a.onClose(function(j){d.close(j)})}q=r.find(p.close||".close");if(!q.length&&!p.close){q=h('<div class="close"></div>');r.prepend(q)}q.click(function(j){a.close(j)})}h.fn.overlay=function(c){var b=this.eq(typeof c=="number"?c:0).data("overlay");if(b){return b}if(h.isFunction(c)){c={onBeforeLoad:c}}var a=h.extend({},h.tools.overlay.conf);c=h.extend(true,a,c);this.each(function(){b=new f(h(this),c);g.push(b);h(this).data("overlay",b)});return c.api?b:this}})(jQuery);(function(j){var f=j.tools.overlay;f.effects=f.effects||{};f.effects.apple={version:"1.0.1"};j.extend(f.conf,{start:{absolute:true,top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function k(b){var a=b.offset();return[a.top+b.height()/2,a.left+b.width()/2]}var h=function(d){var s=this.getOverlay(),x=this.getConf(),u=this.getTrigger(),b=this,a=s.outerWidth({margin:true}),e=s.data("img");if(!e){var p=s.css("backgroundImage");if(!p){throw"background-image CSS property not set for overlay"}p=p.substring(p.indexOf("(")+1,p.indexOf(")")).replace(/\"/g,"");s.css("backgroundImage","none");e=j('<img src="'+p+'"/>');e.css({border:0,position:"absolute",display:"none"}).width(a);j("body").append(e);s.data("img",e)}var c=j(window),t=x.start.top||Math.round(c.height()/2),v=x.start.left||Math.round(c.width()/2);if(u){var w=k(u);t=w[0];v=w[1]}if(!x.start.absolute){t+=c.scrollTop();v+=c.scrollLeft()}e.css({top:t,left:v,width:0,zIndex:x.zIndex}).show();e.animate({top:s.css("top"),left:s.css("left"),width:a},x.speed,function(){s.css("zIndex",x.zIndex+1).fadeIn(x.fadeInSpeed,function(){if(b.isOpened()&&!j(this).index(s)){d.call()}else{s.hide()}})})};var g=function(n){var e=this.getOverlay(),d=this.getConf(),m=this.getTrigger(),a=d.start.top,b=d.start.left;e.hide();if(m){var c=k(m);a=c[0];b=c[1]}e.data("img").animate({top:a,left:b,width:0},d.closeSpeed,n)};f.addEffect("apple",h,g)})(jQuery);(function(b){var a=b.tools.overlay;a.plugins=a.plugins||{};a.plugins.gallery={version:"1.0.0",conf:{imgId:"img",next:".next",prev:".prev",info:".info",progress:".progress",disabledClass:"disabled",activeClass:"active",opacity:0.8,speed:"slow",template:"<strong>${title}</strong> <span>Image ${index} of ${total}</span>",autohide:true,preload:true,api:false}};b.fn.gallery=function(d){var p=b.extend({},a.plugins.gallery.conf),n;b.extend(p,d);n=this.overlay();var s=this,k=n.getOverlay(),l=k.find(p.next),g=k.find(p.prev),e=k.find(p.info),c=k.find(p.progress),j=g.add(l).add(e).css({opacity:p.opacity}),t=n.getClosers(),m;b("#gallery .close-text").css({opacity:p.opacity});var h;function q(v){c.fadeIn();j.hide();t.hide();b("#gallery .close-text").hide();var u=v.attr("href");var w=new Image();w.onload=function(){h="image";c.fadeOut();var z=b("#"+p.imgId,k);if(!z.length){z=b("<img/>").attr("id",p.imgId).css("visibility","hidden");k.prepend(z)}z.attr("src",u).css("visibility","hidden");var A=w.width;var B=(b(window).width()-A)/2;m=s.index(s.filter("[href="+u+"]"));s.removeClass(p.activeClass).eq(m).addClass(p.activeClass);var x=p.disabledClass;j.removeClass(x);if(m===0){g.addClass(x)}if(m==s.length-1){l.addClass(x)}var C=p.template.replace("${title}",v.attr("title")||v.data("title")).replace("${index}",m+1).replace("${total}",s.length);var y=parseInt(e.css("paddingLeft"),10)+parseInt(e.css("paddingRight"),10);e.html(C).css({width:A-y});b("#gallery .close-text").css({width:A-y});k.animate({width:A,height:w.height,left:B},p.speed,function(){z.hide().css("visibility","visible").fadeIn(function(){if(!p.autohide){j.fadeIn();t.show()}})})};w.onerror=function(){h="object";c.fadeOut();var x=b("#"+p.imgId,k);if(x.length){x.remove()}var B=b("<object></object>").attr({height:"344",width:"425",id:p.imgId,wmode:"opaque",type:"application"}).css("visibility","hidden");var C=b('<param name="allowFullScreen" value="true"></param>');var A=b('<param name="allowScriptAccess" value="always"></param>');B.append(C);B.append(A);B.attr("data",u);k.prepend(B);B.css("visibility","hidden");var y=425;var z=(b(window).width()-y)/2;m=s.index(s.filter("[href="+u+"]"));s.removeClass(p.activeClass).eq(m).addClass(p.activeClass);var F=p.disabledClass;j.removeClass(F);if(m===0){g.addClass(F)}if(m==s.length-1){l.addClass(F)}var E=p.template.replace("${title}",v.attr("title")||v.data("title")).replace("${index}",m+1).replace("${total}",s.length);var D=parseInt(e.css("paddingLeft"),10)+parseInt(e.css("paddingRight"),10);e.html(E).css({width:y-D});b("#gallery .close-text").css({width:y-D});k.animate({width:y,height:"378px",left:z},p.speed,function(){B.hide().css("visibility","visible").fadeIn(function(){if(!p.autohide){j.fadeIn();t.show()}})})};w.src=u;if(p.preload){s.filter(":eq("+(m-1)+"), :eq("+(m+1)+")").each(function(){var x=new Image();x.src=b(this).attr("href")})}}function f(u,v){u.click(function(){if(u.hasClass(p.disabledClass)){return}var w=s.eq(i=m+(v?1:-1));if(w.length){q(w)}})}f(l,true);f(g);b(document).keydown(function(u){if(!k.is(":visible")||u.altKey||u.ctrlKey){return}if(u.keyCode==37||u.keyCode==39){var v=u.keyCode==37?g:l;v.click();return u.preventDefault()}return true});function r(){if(!k.is(":animated")){j.show();t.show();b("#gallery .close-text").show()}}if(p.autohide){k.hover(r,function(){j.fadeOut();t.hide();b(".close-text").fadeOut()}).mousemove(r)}var o;this.each(function(){var w=b(this),v=b(this).overlay(),u=v;v.onBeforeLoad(function(){q(w)});v.onClose(function(){s.removeClass(p.activeClass)})});return p.api?o:this}})(jQuery);