if(typeof(Draggable)!="undefined"){Draggable.prototype.draw=function(j){var i=Position.cumulativeOffset(this.element);
if(this.options.ghosting){var a=Position.realOffset(this.element);
i[0]+=a[0]-Position.deltaX;
i[1]+=a[1]-Position.deltaY
}var h=this.currentDelta();
i[0]-=h[0];
i[1]-=h[1];
if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){i[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;
i[1]-=this.options.scroll.scrollTop-this.originalScrollTop
}var c=[0,1].map(function(d){return(j[d]-i[d]-this.offset[d])
}.bind(this));
if(this.options.snap){if(typeof this.options.snap=="function"){c=this.options.snap(c[0],c[1],this)
}else{if(this.options.snap instanceof Array){c=c.map(function(d,m){return Math.round(d/this.options.snap[m])*this.options.snap[m]
}.bind(this))
}else{c=c.map(function(d){return Math.round(d/this.options.snap)*this.options.snap
}.bind(this))
}}}if(this.options.onDraw){this.options.onDraw.bind(this)(c)
}else{var b=this.element.style;
if(this.options.constrainToViewport){var l=document.viewport.getDimensions();
var f=this.element.getDimensions();
var g=parseInt(this.element.getStyle("margin-top"));
var k=parseInt(this.element.getStyle("margin-left"));
var e=[[0-k,0-g],[(l.width-f.width)-k,(l.height-f.height)-g]];
if((!this.options.constraint)||(this.options.constraint=="horizontal")){if((c[0]>=e[0][0])&&(c[0]<=e[1][0])){this.element.style.left=c[0]+"px"
}else{this.element.style.left=((c[0]<e[0][0])?e[0][0]:e[1][0])+"px"
}}if((!this.options.constraint)||(this.options.constraint=="vertical")){if((c[1]>=e[0][1])&&(c[1]<=e[1][1])){this.element.style.top=c[1]+"px"
}else{this.element.style.top=((c[1]<=e[0][1])?e[0][1]:e[1][1])+"px"
}}}else{if((!this.options.constraint)||(this.options.constraint=="horizontal")){b.left=c[0]+"px"
}if((!this.options.constraint)||(this.options.constraint=="vertical")){b.top=c[1]+"px"
}}if(b.visibility=="hidden"){b.visibility=""
}}}
}if(typeof(Prototype)=="undefined"){throw"Control.Window requires Prototype to be loaded."
}if(typeof(IframeShim)=="undefined"){throw"Control.Window requires IframeShim to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.Window requires Object.Event to be loaded."
}Control.Window=Class.create({initialize:function(b,c){Control.Window.windows.push(this);
this.container=false;
this.isOpen=false;
this.href=false;
this.sourceContainer=false;
this.ajaxRequest=false;
this.remoteContentLoaded=false;
this.numberInSequence=Control.Window.windows.length+1;
this.indicator=false;
this.effects={fade:false,appear:false};
this.indicatorEffects={fade:false,appear:false};
this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:"center",offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:true,fade:false,fadeDuration:0.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,method:"post",parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},c||{});
this.indicator=this.options.indicator?$(this.options.indicator):false;
if(b){if(typeof(b)=="string"&&b.match(Control.Window.uriRegex)){this.href=b
}else{this.container=$(b);
this.createDefaultContainer(b);
if(this.container&&((this.container.readAttribute("href")&&this.container.readAttribute("href")!="")||(this.options.hover&&this.options.hover!==true))){if(this.options.hover&&this.options.hover!==true){this.sourceContainer=$(this.options.hover)
}else{this.sourceContainer=this.container;
this.href=this.container.readAttribute("href");
var a=this.href.match(/^#(.+)$/);
if(a&&a[1]){this.container=$(a[1]);
this.href=false
}else{this.container=false
}}this.sourceContainerOpenHandler=function(e){this.open(e);
e.stop();
return false
}.bindAsEventListener(this);
this.sourceContainerCloseHandler=function(e){this.close(e)
}.bindAsEventListener(this);
this.sourceContainerMouseMoveHandler=function(e){this.position(e)
}.bindAsEventListener(this);
if(this.options.hover){this.sourceContainer.observe("mouseenter",this.sourceContainerOpenHandler);
this.sourceContainer.observe("mouseleave",this.sourceContainerCloseHandler);
if(this.options.position=="mouse"){this.sourceContainer.observe("mousemove",this.sourceContainerMouseMoveHandler)
}}else{this.sourceContainer.observe("click",this.sourceContainerOpenHandler)
}}}}this.createDefaultContainer(b);
if(this.options.insertRemoteContentAt===false){this.options.insertRemoteContentAt=this.container
}var d={margin:0,position:"absolute",zIndex:Control.Window.initialZIndexForWindow()};
if(this.options.width){d.width=$value(this.options.width)+"px"
}if(this.options.height){d.height=$value(this.options.height)+"px"
}this.container.setStyle(d);
if(this.options.className){this.container.addClassName(this.options.className)
}this.positionHandler=this.position.bindAsEventListener(this);
this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);
this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);
this.container.observe("mousedown",this.bringToFrontHandler);
this.container.hide();
this.closeHandler=this.close.bindAsEventListener(this);
if(this.options.iframeshim){this.iFrameShim=new IframeShim();
this.iFrameShim.hide()
}this.applyResizable();
this.applyDraggable();
Event.observe(window,"resize",this.outOfBoundsPositionHandler);
this.notify("afterInitialize")
},open:function(c){if(this.isOpen){this.bringToFront();
return false
}if(this.notify("beforeOpen")===false){return false
}if(this.options.closeOnClick){if(this.options.closeOnClick===true){this.closeOnClickContainer=$(document.body)
}else{if(this.options.closeOnClick=="container"){this.closeOnClickContainer=this.container
}else{if(this.options.closeOnClick=="overlay"){Control.Overlay.load();
this.closeOnClickContainer=Control.Overlay.container
}else{this.closeOnClickContainer=$(this.options.closeOnClick)
}}}this.closeOnClickContainer.observe("click",this.closeHandler)
}if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;
if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var a=new Element("img");
a.observe("load",function(d){this.getRemoteContentInsertionTarget().insert(d);
this.position();
if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()
}this.finishOpen()
}}.bind(this,a));
a.writeAttribute("src",this.href)
}else{if(!this.ajaxRequest){if(this.options.indicator){this.showIndicator()
}this.ajaxRequest=new Ajax.Request(this.href,{method:this.options.method,parameters:this.options.parameters,onComplete:function(d){this.notify("onComplete",d);
this.ajaxRequest=false
}.bind(this),onSuccess:function(d){this.getRemoteContentInsertionTarget().insert(d.responseText);
this.notify("onSuccess",d);
if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()
}this.finishOpen()
}}.bind(this),onFailure:function(d){this.notify("onFailure",d);
if(this.options.indicator){this.hideIndicator()
}}.bind(this),onException:function(d,f){this.notify("onException",d,f);
if(this.options.indicator){this.hideIndicator()
}}.bind(this)})
}}return true
}else{if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;
if(this.options.indicator){this.showIndicator()
}this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));
var b=this.container.down("iframe");
b.onload=function(){this.notify("onRemoteContentLoaded");
if(this.options.indicator){this.hideIndicator()
}b.onload=null
}.bind(this)
}}this.finishOpen(c);
return true
},close:function(a){if(!this.isOpen||this.notify("beforeClose",a)===false){return false
}if(this.options.closeOnClick){this.closeOnClickContainer.stopObserving("click",this.closeHandler)
}if(this.options.fade){this.effects.fade=new Effect.Fade(this.container,{queue:{position:"front",scope:"Control.Window"+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.iFrameShim.hide()
}this.isOpen=false;
this.notify("afterClose")
}.bind(this)})
}else{this.container.hide();
if(this.iFrameShim){this.iFrameShim.hide()
}}if(this.ajaxRequest){this.ajaxRequest.transport.abort()
}if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.stopObserving(window,"resize",this.positionHandler)
}if(!this.options.draggable&&this.options.position=="center"){Event.stopObserving(window,"scroll",this.positionHandler)
}if(this.options.indicator){this.hideIndicator()
}if(!this.options.fade){this.isOpen=false;
this.notify("afterClose")
}return true
},position:function(d){if(this.options.position=="mouse"){var g=[Event.pointerX(d),Event.pointerY(d)];
this.container.setStyle({top:g[1]+$value(this.options.offsetTop)+"px",left:g[0]+$value(this.options.offsetLeft)+"px"});
return
}var h=this.container.getDimensions();
var c=document.viewport.getDimensions();
Position.prepare();
var b=(Position.deltaX+Math.floor((c.width-h.width)/2));
var a=(Position.deltaY+((c.height>h.height)?Math.floor((c.height-h.height)/2):0));
if(this.options.position=="center"){this.container.setStyle({top:(h.height<=c.height)?((a!=null&&a>0)?a:0)+"px":0,left:(h.width<=c.width)?((b!=null&&b>0)?b:0)+"px":0})
}else{if(this.options.position=="relative"){var g=this.sourceContainer.cumulativeOffset();
var f=g[1]+$value(this.options.offsetTop);
var e=g[0]+$value(this.options.offsetLeft);
this.container.setStyle({top:(h.height<=c.height)?(this.options.constrainToViewport?Math.max(0,Math.min(c.height-(h.height),f)):f)+"px":0,left:(h.width<=c.width)?(this.options.constrainToViewport?Math.max(0,Math.min(c.width-(h.width),e)):e)+"px":0})
}else{if(this.options.position.length){var f=$value(this.options.position[1])+$value(this.options.offsetTop);
var e=$value(this.options.position[0])+$value(this.options.offsetLeft);
this.container.setStyle({top:(h.height<=c.height)?(this.options.constrainToViewport?Math.max(0,Math.min(c.height-(h.height),f)):f)+"px":0,left:(h.width<=c.width)?(this.options.constrainToViewport?Math.max(0,Math.min(c.width-(h.width),e)):e)+"px":0})
}}}if(this.iFrameShim){this.updateIFrameShimZIndex()
}},ensureInBounds:function(){if(!this.isOpen){return
}var a=document.viewport.getDimensions();
var c=this.container.cumulativeOffset();
var b=this.container.getDimensions();
if(c.left+b.width>a.width){this.container.setStyle({left:(Math.max(0,a.width-b.width))+"px"})
}if(c.top+b.height>a.height){this.container.setStyle({top:(Math.max(0,a.height-b.height))+"px"})
}},bringToFront:function(){Control.Window.bringToFront(this);
this.notify("bringToFront")
},destroy:function(){this.container.stopObserving("mousedown",this.bringToFrontHandler);
if(this.draggable){Draggables.removeObserver(this.container);
this.draggable.handle.stopObserving("mousedown",this.bringToFrontHandler);
this.draggable.destroy()
}if(this.resizable){Resizables.removeObserver(this.container);
this.resizable.handle.stopObserving("mousedown",this.bringToFrontHandler);
this.resizable.destroy()
}if(this.container&&!this.sourceContainer){this.container.remove()
}if(this.sourceContainer){if(this.options.hover){this.sourceContainer.stopObserving("mouseenter",this.sourceContainerOpenHandler);
this.sourceContainer.stopObserving("mouseleave",this.sourceContainerCloseHandler);
if(this.options.position=="mouse"){this.sourceContainer.stopObserving("mousemove",this.sourceContainerMouseMoveHandler)
}}else{this.sourceContainer.stopObserving("click",this.sourceContainerOpenHandler)
}}if(this.iFrameShim){this.iFrameShim.destroy()
}Event.stopObserving(window,"resize",this.outOfBoundsPositionHandler);
Control.Window.windows=Control.Window.windows.without(this);
this.notify("afterDestroy")
},applyResizable:function(){if(this.options.resizable){if(typeof(Resizable)=="undefined"){throw"Control.Window requires resizable.js to be loaded."
}var a=null;
if(this.options.resizable===true){a=new Element("div",{className:"resizable_handle"});
this.container.insert(a)
}else{a=$(this.options.resziable)
}this.resizable=new Resizable(this.container,{handle:a,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(b){return(document.viewport.getDimensions().height-parseInt(b.style.top||0))-(b.getHeight()-parseInt(b.style.height||0))
}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(b){return(document.viewport.getDimensions().width-parseInt(b.style.left||0))-(b.getWidth()-parseInt(b.style.width||0))
}:this.options.maxWidth});
this.resizable.handle.observe("mousedown",this.bringToFrontHandler);
Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()
}this.notify("onResize")
}.bind(this)))
}},applyDraggable:function(){if(this.options.draggable){if(typeof(Draggables)=="undefined"){throw"Control.Window requires dragdrop.js to be loaded."
}var a=null;
if(this.options.draggable===true){a=new Element("div",{className:"draggable_handle"});
this.container.insert(a)
}else{a=$(this.options.draggable)
}this.draggable=new Draggable(this.container,{handle:a,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle("z-index"),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;
document.onselectstart=function(){return false
}
}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart
}.bind(this)});
this.draggable.handle.observe("mousedown",this.bringToFrontHandler);
Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()
}this.notify("onDrag")
}.bind(this)))
}},createDefaultContainer:function(a){if(!this.container){this.container=new Element("div",{id:"control_window_"+this.numberInSequence});
$(document.body).insert(this.container);
if(typeof(a)=="string"&&$(a)==null&&!a.match(/^#(.+)$/)&&!a.match(Control.Window.uriRegex)){this.container.update(a)
}}},finishOpen:function(a){this.bringToFront();
if(this.options.fade){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."
}if(this.effects.fade){this.effects.fade.cancel()
}this.effects.appear=new Effect.Appear(this.container,{queue:{position:"end",scope:"Control.Window."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.updateIFrameShimZIndex()
}this.isOpen=true;
this.notify("afterOpen")
}.bind(this)})
}else{this.container.show()
}this.position(a);
if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.observe(window,"resize",this.positionHandler,false)
}if(!this.options.draggable&&this.options.position=="center"){Event.observe(window,"scroll",this.positionHandler,false)
}if(!this.options.fade){this.isOpen=true;
this.notify("afterOpen")
}return true
},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade){this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:"front",scope:"Control.Window.indicator."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2})
}else{this.indicator.show()
}}.bind(this),Control.Window.indicatorTimeout)
},hideIndicator:function(){if(this.showIndicatorTimeout){window.clearTimeout(this.showIndicatorTimeout)
}this.indicator.hide()
},getRemoteContentInsertionTarget:function(){return typeof(this.options.insertRemoteContentAt)=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt)
},updateIFrameShimZIndex:function(){if(this.iFrameShim){this.iFrameShim.positionUnder(this.container)
}}});
Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(a){Control.Window.windows=Control.Window.windows.without(a);
Control.Window.windows.push(a);
Control.Window.windows.each(function(c,d){var b=Control.Window.baseZIndex+d;
c.container.setStyle({zIndex:b});
if(c.isOpen){if(c.iFrameShim){c.updateIFrameShimZIndex()
}}if(c.options.draggable){c.draggable.options.zindex=b
}})
},open:function(b,c){var a=new Control.Window(b,c);
a.open();
return a
},initialZIndexForWindow:function(a){return Control.Window.baseZIndex+(Control.Window.windows.length-1)
}});
Object.Event.extend(Control.Window);
Control.Window.LayoutUpdateObserver=Class.create({initialize:function(a,b){this.w=a;
this.element=$(a.container);
this.observer=b
},onStart:Prototype.emptyFunction,onEnd:function(b,a){if(a.element==this.element&&this.iFrameShim){this.w.updateIFrameShimZIndex()
}},onResize:function(b,a){if(a.element==this.element){this.observer(this.element)
}},onDrag:function(b,a){if(a.element==this.element){this.observer(this.element)
}}});
Control.Overlay={id:"control_overlay",loaded:false,container:false,lastOpacity:0,styles:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:9998},ieStyles:{position:"absolute",top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded){return false
}Control.Overlay.loaded=true;
Control.Overlay.container=new Element("div",{id:Control.Overlay.id});
$(document.body).insert(Control.Overlay.container);
if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);
Event.observe(window,"scroll",Control.Overlay.positionOverlay);
Event.observe(window,"resize",Control.Overlay.positionOverlay);
Control.Overlay.observe("beforeShow",Control.Overlay.positionOverlay)
}else{Control.Overlay.container.setStyle(Control.Overlay.styles)
}Control.Overlay.iFrameShim=new IframeShim();
Control.Overlay.iFrameShim.hide();
Event.observe(window,"resize",Control.Overlay.positionIFrameShim);
Control.Overlay.container.hide();
return true
},unload:function(){if(!Control.Overlay.loaded){return false
}Event.stopObserving(window,"resize",Control.Overlay.positionOverlay);
Control.Overlay.stopObserving("beforeShow",Control.Overlay.positionOverlay);
Event.stopObserving(window,"resize",Control.Overlay.positionIFrameShim);
Control.Overlay.iFrameShim.destroy();
Control.Overlay.container.remove();
Control.Overlay.loaded=false;
return true
},show:function(a,b){if(Control.Overlay.notify("beforeShow")===false){return false
}Control.Overlay.lastOpacity=a;
Control.Overlay.positionIFrameShim();
Control.Overlay.iFrameShim.show();
if(b){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."
}if(Control.Overlay.effects.fade){Control.Overlay.effects.fade.cancel()
}Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:"end",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterShow")
},from:0,to:Control.Overlay.lastOpacity,duration:(b===true?0.75:b)/2})
}else{Control.Overlay.container.setStyle({opacity:a||1});
Control.Overlay.container.show();
Control.Overlay.notify("afterShow")
}return true
},hide:function(a){if(Control.Overlay.notify("beforeHide")===false){return false
}if(Control.Overlay.effects.appear){Control.Overlay.effects.appear.cancel()
}Control.Overlay.iFrameShim.hide();
if(a){Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:"front",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterHide")
},from:Control.Overlay.lastOpacity,to:0,duration:(a===true?0.75:a)/2})
}else{Control.Overlay.container.hide();
Control.Overlay.notify("afterHide")
}return true
},positionIFrameShim:function(){if(Control.Overlay.container.visible()){Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container)
}},positionOverlay:function(){Control.Overlay.container.setStyle({width:document.body.clientWidth+"px",height:document.body.clientHeight+"px"})
}};
Object.Event.extend(Control.Overlay);
Control.ToolTip=Class.create(Control.Window,{initialize:function($super,a,c,b){$super(c,Object.extend(Object.extend(Object.clone(Control.ToolTip.defaultOptions),b||{}),{position:"mouse",hover:a}))
}});
Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});
Control.Modal=Class.create(Control.Window,{initialize:function($super,a,b){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();
$super(a,Object.extend(Object.clone(Control.Modal.defaultOptions),b||{}))
}});
Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:0.5,closeOnClick:"overlay"},current:false,open:function(a,b){var c=new Control.Modal(a,b);
c.open();
return c
},close:function(){if(Control.Modal.current){Control.Modal.current.close()
}},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();
this.overlayFinishedOpening=false;
this.observe("beforeOpen",Control.Modal.Observers.beforeOpen.bind(this));
this.observe("afterOpen",Control.Modal.Observers.afterOpen.bind(this));
this.observe("afterClose",Control.Modal.Observers.afterClose.bind(this))
}},Observers:{beforeOpen:function(){if(!this.overlayFinishedOpening){Control.Overlay.observeOnce("afterShow",function(){this.overlayFinishedOpening=true;
this.open()
}.bind(this));
Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);
throw $break
}else{Control.Window.windows.without(this).invoke("close")
}},afterOpen:function(){Control.Modal.current=this
},afterClose:function(){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);
Control.Modal.current=false;
this.overlayFinishedOpening=false
}}});
Control.LightBox=Class.create(Control.Window,{initialize:function($super,a,b){this.allImagesLoaded=false;
if(b.modal){var b=Object.extend(Object.clone(Control.LightBox.defaultOptions),b||{});
b=Object.extend(Object.clone(Control.Modal.defaultOptions),b);
b=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(b);
$super(a,b)
}else{$super(a,Object.extend(Object.clone(Control.LightBox.defaultOptions),b||{}))
}this.hasRemoteContent=this.href&&!this.options.iframe;
if(this.hasRemoteContent){this.observe("onRemoteContentLoaded",Control.LightBox.Observers.onRemoteContentLoaded.bind(this))
}else{this.applyImageObservers()
}this.observe("beforeOpen",Control.LightBox.Observers.beforeOpen.bind(this))
},applyImageObservers:function(){var a=this.getImages();
this.numberImagesToLoad=a.length;
this.numberofImagesLoaded=0;
a.each(function(b){b.observe("load",function(c){++this.numberofImagesLoaded;
if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;
this.onAllImagesLoaded()
}}.bind(this,b));
b.hide()
}.bind(this))
},onAllImagesLoaded:function(){this.getImages().each(function(a){this.showImage(a)
}.bind(this));
if(this.hasRemoteContent){if(this.options.indicator){this.hideIndicator()
}this.finishOpen()
}else{this.open()
}},getImages:function(){return this.container.select(Control.LightBox.imageSelector)
},showImage:function(a){a.show()
}});
Object.extend(Control.LightBox,{imageSelector:"img",defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded){throw $break
}},onRemoteContentLoaded:function(){this.applyImageObservers();
if(!this.allImagesLoaded){throw $break
}}}});
