var Overlay=new Class({Implements:[Options,Events],options:{id:"overlay",color:"#000",duration:500,opacity:0.5,zIndex:5E3},initialize:function(a,b){this.setOptions(b);this.container=document.id(a);if(Browser.Engine.trident&&Browser.Engine.version<=6)this.ie6=true;this.bound={window:{resize:this.resize.bind(this),scroll:this.scroll.bind(this)},overlayClick:this.overlayClick.bind(this),tweenStart:this.tweenStart.bind(this),tweenComplete:this.tweenComplete.bind(this)};this.build().attach()},build:function(){this.overlay=
(new Element("div",{id:this.options.id,opacity:0,styles:{position:this.ie6?"absolute":"fixed",background:this.options.color,left:0,top:0,"z-index":this.options.zIndex}})).inject(this.container);this.tween=new Fx.Tween(this.overlay,{duration:this.options.duration,link:"cancel",property:"opacity"});return this}.protect(),attach:function(){window.addEvents(this.bound.window);this.overlay.addEvent("click",this.bound.overlayClick);this.tween.addEvents({onStart:this.bound.tweenStart,onComplete:this.bound.tweenComplete});
return this},detach:function(){Array.prototype.slice.call(arguments).each(function(a){a=="window"&&window.removeEvents(this.bound.window);a=="overlay"&&this.overlay.removeEvent("click",this.bound.overlayClick)},this);return this},overlayClick:function(){this.fireEvent("click");return this},tweenStart:function(){this.overlay.setStyles({width:"100%",height:this.container.getScrollSize().y});return this},tweenComplete:function(){this.fireEvent(this.overlay.get("opacity")==this.options.opacity?"show":
"hide");return this},open:function(){this.fireEvent("open");this.tween.start(this.options.opacity);return this},close:function(){this.fireEvent("close");this.tween.start(0);return this},resize:function(){this.fireEvent("resize");this.overlay.setStyle("height",this.container.getScrollSize().y);return this},scroll:function(){this.fireEvent("scroll");this.ie6&&this.overlay.setStyle("left",window.getScroll().x);return this}});RRS={};
RRS.SimpleAjaxForm=new Class({Implements:[Options,Events],options:{duration:250,successElement:new Element("h3",{text:"Your message has been recieved!"}),hideShowTrigger:null},initialize:function(a,b){this.setOptions(b);this.form=$(a);this.form.addEvent("submit",this.sendMessage.bind(this))},sendMessage:function(){var a=this.form,b=this.options;a.retrieve("back_text")&&a.retrieve("back_text").reset();a.get("send",{method:"post",onComplete:function(c){if(this.status==204||this.status==1223){a.setStyle("display",
"none");b.successElement.inject(a,"after");b.successElement.get("tween",{property:"opacity",duration:b.duration}).start(1);b.hideShowTrigger&&b.hideShowTrigger.removeEvents("click");b.successCallback&&b.successCallback()}else{a.getElements("span.error, ul.errorlist").destroy();$H(JSON.decode(c).errors).each(function(d,e){(new Element("span",{"class":"error",html:d[0]})).inject($("id_"+e),"before")});a.getElements("input, textarea").fireEvent("blur")}}}).send();return false}});
var overlay=new Overlay(document.body,{id:"overlay",duration:100,color:"#111",opacity:0.8,onClick:function(){$("signup_panel")&&$("signup_panel").get("tween",{property:"opacity",duration:100,onComplete:function(){$("signup_panel").destroy()}}).start(0);this.close()}});
$("in_touch").addEvent("click",function(){(new Request({url:"/signup/",method:"get",onComplete:function(a){$(document.body).adopt((new Element("div",{html:a})).getFirst());overlay.open();$("signup_panel").get("tween",{property:"opacity",duration:100}).start(1);new RRS.SimpleAjaxForm($("signup_panel").getElement("form"),{successElement:(new Element("div",{opacity:0,"class":"signup_compelete"})).adopt(new Element("h2",{text:"Thanks"}),new Element("p",{text:"We'll be in touch when we're ready for testers."}))})}})).send()});
