//f58ba3f3683bbfc661f0deb0b2ea96bf
var SqueezeBox={presets:{onOpen:$empty,onClose:$empty,onUpdate:$empty,onResize:$empty,onMove:$empty,onShow:$empty,onHide:$empty,size:{x:600,y:450},sizeLoading:{x:200,y:150},marginInner:{x:20,y:20},marginImage:{x:50,y:75},handler:false,target:null,closable:true,closeBtn:true,zIndex:65555,overlayOpacity:0.7,classWindow:"",classOverlay:"",overlayFx:{},resizeFx:{},contentFx:{},parse:false,parseSecure:false,shadow:true,document:null,ajaxOptions:{}},initialize:function(A){if(this.options){return this}this.presets=$merge(this.presets,A);this.doc=this.presets.document||document;this.options={};this.setOptions(this.presets).build();this.bound={window:this.reposition.bind(this,[null]),scroll:this.checkTarget.bind(this),close:this.close.bind(this),key:this.onKey.bind(this)};this.isOpen=this.isLoading=false;return this},build:function(){this.overlay=new Element("div",{id:"sbox-overlay",styles:{display:"none",zIndex:this.options.zIndex}});this.win=new Element("div",{id:"sbox-window",styles:{display:"none",zIndex:this.options.zIndex+2}});if(this.options.shadow){if(Browser.Engine.webkit420){this.win.setStyle("-webkit-box-shadow","0 0 10px rgba(0, 0, 0, 0.7)")}else{if(!Browser.Engine.trident4){var B=new Element("div",{"class":"sbox-bg-wrap"}).inject(this.win);var A=function(C){this.overlay.fireEvent("click",[C])}.bind(this);["n","ne","e","se","s","sw","w","nw"].each(function(C){new Element("div",{"class":"sbox-bg sbox-bg-"+C}).inject(B).addEvent("click",A)})}}}this.content=new Element("div",{id:"sbox-content"}).inject(this.win);this.closeBtn=new Element("a",{id:"sbox-btn-close",href:"#"}).inject(this.win);this.fx={overlay:new Fx.Tween(this.overlay,$merge({property:"opacity",onStart:Events.prototype.clearChain,duration:250,link:"cancel"},this.options.overlayFx)).set(0),win:new Fx.Morph(this.win,$merge({onStart:Events.prototype.clearChain,unit:"px",duration:750,transition:Fx.Transitions.Quint.easeOut,link:"cancel",unit:"px"},this.options.resizeFx)),content:new Fx.Tween(this.content,$merge({property:"opacity",duration:250,link:"cancel"},this.options.contentFx)).set(0)};$(this.doc.body).adopt(this.overlay,this.win)},assign:function(B,A){return B.addEvent("click",function(){return !SqueezeBox.fromElement(this,A)})},fromElement:function(E,B){this.initialize();if(this.element){this.trash()}this.element=$(E);this.setOptions($merge(this.presets,B||{}));if(this.element&&this.options.parse){var D=this.element.getProperty(this.options.parse);if(D&&(D=JSON.decode(D,this.options.parseSecure))){this.setOptions(D)}}this.assignOptions();this.url=((this.element)?(this.options.url||this.element.get("href")):E)||"";var C=this.options.handler;if(C){return this.setContent(C,this.parsers[C].call(this,true))}var A=false;this.parsers.some(function(H,F){var G=H.call(this);if(G){A=this.setContent(F,G);return true}return false},this);return A},assignOptions:function(){this.overlay.set("class",this.options.classOverlay);this.win.set("class",this.options.classWindow);if(Browser.Engine.trident4){this.win.addClass("sbox-window-ie6")}},close:function(B){var A=($type(B)=="event");if(A){B.stop()}if(!this.isOpen||(A&&!$lambda(this.options.closable).call(this,B))){return this}this.fx.overlay.start(0).chain(this.toggleOverlay.bind(this));this.win.setStyle("display","none");this.fireEvent("onClose",[this.content]);this.trash();this.toggleListeners();this.isOpen=false;return this},trash:function(){this.element=this.asset=null;this.content.empty();this.options={};this.removeEvents().setOptions(this.presets).callChain()},onError:function(){this.asset=null;this.setContent("string",this.options.errorMsg||"An error occurred")},setContent:function(A,B){if(!this.handlers[A]){return false}this.content.className="sbox-content-"+A;this.applyTimer=this.applyContent.delay(this.fx.overlay.options.duration,this,this.handlers[A].call(this,B));if(this.overlay.retrieve("opacity")){return this}this.toggleOverlay(true);this.fx.overlay.start(this.options.overlayOpacity);return this.reposition()},applyContent:function(B,A){if(!this.isOpen&&!this.applyTimer){return }this.applyTimer=$clear(this.applyTimer);this.hideContent();if(!B){this.toggleLoading(true)}else{if(this.isLoading){this.toggleLoading(false)}this.fireEvent("onUpdate",[this.content],20)}if(B){if(["string","array"].contains($type(B))){this.content.set("html",B)}else{if(!this.content.hasChild(B)){this.content.adopt(B)}}}this.callChain();if(!this.isOpen){this.toggleListeners(true);this.resize(A,true);this.isOpen=true;this.fireEvent("onOpen",[this.content])}else{this.resize(A)}},resize:function(C,B){this.showTimer=$clear(this.showTimer||null);var D=this.doc.getSize(),A=this.doc.getScroll();this.size=$merge((this.isLoading)?this.options.sizeLoading:this.options.size,C);var E={width:this.size.x,height:this.size.y,left:(A.x+(D.x-this.size.x-this.options.marginInner.x)/2).toInt(),top:(A.y+(D.y-this.size.y-this.options.marginInner.y)/2).toInt()};this.hideContent();if(!B){this.fx.win.start(E).chain(this.showContent.bind(this))}else{this.win.setStyles(E).setStyle("display","");this.showTimer=this.showContent.delay(50,this)}return this.reposition()},toggleListeners:function(B){var A=(B)?"addEvent":"removeEvent";this.closeBtn[A]("click",this.bound.close);this.overlay[A]("click",this.bound.close);this.doc[A]("keydown",this.bound.key)[A]("mousewheel",this.bound.scroll);this.doc.getWindow()[A]("resize",this.bound.window)[A]("scroll",this.bound.window)},toggleLoading:function(A){this.isLoading=A;this.win[(A)?"addClass":"removeClass"]("sbox-loading");if(A){this.fireEvent("onLoading",[this.win])}},toggleOverlay:function(B){var A=this.doc.getSize().x;this.overlay.setStyle("display",(B)?"":"none");this.doc.body[(B)?"addClass":"removeClass"]("body-overlayed");if(B){this.scrollOffset=this.doc.getWindow().getSize().x-A;this.doc.body.setStyle("margin-right",this.scrollOffset)}else{this.doc.body.setStyle("margin-right","")}},showContent:function(){if(this.content.get("opacity")){this.fireEvent("onShow",[this.win])}this.fx.content.start(1)},hideContent:function(){if(!this.content.get("opacity")){this.fireEvent("onHide",[this.win])}this.fx.content.cancel().set(0)},onKey:function(A){switch(A.key){case"esc":this.close(A);case"up":case"down":return false}},checkTarget:function(A){return this.content.hasChild(A.target)},reposition:function(){var C=this.doc.getSize(),A=this.doc.getScroll(),B=this.doc.getScrollSize();this.overlay.setStyles({width:B.x+"px",height:B.y+"px"});this.win.setStyles({left:(A.x+(C.x-this.win.offsetWidth)/2-this.scrollOffset).toInt()+"px",top:(A.y+(C.y-this.win.offsetHeight)/2).toInt()+"px"});return this.fireEvent("onMove",[this.overlay,this.win])},removeEvents:function(A){if(!this.$events){return this}if(!A){this.$events=null}else{if(this.$events[A]){this.$events[A]=null}}return this},extend:function(A){return $extend(this,A)},handlers:new Hash(),parsers:new Hash()};SqueezeBox.extend(new Events($empty)).extend(new Options($empty)).extend(new Chain($empty));SqueezeBox.parsers.extend({image:function(A){var B=this.url.split(/\?/)[0];return(A||(/\.(?:jpe?g|png|gif)$/i).test(B))?B:false},clone:function(A){if($(this.options.target)){return $(this.options.target)}if(this.element&&!this.element.parentNode){return this.element}var B=this.url.match(/#([\w-]+)$/);return(B)?$(B[1]):(A?this.element:false)},ajax:function(A){return(A||(this.url&&!(/^(?:javascript|#)/i).test(this.url)))?this.url:false},iframe:function(A){return(A||this.url)?this.url:false},string:function(A){return true}});SqueezeBox.handlers.extend({image:function(A){var C,B=new Image();this.asset=null;B.onload=B.onabort=B.onerror=(function(){B.onload=B.onabort=B.onerror=null;if(!B.width){this.onError.delay(10,this);return }var E=this.doc.getSize();E.x-=this.options.marginImage.x;E.y-=this.options.marginImage.y;C={x:B.width,y:B.height};for(var D=2;D--;){if(C.x>E.x){C.y*=E.x/C.x;C.x=E.x}else{if(C.y>E.y){C.x*=E.y/C.y;C.y=E.y}}}C.x=C.x.toInt();C.y=C.y.toInt();this.asset=$(B);B=null;this.asset.width=C.x;this.asset.height=C.y;this.applyContent(this.asset,C)}).bind(this);B.src=A;if(B&&B.onload&&B.complete){B.onload()}return(this.asset)?[this.asset,C]:null},clone:function(A){if(A){return A.clone()}return this.onError()},adopt:function(A){if(A){return A}return this.onError()},ajax:function(A){this.asset=new Request.HTML($merge({method:"get"},this.options.ajaxOptions)).addEvents({onSuccess:function(B){this.applyContent(B);this.fireEvent("onAjax",[B,this.asset]);this.asset=null}.bind(this),onFailure:this.onError.bind(this)});this.asset.send.delay(10,this.asset,[{url:A}])},iframe:function(A){this.asset=new Element("iframe",$merge({src:A,frameBorder:0,width:this.options.size.x,height:this.options.size.y},this.options.iframeOptions));if(this.options.iframePreload){this.asset.addEvent("load",function(){this.applyContent(this.asset.setStyle("display",""))}.bind(this));this.asset.setStyle("display","none").inject(this.content);return false}return this.asset},string:function(A){return A}});SqueezeBox.handlers.url=SqueezeBox.handlers.ajax;SqueezeBox.parsers.url=SqueezeBox.parsers.ajax;SqueezeBox.parsers.adopt=SqueezeBox.parsers.clone;