(function()
{
 var Global=this,Runtime=this.IntelliFactory.Runtime,WebSharper,Formlet,Formlet1,Controls,Enhance,FormButtonConfiguration,Trainings,Config,Button,Server,Utils,Formlet2,Enhance1,Remoting,Controls1,List,Admin,Client,Html,Default,Operators,T,Widget,Client1,JS,FormletHelpers,EventsPervasives,Seq,Concurrency,Data,UserControls,Tags,Client2,FormletHelpers1,FwL,Padding,FormContainerConfiguration,UI,Client3,Enhance2,Layout,LabelConfiguration,jQuery,Strings,MarkupLanguage,Client4,SyntaxHighlighter,Option,Date,Dao,DateDAO,TimeDAO,JQueryUI,Controls2,Number,FwLS,Company,Client5,Yui,Controls3,LocationDetails,Location,Client6,location,ConferenceSupport,ConferenceExtraDAO,Operators1,FwS,Trainings1,Client7,Courses,Client8,Forms,Default1,EventOrCourseCreation,CreateEventOrCourseType,EcmaScript,ExtraInformationDAO,PricingDAO,TimeAndDurationDAO,EventOrCourseDetailsDAO_WebcastDetails,ReadOnly,PayPal,Controls4,DateTime,DeveloperProfileUpdateData,JobLocation,JobOffer,SchoolInfo,TrainerOptionsDAO,UserOptionsDAO,WorkPlaceInfo,DeveloperSearch,$,TinyMce,AdvancedHtmlEditorConfiguration,Controls5,ReadOnly1,FwoL,Forum,Client9,Lazy,ContactButtonConfiguration,JQueryUI1,Tabs,alert,window,Invite,Clienta,self,setTimeout,JobOffer1,Clientb,google,Unchecked,TrainingBookingInternals,Clientc,UserData,Search,Widget1,String,encodeURI,RegExp,Arrays,visualization,DataTable,GeoMap,Google,Visualization,Visualizations,GeoMapOptions,SearchDeveloper,Clientd,Events,GeoMap1,Util,parseFloat,ColumnChart,ColumnChart1,ColumnChartOptions,SubscribeDeveloerSearch,Cliente,Formlet3,Base,_Result_1,Collections,BalancedTree,_FSharpSet_1,Twitter,Clientf,_FSharpMap_2,MapModule,Twitter1,UserModule,Client10,Timeline,Client11,Control,_FSharpEvent_1,Upload,DialogConfiguration,Dialog,_FormletProvider_1,Reactive,_HotStream_1,AutocompleteConfiguration,Autocomplete,Body,Zone,Client12;
 Runtime.Define(Global,{
  IntelliFactory:{
   Trainings:{
    ActivateAccount:{
     Client:{
      ActivateUserControl:Runtime.Class({
       get_Body:function()
       {
        var _builder_,_this=this;
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x,x1,x2,f,buttonConf,inputRecord,Class,arg0,f1,f2;
         return _builder_.Bind((x=(x1=(x2=Controls.Input(""),(f=(buttonConf=(inputRecord=FormButtonConfiguration.get_Default(),(Class=(arg0=Server.Large(),{
          $:1,
          $0:arg0
         }),Runtime.New(FormButtonConfiguration,{
          Label:{
           $:1,
           $0:"Send me an Activation Link"
          },
          Style:inputRecord.Style,
          Class:Class
         }))),function(formlet)
         {
          return Enhance.WithCustomSubmitButton(buttonConf,formlet);
         }),f(x2))),(f1=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },f1(x1))),(f2=function(formlet)
         {
          return Enhance1.SubmitOnEnter(formlet);
         },f2(x))),function(_arg184)
         {
          var x3,f3;
          return _builder_.Bind((x3=Remoting.Async("IntelliFactory.Trainings:102",[{
           Email:_arg184,
           ActivationURL:_this.activationURL
          }]),(f3=function(a)
          {
           return Formlet2.LoadingFormlet(a);
          },f3(x3))),function(_arg183)
          {
           return _builder_.ReturnFrom(_arg183?Controls1.SuccessPanel("An email has been sent to you, with instructions on how you can activate your account."):Controls1.ErrorPanel("Something went wrong."));
          });
         });
        });
       }
      })
     }
    },
    Admin:{
     Client:{
      AddUserOAuthProviderControl:Runtime.Class({
       get_Body:function()
       {
        var x,f;
        x=List.ofArray([Client.RebuildButton("Recompute User Scores",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:1",[]);
        }),Client.RebuildButton("Build User Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:2",[]);
        }),Client.RebuildButton("Build Topics Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:3",[]);
        }),Client.RebuildButton("Build Trainer Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:4",[]);
        }),Client.RebuildButton("Build Company Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:5",[]);
        }),Client.RebuildButton("Build Training Events Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:6",[]);
        }),Client.RebuildButton("Build Trainings Course Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:7",[]);
        }),Client.RebuildButton("Build User Data Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:8",[]);
        }),Client.RebuildButton("Build Blogs Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:10",[]);
        }),Client.RebuildButton("Build Zone Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:9",[]);
        }),Client.RebuildButton("Clear Skin CSS Cache",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:11",[]);
        }),Client.RebuildButton("Recompute user locations",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:12",[]);
        }),Client.RebuildButton("Cleanup tags (remove db duplicates)",function()
        {
         return Remoting.Async("IntelliFactory.Trainings:13",[]);
        }),Client.MergeUsersForm(),Client.TagSubstitutionForm(),Client.ExistingTagSubstitutions(this.tagSubstitutions),Client.DeleteTags(this.tags)]);
        f=function(x1)
        {
         return Default.Div(x1);
        };
        return f(x);
       }
      }),
      DeleteTags:function(tags)
      {
       var f,mapping;
       return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("tags-to-delete")])),List.ofArray([Default.H2(List.ofArray([Default.Text("Delete tags")])),Default.P(List.ofArray([Default.Text("Click a tag below to delete it and untag all associated entities.")])),Default.UL((f=(mapping=Runtime.Tupled(function(tupledArg)
       {
        var tag,isMaster,li,x,_this,_this1,_this2,_this3,_this4,f1,x1;
        tag=tupledArg[0];
        isMaster=tupledArg[1];
        li=Default.LI(Runtime.New(T,{
         $:0
        }));
        return Operators.add(li,List.ofArray([(x=Operators.add(Default.A(List.ofArray([Default.Attr().Class("tag"+(isMaster?" master":"")),(_this=Default.Attr(),_this.NewAttr("href","#"))])),List.ofArray([Default.Img(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("src","/images/icons/close.png")),(_this2=Default.Attr(),_this2.NewAttr("alt","remove")),(_this3=Default.Attr(),_this3.NewAttr("title","remove")),(_this4=Default.Attr(),_this4.NewAttr("style","height: 10px; width: 10px; margin-right: 5px;"))])),Default.Text(tag)])),(f1=(x1=function(e)
        {
         return function()
         {
          var x2,x3,_builder_,f3,f4;
          x2=(x3=(_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           return _builder_.Bind(Formlet1.OfElement(function()
           {
            return Default.Div(List.ofArray([Default.Text("Really delete tag '"+tag+"' ?")]));
           }),function()
           {
            var x4,f2,cl;
            return _builder_.Bind((x4=Formlet1.Return(null),(f2=(cl=Server.Small(),function(formlet)
            {
             return Client1.EnhanceWithCustomSubmitButton(cl,"Yes",formlet);
            }),f2(x4))),function()
            {
             return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:16",[tag])),function(_arg192)
             {
              var msg;
              if(_arg192.$==0)
               {
                li["HtmlProvider@32"].Remove(li.Body);
                return _builder_.Return(null);
               }
              else
               {
                msg=_arg192.$0;
                return _builder_.ReturnFrom(FormletHelpers.ErrorF(msg));
               }
             });
            });
           });
          })),(f3=function(formlet)
          {
           return Enhance1.WithDialog("Confirm",formlet);
          },f3(x3)));
          f4=function(arg00)
          {
           return e.AppendI(arg00);
          };
          return f4(x2);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f1(x),x)))]));
       }),function(list)
       {
        return List.map(mapping,list);
       }),f(tags)))]));
      },
      ExistingTagSubstitutions:function(tagSubstitutions)
      {
       return Default.Div(Seq.toList(Seq.delay(function()
       {
        return Seq.append([Default.H2(List.ofArray([Default.Text("Existing substitutions")]))],Seq.delay(function()
        {
         return Seq.collect(Runtime.Tupled(function(matchValue)
         {
          var tag,substs;
          tag=matchValue[0];
          substs=matchValue[1];
          return Seq.append([Operators.add(Default.A(List.ofArray([Default.Attr().Class("tag")])),List.ofArray([Default.Text(tag)]))],Seq.delay(function()
          {
           return Seq.append([Default.Span(List.ofArray([Default.Text("->")]))],Seq.delay(function()
           {
            return Seq.append(Seq.map(function(subst)
            {
             return Operators.add(Default.A(List.ofArray([Default.Attr().Class("tag")])),List.ofArray([Default.Text(subst)]));
            },substs),Seq.delay(function()
            {
             return[Default.Br(Runtime.New(T,{
              $:0
             }))];
            }));
           }));
          }));
         }),tagSubstitutions);
        }));
       })));
      },
      MergeUsersForm:function()
      {
       var lookupUsers,chooseUsersForm,x2,x3,x4,f3,f4,x5,x6,f5,f6,x7,x8,_builder_,f7,f8;
       lookupUsers=function(name)
       {
        var f;
        f=function()
        {
         var x,f1;
         x=Remoting.Async("IntelliFactory.Trainings:101",[name]);
         f1=function(_arg189)
         {
          var x1,f2,mapping;
          x1=(f2=(mapping=Runtime.Tupled(function(tupledArg)
          {
           var l,v;
           l=tupledArg[0];
           v=tupledArg[1];
           return{
            label:l+" &lt;"+v+"&gt;",
            value:v
           };
          }),function(list)
          {
           return List.map(mapping,list);
          }),f2(_arg189));
          return Concurrency.Return(x1);
         };
         return Concurrency.Bind(x,f1);
        };
        return Concurrency.Delay(f);
       };
       chooseUsersForm=Data.$(Data.$((x2=function(uFrom)
       {
        return function(uTo)
        {
         return[uFrom,uTo];
        };
       },Formlet1.Return(x2)),(x3=(x4=Controls1.Autocomplete("",lookupUsers),(f3=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a first user",arg10);
       },f3(x4))),(f4=function(formlet)
       {
        return Enhance.WithTextLabel("Merge this user:",formlet);
       },f4(x3)))),(x5=(x6=Controls1.Autocomplete("",lookupUsers),(f5=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a second user",arg10);
       },f5(x6))),(f6=function(formlet)
       {
        return Enhance.WithTextLabel("Into this one:",formlet);
       },f6(x5))));
       x7=(x8=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x,x1,f,arg00,f1,f2;
        return _builder_.Bind((x=(x1=(f=(arg00=Runtime.Tupled(function(tupledArg)
        {
         var u1,u2;
         u1=tupledArg[0];
         u2=tupledArg[1];
         return u1!==u2;
        }),function(arg20)
        {
         return Data.Validator().Is(arg00,"You cannot merge a user into himself",arg20);
        }),f(chooseUsersForm)),(f1=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f1(x1))),(f2=function(formlet)
        {
         return Enhance.WithSubmitButton(formlet);
        },f2(x))),Runtime.Tupled(function(_arg191)
        {
         var uTo,uFrom;
         uTo=_arg191[1];
         uFrom=_arg191[0];
         return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:14",[uFrom,uTo])),function(_arg190)
         {
          var msg;
          return _builder_.ReturnFrom(_arg190.$==0?FormletHelpers.SuccessF("Successfully merged user "+uFrom+" into "+uTo+"."):(msg=_arg190.$0,FormletHelpers.ErrorF(msg)));
         });
        }));
       })),(f7=function(formlet)
       {
        return Enhance.WithLegend("Merge users",formlet);
       },f7(x8)));
       f8=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       };
       return f8(x7);
      },
      RebuildButton:function(label,action)
      {
       var x,_builder_,f1;
       x=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        return _builder_.Bind(UserControls.SmallButton(label),function()
        {
         var x1,f;
         return _builder_.Bind((x1=action(null),(f=function(a)
         {
          return Formlet2.LoadingFormlet(a);
         },f(x1))),function(_arg185)
         {
          var time,msg;
          return _builder_.ReturnFrom(_arg185.$==0?FormletHelpers.ErrorF("Sorry, an error occurred."):(time=_arg185.$0,(msg="Rebuilt in "+Global.String(time)+" seconds.",FormletHelpers.SuccessF(msg))));
         });
        });
       }));
       f1=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       };
       return f1(x);
      },
      TagSubstitutionForm:function()
      {
       var chooseTagsForm,x,x1,x2,_builder_,f2,f3;
       chooseTagsForm=Data.$(Data.$((x=function(tFrom)
       {
        return function(tTo)
        {
         return[tFrom,Client2.ParseTags(tTo)];
        };
       },Formlet1.Return(x)),FwL.Input("When a user enters this tag:","You must specify a tag to substitute")),FwL.Input("Replace it with these (comma-separated):","You must specify substitution tag(s)"));
       x1=(x2=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x3,f,f1;
        return _builder_.Bind((x3=(f=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f(chooseTagsForm)),(f1=function(formlet)
        {
         return Enhance.WithSubmitButton(formlet);
        },f1(x3))),Runtime.Tupled(function(_arg188)
        {
         var tTo,tFrom;
         tTo=_arg188[1];
         tFrom=_arg188[0];
         return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:15",[tFrom,tTo])),function(_arg187)
         {
          var tFromPretty,tToPretty,msg;
          return _builder_.ReturnFrom(_arg187.$==0?(tFromPretty="'"+tFrom+"'",(tToPretty=Client2.PrettyTags(tTo),FormletHelpers.SuccessF("Successfully substituting "+tFromPretty+" with "+tToPretty+"."))):(msg=_arg187.$0,FormletHelpers.ErrorF(msg)));
         });
        }));
       })),(f2=function(formlet)
       {
        return Enhance.WithLegend("Substitute tags",formlet);
       },f2(x2)));
       f3=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       };
       return f3(x1);
      }
     }
    },
    Author:{
     Client:{
      RequestAuthorAccount:Runtime.Class({
       get_Body:function()
       {
        var buttonClass,conf,Padding1,Top,Bottom,dataForm,x,x1,x2,x3,x4,x5,x6,x7,f,f1,f2,f3,x8,x9,xa,xb,f4,f5,f6,f7,xc,xd,xe,xf,f8,f9,fa,fb,fc,lc,inputRecord,Placement,fd,fe,_builder_;
        buttonClass=Server.Large();
        conf=(Padding1=(Top={
         $:0
        },(Bottom={
         $:0
        },Runtime.New(Padding,{
         Left:{
          $:0
         },
         Right:{
          $:0
         },
         Top:Top,
         Bottom:Bottom
        }))),Runtime.New(FormContainerConfiguration,{
         Header:{
          $:0
         },
         Padding:Padding1,
         Description:{
          $:0
         },
         BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
         BorderColor:Client3.StandardConfiguration().BorderColor,
         CssClass:Client3.StandardConfiguration().CssClass,
         Style:Client3.StandardConfiguration().Style
        }));
        dataForm=(x=(x1=(x2=Data.$(Data.$(Data.$((x3=function(name)
        {
         return function(email)
         {
          return function(homepage)
          {
           return{
            Name:name,
            Email:email,
            Homepage:homepage
           };
          };
         };
        },Formlet1.Return(x3)),(x4=(x5=(x6=(x7=Controls.Input(this.Name),(f=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must enter a name",arg10);
        },f(x7))),(f1=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f1(x6))),(f2=function(formlet)
        {
         return Enhance.WithTextLabel("Your name",formlet);
        },f2(x5))),(f3=function(formlet)
        {
         return Enhance2.WithCssClass("name",formlet);
        },f3(x4)))),(x8=(x9=(xa=(xb=Controls.Input(this.Email),(f4=Data.Validator().IsEmail("You must enter a valid email"),f4(xb))),(f5=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f5(xa))),(f6=function(formlet)
        {
         return Enhance.WithTextLabel("Your email address",formlet);
        },f6(x9))),(f7=function(formlet)
        {
         return Enhance2.WithCssClass("email",formlet);
        },f7(x8)))),(xc=(xd=(xe=(xf=Controls.Input(""),(f8=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must enter a valid URL",arg10);
        },f8(xf))),(f9=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f9(xe))),(fa=function(formlet)
        {
         return Enhance.WithTextLabel("Your home page",formlet);
        },fa(xd))),(fb=function(formlet)
        {
         return Enhance2.WithCssClass("homepage",formlet);
        },fb(xc)))),(fc=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),fc(x2))),(fd=function(formlet)
        {
         return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
        },fd(x1))),(fe=function(formlet)
        {
         return Enhance.WithCustomFormContainer(conf,formlet);
        },fe(x)));
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         return _builder_.Bind(dataForm,function(_arg50)
         {
          var a;
          return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:59",[_arg50]),Formlet2.LoadingFormlet(a)),function(_arg49)
          {
           return _builder_.ReturnFrom(Formlet1.OfElement(function()
           {
            var e;
            if(_arg49.$==1)
             {
              e=_arg49.$0;
              return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(e)]));
             }
            else
             {
              return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("success")])),List.ofArray([Default.Span(List.ofArray([Default.Text("Your request was received.")]))]));
             }
           }));
          });
         });
        });
       }
      })
     }
    },
    Blog:{
     Client:{
      BreakdownMonthTitle:Runtime.Class({
       get_Body:function()
       {
        var list,x,_this,_this1,_this2,x1,_this3,_this4,x2,f,x3;
        list=jQuery("#"+this.ListId);
        if(this.StartFolded)
         {
          list.hide();
         }
        x=Operators.add(Default.Span(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","cursor: pointer;"))])),List.ofArray([Default.Img(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("src","/images/fold-arrow-closed.png")),Default.Attr().Class("blog-breakdown-arrow"),(_this2=Default.Attr(),(x1=this.StartFolded?"":"display:none;",_this2.NewAttr("style",x1)))])),Default.Img(List.ofArray([(_this3=Default.Attr(),_this3.NewAttr("src","/images/fold-arrow-open.png")),Default.Attr().Class("blog-breakdown-arrow"),(_this4=Default.Attr(),(x2=this.StartFolded?"display:none;":"",_this4.NewAttr("style",x2)))])),Default.Span(List.ofArray([Default.Text(this.Title)]))]));
        f=(x3=function(e)
        {
         return function()
         {
          list.slideToggle("fast");
          return jQuery(e.Body).find("img").toggle();
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x3,arg10);
        });
        f(x);
        return x;
       }
      }),
      EditOrCreateBlogEntryControl:Runtime.Class({
       get_Body:function()
       {
        var daoElt,_this=this,_builder_;
        daoElt=function(f)
        {
         var matchValue,dao;
         matchValue=_this.Dao;
         if(matchValue.$==1)
          {
           dao=matchValue.$0;
           return f(dao);
          }
         else
          {
           return"";
          }
        };
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var tagsString,matchValue,tags,tags1,bodyForm,form,matchValue1,body,publishForm,_builder_2,xb,xc,xd,xe,xf,f8,f9,x10,fa,x11,x12,x13,fb,fc,fd,fe,cl,ff;
         return _builder_.Bind((tagsString=(matchValue=[_this.Dao,_this.DefaultTags],matchValue[0].$==1?(tags=matchValue[0].$0.Tags,Strings.concat(", ",tags)):matchValue[1].$==0?"":(tags1=matchValue[1],Strings.concat(", ",tags1))),(bodyForm=(form=function(initText)
         {
          var _builder_1;
          _builder_1=Formlet1.Do();
          return _builder_1.Delay(function()
          {
           var x,x1,x2,f,f1,f2;
           return _builder_1.Bind((x=(x1=(x2=Controls.TextArea(initText),(f=function(formlet)
           {
            return Enhance.WithTextLabel("Content",formlet);
           },f(x2))),(f1=function(formlet)
           {
            return Enhance.WithCssClass("blog-edit-body",formlet);
           },f1(x1))),(f2=function(formlet)
           {
            return Enhance.WithLabelAbove(formlet);
           },f2(x))),function(_arg114)
           {
            return _builder_1.Bind(Formlet1.OfElement(function()
            {
             var x3,f3,f4;
             x3=Default.Div(List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("preview-title")])),List.ofArray([Default.Text("Article preview:")])),Operators.add(Client4.Translate(_arg114),List.ofArray([Default.Attr().Class("forum-text comment-body preview")]))]));
             f3=(f4=function()
             {
              return SyntaxHighlighter.highlight();
             },function(w)
             {
              return Operators.OnAfterRender(f4,w);
             });
             f3(x3);
             return x3;
            }),function()
            {
             return _builder_1.Return({
              $:1,
              $0:_arg114
             });
            });
           });
          });
         },(matchValue1=_this.Dao,matchValue1.$==0?form(""):matchValue1.$0.Body.$==1?(body=matchValue1.$0.Body.$0,form(body)):Formlet1.Return({
          $:0
         }))),(publishForm=(_builder_2=Formlet1.Do(),_builder_2.Delay(function()
         {
          var x,x1,f,f1,lc,inputRecord,Placement;
          return _builder_2.Bind((x=(x1=Controls.Checkbox(_this.Dao.$==1?_this.Dao.$0.Publish.$==1:false),(f=function(formlet)
          {
           return Enhance.WithTextLabel("Publish this article",formlet);
          },f(x1))),(f1=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
           $:1
          },Runtime.New(LabelConfiguration,{
           Align:inputRecord.Align,
           VerticalAlign:inputRecord.VerticalAlign,
           Placement:Placement
          }))),function(formlet)
          {
           return Enhance.WithLabelConfiguration(lc,formlet);
          }),f1(x))),function(_arg115)
          {
           var patternInput,matchValue2,x2,f2,binder,timeDao,dateDao,date,defaultMinute,defaultHour,defaultDate,x3,x4,f3,f4,x6,x7,x8,f5,f6,x9,xa,f7;
           if(_arg115)
            {
             return _builder_2.ReturnFrom((patternInput=(matchValue2=(x2=_this.Dao,(f2=(binder=function(dao)
             {
              return dao.Publish;
             },function(option)
             {
              return Option.bind(binder,option);
             }),f2(x2))),matchValue2.$==1?(timeDao=matchValue2.$0[1],(dateDao=matchValue2.$0[0],[{
              $:1,
              $0:new Date(dateDao.Year,dateDao.Month,dateDao.Day)
             },timeDao.Hour,timeDao.Minute])):(date=new Date(),[{
              $:1,
              $0:date
             },date.getHours(),date.getMinutes()])),(defaultMinute=patternInput[2],(defaultHour=patternInput[1],(defaultDate=patternInput[0],(_this.Dao.$==1?_this.Dao.$0.Body.$==0:false)?(x3=(x4=[Runtime.New(DateDAO,{
              Year:0,
              Month:0,
              Day:0
             }),Runtime.New(TimeDAO,{
              Hour:0,
              Minute:0,
              TimeZone:0
             })],(f3=Runtime.Tupled(function(arg0)
             {
              return{
               $:1,
               $0:arg0
              };
             }),f3(x4))),(f4=function(x5)
             {
              return Formlet1.Return(x5);
             },f4(x3))):Data.$(Data.$((x6=function(date1)
             {
              return Runtime.Tupled(function(tupledArg)
              {
               var hours,minutes,localDate;
               hours=tupledArg[0];
               minutes=tupledArg[1];
               localDate=new Date(date1.getFullYear(),date1.getMonth(),date1.getDate(),hours,minutes);
               return{
                $:1,
                $0:[Runtime.New(DateDAO,{
                 Year:localDate.getFullYear(),
                 Month:localDate.getMonth()+1,
                 Day:localDate.getDate()
                }),Runtime.New(TimeDAO,{
                 Hour:localDate.getHours(),
                 Minute:localDate.getMinutes(),
                 TimeZone:0
                })]
               };
              });
             },Formlet1.Return(x6)),(x7=(x8=Controls2.Datepicker(defaultDate),(f5=function(formlet)
             {
              return Enhance.WithTextLabel("Publish date:",formlet);
             },f5(x8))),(f6=function(formlet)
             {
              return Enhance.WithLabelAbove(formlet);
             },f6(x7)))),(x9=Data.$(Data.$((xa=function(hour)
             {
              return function(minute)
              {
               return[Number(hour),Number(minute)];
              };
             },Formlet1.Return(xa)),FwLS.InputOptionalWithValue(Global.String(defaultHour),"Publish time:","blog-edit-hour")),FwLS.InputOptionalWithValue(Global.String(defaultMinute),"h","blog-edit-minute")),(f7=function(formlet)
             {
              return Formlet1.Horizontal(formlet);
             },f7(x9)))))))));
            }
           else
            {
             return _builder_2.Return({
              $:0
             });
            }
          });
         })),(xb=(xc=Data.$(Data.$(Data.$(Data.$(Data.$((xd=function(tags2)
         {
          return function(title)
          {
           return function(_abstract_)
           {
            return function(body1)
            {
             return function(publish)
             {
              return{
               Id:daoElt(function(dao)
               {
                return dao.Id;
               }),
               Title:title,
               Description:_abstract_,
               Body:body1,
               Tags:tags2,
               Publish:publish
              };
             };
            };
           };
          };
         },Formlet1.Return(xd)),(xe=(xf=FwLS.InputOptionalWithValue(tagsString,"Tags (comma-separated)","blog-edit-tags"),(f8=function(formlet)
         {
          return Enhance.WithLabelAbove(formlet);
         },f8(xf))),(f9=function(formlet)
         {
          return Formlet1.Map(function(s)
          {
           return Client2.ParseTags(s);
          },formlet);
         },f9(xe)))),(x10=FwLS.InputWithValue(daoElt(function(dao)
         {
          return dao.Title;
         }),"Title","Enter a title","blog-edit-title"),(fa=function(formlet)
         {
          return Enhance.WithLabelAbove(formlet);
         },fa(x10)))),(x11=(x12=(x13=Controls.TextArea(daoElt(function(dao)
         {
          return dao.Description;
         })),(fb=function(formlet)
         {
          return Enhance.WithTextLabel("Abstract",formlet);
         },fb(x13))),(fc=function(formlet)
         {
          return Enhance.WithCssClass("blog-edit-abstract",formlet);
         },fc(x12))),(fd=function(formlet)
         {
          return Enhance.WithLabelAbove(formlet);
         },fd(x11)))),bodyForm),publishForm),(fe=(cl=Server.Large(),function(formlet)
         {
          return Client1.EnhanceWithCustomSubmitButton(cl,"Save",formlet);
         }),fe(xc))),(ff=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },ff(xb)))))),function(_arg112)
         {
          var rpc;
          return _builder_.Bind((rpc=_this.get_Creating()?function(dao)
          {
           return Remoting.Async("IntelliFactory.Trainings:46",[dao]);
          }:function(dao)
          {
           return Remoting.Async("IntelliFactory.Trainings:47",[dao]);
          },Formlet2.LoadingFormletWithLogin(rpc(_arg112))),function(_arg111)
          {
           var msg,articleId;
           return _builder_.ReturnFrom(_arg111.$==1?(msg=_arg111.$0,FormletHelpers.ErrorF(msg)):(articleId=_arg111.$0,(_this.Dao={
            $:1,
            $0:{
             Id:articleId,
             Title:_arg112.Title,
             Description:_arg112.Description,
             Body:_arg112.Body,
             Tags:_arg112.Tags,
             Publish:_arg112.Publish
            }
           },FormletHelpers.SuccessFHtml(List.ofArray([Default.Text("Blog entry successfully updated. "),Operators.add(Default.A(List.ofArray([Default.HRef(_this.SuccessLink+articleId)])),List.ofArray([Default.Text("Click here")])),Default.Text(" to view it.")])))));
          });
         });
        });
       },
       get_Creating:function()
       {
        return this.Dao.$==0;
       }
      }),
      EditTagsButton:Runtime.Class({
       get_Body:function()
       {
        var editPanel,msgPanel,_this,buttonCssClass,x,f,x1,_this1=this;
        editPanel=Default.Div(List.ofArray([Default.Attr().Class("tag-edit")]));
        msgPanel=Default.Div(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","display: block;"))]));
        buttonCssClass=Server.Small();
        return Default.Div(List.ofArray([(x=Client1.Button("Change tags","",buttonCssClass),(f=(x1=function()
        {
         return function()
         {
          var x2,x3,_builder_,f6,f7,f8;
          editPanel["HtmlProvider@32"].Clear(editPanel.Body);
          x2=(x3=(_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           var a;
           return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:43",[_this1.id]),Formlet2.LoadingFormletWithLogin(a)),function(_arg109)
           {
            var tagsString,res,editBox,_this2,_this3,saveButton,x4,f1,x5,cancelButton,x9,f5,xa;
            tagsString=_arg109.$==0?(res=_arg109.$0,res):"[Failed to retrieve tags]";
            editBox=Default.Input(List.ofArray([(_this2=Default.Attr(),_this2.NewAttr("type","text")),(_this3=Default.Attr(),_this3.NewAttr("value",tagsString)),Default.Attr().Class("tag-edit-box")]));
            saveButton=(x4=Client1.Button("Save","",buttonCssClass),(f1=(x5=function()
            {
             return function()
             {
              var x6,x7,_builder_1,f2,f3,f4;
              msgPanel["HtmlProvider@32"].Clear(msgPanel.Body);
              x6=(x7=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
              {
               var a1;
               return _builder_1.Bind((a1=Remoting.Async("IntelliFactory.Trainings:44",[_this1.id,editBox.get_Value()]),Formlet2.LoadingFormlet(a1)),function(_arg110)
               {
                var objectArg,arg00,objectArg1,arg001,msg,objectArg2,arg002,objectArg3,arg003,x8;
                if(_arg110.$==0)
                 {
                  objectArg=msgPanel["HtmlProvider@32"];
                  (arg00=msgPanel.Body,function(arg10)
                  {
                   return objectArg.RemoveClass(arg00,arg10);
                  })("error");
                  objectArg1=msgPanel["HtmlProvider@32"];
                  (arg001=msgPanel.Body,function(arg10)
                  {
                   return objectArg1.AddClass(arg001,arg10);
                  })("success");
                  msgPanel.AppendI(Default.Text("Updated, refresh page to reflect"));
                 }
                else
                 {
                  msg=_arg110.$0;
                  objectArg2=msgPanel["HtmlProvider@32"];
                  (arg002=msgPanel.Body,function(arg10)
                  {
                   return objectArg2.RemoveClass(arg002,arg10);
                  })("success");
                  objectArg3=msgPanel["HtmlProvider@32"];
                  (arg003=msgPanel.Body,function(arg10)
                  {
                   return objectArg3.AddClass(arg003,arg10);
                  })("error");
                  msgPanel.AppendI((x8="Error: "+msg,Default.Text(x8)));
                 }
                return _builder_1.Return(null);
               });
              })),(f2=(f3=function()
              {
               return null;
              },function(formlet)
              {
               return Formlet1.Run(f3,formlet);
              }),f2(x7)));
              f4=function(form)
              {
               return msgPanel.AppendI(form);
              };
              return f4(x6);
             };
            },function(arg10)
            {
             return EventsPervasives.Events().OnClick(x5,arg10);
            }),(f1(x4),x4)));
            cancelButton=(x9=Client1.Button("Cancel","",buttonCssClass),(f5=(xa=function()
            {
             return function()
             {
              var objectArg,arg00,objectArg1,arg001;
              objectArg=msgPanel["HtmlProvider@32"];
              (arg00=msgPanel.Body,function(arg10)
              {
               return objectArg.RemoveClass(arg00,arg10);
              })("success");
              objectArg1=msgPanel["HtmlProvider@32"];
              (arg001=msgPanel.Body,function(arg10)
              {
               return objectArg1.RemoveClass(arg001,arg10);
              })("error");
              msgPanel["HtmlProvider@32"].Clear(msgPanel.Body);
              return editPanel["HtmlProvider@32"].Clear(editPanel.Body);
             };
            },function(arg10)
            {
             return EventsPervasives.Events().OnClick(xa,arg10);
            }),(f5(x9),x9)));
            editPanel.AppendI(editBox);
            editPanel.AppendI(saveButton);
            editPanel.AppendI(cancelButton);
            jQuery(editBox.Body).focus();
            return _builder_.Return(null);
           });
          })),(f6=(f7=function()
          {
           return null;
          },function(formlet)
          {
           return Formlet1.Run(f7,formlet);
          }),f6(x3)));
          f8=function(form)
          {
           return editPanel.AppendI(form);
          };
          return f8(x2);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x))),editPanel,msgPanel]));
       }
      }),
      ScrapeButtonForUsername:Runtime.Class({
       get_Body:function()
       {
        var msgPanel,_this,x,_this1,f,x1,_this2=this;
        msgPanel=Default.Div(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","display: block;"))]));
        if(this.Username.$==1)
         {
          return Default.Div(List.ofArray([(x=Operators.add(Default.A(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("href","#"))])),List.ofArray([Default.Text("Scrape feed")])),(f=(x1=function()
          {
           return function()
           {
            var objectArg,arg00,objectArg1,arg001,x2,_builder_,f1;
            msgPanel["HtmlProvider@32"].Clear(msgPanel.Body);
            objectArg=msgPanel["HtmlProvider@32"];
            (arg00=msgPanel.Body,function(arg10)
            {
             return objectArg.RemoveClass(arg00,arg10);
            })("success");
            objectArg1=msgPanel["HtmlProvider@32"];
            (arg001=msgPanel.Body,function(arg10)
            {
             return objectArg1.RemoveClass(arg001,arg10);
            })("error");
            x2=Default.Div(List.ofArray([(_builder_=Formlet1.Do(),_builder_.Delay(function()
            {
             return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:42",[_this2.Username.$0])),function(_arg108)
             {
              var count,objectArg2,arg002,objectArg3,arg003,text,objectArg4,arg004,msg,objectArg5,arg005,objectArg6,arg006,objectArg7,arg007;
              return _builder_.Return(_arg108.$==0?(count=_arg108.$0,(objectArg2=msgPanel["HtmlProvider@32"],(arg002=msgPanel.Body,function(arg10)
              {
               return objectArg2.RemoveClass(arg002,arg10);
              })("error"),(objectArg3=msgPanel["HtmlProvider@32"],(arg003=msgPanel.Body,function(arg10)
              {
               return objectArg3.AddClass(arg003,arg10);
              })("success"),(text="Success, "+Global.String(count)+" new article(s) loaded",(objectArg4=msgPanel["HtmlProvider@32"],(arg004=msgPanel.Body,function(arg10)
              {
               return objectArg4.AppendNode(arg004,arg10);
              })(msgPanel["HtmlProvider@32"].CreateTextNode(text))))))):(msg=_arg108.$0,(objectArg5=msgPanel["HtmlProvider@32"],(arg005=msgPanel.Body,function(arg10)
              {
               return objectArg5.RemoveClass(arg005,arg10);
              })("success"),(objectArg6=msgPanel["HtmlProvider@32"],(arg006=msgPanel.Body,function(arg10)
              {
               return objectArg6.AddClass(arg006,arg10);
              })("error"),(objectArg7=msgPanel["HtmlProvider@32"],(arg007=msgPanel.Body,function(arg10)
              {
               return objectArg7.AppendNode(arg007,arg10);
              })(msgPanel["HtmlProvider@32"].CreateTextNode(msg)))))));
             });
            }))]));
            f1=function(msg)
            {
             msgPanel["HtmlProvider@32"].Clear(msgPanel.Body);
             return msgPanel.AppendI(msg);
            };
            return f1(x2);
           };
          },function(arg10)
          {
           return EventsPervasives.Events().OnClick(x1,arg10);
          }),(f(x),x))),msgPanel]));
         }
        else
         {
          return Default.Div(Runtime.New(T,{
           $:0
          }));
         }
       }
      }),
      ShowHideArticleButton:Runtime.Class({
       get_Body:function()
       {
        var buttonClass,patternInput,textTo,text,x,f,x1,_this=this;
        buttonClass=Server.Small();
        patternInput=this.IsVisible?["Hide","Show"]:["Show","Hide"];
        textTo=patternInput[1];
        text=patternInput[0];
        x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(buttonClass)])),List.ofArray([Default.Text(text)]));
        f=(x1=function(e)
        {
         return function()
         {
          var matchValue,msg,patternInput1,textTo1,text1,span,x2,f1;
          if(_this.BlogArticleId!=="")
           {
            matchValue=Remoting.Call("IntelliFactory.Trainings:45",[_this.BlogArticleId,!_this.IsVisible]);
            if(matchValue.$==1)
             {
              msg=matchValue.$0;
              e["HtmlProvider@32"].Clear(e.Body);
              return e.AppendI(Default.Text("Can't set visibility"));
             }
            else
             {
              patternInput1=_this.IsVisible?["Hide","Show"]:["Show","Hide"];
              textTo1=patternInput1[1];
              text1=patternInput1[0];
              _this.IsVisible=!_this.IsVisible;
              span=_this.IsVisible?Operators.add(Default.Span(List.ofArray([Default.Attr().Class("head-label price free")])),List.ofArray([Default.Text("Visible")])):Operators.add(Default.Span(List.ofArray([Default.Attr().Class("head-label price not-published")])),List.ofArray([Default.Text("Hidden")]));
              x2=jQuery("#"+_this.BlockId+" .head2 span").empty().append(span.Body);
              f1=function(value)
              {
               value;
              };
              f1(x2);
              e["HtmlProvider@32"].Clear(e.Body);
              return e.AppendI(Default.Text(textTo1));
             }
           }
          else
           {
            return null;
           }
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(x);
        return x;
       }
      })
     }
    },
    Company:{
     Client:{
      AddRemoveAdminsForm:Runtime.Class({
       get_Body:function()
       {
        var _this=this;
        return Client1.AddRemoveAdminsForm(function(name)
        {
         return Remoting.Async("IntelliFactory.Trainings:73",[_this.UrlName,name]);
        },function(name)
        {
         return Remoting.Async("IntelliFactory.Trainings:74",[_this.UrlName,name]);
        },_this.Admins);
       }
      }),
      ConferenceDatesControl:Runtime.Class({
       get_Body:function()
       {
        var form,_builder_,_this=this;
        form=Client5.conferenceDatingForm(false,this.Dao);
        return Default.Div(List.ofArray([(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(form,function(_arg39)
         {
          var x,f;
          return _builder_.Bind((x=Remoting.Async("IntelliFactory.Trainings:72",[_this.GroupUrlName,_arg39]),(f=function(a)
          {
           return Formlet2.LoadingFormletWithLogin(a);
          },f(x))),function(_arg38)
          {
           var msg;
           return _builder_.ReturnFrom(_arg38.$==1?(msg=_arg38.$0,FormletHelpers.ErrorF(msg)):FormletHelpers.SuccessF("Conference was successfully updated."));
          });
         });
        }))]));
       }
      }),
      ContactForm:Runtime.Class({
       get_Body:function()
       {
        var form,x,x1,x2,x3,x4,x5,x6,x7,f,f1,f2,f3,x8,x9,xa,xb,f4,f5,f6,f7,f8,f9,fa,cl,_builder_,_this=this;
        form=(x=(x1=(x2=Data.$(Data.$((x3=function(subject)
        {
         return function(message)
         {
          return[subject,message];
         };
        },Formlet1.Return(x3)),(x4=(x5=(x6=(x7=Controls.Input(""),(f=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You need to enter a subject",arg10);
        },f(x7))),(f1=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f1(x6))),(f2=function(formlet)
        {
         return Enhance.WithTextLabel("Subject",formlet);
        },f2(x5))),(f3=function(formlet)
        {
         return Enhance2.WithCssClass("group-contact-subject",formlet);
        },f3(x4)))),(x8=(x9=(xa=(xb=Controls.TextArea(""),(f4=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You need to enter a message to send",arg10);
        },f4(xb))),(f5=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f5(xa))),(f6=function(formlet)
        {
         return Enhance.WithTextLabel("Message",formlet);
        },f6(x9))),(f7=function(formlet)
        {
         return Enhance2.WithCssClass("group-contact-message",formlet);
        },f7(x8)))),(f8=function(formlet)
        {
         return Enhance2.WithCssClass("group-contact-form",formlet);
        },f8(x2))),(f9=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f9(x1))),(fa=(cl=Server.Large(),function(formlet)
        {
         return Client1.EnhanceWithCustomSubmitButton(cl,"Send",formlet);
        }),fa(x)));
        return Default.Div(List.ofArray([Default.Div(List.ofArray([Default.Text("You can use this form to send an e-mail to the administrators of this group.")])),(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(form,Runtime.Tupled(function(_arg45)
         {
          var subject,message;
          subject=_arg45[0];
          message=_arg45[1];
          return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:69",[_this.GroupId,subject,message])),function(_arg44)
          {
           var msg;
           return _builder_.ReturnFrom(_arg44.$==1?(msg=_arg44.$0,FormletHelpers.ErrorF(msg)):FormletHelpers.SuccessF("Message sent."));
          });
         }));
        }))]));
       }
      }),
      CreateOrEditGroupFormByUsername:Runtime.Class({
       get_Body:function()
       {
        var buttonClass,conf,Padding1,Top,Bottom,x,f,f1,x1,f2,f3,defaultString,_this=this,nameForm,x4,groupInfoForm,x5,x6,x7,x8,x9,xa,f7,f8,f9,fa,xb,xc,xd,xe,fb,fc,fd,fe,ff,shortDescriptionAndDateForm,dateForm,xf,x10,x11,x12,x13,x14,f10,mapping1,f11,f12,f13,f14,f15,lc,inputRecord,Placement,x15,x16,x17,x18,x19,x1a,x1b,x1c,f16,f17,arg00,f18,f19,f1a,f1b,lc1,inputRecord1,Placement1,f1c,locationForm,patternInput,matchValue1,org,id1,matchValue2,loc,dao,form1,x1d,x1e,x1f,x20,f1d,lc2,inputRecord2,Placement2,x21,f1e,lc3,inputRecord3,Placement3,x22,x23,matchValue3,tags1,tags2,f1f,f20,f21,f22,x24,_builder_,f23;
        buttonClass=Server.Large();
        conf=(Padding1=(Top={
         $:0
        },(Bottom={
         $:0
        },Runtime.New(Padding,{
         Left:{
          $:0
         },
         Right:{
          $:0
         },
         Top:Top,
         Bottom:Bottom
        }))),Runtime.New(FormContainerConfiguration,{
         Header:this.Editing.$==1?{
          $:0
         }:(x=(f=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },f("Create a group")),(f1=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f1(x))),
         Padding:Padding1,
         Description:this.Editing.$==1?{
          $:0
         }:(x1=(f2=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },f2("Use this form to create a user group or a conference.")),(f3=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f3(x1))),
         BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
         BorderColor:Client3.StandardConfiguration().BorderColor,
         CssClass:Client3.StandardConfiguration().CssClass,
         Style:Client3.StandardConfiguration().Style
        }));
        defaultString=function(f4)
        {
         var matchValue,x2,f5,mapping,f6,s;
         matchValue=(x2=_this.Editing,(f5=(mapping=(f6=Runtime.Tupled(function(tuple)
         {
          return tuple[1];
         }),function(x3)
         {
          return f4(f6(x3));
         }),function(option)
         {
          return Option.map(mapping,option);
         }),f5(x2)));
         if(matchValue.$==1)
          {
           if(matchValue.$0===null)
            {
             return"";
            }
           else
            {
             s=matchValue.$0;
             return s;
            }
          }
         else
          {
           return"";
          }
        };
        nameForm=Data.$((x4=function(name)
        {
         return name;
        },Formlet1.Return(x4)),FwLS.InputWithValue(defaultString(function(c)
        {
         return c.Name;
        }),"Group name","You must enter a name for your group","group-name"));
        groupInfoForm=(x5=Data.$(Data.$((x6=function(urlname)
        {
         return function(adminEmail)
         {
          return[urlname,adminEmail];
         };
        },Formlet1.Return(x6)),(x7=(x8=(x9=(xa=Controls.Input(defaultString(function(c)
        {
         return c.UrlName;
        })),(f7=function(arg20)
        {
         return Data.Validator().IsRegexMatch("^[0-9a-zA-Z\\-]+$","Your group URL must only contain alphanumeric characters",arg20);
        },f7(xa))),(f8=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f8(x9))),(f9=function(formlet)
        {
         return Enhance.WithTextLabel("Group URL",formlet);
        },f9(x8))),(fa=function(formlet)
        {
         return Enhance2.WithCssClass("group-url",formlet);
        },fa(x7)))),(xb=(xc=(xd=(xe=Controls.Input(defaultString(function(c)
        {
         return c.Email;
        })),(fb=Data.Validator().IsEmail("You must enter an email for the group administrator"),fb(xe))),(fc=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },fc(xd))),(fd=function(formlet)
        {
         return Enhance.WithTextLabel("Group email",formlet);
        },fd(xc))),(fe=function(formlet)
        {
         return Enhance2.WithCssClass("group-email",formlet);
        },fe(xb)))),(ff=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        },ff(x5)));
        shortDescriptionAndDateForm=(dateForm=Data.$((xf=function(date)
        {
         return{
          Year:date.getFullYear(),
          Month:date.getMonth()+1,
          Day:date.getDate()
         };
        },Formlet1.Return(xf)),(x10=(x11=(x12=(x13=Controls3.Calendar((x14=_this.Editing,(f10=(mapping1=Runtime.Tupled(function(tupledArg)
        {
         var id,c;
         id=tupledArg[0];
         c=tupledArg[1];
         return new Date(c.FoundedOnDate.Year,c.FoundedOnDate.Month,c.FoundedOnDate.Day);
        }),function(option)
        {
         return Option.map(mapping1,option);
        }),f10(x14)))),(f11=(f12=function(el)
        {
         var _this1;
         return Operators.add(Default.Div(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("style","padding: 10px;"))])),List.ofArray([el]));
        },function(formlet)
        {
         return Formlet1.MapElement(f12,formlet);
        }),f11(x13))),(f13=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f13(x12))),(f14=function(formlet)
        {
         return Enhance.WithTextLabel("Founded on",formlet);
        },f14(x11))),(f15=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f15(x10)))),(x15=Data.$(Data.$((x16=function(info)
        {
         return function(date)
         {
          return[info,date];
         };
        },Formlet1.Return(x16)),(x17=(x18=(x19=(x1a=(x1b=(x1c=Controls.TextArea(defaultString(function(c)
        {
         return c.ShortDescriptionText;
        })),(f16=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must enter a description for your group",arg10);
        },f16(x1c))),(f17=(arg00=function(s)
        {
         return s.length<=255;
        },function(arg20)
        {
         return Data.Validator().Is(arg00,"You can't enter more than 255 characters",arg20);
        }),f17(x1b))),(f18=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f18(x1a))),(f19=function(formlet)
        {
         return Enhance.WithTextLabel("Description - as shown in the group's listing",formlet);
        },f19(x19))),(f1a=function(formlet)
        {
         return Enhance2.WithCssClass("group-short-description",formlet);
        },f1a(x18))),(f1b=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord1.Align,
         VerticalAlign:inputRecord1.VerticalAlign,
         Placement:Placement1
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc1,formlet);
        }),f1b(x17)))),dateForm),(f1c=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        },f1c(x15))));
        locationForm=(patternInput=(matchValue1=_this.Editing,matchValue1.$==1?(org=matchValue1.$0[1],(id1=matchValue1.$0[0],(matchValue2=org.Location,matchValue2.$==0?[{
         $:0
        },matchValue2]:matchValue2.$==2?[{
         $:0
        },matchValue2]:(loc=matchValue2.$0,[{
         $:1,
         $0:loc.Id
        },matchValue2])))):[{
         $:0
        },{
         $:0,
         $0:LocationDetails.get_Default()
        }]),(dao=patternInput[1],Client6.LocationFormForUsername(_this.Username,dao)));
        form1=(x1d=(x1e=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x1f=function(name)
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var urlName,adminEmail;
          urlName=tupledArg[0];
          adminEmail=tupledArg[1];
          return Runtime.Tupled(function(tupledArg1)
          {
           var shortDescr,date;
           shortDescr=tupledArg1[0];
           date=tupledArg1[1];
           return function(loc1)
           {
            return function(descr)
            {
             return function(banner)
             {
              return function(tags)
              {
               return{
                Name:name,
                UrlName:urlName,
                Email:adminEmail,
                Location:loc1,
                FoundedOnDate:date,
                ShortDescriptionText:shortDescr,
                DescriptionHtml:descr,
                BannerHtml:banner,
                Tags:tags
               };
              };
             };
            };
           };
          });
         });
        },Formlet1.Return(x1f)),nameForm),groupInfoForm),shortDescriptionAndDateForm),locationForm),(x20=FwLS.RichEditorWithValue(defaultString(function(c)
        {
         return c.DescriptionHtml;
        }),"Description markup - on your group's page","You must enter a brief description of your group","group-description"),(f1d=(lc2=(inputRecord2=LabelConfiguration.get_Default(),(Placement2={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord2.Align,
         VerticalAlign:inputRecord2.VerticalAlign,
         Placement:Placement2
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc2,formlet);
        }),f1d(x20)))),(x21=FwLS.RichEditorWithValueOptional(defaultString(function(c)
        {
         return c.BannerHtml;
        }),"Banner markup (optional) - on your group's page","group-banner"),(f1e=(lc3=(inputRecord3=LabelConfiguration.get_Default(),(Placement3={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord3.Align,
         VerticalAlign:inputRecord3.VerticalAlign,
         Placement:Placement3
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc3,formlet);
        }),f1e(x21)))),(x22=FwLS.InputWithValue((x23=(matchValue3=[_this.Editing,_this.DefaultTags],matchValue3[0].$==0?(tags1=matchValue3[1],tags1):(tags2=matchValue3[0].$0[1].Tags,tags2)),(f1f=function(strings)
        {
         return Strings.concat(", ",strings);
        },f1f(x23))),"Tags (comma-separated)","You must enter at least one group tag","group-tags"),(f20=function(formlet)
        {
         return Formlet1.Map(function(s)
         {
          return Client2.ParseTags(s);
         },formlet);
        },f20(x22)))),(f21=function(formlet)
        {
         return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
        },f21(x1e))),(f22=function(formlet)
        {
         return Enhance.WithCustomFormContainer(conf,formlet);
        },f22(x1d)));
        x24=(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(form1,function(_arg43)
         {
          var a,matchValue,orgId,org1;
          return _builder_.Bind((a=(matchValue=_this.Editing,matchValue.$==1?(orgId=matchValue.$0[0],(org1=matchValue.$0[1],Remoting.Async("IntelliFactory.Trainings:65",[orgId,_arg43,_this.Username]))):Remoting.Async("IntelliFactory.Trainings:64",[_arg43,_this.Username])),Formlet2.LoadingFormletWithLogin(a)),function(_arg42)
          {
           return _builder_.ReturnFrom(Formlet1.OfElement(function()
           {
            var e;
            if(_arg42.$==1)
             {
              e=_arg42.$0;
              return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(e)]));
             }
            else
             {
              location.href=_this.ReturnUrl;
              return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("success")])),List.ofArray([Default.Span(List.ofArray([Default.Text(_this.Editing.$==1?"Your group has been edited.":"Your group has been created.")]))]));
             }
           }));
          });
         });
        }));
        f23=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        };
        return f23(x24);
       }
      }),
      GroupSubscribeControl:Runtime.Class({
       get_Body:function()
       {
        var youAreSubscribed,container,x,f,x1,_this=this;
        youAreSubscribed=Default.Span(List.ofArray([Default.Text(this.IsSubscribed?"You are a member.":"You are not a member.")]));
        container=Default.Span(List.ofArray([youAreSubscribed,Default.Span(List.ofArray([Default.Text(" ")])),(x=Operators.add(Default.A(List.ofArray([Default.HRef("#")])),List.ofArray([Default.Text(this.IsSubscribed?"Leave":"Join")])),(f=(x1=function(e)
        {
         return function()
         {
          var matchValue,matchValue1;
          if(_this.IsSubscribed)
           {
            matchValue=Remoting.Call("IntelliFactory.Trainings:68",[_this.GroupId]);
            if(matchValue.$==1)
             {
              if(matchValue.$0.$==0)
               {
                _this.IsSubscribed=false;
                e["HtmlProvider@32"].Clear(e.Body);
                e.AppendI(Default.Text("Join"));
                youAreSubscribed["HtmlProvider@32"].Clear(youAreSubscribed.Body);
                return youAreSubscribed.AppendI(Default.Text("You are not a member."));
               }
              else
               {
                return null;
               }
             }
            else
             {
              return null;
             }
           }
          else
           {
            matchValue1=Remoting.Call("IntelliFactory.Trainings:67",[_this.GroupId]);
            if(matchValue1.$==1)
             {
              if(matchValue1.$0.$==0)
               {
                _this.IsSubscribed=true;
                e["HtmlProvider@32"].Clear(e.Body);
                e.AppendI(Default.Text("Leave"));
                youAreSubscribed["HtmlProvider@32"].Clear(youAreSubscribed.Body);
                return youAreSubscribed.AppendI(Default.Text("You are a member."));
               }
              else
               {
                return null;
               }
             }
            else
             {
              return null;
             }
           }
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x)))]));
        return container;
       }
      }),
      SubmitProposalForm:Runtime.Class({
       get_Body:function()
       {
        var form,x,x1,x2,x3,x4,x5,x6,x7,f,f1,f2,f3,x8,x9,xa,xb,f4,f5,f6,f7,f8,f9,fa,cl,_builder_,_this=this;
        form=(x=(x1=(x2=Data.$(Data.$((x3=function(title)
        {
         return function(abstr)
         {
          return[title,abstr];
         };
        },Formlet1.Return(x3)),(x4=(x5=(x6=(x7=Controls.Input(""),(f=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You need to enter a title",arg10);
        },f(x7))),(f1=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f1(x6))),(f2=function(formlet)
        {
         return Enhance.WithTextLabel("Title",formlet);
        },f2(x5))),(f3=function(formlet)
        {
         return Enhance2.WithCssClass("group-contact-subject",formlet);
        },f3(x4)))),(x8=(x9=(xa=(xb=Controls.TextArea(""),(f4=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must enter an abstract",arg10);
        },f4(xb))),(f5=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f5(xa))),(f6=function(formlet)
        {
         return Enhance.WithTextLabel("Abstract",formlet);
        },f6(x9))),(f7=function(formlet)
        {
         return Enhance2.WithCssClass("group-contact-message",formlet);
        },f7(x8)))),(f8=function(formlet)
        {
         return Enhance2.WithCssClass("group-contact-form",formlet);
        },f8(x2))),(f9=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f9(x1))),(fa=(cl=Server.Large(),function(formlet)
        {
         return Client1.EnhanceWithCustomSubmitButton(cl,"Send",formlet);
        }),fa(x)));
        return Default.Div(List.ofArray([Default.Div(List.ofArray([Default.Text("You can use this form to submit a talk proposal.  You will be notified in email about acceptance.")])),(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(form,Runtime.Tupled(function(_arg47)
         {
          var title,abstr;
          title=_arg47[0];
          abstr=_arg47[1];
          return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:70",[_this.GroupId,title,abstr])),function(_arg46)
          {
           var msg;
           return _builder_.ReturnFrom(_arg46.$==1?(msg=_arg46.$0,FormletHelpers.ErrorF(msg)):FormletHelpers.SuccessF("Your talk proposal was recorded. Thanks!"));
          });
         }));
        }))]));
       }
      }),
      TurnGroupToConferenceControl:Runtime.Class({
       get_Body:function()
       {
        var form,f,_builder_,_this=this;
        form=Client5.conferenceDatingForm(true,ConferenceExtraDAO.FromDate(this.StartDateDao));
        if(this.GroupUrlName.$==1)
         {
          return Default.Div(List.ofArray([Operators.add(Default.P(List.ofArray([Default.Attr().Class("warning")])),List.ofArray([(f=function(x)
          {
           return Default.Text(x);
          },f("You can turn this group into a conference by filling in the form below. Note that this can NOT be reversed. If you have existing group\r\n                            members they will no longer be shown on the conference's page."))])),(_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           return _builder_.Bind(form,function(_arg41)
           {
            return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:71",[_this.GroupUrlName.$0,_arg41])),function(_arg40)
            {
             var msg;
             return _builder_.ReturnFrom(_arg40.$==1?(msg=_arg40.$0,FormletHelpers.ErrorF(msg)):(location.href=location.href,FormletHelpers.SuccessF("Group was successfully converted to a conference.")));
            });
           });
          }))]));
         }
        else
         {
          return Default.Div(Runtime.New(T,{
           $:0
          }));
         }
       }
      }),
      conferenceDatingForm:function(isNew,extra)
      {
       var x,x1,x2,x3,x4,x5,x6,f,f1,f2,f3,f4,cl,submit;
       x=(x1=(x2=(x3=Data.$((x4=Data.$((x5=Runtime.Tupled(function(tupledArg)
       {
        var _arg1,_arg2;
        _arg1=tupledArg[0];
        _arg2=tupledArg[1];
        return function(proposals)
        {
         var startTime,startDate,endTime,endDate;
         startTime=_arg1[1];
         startDate=_arg1[0];
         endTime=_arg2[1];
         endDate=_arg2[0];
         return Runtime.New(ConferenceExtraDAO,{
          StartDate:startDate,
          StartTime:startTime,
          EndDate:endDate,
          EndTime:endTime,
          ProposalSettings:proposals
         });
        };
       }),Formlet1.Return(x5)),Data.$(Data.$((x6=Runtime.Tupled(function(d1)
       {
        return Runtime.Tupled(function(d2)
        {
         return[d1,d2];
        });
       }),Formlet1.Return(x6)),Client5.datesForm("Starts on",extra.StartDate,extra.StartTime)),Client5.datesForm("Ends on",extra.EndDate,extra.EndTime))),(f=function(formlet)
       {
        return Formlet1.Horizontal(formlet);
       },f(x4))),Client5.talkSubmissionOptionForm(extra.ProposalSettings)),(f1=function(formlet)
       {
        return Formlet1.Vertical(formlet);
       },f1(x3))),(f2=function(formlet)
       {
        return Enhance2.WithCssClass("make-conference-form",formlet);
       },f2(x2))),(f3=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f3(x1)));
       f4=(cl=Server.Large(),(submit=isNew?"Make it a conference":"Edit conference",function(formlet)
       {
        return Client1.EnhanceWithCustomSubmitButton(cl,submit,formlet);
       }));
       return f4(x);
      },
      datesForm:function(lbl,dateDao,timeDao)
      {
       var x,x1,x2,x3,x4,x5,arg0,f,f1,f2,f3,f4,lc,inputRecord,Placement,f5;
       x=Data.$(Data.$((x1=function(date)
       {
        return function(time)
        {
         return[Runtime.New(DateDAO,{
          Year:date.getFullYear(),
          Month:date.getMonth()+1,
          Day:date.getDate()
         }),time];
        };
       },Formlet1.Return(x1)),(x2=(x3=(x4=(x5=Controls3.Calendar((arg0=new Date(dateDao.Year,dateDao.Month,dateDao.Day),{
        $:1,
        $0:arg0
       })),(f=(f1=function(el)
       {
        var _this;
        return Operators.add(Default.Div(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","padding: 10px;"))])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f1,formlet);
       }),f(x5))),(f2=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f2(x4))),(f3=function(formlet)
       {
        return Enhance.WithTextLabel(lbl,formlet);
       },f3(x3))),(f4=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
        $:2
       },Runtime.New(LabelConfiguration,{
        Align:inputRecord.Align,
        VerticalAlign:inputRecord.VerticalAlign,
        Placement:Placement
       }))),function(formlet)
       {
        return Enhance.WithLabelConfiguration(lc,formlet);
       }),f4(x2)))),Client5.timesForm(timeDao));
       f5=function(formlet)
       {
        return Formlet1.Vertical(formlet);
       };
       return f5(x);
      },
      talkSubmissionOptionForm:function(dao)
      {
       var daysBeforeForm,options,i1,x7,initSelection,_builder_;
       daysBeforeForm=function(i)
       {
        var x,x1,x2,x3,x4,x5,x6,f1,f2,f3,f4,f5,f6,f7;
        x=Data.$(Data.$((x1=function(days)
        {
         return function()
         {
          var f;
          f=function(arg0)
          {
           return{
            $:1,
            $0:arg0
           };
          };
          return f(days);
         };
        },Formlet1.Return(x1)),(x2=(x3=(x4=(x5=(x6=Controls.Input(Global.String(i)),(f1=function(formlet)
        {
         return Enhance.WithTextLabel("Proposal submission ends",formlet);
        },f1(x6))),(f2=Data.Validator().IsInt("You must enter an integer value"),f2(x5))),(f3=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f3(x4))),(f4=function(formlet)
        {
         return Enhance2.WithCssClass("submission-ends",formlet);
        },f4(x3))),(f5=(f6=function(s)
        {
         return Number(s);
        },function(formlet)
        {
         return Formlet1.Map(f6,formlet);
        }),f5(x2)))),Formlet1.OfElement(function()
        {
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("days-before")])),List.ofArray([Default.Text("days before the conference")]));
        }));
        f7=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        };
        return f7(x);
       };
       options=List.ofArray([["Yes",daysBeforeForm(dao.$==1?(i1=dao.$0,i1):30)],["No",(x7={
        $:0
       },Formlet1.Return(x7))]]);
       initSelection=dao.$==1?0:1;
       _builder_=Formlet1.Do();
       return _builder_.Delay(function()
       {
        return _builder_.Bind(FwLS.Select(initSelection,"Can proposals be submitted?",options,"proposal-submit"),function(_arg37)
        {
         return _builder_.ReturnFrom(_arg37);
        });
       });
      },
      timesForm:function(def)
      {
       var hours,x,x1,f,mapping,f1,minutes,x2,x3,f2,mapping1,f3,tzones,x4,x5,f4,mapping2,f5,x6,x7,x8,f6,f7,x9,f8,f9,xa,fa,fb,fc;
       hours=(x=(x1=Operators1.range(0,23),(f=(mapping=function(i)
       {
        return[Global.String(i),Global.String(i)];
       },function(source)
       {
        return Seq.map(mapping,source);
       }),f(x1))),(f1=function(source)
       {
        return Seq.toList(source);
       },f1(x)));
       minutes=(x2=(x3=Operators1.step(0,15,45),(f2=(mapping1=function(i)
       {
        return[i===0?"00":Global.String(i),Global.String(i)];
       },function(source)
       {
        return Seq.map(mapping1,source);
       }),f2(x3))),(f3=function(source)
       {
        return Seq.toList(source);
       },f3(x2)));
       tzones=(x4=(x5=Operators1.range(0,24),(f4=(mapping2=function(i)
       {
        return["GMT"+(i<12?Global.String(i-12):i===12?"":"+"+Global.String(i-12)),Global.String(i-12)];
       },function(source)
       {
        return Seq.map(mapping2,source);
       }),f4(x5))),(f5=function(source)
       {
        return Seq.toList(source);
       },f5(x4)));
       x6=Data.$(Data.$(Data.$((x7=function(seHour)
       {
        return function(seMinute)
        {
         return function(seZone)
         {
          return Runtime.New(TimeDAO,{
           Hour:seHour,
           Minute:seMinute,
           TimeZone:seZone
          });
         };
        };
       },Formlet1.Return(x7)),(x8=FwS.Select(def.Hour,hours,"starts-at-hours"),(f6=(f7=function(s)
       {
        return Number(s);
       },function(formlet)
       {
        return Formlet1.Map(f7,formlet);
       }),f6(x8)))),(x9=FwS.Select(def.Minute/15>>0,minutes,"starts-at-minutes"),(f8=(f9=function(s)
       {
        return Number(s);
       },function(formlet)
       {
        return Formlet1.Map(f9,formlet);
       }),f8(x9)))),(xa=FwS.Select(def.TimeZone+12,tzones,"starts-at-zones"),(fa=(fb=function(s)
       {
        return Number(s);
       },function(formlet)
       {
        return Formlet1.Map(fb,formlet);
       }),fa(xa))));
       fc=function(formlet)
       {
        return Formlet1.Horizontal(formlet);
       };
       return fc(x6);
      }
     }
    },
    Config:{
     Button:{
      Server:{
       Comment:function()
       {
        return"buttonPro white small";
       },
       Highlight:function()
       {
        return"buttonPro blue small";
       },
       Large:function()
       {
        return"buttonPro blue space-top space-bottom";
       },
       Small:function()
       {
        return"buttonPro white small";
       }
      }
     }
    },
    CourseSummaries:Runtime.Class({
     get_Body:function()
     {
      var x,f;
      x=Client7.CoursesSummaries(this.BaseUrl);
      f=function(a)
      {
       return Client3.LoadingPane(a);
      };
      return f(x);
     }
    }),
    Courses:{
     Client:{
      AcceptRejectProposalButtonsControl:Runtime.Class({
       Form:function(getData,realForm)
       {
        var x,_builder_,_this=this,f;
        return Default.Div(List.ofArray([(x=(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         var a;
         return _builder_.Bind((a=getData(_this.CourseId),Formlet2.LoadingFormletWithLogin(a)),function(_arg136)
         {
          var initText,msg;
          return _builder_.ReturnFrom(_arg136.$==0?(initText=_arg136.$0,realForm(initText)):(msg=_arg136.$0,FormletHelpers.ErrorF(msg)));
         });
        })),(f=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f(x)))]));
       },
       get_Body:function()
       {
        var acceptButton,rejectButton,formContainer,showForm,hideAcceptForm,_this=this,hideRejectForm,showAcceptForm,showRejectForm,f3,x5,f4,x6;
        acceptButton=Operators.add(Default.A(List.ofArray([Default.Attr().Class(this.get_CssClass())])),List.ofArray([Default.Text("Accept proposal...")]));
        rejectButton=Operators.add(Default.A(List.ofArray([Default.Attr().Class(this.get_CssClass())])),List.ofArray([Default.Text("Reject proposal...")]));
        formContainer=jQuery("#"+this.ContainerId+" .proposal-accept-reject-container > div");
        showForm=function(formFun)
        {
         return formContainer.empty().append(formFun.Body);
        };
        hideAcceptForm=function()
        {
         var value,objectArg,arg00;
         _this.IsAcceptFormVisible=false;
         value=Server.Small();
         objectArg=acceptButton["HtmlProvider@32"];
         ((arg00=acceptButton.Body,function(arg10)
         {
          return function(arg20)
          {
           return objectArg.SetAttribute(arg00,arg10,arg20);
          };
         })("class"))(value);
         return formContainer.empty();
        };
        hideRejectForm=function()
        {
         var value,objectArg,arg00;
         _this.IsRejectFormVisible=false;
         value=Server.Small();
         objectArg=rejectButton["HtmlProvider@32"];
         ((arg00=rejectButton.Body,function(arg10)
         {
          return function(arg20)
          {
           return objectArg.SetAttribute(arg00,arg10,arg20);
          };
         })("class"))(value);
         return formContainer.empty();
        };
        showAcceptForm=function()
        {
         var value,objectArg,arg00,acceptForm,arg001;
         _this.IsAcceptFormVisible=true;
         value=Server.Highlight();
         objectArg=acceptButton["HtmlProvider@32"];
         ((arg00=acceptButton.Body,function(arg10)
         {
          return function(arg20)
          {
           return objectArg.SetAttribute(arg00,arg10,arg20);
          };
         })("class"))(value);
         acceptForm=function(initText)
         {
          var _builder_;
          _builder_=Formlet1.Do();
          return _builder_.Delay(function()
          {
           var x,x1,x2,f,x3,f1,lc,inputRecord,Placement,f2,cl;
           return _builder_.Bind((x=Data.$(Data.$((x1=function(t)
           {
            return function(i)
            {
             return[t,i];
            };
           },Formlet1.Return(x1)),(x2=FwL.TextAreaWithValueOptional(initText,"Acceptance message to the author:"),(f=function(formlet)
           {
            return Enhance.WithLabelAbove(formlet);
           },f(x2)))),(x3=Controls.RadioButtonGroup({
            $:1,
            $0:0
           },List.ofArray([["Accept for one session",true],["Accept as a course (possibly recurring event)",false]])),(f1=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
            $:1
           },Runtime.New(LabelConfiguration,{
            Align:inputRecord.Align,
            VerticalAlign:inputRecord.VerticalAlign,
            Placement:Placement
           }))),function(formlet)
           {
            return Enhance.WithLabelConfiguration(lc,formlet);
           }),f1(x3)))),(f2=(cl=_this.get_CssClass(),function(formlet)
           {
            return Client1.EnhanceWithCustomSubmitAndResetButtons(cl,"Confirm","Reset message",formlet);
           }),f2(x))),Runtime.Tupled(function(_arg138)
           {
            var text,isOneOff,a;
            text=_arg138[0];
            isOneOff=_arg138[1];
            return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:39",[_this.CourseId,text,isOneOff]),Formlet2.LoadingFormletWithLogin(a)),function(_arg137)
            {
             var _this1,x4,msg;
             return _builder_.ReturnFrom(_arg137.$==0?FormletHelpers.SuccessFHtml(List.ofArray([Default.P(List.ofArray([Default.Text("Acceptance message sent.")])),Default.P(List.ofArray([Default.Text("To schedule the talk, "),Operators.add(Default.A(List.ofArray([(_this1=Default.Attr(),(x4=_this.CreateEventUrl,_this1.NewAttr("href",x4)))])),List.ofArray([Default.Text("click here")])),Default.Text(".")]))])):(msg=_arg137.$0,FormletHelpers.ErrorF(msg)));
            });
           }));
          });
         };
         return showForm((arg001=function(courseId)
         {
          return Remoting.Async("IntelliFactory.Trainings:37",[courseId]);
         },_this.Form(arg001,acceptForm)));
        };
        showRejectForm=function()
        {
         var value,objectArg,arg00,rejectForm,arg001;
         _this.IsRejectFormVisible=true;
         value=Server.Highlight();
         objectArg=rejectButton["HtmlProvider@32"];
         ((arg00=rejectButton.Body,function(arg10)
         {
          return function(arg20)
          {
           return objectArg.SetAttribute(arg00,arg10,arg20);
          };
         })("class"))(value);
         rejectForm=function(initText)
         {
          var _builder_;
          _builder_=Formlet1.Do();
          return _builder_.Delay(function()
          {
           var x,x1,f,f1,cl;
           return _builder_.Bind((x=(x1=FwL.TextAreaWithValueOptional(initText,"Rejection message to the author:"),(f=function(formlet)
           {
            return Enhance.WithLabelAbove(formlet);
           },f(x1))),(f1=(cl=_this.get_CssClass(),function(formlet)
           {
            return Client1.EnhanceWithCustomSubmitAndResetButtons(cl,"Confirm","Reset message",formlet);
           }),f1(x))),function(_arg140)
           {
            var a;
            return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:40",[_this.CourseId,_arg140]),Formlet2.LoadingFormletWithLogin(a)),function(_arg139)
            {
             var msg;
             return _builder_.ReturnFrom(_arg139.$==0?FormletHelpers.SuccessFHtml(List.ofArray([Default.P(List.ofArray([Default.Text("Rejection message sent.")]))])):(msg=_arg139.$0,FormletHelpers.ErrorF(msg)));
            });
           });
          });
         };
         return showForm((arg001=function(courseId)
         {
          return Remoting.Async("IntelliFactory.Trainings:38",[courseId]);
         },_this.Form(arg001,rejectForm)));
        };
        return Default.Span(List.ofArray([(f3=(x5=function()
        {
         return function()
         {
          hideRejectForm(null);
          if(_this.IsAcceptFormVisible)
           {
            return hideAcceptForm(null);
           }
          else
           {
            return showAcceptForm(null);
           }
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x5,arg10);
        }),(f3(acceptButton),acceptButton)),(f4=(x6=function()
        {
         return function()
         {
          hideAcceptForm(null);
          if(_this.IsRejectFormVisible)
           {
            return hideRejectForm(null);
           }
          else
           {
            return showRejectForm(null);
           }
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x6,arg10);
        }),(f4(rejectButton),rejectButton))]));
       },
       get_CssClass:function()
       {
        return Server.Small();
       }
      }),
      ActivateCourseControl:Runtime.Class({
       get_Body:function()
       {
        var buttonClass,patternInput,textTo,text,button,_this=this;
        buttonClass=Server.Small();
        patternInput=this.Active?["Disable","Publish"]:["Publish","Disable"];
        textTo=patternInput[1];
        text=patternInput[0];
        button=function(cssClass)
        {
         var x,f,x1;
         x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(cssClass)])),List.ofArray([Default.Text(text)]));
         f=(x1=function(e)
         {
          return function()
          {
           var matchValue,msg,patternInput1,textTo1,text1,span,x2,f1,x3,f2;
           if(_this.CourseId>0)
            {
             matchValue=Remoting.Call("IntelliFactory.Trainings:41",[_this.CourseId,_this.Active]);
             if(matchValue.$==1)
              {
               msg=matchValue.$0;
               e["HtmlProvider@32"].Clear(e.Body);
               return e.AppendI(Default.Text("Can't Disable"));
              }
             else
              {
               _this.Active=!_this.Active;
               patternInput1=_this.Active?["Publish","Disable"]:["Disable","Publish"];
               textTo1=patternInput1[1];
               text1=patternInput1[0];
               span=_this.Active?Operators.add(Default.Span(List.ofArray([Default.Attr().Class("head-label active price free")])),List.ofArray([Default.Text("Active")])):Operators.add(Default.Span(List.ofArray([Default.Attr().Class("head-label active price not-published")])),List.ofArray([Default.Text("Inactive")]));
               x2=jQuery("#"+_this.ContainerId+" .head2 span span.active").remove();
               f1=function(value)
               {
                value;
               };
               f1(x2);
               x3=jQuery("#"+_this.ContainerId+" .head2 span").append(span.Body);
               f2=function(value)
               {
                value;
               };
               f2(x3);
               e["HtmlProvider@32"].Clear(e.Body);
               return e.AppendI(Default.Text(textTo1));
              }
            }
           else
            {
             return null;
            }
          };
         },function(arg10)
         {
          return EventsPervasives.Events().OnClick(x1,arg10);
         });
         f(x);
         return x;
        };
        return button(buttonClass);
       }
      }),
      CreateEventOrCourseControlForUsername:Runtime.Class({
       get_Body:function()
       {
        var buttonClass,conf,Padding1,Top,Bottom,x,f,f1,x1,f2,f3,detailsForm,inPersonForm,x2,x3,f5,lc,inputRecord,Placement,webcastForm,x5,x6,f6,lc1,inputRecord1,Placement1,newCourseForm,x7,x8,f7,lc2,inputRecord2,Placement2,newEventForCourseForm,courses,x9,f8,defaultCourse,matchValue,id,f9,predicate,xa,xb,xc,xd,xe,fa,fb,fc,xf,_builder_,_this=this,fd,form,x10,matchValue1,extra1,x11,_builder_1,f11;
        buttonClass=Server.Large();
        conf=(Padding1=(Top={
         $:0
        },(Bottom={
         $:0
        },Runtime.New(Padding,{
         Left:{
          $:0
         },
         Right:{
          $:0
         },
         Top:Top,
         Bottom:Bottom
        }))),Runtime.New(FormContainerConfiguration,{
         Header:(x=(f=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },f("Create an event or a course")),(f1=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f1(x))),
         Padding:Padding1,
         Description:(x1=(f2=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },f2("Use this form to create one-time events such as in-class trainings or webcasts; new courses; or instances of events for existing courses.")),(f3=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f3(x1))),
         BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
         BorderColor:Client3.StandardConfiguration().BorderColor,
         CssClass:Client3.StandardConfiguration().CssClass,
         Style:Client3.StandardConfiguration().Style
        }));
        detailsForm=(inPersonForm=(x2=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x3=function()
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var courseNumber,title,isActive;
          courseNumber=tupledArg[0];
          title=tupledArg[1];
          isActive=tupledArg[2];
          return Runtime.Tupled(function(tupledArg1)
          {
           var abstr,date;
           abstr=tupledArg1[0];
           date=tupledArg1[1];
           return function(timeAndDuration)
           {
            return function(descr)
            {
             return function(outl)
             {
              return function()
              {
               return function(loc)
               {
                var x4,f4;
                x4={
                 CourseNumber:courseNumber,
                 Title:title,
                 Abstract:abstr,
                 Description:descr,
                 Outline:outl,
                 IsActive:isActive,
                 Date:date,
                 TimeAndDuration:timeAndDuration,
                 Location:loc
                };
                f4=function(arg0)
                {
                 return{
                  $:1,
                  $0:arg0
                 };
                };
                return f4(x4);
               };
              };
             };
            };
           };
          });
         });
        },Formlet1.Return(x3)),Forms.StepForm(1,"Event details")),Default1.CourseNumberAndTitleAndIsActiveForm()),Default1.CourseAbstractAndDateFormWithAbstract(this.DefaultAbstract)),Default1.StartsAtAndLastsForForm()),FwLS.RichEditor("Event description","You must enter a course description","description")),FwLS.RichEditor("Event outline","You must enter a course outline","outline")),Forms.StepForm(2,"Location details")),Default1.LocationFormForUsername(this.Username)),(f5=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f5(x2))),(webcastForm=(x5=Data.$(Data.$(Data.$(Data.$(Data.$((x6=function()
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var number,title,isActive;
          number=tupledArg[0];
          title=tupledArg[1];
          isActive=tupledArg[2];
          return Runtime.Tupled(function(tupledArg1)
          {
           var abs,date;
           abs=tupledArg1[0];
           date=tupledArg1[1];
           return function(timeAndDuration)
           {
            return function(content)
            {
             var x4,f4;
             x4={
              CourseNumber:number,
              Title:title,
              Abstract:abs,
              IsActive:isActive,
              Date:date,
              TimeAndDuration:timeAndDuration,
              Details:content
             };
             f4=function(arg0)
             {
              return{
               $:0,
               $0:arg0
              };
             };
             return f4(x4);
            };
           };
          });
         });
        },Formlet1.Return(x6)),Forms.StepForm(1,"Event details")),Default1.CourseNumberAndTitleAndIsActiveForm()),Default1.CourseAbstractAndDateFormWithAbstract(this.DefaultAbstract)),Default1.StartsAtAndLastsForForm()),Default1.WebcastDetailsForm()),(f6=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord1.Align,
         VerticalAlign:inputRecord1.VerticalAlign,
         Placement:Placement1
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc1,formlet);
        }),f6(x5))),(newCourseForm=(x7=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x8=function()
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var courseNumber,title,isActive;
          courseNumber=tupledArg[0];
          title=tupledArg[1];
          isActive=tupledArg[2];
          return function(abs)
          {
           return function()
           {
            return function(desc)
            {
             return function(outl)
             {
              var x4,f4;
              x4={
               CourseNumber:courseNumber,
               Title:title,
               Abstract:abs,
               Description:desc,
               Outline:outl,
               IsActive:isActive,
               IsOneOff:false
              };
              f4=function(arg0)
              {
               return{
                $:2,
                $0:arg0
               };
              };
              return f4(x4);
             };
            };
           };
          };
         });
        },Formlet1.Return(x8)),Forms.StepForm(1,"Course details")),Default1.CourseNumberAndTitleAndIsActiveForm()),FwLS.TextArea("Course abstract","You must enter a course abstract","description")),Forms.StepForm(2,"Course outline")),FwLS.RichEditor("Course description","You must enter a course description","description")),FwLS.RichEditor("Course outline","You must enter a course outline","outline")),(f7=(lc2=(inputRecord2=LabelConfiguration.get_Default(),(Placement2={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord2.Align,
         VerticalAlign:inputRecord2.VerticalAlign,
         Placement:Placement2
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc2,formlet);
        }),f7(x7))),(newEventForCourseForm=(courses=(x9=Remoting.Call("IntelliFactory.Trainings:63",[this.Username]),(f8=function(courses1)
        {
         return Runtime.New(T,{
          $:1,
          $0:["<Select>",0],
          $1:courses1
         });
        },f8(x9))),(defaultCourse=(matchValue=this.DefaultType,matchValue.$==3?matchValue.$0.$==1?(id=matchValue.$0.$0,Operators1.DefaultArg((f9=(predicate=Runtime.Tupled(function(tupledArg)
        {
         var _arg1,cid;
         _arg1=tupledArg[0];
         cid=tupledArg[1];
         return cid===id;
        }),function(list)
        {
         return Seq.tryFindIndex(predicate,list);
        }),f9(courses)),0)):0:0),Data.$(Data.$(Data.$(Data.$(Data.$((xa=function()
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var courseId,isActive;
          courseId=tupledArg[0];
          isActive=tupledArg[1];
          return Runtime.Tupled(function(tupledArg1)
          {
           var abs,date;
           abs=tupledArg1[0];
           date=tupledArg1[1];
           return function(timeAndDuration)
           {
            return function(details)
            {
             var x4,f4;
             x4={
              TrainingCourseId:courseId,
              Abstract:abs,
              Date:date,
              IsActive:isActive,
              TimeAndDuration:timeAndDuration,
              Details:details
             };
             f4=function(arg0)
             {
              return{
               $:3,
               $0:arg0
              };
             };
             return f4(x4);
            };
           };
          });
         });
        },Formlet1.Return(xa)),Forms.StepForm(1,"Course details")),(xb=Data.$((xc=Data.$((xd=function(courseId)
        {
         return function(isActive)
         {
          return[courseId,isActive];
         };
        },Formlet1.Return(xd)),(xe=FwLS.Select(defaultCourse,"Course",courses,"courses"),(fa=function(arg20)
        {
         return Data.Validator().IsGreaterThan(0,"Must select a course",arg20);
        },fa(xe)))),(fb=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },fb(xc))),Controls3.CheckboxButton("Active",true)),(fc=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        },fc(xb)))),Default1.CourseAbstractAndDateFormWithAbstract(this.DefaultAbstract)),Default1.StartsAtAndLastsForForm()),Default1.WebcastContentOrInClassLocationFormForUsername(this.Username)))),(xf=(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         var x4,f4;
         return _builder_.Bind((x4=Controls.Select(_this.DefaultType.get_Index(),List.ofArray([["New one-time webcast",Runtime.New(CreateEventOrCourseType,{
          $:0
         })],["New one-time training",Runtime.New(CreateEventOrCourseType,{
          $:1
         })],["New course",Runtime.New(CreateEventOrCourseType,{
          $:2
         })],["New event for an existing course",Runtime.New(CreateEventOrCourseType,{
          $:3,
          $0:{
           $:0
          }
         })]])),(f4=function(formlet)
         {
          return Enhance.WithTextLabel("Type of event",formlet);
         },f4(x4))),function(_arg158)
         {
          return _builder_.Bind(_arg158.$==1?inPersonForm:_arg158.$==2?newCourseForm:_arg158.$==3?newEventForCourseForm:webcastForm,function(_arg157)
          {
           return _builder_.Return(_arg157);
          });
         });
        })),(fd=function(formlet)
        {
         return Formlet1.Vertical(formlet);
        },fd(xf)))))));
        form=Data.$(Data.$(Data.$((x10=function(info)
        {
         return function(paymentProcessing)
         {
          return function(extra)
          {
           return{
            Details:info,
            PaymentProcessing:paymentProcessing,
            Extra:extra
           };
          };
         };
        },Formlet1.Return(x10)),detailsForm),Default1.PaymentProcessingForm()),(matchValue1=_this.DefaultExtra,matchValue1.$==1?(extra1=matchValue1.$0,Forms.ExtraInfoFormForUsername(_this.Username,extra1)):Default1.ExtraInfoFormForUsername(_this.Username)));
        x11=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
        {
         var x4,x12,f4,fe,ff;
         return _builder_1.Bind((x4=(x12=(f4=function(formlet)
         {
          return Enhance2.WithCssClass("add-event-form",formlet);
         },f4(form)),(fe=function(formlet)
         {
          return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
         },fe(x12))),(ff=function(formlet)
         {
          return Enhance.WithCustomFormContainer(conf,formlet);
         },ff(x4))),function(_arg160)
         {
          var x13,f10;
          return _builder_1.Bind((x13=Remoting.Async("IntelliFactory.Trainings:60",[_arg160]),(f10=function(a)
          {
           return Formlet2.LoadingFormletWithLogin(a);
          },f10(x13))),function(_arg159)
          {
           return _builder_1.ReturnFrom(Formlet1.OfElement(function()
           {
            var e;
            if(_arg159.$==1)
             {
              e=_arg159.$0;
              return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(e)]));
             }
            else
             {
              location.href=_this.MyPageUrl;
              return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("success")])),List.ofArray([Default.Span(List.ofArray([Default.Text("\r\n                                Your event has been created.")]))]));
             }
           }));
          });
         });
        }));
        f11=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        };
        return f11(x11);
       }
      }),
      EditCourseControl:Runtime.Class({
       get_Body:function()
       {
        var course,conf,Padding1,Top,Bottom,x,f,f1,arg01,form,x1,x2,x3,x4,f2,f3,f4,cl,x5,_builder_,_this=this,f5;
        course=this.Course.$0;
        conf=(Padding1=(Top={
         $:0
        },(Bottom={
         $:0
        },Runtime.New(Padding,{
         Left:{
          $:0
         },
         Right:{
          $:0
         },
         Top:Top,
         Bottom:Bottom
        }))),Runtime.New(FormContainerConfiguration,{
         Header:(x=(f=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },f("Edit a course")),(f1=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f1(x))),
         Padding:Padding1,
         Description:(arg01={
          $:1,
          $0:function()
          {
           return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("Use this form to edit a course."),Default.Br(Runtime.New(T,{
            $:0
           })),Default.Text("Please note that all changes made here will be reflected\r\n                                             in existing events associated with this course.")]))]));
          }
         },{
          $:1,
          $0:arg01
         }),
         BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
         BorderColor:Client3.StandardConfiguration().BorderColor,
         CssClass:Client3.StandardConfiguration().CssClass,
         Style:Client3.StandardConfiguration().Style
        }));
        form=(x1=(x2=(x3=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x4=function()
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var number,title,isActive;
          number=tupledArg[0];
          title=tupledArg[1];
          isActive=tupledArg[2];
          return function(abs)
          {
           return function()
           {
            return Runtime.Tupled(function(tupledArg1)
            {
             var descr,outl;
             descr=tupledArg1[0];
             outl=tupledArg1[1];
             return function(pricing)
             {
              return function(extra)
              {
               return{
                Id:course.Id,
                CourseNumber:number,
                Title:title,
                IsActive:isActive,
                Abstract:abs,
                Outline:outl,
                Description:descr,
                PaymentProcessing:pricing,
                Extra:extra
               };
              };
             };
            });
           };
          };
         });
        },Formlet1.Return(x4)),Forms.StepForm(1,"Course details")),Forms.CourseNumberAndTitleAndIsActiveForm(false,course.CourseNumber,course.Title,course.IsActive)),Forms.CourseAbstractForm(course.Abstract)),Forms.StepForm(2,"Course outline")),Forms.CourseDescriptionAndOutlineForm(false,course.Description,course.Outline)),Forms.PaymentProcessingForm(course.PaymentProcessing)),Forms.ExtraInfoFormForUsername(this.Username,course.Extra)),(f2=function(formlet)
        {
         return Enhance.WithCustomFormContainer(conf,formlet);
        },f2(x3))),(f3=function(formlet)
        {
         return Enhance2.WithCssClass("add-event-form edit-course-form",formlet);
        },f3(x2))),(f4=(cl=Server.Large(),function(formlet)
        {
         return Client1.EnhanceWithSubmitAndResetButtons(cl,formlet);
        }),f4(x1)));
        return Default.Div(List.ofArray([(x5=(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(form,function(_arg162)
         {
          return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:62",[_arg162])),function(_arg161)
          {
           var msg,i;
           return _builder_.ReturnFrom(_arg161.$==1?(msg=_arg161.$0,FormletHelpers.ErrorF(msg)):(i=_arg161.$0,(location.href=_this.SuccessPageUrl,FormletHelpers.SuccessF("The course has been modified."))));
          });
         });
        })),(f5=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f5(x5)))]));
       }
      }),
      EditEventControl:Runtime.Class({
       get_Body:function()
       {
        var event,conf,Padding1,Top,Bottom,x,f,f1,x1,f2,x2,f3,f4,form,x3,x4,x5,x6,f5,f6,f7,cl,x7,_builder_,_this=this,f9;
        event=this.Event.$0;
        conf=(Padding1=(Top={
         $:0
        },(Bottom={
         $:0
        },Runtime.New(Padding,{
         Left:{
          $:0
         },
         Right:{
          $:0
         },
         Top:Top,
         Bottom:Bottom
        }))),Runtime.New(FormContainerConfiguration,{
         Header:(x=(f=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },f("Edit an event")),(f1=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f1(x))),
         Padding:Padding1,
         Description:(x1=event.IsOneOff?(f2=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },f2("Use this form to edit an event.")):(x2=function()
         {
          return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("Use this form to edit an event.")])),Default.P(List.ofArray([Default.Text("This event is associated with a course. Modifying the fields in red will modify the course,\r\n                                                  which will alter all other events associated with this course.")]))]));
         },(f3=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f3(x2))),(f4=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },f4(x1))),
         BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
         BorderColor:Client3.StandardConfiguration().BorderColor,
         CssClass:Client3.StandardConfiguration().CssClass,
         Style:Client3.StandardConfiguration().Style
        }));
        form=(x3=(x4=(x5=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x6=function()
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var number,title,isActive;
          number=tupledArg[0];
          title=tupledArg[1];
          isActive=tupledArg[2];
          return Runtime.Tupled(function(tupledArg1)
          {
           var abs,date;
           abs=tupledArg1[0];
           date=tupledArg1[1];
           return Runtime.Tupled(function(tupledArg2)
           {
            var descr,outl;
            descr=tupledArg2[0];
            outl=tupledArg2[1];
            return function(timeAndDuration)
            {
             return function(details)
             {
              return function(pricing)
              {
               return function(extra)
               {
                return{
                 Id:event.Id,
                 Title:title,
                 IsActive:isActive,
                 Abstract:abs,
                 Outline:outl,
                 Description:descr,
                 CourseNumber:number,
                 Date:date,
                 TimeAndDuration:timeAndDuration,
                 Details:details,
                 PaymentProcessing:pricing,
                 Extra:extra,
                 IsOneOff:event.IsOneOff
                };
               };
              };
             };
            };
           });
          });
         });
        },Formlet1.Return(x6)),Forms.StepForm(1,"Course details")),Forms.CourseNumberAndTitleAndIsActiveForm(!event.IsOneOff,event.CourseNumber,event.Title,event.IsActive)),Forms.CourseAbstractAndDateForm(!event.IsOneOff,event.Abstract,{
         $:1,
         $0:event.Date.get_ToEcma()
        })),Forms.CourseDescriptionAndOutlineForm(!event.IsOneOff,event.Description,event.Outline)),Forms.StartsAtAndLastsForForm(event.TimeAndDuration)),Forms.WebcastContentOrInClassLocationForEditFormForUsername(this.Username,event.Details)),Forms.PaymentProcessingForm(event.PaymentProcessing)),Forms.ExtraInfoFormForUsername(this.Username,event.Extra)),(f5=function(formlet)
        {
         return Enhance.WithCustomFormContainer(conf,formlet);
        },f5(x5))),(f6=function(formlet)
        {
         return Enhance2.WithCssClass("add-event-form",formlet);
        },f6(x4))),(f7=(cl=Server.Large(),function(formlet)
        {
         return Client1.EnhanceWithSubmitAndResetButtons(cl,formlet);
        }),f7(x3)));
        return Default.Div(List.ofArray([(x7=(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(form,function(_arg164)
         {
          var x8,f8;
          return _builder_.Bind((x8=Remoting.Async("IntelliFactory.Trainings:61",[_arg164]),(f8=function(a)
          {
           return Formlet2.LoadingFormletWithLogin(a);
          },f8(x8))),function(_arg163)
          {
           var msg,i;
           return _builder_.ReturnFrom(_arg163.$==1?(msg=_arg163.$0,FormletHelpers.ErrorF(msg)):(i=_arg163.$0,(location.href=_this.MyPageUrl,FormletHelpers.SuccessF("The event has been modified."))));
          });
         });
        })),(f9=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f9(x7)))]));
       }
      }),
      Forms:{
       CourseAbstractAndDateForm:function(isCourseDataSpecial,def_abs,def_date)
       {
        var x,x1,x2,x3,f,f1,lc,inputRecord,Placement,x4,x5,x6,x7,f2,f3,f4,f5,f6,lc1,inputRecord1,Placement1,f7;
        x=Data.$(Data.$((x1=function(abs)
        {
         return function(date)
         {
          var value,value1;
          return[abs,Runtime.New(DateDAO,{
           Year:date.getFullYear(),
           Month:(value=EcmaScript["Date.GetNetMonth"](date),Number(value)),
           Day:(value1=date.getDate(),Number(value1))
          })];
         };
        },Formlet1.Return(x1)),(x2=(x3=FwLS.TextAreaWithValue(def_abs,"Event abstract","You must enter an event abstract","abstract"),(f=Forms.EnhanceWithSpecialLabel(isCourseDataSpecial,"Event abstract"),f(x3))),(f1=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f1(x2)))),(x4=(x5=(x6=(x7=Controls2.Datepicker(def_date),(f2=(f3=function(el)
        {
         var _this;
         return Operators.add(Default.Div(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","padding: 5px;"))])),List.ofArray([el]));
        },function(formlet)
        {
         return Formlet1.MapElement(f3,formlet);
        }),f2(x7))),(f4=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f4(x6))),(f5=function(formlet)
        {
         return Enhance.WithTextLabel("Date",formlet);
        },f5(x5))),(f6=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord1.Align,
         VerticalAlign:inputRecord1.VerticalAlign,
         Placement:Placement1
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc1,formlet);
        }),f6(x4))));
        f7=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        };
        return f7(x);
       },
       CourseAbstractForm:function(def_abs)
       {
        var x,f,lc,inputRecord,Placement;
        x=FwLS.TextAreaWithValue(def_abs,"Course abstract","You must enter a course abstract","abstract");
        f=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        });
        return f(x);
       },
       CourseDescriptionAndOutlineForm:function(isCourseDataSpecial,def_descr,def_outl)
       {
        var x,x1,x2,f,f1,lc,inputRecord,Placement,x3,x4,f2,f3,lc1,inputRecord1,Placement1;
        return Data.$(Data.$((x=function(descr)
        {
         return function(outl)
         {
          return[descr,outl];
         };
        },Formlet1.Return(x)),(x1=(x2=FwLS.RichEditorWithValue(def_descr,"Description of the course","You should provide a description of the course","course-description"),(f=Forms.EnhanceWithSpecialLabel(isCourseDataSpecial,"Description of the course"),f(x2))),(f1=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f1(x1)))),(x3=(x4=FwLS.RichEditorWithValue(def_outl,"Outline of the course","You should provide an outline of the course","course-outline"),(f2=Forms.EnhanceWithSpecialLabel(isCourseDataSpecial,"Outline of the course"),f2(x4))),(f3=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord1.Align,
         VerticalAlign:inputRecord1.VerticalAlign,
         Placement:Placement1
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc1,formlet);
        }),f3(x3))));
       },
       CourseNumberAndTitleAndIsActiveForm:function(isCourseDataSpecial,def_number,def_title,def_isActive)
       {
        var x,x1,x2,f,f1;
        x=Data.$(Data.$((x1=function(title)
        {
         return function(isActive)
         {
          return[def_number,title,isActive];
         };
        },Formlet1.Return(x1)),(x2=FwLS.InputWithValue(def_title,"Title","You must enter a title","title"),(f=Forms.EnhanceWithSpecialLabel(isCourseDataSpecial,"Title"),f(x2)))),Controls3.CheckboxButton("Active",def_isActive));
        f1=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        };
        return f1(x);
       },
       Default:{
        CourseAbstractAndDateForm:function()
        {
         return Default1.CourseAbstractAndDateFormWithAbstract("");
        },
        CourseAbstractAndDateFormWithAbstract:function(abstr)
        {
         return Forms.CourseAbstractAndDateForm(false,abstr,{
          $:0
         });
        },
        CourseNumberAndTitleAndIsActiveForm:function()
        {
         return Forms.CourseNumberAndTitleAndIsActiveForm(false,"N/A","",true);
        },
        ExtraInfoFormForUsername:function(username)
        {
         return Forms.ExtraInfoFormForUsername(username,ExtraInformationDAO.Default(username));
        },
        LocationFormForUsername:function(username)
        {
         return Client6.LocationFormForUsername(username,{
          $:0,
          $0:LocationDetails.get_Default()
         });
        },
        PaymentProcessingForm:function()
        {
         return Forms.PaymentProcessingForm({
          $:0,
          $0:PricingDAO.get_Default()
         });
        },
        PricingForm:function()
        {
         return Forms.PricingForm(true,PricingDAO.get_Default());
        },
        StartsAtAndLastsForForm:function()
        {
         return Forms.StartsAtAndLastsForForm(TimeAndDurationDAO.get_Default());
        },
        WebcastContentOrInClassLocationFormForUsername:function(username)
        {
         var arg0;
         return Forms.WebcastContentOrInClassLocationFormForUsername(username,(arg0=EventOrCourseDetailsDAO_WebcastDetails.Default(),{
          $:1,
          $0:arg0
         }));
        },
        WebcastDetailsForm:function()
        {
         return Forms.WebcastDetailsForm(EventOrCourseDetailsDAO_WebcastDetails.Default());
        }
       },
       EnhanceWithSpecialLabel:function(isSpecial,label)
       {
        var labelGen;
        if(isSpecial)
         {
          labelGen=function()
          {
           var x,_this;
           return Operators.add((x=List.ofArray([Default.Attr().Class("special")]),(_this=Default.Tags(),_this.NewTag("label",x))),List.ofArray([Default.Text(label)]));
          };
          return function(formlet)
          {
           return Enhance.WithLabel(labelGen,formlet);
          };
         }
        else
         {
          return function(x)
          {
           return x;
          };
         }
       },
       ExtraInfoFormForUsername:function(username,dao)
       {
        var companies,x,x1,f,mapping,f1,indexComp,matchValue,urlName,x2,p,f2,x3,_builder_,x4,f3;
        companies=(x=(x1=Remoting.Call("IntelliFactory.Trainings:66",[username]),(f=(mapping=function(comp)
        {
         return[comp.Name,comp.UrlName];
        },function(list)
        {
         return List.map(mapping,list);
        }),f(x1))),(f1=function(comps)
        {
         return Runtime.New(T,{
          $:1,
          $0:["<None>",""],
          $1:comps
         });
        },f1(x)));
        indexComp=(matchValue=dao.AssociatedGroupUrlName,matchValue.$==1?(urlName=matchValue.$0,(x2=(p=Runtime.Tupled(function(tupledArg)
        {
         var _arg1,n;
         _arg1=tupledArg[0];
         n=tupledArg[1];
         return n===urlName;
        }),Seq.tryFindIndex(p,companies)),(f2=function(o)
        {
         return Operators1.DefaultArg(o,0);
        },f2(x2)))):0);
        return Data.$(Data.$(Data.$((x3=function()
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var orgName,authorUsername;
          orgName=tupledArg[0];
          authorUsername=tupledArg[1];
          return function(tags)
          {
           return Runtime.New(ExtraInformationDAO,{
            Tags:tags,
            AssociatedGroupUrlName:orgName===""?{
             $:0
            }:{
             $:1,
             $0:orgName
            },
            CreateAsAuthorUsername:authorUsername
           });
          };
         });
        },Formlet1.Return(x3)),Forms.StepForm(4,"Almost there...")),(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(FwLS.Select(indexComp,"Associate event with",companies,"Selecting an organization or group is optional"),function(_arg156)
         {
          var a;
          return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:36",[username,_arg156,dao.CreateAsAuthorUsername]),Formlet2.LoadingFormlet(a)),function(_arg155)
          {
           var patternInput,index,res,res1,indexAuthors,authors;
           patternInput=_arg155.$==0?_arg155.$0[1].$==1?(index=_arg155.$0[1].$0,(res=_arg155.$0[0],[res,index])):(res1=_arg155.$0[0],[res1,0]):[List.ofArray([["[Myself]",username]]),0];
           indexAuthors=patternInput[1];
           authors=patternInput[0];
           return _builder_.Bind(FwLS.Select(indexAuthors,"Event author",authors,"Selecting an author is optional"),function(_arg154)
           {
            return _builder_.Return([_arg156,_arg154]);
           });
          });
         });
        }))),(x4=FwLS.InputWithValue(Strings.concat(", ",dao.Tags),"Tags (comma-separated)","You must choose at least one tag","tags"),(f3=function(formlet)
        {
         return Formlet1.Map(function(s)
         {
          return Client2.ParseTags(s);
         },formlet);
        },f3(x4))));
       },
       LocationWithEditExistingFormForUsername:function(username,def_dao)
       {
        var locStepForm,addressForm,newLocationForm,existingLocationForm,x8,_builder_1,f9,lc1,inputRecord1,Placement1;
        locStepForm=Forms.StepForm(2,"Location details");
        addressForm=function(def)
        {
         var x,x1,x2,x3,f,f1,f2,f3,x4,x5,x6,f4,f5,f6,f7,x7,f8,lc,inputRecord,Placement;
         return Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x=function(descr)
         {
          return function(s1)
          {
           return function(s2)
           {
            return function(city)
            {
             return function(state)
             {
              return function(zip)
              {
               return function(country)
               {
                return function(memo)
                {
                 return Runtime.New(LocationDetails,{
                  Description:descr,
                  Street1:s1,
                  Street2:s2,
                  City:city,
                  State:state,
                  Country:country,
                  Zip:zip,
                  Memo:memo
                 });
                };
               };
              };
             };
            };
           };
          };
         },Formlet1.Return(x)),FwLS.InputWithValue(def.Description,"Description","You must enter a description","location-description")),FwLS.InputWithValue(def.Street1,"Street 1","You must enter a street","street-1")),(x1=(x2=(x3=Controls.Input(def.Street2.$==0?"":def.Street2.$0),(f=(f1=function(s)
         {
          if(s.toLowerCase()!=="")
           {
            return{
             $:1,
             $0:s
            };
           }
          else
           {
            return{
             $:0
            };
           }
         },function(formlet)
         {
          return Formlet1.Map(f1,formlet);
         }),f(x3))),(f2=function(formlet)
         {
          return Enhance.WithTextLabel("Street 2",formlet);
         },f2(x2))),(f3=function(formlet)
         {
          return Enhance2.WithCssClass("street-2",formlet);
         },f3(x1)))),FwLS.InputWithValue(def.City,"City","You must enter a city","city")),(x4=(x5=(x6=Controls.Input(def.State.$==0?"":def.State.$0),(f4=(f5=function(s)
         {
          if(s.toLowerCase()!=="")
           {
            return{
             $:1,
             $0:s
            };
           }
          else
           {
            return{
             $:0
            };
           }
         },function(formlet)
         {
          return Formlet1.Map(f5,formlet);
         }),f4(x6))),(f6=function(formlet)
         {
          return Enhance.WithTextLabel("State",formlet);
         },f6(x5))),(f7=function(formlet)
         {
          return Enhance2.WithCssClass("state",formlet);
         },f7(x4)))),FwLS.InputWithValue(def.Zip,"Zip code","You must enter a zip code","zip")),FwLS.InputWithValue(def.Country,"Country","You must enter a country","country")),(x7=FwLS.RichEditorWithValueOptional(def.Memo,"Directions","memo"),(f8=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
          $:2
         },Runtime.New(LabelConfiguration,{
          Align:inputRecord.Align,
          VerticalAlign:inputRecord.VerticalAlign,
          Placement:Placement
         }))),function(formlet)
         {
          return Enhance.WithLabelConfiguration(lc,formlet);
         }),f8(x7))));
        };
        newLocationForm=function()
        {
         var x,f,f1;
         x=addressForm(LocationDetails.get_Default());
         f=(f1=function(arg0)
         {
          return{
           $:0,
           $0:arg0
          };
         },function(formlet)
         {
          return Formlet1.Map(f1,formlet);
         });
         return f(x);
        };
        existingLocationForm=function()
        {
         var patternInput,l,locIdOption,def,locations,x,x1,f,mapping,f1,_builder_;
         patternInput=def_dao.$==1?(l=def_dao.$0,[{
          $:1,
          $0:l
         },{
          $:1,
          $0:l.Id
         }]):[{
          $:0
         },{
          $:0
         }];
         locIdOption=patternInput[1];
         def=patternInput[0];
         locations=(x=(x1=Remoting.Call("IntelliFactory.Trainings:75",[username,locIdOption]),(f=(mapping=function(loc)
         {
          return[loc.Details.Description,{
           $:1,
           $0:loc
          }];
         },function(list)
         {
          return List.map(mapping,list);
         }),f(x1))),(f1=function(locs)
         {
          return Runtime.New(T,{
           $:1,
           $0:["<Select>",{
            $:0
           }],
           $1:locs
          });
         },f1(x)));
         _builder_=Formlet1.Do();
         return _builder_.Delay(function()
         {
          var x2,x3,x4,def1,f2,predicate,f3,arg00,f4,f5;
          return _builder_.Bind((x2=(x3=(x4=Controls.Select(def.$==1?(def1=def.$0,(f2=(predicate=Runtime.Tupled(function(tupledArg)
          {
           var _arg1,i;
           _arg1=tupledArg[0];
           i=tupledArg[1];
           if(i.$==1)
            {
             return i.$0.Id===def1.Id;
            }
           else
            {
             return false;
            }
          }),function(list)
          {
           return Seq.findIndex(predicate,list);
          }),f2(locations))):0,locations),(f3=(arg00=function(opt)
          {
           if(opt.$==1)
            {
             return opt.$0.Id>0;
            }
           else
            {
             return false;
            }
          },function(arg20)
          {
           return Data.Validator().Is(arg00,"You must select an existing location",arg20);
          }),f3(x4))),(f4=function(formlet)
          {
           return Enhance.WithValidationIcon(formlet);
          },f4(x3))),(f5=function(formlet)
          {
           return Enhance.WithTextLabel("Address",formlet);
          },f5(x2))),function(_arg145)
          {
           return _builder_.Bind(addressForm(_arg145.$0.Details),function(_arg144)
           {
            var Id;
            return _builder_.Return({
             $:1,
             $0:(Id=_arg145.$0.Id,{
              Details:_arg144,
              Id:Id
             })
            });
           });
          });
         });
        };
        x8=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
        {
         return _builder_1.Bind(locStepForm,function()
         {
          var def,x,f;
          return _builder_1.Bind((def=def_dao.$==1?1:def_dao.$==2?0:0,(x=Controls.Select(def,List.ofArray([["New address",true],["Existing address",false]])),(f=function(formlet)
          {
           return Enhance.WithTextLabel("Choose location",formlet);
          },f(x)))),function(_arg147)
          {
           return _builder_1.Bind(_arg147?newLocationForm(null):existingLocationForm(null),function(_arg146)
           {
            return _builder_1.Return(_arg146);
           });
          });
         });
        }));
        f9=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
         $:0
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord1.Align,
         VerticalAlign:inputRecord1.VerticalAlign,
         Placement:Placement1
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc1,formlet);
        });
        return f9(x8);
       },
       PaymentProcessingForm:function(dao)
       {
        var patternInput,pricing,pricing1,defPricing,def,isExternalProcessingForm,x,_builder_;
        patternInput=dao.$==1?(pricing=dao.$1,[1,pricing]):(pricing1=dao.$0,[0,pricing1]);
        defPricing=patternInput[1];
        def=patternInput[0];
        isExternalProcessingForm=function()
        {
         return FwL.Select(def,"Payment processing",List.ofArray([["Processed by FPish",false],["External processing",true]]));
        };
        return Data.$(Data.$((x=function()
        {
         return function(res)
         {
          return res;
         };
        },Formlet1.Return(x)),Forms.StepForm(3,"Pricing details")),(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(isExternalProcessingForm(null),function(_arg153)
         {
          var url,s,x1,x2;
          return _builder_.ReturnFrom(_arg153?(url=dao.$==1?(s=dao.$0,s):"",Data.$(Data.$((x1=function(url1)
          {
           return function(pricing2)
           {
            return{
             $:1,
             $0:url1,
             $1:pricing2
            };
           };
          },Formlet1.Return(x1)),FwL.InputWithValue(url,"Payment processing URL","You must enter a URL for payment processing")),Forms.PricingForm(false,defPricing))):Data.$(Data.$((x2=function()
          {
           return function(pricing2)
           {
            return{
             $:0,
             $0:pricing2
            };
           };
          },Formlet1.Return(x2)),Formlet1.OfElement(function()
          {
           return Default.Div(List.ofArray([Default.Span(List.ofArray([Default.Text("Paid event processing through FPish is not available yet.")])),Default.Br(Runtime.New(T,{
            $:0
           })),Default.Span(List.ofArray([Default.Text("If you want to offer paid events, you need to provide your checkout URL using \"External processing\" above.")]))]));
          })),Forms.PricingForm(true,PricingDAO.get_Default())));
         });
        })));
       },
       PricingForm:function(isReadOnly,dao)
       {
        var patternInput,input,clas,x,x1,f,f1;
        patternInput=isReadOnly?[function(defValue)
        {
         return function(label)
         {
          return function(validationMsg)
          {
           return function(cssClass)
           {
            return ReadOnly.Input(defValue,label,validationMsg,cssClass);
           };
          };
         };
        },"inactive"]:[function(value)
        {
         return function(label)
         {
          return function(validationMsg)
          {
           return function(cssClass)
           {
            return FwLS.InputWithValue(value,label,validationMsg,cssClass);
           };
          };
         };
        },""];
        input=patternInput[0];
        clas=patternInput[1];
        return Data.$(Data.$((x=function(price)
        {
         return function(curr)
         {
          return Runtime.New(PricingDAO,{
           Price:price,
           Currency:curr
          });
         };
        },Formlet1.Return(x)),(x1=(((input(Global.String(dao.Price)))("Price"))("You must enter a price"))("price "+clas),(f=(f1=function(t)
        {
         return Number(t);
        },function(formlet)
        {
         return Formlet1.Map(f1,formlet);
        }),f(x1)))),(((input(dao.Currency))("Currency"))("You must enter a currency"))("currency "+clas));
       },
       StartsAtAndLastsForForm:function(def)
       {
        var hours,x,x1,f,mapping,f1,minutes,x2,x3,f2,mapping1,f3,tzones,x4,x5,f4,mapping2,f5,lastsFor,minutes1,x6,x7,f6,mapping3,f7,hours1,x8,x9,f8,mapping4,f9,days,xa,xb,fa,mapping5,fb,b,a,b1,xc,xd,xe,fc,fd,xf,fe,ff,x10,f10,f11,x11,f12,predicate,f13,f14,f15;
        hours=(x=(x1=Operators1.range(0,23),(f=(mapping=function(i)
        {
         return[Global.String(i),Global.String(i)];
        },function(source)
        {
         return Seq.map(mapping,source);
        }),f(x1))),(f1=function(source)
        {
         return Seq.toList(source);
        },f1(x)));
        minutes=(x2=(x3=Operators1.step(0,15,45),(f2=(mapping1=function(i)
        {
         return[i===0?"00":Global.String(i),Global.String(i)];
        },function(source)
        {
         return Seq.map(mapping1,source);
        }),f2(x3))),(f3=function(source)
        {
         return Seq.toList(source);
        },f3(x2)));
        tzones=(x4=(x5=Operators1.range(0,24),(f4=(mapping2=function(i)
        {
         return["GMT"+(i<12?Global.String(i-12):i===12?"":"+"+Global.String(i-12)),Global.String(i-12)];
        },function(source)
        {
         return Seq.map(mapping2,source);
        }),f4(x5))),(f5=function(source)
        {
         return Seq.toList(source);
        },f5(x4)));
        lastsFor=(minutes1=(x6=(x7=Operators1.step(15,15,60),(f6=(mapping3=function(i)
        {
         return[Global.String(i)+" minutes",Global.String(i)];
        },function(source)
        {
         return Seq.map(mapping3,source);
        }),f6(x7))),(f7=function(source)
        {
         return Seq.toList(source);
        },f7(x6))),(hours1=(x8=(x9=Operators1.range(2,8),(f8=(mapping4=function(i)
        {
         return[Global.String(i)+" hours",Global.String(i*60)];
        },function(source)
        {
         return Seq.map(mapping4,source);
        }),f8(x9))),(f9=function(source)
        {
         return Seq.toList(source);
        },f9(x8))),(days=(xa=(xb=Operators1.range(2,30),(fa=(mapping5=function(i)
        {
         return[Global.String(i)+" days",Global.String(i*60*24)];
        },function(source)
        {
         return Seq.map(mapping5,source);
        }),fa(xb))),(fb=function(source)
        {
         return Seq.toList(source);
        },fb(xa))),(b=(a=List.ofArray([["90 minutes","90"]]),(b1=List.append(hours1,days),List.append(a,b1))),List.append(minutes1,b)))));
        xc=Data.$(Data.$(Data.$(Data.$(Data.$((xd=function(seHour)
        {
         return function(seMinute)
         {
          return function(seZone)
          {
           return function()
           {
            return function(lastFor)
            {
             return Runtime.New(TimeAndDurationDAO,{
              StartsAtHour:seHour,
              StartsAtMinute:seMinute,
              StartsAtTimeZone:seZone,
              LastsForMinutes:lastFor
             });
            };
           };
          };
         };
        },Formlet1.Return(xd)),(xe=FwLS.Select(def.StartsAtHour,"Starts at",hours,"starts-at-hours"),(fc=(fd=function(s)
        {
         return Number(s);
        },function(formlet)
        {
         return Formlet1.Map(fd,formlet);
        }),fc(xe)))),(xf=FwS.Select(def.StartsAtMinute/15>>0,minutes,"starts-at-minutes"),(fe=(ff=function(s)
        {
         return Number(s);
        },function(formlet)
        {
         return Formlet1.Map(ff,formlet);
        }),fe(xf)))),(x10=FwS.Select(def.StartsAtTimeZone+12,tzones,"starts-at-zones"),(f10=(f11=function(s)
        {
         return Number(s);
        },function(formlet)
        {
         return Formlet1.Map(f11,formlet);
        }),f10(x10)))),Formlet1.OfElement(function()
        {
         return Default.Div(List.ofArray([Default.Attr().Class("starts-at-space")]));
        })),(x11=FwLS.Select((f12=(predicate=Runtime.Tupled(function(tupledArg)
        {
         var _arg1,v;
         _arg1=tupledArg[0];
         v=tupledArg[1];
         return v===Global.String(def.LastsForMinutes);
        }),function(list)
        {
         return Seq.findIndex(predicate,list);
        }),f12(lastsFor)),"Lasts for",lastsFor,"lasts-for"),(f13=(f14=function(s)
        {
         return Number(s);
        },function(formlet)
        {
         return Formlet1.Map(f14,formlet);
        }),f13(x11))));
        f15=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        };
        return f15(xc);
       },
       StepForm:function(num,title)
       {
        var imgSrc,imgAlt;
        imgSrc="/images/step"+Global.String(num)+".png";
        imgAlt="Step "+Global.String(num);
        return Formlet1.OfElement(function()
        {
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("add-event-form-sep")])),List.ofArray([Default.Img(List.ofArray([Default.Src(imgSrc),Default.Alt(imgAlt)])),Default.H1(List.ofArray([Default.Text(title)]))]));
        });
       },
       WebcastContentOrInClassLocationForEditFormForUsername:function(username,dao)
       {
        var _default_,_builder_;
        _default_=dao.$==0?1:0;
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x,f;
         return _builder_.Bind((x=Controls.Select(_default_,List.ofArray([["Webcast",true],["In class-training",false]])),(f=function(formlet)
         {
          return Enhance.WithTextLabel("Type of event",formlet);
         },f(x))),function(_arg152)
         {
          var _dao_,w,x1,f1,f2,_dao_1,w1,x2,f3,f4;
          return _builder_.Bind(_arg152?(_dao_=dao.$==1?(w=dao.$0,w):EventOrCourseDetailsDAO_WebcastDetails.Default(),(x1=Forms.WebcastDetailsForm(_dao_),(f1=(f2=function(webcastContent)
          {
           return{
            $:1,
            $0:webcastContent
           };
          },function(formlet)
          {
           return Formlet1.Map(f2,formlet);
          }),f1(x1)))):(_dao_1=dao.$==0?(w1=dao.$0,w1):{
           $:0,
           $0:LocationDetails.get_Default()
          },(x2=Forms.LocationWithEditExistingFormForUsername(username,_dao_1),(f3=(f4=function(location1)
          {
           return{
            $:0,
            $0:location1
           };
          },function(formlet)
          {
           return Formlet1.Map(f4,formlet);
          }),f3(x2)))),function(_arg151)
          {
           return _builder_.Return(_arg151);
          });
         });
        });
       },
       WebcastContentOrInClassLocationFormForUsername:function(username,dao)
       {
        var _default_,_builder_;
        _default_=dao.$==0?1:0;
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x,f;
         return _builder_.Bind((x=Controls.Select(_default_,List.ofArray([["Webcast",true],["In class-training",false]])),(f=function(formlet)
         {
          return Enhance.WithTextLabel("Type of event",formlet);
         },f(x))),function(_arg150)
         {
          var _dao_,w,x1,f1,f2,_dao_1,w1,x2,x3,f3,f4;
          return _builder_.Bind(_arg150?(_dao_=dao.$==1?(w=dao.$0,w):EventOrCourseDetailsDAO_WebcastDetails.Default(),(x1=Forms.WebcastDetailsForm(_dao_),(f1=(f2=function(webcastContent)
          {
           return{
            $:1,
            $0:webcastContent
           };
          },function(formlet)
          {
           return Formlet1.Map(f2,formlet);
          }),f1(x1)))):(_dao_1=dao.$==0?(w1=dao.$0,w1):{
           $:0,
           $0:LocationDetails.get_Default()
          },(x2=Data.$(Data.$((x3=function()
          {
           return function(l)
           {
            return l;
           };
          },Formlet1.Return(x3)),Forms.StepForm(2,"Location details")),Client6.LocationFormForUsername(username,_dao_1)),(f3=(f4=function(location1)
          {
           return{
            $:0,
            $0:location1
           };
          },function(formlet)
          {
           return Formlet1.Map(f4,formlet);
          }),f3(x2)))),function(_arg149)
          {
           return _builder_.Return(_arg149);
          });
         });
        });
       },
       WebcastDetailsForm:function(dao)
       {
        var _default_,matchValue,x,x1,x2,f,lc,inputRecord,Placement,_builder_,f2,lc1,inputRecord1,Placement1;
        _default_=(matchValue=dao.Content,matchValue.$==0?1:matchValue.$==1?2:0);
        x=Data.$(Data.$((x1=function(joinInstructions)
        {
         return function(content)
         {
          return Runtime.New(EventOrCourseDetailsDAO_WebcastDetails,{
           Content:content,
           InstructionsToJoin:joinInstructions
          });
         };
        },Formlet1.Return(x1)),(x2=FwLS.TextAreaWithValueOptional(dao.InstructionsToJoin,"Instructions to join","instructions-to-join"),(f=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f(x2)))),(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(Forms.StepForm(2,"Online content details"),function()
         {
          var x3,f1;
          return _builder_.Bind((x3=Controls.Select(_default_,List.ofArray([["None yet",1],["URL",2],["HTML block",3]])),(f1=function(formlet)
          {
           return Enhance.WithTextLabel("Content type",formlet);
          },f1(x3))),function(_arg142)
          {
           var value,matchValue1,s,x4,value1,matchValue2,s2,x5,x6;
           return _builder_.Bind(_arg142===2?(value=(matchValue1=dao.Content,matchValue1.$==0?(s=matchValue1.$0,s):""),Data.$((x4=function(s1)
           {
            return{
             $:0,
             $0:s1
            };
           },Formlet1.Return(x4)),FwLS.InputWithValue(value,"URL","You must enter a URL","url"))):_arg142===3?(value1=(matchValue2=dao.Content,matchValue2.$==1?(s2=matchValue2.$0,s2):""),Data.$((x5=function(s1)
           {
            return{
             $:1,
             $0:s1
            };
           },Formlet1.Return(x5)),FwLS.TextAreaWithValue(value1,"HTML","You must enter an HTML string","html"))):(x6={
            $:2
           },Formlet1.Return(x6)),function(_arg141)
           {
            return _builder_.Return(_arg141);
           });
          });
         });
        })));
        f2=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
         $:0
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord1.Align,
         VerticalAlign:inputRecord1.VerticalAlign,
         Placement:Placement1
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc1,formlet);
        });
        return f2(x);
       }
      }
     }
    },
    Credit:{
     Client:{
      PurchaseCreditButton:function(ammount)
      {
       var x,f,f1;
       x=UserControls.SmallButton(Global.String(ammount));
       f=(f1=function()
       {
        return ammount;
       },function(formlet)
       {
        return Formlet1.Map(f1,formlet);
       });
       return f(x);
      },
      PurchaseCreditsButtonControl:Runtime.Class({
       get_Body:function()
       {
        return Controls4.PayPalButtonCredit(this.buttonInfo);
       }
      }),
      PurchaseCreditsButtonsControl:Runtime.Class({
       get_Body:function()
       {
        var ticketPanel,_this=this,_builder_;
        ticketPanel=function(numCreds,ticket)
        {
         var basePrice,vat,x,f,totalPrice,ppButton,x1,x2,_this1,x3,_this2,x4,_this3;
         basePrice=Global.String(ticket.BasePrice)+" "+ticket.Currency;
         vat=(x=ticket.Price-ticket.BasePrice,(f=function(value)
         {
          return Global.String(value);
         },f(x)))+" "+ticket.Currency;
         totalPrice=Global.String(ticket.Price)+" "+ticket.Currency;
         ppButton=Controls4.PayPalButtonCredit({
          Label:"Proceed to PayPal",
          CancelLink:_this.args.CancelLink,
          PaypalUrl:_this.args.PaypalUrl,
          BusinessName:_this.args.BusinessName,
          ClientEmail:_this.args.ClientEmail,
          TicketInfo:ticket,
          ReturnUrl:_this.args.ReturnUrl,
          ReturnMode:_this.args.ReturnMode,
          NotifyUrl:_this.args.NotifyUrl+ticket.VerificationCode
         });
         return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("Please review your purchase below before continuing.")])),Operators.add(Default.Div(List.ofArray([Default.Attr().Class("payment-confirm-panel")])),List.ofArray([Default.P(List.ofArray([Default.B(List.ofArray([(x1="Purchasing "+Global.String(numCreds)+" credits.",Default.Text(x1))]))])),Default.Table(List.ofArray([Default.TBody(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([(x2=List.ofArray([Default.Text("Unit Price")]),(_this1=Default.Tags(),_this1.NewTag("label",x2)))])),Operators.add(Default.TD(List.ofArray([Default.Attr().Class("price")])),List.ofArray([Default.Text(basePrice)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([(x3=List.ofArray([Default.Text("VAT *")]),(_this2=Default.Tags(),_this2.NewTag("label",x3)))])),Operators.add(Default.TD(List.ofArray([Default.Attr().Class("price")])),List.ofArray([Default.Text(vat)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([(x4=List.ofArray([Default.Text("Subtotal")]),(_this3=Default.Tags(),_this3.NewTag("label",x4)))])),Operators.add(Default.TD(List.ofArray([Default.Attr().Class("price")])),List.ofArray([Default.Text(totalPrice)]))]))]))])),Operators.add(Default.Span(List.ofArray([Default.Attr().Class("note")])),List.ofArray([Default.Text("*Note: VAT is added on all purchases made by \r\n                                        EU individuals and companies from Hungary.")])),ppButton]))]));
        };
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x,x1,x2,x3,f,mapping,f3,f4,f5,f6;
         return _builder_.Bind((x=(x1=(x2=(x3=_this.args.CreditAmounts,(f=(mapping=function(ammount)
         {
          var label,x4,f1,f2;
          label=_this.args.CurrencySymbol+Global.String(ammount);
          x4=Controls1.SmallButton(label);
          f1=(f2=function()
          {
           return ammount;
          },function(formlet)
          {
           return Formlet1.Map(f2,formlet);
          });
          return f1(x4);
         },function(list)
         {
          return List.map(mapping,list);
         }),f(x3))),(f3=function(fs)
         {
          return Formlet1.Choose(fs);
         },f3(x2))),(f4=function(formlet)
         {
          return Formlet1.Horizontal(formlet);
         },f4(x1))),(f5=(f6=function(el)
         {
          return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("credit-buttons")])),List.ofArray([el]));
         },function(formlet)
         {
          return Formlet1.MapElement(f6,formlet);
         }),f5(x))),function(_arg196)
         {
          var x4,f1;
          return _builder_.Bind((x4=Remoting.Async("IntelliFactory.Trainings:0",[_arg196]),(f1=function(a)
          {
           return Formlet2.LoadingFormlet(a);
          },f1(x4))),function(_arg195)
          {
           var ticket,genElem;
           return _builder_.ReturnFrom(_arg195.$==0?Formlet1.Never():(ticket=_arg195.$0,(genElem=function()
           {
            return ticketPanel(_arg196,ticket);
           },Formlet1.OfElement(genElem))));
          });
         });
        });
       }
      })
     }
    },
    Dao:{
     Booking:{
      CourseEventType:Runtime.Class({
       get_DisplayString:function()
       {
        if(this.$==1)
         {
          return"Scheduled";
         }
        else
         {
          return"Online";
         }
       }
      })
     },
     Company:Runtime.Class({
      get_IsConference:function()
      {
       return this.ConferenceData.$==1;
      }
     }),
     ConferenceSupport:{
      ConferenceExtraDAO:Runtime.Class({},{
       FromDate:function(date)
       {
        return Runtime.New(ConferenceExtraDAO,{
         StartDate:date,
         StartTime:TimeDAO.get_Default(),
         EndDate:date,
         EndTime:TimeDAO.get_Default(),
         ProposalSettings:{
          $:0
         }
        });
       },
       get_Default:function()
       {
        return ConferenceExtraDAO.FromDate(DateDAO.get_Default());
       }
      })
     },
     DateDAO:Runtime.Class({
      get_ToEcma:function()
      {
       return new Date(this.Year,this.Month-1,this.Day);
      },
      get_ToNet:function()
      {
       return DateTime.New2(this.Year,this.Month,this.Day);
      }
     },{
      get_Default:function()
      {
       return Runtime.New(DateDAO,{
        Year:0,
        Month:0,
        Day:0
       });
      }
     }),
     DeveloperProfileUpdateData:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(DeveloperProfileUpdateData,{
        ShowInPublicSearches:false,
        DescriptionSummary:"",
        Description:"",
        TagRanks:Runtime.New(T,{
         $:0
        }),
        Schools:Runtime.New(T,{
         $:0
        }),
        Workplaces:Runtime.New(T,{
         $:0
        })
       });
      }
     }),
     EventOrCourseCreation:{
      CreateEventOrCourseType:Runtime.Class({
       get_Index:function()
       {
        if(this.$==1)
         {
          return 1;
         }
        else
         {
          if(this.$==2)
           {
            return 2;
           }
          else
           {
            if(this.$==3)
             {
              return 3;
             }
            else
             {
              return 0;
             }
           }
         }
       }
      }),
      EventOrCourseDetailsDAO_WebcastDetails:Runtime.Class({},{
       Default:function()
       {
        return Runtime.New(EventOrCourseDetailsDAO_WebcastDetails,{
         Content:{
          $:2
         },
         InstructionsToJoin:""
        });
       }
      }),
      ExtraInformationDAO:Runtime.Class({},{
       Default:function(email)
       {
        return Runtime.New(ExtraInformationDAO,{
         Tags:List.ofArray(["F#"]),
         AssociatedGroupUrlName:{
          $:0
         },
         CreateAsAuthorUsername:email
        });
       }
      })
     },
     JobLocation:Runtime.Class({
      get_Display:function()
      {
       var x,_this=this,f,folder;
       x=Seq.toList(Seq.delay(function()
       {
        return Seq.append([_this.City],Seq.delay(function()
        {
         return Seq.append([_this.State!==""?", "+_this.State:""],Seq.delay(function()
         {
          return Seq.append([","],Seq.delay(function()
          {
           return[_this.Country];
          }));
         }));
        }));
       }));
       f=(folder=function(x1)
       {
        return function(y)
        {
         return x1+y;
        };
       },function(list)
       {
        return Seq.fold(folder,"",list);
       });
       return f(x);
      }
     },{
      get_Empty:function()
      {
       return Runtime.New(JobLocation,{
        City:"",
        State:"",
        Zip:"",
        Country:""
       });
      }
     }),
     JobOffer:Runtime.Class({},{
      get_Empty:function()
      {
       var Locations,Tags1;
       Locations=Runtime.New(T,{
        $:0
       });
       Tags1=Runtime.New(T,{
        $:0
       });
       return Runtime.New(JobOffer,{
        Id:{
         $:0
        },
        Title:"",
        CreateDate:{
         $:0
        },
        ExpirationDate:{
         $:0
        },
        PostedByUser:{
         $:0
        },
        CompanyName:"",
        CompanyDescription:"",
        CompanyWebSiteUrl:"",
        CompanyLogoUrl:"",
        Abstract:"",
        Locations:Locations,
        IsTelecommutePossible:false,
        Description:"",
        Requirements:"",
        Tags:Tags1,
        IsPublic:false,
        Applications:Runtime.New(T,{
         $:0
        }),
        CanApply:true
       });
      }
     }),
     LocationDetails:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(LocationDetails,{
        Description:"",
        Street1:"",
        Street2:{
         $:0
        },
        City:"",
        State:{
         $:0
        },
        Country:"",
        Zip:"",
        Memo:""
       });
      }
     }),
     PricingDAO:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(PricingDAO,{
        Price:0,
        Currency:"USD"
       });
      }
     }),
     SchoolInfo:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(SchoolInfo,{
        Name:"",
        Degree:"",
        Field:"",
        FromYear:2011,
        EndYear:{
         $:0
        },
        Notes:""
       });
      }
     }),
     TimeAndDurationDAO:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(TimeAndDurationDAO,{
        StartsAtHour:12,
        StartsAtMinute:0,
        StartsAtTimeZone:0,
        LastsForMinutes:60
       });
      }
     }),
     TimeDAO:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(TimeDAO,{
        Hour:12,
        Minute:0,
        TimeZone:0
       });
      }
     }),
     TrainerOptionsDAO:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(TrainerOptionsDAO,{
        AdvertiseEvents:true,
        AdvertiseBlogEntries:true
       });
      }
     }),
     UserData:Runtime.Class({
      get_IsCompany:function()
      {
       var x;
       return!(x=this.Company,Strings.IsNullOrEmpty(x));
      },
      get_MustPayVAT:function()
      {
       var isHungarian,isEuropeanUnionBased,isEUCompany,matchValue,address,number,isHungComp,matchValue1,address1,isFromEU;
       isHungarian=this.Country.toLowerCase()==="hungary";
       isEuropeanUnionBased=function(country)
       {
        var x,x1,f,predicate,f1;
        x=(x1=List.ofArray(["Austria","Belgium","Bulgaria","Cyprus","Czech Republic","Denmark","Estonia","Finland","France","Germany","Greece","Hungary","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Netherlands","Poland","Portugal","Romania","Slovakia","Slovenia","Spain","Sweden","United Kingdom"]),(f=(predicate=function(c)
        {
         return c.toLowerCase()===country.toLowerCase();
        },function(source)
        {
         return Seq.tryFind(predicate,source);
        }),f(x1)));
        f1=function(option)
        {
         return option.$==1;
        };
        return f1(x);
       };
       isEUCompany=(matchValue=[this.BillingAddress,this.EUTaxNumber],matchValue[0].$==1?matchValue[1].$==1?(address=matchValue[0].$0,(number=matchValue[1].$0,isEuropeanUnionBased(address.Country))):false:false);
       isHungComp=(matchValue1=this.BillingAddress,matchValue1.$==1?(address1=matchValue1.$0,address1.Country.toLowerCase()==="hungary"):false);
       isFromEU=isEuropeanUnionBased(this.Country);
       if(!isEUCompany)
        {
         if(isFromEU)
          {
           return true;
          }
         else
          {
           return isHungComp;
          }
        }
       else
        {
         return false;
        }
      }
     }),
     UserOAuthData:Runtime.Class({
      get_DisplayName:function()
      {
       var matchValue,name;
       matchValue=this.OAuthUserDisplayName;
       if(matchValue.$==0)
        {
         return this.OAuthUsername;
        }
       else
        {
         name=matchValue.$0;
         return name;
        }
      }
     }),
     UserOptionsDAO:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(UserOptionsDAO,{
        AdvertiseGroups:true,
        AdvertiseConferences:true,
        AdvertiseQuestions:true,
        AdvertiseAnswers:true,
        TrainerOptions:{
         $:0
        }
       });
      }
     }),
     WorkPlaceInfo:Runtime.Class({},{
      get_Default:function()
      {
       return Runtime.New(WorkPlaceInfo,{
        WorkPlace:"",
        Title:"",
        Location:"",
        FromYear:2011,
        EndYear:{
         $:0
        },
        Description:""
       });
      }
     })
    },
    DeveloperSearch:Runtime.Class({},{
     get_Default:function()
     {
      return Runtime.New(DeveloperSearch,{
       SearchTerm:{
        $:0
       },
       Location:{
        $:0
       },
       BatchIx:0,
       Tags:Runtime.New(T,{
        $:0
       }),
       IsSortByName:true
      });
     }
    }),
    EcmaScript:{
     "Date.GetNetMonth":function(_)
     {
      var unitVar1;
      unitVar1=["uncurry"];
      return _.getMonth()+1;
     }
    },
    Enhance:{
     WithJQueryUI:Runtime.Class({
      get_Body:function()
      {
       var x,f,f1,_this=this;
       x=Default.Div(Runtime.New(T,{
        $:0
       }));
       f=(f1=function()
       {
        var x1,f2,def;
        x1=_this.Id;
        f2=(def=_this.Default,function(id)
        {
         return $("#"+id).tabs({
          selected:def
         });
        });
        return f2(x1);
       },function(w)
       {
        return Operators.OnAfterRender(f1,w);
       });
       f(x);
       return x;
      }
     })
    },
    FormletHelpers:{
     FwL:{
      CheckBox:function(defValue,label)
      {
       var x,f;
       x=Controls.Checkbox(defValue);
       f=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f(x);
      },
      Input:function(label,validationMsg)
      {
       var x,x1,x2,f,f1,f2;
       x=(x1=(x2=Controls.Input(""),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty(validationMsg,arg10);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x1)));
       f2=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f2(x);
      },
      InputOptional:function(label)
      {
       var x,f;
       x=Controls.Input("");
       f=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f(x);
      },
      InputOptionalWithValue:function(value,label)
      {
       var x,f;
       x=Controls.Input(value);
       f=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f(x);
      },
      InputWithTopLabel:function(label,validationMsg)
      {
       var x,x1,x2,x3,f,f1,f2,f3;
       x=(x1=(x2=(x3=Controls.Input(""),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty(validationMsg,arg10);
       },f(x3))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x2))),(f2=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       },f2(x1)));
       f3=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       };
       return f3(x);
      },
      InputWithValue:function(value,label,validationMsg)
      {
       var x,x1,x2,f,f1,f2;
       x=(x1=(x2=Controls.Input(value),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty(validationMsg,arg10);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x1)));
       f2=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f2(x);
      },
      ReadOnly:{
       CheckBox:function(defValue,label)
       {
        var x,x1,f,f1;
        x=(x1=Controls.ReadOnlyCheckbox(defValue),(f=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f(x1)));
        f1=function(formlet)
        {
         return Enhance.WithTextLabel(label,formlet);
        };
        return f1(x);
       },
       Input:function(defValue,label)
       {
        var x,x1,f,f1;
        x=(x1=Controls.ReadOnlyInput(defValue),(f=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f(x1)));
        f1=function(formlet)
        {
         return Enhance.WithTextLabel(label,formlet);
        };
        return f1(x);
       }
      },
      RichEditor:function(label,validationMsg)
      {
       return FwL.RichEditorWithValue("",label,validationMsg);
      },
      RichEditorParams:Runtime.Field(function()
      {
       var inputRecord,ToolbarLocation,Buttons;
       inputRecord=AdvancedHtmlEditorConfiguration.get_Default();
       ToolbarLocation={
        $:1,
        $0:"top"
       };
       Buttons={
        $:1,
        $0:List.ofArray([List.ofArray([{
         $:0
        },{
         $:1
        },{
         $:2
        },{
         $:3
        },{
         $:40
        },{
         $:15
        },{
         $:16
        },{
         $:40
        },{
         $:4
        },{
         $:5
        },{
         $:6
        },{
         $:7
        },{
         $:40
        },{
         $:9
        },{
         $:8
        },{
         $:40
        },{
         $:25
        },{
         $:40
        },{
         $:17
        },{
         $:18
        },{
         $:19
        },{
         $:40
        },{
         $:20
        },{
         $:22
        },{
         $:40
        },{
         $:21
        }]),Runtime.New(T,{
         $:0
        }),Runtime.New(T,{
         $:0
        })])
       };
       return Runtime.New(AdvancedHtmlEditorConfiguration,{
        Width:{
         $:1,
         $0:608
        },
        Height:{
         $:1,
         $0:250
        },
        Plugins:inputRecord.Plugins,
        ToolbarLocation:ToolbarLocation,
        ToolbarAlign:inputRecord.ToolbarAlign,
        StatusbarLocation:inputRecord.StatusbarLocation,
        Buttons:Buttons
       });
      }),
      RichEditorWithValue:function(value,label,validationMsg)
      {
       var x,x1,x2,f,f1,f2;
       x=(x1=(x2=(Controls5.AdvancedHtmlEditor(FwL.RichEditorParams()))(value),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty(validationMsg,arg10);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x1)));
       f2=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f2(x);
      },
      RichEditorWithValueOptional:function(value,label)
      {
       var x,f;
       x=(Controls5.AdvancedHtmlEditor(FwL.RichEditorParams()))(value);
       f=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f(x);
      },
      Select:function(def,label,elems)
      {
       var x,f;
       x=Controls.Select(def,elems);
       f=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f(x);
      },
      TextArea:function(label,validationMsg)
      {
       var x,x1,x2,f,f1,f2;
       x=(x1=(x2=Controls.TextArea(""),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty(validationMsg,arg10);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x1)));
       f2=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f2(x);
      },
      TextAreaWithValue:function(value,label,validationMsg)
      {
       var x,x1,x2,f,f1,f2;
       x=(x1=(x2=Controls.TextArea(value),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty(validationMsg,arg10);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x1)));
       f2=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f2(x);
      },
      TextAreaWithValueOptional:function(value,label)
      {
       var x,f;
       x=Controls.TextArea(value);
       f=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       };
       return f(x);
      }
     },
     FwLS:{
      Input:function(label,validationMsg,cssClass)
      {
       var x,f;
       x=FwL.Input(label,validationMsg);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      InputOptional:function(label,cssClass)
      {
       var x,f;
       x=FwL.InputOptional(label);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      InputOptionalWithValue:function(value,label,cssClass)
      {
       var x,f;
       x=FwL.InputOptionalWithValue(value,label);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      InputWithValue:function(value,label,validationMsg,cssClass)
      {
       var x,x1,x2,x3,f,f1,f2,f3;
       x=(x1=(x2=(x3=Controls.Input(value),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty(validationMsg,arg10);
       },f(x3))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x2))),(f2=function(formlet)
       {
        return Enhance.WithTextLabel(label,formlet);
       },f2(x1)));
       f3=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f3(x);
      },
      ReadOnly:{
       CheckBox:function(defValue,label,validationMsg,cssClass)
       {
        var x,f;
        x=ReadOnly1.CheckBox(defValue,label,validationMsg);
        f=function(formlet)
        {
         return Enhance.WithCssClass(cssClass,formlet);
        };
        return f(x);
       },
       Input:function(defValue,label,validationMsg,cssClass)
       {
        var x,f;
        x=ReadOnly1.Input(defValue,label,validationMsg);
        f=function(formlet)
        {
         return Enhance.WithCssClass(cssClass,formlet);
        };
        return f(x);
       }
      },
      RichEditor:function(label,validationMsg,cssClass)
      {
       var x,f;
       x=FwL.RichEditor(label,validationMsg);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      RichEditorWithValue:function(value,label,validationMsg,cssClass)
      {
       var x,f;
       x=FwL.RichEditorWithValue(value,label,validationMsg);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      RichEditorWithValueOptional:function(value,label,cssClass)
      {
       var x,f;
       x=FwL.RichEditorWithValueOptional(value,label);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      Select:function(def,label,elems,cssClass)
      {
       var x,f;
       x=FwL.Select(def,label,elems);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      TextArea:function(label,validationMsg,cssClass)
      {
       var x,f;
       x=FwL.TextArea(label,validationMsg);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      TextAreaWithValue:function(value,label,validationMsg,cssClass)
      {
       var x,f;
       x=FwL.TextAreaWithValue(value,label,validationMsg);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      },
      TextAreaWithValueOptional:function(value,label,cssClass)
      {
       var x,f;
       x=FwL.TextAreaWithValueOptional(value,label);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      }
     },
     FwS:{
      Select:function(def,elems,cssClass)
      {
       var x,f;
       x=FwoL.Select(def,elems);
       f=function(formlet)
       {
        return Enhance.WithCssClass(cssClass,formlet);
       };
       return f(x);
      }
     },
     FwoL:{
      Select:function(def,elems)
      {
       return Controls.Select(def,elems);
      }
     }
    },
    Forum:{
     Client:{
      ContactButton:function(conf)
      {
       var isReplyOpen,isMarkupHelpOpen,markupHelpContainer,_this,isRendered,markupHelpButton,x,f,x1,hide,contactButton,contactButton1,replyContainer,replyContainer1,contentContainer,contentContainer1,contactButton2,replyContainer2,contentContainer2,x4,f2;
       isReplyOpen={
        contents:false
       };
       isMarkupHelpOpen={
        contents:false
       };
       markupHelpContainer=Operators.add(Default.Div(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","display:none")),Default.Attr().Class("markup-help-container")])),List.ofArray([Client9.MarkupHelp()]));
       isRendered={
        contents:false
       };
       markupHelpButton=Operators.add(Default.Span(List.ofArray([Default.Attr().Class("no-display")])),List.ofArray([(x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(conf.ButtonClass)])),List.ofArray([Default.Text("Markup help")])),(f=(x1=function(e)
       {
        return function()
        {
         var objectArg,arg00,objectArg1,arg001;
         if(isMarkupHelpOpen.contents)
          {
           isMarkupHelpOpen.contents=false;
           objectArg=markupHelpContainer["HtmlProvider@32"];
           ((arg00=markupHelpContainer.Body,function(arg10)
           {
            return function(arg20)
            {
             return objectArg.SetCss(arg00,arg10,arg20);
            };
           })("display"))("none");
           e.set_Text("Markup help");
          }
         else
          {
           isMarkupHelpOpen.contents=true;
           objectArg1=markupHelpContainer["HtmlProvider@32"];
           ((arg001=markupHelpContainer.Body,function(arg10)
           {
            return function(arg20)
            {
             return objectArg1.SetCss(arg001,arg10,arg20);
            };
           })("display"))("block");
           e.set_Text("Hide markup help");
          }
         return null;
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(x1,arg10);
       }),(f(x),x)))]));
       hide=function()
       {
        var _this1,objectArg,arg00,objectArg1,arg001;
        isReplyOpen.contents=false;
        _this1=Lazy.Force(contentContainer1);
        objectArg=_this1["HtmlProvider@32"];
        ((arg00=_this1.Body,function(arg10)
        {
         return function(arg20)
         {
          return objectArg.SetCss(arg00,arg10,arg20);
         };
        })("display"))("none");
        objectArg1=markupHelpButton["HtmlProvider@32"];
        (arg001=markupHelpButton.Body,function(arg10)
        {
         return objectArg1.AddClass(arg001,arg10);
        })("no-display");
        return Lazy.Force(contactButton1).set_Text(conf.ButtonLabel);
       };
       contactButton=function()
       {
        var x2,f1,x3;
        x2=Operators.add(Default.A(List.ofArray([Default.Attr().Class(conf.ButtonClass)])),List.ofArray([Default.Text(conf.ButtonLabel)]));
        f1=(x3=function(e)
        {
         return function()
         {
          var _this1,objectArg,arg00,objectArg1,arg001;
          if(isReplyOpen.contents)
           {
            return hide(null);
           }
          else
           {
            isReplyOpen.contents=true;
            if(!isRendered.contents)
             {
              isRendered.contents=true;
              Lazy.Force(contentContainer1).Render();
             }
            _this1=Lazy.Force(contentContainer1);
            objectArg=_this1["HtmlProvider@32"];
            ((arg00=_this1.Body,function(arg10)
            {
             return function(arg20)
             {
              return objectArg.SetCss(arg00,arg10,arg20);
             };
            })("display"))("block");
            objectArg1=markupHelpButton["HtmlProvider@32"];
            (arg001=markupHelpButton.Body,function(arg10)
            {
             return objectArg1.RemoveClass(arg001,arg10);
            })("no-display");
            return e.set_Text(conf.ButtonHideLabel);
           }
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x3,arg10);
        });
        f1(x2);
        return x2;
       };
       contactButton1=Lazy.Create(contactButton);
       replyContainer=function()
       {
        return Default.Div(List.ofArray([conf.ReplyFormElement.call(null,hide)]));
       };
       replyContainer1=Lazy.Create(replyContainer);
       contentContainer=function()
       {
        var _this1;
        return Operators.add(Default.Div(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("style","display:none"))])),List.ofArray([markupHelpContainer,replyContainer2]));
       };
       contentContainer1=Lazy.Create(contentContainer);
       contactButton2=Lazy.Force(contactButton1);
       replyContainer2=Lazy.Force(replyContainer1);
       contentContainer2=Lazy.Force(contentContainer1);
       x4=jQuery("#"+conf.ReplyPanelId).append(contentContainer2.Body);
       f2=function(value)
       {
        value;
       };
       f2(x4);
       return Default.Div(List.ofArray([Default.Table(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([contactButton2])),Default.TD(List.ofArray([markupHelpButton]))]))]))]));
      },
      ContactButtonConfiguration:Runtime.Class({},{
       get_Default:function()
       {
        return Runtime.New(ContactButtonConfiguration,{
         ReplyFormElement:function()
         {
          return Default.Div(Runtime.New(T,{
           $:0
          }));
         },
         ButtonClass:Server.Small(),
         ReplyPanelId:"",
         ButtonLabel:"Contact",
         ButtonHideLabel:"Hide contact box"
        });
       }
      }),
      ContactButtonControl:Runtime.Class({
       get_Body:function()
       {
        var replyForm,_this=this,x3,inputRecord,ReplyPanelId,f3;
        replyForm=function(hideForm)
        {
         var form,_builder_;
         form=(_builder_=Formlet1.Do(),_builder_.Delay(function()
         {
          var x,x1,f,f1;
          return _builder_.Bind((x=(x1={
           FixedRecipient:{
            $:1,
            $0:_this.conf.RecipientUsername
           },
           ButtonClass:Server.Small(),
           IncludeTitle:true,
           Text:""
          },(f=function(conf)
          {
           return Client9.MarkupMessageForm(conf);
          },f(x1))),(f1=function(formlet)
          {
           return Formlet1.WithNotificationChannel(formlet);
          },f1(x))),Runtime.Tupled(function(_arg126)
          {
           var title,reset,message,x2,f2;
           title=_arg126[0][1];
           reset=_arg126[1];
           message=_arg126[0][2];
           return _builder_.Bind((x2=Remoting.Async("IntelliFactory.Trainings:88",[{
            ToUsernameOrEmail:_this.conf.RecipientUsername,
            Title:title,
            Message:message
           }]),(f2=function(a)
           {
            return Formlet2.LoadingFormletWithLogin(a);
           },f2(x2))),function(_arg125)
           {
            var msg;
            return _builder_.ReturnFrom(_arg125.$==1?(msg=_arg125.$0,FormletHelpers.ErrorF(msg)):(reset(null),(hideForm(null),FormletHelpers.SuccessF("Message successfully sent."))));
           });
          }));
         }));
         return Default.Div(List.ofArray([form]));
        };
        x3=(inputRecord=ContactButtonConfiguration.get_Default(),(ReplyPanelId=_this.conf.ReplyPanelId,Runtime.New(ContactButtonConfiguration,{
         ReplyFormElement:replyForm,
         ButtonClass:inputRecord.ButtonClass,
         ReplyPanelId:ReplyPanelId,
         ButtonLabel:inputRecord.ButtonLabel,
         ButtonHideLabel:inputRecord.ButtonHideLabel
        })));
        f3=function(conf)
        {
         return Client9.ContactButton(conf);
        };
        return f3(x3);
       }
      }),
      DeleteButton:Runtime.Class({
       get_Body:function()
       {
        return Client9.deleteButton(this.TopicId,this.ButtonClass,this.OnDeleteUrl);
       }
      }),
      EditTagsButton:Runtime.Class({
       get_Body:function()
       {
        var editPanel,msgPanel,_this,buttonCssClass,x,f,x1,_this1=this;
        editPanel=Default.Div(List.ofArray([Default.Attr().Class("tag-edit")]));
        msgPanel=Default.Div(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","display: block;"))]));
        buttonCssClass=Server.Small();
        return Default.Div(List.ofArray([(x=Client1.Button("Change tags","",buttonCssClass+" comment-button"),(f=(x1=function()
        {
         return function()
         {
          var x2,x3,_builder_,f7,f8,f9;
          editPanel["HtmlProvider@32"].Clear(editPanel.Body);
          x2=(x3=(_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           var a;
           return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:99",[_this1.id]),Formlet2.LoadingFormlet(a)),function(_arg132)
           {
            var tagsString,res,editBox,_this2,_this3,saveButton,x4,f1,x5,cancelButton,xa,f6,xb;
            tagsString=_arg132.$==0?(res=_arg132.$0,res):"[Failed to retrieve tags]";
            editBox=Default.Input(List.ofArray([(_this2=Default.Attr(),_this2.NewAttr("type","text")),(_this3=Default.Attr(),_this3.NewAttr("value",tagsString)),Default.Attr().Class("tag-edit-box")]));
            saveButton=(x4=Client1.Button("Save","",buttonCssClass),(f1=(x5=function()
            {
             return function()
             {
              var x6,x7,_builder_1,f3,f4,f5;
              msgPanel["HtmlProvider@32"].Clear(msgPanel.Body);
              x6=(x7=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
              {
               var x8,f2;
               return _builder_1.Bind((x8=Remoting.Async("IntelliFactory.Trainings:100",[_this1.id,editBox.get_Value()]),(f2=function(a1)
               {
                return Formlet2.LoadingFormlet(a1);
               },f2(x8))),function(_arg133)
               {
                var objectArg,arg00,objectArg1,arg001,msg,objectArg2,arg002,objectArg3,arg003,x9;
                if(_arg133.$==0)
                 {
                  objectArg=msgPanel["HtmlProvider@32"];
                  (arg00=msgPanel.Body,function(arg10)
                  {
                   return objectArg.RemoveClass(arg00,arg10);
                  })("error");
                  objectArg1=msgPanel["HtmlProvider@32"];
                  (arg001=msgPanel.Body,function(arg10)
                  {
                   return objectArg1.AddClass(arg001,arg10);
                  })("success");
                  msgPanel.AppendI(Default.Text("Updated, refresh page to reflect"));
                 }
                else
                 {
                  msg=_arg133.$0;
                  objectArg2=msgPanel["HtmlProvider@32"];
                  (arg002=msgPanel.Body,function(arg10)
                  {
                   return objectArg2.RemoveClass(arg002,arg10);
                  })("success");
                  objectArg3=msgPanel["HtmlProvider@32"];
                  (arg003=msgPanel.Body,function(arg10)
                  {
                   return objectArg3.AddClass(arg003,arg10);
                  })("error");
                  msgPanel.AppendI((x9="Error: "+msg,Default.Text(x9)));
                 }
                return _builder_1.Return(null);
               });
              })),(f3=(f4=function()
              {
               return null;
              },function(formlet)
              {
               return Formlet1.Run(f4,formlet);
              }),f3(x7)));
              f5=function(form)
              {
               return msgPanel.AppendI(form);
              };
              return f5(x6);
             };
            },function(arg10)
            {
             return EventsPervasives.Events().OnClick(x5,arg10);
            }),(f1(x4),x4)));
            cancelButton=(xa=Client1.Button("Cancel","",buttonCssClass),(f6=(xb=function()
            {
             return function()
             {
              var objectArg,arg00,objectArg1,arg001;
              objectArg=msgPanel["HtmlProvider@32"];
              (arg00=msgPanel.Body,function(arg10)
              {
               return objectArg.RemoveClass(arg00,arg10);
              })("success");
              objectArg1=msgPanel["HtmlProvider@32"];
              (arg001=msgPanel.Body,function(arg10)
              {
               return objectArg1.RemoveClass(arg001,arg10);
              })("error");
              msgPanel["HtmlProvider@32"].Clear(msgPanel.Body);
              return editPanel["HtmlProvider@32"].Clear(editPanel.Body);
             };
            },function(arg10)
            {
             return EventsPervasives.Events().OnClick(xb,arg10);
            }),(f6(xa),xa)));
            editPanel.AppendI(editBox);
            editPanel.AppendI(saveButton);
            editPanel.AppendI(cancelButton);
            jQuery(editBox.Body).focus();
            return _builder_.Return(null);
           });
          })),(f7=(f8=function()
          {
           return null;
          },function(formlet)
          {
           return Formlet1.Run(f8,formlet);
          }),f7(x3)));
          f9=function(form)
          {
           return editPanel.AppendI(form);
          };
          return f9(x2);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x))),editPanel,msgPanel]));
       }
      }),
      FoldComment:Runtime.Class({
       get_Body:function()
       {
        var x,_this,_this1,_this2,f,x1,_this3=this;
        x=Operators.add(Default.Div(List.ofArray([Default.Attr().Class("comment-unfold-button")])),List.ofArray([Default.Img(List.ofArray([(_this=Default.Attr(),_this.NewAttr("src","/images/uparrow.gif")),(_this1=Default.Attr(),_this1.NewAttr("title","Hide this comment")),(_this2=Default.Attr(),_this2.NewAttr("alt","Hide this comment"))]))]));
        f=(x1=function(e)
        {
         return function()
         {
          var _this4,_this5,_this6,_this7,_this8,_this9;
          jQuery("#"+_this3.blockId).slideToggle("fast");
          _this3.isFolded=!_this3.isFolded;
          e["HtmlProvider@32"].Clear(e.Body);
          if(_this3.isFolded)
           {
            jQuery(e.Body).addClass("folded");
            return e.AppendI(Default.Img(List.ofArray([(_this4=Default.Attr(),_this4.NewAttr("src","/images/downarrow.gif")),(_this5=Default.Attr(),_this5.NewAttr("title","Show this comment")),(_this6=Default.Attr(),_this6.NewAttr("alt","Show this comment"))])));
           }
          else
           {
            jQuery(e.Body).removeClass("folded");
            return e.AppendI(Default.Img(List.ofArray([(_this7=Default.Attr(),_this7.NewAttr("src","/images/uparrow.gif")),(_this8=Default.Attr(),_this8.NewAttr("title","Hide this comment")),(_this9=Default.Attr(),_this9.NewAttr("alt","Hide this comment"))])));
           }
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(x);
        return x;
       }
      }),
      MarkAsAnswerButton:Runtime.Class({
       MarkButton:function(container)
       {
        var x,f,x1,_this=this;
        x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(Server.Comment())])),List.ofArray([Default.Text("Mark as an answer")]));
        f=(x1=function()
        {
         return function()
         {
          return _this.TryMarkAsAnswer(container);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(x);
        return x;
       },
       TryMarkAsAnswer:function(container)
       {
        var _builder_,_this=this;
        container["HtmlProvider@32"].Clear(container.Body);
        return container.AppendI((_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:91",[_this.CommentId])),function(_arg128)
         {
          return _builder_.ReturnFrom(Formlet1.OfElement(function()
          {
           if(_arg128.$==0)
            {
             jQuery("#comment-"+Global.String(_this.CommentId)).parent().addClass("isanswer");
             return _this.UnmarkButton(container);
            }
           else
            {
             return Default.Span(List.ofArray([_this.MarkButton(container),Default.Text("Error when marking this comment as answer")]));
            }
          }));
         });
        })));
       },
       TryUnmarkAsAnswer:function(container)
       {
        var _builder_,_this=this;
        container["HtmlProvider@32"].Clear(container.Body);
        return container.AppendI((_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:92",[_this.CommentId])),function(_arg129)
         {
          return _builder_.ReturnFrom(Formlet1.OfElement(function()
          {
           if(_arg129.$==0)
            {
             jQuery("#comment-"+Global.String(_this.CommentId)).parent().removeClass("isanswer");
             return _this.MarkButton(container);
            }
           else
            {
             return Default.Span(List.ofArray([_this.UnmarkButton(container),Default.Text("Error when unmarking this comment")]));
            }
          }));
         });
        })));
       },
       UnmarkButton:function(container)
       {
        var x,f,x1,_this=this;
        return Default.Span(List.ofArray([(x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(Server.Comment()+" comment-button")])),List.ofArray([Default.Text("Unmark answer")])),(f=(x1=function()
        {
         return function()
         {
          return _this.TryUnmarkAsAnswer(container);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x)))]));
       },
       get_Body:function()
       {
        var container,_this=this;
        container=Default.Span(Runtime.New(T,{
         $:0
        }));
        return Operators.add(container,List.ofArray([(this.BeginIsAnswer?function(arg00)
        {
         return _this.UnmarkButton(arg00);
        }:function(arg00)
        {
         return _this.MarkButton(arg00);
        })(container)]));
       }
      }),
      MarkupHelp:function()
      {
       var simple,code,links,lists,misc,res,x2,f,f1;
       simple=function()
       {
        var x,_this;
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<b>This syntax</b>")])),Default.Text(" inserts "),Default.B(List.ofArray([Default.Text("bold text")])),Default.Text(".")])),Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<i>This syntax</i>")])),Default.Text(" inserts "),Default.I(List.ofArray([Default.Text("italic text")])),Default.Text(".")])),Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<c>This syntax</c>")])),Default.Text(" inserts "),Default.Code(List.ofArray([Default.Text("inline code")])),Default.Text(".")])),Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<s>This syntax</s>")])),Default.Text(" inserts "),(x=List.ofArray([Default.Text("strikethrough text")]),(_this=Default.Tags(),_this.NewTag("del",x))),Default.Text(".")])),Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<h1>This syntax</h1>")])),Default.Text(" inserts a header. Available header tags are "),Default.Code(List.ofArray([Default.Text("<h1>")])),Default.Text(", "),Default.Code(List.ofArray([Default.Text("<h2>")])),Default.Text(", "),Default.Code(List.ofArray([Default.Text("<h3>")])),Default.Text(" and "),Default.Code(List.ofArray([Default.Text("<h4>")])),Default.Text(".")]))]));
       };
       code=function()
       {
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<code>...</code>")])),Default.Text(" inserts a code snippet, like this:")])),Operators.add(Default.Pre(List.ofArray([Default.Attr().Class("brush: text; toolbar: false;")])),List.ofArray([Default.Text("main = putStrLn \"This is a code snippet.\"")])),Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<code lang=\"fsharp\">...</code>")])),Default.Text(" specifies the programming language, providing syntax higlighting:")])),Operators.add(Default.Pre(List.ofArray([Default.Attr().Class("brush: fsharp; toolbar: false;")])),List.ofArray([Default.Text("let main() =\n  printfn \"This is an F# code snippet.\"")]))]));
       };
       links=function()
       {
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<a href=\"http://fpish.net\">this syntax</a>")])),Default.Text(" inserts "),Operators.add(Default.A(List.ofArray([Default.HRef("http://fpish.net")])),List.ofArray([Default.Text("a link to FPish.net")])),Default.Text(".")])),Default.P(List.ofArray([Default.Code(List.ofArray([Default.Text("<img src=\"http://fpish.net/images/fish.png\">")])),Default.Text(" inserts an image.")])),Default.Img(List.ofArray([Default.Src("/images/fish.png")]))]));
       };
       lists=function()
       {
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("You can insert ordered and unordered listings. They are identical to their HTML counterparts.")])),Default.Table(List.ofArray([Default.TBody(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Pre(List.ofArray([Default.Text("<ul>\n  <li>Item 1</li>\n  <li>Item 2</li>\n</ul>")]))])),Default.TD(List.ofArray([Default.Text("becomes")])),Default.TD(List.ofArray([Default.UL(List.ofArray([Default.LI(List.ofArray([Default.Text("Item 1")])),Default.LI(List.ofArray([Default.Text("Item 2")]))]))]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Pre(List.ofArray([Default.Text("<ol>\n  <li>Item 1</li>\n  <li>Item 2</li>\n</ol>")]))])),Default.TD(List.ofArray([Default.Text("becomes")])),Default.TD(List.ofArray([Default.OL(List.ofArray([Default.LI(List.ofArray([Default.Text("Item 1")])),Default.LI(List.ofArray([Default.Text("Item 2")]))]))]))]))]))]))]));
       };
       misc=function()
       {
        var x,x1,_this,_this1;
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("You can quote another post using <quote>...</quote>.")])),(x=List.ofArray([(x1=List.ofArray([Default.Text("This is some nice code.")]),(_this=Default.Tags(),_this.NewTag("blockquote",x1))),Default.Span(List.ofArray([Default.Text("I quite agree with you.")]))]),(_this1=Default.Tags(),_this1.NewTag("blockquote",x))),Default.P(List.ofArray([Default.Text("You can add tables using HTML's <table>, <tr> and <td>.")])),Default.Table(List.ofArray([Default.TBody(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Pre(List.ofArray([Default.Text("<table>\r\n  <tr>\r\n    <td>C1</td>\r\n    <td>C2</td>\r\n  </tr><tr>\r\n    <td>C3</td>\r\n    <td>C4</td>\r\n  </tr>\r\n</table>")]))])),Default.TD(List.ofArray([Default.Text("becomes")])),Default.TD(List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("comment-body")])),List.ofArray([Default.Table(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("C1")])),Default.TD(List.ofArray([Default.Text("C2")]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("C3")])),Default.TD(List.ofArray([Default.Text("C4")]))]))]))]))]))]))]))]))]));
       };
       res=(x2=Operators.add(Default.Div(List.ofArray([Default.Attr().Class("forum-text")])),List.ofArray([Default.P(List.ofArray([Default.Text("The FPish messages use an HTML-like markup language to include elements such as code snippets, images or links. These are the tags you can use:")])),Tabs.New2(List.ofArray([["Simple formatting",simple(null)],["Code",code(null)],["Links & Images",links(null)],["Lists",lists(null)],["Misc",misc(null)]]))])),(f=(f1=function()
       {
        return SyntaxHighlighter.highlight();
       },function(w)
       {
        return Operators.OnAfterRender(f1,w);
       }),(f(x2),x2)));
       return res;
      },
      MarkupMessageForm:function(conf)
      {
       var lookupUsers,subform,recipientForm,titleForm,x5,x6,x7,x8,x9,f5,f6,f7,f8,f9,msgForm,xa,xb,xc,xd,xe,fa,fb,fc,fd,fe,xf,x10,x11,_builder_1,ff,cl,f10;
       lookupUsers=function(name)
       {
        var f;
        f=function()
        {
         var x,f1;
         x=Remoting.Async("IntelliFactory.Trainings:101",[name]);
         f1=function(_arg122)
         {
          var x1,f2,mapping;
          x1=(f2=(mapping=Runtime.Tupled(function(tupledArg)
          {
           var l,v;
           l=tupledArg[0];
           v=tupledArg[1];
           return{
            label:l+" &lt;"+v+"&gt;",
            value:v
           };
          }),function(list)
          {
           return List.map(mapping,list);
          }),f2(_arg122));
          return Concurrency.Return(x1);
         };
         return Concurrency.Bind(x,f1);
        };
        return Concurrency.Delay(f);
       };
       subform=(recipientForm=function()
       {
        var matchValue,_builder_,rcp;
        matchValue=conf.FixedRecipient;
        if(matchValue.$==0)
         {
          _builder_=Formlet1.Do();
          return _builder_.Delay(function()
          {
           var x,x1,x2,x3,x4,f,f1,f2,f3,f4;
           return _builder_.ReturnFrom((x=(x1=(x2=(x3=(x4=Controls1.Autocomplete("",lookupUsers),(f=function(formlet)
           {
            return Enhance.WithCssClass("forum-reply-recipient",formlet);
           },f(x4))),(f1=function(arg10)
           {
            return Data.Validator().IsNotEmpty("You must specify a recipient",arg10);
           },f1(x3))),(f2=function(formlet)
           {
            return Enhance.WithTextLabel("To (username):",formlet);
           },f2(x2))),(f3=function(formlet)
           {
            return Enhance.WithLabelAbove(formlet);
           },f3(x1))),(f4=function(formlet)
           {
            return Enhance.WithFormContainer(formlet);
           },f4(x))));
          });
         }
        else
         {
          rcp=matchValue.$0;
          return Formlet1.Return(rcp);
         }
       },(titleForm=conf.IncludeTitle?(x5=(x6=(x7=(x8=(x9=Controls.Input(""),(f5=function(formlet)
       {
        return Enhance.WithCssClass("forum-reply-title",formlet);
       },f5(x9))),(f6=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter a title",arg10);
       },f6(x8))),(f7=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f7(x7))),(f8=function(formlet)
       {
        return Enhance.WithTextLabel("Title:",formlet);
       },f8(x6))),(f9=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       },f9(x5))):Formlet1.Return(""),(msgForm=(xa=(xb=(xc=(xd=(xe=Controls.TextArea(conf.Text),(fa=function(formlet)
       {
        return Enhance.WithCssClass("forum-reply",formlet);
       },fa(xe))),(fb=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter a message.",arg10);
       },fb(xd))),(fc=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },fc(xc))),(fd=function(formlet)
       {
        return Enhance.WithTextLabel("Message:",formlet);
       },fd(xb))),(fe=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       },fe(xa))),Data.$(Data.$(Data.$((xf=function(recipient)
       {
        return function(title)
        {
         return function(text)
         {
          return[recipient,title,text];
         };
        };
       },Formlet1.Return(xf)),recipientForm(null)),titleForm),msgForm))));
       x10=(x11=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        return _builder_1.Bind(subform,Runtime.Tupled(function(_arg124)
        {
         var title,text,recipient;
         title=_arg124[1];
         text=_arg124[2];
         recipient=_arg124[0];
         return _builder_1.Bind(Formlet1.OfElement(function()
         {
          var x,f,f1;
          x=Default.Div(List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("preview-title")])),List.ofArray([Default.Text("Message preview:")])),Operators.add(Client4.Translate(text),List.ofArray([Default.Attr().Class("forum-text preview")]))]));
          f=(f1=function()
          {
           return SyntaxHighlighter.highlight();
          },function(w)
          {
           return Operators.OnAfterRender(f1,w);
          });
          f(x);
          return x;
         }),function()
         {
          return _builder_1.Return([recipient,title,text]);
         });
        }));
       })),(ff=(cl=conf.ButtonClass,function(formlet)
       {
        return Client1.EnhanceWithSubmitButton(cl,formlet);
       }),ff(x11)));
       f10=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       };
       return f10(x10);
      },
      NewTopicForm:Runtime.Class({
       get_Body:function()
       {
        var buttonClass,_this=this;
        buttonClass=Server.Comment();
        return Default.Div(Seq.toList(Seq.delay(function()
        {
         return Seq.append(Client9.ReplyForm(buttonClass,{
          $:1
         },_this.NewTopicUrl,"even",_this.DefaultTags),Seq.delay(function()
         {
          return[Operators.add(Default.Div(List.ofArray([Default.Attr().Class("markup-help-container")])),List.ofArray([Client9.MarkupHelp()]))];
         }));
        })));
       }
      }),
      ReplyEditButton:Runtime.Class({
       HideEditForm:function(buttons)
       {
        var _this;
        this.IsReplyOpen=false;
        this.HideMarkupHelp(buttons);
        jQuery("#comment-reply-container-"+Global.String(this.CommentId)).empty();
        jQuery("#"+this.get_ExtraButtonId()).addClass("no-display");
        _this=buttons.EditButton;
        _this["HtmlProvider@32"].Clear(_this.Body);
        return buttons.EditButton.AppendI(Default.Text("Edit"));
       },
       HideMarkupHelp:function(buttons)
       {
        var _this;
        this.IsMarkupHelpOpen=false;
        jQuery("#markup-help-container-"+Global.String(this.CommentId)).empty();
        _this=buttons.MarkupHelpButton;
        _this["HtmlProvider@32"].Clear(_this.Body);
        return buttons.MarkupHelpButton.AppendI(Default.Text("Markup help"));
       },
       HideReplyForm:function(buttons)
       {
        var _this;
        this.IsReplyOpen=false;
        this.HideMarkupHelp(buttons);
        jQuery("#comment-reply-container-"+Global.String(this.CommentId)).empty();
        jQuery("#"+this.get_ExtraButtonId()).addClass("no-display");
        _this=buttons.ReplyButton;
        _this["HtmlProvider@32"].Clear(_this.Body);
        return buttons.ReplyButton.AppendI(Default.Text("Reply"));
       },
       ShowEditForm:function(buttons)
       {
        var x,f,x1,_this=this,form,_this1;
        this.IsReplyOpen=true;
        x=buttons.MarkupHelpButton;
        f=(x1=function()
        {
         return function()
         {
          return _this.ToggleMarkupHelp(buttons);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(x);
        form=Default.Div(Runtime.New(T,{
         $:1,
         $0:buttons.MarkupHelpButton,
         $1:Client9.ReplyForm(_this.get_ButtonClass(),{
          $:2,
          $0:_this.CommentId,
          $1:_this.Level===-1
         },"",_this.Level%2===0?"odd":"even",Runtime.New(T,{
          $:0
         }))
        }));
        jQuery("#comment-reply-container-"+Global.String(_this.CommentId)).empty().append(Default.H3(List.ofArray([Default.Text("Edit message")])).Body).append(form.Body);
        jQuery("#"+_this.get_ExtraButtonId()).removeClass("no-display");
        _this1=buttons.EditButton;
        _this1["HtmlProvider@32"].Clear(_this1.Body);
        return buttons.EditButton.AppendI(Default.Text("Hide edit box"));
       },
       ShowMarkupHelp:function(buttons)
       {
        var tabs,_this;
        this.IsMarkupHelpOpen=true;
        tabs=Client9.MarkupHelp();
        jQuery("#markup-help-container-"+Global.String(this.CommentId)).empty().append(tabs.Body);
        tabs.Render();
        _this=buttons.MarkupHelpButton;
        _this["HtmlProvider@32"].Clear(_this.Body);
        return buttons.MarkupHelpButton.AppendI(Default.Text("Hide markup help"));
       },
       ShowReplyForm:function(buttons)
       {
        var x,f,x1,_this=this,form,_this1;
        this.IsReplyOpen=true;
        x=buttons.MarkupHelpButton;
        f=(x1=function()
        {
         return function()
         {
          return _this.ToggleMarkupHelp(buttons);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(x);
        form=Default.Div(Runtime.New(T,{
         $:1,
         $0:buttons.MarkupHelpButton,
         $1:Client9.ReplyForm(_this.get_ButtonClass(),{
          $:0,
          $0:_this.CommentId
         },"",_this.Level%2===0?"odd":"even",Runtime.New(T,{
          $:0
         }))
        }));
        jQuery("#comment-reply-container-"+Global.String(_this.CommentId)).empty().append(Default.H3(List.ofArray([Default.Text("Add comment")])).Body).append(form.Body);
        jQuery("#"+_this.get_ExtraButtonId()).removeClass("no-display");
        _this1=buttons.ReplyButton;
        _this1["HtmlProvider@32"].Clear(_this1.Body);
        return buttons.ReplyButton.AppendI(Default.Text("Hide reply box"));
       },
       ToggleEditForm:function(buttons)
       {
        if(this.IsReplyOpen)
         {
          jQuery(buttons.ReplyButton.Body).show();
          return this.HideEditForm(buttons);
         }
        else
         {
          jQuery(buttons.ReplyButton.Body).hide();
          return this.ShowEditForm(buttons);
         }
       },
       ToggleMarkupHelp:function(buttons)
       {
        if(this.IsMarkupHelpOpen)
         {
          return this.HideMarkupHelp(buttons);
         }
        else
         {
          return this.ShowMarkupHelp(buttons);
         }
       },
       ToggleReplyForm:function(buttons)
       {
        if(this.IsReplyOpen)
         {
          jQuery(buttons.EditButton.Body).show();
          return this.HideReplyForm(buttons);
         }
        else
         {
          jQuery(buttons.EditButton.Body).hide();
          return this.ShowReplyForm(buttons);
         }
       },
       get_Body:function()
       {
        var mhButton,_this,x,replyButton,editButton,buttons,f,x1,_this1=this,f1,x2,delButton;
        mhButton=Operators.add(Default.A(List.ofArray([Default.Attr().Class(this.get_ButtonClass()+" comment-button no-display"),(_this=Default.Attr(),(x=this.get_ExtraButtonId(),_this.NewAttr("id",x)))])),List.ofArray([Default.Text("Markup help")]));
        replyButton=Operators.add(Default.A(List.ofArray([Default.Attr().Class(this.get_ButtonClass()+" comment-button")])),List.ofArray([Default.Text("Reply")]));
        editButton=Operators.add(Default.A(List.ofArray([Default.Attr().Class(this.get_ButtonClass()+" comment-button")])),List.ofArray([Default.Text("Edit")]));
        buttons={
         ReplyButton:replyButton,
         EditButton:editButton,
         MarkupHelpButton:mhButton
        };
        f=(x1=function()
        {
         return function()
         {
          return _this1.ToggleReplyForm(buttons);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(replyButton);
        f1=(x2=function()
        {
         return function()
         {
          return _this1.ToggleEditForm(buttons);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x2,arg10);
        });
        f1(editButton);
        delButton=Client9.deleteButton(_this1.CommentId,_this1.get_ButtonClass()+" comment-button",_this1.Level<0?{
         $:1,
         $0:_this1.TopicListUrl
        }:{
         $:0
        });
        return Default.Span(Seq.toList(Seq.delay(function()
        {
         return Seq.append([replyButton],Seq.delay(function()
         {
          return Seq.append(_this1.CanEdit?[editButton]:Seq.empty(),Seq.delay(function()
          {
           if(_this1.CanDelete)
            {
             return[delButton];
            }
           else
            {
             return Seq.empty();
            }
          }));
         }));
        })));
       },
       get_ButtonClass:function()
       {
        if(this.Level<0)
         {
          return Server.Small();
         }
        else
         {
          return Server.Comment();
         }
       },
       get_ExtraButtonId:function()
       {
        return"comment-response-extra-button-"+Global.String(this.CommentId);
       },
       get_ReplyFormId:function()
       {
        return"forum-reply-form-"+Global.String(this.CommentId);
       }
      }),
      ReplyForm:function(buttonClass,formType,newTopicUrl,previewClass,defaultTags)
      {
       var subform,form,x7,_builder_,f6,x8,x9,_builder_1,f7,f8;
       subform=function(prefill)
       {
        var x,x1,x2,f,f1,x3,f2,x4,f3,x5,x6,f4,f5,lc,inputRecord;
        return Data.$(Data.$(Data.$(Data.$((x=function(tags)
        {
         return function(title)
         {
          return function(text)
          {
           return function(isMinor)
           {
            return[tags,title,text,isMinor];
           };
          };
         };
        },Formlet1.Return(x)),formType.$==0?Formlet1.Return(Runtime.New(T,{
         $:0
        })):formType.$==2?Formlet1.Return(Runtime.New(T,{
         $:0
        })):(x1=(x2=FwLS.InputWithValue(Client2.PrettyTags(defaultTags),"Tags (comma-separated)","You need to associate your question with at least one tag","forum-reply-tags"),(f=function(formlet)
        {
         return Enhance.WithLabelAbove(formlet);
        },f(x2))),(f1=function(formlet)
        {
         return Formlet1.Map(function(s)
         {
          return Client2.ParseTags(s);
         },formlet);
        },f1(x1)))),formType.$==2?Formlet1.Return(""):formType.$==1?(x3=FwLS.Input("Title","Enter a title","forum-reply-title"),(f2=function(formlet)
        {
         return Enhance.WithLabelAbove(formlet);
        },f2(x3))):Formlet1.Return("")),(x4=FwLS.TextAreaWithValue(prefill,"Message","Enter your question.","forum-reply"),(f3=function(formlet)
        {
         return Enhance.WithLabelAbove(formlet);
        },f3(x4)))),formType.$==1?Formlet1.Return(true):formType.$==2?(x5=(x6=Controls.Checkbox(true),(f4=function(formlet)
        {
         return Enhance.WithTextLabel("Minor edit (don't bump the question)",formlet);
        },f4(x6))),(f5=(lc=(inputRecord=LabelConfiguration.get_Default(),Runtime.New(LabelConfiguration,{
         Align:{
          $:1
         },
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:inputRecord.Placement
        })),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f5(x5))):Formlet1.Return(true));
       };
       form=(x7=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var commentId,x,x1,f,f1,f2;
        return _builder_.Bind(formType.$==1?Formlet1.Return(""):formType.$==2?(commentId=formType.$0,(x=(x1=Remoting.Async("IntelliFactory.Trainings:97",[commentId]),(f=function(a)
        {
         return Formlet2.LoadingFormlet(a);
        },f(x1))),(f1=(f2=function(_arg1)
        {
         var s,err;
         if(_arg1.$==0)
          {
           s=_arg1.$0;
           return s;
          }
         else
          {
           err=_arg1.$0;
           alert(err);
           return"";
          }
        },function(formlet)
        {
         return Formlet1.Map(f2,formlet);
        }),f1(x)))):Formlet1.Return(""),function(_arg118)
        {
         return _builder_.Bind(subform(_arg118),Runtime.Tupled(function(_arg117)
         {
          var text;
          text=_arg117[2];
          return _builder_.Bind(Formlet1.OfElement(function()
          {
           var x2,f3,f4;
           x2=Default.Div(List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("preview-title")])),List.ofArray([Default.Text("Message preview:")])),Operators.add(Client4.Translate(text),List.ofArray([Default.Attr().Class("forum-text comment-body preview "+previewClass)]))]));
           f3=(f4=function()
           {
            return SyntaxHighlighter.highlight();
           },function(w)
           {
            return Operators.OnAfterRender(f4,w);
           });
           f3(x2);
           return x2;
          }),function()
          {
           return _builder_.Return(_arg117);
          });
         }));
        });
       })),(f6=function(formlet)
       {
        return Client1.EnhanceWithSubmitButton(buttonClass,formlet);
       },f6(x7)));
       x8=(x9=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        return _builder_1.Bind(form,Runtime.Tupled(function(_arg120)
        {
         var title,text,tags,isMinor,a,commentId,parentId;
         title=_arg120[1];
         text=_arg120[2];
         tags=_arg120[0];
         isMinor=_arg120[3];
         return _builder_1.Bind((a=formType.$==1?Remoting.Async("IntelliFactory.Trainings:89",[title,text,tags]):formType.$==2?(commentId=formType.$0,Remoting.Async("IntelliFactory.Trainings:90",[commentId,text,isMinor])):(parentId=formType.$0,Remoting.Async("IntelliFactory.Trainings:96",[parentId,text])),Formlet2.LoadingFormletWithLogin(a)),function(_arg119)
         {
          var msg,newCommentId;
          return _builder_1.ReturnFrom(_arg119.$==1?(msg=_arg119.$0,FormletHelpers.ErrorF(msg)):(newCommentId=_arg119.$0,(formType.$==2?location.href=location.href:formType.$==1?location.href=newTopicUrl+Global.String(newCommentId):location.href=location.href,FormletHelpers.SuccessF(formType.$==1?"Topic successfully created.":formType.$==2?"Message successfully edited.":"Comment successfully added."))));
         });
        }));
       })),(f7=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f7(x9)));
       f8=function(form1)
       {
        var form2,quoteParentButton;
        form2=Default.Div(List.ofArray([form1]));
        quoteParentButton=function(rpcCall)
        {
         var x,f,x1;
         x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(Server.Small()+" comment-button")])),List.ofArray([Default.Text("Quote parent")]));
         f=(x1=function()
         {
          return function()
          {
           var x2,f1,f4;
           x2=(f1=function()
           {
            var x3,f2;
            x3=rpcCall(null);
            f2=function(_arg121)
            {
             var text,text1,e1,x4,f3,msg;
             if(_arg121.$==0)
              {
               text=_arg121.$0;
               text1="<quote>\n"+text+"\n</quote>";
               e1=jQuery(form2.Body).find(".forum-reply textarea");
               x4=e1.val(Global.String(e1.val())+text1);
               f3=function(value)
               {
                value;
               };
               f3(x4);
               return Concurrency.Return(null);
              }
             else
              {
               msg=_arg121.$0;
               return Concurrency.Return(null);
              }
            };
            return Concurrency.Bind(x3,f2);
           },Concurrency.Delay(f1));
           f4=function(arg00)
           {
            var t;
            t={
             $:0
            };
            return Concurrency.Start(arg00);
           };
           return f4(x2);
          };
         },function(arg10)
         {
          return EventsPervasives.Events().OnClick(x1,arg10);
         });
         f(x);
         return x;
        };
        return Seq.toList(Seq.delay(function()
        {
         var parentId,commentId;
         return Seq.append(formType.$==0?(parentId=formType.$0,[quoteParentButton(function()
         {
          return Remoting.Async("IntelliFactory.Trainings:97",[parentId]);
         })]):formType.$==2?formType.$1?(null,Seq.empty()):(commentId=formType.$0,[quoteParentButton(function()
         {
          return Remoting.Async("IntelliFactory.Trainings:98",[commentId]);
         })]):(null,Seq.empty()),Seq.delay(function()
         {
          var _this,x,id,id1;
          return Seq.append([Default.Div(List.ofArray([(_this=Default.Attr(),(x="markup-help-container-"+Global.String(formType.$==2?(id=formType.$0,id):formType.$==1?0:(id1=formType.$0,id1)),_this.NewAttr("id",x))),Default.Attr().Class("markup-help-container")]))],Seq.delay(function()
          {
           return[form2];
          }));
         }));
        }));
       };
       return f8(x8);
      },
      ScoreDisplay:Runtime.Class({
       get_Body:function()
       {
        var showCount,showPosNegCount,plusButton,_this,minusButton,_this1,scoreDisplay,updateDisplayAfterVote,_this2=this;
        showCount=function(count)
        {
         if(count>=1000000)
          {
           return Global.String(count/1000000>>0)+"."+Global.String((count/100000>>0)%10)+"M";
          }
         else
          {
           if(count>=1000)
            {
             return Global.String(count/1000>>0)+"."+Global.String((count/100>>0)%10)+"k";
            }
           else
            {
             return Global.String(count);
            }
          }
        };
        showPosNegCount=function(count)
        {
         return(count>0?"+":"")+showCount(count);
        };
        plusButton=Operators.add(Default.TD(List.ofArray([Default.Attr().Class("topic-counter-plus"),(_this=Default.Attr(),_this.NewAttr("title","Upvote"))])),List.ofArray([Default.Text("+")]));
        minusButton=Operators.add(Default.TD(List.ofArray([Default.Attr().Class("topic-counter-minus"),(_this1=Default.Attr(),_this1.NewAttr("title","Downvote"))])),List.ofArray([Default.Text("-")]));
        scoreDisplay=Operators.add(Default.Span(List.ofArray([Default.Attr().Class("topic-counter-count")])),List.ofArray([Default.Text(showPosNegCount(this.Score))]));
        updateDisplayAfterVote=function()
        {
         scoreDisplay["HtmlProvider@32"].Clear(scoreDisplay.Body);
         scoreDisplay.AppendI(Default.Text(showPosNegCount(_this2.Score)));
         minusButton["HtmlProvider@32"].Remove(minusButton.Body);
         plusButton["HtmlProvider@32"].Remove(plusButton.Body);
         return jQuery("#score-display-"+Global.String(_this2.TopicId)).parent().removeClass("good").removeClass("bad").addClass(_this2.Score>0?"good":_this2.Score<0?"bad":"");
        };
        return Default.Table(List.ofArray([Default.TBody(List.ofArray([Default.TR(Seq.toList(Seq.delay(function()
        {
         return Seq.append([Operators.add(Default.TD(List.ofArray([Default.Attr().Class("score-display-box"),Default.RowSpan("2")])),List.ofArray([scoreDisplay,Default.Br(Runtime.New(T,{
          $:0
         })),Operators.add(Default.Span(List.ofArray([Default.Attr().Class("topic-counter-label")])),List.ofArray([Default.Text("score")]))]))],Seq.delay(function()
         {
          var f,x;
          if(_this2.CanVote)
           {
            return[(f=(x=function()
            {
             return function()
             {
              var x1,f1,f3;
              x1=(f1=function()
              {
               var x2,f2;
               x2=Remoting.Async("IntelliFactory.Trainings:95",[_this2.TopicId]);
               f2=function(_arg130)
               {
                var x3;
                x3=_arg130.$==1?_arg130.$0.$==0?(_this2.Score=_this2.Score+1,updateDisplayAfterVote(null)):null:window.open("/login-frame","login","width=600,height=500,status=0,resizable=0,location=0");
                return Concurrency.Return(x3);
               };
               return Concurrency.Bind(x2,f2);
              },Concurrency.Delay(f1));
              f3=function(arg00)
              {
               var t;
               t={
                $:0
               };
               return Concurrency.Start(arg00);
              };
              return f3(x1);
             };
            },function(arg10)
            {
             return EventsPervasives.Events().OnClick(x,arg10);
            }),(f(plusButton),plusButton))];
           }
          else
           {
            return Seq.empty();
           }
         }));
        }))),Default.TR(Seq.toList(Seq.delay(function()
        {
         var f,x;
         if(_this2.CanVote)
          {
           return[(f=(x=function()
           {
            return function()
            {
             var x1,f1,f3;
             x1=(f1=function()
             {
              var x2,f2;
              x2=Remoting.Async("IntelliFactory.Trainings:94",[_this2.TopicId]);
              f2=function(_arg131)
              {
               var x3;
               x3=_arg131.$==1?_arg131.$0.$==0?(_this2.Score=_this2.Score-1,updateDisplayAfterVote(null)):null:window.open("/login-frame","login","width=600,height=500,status=0,resizable=0,location=0");
               return Concurrency.Return(x3);
              };
              return Concurrency.Bind(x2,f2);
             },Concurrency.Delay(f1));
             f3=function(arg00)
             {
              var t;
              t={
               $:0
              };
              return Concurrency.Start(arg00);
             };
             return f3(x1);
            };
           },function(arg10)
           {
            return EventsPervasives.Events().OnClick(x,arg10);
           }),(f(minusButton),minusButton))];
          }
         else
          {
           return Seq.empty();
          }
        })))]))]));
       }
      }),
      deleteButton:function(topicId,buttonClass,onDeleteUrl)
      {
       var deleteButton,showForm,hideForm,container1;
       deleteButton=function(container)
       {
        var x,f,x1;
        x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(buttonClass)])),List.ofArray([Default.Text("Delete")]));
        f=(x1=function()
        {
         return function()
         {
          return showForm(container);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(x);
        return x;
       };
       showForm=function(container)
       {
        var waitFormContainer,x,f,x1,x2,f1,x3;
        container["HtmlProvider@32"].Clear(container.Body);
        return container.AppendI((waitFormContainer=Default.Span(Runtime.New(T,{
         $:0
        })),Default.Span(List.ofArray([Default.Span(List.ofArray([Default.Text("Really delete?")])),(x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(buttonClass)])),List.ofArray([Default.Text("Yes")])),(f=(x1=function()
        {
         return function()
         {
          var _builder_;
          waitFormContainer["HtmlProvider@32"].Clear(waitFormContainer.Body);
          return waitFormContainer.AppendI((_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:93",[topicId])),function(_arg127)
           {
            var msg,url;
            return _builder_.ReturnFrom(_arg127.$==1?(msg=_arg127.$0,FormletHelpers.ErrorF(msg)):(onDeleteUrl.$==1?(url=onDeleteUrl.$0,location.href=url):location.href=location.href,Formlet1.Return(null)));
           });
          })));
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x))),(x2=Operators.add(Default.A(List.ofArray([Default.Attr().Class(buttonClass)])),List.ofArray([Default.Text("No")])),(f1=(x3=function()
        {
         return function()
         {
          return hideForm(container);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x3,arg10);
        }),(f1(x2),x2)))]))));
       };
       hideForm=function(container)
       {
        container["HtmlProvider@32"].Clear(container.Body);
        return container.AppendI(deleteButton(container));
       };
       container1=Default.Span(Runtime.New(T,{
        $:0
       }));
       return Operators.add(container1,List.ofArray([deleteButton(container1)]));
      }
     }
    },
    Inbox:{
     Client:{
      NewPrivateMessageControl:Runtime.Class({
       get_Body:function()
       {
        var replyForm,_this=this,x3,inputRecord,ReplyPanelId,f3;
        replyForm=function(hideForm)
        {
         var form,_builder_;
         form=(_builder_=Formlet1.Do(),_builder_.Delay(function()
         {
          var x,x1,f,f1;
          return _builder_.Bind((x=(x1={
           FixedRecipient:{
            $:0
           },
           ButtonClass:Server.Small(),
           IncludeTitle:true,
           Text:""
          },(f=function(conf)
          {
           return Client9.MarkupMessageForm(conf);
          },f(x1))),(f1=function(formlet)
          {
           return Formlet1.WithNotificationChannel(formlet);
          },f1(x))),Runtime.Tupled(function(_arg135)
          {
           var title,reset,recipient,message,x2,f2;
           title=_arg135[0][1];
           reset=_arg135[1];
           recipient=_arg135[0][0];
           message=_arg135[0][2];
           return _builder_.Bind((x2=Remoting.Async("IntelliFactory.Trainings:88",[{
            ToUsernameOrEmail:recipient,
            Title:title,
            Message:message
           }]),(f2=function(a)
           {
            return Formlet2.LoadingFormletWithLogin(a);
           },f2(x2))),function(_arg134)
           {
            var msg,id;
            return _builder_.ReturnFrom(_arg134.$==1?(msg=_arg134.$0,FormletHelpers.ErrorF(msg)):(id=_arg134.$0,(reset(null),(hideForm(null),(location.href=_this.conf.MessageUrl+Global.String(id),FormletHelpers.SuccessF("Message successfully sent."))))));
           });
          }));
         }));
         return Default.Div(List.ofArray([form]));
        };
        x3=(inputRecord=ContactButtonConfiguration.get_Default(),(ReplyPanelId=_this.conf.ReplyPanelId,Runtime.New(ContactButtonConfiguration,{
         ReplyFormElement:replyForm,
         ButtonClass:inputRecord.ButtonClass,
         ReplyPanelId:ReplyPanelId,
         ButtonLabel:"Compose message",
         ButtonHideLabel:"Hide message box"
        })));
        f3=function(conf)
        {
         return Client9.ContactButton(conf);
        };
        return f3(x3);
       }
      })
     }
    },
    Invite:{
     Client:{
      ContactListDataControl:Runtime.Class({
       get_Body:function()
       {
        return Default.Div(Seq.toList(Seq.delay(function()
        {
         var x,f,x1,x2,f1,f2;
         if(Clienta.IsIE())
          {
           return[(x=Default.Button(List.ofArray([Default.Text("Close window")])),(f=(x1=function()
           {
            return function()
            {
             self.close();
            };
           },function(arg10)
           {
            return EventsPervasives.Events().OnClick(x1,arg10);
           }),(f(x),x)))];
          }
         else
          {
           return[(x2=Default.Div(Runtime.New(T,{
            $:0
           })),(f1=(f2=function()
           {
            self.close();
           },function(w)
           {
            return Operators.OnAfterRender(f2,w);
           }),(f1(x2),x2)))];
          }
        })));
       }
      }),
      IsIE:Runtime.Field(function()
      {
       var $0=this,$this=this;
       return(/MSIE (\d+\.\d+);/).test(Global.navigator.userAgent);
      }),
      JSRedirectControl:Runtime.Class({
       get_Body:function()
       {
        var x,f,f1;
        x=Default.Div(Runtime.New(T,{
         $:0
        }));
        f=(f1=function()
        {
         self.close();
        },function(w)
        {
         return Operators.OnAfterRender(f1,w);
        });
        f(x);
        return x;
       }
      }),
      SelectContactsControl:Runtime.Class({
       get_Body:function()
       {
        var currentSessKey,inviteContentDiv,selectedProvider,invitationSentDiv,providersListDiv,_this1=this,contactsListDiv,f12,f13;
        currentSessKey={
         contents:""
        };
        inviteContentDiv=Default.Div(List.ofArray([Default.Id("invite-content")]));
        selectedProvider={
         contents:""
        };
        invitationSentDiv=function()
        {
         return Operators.add(Default.Div(List.ofArray([Default.Id("invitation-sent")])),List.ofArray([Default.H4(List.ofArray([Default.Text("Congratulations! Invitation to Your contacts were sent")]))]));
        };
        providersListDiv=function()
        {
         var div,x,f,f2;
         div=Default.Div(List.ofArray([Default.Id("providers")]));
         x=(f=function()
         {
          var x1,f1;
          x1=Remoting.Async("IntelliFactory.Trainings:17",[]);
          f1=function(_arg178)
          {
           currentSessKey.contents=_arg178;
           div.AppendI(Default.Div(Seq.toList(Seq.delay(function()
           {
            return Seq.collect(Runtime.Tupled(function(provider)
            {
             var url,onClick,_this;
             selectedProvider.contents=provider[0];
             url=provider[1]+currentSessKey.contents+"/";
             onClick="window.open('"+url+"',"+"'invitefriendspopup', 'width=600,height=500,status=0,resizable=0,location=0'); return false;";
             return[Operators.add(Default.A(List.ofArray([Default.Attr().Class("provider"),(_this=Default.Attr(),_this.NewAttr("onclick",onClick))])),List.ofArray([Default.Img(List.ofArray([Default.Src("/images/invite/"+provider[0].toLowerCase()+".png")])),Default.H3(List.ofArray([Default.Text(provider[0])]))]))];
            }),_this1.contactsProviders);
           }))));
           return Concurrency.Return(null);
          };
          return Concurrency.Bind(x1,f1);
         },Concurrency.Delay(f));
         f2=function(arg00)
         {
          var t;
          t={
           $:0
          };
          return Concurrency.Start(arg00);
         };
         f2(x);
         return div;
        };
        contactsListDiv=function(contacts)
        {
         var x,_this,_this2,f,f1,x3,arg00,f4,x4,x9,arg001,f9,xa;
         return Operators.add(Default.Div(List.ofArray([Default.Id("friends-list")])),List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Id("all-select")])),List.ofArray([(x=Default.Input(List.ofArray([(_this=Default.Attr(),_this.NewAttr("type","checkbox")),(_this2=Default.Attr(),_this2.NewAttr("id","select-all-none"))])),(f=(f1=function()
         {
          var x1,f3;
          x1=jQuery("#select-all-none").change(function()
          {
           var newValue,x2,f2;
           newValue=jQuery("#select-all-none").is(":checked");
           x2=jQuery("#friends-table-container table input[type=checkbox]").attr("checked",newValue);
           f2=function(value)
           {
            value;
           };
           return f2(x2);
          });
          f3=function(value)
          {
           value;
          };
          return f3(x1);
         },function(w)
         {
          return Operators.OnAfterRender(f1,w);
         }),(f(x),x))),Default.Span(List.ofArray([Default.Text("Select All/None")]))])),Operators.add(Default.Div(List.ofArray([Default.Id("friends-table-container")])),List.ofArray([Default.Form(List.ofArray([Default.Table(Seq.toList(Seq.delay(function()
         {
          return Seq.map(function(friend)
          {
           var _this3,_this4,_this5,x1;
           return Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Input(List.ofArray([(_this3=Default.Attr(),_this3.NewAttr("type","checkbox")),(_this4=Default.Attr(),_this4.NewAttr("name","contact")),(_this5=Default.Attr(),(x1=friend.Username+"|"+friend.Email,_this5.NewAttr("value",x1)))]))])),Default.TD(List.ofArray([Default.Text(friend.Username)])),Default.TD(List.ofArray([Default.Text(friend.Email)]))]));
          },contacts);
         })))]))])),Operators.add(Default.Div(List.ofArray([Default.Id("summary")])),List.ofArray([(x3=Operators.add(Default.A(List.ofArray([Default.Id("go-step-one"),(arg00=Server.Comment(),Default.Attr().Class(arg00))])),List.ofArray([Default.Text("Go to Step 1")])),(f4=(x4=function()
         {
          return function()
          {
           var x1,f2,x2,f3,x5,f5,x6,f6,x7,f7,x8,f8;
           x1=jQuery("li#invite-step-one").addClass("selected");
           f2=function(value)
           {
            value;
           };
           f2(x1);
           x2=jQuery("li#invite-step-two").removeClass("selected");
           f3=function(value)
           {
            value;
           };
           f3(x2);
           x5=jQuery(inviteContentDiv.Body).fadeOut();
           f5=function(value)
           {
            value;
           };
           f5(x5);
           x6=jQuery(inviteContentDiv.Body).hide();
           f6=function(value)
           {
            value;
           };
           f6(x6);
           inviteContentDiv["HtmlProvider@32"].Clear(inviteContentDiv.Body);
           x7=inviteContentDiv.AppendI(providersListDiv(null));
           f7=function(value)
           {
            value;
           };
           f7(x7);
           x8=jQuery(inviteContentDiv.Body).fadeIn();
           f8=function(value)
           {
            value;
           };
           return f8(x8);
          };
         },function(arg10)
         {
          return EventsPervasives.Events().OnClick(x4,arg10);
         }),(f4(x3),x3))),(x9=Operators.add(Default.A(List.ofArray([Default.Id("invite-friends"),(arg001=Server.Large(),Default.Attr().Class(arg001))])),List.ofArray([Default.Text("Invite friends")])),(f9=(xa=function()
         {
          return function()
          {
           var sel,x1,f3,l,x5,f5,f6,x6,f7,x7,f8,x8,fa,xb,fb,xc,f11;
           sel={
            contents:Runtime.New(T,{
             $:0
            })
           };
           x1=jQuery("#friends-table-container table input:checkbox[name=contact]:checked").each(function()
           {
            var contact,x2,f2,username,email;
            contact=(x2=jQuery(this).val(),(f2=function(value)
            {
             return Global.String(value);
            },f2(x2)));
            username=(contact.split("|"))[0];
            email=(contact.split("|"))[1];
            sel.contents=Runtime.New(T,{
             $:1,
             $0:{
              Email:email,
              Username:username
             },
             $1:sel.contents
            });
           });
           f3=function(value)
           {
            value;
           };
           f3(x1);
           if((l=sel.contents,Seq.length(l))===0)
            {
             return alert("You haven't selected any contacts.");
            }
           else
            {
             x5=(f5=function()
             {
              var x2,f2;
              x2=Remoting.Async("IntelliFactory.Trainings:19",[sel.contents,selectedProvider.contents]);
              f2=function()
              {
               return Concurrency.Return(null);
              };
              return Concurrency.Bind(x2,f2);
             },Concurrency.Delay(f5));
             f6=function(arg002)
             {
              var t;
              t={
               $:0
              };
              return Concurrency.Start(arg002);
             };
             f6(x5);
             x6=jQuery(inviteContentDiv.Body).fadeOut();
             f7=function(value)
             {
              value;
             };
             f7(x6);
             x7=jQuery(inviteContentDiv.Body).hide();
             f8=function(value)
             {
              value;
             };
             f8(x7);
             inviteContentDiv["HtmlProvider@32"].Clear(inviteContentDiv.Body);
             x8=inviteContentDiv.AppendI(invitationSentDiv(null));
             fa=function(value)
             {
              value;
             };
             fa(x8);
             xb=jQuery(inviteContentDiv.Body).fadeIn();
             fb=function(value)
             {
              value;
             };
             fb(xb);
             xc=setTimeout(function()
             {
              var x2,f2,xd,fc,xe,fd,xf,fe,x10,ff,x11,f10;
              x2=jQuery("li#invite-step-one").addClass("selected");
              f2=function(value)
              {
               value;
              };
              f2(x2);
              xd=jQuery("li#invite-step-two").removeClass("selected");
              fc=function(value)
              {
               value;
              };
              fc(xd);
              xe=jQuery(inviteContentDiv.Body).fadeOut();
              fd=function(value)
              {
               value;
              };
              fd(xe);
              xf=jQuery(inviteContentDiv.Body).hide();
              fe=function(value)
              {
               value;
              };
              fe(xf);
              inviteContentDiv["HtmlProvider@32"].Clear(inviteContentDiv.Body);
              x10=inviteContentDiv.AppendI(providersListDiv(null));
              ff=function(value)
              {
               value;
              };
              ff(x10);
              x11=jQuery(inviteContentDiv.Body).fadeIn();
              f10=function(value)
              {
               value;
              };
              return f10(x11);
             },3000);
             f11=function(value)
             {
              value;
             };
             return f11(xc);
            }
          };
         },function(arg10)
         {
          return EventsPervasives.Events().OnClick(xa,arg10);
         }),(f9(x9),x9)))]))]));
        };
        f12=(f13=function()
        {
         var x,f,x1,f1,x2,f2,x3,f3,x4,f4,returnContactsInternal,waitForContactsFromSever;
         x=jQuery(inviteContentDiv.Body).hide();
         f=function(value)
         {
          value;
         };
         f(x);
         x1=inviteContentDiv.AppendI(providersListDiv(null));
         f1=function(value)
         {
          value;
         };
         f1(x1);
         x2=jQuery(inviteContentDiv.Body).fadeIn();
         f2=function(value)
         {
          value;
         };
         f2(x2);
         x3=jQuery("li#invite-step-one").addClass("selected");
         f3=function(value)
         {
          value;
         };
         f3(x3);
         x4=jQuery("li#invite-step-two").removeClass("selected");
         f4=function(value)
         {
          value;
         };
         f4(x4);
         returnContactsInternal=function(contacts)
         {
          var x5,f5,x6,f6,contactsPopulatedDiv,x7,f7,x8,f8,x9,f9;
          x5=jQuery("li#invite-step-one").removeClass("selected");
          f5=function(value)
          {
           value;
          };
          f5(x5);
          x6=jQuery("li#invite-step-two").addClass("selected");
          f6=function(value)
          {
           value;
          };
          f6(x6);
          contactsPopulatedDiv=contactsListDiv(contacts);
          x7=jQuery(inviteContentDiv.Body).fadeOut();
          f7=function(value)
          {
           value;
          };
          f7(x7);
          x8=jQuery(inviteContentDiv.Body).hide();
          f8=function(value)
          {
           value;
          };
          f8(x8);
          inviteContentDiv["HtmlProvider@32"].Clear(inviteContentDiv.Body);
          inviteContentDiv.AppendI(contactsPopulatedDiv);
          x9=jQuery(inviteContentDiv.Body).fadeIn();
          f9=function(value)
          {
           value;
          };
          return f9(x9);
         };
         waitForContactsFromSever=function()
         {
          var x5,f5,f9,x7,fa;
          if(currentSessKey.contents!=="")
           {
            x5=(f5=function()
            {
             var x6,f6;
             x6=Remoting.Async("IntelliFactory.Trainings:18",[currentSessKey.contents]);
             f6=function(_arg180)
             {
              var a,contacts,b,f7,f8;
              a=_arg180.$==0?(null,Concurrency.Return(null)):(contacts=_arg180.$0,(returnContactsInternal(contacts),Concurrency.Return(null)));
              b=(f7=function()
              {
               return Concurrency.Return(null);
              },Concurrency.Delay(f7));
              f8=function()
              {
               return b;
              };
              return Concurrency.Bind(a,f8);
             };
             return Concurrency.Bind(x6,f6);
            },Concurrency.Delay(f5));
            f9=function(arg00)
            {
             var t;
             t={
              $:0
             };
             return Concurrency.Start(arg00);
            };
            f9(x5);
           }
          x7=setTimeout(waitForContactsFromSever,1000);
          fa=function(value)
          {
           value;
          };
          return fa(x7);
         };
         return waitForContactsFromSever(null);
        },function(w)
        {
         return Operators.OnAfterRender(f13,w);
        });
        f12(inviteContentDiv);
        return inviteContentDiv;
       }
      })
     }
    },
    JS:{
     FormletHelpers:{
      Enhance:{
       WithCssClass:function(css,formlet)
       {
        var f,f1;
        f=(f1=function(el)
        {
         var _this,objectArg,arg00;
         _this=el.Element;
         objectArg=_this["HtmlProvider@32"];
         (arg00=_this.Body,function(arg10)
         {
          return objectArg.AddClass(arg00,arg10);
         })(css);
         return el;
        },function(formlet1)
        {
         return Formlet1.MapBody(f1,formlet1);
        });
        return f(formlet);
       }
      },
      ErrorF:function(msg)
      {
       return FormletHelpers.MessageF("error",List.ofArray([Default.Text(msg)]));
      },
      ErrorFHtml:function(msg)
      {
       return FormletHelpers.MessageF("error",msg);
      },
      MessageF:function(_class_,msg)
      {
       var _builder_;
       _builder_=Formlet1.Do();
       return _builder_.Delay(function()
       {
        return _builder_.Bind(Formlet1.OfElement(function()
        {
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class(_class_)])),msg);
        }),function()
        {
         return _builder_.ReturnFrom(Formlet1.Never());
        });
       });
      },
      SuccessF:function(msg)
      {
       return FormletHelpers.MessageF("success",List.ofArray([Default.Text(msg)]));
      },
      SuccessFHtml:function(msg)
      {
       return FormletHelpers.MessageF("success",msg);
      }
     }
    },
    JobListing:{
     Client:{
      ApplicantsControl:Runtime.Class({
       get_Body:function()
       {
        var jobRow,_builder_,_this=this;
        jobRow=function(app)
        {
         var x,f;
         x=List.ofArray([Operators.add(Default.TD(List.ofArray([Default.Attr().Class("date")])),List.ofArray([Default.Text(app.Date)])),Operators.add(Default.TD(List.ofArray([Default.Attr().Class("username")])),Seq.toList(Seq.delay(function()
         {
          var matchValue,url;
          return[(matchValue=app.UsernameUrl,matchValue.$==0?Default.Text(app.Username):(url=matchValue.$0,Operators.add(Default.A(List.ofArray([Default.HRef(url)])),List.ofArray([Default.Text(app.Username)]))))];
         }))),Operators.add(Default.TD(List.ofArray([Default.Attr().Class("message")])),List.ofArray([Operators.add(Default.A(List.ofArray([Default.HRef(app.MessageUrl)])),List.ofArray([Default.Text(app.Title)]))]))]);
         f=function(x1)
         {
          return Default.TR(x1);
         };
         return f(x);
        };
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var label,l;
         return _builder_.Bind((label=Global.String((l=_this.apps,Seq.length(l))),Controls1.SmallButton(label)),function()
         {
          var x,f1;
          return _builder_.ReturnFrom((x=Formlet1.OfElement(function()
          {
           var rows,x1,f;
           rows=(x1=_this.apps,(f=function(list)
           {
            return List.map(jobRow,list);
           },f(x1)));
           return Operators.add(Default.Table(List.ofArray([Default.Attr().Class("job-application-listing")])),List.ofArray([Default.THead(List.ofArray([Default.TH(List.ofArray([Default.Text("Date")])),Default.TH(List.ofArray([Default.Text("From")])),Default.TH(List.ofArray([Default.Text("Message")]))])),Default.TBody(rows)]));
          }),(f1=function(formlet)
          {
           return Enhance1.WithDialog("Job inquires",formlet);
          },f1(x))));
         });
        });
       }
      }),
      ExtendPeriodFormControl:Runtime.Class({
       get_Body:function()
       {
        var form,_builder_,_this=this,_builder_2;
        form=(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         var x,_builder_1,f;
         return _builder_.Bind((x=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
         {
          return _builder_1.Bind(Clientb.ListingPeriodForm(_this.args.User,_this.args.PeriodLabelsAndPrices,{
           $:1,
           $0:0
          }),function(_arg223)
          {
           return _builder_1.Bind(Clientb.ConfirmUpdateForm(_this.args.ActiveDaysLeft,_arg223),function()
           {
            return _builder_1.Return(_arg223);
           });
          });
         })),(f=function(formlet)
         {
          return UserControls.SetupForm("Extend",true,formlet);
         },f(x))),function(_arg221)
         {
          var x1,f1;
          return _builder_.Bind((x1=Remoting.Async("IntelliFactory.Trainings:83",[_this.args.JobId,_arg221]),(f1=function(a)
          {
           return Formlet2.LoadingFormlet(a);
          },f1(x1))),function(_arg220)
          {
           return _builder_.ReturnFrom(_arg220?(location.href=location.href,FormletHelpers.SuccessF("The job listing period has been extended.")):FormletHelpers.ErrorF("Something went wrong, the listing period could not be extended."));
          });
         });
        }));
        _builder_2=Formlet1.Do();
        return _builder_2.Delay(function()
        {
         return _builder_2.Bind(Controls1.SmallButton("Extend"),function()
         {
          var f;
          return _builder_2.Bind((f=function(formlet)
          {
           return Enhance1.WithDialog("Extend job listing",formlet);
          },f(form)),function()
          {
           return _builder_2.Return(null);
          });
         });
        });
       }
      }),
      SetActiveJobControl:Runtime.Class({
       get_Body:function()
       {
        var patternInput,title,rpc,msg,label,_builder_,_this=this;
        patternInput=this.job.IsPublic?["Deactivate","Confirm deactivation of job","Are you sure you would like to deactivate this \r\n                            job and remove it from the public job listing",function(jobId)
        {
         return Remoting.Async("IntelliFactory.Trainings:80",[jobId]);
        }]:["Activate","Confirm activation of job","Are you sure you would like to activate this \r\n                            job and making it publicly visible.",function(jobId)
        {
         return Remoting.Async("IntelliFactory.Trainings:79",[jobId]);
        }];
        title=patternInput[1];
        rpc=patternInput[3];
        msg=patternInput[2];
        label=patternInput[0];
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         return _builder_.Bind(Controls1.SmallButton(label),function()
         {
          return _builder_.Bind(UserControls.Confirm({
           Title:title,
           Message:msg,
           YesLabel:"Yes",
           NoLabel:"No"
          }),function(_arg217)
          {
           var x,x1,f,f2,f3;
           return _builder_.Bind(_arg217?(x=(x1=(f=function()
           {
            var x2,f1;
            x2=rpc(_this.jobId);
            f1=function()
            {
             location.href=location.href;
             return Concurrency.Return(null);
            };
            return Concurrency.Bind(x2,f1);
           },Concurrency.Delay(f)),(f2=function(arg00)
           {
            var t;
            t={
             $:0
            };
            return Concurrency.Start(arg00);
           },f2(x1))),(f3=function(value)
           {
            value;
           },f3(x)),Formlet1.Return(null)):Formlet1.Never(),function()
           {
            return _builder_.Return(null);
           });
          });
         });
        });
       }
      })
     }
    },
    JobOffer:{
     Client:{
      CompanyForm:function(job)
      {
       var compName,x,x1,x2,f,f1,f2,compUrl,x3,f3,compLogoUrl,x4,f4,compDescr,x5,x6,f5,f6,x7,x8,f7;
       compName=(x=(x1=(x2=Controls.Input(job.CompanyName),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter a non empty company name.",arg10);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x1))),(f2=function(formlet)
       {
        return Enhance.WithTextLabel("Company name",formlet);
       },f2(x)));
       compUrl=(x3=Controls.Input(job.CompanyWebSiteUrl),(f3=function(formlet)
       {
        return Enhance.WithTextLabel("Company URL",formlet);
       },f3(x3)));
       compLogoUrl=(x4=Controls.Input(job.CompanyLogoUrl),(f4=function(formlet)
       {
        return Enhance.WithTextLabel("Company logo URL",formlet);
       },f4(x4)));
       compDescr=(x5=(x6=Controls.TextArea(job.CompanyDescription),(f5=function(formlet)
       {
        return Enhance.WithTextLabel("Company description",formlet);
       },f5(x6))),(f6=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       },f6(x5)));
       x7=Data.$(Data.$(Data.$(Data.$((x8=function(name)
       {
        return function(url)
        {
         return function(lUrl)
         {
          return function(descr)
          {
           return{
            Name:name,
            Description:descr,
            Url:url,
            LogoUrl:lUrl
           };
          };
         };
        };
       },Formlet1.Return(x8)),compName),compUrl),compLogoUrl),compDescr);
       f7=function(formlet)
       {
        return Enhance1.WithStep(1,"Company Info",formlet);
       };
       return f7(x7);
      },
      ConfirmPostForm:function(period)
      {
       var info,conf,x2,f,x3,x4,x5,f1,f2,f3;
       info=function()
       {
        var x,_this,x1,_this1;
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("Posting this job will make it publicly visible for "),(x=List.ofArray([Default.Text(period.Label.toLowerCase())]),(_this=Default.Tags(),_this.NewTag("strong",x))),Default.Text(".")])),Default.P(List.ofArray([Default.Text(" The total the cost is "),(x1=List.ofArray([Default.Text(Global.String(period.Price))]),(_this1=Default.Tags(),_this1.NewTag("strong",x1))),Default.Text(" credits, which will be deducted from your FPish credits balance.")])),Default.P(List.ofArray([Default.Text("Please confirm that you agree with these terms.")]))]));
       };
       conf=(x2=Controls.Checkbox(false),(f=function(arg10)
       {
        return Data.Validator().IsTrue("You need to agree with the terms.",arg10);
       },f(x2)));
       x3=Data.$(Data.$((x4=function()
       {
        return function()
        {
         return null;
        };
       },Formlet1.Return(x4)),(x5=Formlet1.OfElement(info),(f1=function(formlet)
       {
        return Formlet1.InitWith(null,formlet);
       },f1(x5)))),conf);
       f2=(f3=function(el)
       {
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("box")])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f3,formlet);
       });
       return f2(x3);
      },
      ConfirmUpdateForm:function(actDays,period)
      {
       var info,x2,_builder_,f3,f4;
       info=function()
       {
        var text,x,_this,x1,_this1;
        text=actDays<0?"Posting this job will make it publicly visible for ":"Posting this job will extend the period of visibility with ";
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text(text),(x=List.ofArray([Default.Text(period.Label.toLowerCase())]),(_this=Default.Tags(),_this.NewTag("strong",x))),Default.Text(".")])),Default.P(List.ofArray([Default.Text(" The total the cost is "),(x1=List.ofArray([Default.Text(Global.String(period.Price))]),(_this1=Default.Tags(),_this1.NewTag("strong",x1))),Default.Text(" credits, which will be deducted from your FPish credits balance.")])),Default.P(List.ofArray([Default.Text("Please confirm that you agree with these terms.")]))]));
       };
       x2=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x,f,f1;
        return _builder_.Bind((x=(f=function(genElem)
        {
         return Formlet1.OfElement(genElem);
        },f(info)),(f1=function(formlet)
        {
         return Formlet1.InitWith(null,formlet);
        },f1(x))),function()
        {
         var x1,f2;
         return _builder_.Bind((x1=Controls.Checkbox(false),(f2=function(arg10)
         {
          return Data.Validator().IsTrue("You need to agree with the terms.",arg10);
         },f2(x1))),function()
         {
          return _builder_.Return(null);
         });
        });
       }));
       f3=(f4=function(el)
       {
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("box")])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f4,formlet);
       });
       return f3(x2);
      },
      EditJobControl:Runtime.Class({
       get_Body:function()
       {
        var x,f,f1;
        x=Clientb.EditJobForm(this.args);
        f=(f1=function(elem)
        {
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("post-job-panel formlet")])),List.ofArray([elem]));
        },function(formlet)
        {
         return Formlet1.MapElement(f1,formlet);
        });
        return f(x);
       }
      }),
      EditJobForm:function(args)
      {
       var editForm,_builder_,_builder_1;
       editForm=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x;
        return _builder_.Bind(Data.$(Data.$((x=function(j)
        {
         return function(p)
         {
          return[j,p];
         };
        },Formlet1.Return(x)),Clientb.JobForm(args.JobOffer)),Clientb.ExtendPeriodForm(args)),Runtime.Tupled(function(_arg212)
        {
         var perOpt,job,period;
         perOpt=_arg212[1];
         job=_arg212[0];
         return _builder_.Bind(perOpt.$==0?Formlet1.Return(null):(period=perOpt.$0,Clientb.ConfirmUpdateForm(args.ActiveDaysLeft,period)),function()
         {
          return _builder_.Return([job,perOpt]);
         });
        }));
       }));
       _builder_1=Formlet1.Do();
       return _builder_1.Delay(function()
       {
        var x,f,f1;
        return _builder_1.Bind((x=(f=function(formlet)
        {
         return Enhance.WithCssClass("edit-job-panel",formlet);
        },f(editForm)),(f1=function(formlet)
        {
         return UserControls.SetupForm("Update",true,formlet);
        },f1(x))),Runtime.Tupled(function(_arg214)
        {
         var perOpt,job,x1,f2;
         perOpt=_arg214[1];
         job=_arg214[0];
         return _builder_1.Bind((x1=Remoting.Async("IntelliFactory.Trainings:82",[args.JobId,job,perOpt]),(f2=function(a)
         {
          return Formlet2.LoadingFormlet(a);
         },f2(x1))),function(_arg213)
         {
          return _builder_1.ReturnFrom(_arg213?(location.href=args.RedirectUrl,FormletHelpers.SuccessF("Your job was updated.")):FormletHelpers.ErrorF("Something went wrong, the job could not be created"));
         });
        }));
       });
      },
      EditorParams:Runtime.Field(function()
      {
       var inputRecord,ToolbarLocation,Buttons;
       inputRecord=AdvancedHtmlEditorConfiguration.get_Default();
       ToolbarLocation={
        $:1,
        $0:"top"
       };
       Buttons={
        $:1,
        $0:List.ofArray([List.ofArray([{
         $:0
        },{
         $:1
        },{
         $:2
        },{
         $:3
        },{
         $:40
        },{
         $:15
        },{
         $:16
        },{
         $:40
        },{
         $:4
        },{
         $:5
        },{
         $:6
        },{
         $:7
        },{
         $:40
        },{
         $:9
        },{
         $:8
        },{
         $:40
        },{
         $:25
        },{
         $:40
        },{
         $:17
        },{
         $:18
        },{
         $:19
        },{
         $:40
        },{
         $:20
        },{
         $:22
        },{
         $:40
        },{
         $:21
        }]),Runtime.New(T,{
         $:0
        }),Runtime.New(T,{
         $:0
        })])
       };
       return Runtime.New(AdvancedHtmlEditorConfiguration,{
        Width:{
         $:1,
         $0:608
        },
        Height:{
         $:1,
         $0:250
        },
        Plugins:inputRecord.Plugins,
        ToolbarLocation:ToolbarLocation,
        ToolbarAlign:inputRecord.ToolbarAlign,
        StatusbarLocation:inputRecord.StatusbarLocation,
        Buttons:Buttons
       });
      }),
      ExtendPeriodForm:function(args)
      {
       var expInfo,periodForm,x2,_builder_,f4,x4,_builder_1,f5;
       expInfo=Formlet1.OfElement(function()
       {
        var x,f;
        return Default.Div(List.ofArray([(x=args.ActiveDaysLeft>0?"This job will be listed for "+Global.String(args.ActiveDaysLeft)+" more days.":"The job offer listing time has expired.",(f=function(x1)
        {
         return Default.Text(x1);
        },f(x)))]));
       });
       periodForm=(x2=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x,f;
        return _builder_.Bind((x=Controls.Checkbox(false),(f=function(formlet)
        {
         return Enhance.WithTextLabel("Extend Period",formlet);
        },f(x))),function(_arg202)
        {
         var x1,x3,f1,f2,f3;
         return _builder_.ReturnFrom(_arg202?(x1=(x3=Clientb.ListingPeriodForm(args.User,args.PeriodLabelsAndPrices,{
          $:0
         }),(f1=function(formlet)
         {
          return Enhance.WithTextLabel("Listing period",formlet);
         },f1(x3))),(f2=(f3=function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         },function(formlet)
         {
          return Formlet1.Map(f3,formlet);
         }),f2(x1))):Formlet1.Return({
          $:0
         }));
        });
       })),(f4=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f4(x2)));
       x4=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        return _builder_1.Bind(expInfo,function()
        {
         return _builder_1.ReturnFrom(periodForm);
        });
       }));
       f5=function(formlet)
       {
        return Enhance1.WithStep(4,"Listing period",formlet);
       };
       return f5(x4);
      },
      JobForm:function(job)
      {
       var x;
       return Data.$(Data.$(Data.$(Data.$((x=function(title)
       {
        return function(comp)
        {
         return function(loc)
         {
          return function(j)
          {
           var jobOffer,Abstract,CompanyName,CompanyDescription,CompanyWebSiteUrl,CompanyLogoUrl,Locations,IsTelecommutePossible,Description,Requirements,Tags1,CanApply;
           jobOffer=(Abstract=j.Abstract,(CompanyName=comp.Name,(CompanyDescription=comp.Description,(CompanyWebSiteUrl=comp.Url,(CompanyLogoUrl=comp.LogoUrl,(Locations=loc.Locations,(IsTelecommutePossible=loc.IsTelecommutePossible,(Description=j.Description,(Requirements=j.Requirements,(Tags1=j.Tags,(CanApply=j.CanApply,Runtime.New(JobOffer,{
            Id:job.Id,
            Title:title,
            CreateDate:job.CreateDate,
            ExpirationDate:job.ExpirationDate,
            PostedByUser:job.PostedByUser,
            CompanyName:CompanyName,
            CompanyDescription:CompanyDescription,
            CompanyWebSiteUrl:CompanyWebSiteUrl,
            CompanyLogoUrl:CompanyLogoUrl,
            Abstract:Abstract,
            Locations:Locations,
            IsTelecommutePossible:IsTelecommutePossible,
            Description:Description,
            Requirements:Requirements,
            Tags:Tags1,
            IsPublic:job.IsPublic,
            Applications:job.Applications,
            CanApply:CanApply
           }))))))))))));
           return jobOffer;
          };
         };
        };
       },Formlet1.Return(x)),Clientb.JobTitleForm(job)),Clientb.CompanyForm(job)),Clientb.LocationForm(job)),Clientb.JobInfoForm(job));
      },
      JobInfoForm:function(job)
      {
       var canApply,x,f,descr,x1,x2,x3,x4,x5,f1,f2,f3,f4,f5,reqs,x6,x7,x8,x9,xa,f6,f7,f8,f9,fa,tags,xb,fb,abs,xc,xd,xe,xf,x10,fc,fd,fe,ff,f10,x11,x12,f11;
       canApply=(x=Controls.Checkbox(job.CanApply),(f=function(formlet)
       {
        return Enhance.WithTextLabel("Users can apply on FPish",formlet);
       },f(x)));
       descr=(x1=(x2=(x3=(x4=(x5=(Controls5.AdvancedHtmlEditor(Clientb.EditorParams()))(job.Description),(f1=function(arg10)
       {
        return Data.Validator().IsNotEmpty("Enter non empty description",arg10);
       },f1(x5))),(f2=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f2(x4))),(f3=function(formlet)
       {
        return Enhance.WithCssClass("rich-editor",formlet);
       },f3(x3))),(f4=function(formlet)
       {
        return Enhance.WithTextLabel("Job description",formlet);
       },f4(x2))),(f5=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       },f5(x1)));
       reqs=(x6=(x7=(x8=(x9=(xa=(Controls5.AdvancedHtmlEditor(Clientb.EditorParams()))(job.Requirements),(f6=function(arg10)
       {
        return Data.Validator().IsNotEmpty("Enter a non empty value",arg10);
       },f6(xa))),(f7=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f7(x9))),(f8=function(formlet)
       {
        return Enhance.WithCssClass("rich-editor",formlet);
       },f8(x8))),(f9=function(formlet)
       {
        return Enhance.WithTextLabel("Requirements",formlet);
       },f9(x7))),(fa=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       },fa(x6)));
       tags=(xb=UserControls.SelectedTagsFormOneOrMore(job.Tags),(fb=function(formlet)
       {
        return Enhance.WithTextLabel("Tags",formlet);
       },fb(xb)));
       abs=(xc=(xd=(xe=(xf=(x10=Controls.TextArea(job.Abstract),(fc=function(arg10)
       {
        return Data.Validator().IsNotEmpty("Enter a non empty value.",arg10);
       },fc(x10))),(fd=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },fd(xf))),(fe=function(formlet)
       {
        return Enhance.WithTextLabel("Abstract",formlet);
       },fe(xe))),(ff=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       },ff(xd))),(f10=function(formlet)
       {
        return Enhance.WithCssClass("",formlet);
       },f10(xc)));
       x11=Data.$(Data.$(Data.$(Data.$(Data.$((x12=function(canApply1)
       {
        return function(abs1)
        {
         return function(descr1)
         {
          return function(reqs1)
          {
           return function(tags1)
           {
            return{
             CanApply:canApply1,
             Abstract:abs1,
             Description:descr1,
             Requirements:reqs1,
             Tags:tags1
            };
           };
          };
         };
        };
       },Formlet1.Return(x12)),canApply),abs),descr),reqs),tags);
       f11=function(formlet)
       {
        return Enhance1.WithStep(3,"Job specifications",formlet);
       };
       return f11(x11);
      },
      JobTitleForm:function(job)
      {
       var x,x1,x2,x3,f,f1,f2,f3;
       x=(x1=(x2=(x3=Controls.Input(job.Title),(f=function(formlet)
       {
        return Enhance.WithCssClass("title",formlet);
       },f(x3))),(f1=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter a non empty title.",arg10);
       },f1(x2))),(f2=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f2(x1)));
       f3=function(formlet)
       {
        return Enhance.WithTextLabel("Job title",formlet);
       };
       return f3(x);
      },
      ListingPeriodForm:function(user,labelAndPeriods,def)
      {
       var _builder_;
       _builder_=Formlet1.Do();
       return _builder_.Delay(function()
       {
        var x,x1,f,mapping,f1,f2;
        return _builder_.Bind((x=(x1=(f=(mapping=function(lp)
        {
         return[lp.Label+" ("+Global.String(lp.Price)+" credits )",lp];
        },function(list)
        {
         return List.map(mapping,list);
        }),f(labelAndPeriods)),(f1=function(values)
        {
         return Controls.RadioButtonGroup(def,values);
        },f1(x1))),(f2=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f2(x))),function(_arg199)
        {
         var x2,f3;
         return _builder_.ReturnFrom(user.Credit<_arg199.Price?(x2=FormletHelpers.ErrorF("You do not have enough credits for this option. Please top up your credits\r\n                            before proceeding or select a shorter period."),(f3=function(formlet)
         {
          return Formlet1.InitWithFailure(formlet);
         },f3(x2))):Formlet1.Return(_arg199));
        });
       });
      },
      LocationForm:function(job)
      {
       var tel,x,x1,x2,f,f1,f2,f3,locations,x3,x4,f4,f5,x5,x6,f6;
       tel=(x=(x1=(x2=Controls.Checkbox(job.IsTelecommutePossible),(f=function(formlet)
       {
        return Enhance.WithTextLabel("Possible to work remotely",formlet);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f1(x1))),(f2=(f3=function(el)
       {
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("remote-panel")])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f3,formlet);
       }),f2(x)));
       locations=(x3=(x4=Clientb.LocationForms(job.Locations),(f4=function(formlet)
       {
        return Enhance.WithTextLabel("Location(s)",formlet);
       },f4(x4))),(f5=function(formlet)
       {
        return Enhance.WithLabelAbove(formlet);
       },f5(x3)));
       x5=Data.$(Data.$((x6=function(tel1)
       {
        return function(locs)
        {
         return{
          IsTelecommutePossible:tel1,
          Locations:locs
         };
        };
       },Formlet1.Return(x6)),tel),locations);
       f6=function(formlet)
       {
        return Enhance1.WithStep(2,"Locations",formlet);
       };
       return f6(x5);
      },
      LocationForms:function(locs)
      {
       var locationForm,patternInput,patternInput1,ls,l,rest,fst,xa,fa,formlet1,restLocs,fstLoc,xb;
       locationForm=function(loc)
       {
        var city,x,x1,x2,f,f1,f2,state,x3,f3,zip,x4,f4,country,x5,x6,x7,f5,f6,f7,x8,x9,f8,f9;
        city=(x=(x1=(x2=Controls.Input(loc.City),(f=function(arg10)
        {
         return Data.Validator().IsNotEmpty("Enter non empty city",arg10);
        },f(x2))),(f1=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f1(x1))),(f2=function(formlet)
        {
         return Enhance.WithTextLabel("City",formlet);
        },f2(x)));
        state=(x3=Controls.Input(loc.State),(f3=function(formlet)
        {
         return Enhance.WithTextLabel("State",formlet);
        },f3(x3)));
        zip=(x4=Controls.Input(loc.Zip),(f4=function(formlet)
        {
         return Enhance.WithTextLabel("Zip",formlet);
        },f4(x4)));
        country=(x5=(x6=(x7=Controls.Input(loc.Country),(f5=function(arg10)
        {
         return Data.Validator().IsNotEmpty("Enter non empty country",arg10);
        },f5(x7))),(f6=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f6(x6))),(f7=function(formlet)
        {
         return Enhance.WithTextLabel("Country",formlet);
        },f7(x5)));
        x8=Data.$(Data.$(Data.$(Data.$((x9=function(city1)
        {
         return function(state1)
         {
          return function(zip1)
          {
           return function(country1)
           {
            return Runtime.New(JobLocation,{
             City:city1,
             State:state1,
             Zip:zip1,
             Country:country1
            });
           };
          };
         };
        },Formlet1.Return(x9)),city),state),zip),country);
        f8=(f9=function(elem)
        {
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("job-location")])),List.ofArray([elem]));
        },function(formlet)
        {
         return Formlet1.MapElement(f9,formlet);
        });
        return f8(x8);
       };
       patternInput=(patternInput1=locs.$==1?(ls=locs.$1,(l=locs.$0,[l,ls])):[JobLocation.get_Empty(),Runtime.New(T,{
        $:0
       })],(rest=patternInput1[1],(fst=patternInput1[0],[locationForm(fst),(xa=List.map(locationForm,rest),(fa=(formlet1=locationForm(JobLocation.get_Empty()),function(init)
       {
        return Formlet2.Many(formlet1,init);
       }),fa(xa)))])));
       restLocs=patternInput[1];
       fstLoc=patternInput[0];
       return Data.$(Data.$((xb=function(l1)
       {
        return function(ls1)
        {
         return Runtime.New(T,{
          $:1,
          $0:l1,
          $1:ls1
         });
        };
       },Formlet1.Return(xb)),fstLoc),restLocs);
      },
      PeriodForm:function(user,labelsAndPrices)
      {
       var x,x1,f,f1;
       x=(x1=Clientb.ListingPeriodForm(user,labelsAndPrices,{
        $:0
       }),(f=function(formlet)
       {
        return Enhance.WithTextLabel("Listing period",formlet);
       },f(x1)));
       f1=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       };
       return f1(x);
      },
      PostJobControl:Runtime.Class({
       get_Body:function()
       {
        var x,f,f1;
        x=Clientb.PostJobForm(this.args);
        f=(f1=function(elem)
        {
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("post-job-panel formlet")])),List.ofArray([elem]));
        },function(formlet)
        {
         return Formlet1.MapElement(f1,formlet);
        });
        return f(x);
       }
      }),
      PostJobForm:function(args)
      {
       var periodForm,x,period,x1,x2,f,f1,elem,_builder_,_builder_1,f4,jobPeriodForm,_builder_2,_builder_3;
       periodForm=(x=args.IsFree?(period=(x1=(x2=args.PeriodsLabelsAndPrices,(f=function(list)
       {
        return List.rev(list);
       },f(x2))),(f1=function(list)
       {
        return list.$0;
       },f1(x1))),(elem=function()
       {
        var x3,_this;
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("box")])),List.ofArray([Default.Text("The job will be listed for free for a period of "),(x3=List.ofArray([Default.Text(Global.String(period.NumDays))]),(_this=Default.Tags(),_this.NewTag("strong",x3))),Default.Text(" days. You may later edit or remove the job from the public listing. "),Default.Text("Please confirm that you agree with these terms.")]));
       },(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x3,f2;
        return _builder_.Bind((x3=Formlet1.OfElement(elem),(f2=function(formlet)
        {
         return Formlet1.InitWith(null,formlet);
        },f2(x3))),function()
        {
         var x4,f3;
         return _builder_.Bind((x4=Controls.Checkbox(false),(f3=function(arg10)
         {
          return Data.Validator().IsTrue("You need to agree with the terms.",arg10);
         },f3(x4))),function()
         {
          return _builder_.Return(period);
         });
        });
       })))):(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        return _builder_1.Bind(Clientb.PeriodForm(args.User,args.PeriodsLabelsAndPrices),function(_arg207)
        {
         return _builder_1.Bind(Clientb.ConfirmPostForm(_arg207),function()
         {
          return _builder_1.Return(_arg207);
         });
        });
       })),(f4=function(formlet)
       {
        return Enhance1.WithStep(4,"Listing period",formlet);
       },f4(x)));
       jobPeriodForm=(_builder_2=Formlet1.Do(),_builder_2.Delay(function()
       {
        var x3,x4,f2;
        return _builder_2.Bind((x3=Data.$(Data.$((x4=function(job)
        {
         return function(period1)
         {
          return[job,period1];
         };
        },Formlet1.Return(x4)),Clientb.JobForm(args.JobOffer)),periodForm),(f2=function(formlet)
        {
         return Enhance.WithCssClass("edit-job-panel",formlet);
        },f2(x3))),Runtime.Tupled(function(_arg208)
        {
         var period1,job;
         period1=_arg208[1];
         job=_arg208[0];
         return _builder_2.Return([job,period1]);
        }));
       }));
       _builder_3=Formlet1.Do();
       return _builder_3.Delay(function()
       {
        var f2;
        return _builder_3.Bind((f2=function(formlet)
        {
         return UserControls.SetupForm("Post",true,formlet);
        },f2(jobPeriodForm)),Runtime.Tupled(function(_arg210)
        {
         var period1,job,x3,f3;
         period1=_arg210[1];
         job=_arg210[0];
         return _builder_3.Bind((x3=Remoting.Async("IntelliFactory.Trainings:81",[job,period1]),(f3=function(a)
         {
          return Formlet2.LoadingFormlet(a);
         },f3(x3))),function(_arg209)
         {
          return _builder_3.ReturnFrom(_arg209?(location.href=args.RedirectUrl,FormletHelpers.SuccessF("Your job was created.")):FormletHelpers.ErrorF("Something went wrong, the job could not be created"));
         });
        }));
       });
      }
     }
    },
    JobView:{
     Client:{
      JobApplicationControl:Runtime.Class({
       get_Body:function()
       {
        var applyForm,_this=this,x3,inputRecord,ReplyPanelId,f3;
        applyForm=function(hideForm)
        {
         var form,_builder_;
         form=(_builder_=Formlet1.Do(),_builder_.Delay(function()
         {
          var x,x1,f,f1;
          return _builder_.Bind((x=(x1={
           FixedRecipient:{
            $:1,
            $0:_this.conf.Recipient
           },
           ButtonClass:Server.Large(),
           IncludeTitle:false,
           Text:_this.conf.DefaultMessage
          },(f=function(conf)
          {
           return Client9.MarkupMessageForm(conf);
          },f(x1))),(f1=function(formlet)
          {
           return Formlet1.WithNotificationChannel(formlet);
          },f1(x))),Runtime.Tupled(function(_arg198)
          {
           var reset,message,x2,f2;
           reset=_arg198[1];
           message=_arg198[0][2];
           return _builder_.Bind((x2=Remoting.Async("IntelliFactory.Trainings:84",[{
            JobId:_this.conf.JobId,
            Title:_this.conf.MessageTitle,
            Message:message
           }]),(f2=function(a)
           {
            return Formlet2.LoadingFormlet(a);
           },f2(x2))),function(_arg197)
           {
            var msg;
            return _builder_.ReturnFrom(_arg197.$==1?(msg=_arg197.$0,FormletHelpers.ErrorF(msg)):(reset(null),(hideForm(null),FormletHelpers.SuccessF("Thanks, your application has been registered."))));
           });
          }));
         }));
         return Default.Div(List.ofArray([form]));
        };
        x3=(inputRecord=ContactButtonConfiguration.get_Default(),(ReplyPanelId=_this.conf.ReplyPanelId,Runtime.New(ContactButtonConfiguration,{
         ReplyFormElement:applyForm,
         ButtonClass:inputRecord.ButtonClass,
         ReplyPanelId:ReplyPanelId,
         ButtonLabel:"Apply",
         ButtonHideLabel:"Hide application form"
        })));
        f3=function(conf)
        {
         return Client9.ContactButton(conf);
        };
        return f3(x3);
       }
      })
     }
    },
    Location:{
     Client:{
      DeveloperMap:function(items)
      {
       var center,mapElement,search,locationToString,map,mapElement1,f,f1,locations,x,x1,f2,predicate,f3,projection,f4,action;
       center=new google.maps.LatLng(47.219568,-27.421875);
       mapElement=Default.Div(List.ofArray([Default.Attr().Class("map-groups")]));
       search=function(location1,cb)
       {
        var geoCoder,req;
        geoCoder=new google.maps.Geocoder();
        req={};
        req.address=location1;
        return geoCoder.geocode(req,Runtime.Tupled(function(tupledArg)
        {
         var res,status,matchValue,r;
         res=tupledArg[0];
         status=tupledArg[1];
         if(!Unchecked.Equals(res,null))
          {
           matchValue=List.ofArray(res);
           if(matchValue.$==0)
            {
             return null;
            }
           else
            {
             r=matchValue.$0;
             return cb(r.geometry.location);
            }
          }
         else
          {
           return null;
          }
        }));
       };
       locationToString=function(location1)
       {
        var st2,matchValue,s,state,matchValue1,s1;
        st2=(matchValue=location1.Street2,matchValue.$==1?(s=matchValue.$0," "+s):"");
        state=(matchValue1=location1.State,matchValue1.$==1?(s1=matchValue1.$0,", "+s1):"");
        return location1.Street1+st2+", "+location1.City+state+", "+location1.Country+" "+location1.Zip;
       };
       map={
        contents:null
       };
       mapElement1=(f=(f1=function(mapElement2)
       {
        var options;
        options={
         zoom:8,
         center:center,
         mapTypeId:google.maps.MapTypeId.ROADMAP
        };
        map.contents=new google.maps.Map(mapElement2.Body,options);
        return map.contents.setZoom(2);
       },function(w)
       {
        return Operators.OnAfterRender(f1,w);
       }),(f(mapElement),mapElement));
       locations=(x=(x1=(f2=(predicate=Runtime.Tupled(function(tupledArg)
       {
        var _arg1,loc;
        _arg1=tupledArg[0];
        loc=tupledArg[1];
        return loc.Country!=="Online";
       }),function(list)
       {
        return List.filter(predicate,list);
       }),f2(items)),(f3=(projection=Runtime.Tupled(function(tuple)
       {
        return tuple[0];
       }),function(source)
       {
        return Seq.distinctBy(projection,source);
       }),f3(x1))),(f4=(action=Runtime.Tupled(function(tupledArg)
       {
        var link,location1;
        link=tupledArg[0];
        location1=tupledArg[1];
        return search(locationToString(location1),function(loc)
        {
         var markerOptions,marker,x2,f5;
         markerOptions={
          position:loc
         };
         markerOptions.map=map.contents;
         marker=new google.maps.Marker(markerOptions);
         x2=google.maps.event.addListener(marker,"click",function()
         {
          location.href=link;
         });
         f5=function(value)
         {
          value;
         };
         return f5(x2);
        });
       }),function(source)
       {
        return Seq.iter(action,source);
       }),f4(x)));
       return mapElement1;
      },
      LocationFormForUsername:function(username,def_dao)
      {
       var editLocationForm,existingLocationForm,newLocationForm,x8,x9,_builder_1,f9,lc1,inputRecord1,Placement1,fa;
       editLocationForm=function(def)
       {
        var x,x1,x2,x3,f,f1,f2,f3,x4,x5,x6,f4,f5,f6,f7,x7,f8,lc,inputRecord,Placement;
        return Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x=function(descr)
        {
         return function(s1)
         {
          return function(s2)
          {
           return function(city)
           {
            return function(state)
            {
             return function(zip)
             {
              return function(country)
              {
               return function(memo)
               {
                return Runtime.New(LocationDetails,{
                 Description:descr,
                 Street1:s1,
                 Street2:s2,
                 City:city,
                 State:state,
                 Country:country,
                 Zip:zip,
                 Memo:memo
                });
               };
              };
             };
            };
           };
          };
         };
        },Formlet1.Return(x)),FwLS.InputWithValue(def.Description,"Description","You must enter a description","location-description")),FwLS.InputWithValue(def.Street1,"Street 1","You must enter a street","street-1")),(x1=(x2=(x3=Controls.Input(def.Street2.$==0?"":def.Street2.$0),(f=(f1=function(s)
        {
         if(s.toLowerCase()!=="")
          {
           return{
            $:1,
            $0:s
           };
          }
         else
          {
           return{
            $:0
           };
          }
        },function(formlet)
        {
         return Formlet1.Map(f1,formlet);
        }),f(x3))),(f2=function(formlet)
        {
         return Enhance.WithTextLabel("Street 2",formlet);
        },f2(x2))),(f3=function(formlet)
        {
         return Enhance.WithCssClass("street-2",formlet);
        },f3(x1)))),FwLS.InputWithValue(def.City,"City","You must enter a city","city")),(x4=(x5=(x6=Controls.Input(def.State.$==0?"":def.State.$0),(f4=(f5=function(s)
        {
         if(s.toLowerCase()!=="")
          {
           return{
            $:1,
            $0:s
           };
          }
         else
          {
           return{
            $:0
           };
          }
        },function(formlet)
        {
         return Formlet1.Map(f5,formlet);
        }),f4(x6))),(f6=function(formlet)
        {
         return Enhance.WithTextLabel("State",formlet);
        },f6(x5))),(f7=function(formlet)
        {
         return Enhance.WithCssClass("state",formlet);
        },f7(x4)))),FwLS.InputWithValue(def.Zip,"Zip code","You must enter a zip code","zip")),FwLS.InputWithValue(def.Country,"Country","You must enter a country","country")),(x7=FwLS.RichEditorWithValueOptional(def.Memo,"Directions","memo"),(f8=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
         $:2
        },Runtime.New(LabelConfiguration,{
         Align:inputRecord.Align,
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:Placement
        }))),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f8(x7))));
       };
       existingLocationForm=function()
       {
        var patternInput,l,locIdOption,def,locations,x,x1,f,mapping,f1,_builder_;
        patternInput=def_dao.$==1?(l=def_dao.$0,[{
         $:1,
         $0:l
        },{
         $:1,
         $0:l.Id
        }]):[{
         $:0
        },{
         $:0
        }];
        locIdOption=patternInput[1];
        def=patternInput[0];
        locations=(x=(x1=Remoting.Call("IntelliFactory.Trainings:75",[username,locIdOption]),(f=(mapping=function(loc)
        {
         return[loc.Details.Description,{
          $:1,
          $0:loc
         }];
        },function(list)
        {
         return List.map(mapping,list);
        }),f(x1))),(f1=function(locs)
        {
         return Runtime.New(T,{
          $:1,
          $0:["<Select>",{
           $:0
          }],
          $1:locs
         });
        },f1(x)));
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x2,x3,x4,x5,def1,f2,predicate,f3,arg00,f4,f5,f6,f7;
         return _builder_.Bind((x2=(x3=(x4=(x5=Controls.Select(def.$==1?(def1=def.$0,(f2=(predicate=Runtime.Tupled(function(tupledArg)
         {
          var _arg1,i;
          _arg1=tupledArg[0];
          i=tupledArg[1];
          if(i.$==1)
           {
            return i.$0.Id===def1.Id;
           }
          else
           {
            return false;
           }
         }),function(list)
         {
          return Seq.findIndex(predicate,list);
         }),f2(locations))):0,locations),(f3=(arg00=function(option)
         {
          return option.$==1;
         },function(arg20)
         {
          return Data.Validator().Is(arg00,"You must select an existing location",arg20);
         }),f3(x5))),(f4=function(formlet)
         {
          return Enhance.WithValidationIcon(formlet);
         },f4(x4))),(f5=function(formlet)
         {
          return Enhance.WithTextLabel("Address",formlet);
         },f5(x3))),(f6=(f7=function(option)
         {
          return option.$0;
         },function(formlet)
         {
          return Formlet1.Map(f7,formlet);
         }),f6(x2))),function(_arg34)
         {
          return _builder_.Bind(editLocationForm(_arg34.Details),function(_arg33)
          {
           var Id;
           return _builder_.Return({
            $:1,
            $0:(Id=_arg34.Id,{
             Details:_arg33,
             Id:Id
            })
           });
          });
         });
        });
       };
       newLocationForm=function()
       {
        var x,f,f1;
        x=editLocationForm(LocationDetails.get_Default());
        f=(f1=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },function(formlet)
        {
         return Formlet1.Map(f1,formlet);
        });
        return f(x);
       };
       x8=(x9=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        var def,x,f;
        return _builder_1.Bind((def=def_dao.$==1?1:def_dao.$==2?2:0,(x=Controls.Select(def,List.ofArray([["New address",[true,true]],["Existing address",[true,false]],["Online",[false,false]]])),(f=function(formlet)
        {
         return Enhance.WithTextLabel("Choose location",formlet);
        },f(x)))),Runtime.Tupled(function(_arg36)
        {
         var re,isPhysical;
         re=_arg36[1];
         isPhysical=_arg36[0];
         return _builder_1.Bind(isPhysical?re?newLocationForm(null):existingLocationForm(null):Formlet1.Return({
          $:2
         }),function(_arg35)
         {
          return _builder_1.Return(_arg35);
         });
        }));
       })),(f9=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
        $:0
       },Runtime.New(LabelConfiguration,{
        Align:inputRecord1.Align,
        VerticalAlign:inputRecord1.VerticalAlign,
        Placement:Placement1
       }))),function(formlet)
       {
        return Enhance.WithLabelConfiguration(lc1,formlet);
       }),f9(x9)));
       fa=function(formlet)
       {
        return Enhance.WithCssClass("location-form",formlet);
       };
       return fa(x8);
      },
      ShowLocation:Runtime.Class({
       get_Body:function()
       {
        var center,mapElement,f,f1,_this=this;
        center=new google.maps.LatLng(0,0);
        mapElement=Default.Div(List.ofArray([Default.Attr().Class("location-map")]));
        f=(f1=function(mapElement1)
        {
         var options,map,markerOption,marker,setLatLong,search;
         options={
          zoom:8,
          center:center,
          mapTypeId:google.maps.MapTypeId.ROADMAP
         };
         map=new google.maps.Map(mapElement1.Body,options);
         map.setZoom(15);
         markerOption={
          position:center
         };
         markerOption.map=map;
         marker=new google.maps.Marker(markerOption);
         setLatLong=function(latLong)
         {
          marker.setPosition(latLong);
          return map.setCenter(latLong);
         };
         search=function(location1)
         {
          var geoCoder,req;
          geoCoder=new google.maps.Geocoder();
          req={};
          req.address=location1;
          return geoCoder.geocode(req,Runtime.Tupled(function(tupledArg)
          {
           var res,status,matchValue,r;
           res=tupledArg[0];
           status=tupledArg[1];
           matchValue=List.ofArray(res);
           if(matchValue.$==0)
            {
             return alert("search failed");
            }
           else
            {
             r=matchValue.$0;
             return setLatLong(r.geometry.location);
            }
          }));
         };
         return search(_this.LocationString);
        },function(w)
        {
         return Operators.OnAfterRender(f1,w);
        });
        f(mapElement);
        return mapElement;
       }
      }),
      ShowMap:Runtime.Class({
       get_Body:function()
       {
        return Client6.DeveloperMap(this.items);
       }
      })
     }
    },
    Login:{
     Client:{
      AddUserOAuthProviderControl:Runtime.Class({
       get_Body:function()
       {
        var _builder_,_this=this;
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x,x1,x2,f,f1,x3,f2,f3,f4,f5;
         return _builder_.Bind((x=(x1=Formlet1.Choose(List.ofArray([(x2=UserControls.LargeButton("Yes"),(f=(f1=function()
         {
          return true;
         },function(formlet)
         {
          return Formlet1.Map(f1,formlet);
         }),f(x2))),(x3=UserControls.LargeButton("No thanks"),(f2=(f3=function()
         {
          return false;
         },function(formlet)
         {
          return Formlet1.Map(f3,formlet);
         }),f2(x3)))])),(f4=function(formlet)
         {
          return Formlet1.Horizontal(formlet);
         },f4(x1))),(f5=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },f5(x))),function(_arg181)
         {
          var _builder_1;
          return _builder_.ReturnFrom(_arg181?(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
          {
           var x4,f6;
           return _builder_1.Bind((x4=Remoting.Async("IntelliFactory.Trainings:105",[_this.args.UserOAuthData]),(f6=function(a)
           {
            return Formlet2.LoadingFormlet(a);
           },f6(x4))),function(_arg182)
           {
            return _builder_1.ReturnFrom(_arg182?(location.href=_this.args.AddRedirectURL,FormletHelpers.SuccessF("You account has been added, redirecting.")):FormletHelpers.ErrorF("Sorry, an error occurred."));
           });
          })):(location.href=_this.args.CancelRedirectURL,Formlet1.Return(null)));
         });
        });
       }
      })
     }
    },
    OnSiteTrainingBooking:Runtime.Class({
     get_Body:function()
     {
      return Clientc.RenderOnSiteTBForm(this.CourseId,this.User,this.SuccessUrl);
     }
    }),
    OnlineTrainingBooking:Runtime.Class({
     get_Body:function()
     {
      return Clientc.RenderOnlineTBForm(this.EventId,this.User,this.SuccessUrl);
     }
    }),
    PastOnlineTrainingBooking:Runtime.Class({
     get_Body:function()
     {
      return Clientc.RenderPastOnlineTBForm(this.EventId,this.User,this.SuccessUrl);
     }
    }),
    PayPal:{
     Controls:{
      ElementButton:function(label)
      {
       var _this,_this1;
       return Default.Input(List.ofArray([(_this=Default.Attr(),_this.NewAttr("type","submit")),(_this1=Default.Attr(),_this1.NewAttr("value",label)),Default.Attr().Class("submitButton"+" buttonPro light_blue small")]));
      },
      LargeSubmitButton:function(label)
      {
       var _this,_this1;
       return Default.Input(List.ofArray([(_this=Default.Attr(),_this.NewAttr("type","submit")),(_this1=Default.Attr(),_this1.NewAttr("value",label)),Default.Attr().Class("buttonPro blue space-top space-bottom")]));
      },
      PayPalButton:function(notifyUrl,label,cancelLink,paypalUrl,businessName,ticket,order,client)
      {
       var price,hiddens,x,f,mapping,loadPanel,loadImg,_this2,_this3,b,x1,f1,x2,x3,_this4,f2,x4;
       price=client.get_MustPayVAT()?order.Price*1.25:order.Price;
       hiddens=(x=List.ofArray([["cmd","_cart"],["upload","1"],["business",businessName],["item_name_1",order.Title],["item_number_1",order.Code],["quantity_1","1"],["amount_1",Global.String(price)],["no_shipping","0"],["no_note","1"],["currency_code",order.Currency],["lc","HU"],["bn","PP-BuyNowBF"],["custom",client.Email],["return",ticket.ReturnUrl],["rm",ticket.ReturnMode],["invoice",ticket.VerificationCode],["notify_url",notifyUrl]]),(f=(mapping=Runtime.Tupled(function(tupledArg)
       {
        var name,value,_this,_this1;
        name=tupledArg[0];
        value=tupledArg[1];
        return Default.Input(List.ofArray([(_this=Default.Attr(),_this.NewAttr("type","hidden")),Default.Name(name),(_this1=Default.Attr(),_this1.NewAttr("value",value))]));
       }),function(list)
       {
        return List.map(mapping,list);
       }),f(x)));
       loadPanel=Default.Div(Runtime.New(T,{
        $:0
       }));
       loadImg=Client3.LoadingImage();
       return Operators.add(Default.Form(List.ofArray([(_this2=Default.Attr(),_this2.NewAttr("action",paypalUrl)),(_this3=Default.Attr(),_this3.NewAttr("method","post"))])),(b=List.ofArray([(x1=Client1.Button("Cancel",cancelLink,Server.Large()),(f1=(x2=function()
       {
        return function()
        {
         return loadPanel.AppendI(loadImg);
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(x2,arg10);
       }),(f1(x1),x1))),(x3=Operators.add(Controls4.ElementButton(label),List.ofArray([(_this4=Default.Attr(),_this4.NewAttr("style","margin-left: 20px;"))])),(f2=(x4=function()
       {
        return function()
        {
         return loadPanel.AppendI(loadImg);
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(x4,arg10);
       }),(f2(x3),x3))),loadPanel]),List.append(hiddens,b)));
      },
      PayPalButtonCredit:function(bInfo)
      {
       var hiddens,x,f,mapping,loadPanel,loadImg,buttonClass,elems,_this2,x5,_this3;
       hiddens=(x=List.ofArray([["cmd","_cart"],["upload","1"],["business",bInfo.BusinessName],["item_name_1",bInfo.TicketInfo.Title],["item_number_1",bInfo.TicketInfo.Code],["quantity_1","1"],["amount_1",Global.String(bInfo.TicketInfo.Price)],["no_shipping","0"],["no_note","1"],["currency_code",bInfo.TicketInfo.Currency],["lc","HU"],["bn","PP-BuyNowBF"],["custom",bInfo.ClientEmail],["return",bInfo.ReturnUrl],["rm",bInfo.ReturnMode],["invoice",bInfo.TicketInfo.VerificationCode],["notify_url",bInfo.NotifyUrl]]),(f=(mapping=Runtime.Tupled(function(tupledArg)
       {
        var name,value,_this,_this1;
        name=tupledArg[0];
        value=tupledArg[1];
        return Default.Input(List.ofArray([(_this=Default.Attr(),_this.NewAttr("type","hidden")),Default.Name(name),(_this1=Default.Attr(),_this1.NewAttr("value",value))]));
       }),function(list)
       {
        return List.map(mapping,list);
       }),f(x)));
       loadPanel=Default.Div(Runtime.New(T,{
        $:0
       }));
       loadImg=Client3.LoadingImage();
       buttonClass=Server.Large();
       elems=Seq.toList(Seq.delay(function()
       {
        return Seq.append(hiddens,Seq.delay(function()
        {
         var x1,f1,x2;
         return Seq.append([(x1=Controls4.LargeSubmitButton(bInfo.Label),(f1=(x2=function()
         {
          return function()
          {
           return loadPanel.AppendI(loadImg);
          };
         },function(arg10)
         {
          return EventsPervasives.Events().OnClick(x2,arg10);
         }),(f1(x1),x1)))],Seq.delay(function()
         {
          var x3,f2,x4;
          return Seq.append([(x3=Client1.Button("Cancel",bInfo.CancelLink,buttonClass),(f2=(x4=function()
          {
           return function()
           {
            return loadPanel.AppendI(loadImg);
           };
          },function(arg10)
          {
           return EventsPervasives.Events().OnClick(x4,arg10);
          }),(f2(x3),x3)))],Seq.delay(function()
          {
           return[loadPanel];
          }));
         }));
        }));
       }));
       return Operators.add(Default.Form(List.ofArray([(_this2=Default.Attr(),(x5=bInfo.PaypalUrl,_this2.NewAttr("action",x5))),(_this3=Default.Attr(),_this3.NewAttr("method","post"))])),elems);
      }
     },
     FailureToGenerateUserAccount:Runtime.Class({}),
     PayPalButton:Runtime.Class({
      get_Body:function()
      {
       return Controls4.PayPalButton(this.NotifyUrl,this.Label,this.CancelLink,this.PaypalUrl,this.BusinessName,this.Ticket.$0,this.Order.$0,this.User.$0);
      }
     })
    },
    Registration:{
     RegistrationControl:Runtime.Class({
      get_Body:function()
      {
       var buttonClass,conf,Padding1,Top,Bottom,x,f,f1,confAuthorStep1,Padding2,Top1,Bottom1,x1,f2,f3,x2,f4,f5,container,AuthorRegistrationForm,step1a,x3,x4,x5,x6,x7,x8,f6,f7,f8,x9,xa,xb,f9,fa,fb,xc,xd,xe,fc,fd,fe,ff,f10,step1,xf,x10,_builder_,f11,f12,x11,_builder_1,_this=this,f13,RegistrationForm,toUserData,toRegData,passwordForm,_builder_2,form,x18,x19,x1a,f1a,f1b,f1c,x1b,x1c,x1d,f1d,f1e,f1f,x1e,x1f,x20,f20,f21,f22,x21,f23,x22,x23,x24,f24,f25,f26,x25,x26,x27,f27,f28,f29,x28,x29,x2a,f2a,f2b,f2c,x2b,f2d,x2c,f2e,x2d,f2f,x2e,x2f,x30,f30,f31,f32,x31,x32,x33,f33,f34,f35,_builder_3;
       buttonClass=Server.Large();
       conf=(Padding1=(Top={
        $:0
       },(Bottom={
        $:0
       },Runtime.New(Padding,{
        Left:{
         $:0
        },
        Right:{
         $:0
        },
        Top:Top,
        Bottom:Bottom
       }))),Runtime.New(FormContainerConfiguration,{
        Header:{
         $:0
        },
        Padding:Padding1,
        Description:(x=(f=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },f("Fill out the form to create your user profile.")),(f1=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },f1(x))),
        BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
        BorderColor:Client3.StandardConfiguration().BorderColor,
        CssClass:Client3.StandardConfiguration().CssClass,
        Style:Client3.StandardConfiguration().Style
       }));
       confAuthorStep1=(Padding2=(Top1={
        $:0
       },(Bottom1={
        $:0
       },Runtime.New(Padding,{
        Left:{
         $:0
        },
        Right:{
         $:0
        },
        Top:Top1,
        Bottom:Bottom1
       }))),Runtime.New(FormContainerConfiguration,{
        Header:(x1=(f2=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },f2("Look up")),(f3=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },f3(x1))),
        Padding:Padding2,
        Description:(x2=(f4=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },f4("Please enter your existing username to create an author profile.")),(f5=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },f5(x2))),
        BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
        BorderColor:Client3.StandardConfiguration().BorderColor,
        CssClass:Client3.StandardConfiguration().CssClass,
        Style:Client3.StandardConfiguration().Style
       }));
       container=Default.Div(Runtime.New(T,{
        $:0
       }));
       AuthorRegistrationForm=(step1a=(x3=(x4=Data.$(Data.$(Data.$(Data.$((x5=function(emailOrUsername)
       {
        return function(pw)
        {
         return function()
         {
          return function(ic)
          {
           return[emailOrUsername,pw,ic];
          };
         };
        };
       },Formlet1.Return(x5)),(x6=(x7=(x8=Controls.Input(""),(f6=Data.Validator().IsEmail("You must enter your registered email address"),f6(x8))),(f7=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f7(x7))),(f8=function(formlet)
       {
        return Enhance.WithTextLabel("Email",formlet);
       },f8(x6)))),(x9=(xa=(xb=Controls.Password(""),(f9=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter your password",arg10);
       },f9(xb))),(fa=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },fa(xa))),(fb=function(formlet)
       {
        return Enhance.WithTextLabel("Password",formlet);
       },fb(x9)))),Formlet1.OfElement(function()
       {
        return Default.Div(List.ofArray([Default.Hr(Runtime.New(T,{
         $:0
        }))]));
       })),(xc=(xd=(xe=Controls.Input(""),(fc=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter your invitation code",arg10);
       },fc(xe))),(fd=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },fd(xd))),(fe=function(formlet)
       {
        return Enhance.WithTextLabel("Invitation code",formlet);
       },fe(xc)))),(ff=function(formlet)
       {
        return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
       },ff(x4))),(f10=function(formlet)
       {
        return Enhance.WithCustomFormContainer(confAuthorStep1,formlet);
       },f10(x3))),(step1=(xf=(x10=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        return _builder_.Bind(step1a,Runtime.Tupled(function(_arg101)
        {
         var pw,ic,email;
         pw=_arg101[1];
         ic=_arg101[2];
         email=_arg101[0];
         return _builder_.Bind(Formlet2.LoadingFormlet(Remoting.Async("IntelliFactory.Trainings:48",[email,pw,ic])),function(_arg100)
         {
          return _builder_.ReturnFrom(_arg100.$==0?Formlet1.Return([email,pw,ic]):FormletHelpers.ErrorF(_arg100.$0));
         });
        }));
       })),(f11=function(formlet)
       {
        return Formlet1.Vertical(formlet);
       },f11(x10))),(f12=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f12(xf))),(x11=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        return _builder_1.Bind(step1,Runtime.Tupled(function(_arg102)
        {
         var pw,email,code,res,matchValue,msg;
         pw=_arg102[1];
         email=_arg102[0];
         code=_arg102[2];
         res=(matchValue=Remoting.Call("IntelliFactory.Trainings:120",[email]),matchValue.$==1?(msg=matchValue.$0,FormletHelpers.ErrorF(msg)):(location.href=_this.args.CreateAuthorUrl,Formlet1.Return(null)));
         return _builder_1.Return(null);
        }));
       })),(f13=function(formlet)
       {
        return Formlet1.Flowlet(formlet);
       },f13(x11)))));
       RegistrationForm=(toUserData=function(un,fn,ln,comp,email,phone,st1,st2,city,state,zip,country)
       {
        return Runtime.New(UserData,{
         Username:un,
         FirstName:fn,
         LastName:ln,
         Company:comp,
         Email:email,
         Phone:phone,
         Street1:st1,
         Street2:st2,
         City:city,
         State:state,
         Zip:zip,
         Country:country,
         IsAuthor:false,
         OnsiteEnabled:false,
         FeaturedEnabled:false,
         AssociatedCompanyId:{
          $:0
         },
         AdministeredCompanies:Runtime.New(T,{
          $:0
         }),
         AdministeredZones:Runtime.New(T,{
          $:0
         }),
         Trainer:{
          $:0
         },
         Developer:{
          $:0
         },
         TwitterUsername:{
          $:0
         },
         PhotoUrl:{
          $:0
         },
         LastLoginDate:0,
         Credit:0,
         BillingAddress:{
          $:0
         },
         EUTaxNumber:{
          $:0
         },
         BillingCompanyName:{
          $:0
         },
         HasUserSearchSubscription:false,
         IsFeatured:false,
         Latitude:{
          $:0
         },
         Longitude:{
          $:0
         },
         IsEmailVerified:false
        });
       },(toRegData=function(un)
       {
        return function(fn)
        {
         return function(ln)
         {
          return function(comp)
          {
           return function(email)
           {
            return function(phone)
            {
             return function(st1)
             {
              return function(st2)
              {
               return function(city)
               {
                return function(state)
                {
                 return function(zip)
                 {
                  return function(country)
                  {
                   return{
                    Data:toUserData(un,fn,ln,comp,email,phone,st1,st2,city,state,zip,country),
                    ConfirmationLink:_this.args.ConfirmationLink,
                    OAuthUserData:_this.args.OAuthUserData
                   };
                  };
                 };
                };
               };
              };
             };
            };
           };
          };
         };
        };
       },(passwordForm=(_builder_2=Formlet1.Do(),_builder_2.Delay(function()
       {
        var x12,x13,x14,f14,f15,f16;
        return _builder_2.Bind((x12=(x13=(x14=Controls.Password(""),(f14=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must set a password",arg10);
        },f14(x14))),(f15=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f15(x13))),(f16=function(formlet)
        {
         return Enhance.WithTextLabel("Password",formlet);
        },f16(x12))),function(_arg104)
        {
         var x15,x16,x17,f17,f18,f19;
         return _builder_2.Bind((x15=(x16=(x17=Controls.Password(""),(f17=function(arg20)
         {
          return Data.Validator().IsEqual(_arg104,"Your confirmed password doesn't match",arg20);
         },f17(x17))),(f18=function(formlet)
         {
          return Enhance.WithValidationIcon(formlet);
         },f18(x16))),(f19=function(formlet)
         {
          return Enhance.WithTextLabel("Confirm password",formlet);
         },f19(x15))),function(_arg103)
         {
          return _builder_2.Return(_arg103);
         });
        });
       })),(form=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Formlet1.Return(toRegData),(x18=(x19=(x1a=Controls.Input(""),(f1a=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your desired username",arg10);
       },f1a(x1a))),(f1b=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1b(x19))),(f1c=function(formlet)
       {
        return Enhance.WithTextLabel("Username",formlet);
       },f1c(x18)))),(x1b=(x1c=(x1d=Controls.Input(""),(f1d=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your first name",arg10);
       },f1d(x1d))),(f1e=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1e(x1c))),(f1f=function(formlet)
       {
        return Enhance.WithTextLabel("First name",formlet);
       },f1f(x1b)))),(x1e=(x1f=(x20=Controls.Input(""),(f20=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your last name",arg10);
       },f20(x20))),(f21=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f21(x1f))),(f22=function(formlet)
       {
        return Enhance.WithTextLabel("Last name",formlet);
       },f22(x1e)))),(x21=Controls.Input(""),(f23=function(formlet)
       {
        return Enhance.WithTextLabel("Company",formlet);
       },f23(x21)))),(x22=(x23=(x24=Controls.Input(""),(f24=Data.Validator().IsEmail("You must specify a correct email"),f24(x24))),(f25=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f25(x23))),(f26=function(formlet)
       {
        return Enhance.WithTextLabel("Email",formlet);
       },f26(x22)))),(x25=(x26=(x27=Controls.Input(""),(f27=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your phone number",arg10);
       },f27(x27))),(f28=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f28(x26))),(f29=function(formlet)
       {
        return Enhance.WithTextLabel("Phone",formlet);
       },f29(x25)))),(x28=(x29=(x2a=Controls.Input(""),(f2a=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your street address",arg10);
       },f2a(x2a))),(f2b=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f2b(x29))),(f2c=function(formlet)
       {
        return Enhance.WithTextLabel("Street address 1",formlet);
       },f2c(x28)))),(x2b=Controls.Input(""),(f2d=function(formlet)
       {
        return Enhance.WithTextLabel("Street address 2",formlet);
       },f2d(x2b)))),(x2c=Controls.Input(""),(f2e=function(formlet)
       {
        return Enhance.WithTextLabel("City",formlet);
       },f2e(x2c)))),(x2d=Controls.Input(""),(f2f=function(formlet)
       {
        return Enhance.WithTextLabel("State",formlet);
       },f2f(x2d)))),(x2e=(x2f=(x30=Controls.Input(""),(f30=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your zip code",arg10);
       },f30(x30))),(f31=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f31(x2f))),(f32=function(formlet)
       {
        return Enhance.WithTextLabel("Zip code",formlet);
       },f32(x2e)))),(x31=(x32=(x33=Controls.Input(""),(f33=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your country",arg10);
       },f33(x33))),(f34=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f34(x32))),(f35=function(formlet)
       {
        return Enhance.WithTextLabel("Country",formlet);
       },f35(x31)))),(_builder_3=Formlet1.Do(),_builder_3.Delay(function()
       {
        var x12,x13,f14,f15,lc,inputRecord,f16;
        return _builder_3.Bind((x12=(x13=(f14=function(formlet)
        {
         return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
        },f14(form)),(f15=(lc=(inputRecord=LabelConfiguration.get_Default(),Runtime.New(LabelConfiguration,{
         Align:{
          $:1
         },
         VerticalAlign:inputRecord.VerticalAlign,
         Placement:inputRecord.Placement
        })),function(formlet)
        {
         return Enhance.WithLabelConfiguration(lc,formlet);
        }),f15(x13))),(f16=function(formlet)
        {
         return Enhance.WithCustomFormContainer(conf,formlet);
        },f16(x12))),function(_arg106)
        {
         var x14,f17;
         return _builder_3.Bind((x14=Remoting.Async("IntelliFactory.Trainings:123",[_arg106]),(f17=function(a)
         {
          return Formlet2.LoadingFormlet(a);
         },f17(x14))),function(_arg105)
         {
          return _builder_3.ReturnFrom(Formlet1.OfElement(function()
          {
           var e,_this1,_this2;
           if(_arg105.$==1)
            {
             e=_arg105.$0;
             return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(e)]));
            }
           else
            {
             return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("success")])),List.ofArray([Default.Span(List.ofArray([Default.Text("\r\n                                We have created your account and sent you a confirmation link to\r\n                                complete your registration.  Please check your email and proceed\r\n                                accordingly.")])),Default.Br(Runtime.New(T,{
              $:0
             })),Operators.add(Default.Div(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("style","padding-top:10px"))])),List.ofArray([Default.Span(List.ofArray([Default.Text("Back to the ")])),Operators.add(Default.A(List.ofArray([Default.HRef(_this.args.MainPage),(_this2=Default.Attr(),_this2.NewAttr("id","registration-main-page-link"))])),List.ofArray([Default.Text("main page")]))]))]));
            }
          }));
         });
        });
       }))))));
       container.AppendI(RegistrationForm);
       return Tabs.New2(List.ofArray([["User",Operators.add(Default.Div(List.ofArray([Default.Attr().Class("registration-form")])),List.ofArray([Operators.add(container,List.ofArray([Default.Attr().Class("yui-skin-sam")]))]))],["Author",Operators.add(Default.Div(List.ofArray([Default.Attr().Class("registration-form")])),List.ofArray([AuthorRegistrationForm]))]]));
      }
     })
    },
    ScheduledTrainingBooking:Runtime.Class({
     get_Body:function()
     {
      return Clientc.RenderScheduledTBForm(this.EventId,this.User,this.SuccessUrl);
     }
    }),
    Search:{
     Widget:{
      FullTextSearch:Runtime.Class({
       get_Body:function()
       {
        var defaultSearchTerm,matchValue,s,_builder_,__=this;
        defaultSearchTerm=(matchValue=this.defaultSearchTerm,matchValue.$==1?(s=matchValue.$0,s):"");
        return Default.Div(List.ofArray([(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         var x,x1,x2,x3,f,f1,buttonConf,inputRecord,Class,arg0,f2,f3;
         return _builder_.Bind((x=(x1=(x2=(x3=Controls.Input(defaultSearchTerm),(f=function(formlet)
         {
          return Enhance.WithCssClass("side-search-input",formlet);
         },f(x3))),(f1=(buttonConf=(inputRecord=FormButtonConfiguration.get_Default(),(Class=(arg0=Server.Small(),{
          $:1,
          $0:arg0
         }),Runtime.New(FormButtonConfiguration,{
          Label:{
           $:1,
           $0:"Search"
          },
          Style:inputRecord.Style,
          Class:Class
         }))),function(formlet)
         {
          return Enhance.WithCustomSubmitButton(buttonConf,formlet);
         }),f1(x2))),(f2=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },f2(x1))),(f3=function(formlet)
         {
          return Enhance1.SubmitOnEnter(formlet);
         },f3(x))),function(_arg174)
         {
          var _this,repl;
          if(Strings.Trim(_arg174)!=="")
           {
            location.href=(_this=__.baseUrl,(repl=(Widget1.escapeUrl())(_arg174),Strings.Replace(_this,"replace-search-here-ifpish",repl)));
            return _builder_.Return(null);
           }
          else
           {
            location.href=__.defaultUrl;
            return _builder_.Return(null);
           }
         });
        }))]));
       }
      }),
      TopMenuSearchForm:Runtime.Class({
       SubmitSearch:function(url,searchTerm)
       {
        var url1,repl;
        if(Strings.Trim(searchTerm)!=="")
         {
          url1=(repl=(Widget1.escapeUrl())(searchTerm),Strings.Replace(url,"replace-search-here-ifpish",repl));
          location.href=url1;
         }
        else
         {
          return null;
         }
       },
       get_Body:function()
       {
        var clas,input,_this,x,dropButton,_this1,dropMenu,_this2,x1,f,x2,_this3=this,x3,f1,x4,x5,f2,x6,defaultOk,f3,x7,f4,x8,f5,x9;
        clas=Server.Small();
        input=Default.Input(List.ofArray([(_this=Default.Attr(),(x=this.DefaultSearchTerm,_this.NewAttr("value",x)))]));
        dropButton=Operators.add(Default.Button(List.ofArray([Default.Attr().Class(clas)])),List.ofArray([Default.Img(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("src","/images/search-drop.png"))]))]));
        dropMenu=Operators.add(Default.Div(List.ofArray([(_this2=Default.Attr(),_this2.NewAttr("style","display:none;"))])),List.ofArray([Default.UL(List.ofArray([Default.LI(List.ofArray([(x1=Default.A(List.ofArray([Default.Text("All")])),(f=(x2=function()
        {
         return function()
         {
          return _this3.SubmitSearch(_this3.AllUrl,input.get_Value());
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x2,arg10);
        }),(f(x1),x1)))])),Default.LI(List.ofArray([(x3=Default.A(List.ofArray([Default.Text("Topics")])),(f1=(x4=function()
        {
         return function()
         {
          return _this3.SubmitSearch(_this3.TopicsUrl,input.get_Value());
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x4,arg10);
        }),(f1(x3),x3)))])),Default.LI(List.ofArray([(x5=Default.A(List.ofArray([Default.Text("Developers")])),(f2=(x6=function()
        {
         return function()
         {
          return _this3.SubmitSearch(_this3.DevelopersUrl,input.get_Value());
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x6,arg10);
        }),(f2(x5),x5)))]))]))]));
        defaultOk=Operators.add(Default.Button(List.ofArray([Default.Attr().Class(clas+" ok")])),List.ofArray([Default.Text("Search")]));
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("topmenu-search")])),List.ofArray([input,(f3=(x7=function()
        {
         return function()
         {
          return _this3.SubmitSearch(_this3.AllUrl,input.get_Value());
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x7,arg10);
        }),(f3(defaultOk),defaultOk)),Operators.add(Default.Span(List.ofArray([Default.Attr().Class("drop")])),List.ofArray([(f4=(x8=function()
        {
         return function()
         {
          return jQuery(dropMenu.Body).toggle();
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x8,arg10);
        }),(f4(dropButton),dropButton)),(f5=(x9=function()
        {
         return function()
         {
          return jQuery(dropMenu.Body).hide();
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnMouseLeave(x9,arg10);
        }),(f5(dropMenu),dropMenu))]))]));
       }
      }),
      escapeUrl:Runtime.Field(function()
      {
       var mapping,f,f1,g,g1;
       mapping=(f=(f1=function(value)
       {
        return String.fromCharCode(value);
       },(g=function(s)
       {
        return encodeURI(s);
       },function(x)
       {
        return g(f1(x));
       })),(g1=function(_arg1)
       {
        if(_arg1==="+")
         {
          return"~2b";
         }
        else
         {
          if(_arg1==="-")
           {
            return"~2d";
           }
          else
           {
            if(_arg1==="*")
             {
              return"~2a";
             }
            else
             {
              if(_arg1==="/")
               {
                return"~2f";
               }
              else
               {
                if(_arg1===".")
                 {
                  return"~2e";
                 }
                else
                 {
                  if(_arg1==="_")
                   {
                    return"~5f";
                   }
                  else
                   {
                    if(_arg1==="@")
                     {
                      return"~40";
                     }
                    else
                     {
                      if(_arg1==="#")
                       {
                        return"~23";
                       }
                      else
                       {
                        if(_arg1==="?")
                         {
                          return"~3f";
                         }
                        else
                         {
                          if(_arg1==="~")
                           {
                            return"~7e";
                           }
                          else
                           {
                            if(_arg1==="&")
                             {
                              return"~26";
                             }
                            else
                             {
                              if((new RegExp("%[0-9a-z][0-9a-z]","i")).test(_arg1))
                               {
                                return Strings.Replace(_arg1,"%","~");
                               }
                              else
                               {
                                return _arg1;
                               }
                             }
                           }
                         }
                       }
                     }
                   }
                 }
               }
             }
           }
         }
       },function(x)
       {
        return g1(f(x));
       }));
       return function(str)
       {
        return Strings.collect(mapping,str);
       };
      })
     }
    },
    SearchDeveloper:{
     Client:{
      DevLocationMap:function(args)
      {
       var items,data,data1,x,f,x1,f1,x2,f2,x3,f3,x4,f4,f5,action,x5,f6,f7;
       items=Arrays.ofSeq(args.DeveloperLocations);
       data=(data1=new DataTable(),(x=data1.addRows(items.length),(f=function(value)
       {
        value;
       },f(x)),(x1=data1.addColumn("number","LATITUDE","Latitude"),(f1=function(value)
       {
        value;
       },f1(x1)),(x2=data1.addColumn("number","LONGITUDE","Longitude"),(f2=function(value)
       {
        value;
       },f2(x2)),(x3=data1.addColumn("number","Number of Developers","Value"),(f3=function(value)
       {
        value;
       },f3(x3)),(x4=data1.addColumn("string","HOVER","HoverText"),(f4=function(value)
       {
        value;
       },f4(x4)),(f5=(action=function(rowIx)
       {
        return function(item)
        {
         data1.setValue(rowIx,0,item.Latitude);
         data1.setValue(rowIx,1,item.Longitude);
         data1.setValue(rowIx,2,item.Frequency);
         return data1.setValue(rowIx,3,item.Location);
        };
       },function(array)
       {
        return Arrays.iteri(action,array);
       }),f5(items),data1)))))));
       x5=Default.Div(Runtime.New(T,{
        $:0
       }));
       f6=(f7=function(container)
       {
        var visualization1,options,inputRecord,width,x6,x7,f8,f9,height,x8,x9,fa,fb,colors,ev,xa,fe;
        visualization1=new GeoMap(container.Body);
        options=(inputRecord=GeoMapOptions.get_Default(),(width=(x6=(x7=Clientd.MapChartDimension(),(f8=Runtime.Tupled(function(tuple)
        {
         return tuple[0];
        }),f8(x7))),(f9=function(value)
        {
         return Global.String(value);
        },f9(x6)))+"px",(height=(x8=(x9=Clientd.MapChartDimension(),(fa=Runtime.Tupled(function(tuple)
        {
         return tuple[1];
        }),fa(x9))),(fb=function(value)
        {
         return Global.String(value);
        },fb(x8)))+"px",(colors=[16746311,16758145,12607488],Runtime.New(GeoMapOptions,{
         region:inputRecord.region,
         dataMode:"markers",
         width:width,
         height:height,
         colors:colors,
         showLegend:inputRecord.showLegend,
         showZoomOut:inputRecord.showZoomOut,
         zoomOutLabel:inputRecord.zoomOutLabel
        })))));
        ev=GeoMap1.RegionClick(visualization1);
        xa=Util.subscribeTo(ev,function(obj)
        {
         var index,loc,xb,xc,inputRecord1,Location1,fc,conf,EncodingType,fd,matchValue;
         try
         {
          index=parseFloat(obj.region);
          loc=items[index];
          xb=(xc=Formlet1.Return((inputRecord1=args.DeveloperSearch,(Location1={
           $:1,
           $0:loc.Location
          },Runtime.New(DeveloperSearch,{
           SearchTerm:inputRecord1.SearchTerm,
           Location:Location1,
           BatchIx:inputRecord1.BatchIx,
           Tags:inputRecord1.Tags,
           IsSortByName:inputRecord1.IsSortByName
          })))),(fc=(conf=(EncodingType={
           $:0
          },{
           PostUrl:{
            $:1,
            $0:args.SearchUrl
           },
           ParameterName:"search",
           EncodingType:EncodingType
          }),function(formlet)
          {
           return Enhance.WithJsonPost(conf,formlet);
          }),fc(xc)));
          fd=function(arg00)
          {
           return container.AppendI(arg00);
          };
          return fd(xb);
         }
         catch(matchValue)
         {
          return null;
         }
        });
        fe=function(value)
        {
         value;
        };
        fe(xa);
        return visualization1.draw(data,options);
       },function(w)
       {
        return Operators.OnAfterRender(f7,w);
       });
       f6(x5);
       return x5;
      },
      DeveloperSearchControl:Runtime.Class({
       get_Body:function()
       {
        return Clientd.DeveloperSearchForm(this.args);
       }
      }),
      DeveloperSearchForm:function(args)
      {
       var search,searchUrl,termF,_builder_,locF,_builder_1,x2,x3,x4,x5,x6,f2,f3,f4,f5,f6,f7,conf,EncodingType;
       search=args.DeveloperSearch;
       searchUrl=args.SearchUrl;
       termF=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x,x1,matchValue,t,f,f1;
        return _builder_.Bind((x=(x1=(matchValue=search.SearchTerm,matchValue.$==0?"":(t=matchValue.$0,t)),(f=function(value)
        {
         return Controls.Input(value);
        },f(x1))),(f1=function(formlet)
        {
         return Enhance.WithTextLabel("Search terms",formlet);
        },f1(x))),function(_arg171)
        {
         return _builder_.Bind(Controls1.SmallButton("Search"),function()
         {
          var inputRecord;
          return _builder_.Return((inputRecord=DeveloperSearch.get_Default(),Runtime.New(DeveloperSearch,{
           SearchTerm:_arg171===""?{
            $:0
           }:{
            $:1,
            $0:_arg171
           },
           Location:inputRecord.Location,
           BatchIx:inputRecord.BatchIx,
           Tags:inputRecord.Tags,
           IsSortByName:inputRecord.IsSortByName
          })));
         });
        });
       }));
       locF=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        var x,x1,matchValue,l,f,f1;
        return _builder_1.Bind((x=(x1=(matchValue=search.Location,matchValue.$==0?"":(l=matchValue.$0,l)),(f=function(value)
        {
         return Controls.Input(value);
        },f(x1))),(f1=function(formlet)
        {
         return Enhance.WithTextLabel("Location",formlet);
        },f1(x))),function(_arg173)
        {
         return _builder_1.Bind(Controls1.SmallButton("Search"),function()
         {
          var inputRecord,Location1;
          return _builder_1.Return((inputRecord=DeveloperSearch.get_Default(),(Location1=_arg173===""?{
           $:0
          }:{
           $:1,
           $0:_arg173
          },Runtime.New(DeveloperSearch,{
           SearchTerm:inputRecord.SearchTerm,
           Location:Location1,
           BatchIx:inputRecord.BatchIx,
           Tags:inputRecord.Tags,
           IsSortByName:inputRecord.IsSortByName
          }))));
         });
        });
       }));
       x2=(x3=(x4=(x5=(x6=List.ofArray([termF,locF]),(f2=function(fs)
       {
        return Formlet1.Choose(fs);
       },f2(x6))),(f3=function(formlet)
       {
        return Formlet1.Horizontal(formlet);
       },f3(x5))),(f4=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f4(x4))),(f5=(f6=function(el)
       {
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("dev-search")])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f6,formlet);
       }),f5(x3)));
       f7=(conf=(EncodingType={
        $:0
       },{
        PostUrl:{
         $:1,
         $0:searchUrl
        },
        ParameterName:"search",
        EncodingType:EncodingType
       }),function(formlet)
       {
        return Enhance.WithJsonPost(conf,formlet);
       });
       return f7(x2);
      },
      DeveloperSearchResultPanel:function(args)
      {
       return Default.Div(Seq.toList(Seq.delay(function()
       {
        return Seq.append([Clientd.DeveloperSearchForm({
         DeveloperSearch:args.DeveloperSearch,
         SearchUrl:args.SearchUrl
        })],Seq.delay(function()
        {
         return[Default.Table(List.ofArray([Default.TBody(List.ofArray([Default.TR(Runtime.New(T,{
          $:0
         })),Default.TR(List.ofArray([Default.TD(List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("tags-chart")])),List.ofArray([Clientd.TagsChart(args)]))])),Default.TD(List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("geo-map")])),List.ofArray([Clientd.DevLocationMap(args)]))]))]))]))]))];
        }));
       })));
      },
      DeveloperSearchResultPanelControl:Runtime.Class({
       get_Body:function()
       {
        return Clientd.DeveloperSearchResultPanel(this.args);
       }
      }),
      MapChartDimension:Runtime.Field(function()
      {
       return[331,230];
      }),
      TagsChart:function(args)
      {
       var x,f,f1;
       x=Default.Div(Runtime.New(T,{
        $:0
       }));
       f=(f1=function(container)
       {
        var arrData,x1,x2,f2,count,l,f3,chartData,data,x3,f4,x4,f5,x5,f6,f7,action,visualization1,ev,x6,fc,inputRecord1,width,xb,xc,fd,fe,height,xd,xe,ff,f10;
        arrData=(x1=(x2=args.TagFrequencies,(f2=(count=Operators1.Min(10,(l=args.TagFrequencies,Seq.length(l))),function(source)
        {
         return Seq.take(count,source);
        }),f2(x2))),(f3=function(source)
        {
         return Arrays.ofSeq(source);
        },f3(x1)));
        chartData=(data=new DataTable(),(x3=data.addColumn("string","Tag"),(f4=function(value)
        {
         value;
        },f4(x3)),(x4=data.addColumn("number","Number of developers"),(f5=function(value)
        {
         value;
        },f5(x4)),(x5=data.addRows(arrData.length),(f6=function(value)
        {
         value;
        },f6(x5)),(f7=(action=function(rowIx)
        {
         return function(tagFreq)
         {
          data.setValue(rowIx,0,tagFreq.Label);
          return data.setValue(rowIx,1,tagFreq.Count);
         };
        },function(array)
        {
         return Arrays.iteri(action,array);
        }),f7(arrData),data)))));
        visualization1=new ColumnChart(container.Body);
        ev=ColumnChart1.Select(visualization1);
        x6=Util.subscribeTo(ev,function()
        {
         var sels,x7,f8,row,tag,x8,f9,x9,xa,inputRecord,Tags1,fa,conf,EncodingType,fb;
         sels=(x7=visualization1.getSelection(),(f8=function(value)
         {
          return value;
         },f8(x7)));
         row=sels[0].row;
         tag=(x8=chartData.getValue(row,0),(f9=function(value)
         {
          return value;
         },f9(x8)));
         x9=(xa=Formlet1.Return((inputRecord=args.DeveloperSearch,(Tags1=Runtime.New(T,{
          $:1,
          $0:tag,
          $1:args.DeveloperSearch.Tags
         }),Runtime.New(DeveloperSearch,{
          SearchTerm:inputRecord.SearchTerm,
          Location:inputRecord.Location,
          BatchIx:inputRecord.BatchIx,
          Tags:Tags1,
          IsSortByName:inputRecord.IsSortByName
         })))),(fa=(conf=(EncodingType={
          $:0
         },{
          PostUrl:{
           $:1,
           $0:args.SearchUrl
          },
          ParameterName:"search",
          EncodingType:EncodingType
         }),function(formlet)
         {
          return Enhance.WithJsonPost(conf,formlet);
         }),fa(xa)));
         fb=function(arg00)
         {
          return container.AppendI(arg00);
         };
         return fb(x9);
        });
        fc=function(value)
        {
         value;
        };
        fc(x6);
        return visualization1.draw(chartData,(inputRecord1=ColumnChartOptions.get_Default(),(width=(xb=(xc=Clientd.MapChartDimension(),(fd=Runtime.Tupled(function(tuple)
        {
         return tuple[0];
        }),fd(xc))),(fe=function(value)
        {
         return Number(value);
        },fe(xb))),(height=(xd=(xe=Clientd.MapChartDimension(),(ff=Runtime.Tupled(function(tuple)
        {
         return tuple[1];
        }),ff(xe))),(f10=function(value)
        {
         return Number(value);
        },f10(xd))),Runtime.New(ColumnChartOptions,{
         backgroundColor:inputRecord1.backgroundColor,
         colors:inputRecord1.colors,
         fontSize:inputRecord1.fontSize,
         fontName:inputRecord1.fontName,
         hAxis:inputRecord1.hAxis,
         height:height,
         isStacked:inputRecord1.isStacked,
         legend:"none",
         legendTextStyle:inputRecord1.legendTextStyle,
         reverseCategories:inputRecord1.reverseCategories,
         title:inputRecord1.title,
         titleTextStyle:inputRecord1.titleTextStyle,
         tooltipTextStyle:inputRecord1.tooltipTextStyle,
         vAxis:inputRecord1.vAxis,
         width:width
        })))));
       },function(w)
       {
        return Operators.OnAfterRender(f1,w);
       });
       f(x);
       return x;
      }
     }
    },
    SubscribeDeveloerSearch:{
     Client:{
      ConfirmSubscribeForm:function(period)
      {
       var info,conf,x2,f,x3,x4,x5,f1,f2,f3;
       info=function()
       {
        var x,_this,x1,_this1;
        return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("Subscribing will grant you access to all developer profiles for a period of "),(x=List.ofArray([Default.Text(period.Label.toLowerCase())]),(_this=Default.Tags(),_this.NewTag("strong",x))),Default.Text(".")])),Default.P(List.ofArray([Default.Text(" The total the cost is "),(x1=List.ofArray([Default.Text(Global.String(period.Price))]),(_this1=Default.Tags(),_this1.NewTag("strong",x1))),Default.Text(" credits, which will be deducted from your FPish credits balance.")])),Default.P(List.ofArray([Default.Text("Please confirm that you agree with these terms.")]))]));
       };
       conf=(x2=Controls.Checkbox(false),(f=function(arg10)
       {
        return Data.Validator().IsTrue("You need to agree with the terms.",arg10);
       },f(x2)));
       x3=Data.$(Data.$((x4=function()
       {
        return function()
        {
         return null;
        };
       },Formlet1.Return(x4)),(x5=Formlet1.OfElement(info),(f1=function(formlet)
       {
        return Formlet1.InitWith(null,formlet);
       },f1(x5)))),conf);
       f2=(f3=function(el)
       {
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("box")])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f3,formlet);
       });
       return f2(x3);
      },
      SubscribeControl:Runtime.Class({
       get_Body:function()
       {
        return Cliente.SubscribeForm(this.data);
       }
      }),
      SubscribeForm:function(data)
      {
       var periodForm,x,_builder_,f1,_builder_1;
       periodForm=(x=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x1,f;
        return _builder_.Bind((x1=Clientb.ListingPeriodForm(data.User,data.PeriodsLabelsAndPrices,{
         $:0
        }),(f=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f(x1))),function(_arg227)
        {
         return _builder_.Bind(Cliente.ConfirmSubscribeForm(_arg227),function()
         {
          return _builder_.Return(_arg227);
         });
        });
       })),(f1=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f1(x)));
       _builder_1=Formlet1.Do();
       return _builder_1.Delay(function()
       {
        var f;
        return _builder_1.Bind((f=function(formlet)
        {
         return UserControls.SetupForm("Subscribe",true,formlet);
        },f(periodForm)),function(_arg229)
        {
         var x1,f2;
         return _builder_1.Bind((x1=Remoting.Async("IntelliFactory.Trainings:77",[_arg229]),(f2=function(a)
         {
          return Formlet2.LoadingFormlet(a);
         },f2(x1))),function(_arg228)
         {
          return _builder_1.ReturnFrom(_arg228?(location.href=data.RedirectUrl,FormletHelpers.SuccessF("You are now subscribed.")):FormletHelpers.ErrorF("Something went wrong, your subscription \r\n                                could not be processed"));
         });
        });
       });
      }
     }
    },
    TrainingBookingInternals:{
     Client:{
      OnlineTBForm:function(eventId)
      {
       var toOnlineBookingInfo,events,x,x1,f,mapping,f1,defEvent,x3,f2,predicate,f3,x4,x5,x6,x7,f4,arg00,f5,f6,f7,lc,inputRecord;
       toOnlineBookingInfo=Runtime.Tupled(function(tupledArg)
       {
        var id,title,date;
        id=tupledArg[0];
        title=tupledArg[1];
        date=tupledArg[2];
        return{
         EventId:id,
         Event:title,
         Date:date
        };
       });
       events=(x=(x1=Remoting.Call("IntelliFactory.Trainings:30",[]),(f=(mapping=function(te)
       {
        return[te.Date+" "+te.Title,[te.EventId,te.Title,te.Date]];
       },function(list)
       {
        return List.map(mapping,list);
       }),f(x1))),(f1=function(x2)
       {
        return Runtime.New(T,{
         $:1,
         $0:["Select",[-1,"",""]],
         $1:x2
        });
       },f1(x)));
       defEvent=(x3=(f2=(predicate=Runtime.Tupled(function(tupledArg)
       {
        var _arg1,_arg2,id;
        _arg1=tupledArg[0];
        _arg2=tupledArg[1];
        id=_arg2[0];
        return id===eventId;
       }),function(list)
       {
        return Seq.tryFindIndex(predicate,list);
       }),f2(events)),(f3=function(_arg3)
       {
        var i;
        if(_arg3.$==1)
         {
          i=_arg3.$0;
          return i;
         }
        else
         {
          return-1;
         }
       },f3(x3)));
       x4=Data.$(Formlet1.Return(toOnlineBookingInfo),(x5=(x6=(x7=Controls.Select(defEvent,events),(f4=(arg00=Runtime.Tupled(function(tupledArg)
       {
        var id,_arg4,_arg5;
        id=tupledArg[0];
        _arg4=tupledArg[1];
        _arg5=tupledArg[2];
        return id>-1;
       }),function(arg20)
       {
        return Data.Validator().Is(arg00,"You must select an event",arg20);
       }),f4(x7))),(f5=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f5(x6))),(f6=function(formlet)
       {
        return Enhance.WithTextLabel("Event",formlet);
       },f6(x5))));
       f7=(lc=(inputRecord=LabelConfiguration.get_Default(),Runtime.New(LabelConfiguration,{
        Align:{
         $:1
        },
        VerticalAlign:inputRecord.VerticalAlign,
        Placement:inputRecord.Placement
       })),function(formlet)
       {
        return Enhance.WithLabelConfiguration(lc,formlet);
       });
       return f7(x4);
      },
      OnsiteBookingForm:function(courseId,booker)
      {
       var events,x,x1,f,mapping,f1,toBookingForm,defaultCourse,x3,f2,predicate,f3,tyF,nullToEmpty,x16,x17,x18,f14,f15,f16,x19,x1a,x1b,x1c,f17,f18,f19,f1a,f1b,x1d,x1e,x1f,f1c,f1d,f1e,x20,f1f,x21,x22,x23,f20,f21,f22,x24,x25,x26,f23,f24,f25,x27,x28,x29,f26,f27,f28,x2a,x2b,x2c,f29,f2a,f2b,f2c;
       events=(x=(x1=Remoting.Call("IntelliFactory.Trainings:55",[]),(f=(mapping=function(course)
       {
        return[course.CourseTitle,[course.CourseId,course.CourseTitle]];
       },function(list)
       {
        return List.map(mapping,list);
       }),f(x1))),(f1=function(x2)
       {
        return Runtime.New(T,{
         $:1,
         $0:["Select",[-1,"N/A"]],
         $1:x2
        });
       },f1(x)));
       toBookingForm=function(comp)
       {
        return function(num)
        {
         return function(st1)
         {
          return function(st2)
          {
           return function(city)
           {
            return function(zip)
            {
             return function(country)
             {
              return function(date)
              {
               return function(_type_)
               {
                return{
                 Company:comp,
                 NumAttendees:num,
                 Street1:st1,
                 Street2:st2,
                 City:city,
                 Zip:zip,
                 Country:country,
                 Date:date.toUTCString(),
                 Type:_type_
                };
               };
              };
             };
            };
           };
          };
         };
        };
       };
       defaultCourse=(x3=(f2=(predicate=Runtime.Tupled(function(tupledArg)
       {
        var _arg1,_arg2,id;
        _arg1=tupledArg[0];
        _arg2=tupledArg[1];
        id=_arg2[0];
        return id===courseId;
       }),function(list)
       {
        return Seq.tryFindIndex(predicate,list);
       }),f2(events)),(f3=function(o)
       {
        return Operators1.DefaultArg(o,-1);
       },f3(x3)));
       tyF=function()
       {
        var _builder_;
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x2,f4;
         return _builder_.Bind((x2=Controls.Select(0,List.ofArray([["Training Course",{
          $:0
         }],["Custom Course",{
          $:1
         }],["Consultation",{
          $:2
         }]])),(f4=function(formlet)
         {
          return Enhance.WithTextLabel("Type of Onsite Work",formlet);
         },f4(x2))),function(_arg166)
         {
          var x4,x5,x6,x7,f5,f6,f7,x8,x9,xa,f8,f9,fa,xb,xc,xd,xe,fb,fc,fd,xf,x10,x11,fe,ff,f10,x12,x13,x14,x15,f11,arg00,f12,f13;
          return _builder_.Bind(_arg166.$==1?Data.$(Data.$((x4=function(description)
          {
           return function(days)
           {
            return{
             $:1,
             $0:description,
             $1:Number(days)
            };
           };
          },Formlet1.Return(x4)),(x5=(x6=(x7=Controls.TextArea(""),(f5=function(arg10)
          {
           return Data.Validator().IsNotEmpty("Enter your desired topics",arg10);
          },f5(x7))),(f6=function(formlet)
          {
           return Enhance.WithValidationIcon(formlet);
          },f6(x6))),(f7=function(formlet)
          {
           return Enhance.WithTextLabel("Desired Topics",formlet);
          },f7(x5)))),(x8=(x9=(xa=Controls.Input(""),(f8=Data.Validator().IsInt("Add the number of days of your desired onsite course"),f8(xa))),(f9=function(formlet)
          {
           return Enhance.WithValidationIcon(formlet);
          },f9(x9))),(fa=function(formlet)
          {
           return Enhance.WithTextLabel("Duration (in days)",formlet);
          },fa(x8)))):_arg166.$==2?Data.$(Data.$((xb=function(description)
          {
           return function(days)
           {
            return{
             $:2,
             $0:description,
             $1:Number(days)
            };
           };
          },Formlet1.Return(xb)),(xc=(xd=(xe=Controls.TextArea(""),(fb=function(arg10)
          {
           return Data.Validator().IsNotEmpty("Enter a brief description of the problems you are facing",arg10);
          },fb(xe))),(fc=function(formlet)
          {
           return Enhance.WithValidationIcon(formlet);
          },fc(xd))),(fd=function(formlet)
          {
           return Enhance.WithTextLabel("Desired Topics",formlet);
          },fd(xc)))),(xf=(x10=(x11=Controls.Input(""),(fe=Data.Validator().IsInt("Add the number of days of your desired onsite consultation"),fe(x11))),(ff=function(formlet)
          {
           return Enhance.WithValidationIcon(formlet);
          },ff(x10))),(f10=function(formlet)
          {
           return Enhance.WithTextLabel("Duration (in days)",formlet);
          },f10(xf)))):Data.$((x12=Runtime.Tupled(function(tupledArg)
          {
           var courseId1,courseTitle;
           courseId1=tupledArg[0];
           courseTitle=tupledArg[1];
           return{
            $:0,
            $0:courseTitle,
            $1:courseId1
           };
          }),Formlet1.Return(x12)),(x13=(x14=(x15=Controls.Select(defaultCourse,events),(f11=(arg00=Runtime.Tupled(function(tupledArg)
          {
           var id,_arg3;
           id=tupledArg[0];
           _arg3=tupledArg[1];
           return id>0;
          }),function(arg20)
          {
           return Data.Validator().Is(arg00,"Select the course you are interested in",arg20);
          }),f11(x15))),(f12=function(formlet)
          {
           return Enhance.WithValidationIcon(formlet);
          },f12(x14))),(f13=function(formlet)
          {
           return Enhance.WithTextLabel("IntelliFactory Course",formlet);
          },f13(x13)))),function(_arg165)
          {
           return _builder_.Return(_arg165);
          });
         });
        });
       };
       nullToEmpty=function(s)
       {
        if(s===null)
         {
          return"";
         }
        else
         {
          return s;
         }
       };
       return Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Formlet1.Return(toBookingForm),(x16=(x17=(x18=Controls.Input(nullToEmpty(booker.Company)),(f14=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a company name",arg10);
       },f14(x18))),(f15=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f15(x17))),(f16=function(formlet)
       {
        return Enhance.WithTextLabel("Company",formlet);
       },f16(x16)))),(x19=(x1a=(x1b=(x1c=Controls.Input("1"),(f17=Data.Validator().IsInt("You must specify a number of attendees"),f17(x1c))),(f18=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f18(x1b))),(f19=function(formlet)
       {
        return Enhance.WithTextLabel("Number of attendees",formlet);
       },f19(x1a))),(f1a=(f1b=function(value)
       {
        return Number(value);
       },function(formlet)
       {
        return Formlet1.Map(f1b,formlet);
       }),f1a(x19)))),(x1d=(x1e=(x1f=Controls.Input(booker.Street1),(f1c=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a street address",arg10);
       },f1c(x1f))),(f1d=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1d(x1e))),(f1e=function(formlet)
       {
        return Enhance.WithTextLabel("Street 1",formlet);
       },f1e(x1d)))),(x20=Controls.Input(nullToEmpty(booker.Street2)),(f1f=function(formlet)
       {
        return Enhance.WithTextLabel("Street 2",formlet);
       },f1f(x20)))),(x21=(x22=(x23=Controls.Input(nullToEmpty(booker.City)),(f20=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a city",arg10);
       },f20(x23))),(f21=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f21(x22))),(f22=function(formlet)
       {
        return Enhance.WithTextLabel("City",formlet);
       },f22(x21)))),(x24=(x25=(x26=Controls.Input(booker.Zip),(f23=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a zip code",arg10);
       },f23(x26))),(f24=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f24(x25))),(f25=function(formlet)
       {
        return Enhance.WithTextLabel("Zip code",formlet);
       },f25(x24)))),(x27=(x28=(x29=Controls.Input(booker.Country),(f26=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a country",arg10);
       },f26(x29))),(f27=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f27(x28))),(f28=function(formlet)
       {
        return Enhance.WithTextLabel("Country",formlet);
       },f28(x27)))),(x2a=(x2b=(x2c=Controls3.Calendar({
        $:0
       }),(f29=(f2a=function(el)
       {
        var _this;
        return Operators.add(Default.Div(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","padding:5px"))])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f2a,formlet);
       }),f29(x2c))),(f2b=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f2b(x2b))),(f2c=function(formlet)
       {
        return Enhance.WithTextLabel("Date",formlet);
       },f2c(x2a)))),tyF(null));
      },
      PastOnlineTBForm:function(eventId)
      {
       var toOnlineBookingInfo,events,x,x1,f,mapping,f1,defEvent,x3,f2,predicate,f3,x4,x5,x6,x7,f4,arg00,f5,f6,f7,lc,inputRecord;
       toOnlineBookingInfo=Runtime.Tupled(function(tupledArg)
       {
        var id,title,date;
        id=tupledArg[0];
        title=tupledArg[1];
        date=tupledArg[2];
        return{
         EventId:id,
         Event:title,
         Date:date
        };
       });
       events=(x=(x1=Remoting.Call("IntelliFactory.Trainings:31",[]),(f=(mapping=function(te)
       {
        return[te.Date+" "+te.Title,[te.EventId,te.Title,te.Date]];
       },function(list)
       {
        return List.map(mapping,list);
       }),f(x1))),(f1=function(x2)
       {
        return Runtime.New(T,{
         $:1,
         $0:["Select",[-1,"",""]],
         $1:x2
        });
       },f1(x)));
       defEvent=(x3=(f2=(predicate=Runtime.Tupled(function(tupledArg)
       {
        var _arg1,_arg2,id;
        _arg1=tupledArg[0];
        _arg2=tupledArg[1];
        id=_arg2[0];
        return id===eventId;
       }),function(list)
       {
        return Seq.tryFindIndex(predicate,list);
       }),f2(events)),(f3=function(_arg3)
       {
        var i;
        if(_arg3.$==1)
         {
          i=_arg3.$0;
          return i;
         }
        else
         {
          return-1;
         }
       },f3(x3)));
       x4=Data.$(Formlet1.Return(toOnlineBookingInfo),(x5=(x6=(x7=Controls.Select(defEvent,events),(f4=(arg00=Runtime.Tupled(function(tupledArg)
       {
        var id,_arg4,_arg5;
        id=tupledArg[0];
        _arg4=tupledArg[1];
        _arg5=tupledArg[2];
        return id>-1;
       }),function(arg20)
       {
        return Data.Validator().Is(arg00,"You must select an event",arg20);
       }),f4(x7))),(f5=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f5(x6))),(f6=function(formlet)
       {
        return Enhance.WithTextLabel("Event",formlet);
       },f6(x5))));
       f7=(lc=(inputRecord=LabelConfiguration.get_Default(),Runtime.New(LabelConfiguration,{
        Align:{
         $:1
        },
        VerticalAlign:inputRecord.VerticalAlign,
        Placement:inputRecord.Placement
       })),function(formlet)
       {
        return Enhance.WithLabelConfiguration(lc,formlet);
       });
       return f7(x4);
      },
      RenderOnSiteTBForm:function(courseId,user,successUrl)
      {
       var buttonClass,courseId1,ProcessOnSiteTB,conf,Description,x2,f3,f4,x3,f5,f6,x4,x5,f7,f8;
       buttonClass=Server.Large();
       courseId1=Operators1.DefaultArg(courseId,-1);
       ProcessOnSiteTB=function(inp)
       {
        var x,f;
        x=Remoting.Call("IntelliFactory.Trainings:35",[inp,user]);
        f=function(_arg1)
        {
         var msgs,f1,id,x1,f2;
         if(_arg1.$==1)
          {
           msgs=_arg1.$0;
           f1=function(arg0)
           {
            return Runtime.New(_Result_1,{
             $:1,
             $0:arg0
            });
           };
           return f1(msgs);
          }
         else
          {
           id=_arg1.$0;
           location.href=successUrl+Global.String(id);
           x1=Client3.LoadingImage();
           f2=function(arg0)
           {
            return Runtime.New(_Result_1,{
             $:0,
             $0:arg0
            });
           };
           return f2(x1);
          }
        };
        return f(x);
       };
       conf=(Description=(x2=(f3=function(arg0)
       {
        return{
         $:0,
         $0:arg0
        };
       },f3("Request a quote for an onsite training session")),(f4=function(arg0)
       {
        return{
         $:1,
         $0:arg0
        };
       },f4(x2))),Runtime.New(FormContainerConfiguration,{
        Header:(x3=(f5=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },f5("Onsite Training Booking")),(f6=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },f6(x3))),
        Padding:Client3.StandardConfiguration().Padding,
        Description:Description,
        BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
        BorderColor:Client3.StandardConfiguration().BorderColor,
        CssClass:Client3.StandardConfiguration().CssClass,
        Style:Client3.StandardConfiguration().Style
       }));
       x4=(x5=Clientc.OnsiteBookingForm(courseId1,user),(f7=function(formlet)
       {
        return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
       },f7(x5)));
       f8=function(form)
       {
        return Enhance1.FormWithResponse(conf,ProcessOnSiteTB,form);
       };
       return f8(x4);
      },
      RenderOnlineTBForm:function(eventId,user,successUrl)
      {
       var buttonClass,eventId1,ProcessOnlineTB,conf,Description,x2,f2,f3,x3,f4,f5,x4,x5,f6,f7;
       buttonClass=Server.Large();
       eventId1=Operators1.DefaultArg(eventId,-1);
       ProcessOnlineTB=function(inp)
       {
        var x,f;
        x=Remoting.Call("IntelliFactory.Trainings:34",[inp,user]);
        f=function(_arg1)
        {
         var msgs,id,x1,f1;
         if(_arg1.$==1)
          {
           msgs=_arg1.$0;
           return Runtime.New(_Result_1,{
            $:1,
            $0:msgs
           });
          }
         else
          {
           id=_arg1.$0;
           location.href=successUrl+Global.String(id);
           x1=Client3.LoadingImage();
           f1=function(arg0)
           {
            return Runtime.New(_Result_1,{
             $:0,
             $0:arg0
            });
           };
           return f1(x1);
          }
        };
        return f(x);
       };
       conf=(Description=(x2=(f2=function(arg0)
       {
        return{
         $:0,
         $0:arg0
        };
       },f2("Register for an online training session")),(f3=function(arg0)
       {
        return{
         $:1,
         $0:arg0
        };
       },f3(x2))),Runtime.New(FormContainerConfiguration,{
        Header:(x3=(f4=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },f4("Online Training Booking")),(f5=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },f5(x3))),
        Padding:Client3.StandardConfiguration().Padding,
        Description:Description,
        BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
        BorderColor:Client3.StandardConfiguration().BorderColor,
        CssClass:Client3.StandardConfiguration().CssClass,
        Style:Client3.StandardConfiguration().Style
       }));
       x4=(x5=Clientc.OnlineTBForm(eventId1,user),(f6=function(formlet)
       {
        return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
       },f6(x5)));
       f7=function(form)
       {
        return Enhance1.FormWithResponse(conf,ProcessOnlineTB,form);
       };
       return f7(x4);
      },
      RenderPastOnlineTBForm:function(eventId,user,successUrl)
      {
       var buttonClass,eventId1,ProcessPastOnlineTB,conf,Description,x2,f2,f3,x3,f4,f5,x4,x5,f6,f7;
       buttonClass=Server.Large();
       eventId1=Operators1.DefaultArg(eventId,-1);
       ProcessPastOnlineTB=function(inp)
       {
        var x,f;
        x=Remoting.Call("IntelliFactory.Trainings:34",[inp,user]);
        f=function(_arg1)
        {
         var msgs,id,x1,f1;
         if(_arg1.$==1)
          {
           msgs=_arg1.$0;
           return Runtime.New(_Result_1,{
            $:1,
            $0:msgs
           });
          }
         else
          {
           id=_arg1.$0;
           location.href=successUrl+Global.String(id);
           x1=Client3.LoadingImage();
           f1=function(arg0)
           {
            return Runtime.New(_Result_1,{
             $:0,
             $0:arg0
            });
           };
           return f1(x1);
          }
        };
        return f(x);
       };
       conf=(Description=(x2=(f2=function(arg0)
       {
        return{
         $:0,
         $0:arg0
        };
       },f2("Select the online session to purchase.")),(f3=function(arg0)
       {
        return{
         $:1,
         $0:arg0
        };
       },f3(x2))),Runtime.New(FormContainerConfiguration,{
        Header:(x3=(f4=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },f4("Past Online Event")),(f5=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },f5(x3))),
        Padding:Client3.StandardConfiguration().Padding,
        Description:Description,
        BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
        BorderColor:Client3.StandardConfiguration().BorderColor,
        CssClass:Client3.StandardConfiguration().CssClass,
        Style:Client3.StandardConfiguration().Style
       }));
       x4=(x5=Clientc.PastOnlineTBForm(eventId1,user),(f6=function(formlet)
       {
        return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
       },f6(x5)));
       f7=function(form)
       {
        return Enhance1.FormWithResponse(conf,ProcessPastOnlineTB,form);
       };
       return f7(x4);
      },
      RenderScheduledTBForm:function(eventId,user,successUrl)
      {
       var buttonClass,eventId1,ProcessScheduledTBForm,conf,Description,x2,f3,f4,x3,f5,f6,x4,x5,f7,f8;
       buttonClass=Server.Large();
       eventId1=Operators1.DefaultArg(eventId,-1);
       ProcessScheduledTBForm=function(stbi)
       {
        var x,f;
        x=Remoting.Call("IntelliFactory.Trainings:33",[stbi,user]);
        f=function(_arg1)
        {
         var msgs,f1,id,x1,f2;
         if(_arg1.$==1)
          {
           msgs=_arg1.$0;
           f1=function(arg0)
           {
            return Runtime.New(_Result_1,{
             $:1,
             $0:arg0
            });
           };
           return f1(msgs);
          }
         else
          {
           id=_arg1.$0;
           location.href=successUrl+Global.String(id);
           x1=Client3.LoadingImage();
           f2=function(arg0)
           {
            return Runtime.New(_Result_1,{
             $:0,
             $0:arg0
            });
           };
           return f2(x1);
          }
        };
        return f(x);
       };
       conf=(Description=(x2=(f3=function(arg0)
       {
        return{
         $:0,
         $0:arg0
        };
       },f3("Sign up for one of the prescheduled training sessions.")),(f4=function(arg0)
       {
        return{
         $:1,
         $0:arg0
        };
       },f4(x2))),Runtime.New(FormContainerConfiguration,{
        Header:(x3=(f5=function(arg0)
        {
         return{
          $:0,
          $0:arg0
         };
        },f5("Scheduled Training Booking")),(f6=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },f6(x3))),
        Padding:Client3.StandardConfiguration().Padding,
        Description:Description,
        BackgroundColor:Client3.StandardConfiguration().BackgroundColor,
        BorderColor:Client3.StandardConfiguration().BorderColor,
        CssClass:Client3.StandardConfiguration().CssClass,
        Style:Client3.StandardConfiguration().Style
       }));
       x4=(x5=Clientc.ScheduledBookingForm(eventId1,user),(f7=function(formlet)
       {
        return Client1.EnhanceWithSubmitAndResetButtons(buttonClass,formlet);
       },f7(x5)));
       f8=function(form)
       {
        return Enhance1.FormWithResponse(conf,ProcessScheduledTBForm,form);
       };
       return f8(x4);
      },
      ScheduledBookingForm:function(eventId,booker)
      {
       var toAttendee,toBookingInfo,attendeeForm,x,x1,x2,x3,x4,x5,x6,x7,x8,f,f1,f2,x9,xa,xb,f3,f4,f5,xc,xd,xe,f6,f7,f8,xf,f9,fa,lc,inputRecord,fb,fc,fd,fe,arg00,ff,g,f10,events,x11,x12,f11,mapping,f12,defEvent,x13,f13,predicate,f14,x14,x15,x16,x17,f15,arg001,f16,f17,f18;
       toAttendee=function(fn)
       {
        return function(ln)
        {
         return function(em)
         {
          return function(ph)
          {
           return{
            FirstName:fn,
            LastName:ln,
            Email:em,
            Phone:ph
           };
          };
         };
        };
       };
       toBookingInfo=Runtime.Tupled(function(tupledArg)
       {
        var evId,evTitle,evDate,evLoc;
        evId=tupledArg[0];
        evTitle=tupledArg[1];
        evDate=tupledArg[2];
        evLoc=tupledArg[3];
        return function(attendees)
        {
         return{
          EventId:evId,
          Event:evTitle,
          Date:evDate,
          Location:evLoc,
          Attendees:attendees
         };
        };
       });
       attendeeForm=(x=(x1=(x2=(x3=(x4=(x5=Data.$(Data.$(Data.$(Data.$(Formlet1.Return(toAttendee),(x6=(x7=(x8=Controls.Input(booker.FirstName),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a first name",arg10);
       },f(x8))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x7))),(f2=function(formlet)
       {
        return Enhance.WithTextLabel("First Name",formlet);
       },f2(x6)))),(x9=(xa=(xb=Controls.Input(booker.LastName),(f3=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify a last name",arg10);
       },f3(xb))),(f4=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f4(xa))),(f5=function(formlet)
       {
        return Enhance.WithTextLabel("Last Name",formlet);
       },f5(x9)))),(xc=(xd=(xe=Controls.Input(booker.Email),(f6=Data.Validator().IsEmail("You must specify a valid email"),f6(xe))),(f7=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f7(xd))),(f8=function(formlet)
       {
        return Enhance.WithTextLabel("Email",formlet);
       },f8(xc)))),(xf=Controls.Input(booker.Phone),(f9=function(formlet)
       {
        return Enhance.WithTextLabel("Phone Number",formlet);
       },f9(xf)))),(fa=(lc=(inputRecord=LabelConfiguration.get_Default(),Runtime.New(LabelConfiguration,{
        Align:{
         $:1
        },
        VerticalAlign:inputRecord.VerticalAlign,
        Placement:inputRecord.Placement
       })),function(formlet)
       {
        return Enhance.WithLabelConfiguration(lc,formlet);
       }),fa(x5))),(fb=function(formlet)
       {
        return Enhance.WithLegend("Attendee",formlet);
       },fb(x4))),(fc=function(formlet)
       {
        return Enhance.Many(formlet);
       },fc(x3))),(fd=function(formlet)
       {
        return Enhance.WithLegend("Attendees",formlet);
       },fd(x2))),(fe=(arg00=(ff=function(value)
       {
        return!value;
       },(g=function(list)
       {
        return list.$==0;
       },function(x10)
       {
        return ff(g(x10));
       })),function(arg20)
       {
        return Data.Validator().Is(arg00,"You must add at least one attendee",arg20);
       }),fe(x1))),(f10=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f10(x)));
       events=(x11=(x12=Remoting.Call("IntelliFactory.Trainings:32",[]),(f11=(mapping=function(te)
       {
        return[te.Date+" ("+te.LocationCity+") "+te.CourseTitle,[te.EventId,te.CourseTitle,te.Date,te.LocationCity]];
       },function(list)
       {
        return List.map(mapping,list);
       }),f11(x12))),(f12=function(x10)
       {
        return Runtime.New(T,{
         $:1,
         $0:["Select",[-1,"","",""]],
         $1:x10
        });
       },f12(x11)));
       defEvent=(x13=(f13=(predicate=Runtime.Tupled(function(tupledArg)
       {
        var _arg1,_arg2,id;
        _arg1=tupledArg[0];
        _arg2=tupledArg[1];
        id=_arg2[0];
        return id===eventId;
       }),function(list)
       {
        return Seq.tryFindIndex(predicate,list);
       }),f13(events)),(f14=function(_arg3)
       {
        var i;
        if(_arg3.$==1)
         {
          i=_arg3.$0;
          return i;
         }
        else
         {
          return-1;
         }
       },f14(x13)));
       return Data.$(Data.$(Formlet1.Return(toBookingInfo),(x14=(x15=(x16=(x17=Controls.Select(defEvent,events),(f15=(arg001=Runtime.Tupled(function(tupledArg)
       {
        var id,_arg4,_arg5,_arg6;
        id=tupledArg[0];
        _arg4=tupledArg[1];
        _arg5=tupledArg[2];
        _arg6=tupledArg[3];
        return id>-1;
       }),function(arg20)
       {
        return Data.Validator().Is(arg001,"You must select an event",arg20);
       }),f15(x17))),(f16=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f16(x16))),(f17=function(formlet)
       {
        return Enhance.WithTextLabel("Event",formlet);
       },f17(x15))),(f18=function(formlet)
       {
        return Enhance.WithLegend("Training Event",formlet);
       },f18(x14)))),attendeeForm);
      }
     }
    },
    Trainings:{
     Client:{
      CourseListing:function(baseUrl)
      {
       var formatCourse,f1;
       formatCourse=function(course)
       {
        var linkCourse,desc,_this,_this1,x,x1,f,_this2,_this3,_this4,_this5,_this6,_this7;
        linkCourse=baseUrl+Global.String(course.CourseId);
        desc=Default.P(Runtime.New(T,{
         $:0
        }));
        desc.set_Html(course.CourseAbstract);
        return Default.LI(List.ofArray([Default.H3(List.ofArray([Operators.add(Default.A(List.ofArray([(_this=Default.Attr(),_this.NewAttr("href",linkCourse)),(_this1=Default.Attr(),(x=course.CourseTitle,_this1.NewAttr("alt",x)))])),List.ofArray([(x1=course.CourseTitle,(f=function(x2)
        {
         return Default.Text(x2);
        },f(x1)))])),course.IsInstructorLed?Default.Img(List.ofArray([(_this2=Default.Attr(),_this2.NewAttr("src","/images/button-1.png")),(_this3=Default.Attr(),_this3.NewAttr("alt","Scheduled")),Default.Attr().Class("course-icon")])):Default.Div(List.ofArray([Default.Attr().Class("course-icon-empty")])),course.IsOnsite?Default.Img(List.ofArray([(_this4=Default.Attr(),_this4.NewAttr("src","/images/button-2.png")),(_this5=Default.Attr(),_this5.NewAttr("alt","Onsite")),Default.Attr().Class("course-icon")])):Default.Div(List.ofArray([Default.Attr().Class("course-icon-empty")])),course.IsVirtual?Default.Img(List.ofArray([(_this6=Default.Attr(),_this6.NewAttr("src","/images/button-3.png")),(_this7=Default.Attr(),_this7.NewAttr("alt","Onsite")),Default.Attr().Class("course-icon")])):Default.Div(List.ofArray([Default.Attr().Class("course-icon-empty")]))])),desc]));
       };
       f1=function()
       {
        var x,f;
        x=Remoting.Async("IntelliFactory.Trainings:57",[]);
        f=function(_arg167)
        {
         var x1,x2,f2,f3;
         x1=(x2=(f2=function(list)
         {
          return List.map(formatCourse,list);
         },f2(_arg167)),(f3=function(courses)
         {
          return Operators.add(Default.UL(List.ofArray([Default.Attr().Class("course-listing")])),courses);
         },f3(x2)));
         return Concurrency.Return(x1);
        };
        return Concurrency.Bind(x,f);
       };
       return Concurrency.Delay(f1);
      },
      CoursesSummaries:function(baseUrl)
      {
       var x,formatCourse,f1;
       x=Default.P(Runtime.New(T,{
        $:0
       }));
       formatCourse=function(course)
       {
        var linkCourse,desc,_this,_this1,_this2,_this3,_this4,_this5,x1,x2,f;
        linkCourse=baseUrl+Global.String(course.CourseId);
        desc=Default.P(Runtime.New(T,{
         $:0
        }));
        desc.set_Html(course.CourseAbstract);
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("postborder")])),List.ofArray([Default.P(List.ofArray([Operators.add(Default.A(List.ofArray([(_this=Default.Attr(),_this.NewAttr("href",linkCourse)),(_this1=Default.Attr(),_this1.NewAttr("alt","Course details"))])),List.ofArray([Default.Img(List.ofArray([(_this2=Default.Attr(),_this2.NewAttr("src","/images/button-details.png")),(_this3=Default.Attr(),_this3.NewAttr("alt","Details"))]))])),Operators.add(Default.A(List.ofArray([(_this4=Default.Attr(),_this4.NewAttr("href",linkCourse)),(_this5=Default.Attr(),(x1=course.CourseTitle,_this5.NewAttr("alt",x1)))])),List.ofArray([(x2=course.CourseTitle,(f=function(x3)
        {
         return Default.Text(x3);
        },f(x2)))]))])),desc]));
       };
       f1=function()
       {
        var x1,f;
        x1=Remoting.Async("IntelliFactory.Trainings:57",[]);
        f=function(_arg168)
        {
         var x2,x3,f2,f3;
         x2=(x3=(f2=function(list)
         {
          return List.map(formatCourse,list);
         },f2(_arg168)),(f3=function(x4)
         {
          return Default.Div(x4);
         },f3(x3)));
         return Concurrency.Return(x2);
        };
        return Concurrency.Bind(x1,f);
       };
       return Concurrency.Delay(f1);
      },
      OrderSummary:Runtime.Class({
       get_Body:function()
       {
        return Tabs.New2(List.ofArray([["Summary",Default.Div(List.ofArray([Default.Table(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Order number")])),Default.TD(List.ofArray([Default.Text(this.OrderInfo.Code)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Course title")])),Default.TD(List.ofArray([Default.Text(this.OrderInfo.Title)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Course type")])),Default.TD(List.ofArray([Default.Text(this.OrderInfo.Type.get_DisplayString())]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Date")])),Default.TD(List.ofArray([Default.Text(this.DateString)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Location")])),Default.TD(List.ofArray([Default.Text(this.LocationString)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text(this.PriceInfo)])),Default.TD(List.ofArray([Default.Text(this.CalculatedPrice)]))]))]))]))]]));
       }
      }),
      showPrice:function(event)
      {
       return Global.String(event.Price)+" "+event.Currency;
      }
     }
    },
    Twitter:{
     Client:{
      LatestTweets:function(panel,twitterUser)
      {
       var ignoredWords,x,f,TOKENIZE,linkToTag,formatTextToElementList,computeWordStatistics,showTweets,f9;
       ignoredWords=(x=List.ofArray(["a","about","above","after","again","against","all","am","an","and","any","are","aren","as","at","be","because","been","before","being","below","between","both","but","by","can","cannot","could","couldn","did","didn","do","does","doesn","doing","don","down","during","each","few","for","from","further","had","hadn","has","hasn","have","haven","having","he","her","here","hers","herself","him","himself","his","how","i","if","in","into","is","isn","it","its","itself","let","me","more","most","mustn","my","myself","no","nor","not","of","off","on","once","only","or","other","ought","our","ours","ourselves","out","over","own","same","shan","she","should","shouldn","so","some","such","than","that","the","their","theirs","them","themselves","then","there","these","they","this","those","through","to","too","under","until","up","very","was","wasn","we","were","weren","what","when","where","which","while","who","whom","why","with","won","would","wouldn","you","your","yours","yourself","yourselves","t","d","ll","s","ve","m","re","!","$","%","^","&","*","(",")","+","-","/","\\"," ","_",":",";",",",".","?","'","\"","=","rt"]),(f=function(elements)
       {
        var t;
        t=BalancedTree.OfSeq(elements);
        return _FSharpSet_1.New1(t);
       },f(x)));
       TOKENIZE=function(s)
       {
        var tokenize;
        tokenize=function(currentToken,input)
        {
         return Seq.delay(function()
         {
          var patternInput,rest,first;
          if(input.length===0)
           {
            return Seq.empty();
           }
          else
           {
            if(input.length===1)
             {
              return[currentToken+input];
             }
            else
             {
              patternInput=[Strings.Substring(input,0,1),Strings.Remove(input,0,1)];
              rest=patternInput[1];
              first=patternInput[0];
              if(first==="&")
               {
                return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                {
                 return tokenize("&",rest);
                }));
               }
              else
               {
                if(first===";")
                 {
                  if(Strings.StartsWith(currentToken,"&"))
                   {
                    return Seq.append([currentToken+";"],Seq.delay(function()
                    {
                     return tokenize("",rest);
                    }));
                   }
                  else
                   {
                    if(currentToken!=="")
                     {
                      return Seq.append([currentToken],Seq.delay(function()
                      {
                       return Seq.append([first],Seq.delay(function()
                       {
                        return tokenize("",rest);
                       }));
                      }));
                     }
                    else
                     {
                      return Seq.empty();
                     }
                   }
                 }
                else
                 {
                  if(first===" ")
                   {
                    return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                    {
                     return Seq.append([first],Seq.delay(function()
                     {
                      return tokenize("",rest);
                     }));
                    }));
                   }
                  else
                   {
                    if(first===",")
                     {
                      return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                      {
                       return Seq.append([first],Seq.delay(function()
                       {
                        return tokenize("",rest);
                       }));
                      }));
                     }
                    else
                     {
                      if(first==="(")
                       {
                        return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                        {
                         return Seq.append([first],Seq.delay(function()
                         {
                          return tokenize("",rest);
                         }));
                        }));
                       }
                      else
                       {
                        if(first===")")
                         {
                          return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                          {
                           return Seq.append([first],Seq.delay(function()
                           {
                            return tokenize("",rest);
                           }));
                          }));
                         }
                        else
                         {
                          if(first==="-")
                           {
                            return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                            {
                             return Seq.append([first],Seq.delay(function()
                             {
                              return tokenize("",rest);
                             }));
                            }));
                           }
                          else
                           {
                            if(first==="+")
                             {
                              return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                              {
                               return Seq.append([first],Seq.delay(function()
                               {
                                return tokenize("",rest);
                               }));
                              }));
                             }
                            else
                             {
                              if(first==="*")
                               {
                                return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                {
                                 return Seq.append([first],Seq.delay(function()
                                 {
                                  return tokenize("",rest);
                                 }));
                                }));
                               }
                              else
                               {
                                if(first==="!")
                                 {
                                  return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                  {
                                   return Seq.append([first],Seq.delay(function()
                                   {
                                    return tokenize("",rest);
                                   }));
                                  }));
                                 }
                                else
                                 {
                                  if(first==="$")
                                   {
                                    return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                    {
                                     return Seq.append([first],Seq.delay(function()
                                     {
                                      return tokenize("",rest);
                                     }));
                                    }));
                                   }
                                  else
                                   {
                                    if(first==="\"")
                                     {
                                      return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                      {
                                       return Seq.append([first],Seq.delay(function()
                                       {
                                        return tokenize("",rest);
                                       }));
                                      }));
                                     }
                                    else
                                     {
                                      if(first==="'")
                                       {
                                        return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                        {
                                         return Seq.append([first],Seq.delay(function()
                                         {
                                          return tokenize("",rest);
                                         }));
                                        }));
                                       }
                                      else
                                       {
                                        if(first==="`")
                                         {
                                          return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                          {
                                           return Seq.append([first],Seq.delay(function()
                                           {
                                            return tokenize("",rest);
                                           }));
                                          }));
                                         }
                                        else
                                         {
                                          if(first==="=")
                                           {
                                            return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                            {
                                             return Seq.append([first],Seq.delay(function()
                                             {
                                              return tokenize("",rest);
                                             }));
                                            }));
                                           }
                                          else
                                           {
                                            if(first==="?")
                                             {
                                              return Seq.append(currentToken!==""?[currentToken]:Seq.empty(),Seq.delay(function()
                                              {
                                               return Seq.append([first],Seq.delay(function()
                                               {
                                                return tokenize("",rest);
                                               }));
                                              }));
                                             }
                                            else
                                             {
                                              return tokenize(currentToken+first,rest);
                                             }
                                           }
                                         }
                                       }
                                     }
                                   }
                                 }
                               }
                             }
                           }
                         }
                       }
                     }
                   }
                 }
               }
             }
           }
         });
        };
        return tokenize("",s);
       };
       linkToTag=function(tag)
       {
        var matchValue;
        matchValue=tag.charCodeAt(0);
        if(matchValue===35)
         {
          return"https://twitter.com/#!/search/realtime/%23"+encodeURI(tag.substring(1)+" from:"+twitterUser+" include:retweets");
         }
        else
         {
          if(matchValue===64)
           {
            return"https://twitter.com/#!/search/realtime/"+encodeURI(" from:"+twitterUser+" "+tag+" "+"include:retweets");
           }
          else
           {
            return"#";
           }
         }
       };
       formatTextToElementList=function(s)
       {
        var mapWord,x1,x2,f1,f2;
        mapWord=function(word)
        {
         var _this,_this1;
         if(word==="RT")
          {
           return Default.Img(List.ofArray([Default.Src("/images/retweet.png"),Default.Alt("RT")]));
          }
         else
          {
           if((_this=word.toLowerCase(),Strings.StartsWith(_this,"http://"))?true:(_this1=word.toLowerCase(),Strings.StartsWith(_this1,"https://")))
            {
             return Operators.add(Default.A(List.ofArray([Default.HRef(word)])),List.ofArray([Default.Text(word)]));
            }
           else
            {
             if(Strings.StartsWith(word,"@")?true:Strings.StartsWith(word,"#"))
              {
               return Operators.add(Default.A(List.ofArray([Default.HRef(linkToTag(word)),Default.Attr().Class("tweet-link")])),List.ofArray([Default.Text(word)]));
              }
             else
              {
               return Clientf.op_MinusBang(Default.Span(Runtime.New(T,{
                $:0
               })),word);
              }
            }
          }
        };
        x1=(x2=TOKENIZE(s),(f1=function(source)
        {
         return Seq.map(mapWord,source);
        },f1(x2)));
        f2=function(source)
        {
         return Seq.toList(source);
        };
        return f2(x1);
       };
       computeWordStatistics=function(tweets)
       {
        var x1,x2,x3,x4,x5,x6,f1,folder,state,f3,f4,predicate,f5,projection,f6,predicate1,f7,f8;
        x1=(x2=(x3=(x4=(x5=(x6=(f1=(folder=function(map)
        {
         return function(tweet)
         {
          var x7,f2,folder1;
          x7=TOKENIZE(tweet.text);
          f2=(folder1=function(map1)
          {
           return function(word)
           {
            var v;
            if(map1.ContainsKey(word))
             {
              v=map1.get_Item(word)+1;
              return map1.Add(word,v);
             }
            else
             {
              return map1.Add(word,1);
             }
           };
          },function(source)
          {
           return Seq.fold(folder1,map,source);
          });
          return f2(x7);
         };
        },(state=_FSharpMap_2.New([]),function(array)
        {
         return Arrays.fold(folder,state,array);
        })),f1(tweets)),(f3=function(table)
        {
         return Seq.toList(MapModule.ToSeq(table));
        },f3(x6))),(f4=(predicate=Runtime.Tupled(function(tupledArg)
        {
         var word,_arg1,_this,_this1,v;
         word=tupledArg[0];
         _arg1=tupledArg[1];
         if((_this=word.toLowerCase(),Strings.StartsWith(_this,"http://"))?true:(_this1=word.toLowerCase(),Strings.StartsWith(_this1,"https://")))
          {
           return false;
          }
         else
          {
           if(v=word.toLowerCase(),ignoredWords.Contains(v))
            {
             return false;
            }
           else
            {
             return true;
            }
          }
        }),function(list)
        {
         return List.filter(predicate,list);
        }),f4(x5))),(f5=(projection=Runtime.Tupled(function(tuple)
        {
         return tuple[1];
        }),function(list)
        {
         return List.sortBy(projection,list);
        }),f5(x4))),(f6=(predicate1=Runtime.Tupled(function(tupledArg)
        {
         var word,count;
         word=tupledArg[0];
         count=tupledArg[1];
         return count>1;
        }),function(list)
        {
         return List.filter(predicate1,list);
        }),f6(x3))),(f7=function(list)
        {
         return List.rev(list);
        },f7(x2)));
        f8=function(res)
        {
         var x7,f2;
         if(Seq.length(res)>20)
          {
           x7=Seq.take(20,res);
           f2=function(source)
           {
            return Seq.toList(source);
           };
           return f2(x7);
          }
         else
          {
           return res;
          }
        };
        return f8(x1);
       };
       showTweets=function(statuses)
       {
        var ts,x1,f1,x3,f2,x4,f3,count1;
        if(statuses.$==0)
         {
          ts=statuses.$0;
          x1=Operators.add(Default.UL(List.ofArray([Default.Attr().Class("top-tweet-words")])),Seq.toList(Seq.delay(function()
          {
           return Seq.append(Seq.collect(Runtime.Tupled(function(matchValue)
           {
            var word,count,x2;
            word=matchValue[0];
            count=matchValue[1];
            return[Default.LI(List.ofArray([Operators.add(Default.A(List.ofArray([Default.HRef(linkToTag(word)),Default.Attr().Class("tweet-link")])),List.ofArray([Default.Text(word)])),(x2="x "+Global.String(count),Default.Text(x2))]))];
           }),computeWordStatistics(ts)),Seq.delay(function()
           {
            return[Default.LI(List.ofArray([Default.Attr().Class("closer")]))];
           }));
          })));
          f1=function(arg00)
          {
           return panel.AppendI(arg00);
          };
          f1(x1);
          x3=Default.Div(List.ofArray([Default.Attr().Class("closer")]));
          f2=function(arg00)
          {
           return panel.AppendI(arg00);
          };
          f2(x3);
          x4=Default.B(List.ofArray([Default.Text("Latest")]));
          f3=function(arg00)
          {
           return panel.AppendI(arg00);
          };
          f3(x4);
          count1=Operators1.Min(3,ts.length);
          Runtime.For(0,count1-1,function(ix)
          {
           var tweet;
           tweet=Operators.add(Operators.add(Default.Div(List.ofArray([Default.Attr().Class("tweet")])),formatTextToElementList(ts[ix].text)),List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("tweet-info")])),Seq.toList(Seq.delay(function()
           {
            return Seq.append([Default.Text("Posted on ")],Seq.delay(function()
            {
             var x2,_this,ct;
             return Seq.append([(x2=(_this=ts[ix].created_at,(ct=ts[ix].created_at.indexOf("+"),Strings.Substring(_this,0,ct))),Default.Text(x2))],Seq.delay(function()
             {
              var x5;
              return Seq.append(ts[ix].retweeted?[(x5=", retweeted "+Global.String(ts[ix].retweet_count)+" times",Default.Text(x5))]:Seq.empty(),Seq.delay(function()
              {
               return[Operators.add(Default.A(List.ofArray([Default.HRef("https://twitter.com/#!/"+twitterUser+"/status/"+ts[ix].id_str),Default.Attr().Class("buttonPro small white")])),List.ofArray([Default.Text("View")]))];
              }));
             }));
            }));
           })))])),panel.AppendI(tweet);
          });
         }
        else
         {
          return null;
         }
       };
       f9=function()
       {
        var x1,f1;
        x1=Client10.GetUser({
         $:0
        },{
         $:1,
         $0:twitterUser
        },{
         $:0
        });
        f1=function()
        {
         var x2,f2;
         x2=Client11.GetUserTimeLine({
          $:0
         },{
          $:0
         },{
          $:0
         },{
          $:0
         },{
          $:0
         },{
          $:1,
          $0:twitterUser
         },{
          $:0
         },{
          $:0
         },{
          $:0
         });
         f2=function(_arg31)
         {
          showTweets(_arg31);
          return Concurrency.Return(null);
         };
         return Concurrency.Bind(x2,f2);
        };
        return Concurrency.Bind(x1,f1);
       };
       return Concurrency.Delay(f9);
      },
      op_MinusBang:function(elem,text)
      {
       jQuery(elem.Body).html(text);
       return elem;
      }
     }
    },
    Upload:{
     File:function(name)
     {
      var x,f,f2;
      x=(f=function()
      {
       var stateChanged,input,x1,_this,_this1,f1,x2,reset;
       stateChanged=_FSharpEvent_1.New();
       input=(x1=Default.Input(List.ofArray([(_this=Default.Attr(),_this.NewAttr("type","file")),(_this1=Default.Attr(),_this1.NewAttr("name",name))])),(f1=(x2=function(e)
       {
        var x3;
        x3=Runtime.New(_Result_1,{
         $:0,
         $0:e.get_Value()
        });
        return stateChanged.event.Trigger(x3);
       },function(arg10)
       {
        return EventsPervasives.Events().OnChange(x2,arg10);
       }),(f1(x1),x1)));
       reset=function()
       {
        var x3;
        input.set_Value("");
        x3=Runtime.New(_Result_1,{
         $:0,
         $0:""
        });
        return stateChanged.event.Trigger(x3);
       };
       return[input,reset,stateChanged.event];
      },Formlet1.BuildFormlet(f));
      f2=function(formlet)
      {
       return Formlet1.InitWith("",formlet);
      };
      return f2(x);
     },
     PhotoUploadFrameControl:Runtime.Class({
      get_Body:function()
      {
       var form,_this,x,_this1,_this2,flet,x1,x2,x3,x4,f,f1,f2,f3,f4;
       form=Default.Form(List.ofArray([(_this=Default.Attr(),(x=this.CallbackUrl,_this.NewAttr("action",x))),(_this1=Default.Attr(),_this1.NewAttr("enctype","multipart/form-data")),(_this2=Default.Attr(),_this2.NewAttr("method","POST"))]));
       flet=(x1=(x2=(x3=(x4=Upload.File("photo"),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty("Select photo",arg10);
       },f(x4))),(f1=function(formlet)
       {
        return Upload.setupForm("Upload photo",false,formlet);
       },f1(x3))),(f2=function(formlet)
       {
        return Enhance.WithLegend("Select photo to upload",formlet);
       },f2(x2))),(f3=(f4=function()
       {
        var x5,clo2,f5;
        x5=(clo2=form.Body.submit,clo2(null));
        f5=function(value)
        {
         value;
        };
        return f5(x5);
       },function(formlet)
       {
        return Formlet1.Run(f4,formlet);
       }),f3(x1)));
       return Default.Div(List.ofArray([Default.Img(List.ofArray([Default.Attr().Class("photo-upload-photo"),Default.Src(this.PhotoUrl)])),Operators.add(form,List.ofArray([flet]))]));
      }
     }),
     SetExtensionValidator:function(ext,flet)
     {
      var msg,f,arg00;
      msg="Invalid file extension. Expected extension: "+ext;
      f=(arg00=function(s)
      {
       return Strings.EndsWith(s,ext);
      },function(arg20)
      {
       return Data.Validator().Is(arg00,msg,arg20);
      });
      return f(flet);
     },
     setupForm:function(okLabel,withReset,formlet)
     {
      var buttonClass,addSubmit,x,x1,f,lc,inputRecord,f1;
      buttonClass=Server.Large();
      addSubmit=withReset?function(formlet1)
      {
       return Client1.EnhanceWithCustomSubmitAndResetButtons(buttonClass,okLabel,"Reset",formlet1);
      }:function(formlet1)
      {
       return Client1.EnhanceWithCustomSubmitButton(buttonClass,okLabel,formlet1);
      };
      x=(x1=addSubmit(formlet),(f=(lc=(inputRecord=LabelConfiguration.get_Default(),Runtime.New(LabelConfiguration,{
       Align:{
        $:1
       },
       VerticalAlign:inputRecord.VerticalAlign,
       Placement:inputRecord.Placement
      })),function(formlet1)
      {
       return Enhance.WithLabelConfiguration(lc,formlet1);
      }),f(x1)));
      f1=function(formlet1)
      {
       return Enhance.WithFormContainer(formlet1);
      };
      return f1(x);
     }
    },
    UserControls:{
     AssignUsersToOrganization:Runtime.Class({
      get_Body:function()
      {
       var buttonClass,formPH,invitationF,errors,buttons,x11,ff,x12,_this=this;
       if(this.Organization.$==0)
        {
         return Default.Div(Runtime.New(T,{
          $:0
         }));
        }
       else
        {
         buttonClass=Server.Small();
         formPH=Default.Div(List.ofArray([Default.Attr().Class("assign-authors-to-organization-form")]));
         invitationF=function()
         {
          var existingUsernameF,_builder_,typeSelector,x8,x9,xa,_builder_1,fc,fd,submitConf,inputRecord2,Class,arg0,resetConf,inputRecord3,Class1,arg01,fe;
          existingUsernameF=(_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           var x,x1,x2,x3,f,arg00,f1,f2,f3;
           return _builder_.Bind((x=(x1=(x2=(x3=Controls.Input(""),(f=(arg00=function(s)
           {
            return s.length>1;
           },function(arg20)
           {
            return Data.Validator().Is(arg00,"Must enter at least 2 characters",arg20);
           }),f(x3))),(f1=function(formlet)
           {
            return Enhance.WithValidationIcon(formlet);
           },f1(x2))),(f2=function(formlet)
           {
            return Enhance.WithTextLabel("Last name",formlet);
           },f2(x1))),(f3=function(formlet)
           {
            return Enhance.WithCssClass("name",formlet);
           },f3(x))),function(_arg59)
           {
            var a;
            return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:51",[_arg59]),Formlet2.LoadingFormlet(a)),function(_arg58)
            {
             var names,_names,x4,x5,x6,x7,f4,arg001,f5,f6,f7;
             names=_arg58.$==1?List.ofArray([["[No matches]",""]]):(_names=_arg58.$0,Seq.length(_names)>0?_names:List.ofArray([["[No matches]",""]]));
             return _builder_.Bind((x4=(x5=(x6=(x7=Controls.Select(0,names),(f4=(arg001=function(s)
             {
              return s!=="";
             },function(arg20)
             {
              return Data.Validator().Is(arg001,"Must select a user",arg20);
             }),f4(x7))),(f5=function(formlet)
             {
              return Enhance.WithValidationIcon(formlet);
             },f5(x6))),(f6=function(formlet)
             {
              return Enhance.WithTextLabel("User",formlet);
             },f6(x5))),(f7=function(formlet)
             {
              return Enhance.WithCssClass("user",formlet);
             },f7(x4))),function(_arg57)
             {
              return _builder_.Return(_arg57);
             });
            });
           });
          }));
          typeSelector=List.ofArray([["Existing",true],["New",false]]);
          x8=(x9=(xa=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
          {
           var x,f;
           return _builder_1.Bind((x=Controls.Select(0,typeSelector),(f=function(formlet)
           {
            return Enhance.WithCssClass("type",formlet);
           },f(x))),function(_arg61)
           {
            var _builder_2,newPersonF,xc,xd,xe,xf,f9,lc,inputRecord,Placement,x10,fa,lc1,inputRecord1,Placement1,fb,_builder_3;
            return _builder_1.Bind(_arg61?(_builder_2=Formlet1.Do(),_builder_2.Delay(function()
            {
             var x1,x2,x3,x4,f1,arg00,f2,f3,f4;
             return _builder_2.Bind((x1=(x2=(x3=(x4=Controls.Input(""),(f1=(arg00=function(s)
             {
              return s.length>1;
             },function(arg20)
             {
              return Data.Validator().Is(arg00,"Must enter at least 2 characters",arg20);
             }),f1(x4))),(f2=function(formlet)
             {
              return Enhance.WithValidationIcon(formlet);
             },f2(x3))),(f3=function(formlet)
             {
              return Enhance.WithTextLabel("Last name",formlet);
             },f3(x2))),(f4=function(formlet)
             {
              return Enhance.WithCssClass("name",formlet);
             },f4(x1))),function(_arg64)
             {
              var a;
              return _builder_2.Bind((a=Remoting.Async("IntelliFactory.Trainings:51",[_arg64]),Formlet2.LoadingFormlet(a)),function(_arg63)
              {
               var names,_names,x5,x6,x7,xb,f5,arg001,f6,f7,f8;
               names=_arg63.$==1?List.ofArray([["[No matches]",""]]):(_names=_arg63.$0,Seq.length(_names)>0?_names:List.ofArray([["[No matches]",""]]));
               return _builder_2.Bind((x5=(x6=(x7=(xb=Controls.Select(0,names),(f5=(arg001=function(s)
               {
                return s!=="";
               },function(arg20)
               {
                return Data.Validator().Is(arg001,"Must select a user",arg20);
               }),f5(xb))),(f6=function(formlet)
               {
                return Enhance.WithValidationIcon(formlet);
               },f6(x7))),(f7=function(formlet)
               {
                return Enhance.WithTextLabel("User",formlet);
               },f7(x6))),(f8=function(formlet)
               {
                return Enhance.WithCssClass("user",formlet);
               },f8(x5))),function(_arg62)
               {
                return _builder_2.Return({
                 $:0,
                 $0:_arg62
                });
               });
              });
             });
            })):(newPersonF=(xc=Data.$(Data.$(Data.$((xd=Runtime.Tupled(function(tupledArg)
            {
             var username,fname,lname,email;
             username=tupledArg[0];
             fname=tupledArg[1];
             lname=tupledArg[2];
             email=tupledArg[3];
             return function()
             {
              return function(bio)
              {
               return[username,fname,lname,email,bio];
              };
             };
            }),Formlet1.Return(xd)),(xe=Data.$(Data.$(Data.$(Data.$((xf=function(username)
            {
             return function(fname)
             {
              return function(lname)
              {
               return function(email)
               {
                return[username,fname,lname,email];
               };
              };
             };
            },Formlet1.Return(xf)),FwLS.Input("Username","Must enter a username","username")),FwLS.Input("First name","Must enter a first name","firstname")),FwLS.Input("Last name","Must enter a last name","lastname")),FwLS.Input("Email","Must enter an email address","email")),(f9=(lc=(inputRecord=LabelConfiguration.get_Default(),(Placement={
             $:2
            },Runtime.New(LabelConfiguration,{
             Align:inputRecord.Align,
             VerticalAlign:inputRecord.VerticalAlign,
             Placement:Placement
            }))),function(formlet)
            {
             return Enhance.WithLabelConfiguration(lc,formlet);
            }),f9(xe)))),Formlet1.OfElement(function()
            {
             return Default.Div(List.ofArray([Default.Attr().Class("separator")]));
            })),(x10=FwLS.TextArea("Bio","Must enter author's bio","bio"),(fa=(lc1=(inputRecord1=LabelConfiguration.get_Default(),(Placement1={
             $:2
            },Runtime.New(LabelConfiguration,{
             Align:inputRecord1.Align,
             VerticalAlign:inputRecord1.VerticalAlign,
             Placement:Placement1
            }))),function(formlet)
            {
             return Enhance.WithLabelConfiguration(lc1,formlet);
            }),fa(x10)))),(fb=function(formlet)
            {
             return Formlet1.Horizontal(formlet);
            },fb(xc))),(_builder_3=Formlet1.Do(),_builder_3.Delay(function()
            {
             return _builder_3.Bind(newPersonF,Runtime.Tupled(function(_arg66)
             {
              var username,lname,fname,email,bio,newAuthor,x1,f1;
              username=_arg66[0];
              lname=_arg66[2];
              fname=_arg66[1];
              email=_arg66[3];
              bio=_arg66[4];
              newAuthor={
               FirstName:fname,
               LastName:lname,
               Username:username,
               Email:email,
               Biography:bio
              };
              return _builder_3.Bind((x1=Remoting.Async("IntelliFactory.Trainings:49",[newAuthor]),(f1=function(a)
              {
               return Formlet2.LoadingFormletWithLogin(a);
              },f1(x1))),function(_arg65)
              {
               var response,msg,_builder_4,x2;
               response=_arg65.$==1?(msg=_arg65.$0,(_builder_4=Formlet1.Do(),_builder_4.Delay(function()
               {
                return _builder_4.Bind(Formlet1.OfElement(function()
                {
                 return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(msg)]));
                }),function()
                {
                 return _builder_4.ReturnFrom(Formlet1.Never());
                });
               }))):(x2={
                $:1,
                $0:{
                 FirstName:fname,
                 LastName:lname,
                 Username:username,
                 Email:email,
                 Biography:bio
                }
               },Formlet1.Return(x2));
               return _builder_3.ReturnFrom(response);
              });
             }));
            }))),function(_arg60)
            {
             return _builder_1.Return(_arg60);
            });
           });
          })),(fc=function(formlet)
          {
           return Enhance.WithLegend("User",formlet);
          },fc(xa))),(fd=(submitConf=(inputRecord2=FormButtonConfiguration.get_Default(),(Class=(arg0=Server.Large(),{
           $:1,
           $0:arg0
          }),Runtime.New(FormButtonConfiguration,{
           Label:{
            $:1,
            $0:"Assign"
           },
           Style:inputRecord2.Style,
           Class:Class
          }))),(resetConf=(inputRecord3=FormButtonConfiguration.get_Default(),(Class1=(arg01=Server.Large(),{
           $:1,
           $0:arg01
          }),Runtime.New(FormButtonConfiguration,{
           Label:{
            $:1,
            $0:"Reset"
           },
           Style:inputRecord3.Style,
           Class:Class1
          }))),function(formlet)
          {
           return Enhance.WithCustomSubmitAndResetButtons(submitConf,resetConf,formlet);
          })),fd(x9)));
          fe=function(formlet)
          {
           return Enhance.WithFormContainer(formlet);
          };
          return fe(x8);
         };
         errors=Default.Div(Runtime.New(T,{
          $:0
         }));
         buttons=Default.Div(List.ofArray([(x11=Operators.add(Default.A(List.ofArray([Default.Attr().Class(buttonClass)])),List.ofArray([Default.Text("New")])),(ff=(x12=function()
         {
          return function()
          {
           var x,x1,_builder_,f1,f2,f3;
           x=(x1=(_builder_=Formlet1.Do(),_builder_.Delay(function()
           {
            return _builder_.Bind(invitationF(null),function(_arg69)
            {
             var newAuthor,_builder_1,username;
             return _builder_.Bind(_arg69.$==1?(newAuthor=_arg69.$0,(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
             {
              var x2,f;
              return _builder_1.Bind((x2=Remoting.Async("IntelliFactory.Trainings:50",[newAuthor]),(f=function(a)
              {
               return Formlet2.LoadingFormletWithLogin(a);
              },f(x2))),function(_arg70)
              {
               var response,msg,_builder_2,matchValue,msg1,_builder_3;
               response=_arg70.$==1?(msg=_arg70.$0,(_builder_2=Formlet1.Do(),_builder_2.Delay(function()
               {
                return _builder_2.Bind(Formlet1.OfElement(function()
                {
                 return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(msg)]));
                }),function()
                {
                 return _builder_2.ReturnFrom(Formlet1.Never());
                });
               }))):(matchValue=Remoting.Call("IntelliFactory.Trainings:122",[newAuthor.Username,newAuthor.Biography]),matchValue.$==1?(msg1=matchValue.$0,(_builder_3=Formlet1.Do(),_builder_3.Delay(function()
               {
                return _builder_3.Bind(Formlet1.OfElement(function()
                {
                 return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(msg1)]));
                }),function()
                {
                 return _builder_3.ReturnFrom(Formlet1.Never());
                });
               }))):Formlet1.Return(newAuthor.Username));
               return _builder_1.ReturnFrom(response);
              });
             }))):(username=_arg69.$0,Formlet1.Return(username)),function(_arg68)
             {
              var res,matchValue,msg,_builder_2;
              res=(matchValue=Remoting.Call("IntelliFactory.Trainings:53",[_this.Organization.$0,List.ofArray([_arg68])]),matchValue.$==1?(msg=matchValue.$0,(_builder_2=Formlet1.Do(),_builder_2.Delay(function()
              {
               return _builder_2.Bind(Formlet1.OfElement(function()
               {
                return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("error")])),List.ofArray([Default.Text(msg)]));
               }),function()
               {
                return _builder_2.ReturnFrom(Formlet1.Never());
               });
              }))):(location.href=location.href,Formlet1.Return(null)));
              return _builder_.ReturnFrom(res);
             });
            });
           })),(f1=(f2=function()
           {
            return null;
           },function(formlet)
           {
            return Formlet1.Run(f2,formlet);
           }),f1(x1)));
           f3=function(form)
           {
            formPH["HtmlProvider@32"].Clear(formPH.Body);
            return formPH.AppendI(form);
           };
           return f3(x);
          };
         },function(arg10)
         {
          return EventsPervasives.Events().OnClick(x12,arg10);
         }),(ff(x11),x11)))]));
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("invitations")])),List.ofArray([buttons,formPH,errors]));
        }
      }
     }),
     AuthorProfileForm:Runtime.Class({
      get_Body:function()
      {
       var toAuthorProfileData,out,tags,matchValue,e,f,form,x,x1,f1,x2,f2,x3,f3,x4,x5,f4,f5,f6,_builder_,_this=this;
       toAuthorProfileData=function(bio)
       {
        return function(paypalEmail)
        {
         return function(blogUrl)
         {
          return function(blogDefaultTags)
          {
           return{
            Biography:bio,
            PaypalEmail:paypalEmail,
            BlogUrl:blogUrl,
            BlogDefaultTags:blogDefaultTags
           };
          };
         };
        };
       };
       out=Default.Div(Runtime.New(T,{
        $:0
       }));
       tags=(matchValue=this.trainerData.BlogDefaultTags,matchValue.$==1?matchValue.$1.$==0?(e=matchValue.$0,e):(f=function(a)
       {
        return function(b)
        {
         return a+", "+b;
        };
       },Seq.reduce(f,matchValue)):"");
       form=(x=Data.$(Data.$(Data.$(Data.$(Formlet1.Return(toAuthorProfileData),(x1=Controls.TextArea(this.trainerData.Biography),(f1=function(formlet)
       {
        return Enhance.WithTextLabel("Biography",formlet);
       },f1(x1)))),(x2=Controls.Input(this.trainerData.PaypalEmail),(f2=function(formlet)
       {
        return Enhance.WithTextLabel("PayPal email",formlet);
       },f2(x2)))),(x3=Controls.Input(this.trainerData.BlogUrl),(f3=function(formlet)
       {
        return Enhance.WithTextLabel("Blog RSS URL",formlet);
       },f3(x3)))),(x4=(x5=Controls.Input(tags),(f4=function(formlet)
       {
        return Enhance.WithTextLabel("Default blog tags",formlet);
       },f4(x5))),(f5=function(formlet)
       {
        return Formlet1.Map(function(s)
        {
         return Client2.ParseTags(s);
        },formlet);
       },f5(x4)))),(f6=function(formlet)
       {
        return UserControls.SetupForm("Update profile",true,formlet);
       },f6(x)));
       _builder_=Formlet1.Do();
       return _builder_.Delay(function()
       {
        return _builder_.Bind(form,function(_arg86)
        {
         var matchValue1,username;
         return _builder_.Bind(Formlet2.LoadingFormlet((matchValue1=_this.usernameToUpdate,matchValue1.$==1?(username=matchValue1.$0,Remoting.Async("IntelliFactory.Trainings:116",[username,_arg86])):Remoting.Async("IntelliFactory.Trainings:115",[_arg86]))),function(_arg85)
         {
          return _builder_.ReturnFrom(_arg85?FormletHelpers.SuccessF("Your profile has been successfully updated."):FormletHelpers.ErrorF("You seem to have been disconnected.\nPlease log in again."));
         });
        });
       });
      }
     }),
     Confirm:function(sett)
     {
      var f;
      f=function()
      {
       var state,conf,returnVal,dialog,el,x,x1,x2,x3,f1,f2,x4,f3,f4,f5,f6,f7,f8,arg0;
       state=_FSharpEvent_1.New();
       conf=(returnVal=[DialogConfiguration.New()],(null,returnVal[0].modal=true,returnVal[0].dialogClass="dialog",returnVal[0].title=sett.Title,returnVal[0]));
       dialog={
        contents:{
         $:0
        }
       };
       el=Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text(sett.Message)])),(x=(x1=(x2=List.ofArray([(x3=UserControls.SmallButton(sett.YesLabel),(f1=(f2=function()
       {
        return true;
       },function(formlet)
       {
        return Formlet1.Map(f2,formlet);
       }),f1(x3))),(x4=UserControls.SmallButton(sett.NoLabel),(f3=(f4=function()
       {
        return false;
       },function(formlet)
       {
        return Formlet1.Map(f4,formlet);
       }),f3(x4)))]),(f5=function(fs)
       {
        return Formlet1.Choose(fs);
       },f5(x2))),(f6=function(formlet)
       {
        return Formlet1.Horizontal(formlet);
       },f6(x1))),(f7=(f8=function(confirmed)
       {
        var matchValue,d,x5;
        matchValue=dialog.contents;
        if(matchValue.$==0)
         {
          return null;
         }
        else
         {
          d=matchValue.$0;
          if(confirmed)
           {
            x5=Runtime.New(_Result_1,{
             $:0,
             $0:true
            });
            state.event.Trigger(x5);
           }
          return jQuery(d.element.Body).dialog("close");
         }
       },function(formlet)
       {
        return Formlet1.Run(f8,formlet);
       }),f7(x)))]));
       dialog.contents=(arg0=Dialog.New1(el,conf),{
        $:1,
        $0:arg0
       });
       return[Default.Div(List.ofArray([dialog.contents.$0])),function(value)
       {
        value;
       },state.event];
      };
      return Formlet1.BuildFormlet(f);
     },
     CreateAuthorProfileButtonByUsername:Runtime.Class({
      get_Body:function()
      {
       var buttonClass,errorPanel,button,x,f,x1,_this=this;
       buttonClass=Server.Small();
       errorPanel=Default.Div(Runtime.New(T,{
        $:0
       }));
       button=(x=Operators.add(Default.A(List.ofArray([Default.Attr().Class(buttonClass)])),List.ofArray([Default.Text("Create")])),(f=(x1=function()
       {
        return function()
        {
         var matchValue,msg,objectArg,arg00,objectArg1,arg001;
         matchValue=Remoting.Call("IntelliFactory.Trainings:120",[_this.Username]);
         if(matchValue.$==1)
          {
           msg=matchValue.$0;
           errorPanel["HtmlProvider@32"].Clear(errorPanel.Body);
           objectArg=errorPanel["HtmlProvider@32"];
           (arg00=errorPanel.Body,function(arg10)
           {
            return objectArg.AddClass(arg00,arg10);
           })("error");
           return errorPanel.AppendI(Default.Text(msg));
          }
         else
          {
           errorPanel["HtmlProvider@32"].Clear(errorPanel.Body);
           objectArg1=errorPanel["HtmlProvider@32"];
           (arg001=errorPanel.Body,function(arg10)
           {
            return objectArg1.RemoveClass(arg001,arg10);
           })("error");
           location.href=_this.EditProfileUrl;
          }
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(x1,arg10);
       }),(f(x),x)));
       return Default.Div(List.ofArray([button,errorPanel]));
      }
     }),
     DeveloperForm:Runtime.Class({
      get_Body:function()
      {
       var isPublicForm,x,f,headerForm,x1,x2,x3,f1,arg00,f2,f3,descriptionForm,x5,x6,x7,f4,f5,f6,techForm,x8,x9,f7,f8,schoolsForm,xa,xb,f9,fa,workplaceForm,xc,xd,fb,fc,form,xe,xf,x10,x11,fd,lc,inputRecord,VerticalAlign,fe,ff,f10,_builder_,_this=this;
       isPublicForm=(x=Controls.Checkbox(this.devInfo.ShowInPublicSearches),(f=function(formlet)
       {
        return Enhance.WithTextLabel("Is Public?",formlet);
       },f(x)));
       headerForm=(x1=(x2=(x3=Controls.Input(this.devInfo.DescriptionSummary),(f1=(arg00=function(x4)
       {
        return x4.length<=32;
       },function(arg20)
       {
        return Data.Validator().Is(arg00,"Maximum 32 characters is allowed.",arg20);
       }),f1(x3))),(f2=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f2(x2))),(f3=function(formlet)
       {
        return Enhance.WithTextLabel("Short headline",formlet);
       },f3(x1)));
       descriptionForm=(x5=(x6=(x7=Controls.TextArea(this.devInfo.Description),(f4=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter your short developer bio",arg10);
       },f4(x7))),(f5=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f5(x6))),(f6=function(formlet)
       {
        return Enhance.WithTextLabel("Developer biography",formlet);
       },f6(x5)));
       techForm=(x8=(x9=UserControls.DeveloperTagRankForm(this.devInfo.TagRanks),(f7=function(formlet)
       {
        return Enhance.WithCssClass("technology-rank",formlet);
       },f7(x9))),(f8=function(formlet)
       {
        return Enhance.WithTextLabel("Skills",formlet);
       },f8(x8)));
       schoolsForm=(xa=(xb=UserControls.SchoolForms(this.devInfo.Schools),(f9=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f9(xb))),(fa=function(formlet)
       {
        return Enhance.WithTextLabel("Education",formlet);
       },fa(xa)));
       workplaceForm=(xc=(xd=UserControls.WorkPlaceForms(this.devInfo.Workplaces),(fb=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },fb(xd))),(fc=function(formlet)
       {
        return Enhance.WithTextLabel("Workplaces",formlet);
       },fc(xc)));
       form=(xe=(xf=(x10=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x11=function(isPub)
       {
        return function(descrSummary)
        {
         return function(desc)
         {
          return function(ts)
          {
           return function(schools)
           {
            return function(wps)
            {
             return Runtime.New(DeveloperProfileUpdateData,{
              ShowInPublicSearches:isPub,
              DescriptionSummary:descrSummary,
              Description:desc,
              TagRanks:ts,
              Schools:schools,
              Workplaces:wps
             });
            };
           };
          };
         };
        };
       },Formlet1.Return(x11)),isPublicForm),headerForm),descriptionForm),techForm),schoolsForm),workplaceForm),(fd=(lc=(inputRecord=LabelConfiguration.get_Default(),(VerticalAlign={
        $:0
       },Runtime.New(LabelConfiguration,{
        Align:inputRecord.Align,
        VerticalAlign:VerticalAlign,
        Placement:inputRecord.Placement
       }))),function(formlet)
       {
        return Enhance.WithLabelConfiguration(lc,formlet);
       }),fd(x10))),(fe=function(formlet)
       {
        return UserControls.SetupForm("Update Profile",true,formlet);
       },fe(xf))),(ff=(f10=function(el)
       {
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("edit-developer")])),List.ofArray([el]));
       },function(formlet)
       {
        return Formlet1.MapElement(f10,formlet);
       }),ff(xe)));
       _builder_=Formlet1.Do();
       return _builder_.Delay(function()
       {
        return _builder_.Bind(form,function(_arg94)
        {
         var matchValue,username;
         return _builder_.Bind(Formlet2.LoadingFormlet((matchValue=_this.usernameToUpdate,matchValue.$==1?(username=matchValue.$0,Remoting.Async("IntelliFactory.Trainings:114",[username,_arg94])):Remoting.Async("IntelliFactory.Trainings:113",[_arg94]))),function(_arg93)
         {
          return _builder_.ReturnFrom(_arg93?FormletHelpers.SuccessF("Your profile has been successfully updated."):FormletHelpers.ErrorF("You seem to have been disconnected.\nPlease log in again."));
         });
        });
       });
      }
     }),
     DeveloperTagRankForm:function(techRanks)
     {
      var techLabels,rankLabels,techForm,patternInput1,xs,xa,fa,mapping1,fb,rest,first,xb;
      techLabels=List.ofArray(["F#"]);
      rankLabels=List.ofArray([["Beginner",0],["Intermediate",1],["Advanced",2],["Expert",3]]);
      techForm=function(techRankOpt)
      {
       var patternInput,tagRank,rank,label,labelForm,x,x1,f,f1,arg00,rankForm,x3,x4,x5,x6,f2,mapping,f3,list1,f4,def,f5,arg001,f6,f7,x7,x8,x9,f8,f9;
       patternInput=techRankOpt.$==0?["",-1]:(tagRank=techRankOpt.$0,[tagRank.Tag,tagRank.Rank]);
       rank=patternInput[1];
       label=patternInput[0];
       labelForm=(x=(x1=Controls.Input(label),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty("Enter a Non Empty Label",arg10);
       },f(x1))),(f1=(arg00=function(x2)
       {
        return x2.length<32;
       },function(arg20)
       {
        return Data.Validator().Is(arg00,"Maximum 32 characters.",arg20);
       }),f1(x)));
       rankForm=(x3=(x4=(x5=(x6=(f2=(mapping=Runtime.Tupled(function(tupledArg)
       {
        var l,v;
        l=tupledArg[0];
        v=tupledArg[1];
        return[l,{
         $:1,
         $0:v
        }];
       }),function(list)
       {
        return List.map(mapping,list);
       }),f2(rankLabels)),(f3=(list1=List.ofArray([["Select Level",{
        $:0
       }]]),function(list2)
       {
        return List.append(list1,list2);
       }),f3(x6))),(f4=(def=rank+1,function(vls)
       {
        return Controls.Select(def,vls);
       }),f4(x5))),(f5=(arg001=function(option)
       {
        return option.$==1;
       },function(arg20)
       {
        return Data.Validator().Is(arg001,"Select a level",arg20);
       }),f5(x4))),(f6=(f7=function(x2)
       {
        return x2.$0;
       },function(formlet)
       {
        return Formlet1.Map(f7,formlet);
       }),f6(x3)));
       x7=(x8=Data.$(Data.$((x9=function(label1)
       {
        return function(rank1)
        {
         return{
          Tag:label1,
          IsMaster:false,
          Rank:rank1
         };
        };
       },Formlet1.Return(x9)),labelForm),rankForm),(f8=function(formlet)
       {
        return Formlet1.Horizontal(formlet);
       },f8(x8)));
       f9=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       };
       return f9(x7);
      };
      patternInput1=techRanks.$==0?[{
       $:0
      },Runtime.New(T,{
       $:0
      })]:(xs=techRanks.$1,(xa=techRanks.$0,[{
       $:1,
       $0:xa
      },(fa=(mapping1=(fb=function(arg0)
      {
       return{
        $:1,
        $0:arg0
       };
      },function(x)
      {
       return techForm(fb(x));
      }),function(list)
      {
       return List.map(mapping1,list);
      }),fa(xs))]));
      rest=patternInput1[1];
      first=patternInput1[0];
      return Data.$(Data.$((xb=function(x)
      {
       return function(xs1)
       {
        return Runtime.New(T,{
         $:1,
         $0:x,
         $1:xs1
        });
       };
      },Formlet1.Return(xb)),techForm(first)),Formlet2.Many(techForm({
       $:0
      }),rest));
     },
     Invitations:Runtime.Class({
      get_Body:function()
      {
       var buttonClass,invitations,invs,formPH,invitationF,x1,x2,x3,x4,x5,x6,x7,x8,f,f1,f2,f3,f4,f5,buttonConf,inputRecord,Class,arg0,f6,buttons,x9,f7,xa,_this=this;
       buttonClass=Server.Small();
       invitations=(this._Author.$==0?true:this._Author.$0.Trainer.$==0)?Default.Div(Runtime.New(T,{
        $:0
       })):(invs=Remoting.Call("IntelliFactory.Trainings:76",[this._Author.$0.Username]),Operators.add(Default.Div(List.ofArray([Default.Attr().Class("invitations-list")])),Seq.toList(Seq.delay(function()
       {
        return Seq.collect(function(inv)
        {
         var status,x;
         status=inv.IsSignedUp?"Signed up already":inv.IsUsed?"Accepted":"No response yet";
         return[Default.Div(List.ofArray([Operators.add(Default.Span(List.ofArray([Default.Attr().Class("invitation-email")])),List.ofArray([Default.Text(inv.Email)])),Operators.add(Default.Span(List.ofArray([Default.Attr().Class("invitation-date")])),List.ofArray([(x="Sent on "+inv.CreationDate+".",Default.Text(x))])),Operators.add(Default.Span(List.ofArray([Default.Attr().Class("tag")])),List.ofArray([Default.Text(status)])),Default.Span(List.ofArray([Default.Attr().Class("closer")]))]))];
        },invs);
       }))));
       formPH=Default.Div(List.ofArray([Default.Attr().Class("invitations-form")]));
       invitationF=(x1=(x2=(x3=Data.$((x4=function(emails)
       {
        return emails;
       },Formlet1.Return(x4)),(x5=(x6=(x7=(x8=Controls.Input(""),(f=Data.Validator().IsEmail("You must enter a valid email address"),f(x8))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x7))),(f2=function(formlet)
       {
        return Enhance.WithTextLabel("Email address",formlet);
       },f2(x6))),(f3=function(formlet)
       {
        return Enhance.Many(formlet);
       },f3(x5)))),(f4=function(formlet)
       {
        return Enhance.WithLegend("Send to",formlet);
       },f4(x3))),(f5=(buttonConf=(inputRecord=FormButtonConfiguration.get_Default(),(Class=(arg0=Server.Large(),{
        $:1,
        $0:arg0
       }),Runtime.New(FormButtonConfiguration,{
        Label:{
         $:1,
         $0:"Send"
        },
        Style:inputRecord.Style,
        Class:Class
       }))),function(formlet)
       {
        return Enhance.WithCustomSubmitButton(buttonConf,formlet);
       }),f5(x2))),(f6=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f6(x1)));
       buttons=(this._Author.$==0?true:this._Author.$0.Trainer.$==0)?Default.Div(Runtime.New(T,{
        $:0
       })):Operators.add(Default.Div(List.ofArray([Default.Attr().Class("dashboard-buttons")])),List.ofArray([(x9=Operators.add(Default.A(List.ofArray([Default.Attr().Class(buttonClass)])),List.ofArray([Default.Text("New")])),(f7=(xa=function()
       {
        return function()
        {
         var x,f8,f9,fc;
         x=(f8=(f9=function(emails)
         {
          var fa,action;
          Remoting.Call("IntelliFactory.Trainings:52",[_this._Author.$0.Trainer.$0,emails]);
          formPH["HtmlProvider@32"].Clear(formPH.Body);
          fa=(action=function(email)
          {
           var xb,fb;
           xb=Default.Div(List.ofArray([Operators.add(Default.Span(List.ofArray([Default.Attr().Class("invitation-email")])),List.ofArray([Default.Text(email)])),Operators.add(Default.Span(List.ofArray([Default.Attr().Class("invitation-date")])),List.ofArray([Default.Text("Sent just now.")])),Operators.add(Default.Span(List.ofArray([Default.Attr().Class("tag")])),List.ofArray([Default.Text("Refresh to show")])),Default.Span(List.ofArray([Default.Attr().Class("closer")]))]));
           fb=function(el)
           {
            return invitations.AppendI(el);
           };
           return fb(xb);
          },function(source)
          {
           return Seq.iter(action,source);
          });
          return fa(emails);
         },function(formlet)
         {
          return Formlet1.Run(f9,formlet);
         }),f8(invitationF));
         fc=function(form)
         {
          formPH["HtmlProvider@32"].Clear(formPH.Body);
          return formPH.AppendI(form);
         };
         return fc(x);
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(xa,arg10);
       }),(f7(x9),x9)))]));
       return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("invitations")])),List.ofArray([buttons,formPH,invitations]));
      }
     }),
     LargeButton:function(label)
     {
      return Controls.ElementButton(function()
      {
       var arg00;
       return Operators.add(Default.A(List.ofArray([Default.HRef("javascript:void();"),(arg00=Server.Large(),Default.Attr().Class(arg00))])),List.ofArray([Default.Text(label)]));
      });
     },
     Login:Runtime.Class({
      get_Body:function()
      {
       var email,x,x1,f,f1,password,x2,x3,f2,f3,form,x4,x5,x6,x7,f4,buttonConf,inputRecord,Class,arg0,f5,f6,x8,_builder_,_this=this,f7;
       email=(x=(x1=Controls.Input(""),(f=function(formlet)
       {
        return Enhance.WithTextLabel("Username",formlet);
       },f(x1))),(f1=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter your username or email address",arg10);
       },f1(x)));
       password=(x2=(x3=Controls.Password(""),(f2=function(formlet)
       {
        return Enhance.WithTextLabel("Password",formlet);
       },f2(x3))),(f3=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter your password",arg10);
       },f3(x2)));
       form=(x4=(x5=(x6=Data.$(Data.$((x7=function(emailOrUsername)
       {
        return function(password1)
        {
         return[emailOrUsername,password1];
        };
       },Formlet1.Return(x7)),email),password),(f4=(buttonConf=(inputRecord=FormButtonConfiguration.get_Default(),(Class=(arg0=Server.Large(),{
        $:1,
        $0:arg0
       }),Runtime.New(FormButtonConfiguration,{
        Label:{
         $:1,
         $0:"Login"
        },
        Style:inputRecord.Style,
        Class:Class
       }))),function(formlet)
       {
        return Enhance.WithCustomSubmitButton(buttonConf,formlet);
       }),f4(x6))),(f5=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f5(x5))),(f6=function(formlet)
       {
        return Enhance1.SubmitOnEnter(formlet);
       },f6(x4)));
       return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("content login")])),List.ofArray([(x8=List.ofArray([(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        return _builder_.Bind(form,Runtime.Tupled(function(_arg52)
        {
         var password1,emailOrUsername;
         password1=_arg52[1];
         emailOrUsername=_arg52[0];
         return _builder_.Bind(Formlet2.LoadingFormlet(Remoting.Async("IntelliFactory.Trainings:107",[emailOrUsername,password1])),function(_arg51)
         {
          var msg;
          return _builder_.ReturnFrom(_arg51.$==1?(msg=_arg51.$0,FormletHelpers.ErrorF(msg)):(location.href=_this.SuccessUrl,FormletHelpers.SuccessF("Login successful, redirecting")));
         });
        }));
       }))]),(f7=function(x9)
       {
        return Default.Div(x9);
       },f7(x8)))]));
      }
     }),
     LogoutForUsername:Runtime.Class({
      get_Body:function()
      {
       var x,f,x1,_this=this;
       x=Operators.add(Default.A(List.ofArray([Default.HRef("#")])),List.ofArray([Default.Text("Log Out")]));
       f=(x1=function()
       {
        return function()
        {
         var x2,f1;
         x2=Remoting.Call("IntelliFactory.Trainings:108",[]);
         f1=function(value)
         {
          value;
         };
         f1(x2);
         location.href=_this.mainPage;
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(x1,arg10);
       });
       f(x);
       return x;
      }
     }),
     OAuthProvidersForm:Runtime.Class({
      get_Body:function()
      {
       var removeProvderForm,form,x6,_builder_2,f5,_this2=this;
       removeProvderForm=function(prov)
       {
        var provName,matchValue,n,infoForm,x,f,confMsg,matchValue1,p,x3,x4,x5,_builder_,f2,f3,f4;
        provName=(matchValue=prov.OAuthProviderName,matchValue.$==0?"N/A":(n=matchValue.$0,n));
        infoForm=(x=Formlet1.OfElement(function()
        {
         var x1,_this,x2,_this1;
         return Default.Span(List.ofArray([(x1=List.ofArray([Default.Text(provName)]),(_this=Default.Tags(),_this.NewTag("label",x1))),(x2=List.ofArray([Default.Text(prov.get_DisplayName())]),(_this1=Default.Tags(),_this1.NewTag("label",x2)))]));
        }),(f=function(formlet)
        {
         return Formlet1.InitWith(null,formlet);
        },f(x)));
        confMsg="Do you want to remove association between your "+(matchValue1=prov.OAuthProviderName,matchValue1.$==1?(p=matchValue1.$0,p+" account and your FPish profile?"):"account and your FPish profile?");
        x3=(x4=(x5=(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         return _builder_.Bind(infoForm,function()
         {
          return _builder_.Bind(UserControls.SmallButton("Remove"),function()
          {
           return _builder_.Bind(UserControls.Confirm({
            Title:"Remove associated account",
            Message:confMsg,
            YesLabel:"Yes",
            NoLabel:"No"
           }),function(_arg80)
           {
            var _builder_1,x2;
            return _builder_.ReturnFrom(_arg80?(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
            {
             var x1,f1;
             return _builder_1.Bind((x1=Remoting.Async("IntelliFactory.Trainings:104",[{
              OAuthProviderId:prov.OAuthProviderId,
              OAuthUsername:prov.OAuthUsername,
              OAuthUserDisplayName:prov.OAuthUserDisplayName
             }]),(f1=function(a)
             {
              return Formlet2.LoadingFormlet(a);
             },f1(x1))),function(_arg83)
             {
              return _builder_1.Return(_arg83?{
               $:0
              }:{
               $:1,
               $0:null
              });
             });
            })):(x2={
             $:1,
             $0:null
            },Formlet1.Return(x2)));
           });
          });
         });
        })),(f2=function(formlet)
        {
         return Formlet1.Horizontal(formlet);
        },f2(x5))),(f3=function(formlet)
        {
         return Enhance.WithCssClass("dataRow",formlet);
        },f3(x4)));
        f4=function(formlet)
        {
         return Formlet1.Deletable(formlet);
        };
        return f4(x3);
       };
       form=(x6=(_builder_2=Formlet1.Do(),_builder_2.Delay(function()
       {
        var x,f;
        return _builder_2.Bind((x=Remoting.Async("IntelliFactory.Trainings:103",[]),(f=function(a)
        {
         return Formlet2.LoadingFormlet(a);
        },f(x))),function(_arg84)
        {
         var genElem,x1,x2,f1,f2,f3,f4;
         return _builder_2.ReturnFrom(_arg84.$==0?(genElem=function()
         {
          return Default.Div(List.ofArray([Default.Text("You do not have any associated accounts.")]));
         },Formlet1.OfElement(genElem)):(x1=(x2=(f1=function(list)
         {
          return List.map(removeProvderForm,list);
         },f1(_arg84)),(f2=function(fs)
         {
          return Formlet1.Sequence(fs);
         },f2(x2))),(f3=(f4=function(value)
         {
          value;
         },function(formlet)
         {
          return Formlet1.Map(f4,formlet);
         }),f3(x1))));
        });
       })),(f5=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f5(x6)));
       return Default.Div(Seq.toList(Seq.delay(function()
       {
        return Seq.append([Default.P(List.ofArray([Default.Text("You have the following account providers registered with your account:")]))],Seq.delay(function()
        {
         return Seq.append([form],Seq.delay(function()
         {
          return[Default.P(List.ofArray([Operators.add(Default.A(List.ofArray([Default.HRef(_this2.loginUrl)])),List.ofArray([Default.Text("Add associated accounts")]))]))];
         }));
        }));
       })));
      }
     }),
     OptionsForm:Runtime.Class({
      get_Body:function()
      {
       var form,x,x1,x2,x3,f,x4,f1,x5,f2,x6,f3,matchValue,trainerOpts1,x7,x8,f4,x9,f5,xa,f6,cl,f7,_builder_;
       form=(x=(x1=Data.$(Data.$(Data.$(Data.$(Data.$((x2=function(groups)
       {
        return function(confs)
        {
         return function(questions)
         {
          return function(answers)
          {
           return function(trainerOpts)
           {
            return Runtime.New(UserOptionsDAO,{
             AdvertiseGroups:groups,
             AdvertiseConferences:confs,
             AdvertiseQuestions:questions,
             AdvertiseAnswers:answers,
             TrainerOptions:trainerOpts
            });
           };
          };
         };
        };
       },Formlet1.Return(x2)),(x3=Controls.Checkbox(this.userOptions.AdvertiseGroups),(f=function(formlet)
       {
        return Enhance.WithTextLabel("Announce my new groups",formlet);
       },f(x3)))),(x4=Controls.Checkbox(this.userOptions.AdvertiseConferences),(f1=function(formlet)
       {
        return Enhance.WithTextLabel("Announce my new conferences",formlet);
       },f1(x4)))),(x5=Controls.Checkbox(this.userOptions.AdvertiseQuestions),(f2=function(formlet)
       {
        return Enhance.WithTextLabel("Announce my new questions",formlet);
       },f2(x5)))),(x6=Controls.Checkbox(this.userOptions.AdvertiseAnswers),(f3=function(formlet)
       {
        return Enhance.WithTextLabel("Announce my responses marked as answers",formlet);
       },f3(x6)))),(matchValue=this.userOptions.TrainerOptions,matchValue.$==1?(trainerOpts1=matchValue.$0,Data.$(Data.$((x7=function(events)
       {
        return function(blogs)
        {
         return{
          $:1,
          $0:Runtime.New(TrainerOptionsDAO,{
           AdvertiseEvents:events,
           AdvertiseBlogEntries:blogs
          })
         };
        };
       },Formlet1.Return(x7)),(x8=Controls.Checkbox(trainerOpts1.AdvertiseEvents),(f4=function(formlet)
       {
        return Enhance.WithTextLabel("Announce my new events",formlet);
       },f4(x8)))),(x9=Controls.Checkbox(trainerOpts1.AdvertiseBlogEntries),(f5=function(formlet)
       {
        return Enhance.WithTextLabel("Announce my new blog entries",formlet);
       },f5(x9))))):(xa={
        $:0
       },Formlet1.Return(xa)))),(f6=(cl=Server.Large(),function(formlet)
       {
        return Client1.EnhanceWithSubmitAndResetButtons(cl,formlet);
       }),f6(x1))),(f7=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f7(x)));
       return Default.Div(List.ofArray([Default.P(List.ofArray([Default.Text("Use the following options to automatically announce your activities on the "),Operators.add(Default.A(List.ofArray([Default.HRef("http://twitter.com/fpishnet-news")])),List.ofArray([Default.Text("@fpishnet-news")])),Default.Text(" Twitter account.")])),(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        return _builder_.Bind(form,function(_arg75)
        {
         return _builder_.Bind(Formlet2.LoadingFormletWithLogin(Remoting.Async("IntelliFactory.Trainings:118",[_arg75])),function(_arg74)
         {
          var msg;
          return _builder_.ReturnFrom(_arg74.$==0?FormletHelpers.SuccessF("Your options have been successfully updated."):(msg=_arg74.$0,FormletHelpers.ErrorF(msg)));
         });
        });
       }))]));
      }
     }),
     PasswordForm:Runtime.Class({
      get_Body:function()
      {
       var out,form,x,x1,x2,x3,x4,f,f1,f2,_builder_,f9,_builder_1;
       out=Default.Div(Runtime.New(T,{
        $:0
       }));
       form=(x=Data.$(Data.$((x1=function(oldP)
       {
        return function(newP)
        {
         return[oldP,newP];
        };
       },Formlet1.Return(x1)),(x2=(x3=(x4=Controls.Password(""),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must enter your current password",arg10);
       },f(x4))),(f1=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f1(x3))),(f2=function(formlet)
       {
        return Enhance.WithTextLabel("Current password",formlet);
       },f2(x2)))),(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x5,x6,x7,f3,f4,f5;
        return _builder_.Bind((x5=(x6=(x7=Controls.Password(""),(f3=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must set a password",arg10);
        },f3(x7))),(f4=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f4(x6))),(f5=function(formlet)
        {
         return Enhance.WithTextLabel("New password",formlet);
        },f5(x5))),function(_arg77)
        {
         var x8,x9,xa,f6,f7,f8;
         return _builder_.Bind((x8=(x9=(xa=Controls.Password(""),(f6=function(arg20)
         {
          return Data.Validator().IsEqual(_arg77,"Your confirmed password doesn't match",arg20);
         },f6(xa))),(f7=function(formlet)
         {
          return Enhance.WithValidationIcon(formlet);
         },f7(x9))),(f8=function(formlet)
         {
          return Enhance.WithTextLabel("Confirm password",formlet);
         },f8(x8))),function(_arg76)
         {
          return _builder_.Return(_arg76);
         });
        });
       }))),(f9=function(formlet)
       {
        return UserControls.SetupForm("Change password",true,formlet);
       },f9(x)));
       _builder_1=Formlet1.Do();
       return _builder_1.Delay(function()
       {
        return _builder_1.Bind(form,Runtime.Tupled(function(_arg79)
        {
         var oldP,newP;
         oldP=_arg79[0];
         newP=_arg79[1];
         return _builder_1.Bind(Formlet2.LoadingFormlet(Remoting.Async("IntelliFactory.Trainings:117",[oldP,newP])),function(_arg78)
         {
          return _builder_1.ReturnFrom(_arg78.$==1?FormletHelpers.ErrorF("You have mistyped your current password."):_arg78.$==2?FormletHelpers.SuccessF("Your password has been successfully changed."):FormletHelpers.ErrorF("You seem to have been disconnected.\nPlease log in again."));
         });
        }));
       });
      }
     }),
     PeriodFormlet:function(fromYear,endYear)
     {
      var yearsLabelsValues,x,f,findIx,fromYearF,ix1,x1,x2,x3,x4,f2,mapping,f3,list1,f4,f5,arg00,f6,f7,endYearF,ix2,y1,x5,x6,x7,f8,mapping1,f9,list11,fa,fb,x8,x9,xa,xb,xc,fc,fd,fe,ff;
      yearsLabelsValues=(x=List.init(50,function(i)
      {
       var year;
       year=i+1970;
       return[Global.String(year),year];
      }),(f=function(list)
      {
       return List.rev(list);
      },f(x)));
      findIx=function(year)
      {
       var ixOpt,f1,predicate,ix;
       ixOpt=(f1=(predicate=Runtime.Tupled(function(tupledArg)
       {
        var _arg1,y;
        _arg1=tupledArg[0];
        y=tupledArg[1];
        return y===year;
       }),function(list)
       {
        return Seq.tryFindIndex(predicate,list);
       }),f1(yearsLabelsValues));
       if(ixOpt.$==0)
        {
         return 0;
        }
       else
        {
         ix=ixOpt.$0;
         return ix+1;
        }
      };
      fromYearF=(ix1=findIx(fromYear),(x1=(x2=(x3=(x4=(f2=(mapping=Runtime.Tupled(function(tupledArg)
      {
       var l,v;
       l=tupledArg[0];
       v=tupledArg[1];
       return[l,{
        $:1,
        $0:v
       }];
      }),function(list)
      {
       return List.map(mapping,list);
      }),f2(yearsLabelsValues)),(f3=(list1=List.ofArray([["Choose",{
       $:0
      }]]),function(list2)
      {
       return List.append(list1,list2);
      }),f3(x4))),(f4=function(vls)
      {
       return Controls.Select(ix1,vls);
      },f4(x3))),(f5=(arg00=function(option)
      {
       return option.$==1;
      },function(arg20)
      {
       return Data.Validator().Is(arg00,"Select a start year.",arg20);
      }),f5(x2))),(f6=(f7=function(option)
      {
       return option.$0;
      },function(formlet)
      {
       return Formlet1.Map(f7,formlet);
      }),f6(x1))));
      endYearF=(ix2=endYear.$==0?0:(y1=endYear.$0,findIx(y1)),(x5=(x6=(x7=(f8=(mapping1=Runtime.Tupled(function(tupledArg)
      {
       var l,v;
       l=tupledArg[0];
       v=tupledArg[1];
       return[l,{
        $:1,
        $0:v
       }];
      }),function(list)
      {
       return List.map(mapping1,list);
      }),f8(yearsLabelsValues)),(f9=(list11=List.ofArray([["Present",{
       $:0
      }]]),function(list2)
      {
       return List.append(list11,list2);
      }),f9(x7))),(fa=function(vls)
      {
       return Controls.Select(ix2,vls);
      },fa(x6))),(fb=function(formlet)
      {
       return Enhance.WithTextLabel("To",formlet);
      },fb(x5))));
      x8=(x9=(xa=(xb=Data.$(Data.$((xc=function(fromD)
      {
       return function(endD)
       {
        return[fromD,endD];
       };
      },Formlet1.Return(xc)),fromYearF),endYearF),(fc=function(formlet)
      {
       return Formlet1.Horizontal(formlet);
      },fc(xb))),(fd=function(formlet)
      {
       return Enhance.WithValidationIcon(formlet);
      },fd(xa))),(fe=function(formlet)
      {
       return Enhance.WithFormContainer(formlet);
      },fe(x9)));
      ff=function(formlet)
      {
       return Enhance.WithTextLabel("Period",formlet);
      };
      return ff(x8);
     },
     ResetPassword:Runtime.Class({
      get_Body:function()
      {
       var passwordForm,_builder_,x6,x7,_builder_1,fc,fd;
       passwordForm=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x,x1,x2,f,f1,f2;
        return _builder_.Bind((x=(x1=(x2=Controls.Password(""),(f=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must set a password",arg10);
        },f(x2))),(f1=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f1(x1))),(f2=function(formlet)
        {
         return Enhance.WithLabelAndInfo("Password","Set your password",formlet);
        },f2(x))),function(_arg54)
        {
         var x3,x4,x5,f3,f4,f5;
         return _builder_.Bind((x3=(x4=(x5=Controls.Password(""),(f3=function(arg20)
         {
          return Data.Validator().IsEqual(_arg54,"Your confirmed password doesn't match",arg20);
         },f3(x5))),(f4=function(formlet)
         {
          return Enhance.WithValidationIcon(formlet);
         },f4(x4))),(f5=function(formlet)
         {
          return Enhance.WithLabelAndInfo("Confirm password","Confirm your password",formlet);
         },f5(x3))),function(_arg53)
         {
          return _builder_.Return(_arg53);
         });
        });
       }));
       return Default.Div(List.ofArray([(x6=(x7=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        var x,x1,x2,x3,x4,f,f1,f2,labelGen,f3,buttonConf,inputRecord,Class,arg0,f4;
        return _builder_1.Bind((x=(x1=(x2=(x3=(x4=Controls.Input(""),(f=function(arg10)
        {
         return Data.Validator().IsNotEmpty("You must type your username",arg10);
        },f(x4))),(f1=function(formlet)
        {
         return Enhance.WithValidationIcon(formlet);
        },f1(x3))),(f2=(labelGen=function()
        {
         return Default.Span(List.ofArray([Default.Text("Your username")]));
        },function(formlet)
        {
         return Enhance.WithLabel(labelGen,formlet);
        }),f2(x2))),(f3=(buttonConf=(inputRecord=FormButtonConfiguration.get_Default(),(Class=(arg0=Server.Large(),{
         $:1,
         $0:arg0
        }),Runtime.New(FormButtonConfiguration,{
         Label:{
          $:1,
          $0:"Reset password"
         },
         Style:inputRecord.Style,
         Class:Class
        }))),function(formlet)
        {
         return Enhance.WithCustomSubmitButton(buttonConf,formlet);
        }),f3(x1))),(f4=function(formlet)
        {
         return Enhance.WithFormContainer(formlet);
        },f4(x))),function(_arg56)
        {
         var securityQuestion,question,x5,x8,x9,xa,xb,f5,labelGen1,f6,labelGen2,f7,f8,xc,xd,f9,fa;
         securityQuestion=Remoting.Call("IntelliFactory.Trainings:109",[_arg56]);
         return _builder_1.Bind(securityQuestion.$==1?(question=securityQuestion.$0,(x5=(x8=Data.$((x9=Data.$((xa=Data.$((xb=function()
         {
          return function(answer)
          {
           return function(pass)
           {
            return[answer,pass];
           };
          };
         },Formlet1.Return(xb)),Formlet1.OfElement(function()
         {
          return Default.Div(List.ofArray([Default.Text(question)]));
         })),(f5=(labelGen1=function()
         {
          return Default.Span(List.ofArray([Default.Text("Security question")]));
         },function(formlet)
         {
          return Enhance.WithLabel(labelGen1,formlet);
         }),f5(xa))),Controls.Input("")),(f6=(labelGen2=function()
         {
          return Default.Span(List.ofArray([Default.Text("Security answer")]));
         },function(formlet)
         {
          return Enhance.WithLabel(labelGen2,formlet);
         }),f6(x9))),passwordForm),(f7=function(formlet)
         {
          return Enhance.WithSubmitButton(formlet);
         },f7(x8))),(f8=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },f8(x5)))):(xc=(xd=Formlet1.FailWith(List.ofArray(["No user is registered with this username"])),(f9=function(formlet)
         {
          return Enhance.WithErrorSummary("Error",formlet);
         },f9(xd))),(fa=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },fa(xc))),Runtime.Tupled(function(_arg55)
         {
          var securityAnswer,password,resetAnswer,xe,fb;
          securityAnswer=_arg55[0];
          password=_arg55[1];
          resetAnswer=Remoting.Call("IntelliFactory.Trainings:110",[_arg56,securityAnswer,password]);
          return _builder_1.ReturnFrom((xe=Formlet1.OfElement(function()
          {
           var text;
           text=resetAnswer.$==1?"Incorrect answer to the security question.":resetAnswer.$==0?"Bad username":"Your password has been successfully reset. Please log in now.";
           return Default.P(List.ofArray([Default.Text(text)]));
          }),(fb=function(formlet)
          {
           return Enhance.WithFormContainer(formlet);
          },fb(xe))));
         }));
        });
       })),(fc=function(formlet)
       {
        return Formlet1.Flowlet(formlet);
       },fc(x7))),(fd=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },fd(x6)))]));
      }
     }),
     SchoolForm:function(data)
     {
      var nameF,x,x1,x2,f,f1,f2,degF,x3,f3,fieldsF,x4,x5,x6,f4,f5,f6,yearsF,notesF,x7,f7,x8,x9,xa,f8,f9,fa;
      nameF=(x=(x1=(x2=Controls.Input(data.Name),(f=function(arg10)
      {
       return Data.Validator().IsNotEmpty("Specify a non empty school name.",arg10);
      },f(x2))),(f1=function(formlet)
      {
       return Enhance.WithValidationIcon(formlet);
      },f1(x1))),(f2=function(formlet)
      {
       return Enhance.WithTextLabel("School Name",formlet);
      },f2(x)));
      degF=(x3=Controls.Input(data.Degree),(f3=function(formlet)
      {
       return Enhance.WithTextLabel("Degree",formlet);
      },f3(x3)));
      fieldsF=(x4=(x5=(x6=Controls.Input(data.Field),(f4=function(arg10)
      {
       return Data.Validator().IsNotEmpty("Specify a non empty field of study.",arg10);
      },f4(x6))),(f5=function(formlet)
      {
       return Enhance.WithValidationIcon(formlet);
      },f5(x5))),(f6=function(formlet)
      {
       return Enhance.WithTextLabel("Field(s) of study",formlet);
      },f6(x4)));
      yearsF=UserControls.PeriodFormlet(data.FromYear,data.EndYear);
      notesF=(x7=Controls.TextArea(data.Notes),(f7=function(formlet)
      {
       return Enhance.WithTextLabel("Notes",formlet);
      },f7(x7)));
      x8=(x9=Data.$(Data.$(Data.$(Data.$(Data.$((xa=function(name)
      {
       return function(degree)
       {
        return function(field)
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var fromY,endY;
          fromY=tupledArg[0];
          endY=tupledArg[1];
          return function(notes)
          {
           return Runtime.New(SchoolInfo,{
            Name:name,
            Degree:degree,
            Field:field,
            FromYear:fromY,
            EndYear:endY,
            Notes:notes
           });
          };
         });
        };
       };
      },Formlet1.Return(xa)),nameF),degF),fieldsF),yearsF),notesF),(f8=function(formlet)
      {
       return Formlet1.Vertical(formlet);
      },f8(x9)));
      f9=(fa=function(el)
      {
       return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("school")])),List.ofArray([el]));
      },function(formlet)
      {
       return Formlet1.MapElement(fa,formlet);
      });
      return f9(x8);
     },
     SchoolForms:function(data)
     {
      var x,f,f1,formlet;
      x=(f=function(list)
      {
       return List.map(function(data1)
       {
        return UserControls.SchoolForm(data1);
       },list);
      },f(data));
      f1=(formlet=UserControls.SchoolForm(SchoolInfo.get_Default()),function(init)
      {
       return Formlet2.Many(formlet,init);
      });
      return f1(x);
     },
     SelectedTagsForm:function(tags)
     {
      var tagForm,x4,f3,mapping,f4,f5,formlet1;
      tagForm=function(tag)
      {
       var label,t,x,x1,x2,f,f1,arg00,f2;
       label=tag.$==0?"":(t=tag.$0,t);
       x=(x1=(x2=Controls.Input(label),(f=function(arg10)
       {
        return Data.Validator().IsNotEmpty("Enter a Non Empty Label",arg10);
       },f(x2))),(f1=(arg00=function(x3)
       {
        return x3.length<32;
       },function(arg20)
       {
        return Data.Validator().Is(arg00,"Maximum 32 characters.",arg20);
       }),f1(x1)));
       f2=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       };
       return f2(x);
      };
      x4=(f3=(mapping=(f4=function(arg0)
      {
       return{
        $:1,
        $0:arg0
       };
      },function(x)
      {
       return tagForm(f4(x));
      }),function(list)
      {
       return List.map(mapping,list);
      }),f3(tags));
      f5=(formlet1=tagForm({
       $:0
      }),function(init)
      {
       return Formlet2.Many(formlet1,init);
      });
      return f5(x4);
     },
     SelectedTagsFormOneOrMore:function(tags)
     {
      var patternInput,ts,t,ts1,t1,x,x1,f,f1;
      patternInput=tags.$==1?(ts=tags.$1,(t=tags.$0,[t,ts])):["",Runtime.New(T,{
       $:0
      })];
      ts1=patternInput[1];
      t1=patternInput[0];
      x=Data.$(Data.$((x1=function(t2)
      {
       return function(ts2)
       {
        return Runtime.New(T,{
         $:1,
         $0:t2,
         $1:ts2
        });
       };
      },Formlet1.Return(x1)),Controls.Input(t1)),UserControls.SelectedTagsForm(ts1));
      f=(f1=function(el)
      {
       return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("tags-select")])),List.ofArray([el]));
      },function(formlet)
      {
       return Formlet1.MapElement(f1,formlet);
      });
      return f(x);
     },
     SetupForm:function(okLabel,withReset,formlet)
     {
      var buttonClass,addSubmit,x,x1,f,lc,inputRecord,f1;
      buttonClass=Server.Large();
      addSubmit=withReset?function(formlet1)
      {
       return Client1.EnhanceWithCustomSubmitAndResetButtons(buttonClass,okLabel,"Reset",formlet1);
      }:function(formlet1)
      {
       return Client1.EnhanceWithCustomSubmitButton(buttonClass,okLabel,formlet1);
      };
      x=(x1=addSubmit(formlet),(f=(lc=(inputRecord=LabelConfiguration.get_Default(),Runtime.New(LabelConfiguration,{
       Align:{
        $:1
       },
       VerticalAlign:inputRecord.VerticalAlign,
       Placement:inputRecord.Placement
      })),function(formlet1)
      {
       return Enhance.WithLabelConfiguration(lc,formlet1);
      }),f(x1)));
      f1=function(formlet1)
      {
       return Enhance.WithFormContainer(formlet1);
      };
      return f1(x);
     },
     SmallButton:function(label)
     {
      return Controls.ElementButton(function()
      {
       var arg00;
       return Operators.add(Default.A(List.ofArray([Default.HRef("javascript:void();"),(arg00=Server.Small(),Default.Attr().Class(arg00))])),List.ofArray([Default.Text(label)]));
      });
     },
     UserProfileForm:Runtime.Class({
      get_Body:function()
      {
       var toUserData,_this=this,out,twitterUserName,x,x1,x2,matchValue,name,f,f1,f2,f3,fromStrOpt,billingAddress,addr,matchValue1,a,x4,x5,x6,f4,f5,x7,f6,x8,f7,x9,f8,xa,xb,xc,f9,fa,fb,xd,xe,xf,fc,fd,fe,euTaxAndBilling,taxAndAddr,companyName,x10,x11,x12,x13,x14,ff,f10,f11,f12,taxNum,x15,x16,x17,f13,f14,x18,_builder_,emailForm,x19,x1a,f18,f19,f1a,usernameForm,x1b,x1c,x1d,_builder_1,f1b,f1c,f1d,form,x20,x21,f1e,x22,f1f,x23,f20,x24,f21,x25,f22,x26,f23,x27,x28,x29,f24,f25,f26,x2a,f27,x2b,x2c,x2d,f28,f29,f2a,x2e,x2f,x30,f2b,f2c,f2d,f2e,_builder_2;
       toUserData=function(userName)
       {
        return function(email)
        {
         return function(fn)
         {
          return function(ln)
          {
           return function(comp)
           {
            return function(phone)
            {
             return function(st1)
             {
              return function(st2)
              {
               return function(city)
               {
                return function(state)
                {
                 return function(zip)
                 {
                  return function(country)
                  {
                   return function(twitter)
                   {
                    return function(taxCNAddr)
                    {
                     var patternInput,tn,bcn,ba,tn1,bcn1,ba1,inputRecord;
                     patternInput=taxCNAddr.$==0?[{
                      $:0
                     },{
                      $:0
                     },{
                      $:0
                     }]:(tn=taxCNAddr.$0[2],(bcn=taxCNAddr.$0[0],(ba=taxCNAddr.$0[1],[{
                      $:1,
                      $0:bcn
                     },ba,{
                      $:1,
                      $0:tn
                     }])));
                     tn1=patternInput[1];
                     bcn1=patternInput[0];
                     ba1=patternInput[2];
                     inputRecord=_this.userData;
                     return{
                      Username:userName,
                      Email:email,
                      EmailIsVerified:inputRecord.EmailIsVerified,
                      FirstName:fn,
                      LastName:ln,
                      Company:comp,
                      Phone:phone,
                      Street1:st1,
                      Street2:st2,
                      City:city,
                      State:state,
                      Zip:zip,
                      Country:country,
                      TwitterUsername:twitter,
                      PhotoUrl:inputRecord.PhotoUrl,
                      BillingAddress:ba1,
                      EUTaxNumber:tn1,
                      BillingCompanyName:bcn1,
                      EmailVerificationUrl:inputRecord.EmailVerificationUrl
                     };
                    };
                   };
                  };
                 };
                };
               };
              };
             };
            };
           };
          };
         };
        };
       };
       out=Default.Div(Runtime.New(T,{
        $:0
       }));
       twitterUserName=(x=(x1=(x2=(matchValue=_this.userData.TwitterUsername,matchValue.$==0?"":(name=matchValue.$0,name)),(f=function(value)
       {
        return Controls.Input(value);
       },f(x2))),(f1=function(formlet)
       {
        return Enhance.WithTextLabel("Twitter username",formlet);
       },f1(x1))),(f2=(f3=function(s)
       {
        if(s==="")
         {
          return{
           $:0
          };
         }
        else
         {
          return{
           $:1,
           $0:s
          };
         }
       },function(formlet)
       {
        return Formlet1.Map(f3,formlet);
       }),f2(x)));
       fromStrOpt=function(x3)
       {
        var s;
        if(x3.$==0)
         {
          return"";
         }
        else
         {
          s=x3.$0;
          return s;
         }
       };
       billingAddress=(addr=(matchValue1=_this.userData.BillingAddress,matchValue1.$==0?{
        Street1:"",
        Street2:"",
        Zip:"",
        City:"",
        Country:"",
        State:""
       }:(a=matchValue1.$0,a)),Data.$(Data.$(Data.$(Data.$(Data.$(Data.$((x4=function(s1)
       {
        return function(s2)
        {
         return function(city)
         {
          return function(state)
          {
           return function(zip)
           {
            return function(cntr)
            {
             return{
              Street1:s1,
              Street2:s2,
              Zip:zip,
              City:city,
              Country:cntr,
              State:state
             };
            };
           };
          };
         };
        };
       },Formlet1.Return(x4)),(x5=(x6=Controls.Input(addr.Street1),(f4=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f4(x6))),(f5=function(formlet)
       {
        return Enhance.WithTextLabel("Street address 1",formlet);
       },f5(x5)))),(x7=Controls.Input(addr.Street2),(f6=function(formlet)
       {
        return Enhance.WithTextLabel("Street address 2",formlet);
       },f6(x7)))),(x8=Controls.Input(addr.City),(f7=function(formlet)
       {
        return Enhance.WithTextLabel("City",formlet);
       },f7(x8)))),(x9=Controls.Input(addr.State),(f8=function(formlet)
       {
        return Enhance.WithTextLabel("State",formlet);
       },f8(x9)))),(xa=(xb=(xc=Controls.Input(addr.Zip),(f9=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your zip code",arg10);
       },f9(xc))),(fa=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },fa(xb))),(fb=function(formlet)
       {
        return Enhance.WithTextLabel("Zip code",formlet);
       },fb(xa)))),(xd=(xe=(xf=Controls.Input(addr.Country),(fc=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your country",arg10);
       },fc(xf))),(fd=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },fd(xe))),(fe=function(formlet)
       {
        return Enhance.WithTextLabel("Country",formlet);
       },fe(xd)))));
       euTaxAndBilling=(taxAndAddr=(companyName=(x10=(x11=(x12=(x13=(x14=_this.userData.BillingCompanyName,fromStrOpt(x14)),(ff=function(value)
       {
        return Controls.Input(value);
       },ff(x13))),(f10=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your company name",arg10);
       },f10(x12))),(f11=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f11(x11))),(f12=function(formlet)
       {
        return Enhance.WithTextLabel("Company Name",formlet);
       },f12(x10))),(taxNum=(x15=(x16=(x17=_this.userData.EUTaxNumber,fromStrOpt(x17)),(f13=function(value)
       {
        return Controls.Input(value);
       },f13(x16))),(f14=function(formlet)
       {
        return Enhance.WithTextLabel("EU Tax Number",formlet);
       },f14(x15))),Data.$(Data.$(Data.$((x18=function(cn)
       {
        return function(tn)
        {
         return function(ba)
         {
          var tn1;
          tn1=tn===""?{
           $:0
          }:{
           $:1,
           $0:tn
          };
          return[cn,tn1,ba];
         };
        };
       },Formlet1.Return(x18)),companyName),taxNum),billingAddress))),(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var x3,f15;
        return _builder_.Bind((x3=Controls.Checkbox(_this.userData.BillingAddress.$==1),(f15=function(formlet)
        {
         return Enhance.WithTextLabel("Company Billing Address",formlet);
        },f15(x3))),function(_arg87)
        {
         var f16,f17;
         return _builder_.ReturnFrom(_arg87?(f16=(f17=Runtime.Tupled(function(arg0)
         {
          return{
           $:1,
           $0:arg0
          };
         }),function(formlet)
         {
          return Formlet1.Map(f17,formlet);
         }),f16(taxAndAddr)):Formlet1.Return({
          $:0
         }));
        });
       })));
       emailForm=(x19=(x1a=Controls.Input(_this.userData.Email),(f18=function(formlet)
       {
        return Enhance.WithTextLabel("Email",formlet);
       },f18(x1a))),(f19=(f1a=function(el)
       {
        var status;
        status=_this.userData.EmailIsVerified?"(verified)":"(unverified)";
        return Default.Table(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([el])),Default.TD(List.ofArray([Default.Text(status)]))]))]));
       },function(formlet)
       {
        return Formlet1.MapElement(f1a,formlet);
       }),f19(x19)));
       usernameForm=(x1b=(x1c=(x1d=(_builder_1=Formlet1.Do(),_builder_1.Delay(function()
       {
        return _builder_1.Bind(Controls.Input(_this.userData.Username),function(_arg90)
        {
         var x3,f15;
         return _builder_1.Bind((x3=Remoting.Async("IntelliFactory.Trainings:121",[_this.userData.Username,_arg90]),(f15=function(a1)
         {
          return Formlet2.FromAsync(a1);
         },f15(x3))),function(_arg89)
         {
          var x1e,x1f,f16,arg00,f17;
          return _builder_1.Bind((x1e=(x1f=Formlet1.Return(null),(f16=(arg00=function()
          {
           return _arg89;
          },function(arg20)
          {
           return Data.Validator().Is(arg00,"You need to specify a non-empty and unique username.",arg20);
          }),f16(x1f))),(f17=function(formlet)
          {
           return Enhance.WithValidationIcon(formlet);
          },f17(x1e))),function()
          {
           return _builder_1.Return(_arg90);
          });
         });
        });
       })),(f1b=function(formlet)
       {
        return Formlet1.Horizontal(formlet);
       },f1b(x1d))),(f1c=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f1c(x1c))),(f1d=function(formlet)
       {
        return Enhance.WithTextLabel("Username",formlet);
       },f1d(x1b)));
       form=(x20=Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Data.$(Formlet1.Return(toUserData),usernameForm),emailForm),(x21=Controls.Input(_this.userData.FirstName),(f1e=function(formlet)
       {
        return Enhance.WithTextLabel("First name",formlet);
       },f1e(x21)))),(x22=Controls.Input(_this.userData.LastName),(f1f=function(formlet)
       {
        return Enhance.WithTextLabel("Last name",formlet);
       },f1f(x22)))),(x23=Controls.Input(_this.userData.Company),(f20=function(formlet)
       {
        return Enhance.WithTextLabel("Company",formlet);
       },f20(x23)))),(x24=Controls.Input(_this.userData.Phone),(f21=function(formlet)
       {
        return Enhance.WithTextLabel("Phone",formlet);
       },f21(x24)))),(x25=Controls.Input(_this.userData.Street1),(f22=function(formlet)
       {
        return Enhance.WithTextLabel("Street address 1",formlet);
       },f22(x25)))),(x26=Controls.Input(_this.userData.Street2),(f23=function(formlet)
       {
        return Enhance.WithTextLabel("Street address 2",formlet);
       },f23(x26)))),(x27=(x28=(x29=Controls.Input(_this.userData.City),(f24=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your city",arg10);
       },f24(x29))),(f25=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f25(x28))),(f26=function(formlet)
       {
        return Enhance.WithTextLabel("City",formlet);
       },f26(x27)))),(x2a=Controls.Input(_this.userData.State),(f27=function(formlet)
       {
        return Enhance.WithTextLabel("State",formlet);
       },f27(x2a)))),(x2b=(x2c=(x2d=Controls.Input(_this.userData.Zip),(f28=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your zip code",arg10);
       },f28(x2d))),(f29=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f29(x2c))),(f2a=function(formlet)
       {
        return Enhance.WithTextLabel("Zip code",formlet);
       },f2a(x2b)))),(x2e=(x2f=(x30=Controls.Input(_this.userData.Country),(f2b=function(arg10)
       {
        return Data.Validator().IsNotEmpty("You must specify your country",arg10);
       },f2b(x30))),(f2c=function(formlet)
       {
        return Enhance.WithValidationIcon(formlet);
       },f2c(x2f))),(f2d=function(formlet)
       {
        return Enhance.WithTextLabel("Country",formlet);
       },f2d(x2e)))),twitterUserName),euTaxAndBilling),(f2e=function(formlet)
       {
        return UserControls.SetupForm("Update profile",true,formlet);
       },f2e(x20)));
       _builder_2=Formlet1.Do();
       return _builder_2.Delay(function()
       {
        return _builder_2.Bind(form,function(_arg92)
        {
         var x3,f15;
         return _builder_2.Bind((x3=_this.isProfileMine?Remoting.Async("IntelliFactory.Trainings:111",[_arg92]):Remoting.Async("IntelliFactory.Trainings:112",[_this.userData.Username,_arg92]),(f15=function(a1)
         {
          return Formlet2.LoadingFormlet(a1);
         },f15(x3))),function(_arg91)
         {
          var status,x1e,f16,f17,f2f;
          return _builder_2.ReturnFrom(_arg91.$==0?(status=_arg91.$0,(x1e=status.NewEmail?"Your profile has been successfully updated. An email was sent to your email\r\n                            address with instructions on how to verify your address. Please see the email and\r\n                            proceed accordingly.":"Your profile has been successfully updated.",(f16=function(msg)
          {
           return FormletHelpers.SuccessF(msg);
          },f16(x1e)))):_arg91.$==1?(f17=function(msg)
          {
           return FormletHelpers.ErrorF(msg);
          },f17("The user name is already in use. Select a different username and try again.")):(f2f=function(msg)
          {
           return FormletHelpers.ErrorF(msg);
          },f2f("You seem to have been disconnected.\nPlease log in again.")));
         });
        });
       });
      }
     }),
     UserTagsForm:Runtime.Class({
      get_Body:function()
      {
       var visibleTagsUL,invisibleTagsUL,visibleEntry,invisibleEntry,_this4=this,resetContainer,x5,f4,x6,_this5,f5,x7,x8,f8;
       visibleTagsUL=Default.UL(List.ofArray([Default.Attr().Class("favorite-tags")]));
       invisibleTagsUL=Default.UL(List.ofArray([Default.Attr().Class("ignored-tags")]));
       visibleEntry=Runtime.Tupled(function(_arg95)
       {
        var tag,isMaster,li,x,_this,_this1,_this2,_this3,f,x1;
        tag=_arg95[0];
        isMaster=_arg95[1];
        li=Default.LI(Runtime.New(T,{
         $:0
        }));
        return Operators.add(li,List.ofArray([(x=Operators.add(Default.A(List.ofArray([Default.Attr().Class("tag"+(isMaster?" master":""))])),List.ofArray([Default.Img(List.ofArray([(_this=Default.Attr(),_this.NewAttr("src","/images/icons/close.png")),(_this1=Default.Attr(),_this1.NewAttr("alt","remove")),(_this2=Default.Attr(),_this2.NewAttr("title","remove")),(_this3=Default.Attr(),_this3.NewAttr("style","height: 10px; width: 10px; margin-right: 5px;"))])),Default.Text(tag)])),(f=(x1=function()
        {
         return function()
         {
          var x2,_builder_,f3;
          x2=(_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           var a;
           return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:85",[tag]),Formlet2.LoadingFormletWithLogin(a)),function(_arg97)
           {
            var f1,g,x4,f2,action,g1;
            return _builder_.ReturnFrom(_arg97.$==0?(_this4["visibleTags@1507"]=List.filter((f1=Runtime.Tupled(function(tuple)
            {
             return tuple[0];
            }),(g=function(y)
            {
             return tag!==y;
            },function(x3)
            {
             return g(f1(x3));
            })),_this4["visibleTags@1507"]),(li["HtmlProvider@32"].Remove(li.Body),(_this4["invisibleTags@1510"]=List.sortBy(Runtime.Tupled(function(tuple)
            {
             return tuple[0];
            }),Runtime.New(T,{
             $:1,
             $0:_arg95,
             $1:_this4["invisibleTags@1510"]
            })),(invisibleTagsUL["HtmlProvider@32"].Clear(invisibleTagsUL.Body),(x4=_this4["invisibleTags@1510"],(f2=(action=(g1=function(arg00)
            {
             return invisibleTagsUL.AppendI(arg00);
            },function(x3)
            {
             return g1(invisibleEntry(x3));
            }),function(list)
            {
             return Seq.iter(action,list);
            }),f2(x4)),Formlet1.Never()))))):Formlet1.Never());
           });
          }));
          f3=function(arg00)
          {
           return li.AppendI(arg00);
          };
          return f3(x2);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x)))]));
       });
       invisibleEntry=Runtime.Tupled(function(_arg96)
       {
        var tag,isMaster,li,x,f,x1;
        tag=_arg96[0];
        isMaster=_arg96[1];
        li=Default.LI(Runtime.New(T,{
         $:0
        }));
        return Operators.add(li,List.ofArray([(x=Operators.add(Default.A(List.ofArray([Default.Attr().Class("tag"+(isMaster?" master":""))])),List.ofArray([Default.Text(tag)])),(f=(x1=function()
        {
         return function()
         {
          var x2,_builder_,f3;
          x2=(_builder_=Formlet1.Do(),_builder_.Delay(function()
          {
           var a;
           return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:86",[tag]),Formlet2.LoadingFormletWithLogin(a)),function(_arg98)
           {
            var x3,f1,action,g,f2,g1;
            return _builder_.ReturnFrom(_arg98.$==1?Formlet1.Never():(_this4["visibleTags@1507"]=List.sortBy(Runtime.Tupled(function(tuple)
            {
             return tuple[0];
            }),Runtime.New(T,{
             $:1,
             $0:_arg96,
             $1:_this4["visibleTags@1507"]
            })),(visibleTagsUL["HtmlProvider@32"].Clear(visibleTagsUL.Body),(x3=_this4["visibleTags@1507"],(f1=(action=(g=function(arg00)
            {
             return visibleTagsUL.AppendI(arg00);
            },function(x4)
            {
             return g(visibleEntry(x4));
            }),function(list)
            {
             return Seq.iter(action,list);
            }),f1(x3)),(_this4["invisibleTags@1510"]=List.filter((f2=Runtime.Tupled(function(tuple)
            {
             return tuple[0];
            }),(g1=function(y)
            {
             return tag!==y;
            },function(x4)
            {
             return g1(f2(x4));
            })),_this4["invisibleTags@1510"]),(li["HtmlProvider@32"].Remove(li.Body),Formlet1.Never()))))));
           });
          }));
          f3=function(arg00)
          {
           return li.AppendI(arg00);
          };
          return f3(x2);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x)))]));
       });
       resetContainer=Default.Div(Runtime.New(T,{
        $:0
       }));
       return Default.Div(List.ofArray([Default.H3(List.ofArray([Default.Text("My tags")])),Default.P(List.ofArray([Default.Text("Here are the topics displayed on your home page. We have\r\n                         inferred some topics you may be interested in, and you can\r\n                         add or remove some more.")])),Default.P(List.ofArray([Default.Text("Click a tag below to remove it from your subjects of interest.")])),Operators.add(visibleTagsUL,(x5=_this4["visibleTags@1507"],(f4=function(list)
       {
        return List.map(visibleEntry,list);
       },f4(x5)))),Default.P(List.ofArray([Default.Text("If you want to reset your topics of interest to the list we have inferred for you,\r\n                         please "),(x6=Operators.add(Default.A(List.ofArray([Default.Attr().Class(Server.Small()),(_this5=Default.Attr(),_this5.NewAttr("href","#"))])),List.ofArray([Default.Text("Click here")])),(f5=(x7=function()
       {
        return function()
        {
         var x,_builder_,f7;
         resetContainer["HtmlProvider@32"].Clear(resetContainer.Body);
         x=(_builder_=Formlet1.Do(),_builder_.Delay(function()
         {
          var a;
          return _builder_.Bind((a=Remoting.Async("IntelliFactory.Trainings:87",[]),Formlet2.LoadingFormletWithLogin(a)),function(_arg99)
          {
           var msg,tags,tagsWithMaster,f,mapping,x2,f2,action,g1,x3,f3,predicate,x4,f6,action1,g2;
           if(_arg99.$==1)
            {
             msg=_arg99.$0;
             return _builder_.ReturnFrom(FormletHelpers.ErrorF(msg));
            }
           else
            {
             tags=_arg99.$0;
             tagsWithMaster=(f=(mapping=function(tag)
             {
              var p,f1,g,l;
              p=(f1=Runtime.Tupled(function(tuple)
              {
               return tuple[0];
              }),(g=function(y)
              {
               return tag===y;
              },function(x1)
              {
               return g(f1(x1));
              }));
              l=_this4.allTags;
              return Seq.find(p,l);
             },function(list)
             {
              return List.map(mapping,list);
             }),f(tags));
             _this4["visibleTags@1507"]=List.sortBy(Runtime.Tupled(function(tuple)
             {
              return tuple[0];
             }),tagsWithMaster);
             visibleTagsUL["HtmlProvider@32"].Clear(visibleTagsUL.Body);
             x2=_this4["visibleTags@1507"];
             f2=(action=(g1=function(arg00)
             {
              return visibleTagsUL.AppendI(arg00);
             },function(x1)
             {
              return g1(visibleEntry(x1));
             }),function(list)
             {
              return Seq.iter(action,list);
             });
             f2(x2);
             _this4["invisibleTags@1510"]=(x3=_this4.allTags,(f3=(predicate=Runtime.Tupled(function(tupledArg)
             {
              var tag,_arg7,x1,f1,predicate1;
              tag=tupledArg[0];
              _arg7=tupledArg[1];
              x1=_this4["visibleTags@1507"];
              f1=(predicate1=Runtime.Tupled(function(tupledArg1)
              {
               var vTag,_arg6;
               vTag=tupledArg1[0];
               _arg6=tupledArg1[1];
               return vTag!==tag;
              }),function(list)
              {
               return Seq.forall(predicate1,list);
              });
              return f1(x1);
             }),function(list)
             {
              return List.filter(predicate,list);
             }),f3(x3)));
             invisibleTagsUL["HtmlProvider@32"].Clear(invisibleTagsUL.Body);
             x4=_this4["invisibleTags@1510"];
             f6=(action1=(g2=function(arg00)
             {
              return invisibleTagsUL.AppendI(arg00);
             },function(x1)
             {
              return g2(invisibleEntry(x1));
             }),function(list)
             {
              return Seq.iter(action1,list);
             });
             f6(x4);
             resetContainer["HtmlProvider@32"].Clear(resetContainer.Body);
             return _builder_.ReturnFrom(Formlet1.Never());
            }
          });
         }));
         f7=function(arg00)
         {
          return resetContainer.AppendI(arg00);
         };
         return f7(x);
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(x7,arg10);
       }),(f5(x6),x6)))])),resetContainer,Default.H3(List.ofArray([Default.Text("Add a tag")])),Default.P(List.ofArray([Default.Text("Click a tag below to add it to your subjects of interest.")])),Operators.add(invisibleTagsUL,(x8=_this4["invisibleTags@1510"],(f8=function(list)
       {
        return List.map(invisibleEntry,list);
       },f8(x8))))]));
      }
     }),
     WorkPlaceForm:function(data)
     {
      var workPlaceF,x,x1,x2,f,f1,f2,titleF,x3,x4,x5,f3,f4,f5,locationF,x6,x7,x8,f6,f7,f8,yearsF,descrF,x9,f9,xa,xb,xc,fa,fb,fc;
      workPlaceF=(x=(x1=(x2=Controls.Input(data.WorkPlace),(f=function(arg10)
      {
       return Data.Validator().IsNotEmpty("Specify a non empty name.",arg10);
      },f(x2))),(f1=function(formlet)
      {
       return Enhance.WithValidationIcon(formlet);
      },f1(x1))),(f2=function(formlet)
      {
       return Enhance.WithTextLabel("Name",formlet);
      },f2(x)));
      titleF=(x3=(x4=(x5=Controls.Input(data.Title),(f3=function(arg10)
      {
       return Data.Validator().IsNotEmpty("Specify a non empty name.",arg10);
      },f3(x5))),(f4=function(formlet)
      {
       return Enhance.WithValidationIcon(formlet);
      },f4(x4))),(f5=function(formlet)
      {
       return Enhance.WithTextLabel("Your position",formlet);
      },f5(x3)));
      locationF=(x6=(x7=(x8=Controls.Input(data.Location),(f6=function(arg10)
      {
       return Data.Validator().IsNotEmpty("Specify a non empty location.",arg10);
      },f6(x8))),(f7=function(formlet)
      {
       return Enhance.WithValidationIcon(formlet);
      },f7(x7))),(f8=function(formlet)
      {
       return Enhance.WithTextLabel("Location",formlet);
      },f8(x6)));
      yearsF=UserControls.PeriodFormlet(data.FromYear,data.EndYear);
      descrF=(x9=Controls.TextArea(data.Description),(f9=function(formlet)
      {
       return Enhance.WithTextLabel("Notes",formlet);
      },f9(x9)));
      xa=(xb=Data.$(Data.$(Data.$(Data.$(Data.$((xc=function(wp)
      {
       return function(title)
       {
        return function(loc)
        {
         return Runtime.Tupled(function(tupledArg)
         {
          var fromY,endY;
          fromY=tupledArg[0];
          endY=tupledArg[1];
          return function(descr)
          {
           return Runtime.New(WorkPlaceInfo,{
            WorkPlace:wp,
            Title:title,
            Location:loc,
            FromYear:fromY,
            EndYear:endY,
            Description:descr
           });
          };
         });
        };
       };
      },Formlet1.Return(xc)),workPlaceF),titleF),locationF),yearsF),descrF),(fa=function(formlet)
      {
       return Formlet1.Vertical(formlet);
      },fa(xb)));
      fb=(fc=function(el)
      {
       return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("workplace")])),List.ofArray([el]));
      },function(formlet)
      {
       return Formlet1.MapElement(fc,formlet);
      });
      return fb(xa);
     },
     WorkPlaceForms:function(data)
     {
      var x,f,f1,formlet;
      x=(f=function(list)
      {
       return List.map(function(data1)
       {
        return UserControls.WorkPlaceForm(data1);
       },list);
      },f(data));
      f1=(formlet=UserControls.WorkPlaceForm(WorkPlaceInfo.get_Default()),function(init)
      {
       return Formlet2.Many(formlet,init);
      });
      return f1(x);
     }
    },
    UserProfile:{
     Client:{
      LatestTweetsControl:Runtime.Class({
       get_Body:function()
       {
        var x,f,f1,_this=this;
        x=Default.Div(List.ofArray([Default.Attr().Class("tweets")]));
        f=(f1=function(panel)
        {
         var x1,x2,_builder_,f3,f4,f5;
         x1=(x2=(_builder_=Formlet1.Do(),_builder_.Delay(function()
         {
          var x3,f2;
          return _builder_.Bind((x3=Clientf.LatestTweets(panel,_this.twitterUser),(f2=function(a)
          {
           return Formlet2.LoadingFormlet(a);
          },f2(x3))),function()
          {
           return _builder_.Return(null);
          });
         })),(f3=(f4=function()
         {
          return null;
         },function(formlet)
         {
          return Formlet1.Run(f4,formlet);
         }),f3(x2)));
         f5=function(value)
         {
          value;
         };
         return f5(x1);
        },function(w)
        {
         return Operators.OnAfterRender(f1,w);
        });
        f(x);
        return x;
       }
      })
     }
    },
    Utils:{
     Formlet:{
      AddMany:function(add,f)
      {
       var x,x1,x2,f1,f2,f3,f4,f5,f6;
       x=(x1=(x2=(f1=(f2=f,function(formlet)
       {
        return Formlet1.Map(f2,formlet);
       }),f1(add)),(f3=function(formlet)
       {
        return Formlet1.SelectMany(formlet);
       },f3(x2))),(f4=function(formlet)
       {
        return Formlet1.FlipBody(formlet);
       },f4(x1)));
       f5=(f6=function(xs)
       {
        var x3,f7;
        x3=Seq.choose(function(x4)
        {
         return x4;
        },xs);
        f7=function(source)
        {
         return List.ofSeq(source);
        };
        return f7(x3);
       },function(formlet)
       {
        return Formlet1.Map(f6,formlet);
       });
       return f5(x);
      },
      AsyncFormlet:function(buildElem,a)
      {
       var loadingPane,f;
       loadingPane=(f=function()
       {
        var elem,state,x,f1,f3;
        elem=buildElem(null);
        state=_FSharpEvent_1.New();
        x=(f1=function()
        {
         var f2;
         f2=function(_arg17)
         {
          var x1;
          x1=Runtime.New(_Result_1,{
           $:0,
           $0:_arg17
          });
          state.event.Trigger(x1);
          return Concurrency.Return(null);
         };
         return Concurrency.Bind(a,f2);
        },Concurrency.Delay(f1));
        f3=function(arg00)
        {
         var t;
         t={
          $:0
         };
         return Concurrency.Start(arg00);
        };
        f3(x);
        return[elem,function(value)
        {
         value;
        },state.event];
       },Formlet1.BuildFormlet(f));
       return Formlet1.Replace(loadingPane,function(value)
       {
        var x,f1;
        x=Formlet1.Empty();
        f1=function(formlet)
        {
         return Formlet1.InitWith(value,formlet);
        };
        return f1(x);
       });
      },
      BaseFormlet:function()
      {
       return _FormletProvider_1.New(Data.UtilsProvider());
      },
      Controls:{
       Autocomplete:function(def,source)
       {
        var f;
        f=function()
        {
         var state,input,_this,upd,f2,x1,f3,x2,ac,conf,source1,returnVal,reset;
         state=_HotStream_1.New(Runtime.New(_Result_1,{
          $:0,
          $0:def
         }));
         input=Default.Input(List.ofArray([Default.Attr().Class("inputText"),(_this=Default.Attr(),_this.NewAttr("value",def))]));
         upd=function()
         {
          var x,f1;
          x=Runtime.New(_Result_1,{
           $:0,
           $0:input.get_Value()
          });
          f1=function(arg00)
          {
           return state.Trigger(arg00);
          };
          return f1(x);
         };
         f2=(x1=function()
         {
          return function()
          {
           return upd(null);
          };
         },function(arg10)
         {
          return EventsPervasives.Events().OnKeyUp(x1,arg10);
         });
         f2(input);
         f3=(x2=function()
         {
          return upd(null);
         },function(arg10)
         {
          return EventsPervasives.Events().OnChange(x2,arg10);
         });
         f3(input);
         ac=(conf=AutocompleteConfiguration.New(),(source1=Runtime.Tupled(function(tupledArg)
         {
          var req,resp,x,f1,f5;
          req=tupledArg[0];
          resp=tupledArg[1];
          x=(f1=function()
          {
           var x3,f4;
           x3=source(req.term);
           f4=function(_arg13)
           {
            resp(Arrays.ofSeq(_arg13));
            return Concurrency.Return(null);
           };
           return Concurrency.Bind(x3,f4);
          },Concurrency.Delay(f1));
          f5=function(arg00)
          {
           var t;
           t={
            $:0
           };
           return Concurrency.Start(arg00);
          };
          return f5(x);
         }),Autocomplete.New1(input,(returnVal=[AutocompleteConfiguration.New()],(null,returnVal[0].source=source1,returnVal[0])))));
         ac.OnChange(function()
         {
          return function()
          {
           return upd(null);
          };
         });
         reset=function()
         {
          input.set_Value(def);
          return state.Trigger(Runtime.New(_Result_1,{
           $:0,
           $0:def
          }));
         };
         return[Default.Div(List.ofArray([ac])),reset,state];
        };
        return Formlet1.BuildFormlet(f);
       },
       ErrorPanel:function(msg)
       {
        return Controls1.MessageF("error",msg);
       },
       LargeButton:function(label)
       {
        return Controls.ElementButton(function()
        {
         var arg00;
         return Operators.add(Default.A(List.ofArray([Default.HRef("#"),(arg00=Server.Large(),Default.Attr().Class(arg00))])),List.ofArray([Default.Text(label)]));
        });
       },
       MessageF:function(_class_,msg)
       {
        var _builder_;
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         return _builder_.Bind(Formlet1.OfElement(function()
         {
          return Operators.add(Default.Div(List.ofArray([Default.Attr().Class(_class_)])),List.ofArray([Default.Text(msg)]));
         }),function()
         {
          return _builder_.ReturnFrom(Formlet1.Never());
         });
        });
       },
       MkFormlet:function(f)
       {
        var f1;
        f1=function()
        {
         var patternInput,s,r,b,panel;
         patternInput=f(null);
         s=patternInput[2];
         r=patternInput[1];
         b=patternInput[0];
         panel=Default.Div(List.ofArray([b]));
         return[panel,r,s];
        };
        return Formlet1.BuildFormlet(f1);
       },
       SmallButton:function(label)
       {
        return Controls.ElementButton(function()
        {
         var arg00;
         return Operators.add(Default.A(List.ofArray([Default.HRef("javascript:void(null)"),(arg00=Server.Small(),Default.Attr().Class(arg00))])),List.ofArray([Default.Text(label)]));
        });
       },
       SuccessPanel:function(msg)
       {
        return Controls1.MessageF("success",msg);
       }
      },
      Deletable:function(formlet)
      {
       return Formlet2.Replace(formlet,function(value)
       {
        var value1,x,f;
        if(value.$==1)
         {
          value1=value.$0;
          return Formlet1.Return({
           $:1,
           $0:value1
          });
         }
        else
         {
          x=Formlet2.BaseFormlet().ReturnEmpty({
           $:0
          });
          f=function(formlet1)
          {
           return Data.OfIFormlet(formlet1);
          };
          return f(x);
         }
       });
      },
      Enhance:{
       FormWithResponse:function(conf,respFun,form)
       {
        var x,x1,f,f1,f2,f3;
        x=(x1=(f=function(formlet)
        {
         return Enhance.WithCustomFormContainer(conf,formlet);
        },f(form)),(f1=function(formlet)
        {
         return Enhance1.FormWithResponseElement(respFun,formlet);
        },f1(x1)));
        f2=(f3=function(value)
        {
         value;
        },function(formlet)
        {
         return Formlet1.Run(f3,formlet);
        });
        return f2(x);
       },
       FormWithResponseElement:function(f,formlet)
       {
        var _builder_;
        _builder_=Formlet1.Do();
        return _builder_.Delay(function()
        {
         var x,f1,f2;
         return _builder_.Bind((x=(f1=function(formlet1)
         {
          return Enhance1.GetElement(formlet1);
         },f1(formlet)),(f2=function(formlet1)
         {
          return Formlet1.WithNotificationChannel(formlet1);
         },f2(x))),Runtime.Tupled(function(_arg20)
         {
          var reset,panel,input,imgBox,procRes;
          reset=_arg20[1];
          panel=_arg20[0][1];
          input=_arg20[0][0];
          imgBox=Client3.LoadingImage();
          panel.AppendI(imgBox);
          procRes=function(res)
          {
           var elem;
           imgBox["HtmlProvider@32"].Remove(imgBox.Body);
           elem=function()
           {
            var msgs,x1,f3,mapping,f4,elem1;
            if(res.$==1)
             {
              msgs=res.$0;
              x1=(f3=(mapping=function(m)
              {
               return Default.LI(List.ofArray([Default.Text(m)]));
              },function(list)
              {
               return List.map(mapping,list);
              }),f3(msgs));
              f4=function(x2)
              {
               return Default.UL(x2);
              };
              return f4(x1);
             }
            else
             {
              elem1=res.$0;
              reset(null);
              return elem1;
             }
           };
           return Formlet1.OfElement(elem);
          };
          return _builder_.Bind(procRes(f(input)),function(_arg19)
          {
           return _builder_.Return(_arg19);
          });
         }));
        });
       },
       GetElement:function(formlet)
       {
        var el,x,f,f1,f2,f3;
        el=Default.Div(Runtime.New(T,{
         $:0
        }));
        x=(f=(f1=function(body)
        {
         el.AppendI(body.Element);
         return Runtime.New(Body,{
          Element:el,
          Label:body.Label
         });
        },function(formlet1)
        {
         return Formlet1.MapBody(f1,formlet1);
        }),f(formlet));
        f2=(f3=function(v)
        {
         return[v,el];
        },function(formlet1)
        {
         return Formlet1.Map(f3,formlet1);
        });
        return f2(x);
       },
       SubmitOnEnter:function(formlet)
       {
        var f,f1;
        f=(f1=function(elem)
        {
         var jqElem,x,f6;
         jqElem=jQuery(elem.Body);
         x=jqElem.keypress(function(k)
         {
          var code,x1,f2,f3,f5;
          code=!Unchecked.Equals(k.keyCode,undefined)?k.keyCode:k.charCode;
          if(code===13)
           {
            x1=(f2=(f3=function()
            {
             var x2,f4;
             x2=jqElem.find("input[type=button]").trigger("click");
             f4=function(value)
             {
              value;
             };
             return f4(x2);
            },function(msec)
            {
             return setTimeout(f3,msec);
            }),f2(100));
            f5=function(value)
            {
             value;
            };
            return f5(x1);
           }
          else
           {
            return null;
           }
         });
         f6=function(value)
         {
          value;
         };
         f6(x);
         return elem;
        },function(formlet1)
        {
         return Formlet1.MapElement(f1,formlet1);
        });
        return f(formlet);
       },
       WithCustomDialog:function(conf,formlet)
       {
        var f;
        f=function()
        {
         var state,dialogOpt,el,f1,f2,dialog1,reset;
         state=_HotStream_1.New(Runtime.New(_Result_1,{
          $:1,
          $0:Runtime.New(T,{
           $:0
          })
         }));
         conf.modal=true;
         conf.dialogClass="dialog";
         dialogOpt={
          contents:{
           $:0
          }
         };
         el=Default.Div(List.ofArray([(f1=(f2=function(confirmed)
         {
          var matchValue,dialog;
          matchValue=dialogOpt.contents;
          if(matchValue.$==0)
           {
            return null;
           }
          else
           {
            dialog=matchValue.$0;
            state.Trigger(Runtime.New(_Result_1,{
             $:0,
             $0:confirmed
            }));
            return jQuery(dialog.element.Body).dialog("close");
           }
         },function(formlet1)
         {
          return Formlet1.Run(f2,formlet1);
         }),f1(formlet))]));
         dialog1=Dialog.New1(el,conf);
         dialogOpt.contents={
          $:1,
          $0:dialog1
         };
         reset=function()
         {
          jQuery(dialog1.element.Body).dialog("close");
          return state.Trigger(Runtime.New(_Result_1,{
           $:1,
           $0:Runtime.New(T,{
            $:0
           })
          }));
         };
         return[Default.Div(List.ofArray([dialog1])),reset,state];
        };
        return Formlet1.BuildFormlet(f);
       },
       WithDialog:function(title,formlet)
       {
        var returnVal;
        return Enhance1.WithCustomDialog((returnVal=[DialogConfiguration.New()],(null,returnVal[0].title=title,returnVal[0])),formlet);
       },
       WithStep:function(num,title,formlet)
       {
        var f,f1;
        f=(f1=function(elem)
        {
         var imgSrc,imgAlt;
         imgSrc="/images/step"+Global.String(num)+".png";
         imgAlt="Step "+Global.String(num);
         return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("form-step")])),List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("form-step-header")])),List.ofArray([Default.Img(List.ofArray([Default.Src(imgSrc),Default.Alt(imgAlt)])),Operators.add(Default.Div(List.ofArray([Default.Attr().Class("form-step-sep")])),List.ofArray([Default.H1(List.ofArray([Default.Text(title)]))]))])),Operators.add(Default.Div(List.ofArray([Default.Attr().Class("form-step-body")])),List.ofArray([elem]))]));
        },function(formlet1)
        {
         return Formlet1.MapElement(f1,formlet1);
        });
        return f(formlet);
       }
      },
      FromAsync:function(a)
      {
       var f;
       f=function()
       {
        var state,x,f1,f3;
        state=_FSharpEvent_1.New();
        x=(f1=function()
        {
         var f2;
         f2=function(_arg18)
         {
          var x1;
          x1=Runtime.New(_Result_1,{
           $:0,
           $0:_arg18
          });
          state.event.Trigger(x1);
          return Concurrency.Return(null);
         };
         return Concurrency.Bind(a,f2);
        },Concurrency.Delay(f1));
        f3=function(arg00)
        {
         var t;
         t={
          $:0
         };
         return Concurrency.Start(arg00);
        };
        f3(x);
        return[Default.Div(Runtime.New(T,{
         $:0
        })),function(value)
        {
         value;
        },state.event];
       };
       return Formlet1.BuildFormlet(f);
      },
      LoadingFormlet:function(a)
      {
       return Formlet2.AsyncFormlet(function()
       {
        return Client3.LoadingImage();
       },a);
      },
      LoadingFormletWithLogin:function(a)
      {
       var _builder_;
       _builder_=Formlet1.Do();
       return _builder_.Delay(function()
       {
        return _builder_.Bind(Formlet2.LoadingFormlet(a),function(_arg21)
        {
         var x;
         if(_arg21.$==1)
          {
           x=_arg21.$0;
           return _builder_.Return(x);
          }
         else
          {
           window.open("/login-frame","login","width=600,height=500,status=0,resizable=0,location=0");
           return _builder_.ReturnFrom(FormletHelpers.SuccessFHtml(List.ofArray([Default.Text("You need to log in to perform this action."),Default.Br(Runtime.New(T,{
            $:0
           })),Default.Text("Please make sure that your browser isn't blocking the login popup window."),Default.Br(Runtime.New(T,{
            $:0
           })),Default.Text("No action will be performed until you log in and confirm this action again.")])));
          }
        });
       });
      },
      Many:function(formlet,init)
      {
       var makeFormlet;
       makeFormlet=function()
       {
        var deletableF,initFs,x4,x5,f5,f6,f7,f8,chooser,addButton,newF,x6,x7,f9,fa,fb,value1,x8;
        deletableF=function(formlet1)
        {
         var x,x1,x2,x3,f,f1,f2,f3,f4;
         x=(x1=(x2=(x3=Controls1.SmallButton("X"),(f=(f1=function(value)
         {
          value;
         },function(formlet2)
         {
          return Formlet1.Map(f1,formlet2);
         }),f(x3))),(f2=function(c)
         {
          return Formlet1.WithCancelation(formlet1,c);
         },f2(x2))),(f3=function(formlet2)
         {
          return Formlet1.Horizontal(formlet2);
         },f3(x1)));
         f4=function(formlet2)
         {
          return Formlet2.Deletable(formlet2);
         };
         return f4(x);
        };
        initFs=(x4=(x5=(f5=function(list)
        {
         return List.map(deletableF,list);
        },f5(init)),(f6=function(fs)
        {
         return Formlet1.Sequence(fs);
        },f6(x5))),(f7=(f8=(chooser=function(x)
        {
         return x;
        },function(list)
        {
         return List.choose(chooser,list);
        }),function(formlet1)
        {
         return Formlet1.Map(f8,formlet1);
        }),f7(x4)));
        addButton=Controls1.SmallButton("Add");
        newF=(x6=(x7=Formlet2.AddMany(addButton,function()
        {
         return deletableF(formlet);
        }),(f9=(fa=function(arg0)
        {
         return{
          $:1,
          $0:arg0
         };
        },function(formlet1)
        {
         return Formlet1.Map(fa,formlet1);
        }),f9(x7))),(fb=(value1={
         $:0
        },function(formlet1)
        {
         return Formlet1.InitWith(value1,formlet1);
        }),fb(x6)));
        return Data.$(Data.$((x8=function(xs)
        {
         return function(ys)
         {
          var ys1;
          if(ys.$==1)
           {
            ys1=ys.$0;
            return List.append(xs,ys1);
           }
          else
           {
            return xs;
           }
         };
        },Formlet1.Return(x8)),initFs),newF);
       };
       return Formlet2.Resettable(makeFormlet);
      },
      Replace:function(formlet,f)
      {
       var x,f1,f2;
       x=(f1=(f2=function(res)
       {
        var fs,x1,f3,s;
        if(res.$==1)
         {
          fs=res.$0;
          x1=Formlet1.FailWith(fs);
          f3=function(arg0)
          {
           return Runtime.New(_Result_1,{
            $:0,
            $0:arg0
           });
          };
          return f3(x1);
         }
        else
         {
          s=res.$0;
          return Runtime.New(_Result_1,{
           $:0,
           $0:f(s)
          });
         }
       },function(formlet1)
       {
        return Formlet1.MapResult(f2,formlet1);
       }),f1(formlet));
       return Formlet1.Switch(x);
      },
      Resettable:function(makeFormlet)
      {
       var resetS,resetF,x,f,reset,x2,_builder_,f4;
       resetS=_FSharpEvent_1.New();
       resetF=(x=Formlet2.BaseFormlet().FromState(resetS.event),(f=function(formlet)
       {
        return Data.OfIFormlet(formlet);
       },f(x)));
       reset=function()
       {
        var x1;
        x1=Runtime.New(_Result_1,{
         $:0,
         $0:null
        });
        return resetS.event.Trigger(x1);
       };
       x2=(_builder_=Formlet1.Do(),_builder_.Delay(function()
       {
        var f1;
        return _builder_.Bind((f1=function(formlet)
        {
         return Formlet1.InitWith(null,formlet);
        },f1(resetF)),function()
        {
         var x1,x3,f2,f3;
         return _builder_.ReturnFrom((x1=(x3=makeFormlet(null),(f2=function(formlet)
         {
          return Formlet1.ApplyLayout(formlet);
         },f2(x3))),(f3=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },f3(x1))));
        });
       }));
       f4=function(formlet)
       {
        return Formlet1.WithNotification(reset,formlet);
       };
       return f4(x2);
      }
     },
     MarkupLanguage:{
      AcceptedLangs:Runtime.Field(function()
      {
       return List.ofArray(["fsharp","f#","ocaml","caml","ml","haskell","hs","lisp","clisp","cl","scala","js","javascript","as3","shell","coldfusion","c","cpp","csharp","css","delphi","pascal","diff","erlang","groovy","java","javafx","perl","php","powershell","python","ruby","sass","sql","vb","text","xml","html"]);
      }),
      Assoc:function(x,l)
      {
       var x1,f,predicate,f1,mapping;
       x1=(f=(predicate=Runtime.Tupled(function(tupledArg)
       {
        var t,_arg1;
        t=tupledArg[0];
        _arg1=tupledArg[1];
        return Unchecked.Equals(t,x);
       }),function(list)
       {
        return Seq.tryFind(predicate,list);
       }),f(l));
       f1=(mapping=Runtime.Tupled(function(tuple)
       {
        return tuple[1];
       }),function(option)
       {
        return Option.map(mapping,option);
       });
       return f1(x1);
      },
      Client:{
       PP:function(_arg1)
       {
        var url,es,_this,es1,es2,es3,es4,x,_this1,lang,content,url1,es5,es6,es7,es8,es9,esa,esb,esc,x1,_this2,esd,ese,esf,es10,es11,x2,_this3,es12,t;
        if(_arg1.$==1)
         {
          return Default.Br(Runtime.New(T,{
           $:0
          }));
         }
        else
         {
          if(_arg1.$==2)
           {
            url=_arg1.$0;
            es=_arg1.$1;
            return Operators.add(Default.A(List.ofArray([(_this=Default.Attr(),_this.NewAttr("href",url))])),List.map(function(_arg11)
            {
             return Client4.PP(_arg11);
            },es));
           }
          else
           {
            if(_arg1.$==3)
             {
              es1=_arg1.$0;
              return Default.B(List.map(function(_arg11)
              {
               return Client4.PP(_arg11);
              },es1));
             }
            else
             {
              if(_arg1.$==4)
               {
                es2=_arg1.$0;
                return Default.Code(List.map(function(_arg11)
                {
                 return Client4.PP(_arg11);
                },es2));
               }
              else
               {
                if(_arg1.$==5)
                 {
                  es3=_arg1.$0;
                  return Default.I(List.map(function(_arg11)
                  {
                   return Client4.PP(_arg11);
                  },es3));
                 }
                else
                 {
                  if(_arg1.$==6)
                   {
                    es4=_arg1.$0;
                    x=List.map(function(_arg11)
                    {
                     return Client4.PP(_arg11);
                    },es4);
                    _this1=Default.Tags();
                    return _this1.NewTag("del",x);
                   }
                  else
                   {
                    if(_arg1.$==7)
                     {
                      lang=_arg1.$0;
                      content=_arg1.$1;
                      return Operators.add(Default.Pre(List.ofArray([Default.Attr().Class("brush: "+lang+"; toolbar: false;")])),List.ofArray([Default.Text(content)]));
                     }
                    else
                     {
                      if(_arg1.$==8)
                       {
                        url1=_arg1.$0;
                        return Default.Img(List.ofArray([Default.Src(url1)]));
                       }
                      else
                       {
                        if(_arg1.$==9)
                         {
                          es5=_arg1.$0;
                          return Default.UL(List.map(function(_arg11)
                          {
                           return Client4.PP(_arg11);
                          },es5));
                         }
                        else
                         {
                          if(_arg1.$==10)
                           {
                            es6=_arg1.$0;
                            return Default.OL(List.map(function(_arg11)
                            {
                             return Client4.PP(_arg11);
                            },es6));
                           }
                          else
                           {
                            if(_arg1.$==11)
                             {
                              es7=_arg1.$0;
                              return Default.LI(List.map(function(_arg11)
                              {
                               return Client4.PP(_arg11);
                              },es7));
                             }
                            else
                             {
                              if(_arg1.$==12)
                               {
                                es8=_arg1.$0;
                                return Default.H1(List.map(function(_arg11)
                                {
                                 return Client4.PP(_arg11);
                                },es8));
                               }
                              else
                               {
                                if(_arg1.$==13)
                                 {
                                  es9=_arg1.$0;
                                  return Default.H2(List.map(function(_arg11)
                                  {
                                   return Client4.PP(_arg11);
                                  },es9));
                                 }
                                else
                                 {
                                  if(_arg1.$==14)
                                   {
                                    esa=_arg1.$0;
                                    return Default.H3(List.map(function(_arg11)
                                    {
                                     return Client4.PP(_arg11);
                                    },esa));
                                   }
                                  else
                                   {
                                    if(_arg1.$==15)
                                     {
                                      esb=_arg1.$0;
                                      return Default.H4(List.map(function(_arg11)
                                      {
                                       return Client4.PP(_arg11);
                                      },esb));
                                     }
                                    else
                                     {
                                      if(_arg1.$==16)
                                       {
                                        esc=_arg1.$0;
                                        x1=List.map(function(_arg11)
                                        {
                                         return Client4.PP(_arg11);
                                        },esc);
                                        _this2=Default.Tags();
                                        return _this2.NewTag("blockquote",x1);
                                       }
                                      else
                                       {
                                        if(_arg1.$==17)
                                         {
                                          esd=_arg1.$0;
                                          return Default.Table(List.ofArray([Default.TBody(List.map(function(_arg11)
                                          {
                                           return Client4.PP(_arg11);
                                          },esd))]));
                                         }
                                        else
                                         {
                                          if(_arg1.$==18)
                                           {
                                            ese=_arg1.$0;
                                            return Default.TR(List.map(function(_arg11)
                                            {
                                             return Client4.PP(_arg11);
                                            },ese));
                                           }
                                          else
                                           {
                                            if(_arg1.$==19)
                                             {
                                              esf=_arg1.$0;
                                              return Default.TD(List.map(function(_arg11)
                                              {
                                               return Client4.PP(_arg11);
                                              },esf));
                                             }
                                            else
                                             {
                                              if(_arg1.$==21)
                                               {
                                                es10=_arg1.$0;
                                                return Default.P(List.map(function(_arg11)
                                                {
                                                 return Client4.PP(_arg11);
                                                },es10));
                                               }
                                              else
                                               {
                                                if(_arg1.$==22)
                                                 {
                                                  es11=_arg1.$0;
                                                  x2=List.map(function(_arg11)
                                                  {
                                                   return Client4.PP(_arg11);
                                                  },es11);
                                                  _this3=Default.Tags();
                                                  return _this3.NewTag("strong",x2);
                                                 }
                                                else
                                                 {
                                                  if(_arg1.$==20)
                                                   {
                                                    es12=_arg1.$0;
                                                    return Default.Span(List.map(function(_arg11)
                                                    {
                                                     return Client4.PP(_arg11);
                                                    },es12));
                                                   }
                                                  else
                                                   {
                                                    t=_arg1.$0;
                                                    return Default.Text(t);
                                                   }
                                                 }
                                               }
                                             }
                                           }
                                         }
                                       }
                                     }
                                   }
                                 }
                               }
                             }
                           }
                         }
                       }
                     }
                   }
                 }
               }
             }
           }
         }
       },
       Translate:function(text)
       {
        var x,x1,x2,activePatternResult,e,e1,rest,f,f1,f2;
        x=(x1=(x2=(activePatternResult=MarkupLanguage["|REV_EXPRESSIONS|"](text),activePatternResult[1]===""?(e=activePatternResult[0],e):(e1=activePatternResult[0],(rest=activePatternResult[1],Runtime.New(T,{
         $:1,
         $0:{
          $:0,
          $0:rest
         },
         $1:e1
        })))),(f=function(list)
        {
         return List.rev(list);
        },f(x2))),(f1=function(list)
        {
         return List.map(function(_arg1)
         {
          return Client4.PP(_arg1);
         },list);
        },f1(x1)));
        f2=function(x3)
        {
         return Default.Div(x3);
        };
        return f2(x);
       }
      },
      MatchExpressions:function(acc,text)
      {
       var activePatternResult,expr,rest,activePatternResult1,expr1,rest1,activePatternResult2,expr2,rest2,activePatternResult3,expr3,rest3,activePatternResult4,expr4,rest4,activePatternResult5,expr5,rest5,activePatternResult6,expr6,rest6,activePatternResult7,expr7,rest7,activePatternResult8,expr8,rest8,activePatternResult9,expr9,rest9,activePatternResulta,expra,resta,activePatternResultb,exprb,restb,activePatternResultc,exprc,restc,activePatternResultd,exprd,restd,activePatternResulte,expre,reste,activePatternResultf,exprf,restf,activePatternResult10,expr10,rest10,activePatternResult11,expr11,rest11,activePatternResult12,expr12,rest12,activePatternResult13,expr13,rest13,activePatternResult14,expr14,rest14,activePatternResult15,rest15,activePatternResult16,rest16,matched,rest17,a;
       activePatternResult=MarkupLanguage["|CODE|_|"](text);
       if(activePatternResult.$==1)
        {
         expr=activePatternResult.$0[0];
         rest=activePatternResult.$0[1];
         return MarkupLanguage.MatchExpressions(Runtime.New(T,{
          $:1,
          $0:expr,
          $1:acc
         }),rest);
        }
       else
        {
         activePatternResult1=MarkupLanguage["|LINK|_|"](text);
         if(activePatternResult1.$==1)
          {
           expr1=activePatternResult1.$0[0];
           rest1=activePatternResult1.$0[1];
           return MarkupLanguage.MatchExpressions(Runtime.New(T,{
            $:1,
            $0:expr1,
            $1:acc
           }),rest1);
          }
         else
          {
           activePatternResult2=MarkupLanguage["|IMAGE|_|"](text);
           if(activePatternResult2.$==1)
            {
             expr2=activePatternResult2.$0[0];
             rest2=activePatternResult2.$0[1];
             return MarkupLanguage.MatchExpressions(Runtime.New(T,{
              $:1,
              $0:expr2,
              $1:acc
             }),rest2);
            }
           else
            {
             activePatternResult3=MarkupLanguage["|UNORDERED_LIST|_|"](text);
             if(activePatternResult3.$==1)
              {
               expr3=activePatternResult3.$0[0];
               rest3=activePatternResult3.$0[1];
               return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                $:1,
                $0:expr3,
                $1:acc
               }),rest3);
              }
             else
              {
               activePatternResult4=MarkupLanguage["|ORDERED_LIST|_|"](text);
               if(activePatternResult4.$==1)
                {
                 expr4=activePatternResult4.$0[0];
                 rest4=activePatternResult4.$0[1];
                 return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                  $:1,
                  $0:expr4,
                  $1:acc
                 }),rest4);
                }
               else
                {
                 activePatternResult5=MarkupLanguage["|LIST_ITEM|_|"](text);
                 if(activePatternResult5.$==1)
                  {
                   expr5=activePatternResult5.$0[0];
                   rest5=activePatternResult5.$0[1];
                   return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                    $:1,
                    $0:expr5,
                    $1:acc
                   }),rest5);
                  }
                 else
                  {
                   activePatternResult6=MarkupLanguage["|INLINE_CODE|_|"](text);
                   if(activePatternResult6.$==1)
                    {
                     expr6=activePatternResult6.$0[0];
                     rest6=activePatternResult6.$0[1];
                     return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                      $:1,
                      $0:expr6,
                      $1:acc
                     }),rest6);
                    }
                   else
                    {
                     activePatternResult7=MarkupLanguage["|H1|_|"](text);
                     if(activePatternResult7.$==1)
                      {
                       expr7=activePatternResult7.$0[0];
                       rest7=activePatternResult7.$0[1];
                       return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                        $:1,
                        $0:expr7,
                        $1:acc
                       }),rest7);
                      }
                     else
                      {
                       activePatternResult8=MarkupLanguage["|H2|_|"](text);
                       if(activePatternResult8.$==1)
                        {
                         expr8=activePatternResult8.$0[0];
                         rest8=activePatternResult8.$0[1];
                         return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                          $:1,
                          $0:expr8,
                          $1:acc
                         }),rest8);
                        }
                       else
                        {
                         activePatternResult9=MarkupLanguage["|H3|_|"](text);
                         if(activePatternResult9.$==1)
                          {
                           expr9=activePatternResult9.$0[0];
                           rest9=activePatternResult9.$0[1];
                           return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                            $:1,
                            $0:expr9,
                            $1:acc
                           }),rest9);
                          }
                         else
                          {
                           activePatternResulta=MarkupLanguage["|H4|_|"](text);
                           if(activePatternResulta.$==1)
                            {
                             expra=activePatternResulta.$0[0];
                             resta=activePatternResulta.$0[1];
                             return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                              $:1,
                              $0:expra,
                              $1:acc
                             }),resta);
                            }
                           else
                            {
                             activePatternResultb=MarkupLanguage["|QUOTE|_|"](text);
                             if(activePatternResultb.$==1)
                              {
                               exprb=activePatternResultb.$0[0];
                               restb=activePatternResultb.$0[1];
                               return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                $:1,
                                $0:exprb,
                                $1:acc
                               }),restb);
                              }
                             else
                              {
                               activePatternResultc=MarkupLanguage["|TABLE|_|"](text);
                               if(activePatternResultc.$==1)
                                {
                                 exprc=activePatternResultc.$0[0];
                                 restc=activePatternResultc.$0[1];
                                 return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                  $:1,
                                  $0:exprc,
                                  $1:acc
                                 }),restc);
                                }
                               else
                                {
                                 activePatternResultd=MarkupLanguage["|TR|_|"](text);
                                 if(activePatternResultd.$==1)
                                  {
                                   exprd=activePatternResultd.$0[0];
                                   restd=activePatternResultd.$0[1];
                                   return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                    $:1,
                                    $0:exprd,
                                    $1:acc
                                   }),restd);
                                  }
                                 else
                                  {
                                   activePatternResulte=MarkupLanguage["|TD|_|"](text);
                                   if(activePatternResulte.$==1)
                                    {
                                     expre=activePatternResulte.$0[0];
                                     reste=activePatternResulte.$0[1];
                                     return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                      $:1,
                                      $0:expre,
                                      $1:acc
                                     }),reste);
                                    }
                                   else
                                    {
                                     activePatternResultf=MarkupLanguage["|BOLD|_|"](text);
                                     if(activePatternResultf.$==1)
                                      {
                                       exprf=activePatternResultf.$0[0];
                                       restf=activePatternResultf.$0[1];
                                       return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                        $:1,
                                        $0:exprf,
                                        $1:acc
                                       }),restf);
                                      }
                                     else
                                      {
                                       activePatternResult10=MarkupLanguage["|STRIKE|_|"](text);
                                       if(activePatternResult10.$==1)
                                        {
                                         expr10=activePatternResult10.$0[0];
                                         rest10=activePatternResult10.$0[1];
                                         return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                          $:1,
                                          $0:expr10,
                                          $1:acc
                                         }),rest10);
                                        }
                                       else
                                        {
                                         activePatternResult11=MarkupLanguage["|P|_|"](text);
                                         if(activePatternResult11.$==1)
                                          {
                                           expr11=activePatternResult11.$0[0];
                                           rest11=activePatternResult11.$0[1];
                                           return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                            $:1,
                                            $0:expr11,
                                            $1:acc
                                           }),rest11);
                                          }
                                         else
                                          {
                                           activePatternResult12=MarkupLanguage["|SPAN|_|"](text);
                                           if(activePatternResult12.$==1)
                                            {
                                             expr12=activePatternResult12.$0[0];
                                             rest12=activePatternResult12.$0[1];
                                             return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                              $:1,
                                              $0:expr12,
                                              $1:acc
                                             }),rest12);
                                            }
                                           else
                                            {
                                             activePatternResult13=MarkupLanguage["|STRONG|_|"](text);
                                             if(activePatternResult13.$==1)
                                              {
                                               expr13=activePatternResult13.$0[0];
                                               rest13=activePatternResult13.$0[1];
                                               return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                                $:1,
                                                $0:expr13,
                                                $1:acc
                                               }),rest13);
                                              }
                                             else
                                              {
                                               activePatternResult14=MarkupLanguage["|ITALIC|_|"](text);
                                               if(activePatternResult14.$==1)
                                                {
                                                 expr14=activePatternResult14.$0[0];
                                                 rest14=activePatternResult14.$0[1];
                                                 return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                                  $:1,
                                                  $0:expr14,
                                                  $1:acc
                                                 }),rest14);
                                                }
                                               else
                                                {
                                                 activePatternResult15=MarkupLanguage["|LINE_BREAK|_|"](text);
                                                 if(activePatternResult15.$==1)
                                                  {
                                                   rest15=activePatternResult15.$0;
                                                   return MarkupLanguage.MatchExpressions(Runtime.New(T,{
                                                    $:1,
                                                    $0:{
                                                     $:1
                                                    },
                                                    $1:acc
                                                   }),rest15);
                                                  }
                                                 else
                                                  {
                                                   activePatternResult16=MarkupLanguage["|NORMAL_TEXT|"](text);
                                                   if(activePatternResult16[0]==="")
                                                    {
                                                     rest16=activePatternResult16[1];
                                                     return[acc,rest16];
                                                    }
                                                   else
                                                    {
                                                     matched=activePatternResult16[0];
                                                     rest17=activePatternResult16[1];
                                                     return MarkupLanguage.MatchExpressions((a=MarkupLanguage.replaceUrls(matched),List.append(a,acc)),rest17);
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      PP_NoMarkup:function(e)
      {
       var concat_exprs,f,mapping,g,es,es1,es2,es3,es4,es5,es6,es7,es8,es9,esa,esb,esc,esd,ese,esf,es10,es11,es12,lang,content,t;
       concat_exprs=(f=(mapping=function(e1)
       {
        return MarkupLanguage.PP_NoMarkup(e1);
       },function(list)
       {
        return List.map(mapping,list);
       }),(g=function(strings)
       {
        return Strings.concat("",strings);
       },function(x)
       {
        return g(f(x));
       }));
       if(e.$==1)
        {
         return"";
        }
       else
        {
         if(e.$==2)
          {
           es=e.$1;
           return concat_exprs(es);
          }
         else
          {
           if(e.$==3)
            {
             es1=e.$0;
             return concat_exprs(es1);
            }
           else
            {
             if(e.$==4)
              {
               es2=e.$0;
               return concat_exprs(es2);
              }
             else
              {
               if(e.$==5)
                {
                 es3=e.$0;
                 return concat_exprs(es3);
                }
               else
                {
                 if(e.$==6)
                  {
                   es4=e.$0;
                   return concat_exprs(es4);
                  }
                 else
                  {
                   if(e.$==12)
                    {
                     es5=e.$0;
                     return concat_exprs(es5);
                    }
                   else
                    {
                     if(e.$==13)
                      {
                       es6=e.$0;
                       return concat_exprs(es6);
                      }
                     else
                      {
                       if(e.$==14)
                        {
                         es7=e.$0;
                         return concat_exprs(es7);
                        }
                       else
                        {
                         if(e.$==15)
                          {
                           es8=e.$0;
                           return concat_exprs(es8);
                          }
                         else
                          {
                           if(e.$==16)
                            {
                             es9=e.$0;
                             return concat_exprs(es9);
                            }
                           else
                            {
                             if(e.$==17)
                              {
                               esa=e.$0;
                               return concat_exprs(esa);
                              }
                             else
                              {
                               if(e.$==18)
                                {
                                 esb=e.$0;
                                 return concat_exprs(esb);
                                }
                               else
                                {
                                 if(e.$==19)
                                  {
                                   esc=e.$0;
                                   return concat_exprs(esc);
                                  }
                                 else
                                  {
                                   if(e.$==9)
                                    {
                                     esd=e.$0;
                                     return concat_exprs(esd);
                                    }
                                   else
                                    {
                                     if(e.$==10)
                                      {
                                       ese=e.$0;
                                       return concat_exprs(ese);
                                      }
                                     else
                                      {
                                       if(e.$==21)
                                        {
                                         esf=e.$0;
                                         return concat_exprs(esf);
                                        }
                                       else
                                        {
                                         if(e.$==22)
                                          {
                                           es10=e.$0;
                                           return concat_exprs(es10);
                                          }
                                         else
                                          {
                                           if(e.$==20)
                                            {
                                             es11=e.$0;
                                             return concat_exprs(es11);
                                            }
                                           else
                                            {
                                             if(e.$==11)
                                              {
                                               es12=e.$0;
                                               return concat_exprs(es12);
                                              }
                                             else
                                              {
                                               if(e.$==7)
                                                {
                                                 lang=e.$0;
                                                 content=e.$1;
                                                 return content;
                                                }
                                               else
                                                {
                                                 if(e.$==8)
                                                  {
                                                   return"";
                                                  }
                                                 else
                                                  {
                                                   t=e.$0;
                                                   return t;
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      Regexp:function(pattern,text)
      {
       var x,f,mapping;
       x=MarkupLanguage.matchToken(pattern,1,text);
       f=(mapping=Runtime.Tupled(function(tuple)
       {
        return tuple[1];
       }),function(option)
       {
        return Option.map(mapping,option);
       });
       return f(x);
      },
      RemoveMarkup:function(_arg1)
      {
       var activePatternResult,s,e;
       activePatternResult=MarkupLanguage["|REV_EXPRESSIONS|"](_arg1);
       s=activePatternResult[1];
       e=activePatternResult[0];
       return Strings.concat("",List.rev(List.map(function(e1)
       {
        return MarkupLanguage.PP_NoMarkup(e1);
       },e)))+s;
      },
      Star:function(f,acc,s)
      {
       var matchValue,rest,res;
       matchValue=f(s);
       if(matchValue.$==0)
        {
         return{
          $:1,
          $0:[List.rev(acc),s]
         };
        }
       else
        {
         rest=matchValue.$0[1];
         res=matchValue.$0[0];
         return MarkupLanguage.Star(f,Runtime.New(T,{
          $:1,
          $0:res,
          $1:acc
         }),rest);
        }
      },
      TagArg:function(text)
      {
       var matchValue,x;
       matchValue=MarkupLanguage.match2Tokens(" *([^<> =]+)=\"([^\"]*)\"",2,3,text);
       if(matchValue.$==0)
        {
         return MarkupLanguage.match2Tokens(" *([^<> =]+)=([^<> =]+)",2,3,text);
        }
       else
        {
         x=matchValue.$0;
         return{
          $:1,
          $0:x
         };
        }
      },
      ValidTags:Runtime.Field(function()
      {
       return List.ofArray(["a","b","c","i","s","code","img","ul","ol","li","h1","h2","h3","h4","quote","table","tr","td","p","span","strong"]);
      }),
      match2Tokens:function(pattern,i1,i2,s)
      {
       var regexp,results,x,f,mapping;
       regexp=new RegExp("^("+pattern+")([\\s\\S]*)","i");
       results=regexp.exec(s);
       if(results==undefined)
        {
         return{
          $:0
         };
        }
       else
        {
         x={
          $:1,
          $0:results
         };
         f=(mapping=function(x1)
         {
          return[[x1[i1],x1[i2]],x1[x1.length-1]];
         },function(option)
         {
          return Option.map(mapping,option);
         });
         return f(x);
        }
      },
      matchToken:function(pattern,index,s)
      {
       var regexp,results,x,f,mapping;
       regexp=new RegExp("^("+pattern+")([\\s\\S]*)","i");
       results=regexp.exec(s);
       if(results==undefined)
        {
         return{
          $:0
         };
        }
       else
        {
         x={
          $:1,
          $0:results
         };
         f=(mapping=function(x1)
         {
          return[x1[index],x1[x1.length-1]];
         },function(option)
         {
          return Option.map(mapping,option);
         });
         return f(x);
        }
      },
      replaceUrls:function(t)
      {
       var replace_rec;
       replace_rec=function(acc,t1)
       {
        var regexp,_match_,before,link,domain,after,inLink;
        regexp=new RegExp("(.*)(https?://([^\\s/]+)(?:/[\\S]*)?)(.*)","i");
        _match_=regexp.exec(t1);
        if(Unchecked.Equals(_match_,null)?true:_match_.length===0)
         {
          return Runtime.New(T,{
           $:1,
           $0:{
            $:0,
            $0:t1
           },
           $1:acc
          });
         }
        else
         {
          before=_match_[1];
          link=_match_[2];
          domain=_match_[3];
          after=_match_[4];
          inLink="[link:"+domain+"]";
          return replace_rec(Runtime.New(T,{
           $:1,
           $0:{
            $:2,
            $0:link,
            $1:List.ofArray([{
             $:0,
             $0:inLink
            }])
           },
           $1:Runtime.New(T,{
            $:1,
            $0:{
             $:0,
             $0:after
            },
            $1:acc
           })
          }),before);
         }
       };
       return List.rev(replace_rec(Runtime.New(T,{
        $:0
       }),t));
      },
      skipWhile:function(f,l)
      {
       var l1,e,e1,l2;
       if(l.$==1)
        {
         if(l1=l.$1,(e=l.$0,f(e)))
          {
           e1=l.$0;
           l2=l.$1;
           return MarkupLanguage.skipWhile(f,l2);
          }
         else
          {
           return l;
          }
        }
       else
        {
         return l;
        }
      },
      validTagsRegex:Runtime.Field(function()
      {
       return Strings.concat("(?!\\w)|",MarkupLanguage.ValidTags())+"(?!\\w)";
      }),
      "|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|":function(tagName,text)
      {
       var activePatternResult,activePatternResult1,activePatternResult2,args,exprs,rest,exprs1,f;
       activePatternResult=MarkupLanguage["|OPEN_TAG|_|"](tagName,text);
       if(activePatternResult.$==1)
        {
         activePatternResult1=MarkupLanguage["|REV_EXPRESSIONS|"](activePatternResult.$0[1]);
         activePatternResult2=MarkupLanguage["|CLOSE_TAG_SKIP_BREAK_AFTER|_|"](tagName,activePatternResult1[1]);
         if(activePatternResult2.$==1)
          {
           args=activePatternResult.$0[0];
           exprs=activePatternResult1[0];
           rest=activePatternResult2.$0;
           exprs1=(f=function(list)
           {
            return List.rev(list);
           },f(exprs));
           return{
            $:1,
            $0:[exprs1,args,rest]
           };
          }
         else
          {
           return{
            $:0
           };
          }
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|BETWEEN_TAGS|_|":function(tagName,text)
      {
       var activePatternResult,activePatternResult1,activePatternResult2,args,exprs,rest,exprs1,f;
       activePatternResult=MarkupLanguage["|OPEN_TAG|_|"](tagName,text);
       if(activePatternResult.$==1)
        {
         activePatternResult1=MarkupLanguage["|REV_EXPRESSIONS|"](activePatternResult.$0[1]);
         activePatternResult2=MarkupLanguage["|CLOSE_TAG|_|"](tagName,activePatternResult1[1]);
         if(activePatternResult2.$==1)
          {
           args=activePatternResult.$0[0];
           exprs=activePatternResult1[0];
           rest=activePatternResult2.$0;
           exprs1=(f=function(list)
           {
            return List.rev(list);
           },f(exprs));
           return{
            $:1,
            $0:[exprs1,args,rest]
           };
          }
         else
          {
           return{
            $:0
           };
          }
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|BOLD|_|":function(_arg1)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS|_|"]("b",_arg1);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:3,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|CLOSE_TAG_SKIP_BREAK_AFTER|_|":function(tagName,text)
      {
       var x,f,mapping;
       x=MarkupLanguage.matchToken("</"+tagName+">\n?",1,text);
       f=(mapping=Runtime.Tupled(function(tuple)
       {
        return tuple[1];
       }),function(option)
       {
        return Option.map(mapping,option);
       });
       return f(x);
      },
      "|CLOSE_TAG|_|":function(tagName,text)
      {
       var x,f,mapping;
       x=MarkupLanguage.matchToken("</"+tagName+">",1,text);
       f=(mapping=Runtime.Tupled(function(tuple)
       {
        return tuple[1];
       }),function(option)
       {
        return Option.map(mapping,option);
       });
       return f(x);
      },
      "|CODE|_|":function(text)
      {
       var activePatternResult,activePatternResult1,args,code,rest,lang,matchValue,lang1,p,l1;
       activePatternResult=MarkupLanguage["|OPEN_TAG|_|"]("code",text);
       if(activePatternResult.$==1)
        {
         activePatternResult1=MarkupLanguage["|UNTIL_CLOSE_TAG_SKIP_BREAK_AFTER|_|"]("code",activePatternResult.$0[1]);
         if(activePatternResult1.$==1)
          {
           args=activePatternResult.$0[0];
           code=activePatternResult1.$0[0];
           rest=activePatternResult1.$0[1];
           lang=(matchValue=MarkupLanguage.Assoc("lang",args),matchValue.$==1?(lang1=matchValue.$0,(p=function(l)
           {
            return l===lang1;
           },(l1=MarkupLanguage.AcceptedLangs(),Seq.exists(p,l1)))?lang1:"text"):"text");
           return{
            $:1,
            $0:[{
             $:7,
             $0:lang,
             $1:code
            },rest]
           };
          }
         else
          {
           return{
            $:0
           };
          }
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|H1|_|":function(_arg10)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("h1",_arg10);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:12,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|H2|_|":function(_arg11)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("h2",_arg11);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:13,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|H3|_|":function(_arg12)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("h3",_arg12);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:14,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|H4|_|":function(_arg13)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("h4",_arg13);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:15,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|IMAGE|_|":function(_arg9)
      {
       var activePatternResult,args,rest,x,f,mapping;
       activePatternResult=MarkupLanguage["|SINGLE_TAG|_|"]("img",_arg9);
       if(activePatternResult.$==1)
        {
         args=activePatternResult.$0[0];
         rest=activePatternResult.$0[1];
         x=MarkupLanguage.Assoc("src",args);
         f=(mapping=function(src)
         {
          return[{
           $:8,
           $0:src
          },rest];
         },function(option)
         {
          return Option.map(mapping,option);
         });
         return f(x);
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|INLINE_CODE|_|":function(_arg4)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS|_|"]("c",_arg4);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:4,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|ITALIC|_|":function(_arg2)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS|_|"]("i",_arg2);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:5,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|LINE_BREAK|_|":function(text)
      {
       var x,f,mapping;
       x=MarkupLanguage.matchToken("\n",1,text);
       f=(mapping=Runtime.Tupled(function(tuple)
       {
        return tuple[1];
       }),function(option)
       {
        return Option.map(mapping,option);
       });
       return f(x);
      },
      "|LINK|_|":function(_arg8)
      {
       var activePatternResult,args,exprs,rest,matchValue,url;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS|_|"]("a",_arg8);
       if(activePatternResult.$==1)
        {
         args=activePatternResult.$0[1];
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         matchValue=MarkupLanguage.Assoc("href",args);
         if(matchValue.$==1)
          {
           url=matchValue.$0;
           return{
            $:1,
            $0:[{
             $:2,
             $0:url,
             $1:exprs
            },rest]
           };
          }
         else
          {
           return{
            $:1,
            $0:[{
             $:2,
             $0:"",
             $1:exprs
            },rest]
           };
          }
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|LIST_ITEM|_|":function(_arg7)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("li",_arg7);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:11,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|NORMAL_TEXT|":function(text)
      {
       var x,f;
       x=MarkupLanguage.matchToken("(((?!</?("+MarkupLanguage.validTagsRegex()+").*>|\n)[\\s\\S])*)",1,text);
       f=function(option)
       {
        return option.$0;
       };
       return f(x);
      },
      "|OPEN_TAG|_|":function(tagName,text)
      {
       var activePatternResult,activePatternResult1,activePatternResult2,args,rest;
       activePatternResult=MarkupLanguage["|START_TAG_AND_NAME|_|"](tagName,text);
       if(activePatternResult.$==1)
        {
         activePatternResult1=MarkupLanguage["|STAR|_|"](function(text1)
         {
          return MarkupLanguage.TagArg(text1);
         },activePatternResult.$0);
         if(activePatternResult1.$==1)
          {
           activePatternResult2=MarkupLanguage["|Regex|_|"](">\n*",activePatternResult1.$0[1]);
           if(activePatternResult2.$==1)
            {
             args=activePatternResult1.$0[0];
             rest=activePatternResult2.$0;
             return{
              $:1,
              $0:[args,rest]
             };
            }
           else
            {
             return{
              $:0
             };
            }
          }
         else
          {
           return{
            $:0
           };
          }
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|ORDERED_LIST|_|":function(_arg6)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("ol",_arg6);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:10,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|P|_|":function(_arg19)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("p",_arg19);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:19,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|QUOTE|_|":function(_arg14)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("quote",_arg14);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:16,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|REV_EXPRESSIONS|":function(text)
      {
       return MarkupLanguage.MatchExpressions(Runtime.New(T,{
        $:0
       }),text);
      },
      "|Regex|_|":function(pattern,text)
      {
       return MarkupLanguage.Regexp(pattern,text);
      },
      "|SINGLE_TAG|_|":function(tagName,text)
      {
       var activePatternResult,activePatternResult1,activePatternResult2,args,rest;
       activePatternResult=MarkupLanguage["|START_TAG_AND_NAME|_|"](tagName,text);
       if(activePatternResult.$==1)
        {
         activePatternResult1=MarkupLanguage["|STAR|_|"](function(text1)
         {
          return MarkupLanguage.TagArg(text1);
         },activePatternResult.$0);
         if(activePatternResult1.$==1)
          {
           activePatternResult2=MarkupLanguage["|Regex|_|"](">",activePatternResult1.$0[1]);
           if(activePatternResult2.$==1)
            {
             args=activePatternResult1.$0[0];
             rest=activePatternResult2.$0;
             return{
              $:1,
              $0:[args,rest]
             };
            }
           else
            {
             return{
              $:0
             };
            }
          }
         else
          {
           return{
            $:0
           };
          }
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|SPAN|_|":function(_arg18)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS|_|"]("span",_arg18);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:19,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|START_TAG_AND_NAME|_|":function(tagName,text)
      {
       return MarkupLanguage.Regexp("<"+tagName,text);
      },
      "|STAR|_|":function(f,s)
      {
       return MarkupLanguage.Star(f,Runtime.New(T,{
        $:0
       }),s);
      },
      "|STRIKE|_|":function(_arg3)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS|_|"]("s",_arg3);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:6,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|STRONG|_|":function(_arg20)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("strong",_arg20);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:3,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|TABLE|_|":function(_arg15)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("table",_arg15);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:17,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|TD|_|":function(_arg17)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("td",_arg17);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:19,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|TR|_|":function(_arg16)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("tr",_arg16);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:18,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|UNORDERED_LIST|_|":function(_arg5)
      {
       var activePatternResult,exprs,rest;
       activePatternResult=MarkupLanguage["|BETWEEN_TAGS_SKIP_BREAK_AFTER|_|"]("ul",_arg5);
       if(activePatternResult.$==1)
        {
         exprs=activePatternResult.$0[0];
         rest=activePatternResult.$0[2];
         return{
          $:1,
          $0:[{
           $:9,
           $0:exprs
          },rest]
         };
        }
       else
        {
         return{
          $:0
         };
        }
      },
      "|UNTIL_CLOSE_TAG_SKIP_BREAK_AFTER|_|":function(tagName,text)
      {
       return MarkupLanguage.matchToken("(((?!</"+tagName+">)[\\s\\S])*)</"+tagName+">\n?",2,text);
      }
     },
     Tags:{
      Client:{
       ParseTags:function(s)
       {
        var isSpaceSeparatedList,commaSplit,x,x1,x2,f,f1,predicate,f2,g,f3,mapping,f4,g1;
        isSpaceSeparatedList=function(arr)
        {
         if(arr.length===1)
          {
           return(new RegExp(" .* ")).test(arr[0]);
          }
         else
          {
           return false;
          }
        };
        commaSplit=s.split(",");
        x=(x1=(x2=isSpaceSeparatedList(commaSplit)?s.split(" "):commaSplit,(f=function(array)
        {
         return List.ofArray(array);
        },f(x2))),(f1=(predicate=(f2=function(value)
        {
         return!value;
        },(g=function(arg00)
        {
         return Strings.IsNullOrEmpty(arg00);
        },function(x3)
        {
         return f2(g(x3));
        })),function(list)
        {
         return List.filter(predicate,list);
        }),f1(x1)));
        f3=(mapping=(f4=function(s1)
        {
         return s1.toLowerCase();
        },(g1=function(s1)
        {
         return Client2.Trim(s1);
        },function(x3)
        {
         return f4(g1(x3));
        })),function(list)
        {
         return List.map(mapping,list);
        });
        return f3(x);
       },
       PrettyTags:function(s)
       {
        var x,f,mapping,f1,reduction;
        if(s.$==0)
         {
          return"";
         }
        else
         {
          x=(f=(mapping=function(s1)
          {
           return"'"+s1+"'";
          },function(list)
          {
           return List.map(mapping,list);
          }),f(s));
          f1=(reduction=function(s1)
          {
           return function(s2)
           {
            return s1+", "+s2;
           };
          },function(list)
          {
           return Seq.reduce(reduction,list);
          });
          return f1(x);
         }
       },
       Trim:function($s)
       {
        var $0=this,$this=this;
        return $s.replace(/^\s*/,"").replace(/\s*$/,"");
       }
      }
     },
     UI:{
      Client:{
       LoadingImage:function()
       {
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("loading-bar")])),List.ofArray([Default.Img(List.ofArray([Default.Src("http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif"),Default.Alt("Loading...")]))]));
       },
       LoadingPane:function(a)
       {
        var x,f,f1;
        x=Default.Div(Runtime.New(T,{
         $:0
        }));
        f=(f1=function(e)
        {
         var x1,f2,f4;
         x1=(f2=function()
         {
          var f3;
          f3=function(_arg12)
          {
           e.AppendI(_arg12);
           _arg12.Render();
           return Concurrency.Return(null);
          };
          return Concurrency.Bind(a,f3);
         },Concurrency.Delay(f2));
         f4=function(arg00)
         {
          var t;
          t={
           $:0
          };
          return Concurrency.Start(arg00);
         };
         return f4(x1);
        },function(w)
        {
         return Operators.OnAfterRender(f1,w);
        });
        f(x);
        return x;
       },
       SignupConfiguration:Runtime.Field(function()
       {
        var inputRecord,Padding1,Top,Bottom;
        inputRecord=FormContainerConfiguration.get_Default();
        Padding1=(Top={
         $:1,
         $0:10
        },(Bottom={
         $:1,
         $0:10
        },Runtime.New(Padding,{
         Left:{
          $:1,
          $0:20
         },
         Right:{
          $:1,
          $0:20
         },
         Top:Top,
         Bottom:Bottom
        })));
        return Runtime.New(FormContainerConfiguration,{
         Header:inputRecord.Header,
         Padding:Padding1,
         Description:inputRecord.Description,
         BackgroundColor:inputRecord.BackgroundColor,
         BorderColor:inputRecord.BorderColor,
         CssClass:inputRecord.CssClass,
         Style:inputRecord.Style
        });
       }),
       StandardConfiguration:Runtime.Field(function()
       {
        var inputRecord,Padding1,Top,Bottom;
        inputRecord=FormContainerConfiguration.get_Default();
        Padding1=(Top={
         $:1,
         $0:20
        },(Bottom={
         $:1,
         $0:20
        },Runtime.New(Padding,{
         Left:{
          $:1,
          $0:40
         },
         Right:{
          $:1,
          $0:80
         },
         Top:Top,
         Bottom:Bottom
        })));
        return Runtime.New(FormContainerConfiguration,{
         Header:inputRecord.Header,
         Padding:Padding1,
         Description:inputRecord.Description,
         BackgroundColor:inputRecord.BackgroundColor,
         BorderColor:inputRecord.BorderColor,
         CssClass:inputRecord.CssClass,
         Style:inputRecord.Style
        });
       }),
       Table:{
        AlternatingColor:function(trs)
        {
         var f,mapping;
         f=(mapping=function(i)
         {
          return function(tr)
          {
           var objectArg,arg00;
           if(i%2===1)
            {
             objectArg=tr["HtmlProvider@32"];
             (arg00=tr.Body,function(arg10)
             {
              return objectArg.AddClass(arg00,arg10);
             })("alt");
            }
           return tr;
          };
         },function(list)
         {
          return List.mapi(mapping,list);
         });
         return f(trs);
        },
        NormalMiddleTable:function(headtr,trs)
        {
         return Operators.add(Default.Table(List.ofArray([Default.Attr().Class("normal middle")])),headtr.$==1?List.ofArray([Default.THead(List.ofArray([headtr.$0])),Default.TBody(trs)]):List.ofArray([Default.TBody(trs)]));
        },
        NormalTable:function(headtr,trs)
        {
         return Operators.add(Default.Table(List.ofArray([Default.Attr().Class("normal")])),headtr.$==1?List.ofArray([Default.THead(List.ofArray([headtr.$0])),Default.TBody(trs)]):List.ofArray([Default.TBody(trs)]));
        }
       },
       TogglePanel:function(elem)
       {
        return Client3.TogglePanelCustom({
         LabelShow:"Show",
         LabelHide:"Hide"
        },elem);
       },
       TogglePanelCustom:function(conf,body)
       {
        var content,x,f,x1;
        content=Default.Div(List.ofArray([body]));
        return Operators.add(Default.Div(List.ofArray([Default.Attr().Class("toggle-panel")])),List.ofArray([Operators.add(Default.Div(List.ofArray([Default.Attr().Class("toggle-panel-menu")])),List.ofArray([(x=Operators.add(Default.Div(List.ofArray([Default.Attr().Class("toggle-panel-link")])),List.ofArray([Default.Text(conf.LabelHide)])),(f=(x1=function(alink)
        {
         return function()
         {
          if(jQuery(content.Body).is(":visible"))
           {
            jQuery(content.Body).slideUp("fast",function(value)
            {
             value;
            });
            return jQuery(alink.Body).text(conf.LabelShow);
           }
          else
           {
            jQuery(content.Body).slideDown("fast",function(value)
            {
             value;
            });
            return jQuery(alink.Body).text(conf.LabelHide);
           }
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        }),(f(x),x)))])),content]));
       }
      },
      Server:{
       Client:{
        ToggleControl:Runtime.Class({
         get_Body:function()
         {
          var content,x,f,f1,_this=this;
          content=Default.Div(Runtime.New(T,{
           $:0
          }));
          x=Client3.TogglePanel(content);
          f=(f1=function(el)
          {
           var objectArg,arg00;
           jQuery(content.Body).append(jQuery("#"+_this.id));
           objectArg=el["HtmlProvider@32"];
           return((arg00=el.Body,function(arg10)
           {
            return function(arg20)
            {
             return objectArg.SetCss(arg00,arg10,arg20);
            };
           })("display"))("block");
          },function(w)
          {
           return Operators.OnAfterRender(f1,w);
          });
          f(x);
          return x;
         }
        })
       }
      }
     }
    },
    Widget:{
     Client:{
      AddRemoveAdminsForm:function(addRpc,removeRpc,currentAdmins)
      {
       var admins,buttonClass,entry,tbody,addForm;
       admins={
        contents:currentAdmins
       };
       buttonClass=Server.Small();
       entry=function(name)
       {
        var tr,_this,_builder_;
        tr=Default.TR(Runtime.New(T,{
         $:0
        }));
        return Operators.add(tr,List.ofArray([Operators.add(Default.TD(List.ofArray([(_this=Default.Attr(),_this.NewAttr("style","text-align: right; vertical-align: middle;"))])),List.ofArray([Default.Text(name)])),Default.TD(List.ofArray([(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         var x,f;
         return _builder_.Bind((x=Formlet1.Return(null),(f=function(formlet)
         {
          return Client1.EnhanceWithCustomSubmitButton(buttonClass,"Remove",formlet);
         },f(x))),function()
         {
          return _builder_.Bind(Formlet2.LoadingFormletWithLogin(removeRpc(name)),function(_arg25)
          {
           var msg;
           return _builder_.ReturnFrom(_arg25.$==0?(tr["HtmlProvider@32"].Clear(tr.Body),Formlet1.Return(null)):(msg=_arg25.$0,FormletHelpers.ErrorF(msg)));
          });
         });
        }))]))]));
       };
       tbody=Default.TBody(Runtime.New(T,{
        $:0
       }));
       addForm=function()
       {
        var _this,_builder_;
        return Operators.add(Default.TD(List.ofArray([(_this=Default.Attr(),_this.NewAttr("colspan","2"))])),List.ofArray([(_builder_=Formlet1.Do(),_builder_.Delay(function()
        {
         var x,x1,f,f1;
         return _builder_.Bind((x=(x1=FwLS.Input("Username","Enter the username of the new administrator","zone-add-admin-input"),(f=function(formlet)
         {
          return Client1.EnhanceWithCustomSubmitButton(buttonClass,"Add administrator",formlet);
         },f(x1))),(f1=function(formlet)
         {
          return Enhance.WithFormContainer(formlet);
         },f1(x))),function(_arg28)
         {
          return _builder_.Bind(Formlet2.LoadingFormletWithLogin(addRpc(_arg28)),function(_arg27)
          {
           var x2,f2,predicate,a,b,x3,f3,action,msg;
           return _builder_.ReturnFrom(_arg27.$==0?(tbody["HtmlProvider@32"].Clear(tbody.Body),(!(x2=admins.contents,(f2=(predicate=function(admin)
           {
            return admin===_arg28;
           },function(list)
           {
            return Seq.exists(predicate,list);
           }),f2(x2)))?admins.contents=(a=admins.contents,(b=List.ofArray([_arg28]),List.append(a,b))):null,(x3=admins.contents,(f3=(action=function(admin)
           {
            return tbody.AppendI(entry(admin));
           },function(list)
           {
            return Seq.iter(action,list);
           }),f3(x3)),(tbody.AppendI(addForm(null)),Formlet1.Return(null))))):(msg=_arg27.$0,FormletHelpers.ErrorF(msg)));
          });
         });
        }))]));
       };
       return Operators.add(Default.Table(List.ofArray([Default.Attr().Class("zone-admin-admins-form")])),List.ofArray([Operators.add(tbody,Seq.toList(Seq.delay(function()
       {
        var x,f;
        return Seq.append((x=admins.contents,(f=function(list)
        {
         return List.map(entry,list);
        },f(x))),Seq.delay(function()
        {
         return[addForm(null)];
        }));
       })))]));
      },
      Button:function(label,href,cl)
      {
       return Operators.add(Default.A(Seq.toList(Seq.delay(function()
       {
        var value;
        return Seq.append((value=Strings.IsNullOrEmpty(href),!value)?[Default.HRef(href)]:Seq.empty(),Seq.delay(function()
        {
         return[Default.Attr().Class(cl)];
        }));
       }))),List.ofArray([Default.Text(label)]));
      },
      EnhanceWithCustomSubmitAndResetButtons:function(cl,submit,reset,formlet)
      {
       var inputRecord,Class,inputRecord1,Class1;
       return Enhance.WithCustomSubmitAndResetButtons((inputRecord=FormButtonConfiguration.get_Default(),(Class={
        $:1,
        $0:cl
       },Runtime.New(FormButtonConfiguration,{
        Label:{
         $:1,
         $0:submit
        },
        Style:inputRecord.Style,
        Class:Class
       }))),(inputRecord1=FormButtonConfiguration.get_Default(),(Class1={
        $:1,
        $0:cl
       },Runtime.New(FormButtonConfiguration,{
        Label:{
         $:1,
         $0:reset
        },
        Style:inputRecord1.Style,
        Class:Class1
       }))),formlet);
      },
      EnhanceWithCustomSubmitButton:function(cl,submit,formlet)
      {
       var inputRecord,Class;
       return Enhance.WithCustomSubmitButton((inputRecord=FormButtonConfiguration.get_Default(),(Class={
        $:1,
        $0:cl
       },Runtime.New(FormButtonConfiguration,{
        Label:{
         $:1,
         $0:submit
        },
        Style:inputRecord.Style,
        Class:Class
       }))),formlet);
      },
      EnhanceWithSubmitAndResetButtons:function(cl,formlet)
      {
       return Client1.EnhanceWithCustomSubmitAndResetButtons(cl,"Submit","Reset",formlet);
      },
      EnhanceWithSubmitButton:function(cl,formlet)
      {
       return Client1.EnhanceWithCustomSubmitButton(cl,"Submit",formlet);
      },
      HoverSummary:function(extraClass,imageUrl,imageLink,content)
      {
       var summaryContainer,_this,_this1,basicThumbnail,_this2;
       summaryContainer=Operators.add(Default.Div(List.ofArray([Default.Attr().Class("thumbnail-summary-container hidden "+extraClass)])),List.ofArray([Default.Div(Runtime.New(T,{
        $:1,
        $0:Operators.add(Default.Div(List.ofArray([Default.Attr().Class("thumbnail-summary-photo")])),List.ofArray([Operators.add(Default.A(List.ofArray([(_this=Default.Attr(),_this.NewAttr("href",imageLink))])),List.ofArray([Default.Img(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("src",imageUrl))]))]))])),
        $1:content
       }))]));
       basicThumbnail=Operators.add(Default.Div(List.ofArray([Default.Attr().Class("thumbnail-holder")])),List.ofArray([Operators.add(Default.A(List.ofArray([(_this2=Default.Attr(),_this2.NewAttr("href",imageLink))])),List.ofArray([Default.Img(List.ofArray([Default.Src(imageUrl)]))]))]));
       return Default.Div(List.ofArray([summaryContainer,basicThumbnail]));
      },
      OrganizationImageHoverSummary:Runtime.Class({
       get_Body:function()
       {
        var cssClass,_this,x;
        cssClass="org-summary-container "+(this.ExpandToTheRight?"expand-right":"expand-left");
        return Client1.HoverSummary(cssClass,this.ImageUrl,this.OrganizationUrl,List.ofArray([Default.Div(List.ofArray([Operators.add(Default.A(List.ofArray([(_this=Default.Attr(),(x=this.OrganizationUrl,_this.NewAttr("href",x)))])),List.ofArray([Default.Text(this.OrganizationName)]))])),Default.Div(List.ofArray([Default.Text(this.OrganizationDescription)]))]));
       }
      }),
      TagCloudUnfoldButton:Runtime.Class({
       get_Body:function()
       {
        var x,_this,_this1,f,x1,_this2=this;
        x=Operators.add(Default.Div(List.ofArray([Default.Attr().Class("tag-cloud-unfold-button")])),List.ofArray([Default.Img(List.ofArray([(_this=Default.Attr(),_this.NewAttr("src","/images/downarrow.gif"))])),Default.Text("See all tags"),Default.Img(List.ofArray([(_this1=Default.Attr(),_this1.NewAttr("src","/images/downarrow.gif"))]))]));
        f=(x1=function(e)
        {
         return function()
         {
          var jq,x2,_this3,_this4,_this5,_this6,f1;
          _this2.isFolded=!_this2.isFolded;
          jq=jQuery(_this2.selector);
          e["HtmlProvider@32"].Clear(e.Body);
          x2=_this2.isFolded?(e.AppendI(Default.Img(List.ofArray([(_this3=Default.Attr(),_this3.NewAttr("src","/images/downarrow.gif"))]))),(e.AppendI(Default.Text("See all tags")),(e.AppendI(Default.Img(List.ofArray([(_this4=Default.Attr(),_this4.NewAttr("src","/images/downarrow.gif"))]))),jq.addClass("folded")))):(e.AppendI(Default.Img(List.ofArray([(_this5=Default.Attr(),_this5.NewAttr("src","/images/uparrow.gif"))]))),(e.AppendI(Default.Text("Hide tags")),(e.AppendI(Default.Img(List.ofArray([(_this6=Default.Attr(),_this6.NewAttr("src","/images/uparrow.gif"))]))),jq.removeClass("folded"))));
          f1=function(value)
          {
           value;
          };
          return f1(x2);
         };
        },function(arg10)
        {
         return EventsPervasives.Events().OnClick(x1,arg10);
        });
        f(x);
        return x;
       }
      }),
      UserImageHoverSummary:Runtime.Class({
       Badge:function(name,alt)
       {
        var _this,x,_this1,_this2;
        return Default.Img(List.ofArray([(_this=Default.Attr(),(x="/images/badges/badge-"+name+".png",_this.NewAttr("src",x))),(_this1=Default.Attr(),_this1.NewAttr("alt",alt)),(_this2=Default.Attr(),_this2.NewAttr("title",alt)),Default.Attr().Class("badge badge-"+name)]));
       },
       NoBadge:function()
       {
        var _this;
        return Default.Img(List.ofArray([(_this=Default.Attr(),_this.NewAttr("src","/images/badges/badge-transparent.png")),Default.Attr().Class("badge badge-none")]));
       },
       get_Body:function()
       {
        var showCount,showFullCount,patternInput,zone,score,group,dev,author,cssClass,_this,x1,_this1,x2,_this2=this;
        showCount=function(count)
        {
         if(count>=1000000)
          {
           return Global.String(count/1000000>>0)+"."+Global.String((count/100000>>0)%10)+"M";
          }
         else
          {
           if(count>=1000)
            {
             return Global.String(count/1000>>0)+"."+Global.String((count/100>>0)%10)+"k";
            }
           else
            {
             return Global.String(count);
            }
          }
        };
        showFullCount=function(count)
        {
         var s,i,x,f;
         s=Global.String(count);
         i={
          contents:s.length%3-3
         };
         if(i.contents===-3)
          {
           i.contents=0;
          }
         x=Seq.toList(Seq.delay(function()
         {
          return Seq.enumWhile(function()
          {
           return i.contents<s.length;
          },Seq.delay(function()
          {
           var from,_to_;
           return Seq.append([(from=i.contents,(_to_=i.contents+3,s.substring(from,_to_)))],Seq.delay(function()
           {
            i.contents=i.contents+3;
            return Seq.empty();
           }));
          }));
         }));
         f=function(strings)
         {
          return Strings.concat(",",strings);
         };
         return f(x);
        };
        patternInput=[this.UserScore.Reputation,this.UserScore.ZoneAdmin,this.UserScore.GroupAdmin,this.UserScore.Developer,this.UserScore.Author];
        zone=patternInput[1];
        score=patternInput[0];
        group=patternInput[2];
        dev=patternInput[3];
        author=patternInput[4];
        cssClass="user-summary-container "+(this.ExpandToTheRight?"expand-right":"expand-left");
        return Client1.HoverSummary(cssClass,this.ImageUrl,this.UserProfileUrl,List.ofArray([Default.Div(List.ofArray([Operators.add(Default.A(List.ofArray([(_this=Default.Attr(),(x1=this.UserProfileUrl,_this.NewAttr("href",x1)))])),List.ofArray([Default.Text(this.UserName)]))])),Operators.add(Default.Div(List.ofArray([Default.Attr().Class("user-score"),(_this1=Default.Attr(),(x2=showFullCount(score),_this1.NewAttr("title",x2)))])),List.ofArray([Default.Text(showCount(score))])),Operators.add(Default.Div(List.ofArray([Default.Attr().Class("badges")])),List.ofArray([Default.UL(Seq.toList(Seq.delay(function()
        {
         return Seq.append(_this2.UserScore.ZoneAdmin+_this2.UserScore.GroupAdmin>0?Seq.append(_this2.UserScore.ZoneAdmin>0?[Default.LI(List.ofArray([_this2.Badge("zone-admin","Zone Admin")]))]:[Default.LI(List.ofArray([_this2.NoBadge()]))],Seq.delay(function()
         {
          if(_this2.UserScore.GroupAdmin>0)
           {
            return[Default.LI(List.ofArray([_this2.Badge("group-admin","Group Admin")]))];
           }
          else
           {
            return[Default.LI(List.ofArray([_this2.NoBadge()]))];
           }
         })):Seq.empty(),Seq.delay(function()
         {
          if(_this2.UserScore.Author?true:_this2.UserScore.Developer)
           {
            return Seq.append(_this2.UserScore.Author?[Default.LI(List.ofArray([_this2.Badge("author","Author")]))]:[Default.LI(List.ofArray([_this2.NoBadge()]))],Seq.delay(function()
            {
             if(_this2.UserScore.Developer)
              {
               return[Default.LI(List.ofArray([_this2.Badge("developer","Developer")]))];
              }
             else
              {
               return[Default.LI(List.ofArray([_this2.NoBadge()]))];
              }
            }));
           }
          else
           {
            return Seq.empty();
           }
         }));
        })))]))]));
       }
      })
     }
    },
    Zone:{
     Client:{
      AdminForm:Runtime.Class({
       get_Body:function()
       {
        var matchValue,zone,adminsForm;
        matchValue=this.Zone;
        if(matchValue.$==1)
         {
          zone=matchValue.$0;
          adminsForm=Client1.AddRemoveAdminsForm(function(name)
          {
           return Remoting.Async("IntelliFactory.Trainings:29",[zone.Tag,name]);
          },function(name)
          {
           return Remoting.Async("IntelliFactory.Trainings:28",[zone.Tag,name]);
          },zone.AdminUsernames);
          return Tabs.New2(List.ofArray([["Zone information",Default.Div(List.ofArray([Client12.InfoForm(zone.Tag,zone.Name,zone.PageContentHtml)]))],["Features",Default.Div(List.ofArray([Client12.FeaturesForm(zone)]))],["Administrators",Default.Div(List.ofArray([adminsForm]))]]));
         }
        else
         {
          return Default.Div(List.ofArray([Default.Text("Error: No such zone.")]));
         }
       }
      }),
      FeaturesForm:function(zone)
      {
       return Operators.add(Default.Table(List.ofArray([Default.Attr().Class("zone-admin-features")])),List.ofArray([Default.TBody(List.ofArray([Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Forum")])),Default.TD(List.ofArray([Client12.ToggleButton(Runtime.Tupled(function(tupledArg)
       {
        var zoneTag,value;
        zoneTag=tupledArg[0];
        value=tupledArg[1];
        return Remoting.Async("IntelliFactory.Trainings:20",[zoneTag,value]);
       }),zone.Tag,zone.HasForum)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Events")])),Default.TD(List.ofArray([Client12.ToggleButton(Runtime.Tupled(function(tupledArg)
       {
        var zoneTag,value;
        zoneTag=tupledArg[0];
        value=tupledArg[1];
        return Remoting.Async("IntelliFactory.Trainings:21",[zoneTag,value]);
       }),zone.Tag,zone.HasEvents)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Courses")])),Default.TD(List.ofArray([Client12.ToggleButton(Runtime.Tupled(function(tupledArg)
       {
        var zoneTag,value;
        zoneTag=tupledArg[0];
        value=tupledArg[1];
        return Remoting.Async("IntelliFactory.Trainings:22",[zoneTag,value]);
       }),zone.Tag,zone.HasCourses)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Blog entries")])),Default.TD(List.ofArray([Client12.ToggleButton(Runtime.Tupled(function(tupledArg)
       {
        var zoneTag,value;
        zoneTag=tupledArg[0];
        value=tupledArg[1];
        return Remoting.Async("IntelliFactory.Trainings:23",[zoneTag,value]);
       }),zone.Tag,zone.HasBlogs)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Groups")])),Default.TD(List.ofArray([Client12.ToggleButton(Runtime.Tupled(function(tupledArg)
       {
        var zoneTag,value;
        zoneTag=tupledArg[0];
        value=tupledArg[1];
        return Remoting.Async("IntelliFactory.Trainings:24",[zoneTag,value]);
       }),zone.Tag,zone.HasGroups)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Conferences")])),Default.TD(List.ofArray([Client12.ToggleButton(Runtime.Tupled(function(tupledArg)
       {
        var zoneTag,value;
        zoneTag=tupledArg[0];
        value=tupledArg[1];
        return Remoting.Async("IntelliFactory.Trainings:25",[zoneTag,value]);
       }),zone.Tag,zone.HasConferences)]))])),Default.TR(List.ofArray([Default.TD(List.ofArray([Default.Text("Developers")])),Default.TD(List.ofArray([Client12.ToggleButton(Runtime.Tupled(function(tupledArg)
       {
        var zoneTag,value;
        zoneTag=tupledArg[0];
        value=tupledArg[1];
        return Remoting.Async("IntelliFactory.Trainings:26",[zoneTag,value]);
       }),zone.Tag,zone.HasDevelopers)]))]))]))]));
      },
      InfoForm:function(zoneTag,name,pageContent)
      {
       var form,x,x1,x2,f,cl,f1,_builder_;
       form=(x=(x1=Data.$(Data.$((x2=function(name1)
       {
        return function(pageContent1)
        {
         return[name1,pageContent1];
        };
       },Formlet1.Return(x2)),FwL.InputWithValue(name,"Name","Enter the name of the zone")),FwL.RichEditorWithValue(pageContent,"Home page","Write the home page for the zone")),(f=(cl=Server.Small(),function(formlet)
       {
        return Client1.EnhanceWithSubmitAndResetButtons(cl,formlet);
       }),f(x1))),(f1=function(formlet)
       {
        return Enhance.WithFormContainer(formlet);
       },f1(x)));
       _builder_=Formlet1.Do();
       return _builder_.Delay(function()
       {
        return _builder_.Bind(form,Runtime.Tupled(function(_arg176)
        {
         var pageContent1,name1,x3,f2;
         pageContent1=_arg176[1];
         name1=_arg176[0];
         return _builder_.Bind((x3=Remoting.Async("IntelliFactory.Trainings:27",[zoneTag,name1,pageContent1]),(f2=function(a)
         {
          return Formlet2.LoadingFormletWithLogin(a);
         },f2(x3))),function(_arg175)
         {
          var msg;
          return _builder_.ReturnFrom(_arg175.$==1?(msg=_arg175.$0,FormletHelpers.ErrorF("Error: "+msg)):FormletHelpers.SuccessF("The zone was successfully modified."));
         });
        }));
       });
      },
      ToggleButton:function(callback,zoneTag,initStatus)
      {
       var status,container,message,label,button,x,f,x1;
       status={
        contents:initStatus
       };
       container=Default.Span(List.ofArray([Default.Attr().Class("togglebutton")]));
       message=Default.Span(List.ofArray([Default.Attr().Class("message")]));
       label=Operators.add(Default.Span(List.ofArray([Default.Attr().Class("label")])),List.ofArray([Default.Text(status.contents?"Yes":"No")]));
       button=(x=Operators.add(Default.Button(List.ofArray([Default.Attr().Class("button "+Server.Small())])),List.ofArray([Default.Text(status.contents?"Deactivate":"Activate")])),(f=(x1=function(e)
       {
        return function()
        {
         var _builder_;
         return message.AppendI((_builder_=Formlet1.Do(),_builder_.Delay(function()
         {
          return _builder_.Bind(Formlet2.LoadingFormletWithLogin(callback([zoneTag,!status.contents])),function(_arg177)
          {
           var msg,text,objectArg,arg00;
           return _builder_.Return((message["HtmlProvider@32"].Clear(message.Body),_arg177.$==1?(msg=_arg177.$0,message.AppendI(Default.Text("Error: "+msg))):(status.contents=!status.contents,(e["HtmlProvider@32"].Clear(e.Body),(e.AppendI(Default.Text(status.contents?"Deactivate":"Activate")),(label["HtmlProvider@32"].Clear(label.Body),(text=status.contents?"Yes":"No",(objectArg=label["HtmlProvider@32"],(arg00=label.Body,function(arg10)
           {
            return objectArg.AppendNode(arg00,arg10);
           })(label["HtmlProvider@32"].CreateTextNode(text))))))))));
          });
         })));
        };
       },function(arg10)
       {
        return EventsPervasives.Events().OnClick(x1,arg10);
       }),(f(x),x)));
       return Operators.add(container,List.ofArray([label,button,message]));
      }
     }
    }
   }
  }
 });
 Runtime.OnInit(function()
 {
  WebSharper=Runtime.Safe(Global.IntelliFactory.WebSharper);
  Formlet=Runtime.Safe(WebSharper.Formlet);
  Formlet1=Runtime.Safe(Formlet.Formlet);
  Controls=Runtime.Safe(Formlet.Controls);
  Enhance=Runtime.Safe(Formlet.Enhance);
  FormButtonConfiguration=Runtime.Safe(Enhance.FormButtonConfiguration);
  Trainings=Runtime.Safe(Global.IntelliFactory.Trainings);
  Config=Runtime.Safe(Trainings.Config);
  Button=Runtime.Safe(Config.Button);
  Server=Runtime.Safe(Button.Server);
  Utils=Runtime.Safe(Trainings.Utils);
  Formlet2=Runtime.Safe(Utils.Formlet);
  Enhance1=Runtime.Safe(Formlet2.Enhance);
  Remoting=Runtime.Safe(WebSharper.Remoting);
  Controls1=Runtime.Safe(Formlet2.Controls);
  List=Runtime.Safe(WebSharper.List);
  Admin=Runtime.Safe(Trainings.Admin);
  Client=Runtime.Safe(Admin.Client);
  Html=Runtime.Safe(WebSharper.Html);
  Default=Runtime.Safe(Html.Default);
  Operators=Runtime.Safe(Html.Operators);
  T=Runtime.Safe(List.T);
  Widget=Runtime.Safe(Trainings.Widget);
  Client1=Runtime.Safe(Widget.Client);
  JS=Runtime.Safe(Trainings.JS);
  FormletHelpers=Runtime.Safe(JS.FormletHelpers);
  EventsPervasives=Runtime.Safe(Html.EventsPervasives);
  Seq=Runtime.Safe(WebSharper.Seq);
  Concurrency=Runtime.Safe(WebSharper.Concurrency);
  Data=Runtime.Safe(Formlet.Data);
  UserControls=Runtime.Safe(Trainings.UserControls);
  Tags=Runtime.Safe(Utils.Tags);
  Client2=Runtime.Safe(Tags.Client);
  FormletHelpers1=Runtime.Safe(Trainings.FormletHelpers);
  FwL=Runtime.Safe(FormletHelpers1.FwL);
  Padding=Runtime.Safe(Enhance.Padding);
  FormContainerConfiguration=Runtime.Safe(Enhance.FormContainerConfiguration);
  UI=Runtime.Safe(Utils.UI);
  Client3=Runtime.Safe(UI.Client);
  Enhance2=Runtime.Safe(FormletHelpers.Enhance);
  Layout=Runtime.Safe(Formlet.Layout);
  LabelConfiguration=Runtime.Safe(Layout.LabelConfiguration);
  jQuery=Runtime.Safe(Global.jQuery);
  Strings=Runtime.Safe(WebSharper.Strings);
  MarkupLanguage=Runtime.Safe(Utils.MarkupLanguage);
  Client4=Runtime.Safe(MarkupLanguage.Client);
  SyntaxHighlighter=Runtime.Safe(Global.SyntaxHighlighter);
  Option=Runtime.Safe(WebSharper.Option);
  Date=Runtime.Safe(Global.Date);
  Dao=Runtime.Safe(Trainings.Dao);
  DateDAO=Runtime.Safe(Dao.DateDAO);
  TimeDAO=Runtime.Safe(Dao.TimeDAO);
  JQueryUI=Runtime.Safe(Formlet.JQueryUI);
  Controls2=Runtime.Safe(JQueryUI.Controls);
  Number=Runtime.Safe(Global.Number);
  FwLS=Runtime.Safe(FormletHelpers1.FwLS);
  Company=Runtime.Safe(Trainings.Company);
  Client5=Runtime.Safe(Company.Client);
  Yui=Runtime.Safe(Formlet.Yui);
  Controls3=Runtime.Safe(Yui.Controls);
  LocationDetails=Runtime.Safe(Dao.LocationDetails);
  Location=Runtime.Safe(Trainings.Location);
  Client6=Runtime.Safe(Location.Client);
  location=Runtime.Safe(Global.location);
  ConferenceSupport=Runtime.Safe(Dao.ConferenceSupport);
  ConferenceExtraDAO=Runtime.Safe(ConferenceSupport.ConferenceExtraDAO);
  Operators1=Runtime.Safe(WebSharper.Operators);
  FwS=Runtime.Safe(FormletHelpers1.FwS);
  Trainings1=Runtime.Safe(Trainings.Trainings);
  Client7=Runtime.Safe(Trainings1.Client);
  Courses=Runtime.Safe(Trainings.Courses);
  Client8=Runtime.Safe(Courses.Client);
  Forms=Runtime.Safe(Client8.Forms);
  Default1=Runtime.Safe(Forms.Default);
  EventOrCourseCreation=Runtime.Safe(Dao.EventOrCourseCreation);
  CreateEventOrCourseType=Runtime.Safe(EventOrCourseCreation.CreateEventOrCourseType);
  EcmaScript=Runtime.Safe(Trainings.EcmaScript);
  ExtraInformationDAO=Runtime.Safe(EventOrCourseCreation.ExtraInformationDAO);
  PricingDAO=Runtime.Safe(Dao.PricingDAO);
  TimeAndDurationDAO=Runtime.Safe(Dao.TimeAndDurationDAO);
  EventOrCourseDetailsDAO_WebcastDetails=Runtime.Safe(EventOrCourseCreation.EventOrCourseDetailsDAO_WebcastDetails);
  ReadOnly=Runtime.Safe(FwLS.ReadOnly);
  PayPal=Runtime.Safe(Trainings.PayPal);
  Controls4=Runtime.Safe(PayPal.Controls);
  DateTime=Runtime.Safe(WebSharper.DateTime);
  DeveloperProfileUpdateData=Runtime.Safe(Dao.DeveloperProfileUpdateData);
  JobLocation=Runtime.Safe(Dao.JobLocation);
  JobOffer=Runtime.Safe(Dao.JobOffer);
  SchoolInfo=Runtime.Safe(Dao.SchoolInfo);
  TrainerOptionsDAO=Runtime.Safe(Dao.TrainerOptionsDAO);
  UserOptionsDAO=Runtime.Safe(Dao.UserOptionsDAO);
  WorkPlaceInfo=Runtime.Safe(Dao.WorkPlaceInfo);
  DeveloperSearch=Runtime.Safe(Trainings.DeveloperSearch);
  $=Runtime.Safe(Global.$);
  TinyMce=Runtime.Safe(Formlet.TinyMce);
  AdvancedHtmlEditorConfiguration=Runtime.Safe(TinyMce.AdvancedHtmlEditorConfiguration);
  Controls5=Runtime.Safe(TinyMce.Controls);
  ReadOnly1=Runtime.Safe(FwL.ReadOnly);
  FwoL=Runtime.Safe(FormletHelpers1.FwoL);
  Forum=Runtime.Safe(Trainings.Forum);
  Client9=Runtime.Safe(Forum.Client);
  Lazy=Runtime.Safe(WebSharper.Lazy);
  ContactButtonConfiguration=Runtime.Safe(Client9.ContactButtonConfiguration);
  JQueryUI1=Runtime.Safe(WebSharper.JQueryUI);
  Tabs=Runtime.Safe(JQueryUI1.Tabs);
  alert=Runtime.Safe(Global.alert);
  window=Runtime.Safe(Global.window);
  Invite=Runtime.Safe(Trainings.Invite);
  Clienta=Runtime.Safe(Invite.Client);
  self=Runtime.Safe(Global.self);
  setTimeout=Runtime.Safe(Global.setTimeout);
  JobOffer1=Runtime.Safe(Trainings.JobOffer);
  Clientb=Runtime.Safe(JobOffer1.Client);
  google=Runtime.Safe(Global.google);
  Unchecked=Runtime.Safe(WebSharper.Unchecked);
  TrainingBookingInternals=Runtime.Safe(Trainings.TrainingBookingInternals);
  Clientc=Runtime.Safe(TrainingBookingInternals.Client);
  UserData=Runtime.Safe(Dao.UserData);
  Search=Runtime.Safe(Trainings.Search);
  Widget1=Runtime.Safe(Search.Widget);
  String=Runtime.Safe(Global.String);
  encodeURI=Runtime.Safe(Global.encodeURI);
  RegExp=Runtime.Safe(Global.RegExp);
  Arrays=Runtime.Safe(WebSharper.Arrays);
  visualization=Runtime.Safe(google.visualization);
  DataTable=Runtime.Safe(visualization.DataTable);
  GeoMap=Runtime.Safe(visualization.GeoMap);
  Google=Runtime.Safe(WebSharper.Google);
  Visualization=Runtime.Safe(Google.Visualization);
  Visualizations=Runtime.Safe(Visualization.Visualizations);
  GeoMapOptions=Runtime.Safe(Visualizations.GeoMapOptions);
  SearchDeveloper=Runtime.Safe(Trainings.SearchDeveloper);
  Clientd=Runtime.Safe(SearchDeveloper.Client);
  Events=Runtime.Safe(Visualization.Events);
  GeoMap1=Runtime.Safe(Events.GeoMap);
  Util=Runtime.Safe(WebSharper.Util);
  parseFloat=Runtime.Safe(Global.parseFloat);
  ColumnChart=Runtime.Safe(visualization.ColumnChart);
  ColumnChart1=Runtime.Safe(Events.ColumnChart);
  ColumnChartOptions=Runtime.Safe(Visualizations.ColumnChartOptions);
  SubscribeDeveloerSearch=Runtime.Safe(Trainings.SubscribeDeveloerSearch);
  Cliente=Runtime.Safe(SubscribeDeveloerSearch.Client);
  Formlet3=Runtime.Safe(Global.IntelliFactory.Formlet);
  Base=Runtime.Safe(Formlet3.Base);
  _Result_1=Runtime.Safe(Base["Result`1"]);
  Collections=Runtime.Safe(WebSharper.Collections);
  BalancedTree=Runtime.Safe(Collections.BalancedTree);
  _FSharpSet_1=Runtime.Safe(Collections["FSharpSet`1"]);
  Twitter=Runtime.Safe(Trainings.Twitter);
  Clientf=Runtime.Safe(Twitter.Client);
  _FSharpMap_2=Runtime.Safe(Collections["FSharpMap`2"]);
  MapModule=Runtime.Safe(Collections.MapModule);
  Twitter1=Runtime.Safe(WebSharper.Twitter);
  UserModule=Runtime.Safe(Twitter1.UserModule);
  Client10=Runtime.Safe(UserModule.Client);
  Timeline=Runtime.Safe(Twitter1.Timeline);
  Client11=Runtime.Safe(Timeline.Client);
  Control=Runtime.Safe(WebSharper.Control);
  _FSharpEvent_1=Runtime.Safe(Control["FSharpEvent`1"]);
  Upload=Runtime.Safe(Trainings.Upload);
  DialogConfiguration=Runtime.Safe(JQueryUI1.DialogConfiguration);
  Dialog=Runtime.Safe(JQueryUI1.Dialog);
  _FormletProvider_1=Runtime.Safe(Base["FormletProvider`1"]);
  Reactive=Runtime.Safe(Global.IntelliFactory.Reactive);
  _HotStream_1=Runtime.Safe(Reactive["HotStream`1"]);
  AutocompleteConfiguration=Runtime.Safe(JQueryUI1.AutocompleteConfiguration);
  Autocomplete=Runtime.Safe(JQueryUI1.Autocomplete);
  Body=Runtime.Safe(Formlet.Body);
  Zone=Runtime.Safe(Trainings.Zone);
  return Client12=Runtime.Safe(Zone.Client);
 });
 Runtime.OnLoad(function()
 {
  Client3.StandardConfiguration();
  Client3.SignupConfiguration();
  MarkupLanguage.validTagsRegex();
  MarkupLanguage.ValidTags();
  MarkupLanguage.AcceptedLangs();
  Clientd.MapChartDimension();
  Widget1.escapeUrl();
  Clientb.EditorParams();
  Clienta.IsIE();
  FwL.RichEditorParams();
 });
}());

