/** * RightJS-UI Lightbox v2.2.2 * http://rightjs.org/ui/lightbox * * Copyright (C) 2009-2011 Nikolay Nemshilov */ var Lightbox=RightJS.Lightbox=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||[]);return e}var d=new b.Class(b.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"}),this.dots=[];for(var c=0;c<(a||4);c++)this.dots.push(new b.Element("div"));this.dots[0].addClass("glowing"),this.insert(this.dots),b(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a),this.insert(a,"top")}}}),e=b,f=b.$,g=b.$$,h=b.$w,i=b.$E,j=b.$ext,k=b.Xhr,l=b.Class,m=b.Object,n=b.Element,o=b.Browser;o.IE6=o.OLD&&navigator.userAgent.indexOf("MSIE 6")>0;var p=new c({extend:{version:"2.2.2",EVENTS:h("show hide load"),Options:{fxName:"fade",fxDuration:300,group:null,hideOnEsc:!0,hideOnOutClick:!0,showCloseButton:!0,cssRule:"a[data-lightbox]",mediaWidth:425,mediaHeight:350},i18n:{Close:"Close",Prev:"Previous Image",Next:"Next Image"},Images:/\.(jpg|jpeg|gif|png|bmp)/i,Medias:[[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/i,"$1/v/$2","swf"],[/(http:\/\/video.google.com)\/videoplay\?docid=([^&]+)/i,"$1/googleplayer.swf?docId=$2","swf"],[/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/i,"$1/moogaloop.swf?clip_id=$2","swf"]]},initialize:function(a,b){this.$super("lightbox",{}).setOptions(a,b).insert([this.locker=new q(this.options),this.dialog=new r(this.options)]).on({close:this._close,next:this._next,prev:this._prev})},setOptions:function(a,b){this.$super(a,b);if(b){var c=b.get("rel");c&&(c=c.match(/lightbox\[(.+?)\]/))&&(this.options.group=c[1])}return this},setTitle:function(a){this.dialog.setTitle(a);return this},show:function(a){return this._showAnd(function(){this.dialog.show(a,!a)})},hide:function(){p.current=null;return this.$super(this.options.fxName,{duration:this.options.fxDuration/3,onFinish:e(function(){this.fire("hide"),this.remove()}).bind(this)})},load:function(a,b){return this._showAnd(function(){this.dialog.load(a,b)})},resize:function(a){this.dialog.resize(a);return this},_close:function(a){a.stop(),this.hide()},_prev:function(a){a.stop(),t.prev()},_next:function(a){a.stop(),t.next()},_showAnd:function(b){p.current!==this?(p.current=this,g("div.rui-lightbox").each("remove"),this.insertTo(a.body),this.dialog.show("",!0),o.OLD?(this.reposition(),n.prototype.show.call(this),b.call(this)):(this.setStyle("display:none"),n.prototype.show.call(this,this.options.fxName,{duration:this.options.fxDuration/2,onFinish:e(function(){b.call(this),this.fire("show")}).bind(this)}))):b.call(this);return this},reposition:function(){if(o.IE6){var a=f(window);this.setStyle({top:a.scrolls().y+"px",width:a.size().x+"px",height:a.size().y+"px",position:"absolute"})}}});p.extend({hide:function(){p.current&&p.current.hide()},show:function(){return this.inst("show",arguments)},load:function(){return this.inst("load",arguments)},inst:function(a,b){var c=new p;return c[a].apply(c,b)}});var q=new l(n,{initialize:function(a){this.$super("div",{"class":"rui-lightbox-locker"}),a.hideOnOutClick&&this.onClick("fire","close")}}),r=new l(n,{initialize:function(a){var b=p.i18n;this.options=a,this.$super("div",{"class":"rui-lightbox-dialog"}),this.insert([this.title=i("div",{"class":"rui-lightbox-title"}),i("div",{"class":"rui-lightbox-body"}).insert(i("div",{"class":"rui-lightbox-body-inner"}).insert([this.locker=i("div",{"class":"rui-lightbox-body-locker"}).insert(new d(4)),this.scroller=i("div",{"class":"rui-lightbox-scroller"}).insert(this.content=i("div",{"class":"rui-lightbox-content"}))])),i("div",{"class":"rui-lightbox-navigation"}).insert([this.closeButton=i("div",{"class":"close",html:"×",title:b.Close}).onClick("fire","close"),this.prevLink=i("div",{"class":"prev",html:"←",title:b.Prev}).onClick("fire","prev"),this.nextLink=i("div",{"class":"next",html:"→",title:b.Next}).onClick("fire","next")])]),this.prevLink.hide(),this.nextLink.hide(),a.showCloseButton||this.closeButton.hide()},setTitle:function(a){this.title.update(a||"")},resize:function(a,c){var d=this.parent().size(),f=this.scroller.size(),g=(d.y-this.size().y)/2,h=this.size().x-f.x;a?(a=this.scroller.setStyle(a).size(),this.scroller.setStyle({width:f.x+"px",height:f.y+"px"})):a=this.content.size();var i=100;a.x+i>d.x&&(a.x=d.x-i),a.y+i>d.y&&(a.y=d.y-i);var k=(g*2+f.y-a.y)/2,l=this._.style,m=this.scroller._.style;b.Fx&&c&&(a.x!=f.x||a.y!=f.y)?j(new b.Fx(this,{duration:this.options.fxDuration}),{render:function(b){m.width=f.x+(a.x-f.x)*b+"px",m.height=f.y+(a.y-f.y)*b+"px",l.top=g+(k-g)*b+"px",o.IE6&&(l.width=h+f.y+(a.y-f.y)*b+"px")}}).onFinish(e(this.unlock).bind(this)).start():(m.width=a.x+"px",m.height=a.y+"px",l.top=k+"px",o.IE6&&(l.width=h+a.x+"px"),this.request||this.unlock());return this},show:function(a,b){this.content.update(a||""),this.resize(null,!b)},load:function(a,b){a instanceof n&&(this.setTitle(a.get("title")),a=a.get("href")),t.show(this,a),this.lock().cancel(),this.request=new s(a,b,e(function(a,b){this.request=null,this.show(a,b)}).bind(this));return this.resize()},cancel:function(){this.request&&this.request.cancel();return this},lock:function(){this.locker.setStyle("opacity:1;display:block").insertTo(this.scroller,"before");return this},unlock:function(){this.locker.remove(e(this.content.html()).blank()?null:"fade",{duration:this.options.fxDuration*2/3});return this}}),s=new l({initialize:function(a,b,c){this.isImage(a,c)?p.current.addClass("rui-lightbox-image"):this.isMedia(a,c)?p.current.addClass("rui-lightbox-media"):this.xhr=(new k(a,m.merge({method:"get"},b))).onComplete(function(){c(this.text)}).send()},cancel:function(){this.xhr?this.xhr.cancel():this.img&&(this.img.onload=function(){})},isImage:function(a,b){if(a.match(p.Images)){var c=this.img=i("img")._;c.onload=function(){b(c)},c.src=a;return!0}},isMedia:function(a,b){var c=e(p.Medias).map(function(b){return a.match(b[0])?this.buildEmbed(a.replace(b[0],b[1]),b[2]):null},this).compact()[0];if(c){b(c,!0);return!0}},buildEmbed:function(a,b){var c={swf:["D27CDB6E-AE6D-11cf-96B8-444553540000","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0","application/x-shockwave-flash"]},d=p.current?p.current.options:p.Options,e=' width="'+d.mediaWidth+'" height="'+d.mediaHeight+'"';return'"}}),t={show:function(a,b){if(a.options.group){this.dialog=a,this.links=this.find(a.options.group),this.link=this.links.first(function(a){return a.get("href")===b});var c=this.links.indexOf(this.link),d=this.links.length;a.prevLink[d&&c>0?"show":"hide"](),a.nextLink[d&&c-1})},timeout:function(){this.timer=e(function(){t.timer=null}).delay(300)}};f(a).on({click:function(a){var b=a.find(p.Options.cssRule)||a.find("a[rel^=lightbox]"),c=a._;b&&!(c.shiftKey||c.altKey||c.ctrlKey||c.metaKey)&&(a.stop(),(new p({},b)).load(b))},mousewheel:function(a){if(p.current){var b=a.target,c=b.parent("div.rui-lightbox-content");(!c||b.getStyle("overflow")==="visible")&&a.stop(),p.current.fire((a._.detail||-a._.wheelDelta)<0?"prev":"next")}},keydown:function(a){var b=p.current,c=({27:"close",33:"prev",37:"prev",38:"prev",39:"next",40:"next",34:"next"})[a.keyCode];if(b&&c)if(c!=="close"||b.options.hideOnEsc)a.stop(),b.fire(c)}}),f(window).on({resize:function(){p.current&&(p.current.reposition(),p.current.dialog.resize())},scroll:function(a){p.current&&o.IE6&&p.current.reposition()}});var u=a.createElement("style"),v=a.createTextNode("div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-lightbox{position:fixed;top:0;left:0;float:none;width:100%;height:100%;margin:0;padding:0;background:none;border:none;text-align:center;z-index:9999;z-index/*\\**/:auto\\9}div.rui-lightbox-locker{position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#000;opacity:0.8;filter:alpha(opacity=80);cursor:default;z-index/*\\**/:9990\\9}div.rui-lightbox-dialog{display:inline-block; *display:inline; *zoom:1;position:relative;text-align:left;z-index/*\\**/:9999\\9}div.rui-lightbox-title{height:1.2em;margin-bottom:.1em;white-space:nowrap;color:#DDD;font-weight:bold;font-size:1.6em;font-family:Helvetica}div.rui-lightbox-body{background-color:#FFF;padding:1em;border-radius:.5em;-moz-border-radius:.5em;-webkit-border-radius:.5em}div.rui-lightbox-body-inner{position:relative}div.rui-lightbox-scroller{overflow:hidden}div.rui-lightbox-content{display:inline-block; *display:inline; *zoom:1;min-height:10em;min-width:10em;_height:10em;_width:10em}div.rui-lightbox-body-locker{background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;opacity:0;filter:alpha(opacity=0)}div.rui-lightbox-body-locker div.rui-spinner{position:absolute;right:0;bottom:0;border:none;background:none;font-size:150%}div.rui-lightbox-navigation{color:#888;font-size:160%;font-family:Arial;height:1em;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-lightbox-navigation div{cursor:pointer;position:absolute}div.rui-lightbox-navigation div:hover{color:white}div.rui-lightbox-navigation div.next{left:2em}div.rui-lightbox-navigation div.close{right:0}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body{padding:0;border:1px solid #777;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px}div.rui-lightbox-image div.rui-lightbox-content,div.rui-lightbox-media div.rui-lightbox-content{min-height:12em;min-width:12em;_height:12em;_width:12em}div.rui-lightbox-image div.rui-lightbox-content img{vertical-align:middle}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-image div.rui-lightbox-body-locker,div.rui-lightbox-media div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body-locker{background-color:#D8D8D8}div.rui-lightbox-image div.rui-lightbox-body-locker div.rui-spinner,div.rui-lightbox-media div.rui-lightbox-body-locker div.rui-spinner{bottom:.5em;right:.5em}");u.type="text/css",a.getElementsByTagName("head")[0].appendChild(u),u.styleSheet?u.styleSheet.cssText=v.nodeValue:u.appendChild(v);return p}(document,RightJS)