var Helpers=Helpers||{};Helpers.Base=Class.create({initialize:function(){this.boundFuncs={};this.options={}},bound:function(B,A){if(this.boundFuncs[B]){return this.boundFuncs[B]}if(this[B]){this.boundFuncs[B]=A?this[B].bindAsEventListener(this):this[B].bind(this)}else{throw new Error("The function "+B+" cannot be bound, because it is not a method on this class")}return this.boundFuncs[B]},listener:function(A){return this.bound(A,true)},setOptions:function(B,A){this.options=A;for(var C in B){this.options[C]=B[C]}}});var Behaviours=Behaviours||{};Behaviours.Popup=Class.create({initialize:function(B,A,C){this.links=B;this.windowName=A;this.options=C;this.setup()},setup:function(){this._processOptions();this.links.invoke("observe","click",this.linkOnClick.bindAsEventListener(this))},destroy:function(){this.links.invoke("stopObserving")},linkOnClick:function(A){if(link=Event.element(A).match("a")?Event.element(A):Event.element(A).up("a")){this.window=window.open(link.href,this.windowName,this.options);this.window.focus()}A.stop()},_processOptions:function(){var C;var B;var A;C=this.options.match(/width=([\d]+)/);if(C){B=parseInt(C[1]);this.options=this.options.replace(/left\=c/,"left="+((screen.availWidth-B)/2))}C=this.options.match(/height=([\d]+)/);if(C){A=parseInt(C[1]);this.options=this.options.replace(/top\=c/,"top="+((screen.availHeight-A)/2))}}});