Effect.OpenUp=function(a){a=$(a);new Effect.BlindDown(a,arguments[1]||{})};Effect.CloseDown=function(a){a=$(a);new Effect.BlindUp(a,arguments[1]||{})};Effect.Combo=function(a){a=$(a);if(a.style.display=="none"){new Effect.OpenUp(a,arguments[1]||{})}else{new Effect.CloseDown(a,arguments[1]||{})}};Glider=Class.create();Object.extend(Object.extend(Glider.prototype,Abstract.prototype),{initialize:function(b,a){this.scrolling=false;this.wrapper=$(b);this.scroller=this.wrapper.down("div.scroller");this.sections=this.wrapper.getElementsBySelector("div.section");this.options=Object.extend({duration:1,frequency:3},a||{});this.sections.each(function(d,c){d._index=c});this.events={click:this.click.bind(this)};this.addObservers();if(this.options.initialSection){this.moveTo(this.options.initialSection,this.scroller,{duration:this.options.duration})}if(this.options.autoGlide){this.start()}},addObservers:function(){var a=this.wrapper.getElementsBySelector("div.controls a");a.invoke("observe","click",this.events.click)},click:function(b){this.stop();var a=Event.findElement(b,"a");if(this.scrolling){this.scrolling.cancel()}this.moveTo(a.href.split("#")[1],this.scroller,{duration:this.options.duration});Event.stop(b)},moveTo:function(d,a,c){this.current=$(d);Position.prepare();var e=Position.cumulativeOffset(a),b=Position.cumulativeOffset($(d));this.scrolling=new Effect.SmoothScroll(a,{duration:c.duration,x:(b[0]-e[0]),y:(b[1]-e[1])});return false},next:function(){if(this.current){var b=this.current._index;var a=(this.sections.length-1==b)?0:b+1}else{var a=1}this.moveTo(this.sections[a],this.scroller,{duration:this.options.duration})},previous:function(){if(this.current){var a=this.current._index;var b=(a==0)?this.sections.length-1:a-1}else{var b=this.sections.length-1}this.moveTo(this.sections[b],this.scroller,{duration:this.options.duration})},stop:function(){clearTimeout(this.timer)},start:function(){this.periodicallyUpdate()},periodicallyUpdate:function(){if(this.timer!=null){clearTimeout(this.timer);this.next()}this.timer=setTimeout(this.periodicallyUpdate.bind(this),this.options.frequency*1000)}});Effect.SmoothScroll=Class.create();Object.extend(Object.extend(Effect.SmoothScroll.prototype,Effect.Base.prototype),{initialize:function(b){this.element=$(b);var a=Object.extend({x:0,y:0,mode:"absolute"},arguments[1]||{});this.start(a)},setup:function(){if(this.options.continuous&&!this.element._ext){this.element.cleanWhitespace();this.element._ext=true;this.element.appendChild(this.element.firstChild)}this.originalLeft=this.element.scrollLeft;this.originalTop=this.element.scrollTop;if(this.options.mode=="absolute"){this.options.x-=this.originalLeft;this.options.y-=this.originalTop}},update:function(a){this.element.scrollLeft=this.options.x*a+this.originalLeft;this.element.scrollTop=this.options.y*a+this.originalTop}});var Prototip={Version:"1.2.0_pre1",REQUIRED_Prototype:"1.6.0",REQUIRED_Scriptaculous:"1.8.0",start:function(){this.require("Prototype");Tips.initialize();Element.observe(window,"unload",this.unload)},require:function(a){if((typeof window[a]=="undefined")||(this.convertVersionString(window[a].Version)<this.convertVersionString(this["REQUIRED_"+a]))){throw ("Prototip requires "+a+" >= "+this["REQUIRED_"+a])}},convertVersionString:function(a){var b=a.split(".");return parseInt(b[0])*100000+parseInt(b[1])*1000+parseInt(b[2])},viewport:{getDimensions:function(){var a={};var b=Prototype.Browser;$w("width height").each(function(e){var c=e.capitalize();a[e]=(b.WebKit&&!document.evaluate)?self["inner"+c]:(b.Opera)?document.body["client"+c]:document.documentElement["client"+c]});return a}},capture:function(a){if(!Prototype.Browser.IE){a=a.wrap(function(d,c){var b=c.relatedTarget,e=c.currentTarget;if(b&&b.nodeType==Node.TEXT_NODE){b=b.parentNode}if(b&&b!=e&&b.descendantOf&&!(b.descendantOf(e))){d(c)}})}return a},unload:function(){Tips.removeAll()}};var Tips={closeButtons:false,zIndex:1200,tips:[],visible:[],initialize:function(){this.zIndexTop=this.zIndex},useEvent:(function(a){return{mouseover:(a?"mouseenter":"mouseover"),mouseout:(a?"mouseleave":"mouseout"),mouseenter:(a?"mouseenter":"mouseover"),mouseleave:(a?"mouseleave":"mouseout")}})(Prototype.Browser.IE),fixIE:(function(b){var a=new RegExp("MSIE ([\\d.]+)").exec(b);return a?(parseFloat(a[1])<=6):false})(navigator.userAgent),add:function(a){this.tips.push(a)},remove:function(a){var b=this.tips.find(function(c){return c.element==$(a)});if(b){b.deactivate();if(b.tooltip){b.wrapper.remove();if(Tips.fixIE){b.iframeShim.remove()}}this.tips=this.tips.without(b)}},removeAll:function(){this.tips.each(function(a){this.remove(a.element)}.bind(this))},raise:function(b){if(b.highest){return}if(this.visible.length==0){this.zIndexTop=this.zIndex;for(var a=0;a<this.tips.length;a++){this.tips[a].wrapper.style.zIndex=this.zIndex}}b.style.zIndex=this.zIndexTop++;for(var a=0;a<this.tips.length;a++){this.tips[a].wrapper.highest=false}b.highest=true},addVisibile:function(a){this.removeVisible(a);this.visible.push(a)},removeVisible:function(a){this.visible=this.visible.without(a)}};Tips.initialize();var Tip=Class.create({initialize:function(a,b){this.element=$(a);Tips.remove(this.element);this.content=b;var d=(arguments[2]&&arguments[2].hook);var c=(arguments[2]&&arguments[2].showOn=="click");this.options=Object.extend({className:"default",closeButton:Tips.closeButtons,delay:!c?0.2:false,duration:0.3,effect:false,hideAfter:false,hideOn:"mouseleave",hook:false,offset:d?{x:0,y:0}:{x:16,y:16},fixed:d?true:false,showOn:"mousemove",target:this.element,title:false,viewport:d?false:true},arguments[2]||{});this.target=$(this.options.target);this.setup();if(this.options.effect){Prototip.require("Scriptaculous");this.queue={position:"end",limit:1,scope:this.wrapper.identify()}}Tips.add(this);this.activate()},setup:function(){this.wrapper=new Element("div",{"class":"prototip"}).setStyle({display:"none",zIndex:Tips.zIndex});this.wrapper.identify();if(Tips.fixIE){this.iframeShim=new Element("iframe",{"class":"iframeShim",src:"javascript:false;"}).setStyle({display:"none",zIndex:Tips.zIndex-1})}this.tip=new Element("div",{"class":"content"}).insert(this.content);this.tip.insert(new Element("div").setStyle({clear:"both"}));if(this.options.closeButton||(this.options.hideOn.element&&this.options.hideOn.element=="closeButton")){this.closeButton=new Element("a",{href:"#","class":"close"})}},build:function(){if(Tips.fixIE){document.body.appendChild(this.iframeShim).setOpacity(0)}var d="wrapper";if(this.options.effect){this.effectWrapper=this.wrapper.appendChild(new Element("div",{"class":"effectWrapper"}));d="effectWrapper"}this.tooltip=this[d].appendChild(new Element("div",{"class":"tooltip "+this.options.className}));if(this.options.title||this.options.closeButton){this.toolbar=this.tooltip.appendChild(new Element("div",{"class":"toolbar"}));this.title=this.toolbar.appendChild(new Element("div",{"class":"title"}).update(this.options.title||" "))}this.tooltip.insert(this.tip);document.body.appendChild(this.wrapper);var a=(this.options.effect)?[this.wrapper,this.effectWrapper]:[this.wrapper];if(Tips.fixIE){a.push(this.iframeShim)}var c=this.wrapper.getWidth();a.invoke("setStyle",{width:c+"px"});if(this.toolbar){this.wrapper.setStyle({visibility:"hidden"}).show();this.toolbar.setStyle({width:this.toolbar.getWidth()+"px"});this.wrapper.hide().setStyle({visibility:"visible"})}if(this.closeButton){this.title.insert({top:this.closeButton}).insert(new Element("div").setStyle({clear:"both"}))}var b=this.wrapper.getHeight();a.invoke("setStyle",{width:c+"px",height:b+"px"});this[this.options.effect?d:"tooltip"].hide()},activate:function(){this.eventShow=this.showDelayed.bindAsEventListener(this);this.eventHide=this.hide.bindAsEventListener(this);if(this.options.fixed&&this.options.showOn=="mousemove"){this.options.showOn="mouseover"}if(this.options.showOn==this.options.hideOn){this.eventToggle=this.toggle.bindAsEventListener(this);this.element.observe(this.options.showOn,this.eventToggle)}var c={element:this.eventToggle?[]:[this.element],target:this.eventToggle?[]:[this.target],tip:this.eventToggle?[]:[this.wrapper],closeButton:[],none:[]};var a=this.options.hideOn.element;this.hideElement=a||(!this.options.hideOn?"none":"element");this.hideTargets=c[this.hideElement];if(!this.hideTargets&&a&&Object.isString(a)){this.hideTargets=this.tip.select(a)}var d={mouseenter:"mouseover",mouseleave:"mouseout"};$w("show hide").each(function(h){var g=h.capitalize();var f=(this.options[h+"On"].event||this.options[h+"On"]);this[h+"Action"]=f;if(["mouseenter","mouseleave","mouseover","mouseout"].include(f)){this[h+"Action"]=(Tips.useEvent[f]||f);this["event"+g]=Prototip.capture(this["event"+g])}}.bind(this));if(!this.eventToggle){this.element.observe(this.options.showOn,this.eventShow)}if(this.hideTargets){this.hideTargets.invoke("observe",this.hideAction,this.eventHide)}if(!this.options.fixed&&this.options.showOn=="click"){this.eventPosition=this.position.bindAsEventListener(this);this.element.observe("mousemove",this.eventPosition)}this.buttonEvent=this.hide.wrap(function(f,e){e.stop();f(e)}).bindAsEventListener(this);if(this.closeButton){this.closeButton.observe("click",this.buttonEvent)}if(this.options.showOn!="click"&&(this.hideElement!="element")){this.eventCheckDelay=Prototip.capture(function(){this.clearTimer("show")}).bindAsEventListener(this);this.element.observe(Tips.useEvent.mouseout,this.eventCheckDelay)}var b=[this.element,this.wrapper];this.activityEnter=Prototip.capture(function(){Tips.raise(this.wrapper);this.cancelHideAfter()}).bindAsEventListener(this);this.activityLeave=Prototip.capture(this.hideAfter).bindAsEventListener(this);b.invoke("observe",Tips.useEvent.mouseover,this.activityEnter);b.invoke("observe",Tips.useEvent.mouseout,this.activityLeave)},deactivate:function(){if(this.options.showOn==this.options.hideOn){this.element.stopObserving(this.options.showOn,this.eventToggle)}else{this.element.stopObserving(this.options.showOn,this.eventShow);if(this.hideTargets){this.hideTargets.invoke("stopObserving")}}if(this.eventPosition){this.element.stopObserving("mousemove",this.eventPosition)}if(this.closeButton){this.closeButton.stopObserving()}if(this.eventCheckDelay){this.element.stopObserving("mouseout",this.eventCheckDelay)}this.wrapper.stopObserving();this.element.stopObserving(Tips.useEvent.mouseover,this.activityEnter);this.element.stopObserving(Tips.useEvent.mouseout,this.activityLeave)},showDelayed:function(a){if(!this.tooltip){this.build()}this.position(a);if(this.wrapper.visible()){return}this.clearTimer("show");this.showTimer=this.show.bind(this).delay(this.options.delay)},clearTimer:function(a){if(this[a+"Timer"]){clearTimeout(this[a+"Timer"])}},show:function(){if(this.wrapper.visible()&&this.options.effect!="appear"){return}if(Tips.fixIE){this.iframeShim.show()}Tips.addVisibile(this.wrapper);this.wrapper.show();if(!this.options.effect){this.tooltip.show()}else{if(this.activeEffect){Effect.Queues.get(this.queue.scope).remove(this.activeEffect)}this.activeEffect=Effect[Effect.PAIRS[this.options.effect][0]](this.effectWrapper,{duration:this.options.duration,queue:this.queue})}},hideAfter:function(a){if(!this.options.hideAfter){return}this.cancelHideAfter();this.hideAfterTimer=this.hide.bind(this).delay(this.options.hideAfter)},cancelHideAfter:function(){if(this.options.hideAfter){this.clearTimer("hideAfter")}},hide:function(){this.clearTimer("show");if(!this.wrapper.visible()){return}if(!this.options.effect){if(Tips.fixIE){this.iframeShim.hide()}this.tooltip.hide();this.wrapper.hide();Tips.removeVisible(this.wrapper)}else{if(this.activeEffect){Effect.Queues.get(this.queue.scope).remove(this.activeEffect)}this.activeEffect=Effect[Effect.PAIRS[this.options.effect][1]](this.effectWrapper,{duration:this.options.duration,queue:this.queue,afterFinish:function(){if(Tips.fixIE){this.iframeShim.hide()}this.wrapper.hide();Tips.removeVisible(this.wrapper)}.bind(this)})}},toggle:function(a){if(this.wrapper&&this.wrapper.visible()){this.hide(a)}else{this.showDelayed(a)}},position:function(a){Tips.raise(this.wrapper);var e={left:this.options.offset.x,top:this.options.offset.y};var f=Position.cumulativeOffset(this.target);var b=this.wrapper.getDimensions();var i={left:(this.options.fixed)?f[0]:Event.pointerX(a),top:(this.options.fixed)?f[1]:Event.pointerY(a)};i.left+=e.left;i.top+=e.top;if(this.options.hook){var k={target:this.target.getDimensions(),tip:b};var l={target:Position.cumulativeOffset(this.target),tip:Position.cumulativeOffset(this.target)};for(var h in l){switch(this.options.hook[h]){case"topRight":l[h][0]+=k[h].width;break;case"topMiddle":l[h][0]+=(k[h].width/2);break;case"rightMiddle":l[h][0]+=k[h].width;l[h][1]+=(k[h].height/2);break;case"bottomLeft":l[h][1]+=k[h].height;break;case"bottomRight":l[h][0]+=k[h].width;l[h][1]+=k[h].height;break;case"bottomMiddle":l[h][0]+=(k[h].width/2);l[h][1]+=k[h].height;break;case"leftMiddle":l[h][1]+=(k[h].height/2);break}}i.left+=-1*(l.tip[0]-l.target[0]);i.top+=-1*(l.tip[1]-l.target[1])}if(!this.options.fixed&&this.element!==this.target){var c=Position.cumulativeOffset(this.element);i.left+=-1*(c[0]-f[0]);i.top+=-1*(c[1]-f[1])}if(!this.options.fixed&&this.options.viewport){var j=document.viewport.getScrollOffsets();var g=Prototip.viewport.getDimensions();var d={left:"width",top:"height"};for(var h in d){if((i[h]+b[d[h]]-j[h])>g[d[h]]){i[h]=i[h]-b[d[h]]-2*e[h]}}}var m={left:i.left+"px",top:i.top+"px"};this.wrapper.setStyle(m);if(Tips.fixIE){this.iframeShim.setStyle(m)}}});Prototip.start();function drawSendForm(e,c,d){var b=document.getElementById("sendPage");var a="";a+="<input type='text' name='fromName' id='fromName' size='20' value='"+c+"' />";a+=" <input type='text' name='fromEmail' id='fromEmail' size='20' value='"+d+"' />";a+=" <input type='text' name='toEmail'	id='toEmail' size='20' value='Enter recipient email...' />";a+=' <input type="button" name="SENDPAGE" value="Send" onclick="return sendLink(\''+e+"');\" />";b.innerHTML=a;fade(0)}function sendLink(d){var b=document.getElementById("fromName").value;var c=document.getElementById("fromEmail").value;var e=document.getElementById("toEmail").value;var a="process/sendPage.php?fromName="+b+"&fromEmail="+c+"&toEmail="+e+"&linkUri="+d;if(window.XMLHttpRequest){req=new XMLHttpRequest()}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP")}}req.open("GET",a,true);req.onreadystatechange=callback;req.send(null)}function callback(){obj=document.getElementById("sendPage");obj.innerHTML="sending page...";setFade(100);if(req.readyState==4){if(req.status==200){response=req.responseText;obj.innerHTML=response;fade(0)}else{alert("There was a problem retrieving the data:\n"+req.statusText)}}}function fade(a){if(a<=100){setFade(a);a+=10;setTimeout("fade("+a+")",5)}}function setFade(a){obj=document.getElementById("sendPage");a=(a==100)?99.999:a;obj.style.filter="alpha(opacity:"+a+")";obj.style.KHTMLOpacity=a/100;obj.style.MozOpacity=a/100;obj.style.opacity=a/100}if(!window.Modalbox){var Modalbox=new Object()}Modalbox.Methods={overrideAlert:false,focusableElements:new Array,currFocused:0,initialized:false,active:true,options:{title:"ModalBox Window",overlayClose:true,width:500,height:90,overlayOpacity:0.65,overlayDuration:0.25,slideDownDuration:0.5,slideUpDuration:0.5,resizeDuration:0.25,inactiveFade:true,transitions:true,loadingString:"Please wait. Loading...",closeString:"Close window",closeValue:"&times;",params:{},method:"get",autoFocusing:true,aspnet:false},_options:new Object,setOptions:function(a){Object.extend(this.options,a||{})},_init:function(b){Object.extend(this._options,this.options);this.setOptions(b);this.MBoverlay=new Element("div",{id:"MB_overlay",opacity:"0"});this.MBwindow=new Element("div",{id:"MB_window",style:"display: none"}).update(this.MBframe=new Element("div",{id:"MB_frame"}).update(this.MBheader=new Element("div",{id:"MB_header"}).update(this.MBcaption=new Element("div",{id:"MB_caption"}))));this.MBclose=new Element("a",{id:"MB_close",title:this.options.closeString,href:"#"}).update("<span>"+this.options.closeValue+"</span>");this.MBheader.insert({bottom:this.MBclose});this.MBcontent=new Element("div",{id:"MB_content"}).update(this.MBloading=new Element("div",{id:"MB_loading"}).update(this.options.loadingString));this.MBframe.insert({bottom:this.MBcontent});var a=this.options.aspnet?$(document.body).down("form"):$(document.body);a.insert({top:this.MBwindow});a.insert({top:this.MBoverlay});this.initScrollX=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft;this.initScrollY=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;this.hideObserver=this._hide.bindAsEventListener(this);this.kbdObserver=this._kbdHandler.bindAsEventListener(this);this._initObservers();this.initialized=true},show:function(b,a){if(!this.initialized){this._init(a)}this.content=b;this.setOptions(a);if(this.options.title){$(this.MBcaption).update(this.options.title)}else{$(this.MBheader).hide();$(this.MBcaption).hide()}if(this.MBwindow.style.display=="none"){this._appear();this.event("onShow")}else{this._update();this.event("onUpdate")}},hide:function(a){if(this.initialized){if(a&&typeof a.element!="function"){Object.extend(this.options,a)}this.event("beforeHide");if(this.options.transitions){Effect.SlideUp(this.MBwindow,{duration:this.options.slideUpDuration,transition:Effect.Transitions.sinoidal,afterFinish:this._deinit.bind(this)})}else{$(this.MBwindow).hide();this._deinit()}}else{throw ("Modalbox is not initialized.")}},_hide:function(a){a.stop();if(a.element().id=="MB_overlay"&&!this.options.overlayClose){return false}this.hide()},alert:function(b){var a='<div class="MB_alert"><p>'+b+'</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';Modalbox.show(a,{title:"Alert: "+document.title,width:300})},_appear:function(){if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){window.scrollTo(0,0);this._prepareIE("100%","hidden")}this._setWidth();this._setPosition();if(this.options.transitions){$(this.MBoverlay).setStyle({opacity:0});new Effect.Fade(this.MBoverlay,{from:0,to:this.options.overlayOpacity,duration:this.options.overlayDuration,afterFinish:function(){new Effect.SlideDown(this.MBwindow,{duration:this.options.slideDownDuration,transition:Effect.Transitions.sinoidal,afterFinish:function(){this._setPosition();this.loadContent()}.bind(this)})}.bind(this)})}else{$(this.MBoverlay).setStyle({opacity:this.options.overlayOpacity});$(this.MBwindow).show();this._setPosition();this.loadContent()}this._setWidthAndPosition=this._setWidthAndPosition.bindAsEventListener(this);Event.observe(window,"resize",this._setWidthAndPosition)},resize:function(g,h,c){var f=$(this.MBwindow).getHeight();var d=$(this.MBwindow).getWidth();var e=$(this.MBheader).getHeight();var b=$(this.MBcontent).getHeight();var a=((f-e+h)<b)?(b+e-f):h;if(c){this.setOptions(c)}if(this.options.transitions){new Effect.ScaleBy(this.MBwindow,g,a,{duration:this.options.resizeDuration,afterFinish:function(){this.event("_afterResize");this.event("afterResize")}.bind(this)})}else{this.MBwindow.setStyle({width:d+g+"px",height:f+a+"px"});setTimeout(function(){this.event("_afterResize");this.event("afterResize")}.bind(this),1)}},resizeToContent:function(a){var b=this.options.height-this.MBwindow.offsetHeight;if(b!=0){if(a){this.setOptions(a)}Modalbox.resize(0,b)}},resizeToInclude:function(c,b){var d=$(c);var a=d.getHeight()+parseInt(d.getStyle("margin-top"))+parseInt(d.getStyle("margin-bottom"))+parseInt(d.getStyle("border-top-width"))+parseInt(d.getStyle("border-bottom-width"));if(a>0){if(b){this.setOptions(b)}Modalbox.resize(0,a)}},_update:function(){$(this.MBcontent).update("");this.MBcontent.appendChild(this.MBloading);$(this.MBloading).update(this.options.loadingString);this.currentDims=[this.MBwindow.offsetWidth,this.MBwindow.offsetHeight];Modalbox.resize((this.options.width-this.currentDims[0]),(this.options.height-this.currentDims[1]),{_afterResize:this._loadAfterResize.bind(this)})},loadContent:function(){if(this.event("beforeLoad")!=false){if(typeof this.content=="string"){var htmlRegExp=new RegExp(/<\/?[^>]+>/gi);if(htmlRegExp.test(this.content)){this._insertContent(this.content.stripScripts());this._putContent(function(){this.content.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""))}.bind(window))}.bind(this))}else{new Ajax.Request(this.content,{method:this.options.method.toLowerCase(),parameters:this.options.params,onSuccess:function(transport){var response=new String(transport.responseText);this._insertContent(transport.responseText.stripScripts());this._putContent(function(){response.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""))}.bind(window))})}.bind(this),onException:function(instance,exception){Modalbox.hide();throw ("Modalbox Loading Error: "+exception)}})}}else{if(typeof this.content=="object"){this._insertContent(this.content);this._putContent()}else{Modalbox.hide();throw ("Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)")}}}},_insertContent:function(b){$(this.MBcontent).hide().update("");if(typeof b=="string"){setTimeout(function(){this.MBcontent.update(b)}.bind(this),1)}else{if(typeof b=="object"){var a=b.cloneNode(true);if(b.id){b.id="MB_"+b.id}$(b).select("*[id]").each(function(c){c.id="MB_"+c.id});this.MBcontent.appendChild(a);this.MBcontent.down().show();if(Prototype.Browser.IE){$$("#MB_content select").invoke("setStyle",{visibility:""})}}}},_putContent:function(a){if(this.options.height==this._options.height){setTimeout(function(){Modalbox.resize(0,$(this.MBcontent).getHeight()-$(this.MBwindow).getHeight()+$(this.MBheader).getHeight(),{afterResize:function(){this.MBcontent.show().makePositioned();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(a!=undefined){a()}this.event("afterLoad")}.bind(this),1)}.bind(this)})}.bind(this),1)}else{this._setWidth();this.MBcontent.setStyle({overflow:"auto",height:$(this.MBwindow).getHeight()-$(this.MBheader).getHeight()-13+"px"});this.MBcontent.show();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(a!=undefined){a()}this.event("afterLoad")}.bind(this),1)}},activate:function(a){this.setOptions(a);this.active=true;$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose){$(this.MBoverlay).observe("click",this.hideObserver)}$(this.MBclose).show();if(this.options.transitions&&this.options.inactiveFade){new Effect.Appear(this.MBwindow,{duration:this.options.slideUpDuration})}},deactivate:function(a){this.setOptions(a);this.active=false;$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose){$(this.MBoverlay).stopObserving("click",this.hideObserver)}$(this.MBclose).hide();if(this.options.transitions&&this.options.inactiveFade){new Effect.Fade(this.MBwindow,{duration:this.options.slideUpDuration,to:0.75})}},_initObservers:function(){$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose){$(this.MBoverlay).observe("click",this.hideObserver)}if(Prototype.Browser.IE){Event.observe(document,"keydown",this.kbdObserver)}else{Event.observe(document,"keypress",this.kbdObserver)}},_removeObservers:function(){$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose){$(this.MBoverlay).stopObserving("click",this.hideObserver)}if(Prototype.Browser.IE){Event.stopObserving(document,"keydown",this.kbdObserver)}else{Event.stopObserving(document,"keypress",this.kbdObserver)}},_loadAfterResize:function(){this._setWidth();this._setPosition();this.loadContent()},_setFocus:function(){if(this.focusableElements.length>0&&this.options.autoFocusing==true){var a=this.focusableElements.find(function(b){return b.tabIndex==1})||this.focusableElements.first();this.currFocused=this.focusableElements.toArray().indexOf(a);a.focus()}else{if($(this.MBclose).visible()){$(this.MBclose).focus()}}},_findFocusableElements:function(){this.MBcontent.select("input:not([type~=hidden]), select, textarea, button, a[href]").invoke("addClassName","MB_focusable");return this.MBcontent.select(".MB_focusable")},_kbdHandler:function(b){var a=b.element();switch(b.keyCode){case Event.KEY_TAB:b.stop();if(a!=this.focusableElements[this.currFocused]){this.currFocused=this.focusableElements.toArray().indexOf(a)}if(!b.shiftKey){if(this.currFocused==this.focusableElements.length-1){this.focusableElements.first().focus();this.currFocused=0}else{this.currFocused++;this.focusableElements[this.currFocused].focus()}}else{if(this.currFocused==0){this.focusableElements.last().focus();this.currFocused=this.focusableElements.length-1}else{this.currFocused--;this.focusableElements[this.currFocused].focus()}}break;case Event.KEY_ESC:if(this.active){this._hide(b)}break;case 32:this._preventScroll(b);break;case 0:if(b.which==32){this._preventScroll(b)}break;case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_PAGEDOWN:case Event.KEY_PAGEUP:case Event.KEY_HOME:case Event.KEY_END:if(Prototype.Browser.WebKit&&!["textarea","select"].include(a.tagName.toLowerCase())){b.stop()}else{if((a.tagName.toLowerCase()=="input"&&["submit","button"].include(a.type))||(a.tagName.toLowerCase()=="a")){b.stop()}}break}},_preventScroll:function(a){if(!["input","textarea","select","button"].include(a.element().tagName.toLowerCase())){a.stop()}},_deinit:function(){this._removeObservers();Event.stopObserving(window,"resize",this._setWidthAndPosition);if(this.options.transitions){Effect.toggle(this.MBoverlay,"appear",{duration:this.options.overlayDuration,afterFinish:this._removeElements.bind(this)})}else{this.MBoverlay.hide();this._removeElements()}$(this.MBcontent).setStyle({overflow:"",height:""})},_removeElements:function(){$(this.MBoverlay).remove();$(this.MBwindow).remove();if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){this._prepareIE("","");window.scrollTo(this.initScrollX,this.initScrollY)}if(typeof this.content=="object"){if(this.content.id&&this.content.id.match(/MB_/)){this.content.id=this.content.id.replace(/MB_/,"")}this.content.select("*[id]").each(function(a){a.id=a.id.replace(/MB_/,"")})}this.initialized=false;this.event("afterHide");this.setOptions(this._options)},_setWidth:function(){$(this.MBwindow).setStyle({width:this.options.width+"px",height:this.options.height+"px"})},_setPosition:function(){$(this.MBwindow).setStyle({left:Math.round((Element.getWidth(document.body)-Element.getWidth(this.MBwindow))/2)+"px"})},_setWidthAndPosition:function(){$(this.MBwindow).setStyle({width:this.options.width+"px"});this._setPosition()},_getScrollTop:function(){var a;if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop}else{if(document.body){a=document.body.scrollTop}}return a},_prepareIE:function(a,b){$$("html, body").invoke("setStyle",{width:a,height:a,overflow:b});$$("select").invoke("setStyle",{visibility:b})},event:function(a){if(this.options[a]){var b=this.options[a]();this.options[a]=null;if(b!=undefined){return b}else{return true}}return true}};Object.extend(Modalbox,Modalbox.Methods);if(Modalbox.overrideAlert){window.alert=Modalbox.alert}Effect.ScaleBy=Class.create();Object.extend(Object.extend(Effect.ScaleBy.prototype,Effect.Base.prototype),{initialize:function(b,c,d,a){this.element=$(b);var a=Object.extend({scaleFromTop:true,scaleMode:"box",scaleByWidth:c,scaleByHeight:d},arguments[3]||{});this.start(a)},setup:function(){this.elementPositioning=this.element.getStyle("position");this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}this.deltaY=this.options.scaleByHeight;this.deltaX=this.options.scaleByWidth},update:function(a){var c=this.dims[0]+(this.deltaY*a);var b=this.dims[1]+(this.deltaX*a);c=(c>0)?c:0;b=(b>0)?b:0;this.setDimensions(c,b)},setDimensions:function(a,e){var f={};f.width=e+"px";f.height=a+"px";var c=Math.round((a-this.dims[0])/2);var b=Math.round((e-this.dims[1])/2);if(this.elementPositioning=="absolute"||this.elementPositioning=="fixed"){if(!this.options.scaleFromTop){f.top=this.originalTop-c+"px"}f.left=this.originalLeft-b+"px"}else{if(!this.options.scaleFromTop){f.top=-c+"px"}f.left=-b+"px"}this.element.setStyle(f)}});