var dialog=new Class({initialize:function(a,b){this.embeds=document.getElementsByTagName("embed");for(i=0;i<this.embeds.length;i++)this.embeds[i].style.visibility="hidden";this.objects=document.getElementsByTagName("object");for(i=0;i<this.objects.length;i++)this.objects[i].style.visibility="hidden";this.youtubeIframes=$ES(".youtube-player");this.youtubeIframes.setStyle("visibility","hidden");this.choices=b;this.textOrUrlOrElement=a;this.sourceType=$type(this.textOrUrlOrElement)=="element"?"element":
this.textOrUrlOrElement.toLowerCase().indexOf("http://")==0||this.textOrUrlOrElement.toLowerCase().indexOf("https://")==0?"url":"text";this.overlayOpacity=0.8;this.containerWidth=587;this.containerHeight=526;this.effectsSpeed=600;this.backgroundSrc="https://www.tasset.com/images/menu/dialogBackground.gif";new Asset.images([this.backgroundSrc],{onComplete:function(){this.build()}.bind(this)})},build:function(){this.overlay=new Element("div",{id:"dialogOverlay"});this.overlay.setStyles({visibility:"hidden",
opacity:0,backgroundColor:"#fff",color:"#fff","z-index":9998,position:"absolute",left:"0px",overflow:"auto","margin-top":"0px"});this.overlay.addEvent("click",function(){this.close()}.bind(this));this.container=new Element("div",{id:"dialogContainer"});this.container.setStyles({visibility:"hidden",opacity:0,position:"absolute","z-index":9999,height:this.containerHeight,width:this.containerWidth,"background-image":"url("+this.backgroundSrc+")",left:window.getWidth()/2-this.containerWidth/2+"px",top:window.getScrollTop()+
15+"px"});this.container.addEvent("click",function(a){(new Event(a)).stopPropagation()});this.dialogContent=new Element("div",{id:"dialogContent"});this.dialogContent.setStyle("visibility","hidden");this.container.adopt(this.dialogContent);this.dialogContent.setStyles({visibility:"visible","margin-top":"90px",width:"455px","margin-left":"62px",padding:"4px",height:"357px",overflow:"auto"});this.dialogContent.setHTML('<br/><br/><center><img src="https://www.tasset.com/images/menu/dialogBackground.gif"></center><br/><br/>');
this.buttonsContainer=new Element("div",{id:"buttonsContainer"});this.buttonsContainer.setStyles({position:"absolute","z-index":1E4,height:"23px",width:"444px","margin-left":"70px","margin-top":"12px","text-align":"right"}).injectInside(this.container);this.createChoices(this.choices);window.addEvent("resize",function(){this.overlay.setStyles({width:window.getScrollWidth(),height:window.getScrollHeight()});this.container.setStyles({left:window.getWidth()/2-this.containerWidth/2+"px",top:window.getScrollTop()+
15+"px"})}.bind(this));this.getText();this.open()},getText:function(){switch(this.sourceType){case "url":if(this.textOrUrlOrElement.toLowerCase().indexOf("https://")==0&&document.location.toString().indexOf("https://")!=0)this.textOrUrlOrElement=this.textOrUrlOrElement.replace("https://","http://");if(this.textOrUrlOrElement.toLowerCase().indexOf("http://")==0&&document.location.toString().indexOf("https://")==0)this.textOrUrlOrElement=this.textOrUrlOrElement.replace("http://","https://");this.dialogTextRequest=
(new XHR({method:"post",onSuccess:function(){this.dialogContent.setHTML(this.dialogTextRequest.response.text)}.bind(this),onRequest:function(){if(this.dialogTextRequest!==null)this.dialogTextRequest=null;this.dialogContent.setHTML('<center style="margin-top:100px"><img src="https://www.tasset.com/images/loader-1.gif"/></center>')}.bind(this),onFailure:function(){this.dialogContent.setHTML('<center style="margin-top:100px;text-align:center;border:1px solid red;color:red;">file not found</center>')}.bind(this)})).send(this.textOrUrlOrElement);
break;case "text":this.dialogContent.setHTML(this.textOrUrlOrElement);break;case "element":this.dialogContent.adopt(this.textOrUrlOrElement)}},getContent:function(){return this.dialogContent.innerHTML},setContent:function(a){this.dialogContent.setHTML(a)},createChoices:function(a){for(var b=0;b<a.length;b++){var d=new Element("button",{id:"dialogChoice"+b,"class":"niceOrangeButton"});d.setStyles({position:"relative","z-index":10001,height:"23px","margin-left":"5px","margin-right":"5px","margin-top":"0px"}).injectInside(this.buttonsContainer);
d.setHTML(a[b].text);d.addEvent("click",function(c){c=(new Event(c)).target.id.split("dialogChoice")[1];a[c].callback=a[c].callback||false;a[c].callback!=false&&a[c].callback();if(!$defined(a[c].autoClose))a[c].autoClose=true;a[c].autoClose&&this.close()}.bind(this))}},replaceChoices:function(a){this.buttonsContainer.getChildren().each(function(b){b.remove()});this.createChoices(a)},open:function(){this.overlay.injectTop(document.body);this.container.injectTop(document.body);this.overlay.setStyles({top:"0px",
width:window.getScrollWidth(),height:window.getScrollHeight()});this.fadeIn(this.overlay,this.overlayOpacity);this.fadeIn(this.container,1);(function(){this.container.setStyle("top",window.getScrollTop()+15+"px")}).delay(this.effectsSpeed,this)},close:function(){this.fadeOut(this.overlay);this.fadeOut(this.container);(function(){this.overlay.remove();this.container.remove();for(i=0;i<this.embeds.length;i++)this.embeds[i].style.visibility="visible";for(i=0;i<this.objects.length;i++)this.objects[i].style.visibility=
"visible";this.youtubeIframes.setStyle("visibility","visible");return false}).delay(this.effectsSpeed,this)},fadeOut:function(a){(new Fx.Styles($(a),{duration:this.effectsSpeed})).start({opacity:0})},fadeIn:function(a,b){(new Fx.Styles($(a),{duration:this.effectsSpeed})).start({opacity:b})}});
