function Events(c,b,a){this.setEventsID(c);this.setContentURI(b);this.loadEvents(a);return this}Events.prototype={loadEvents:function(a){var e=this,d,f,b,g,c;c=this.contentURI==="http://localhost:8080/UIService/GetFutureEvents"?"upcoming":"past";b=e.getEventsID();$.ajax({url:this.getContentURI(),dataType:"jsonp",success:function(k,h,j){f="";g=(5-k.length)%5;for(i=0;i<k.length;i+=1){f+=e.buildTime(k[i],a)}for(i=0;i<g;i+=1){f+='<li class="empty-item"></li>'}$(e.getEventsSelector()+" ul").html(f);d=new Ribbon({ribbonID:b,type:"Pre_Populated",vertical:true,numDisplay:5})},error:function(k,h,j){console.log(k);console.log(h);console.log(j);$(e.getEventsSelector()).html('<div class="no-result">There was an error in retrieving content.</div>')}})},buildTime:function(k,j){var p,b,n,l,f,e,h,m,g="return true",d="";m="first";eventType=this.contentURI==="http://localhost:8080/UIService/GetFutureEvents"?"upcoming":"past";var o=new Date();j=parseInt(j,10);var c=o.getTimezoneOffset();c=c/60;c=c+j;c=c*3600000;var a=k.Timestamp*1000;a=a+c;n=new Date().getTime();p=new Date(a).format("hh:nn ap");date=new Date(a).format("mmm dd");e="";b=(k.Timestamp*1000)<=n?'<div class="play"></div>':"";l=115;m="";h="/watch/event/{0}".format(k.Guid);f='<li>                     <a href ="{0}" onclick="{1}">                         <div class="vertical-center-img">                            <div>                                <div>                                    {7}                                    <img src="{2}" alt="{3}" />                                </div>                            </div>                        </div>                        <div class="vertical-center-text">                            <div class="episodeWidget">                                <div>                                    <h3>{4}</h3>                                    <div class="eventInfo"><p title="{5}">{5}</p>                                    <div class="italic time">{3}, {6}</div></div>                                    {8}                                </div>                            </div>                        </div>                    </a>                </li>'.format(h,g,k.Image,date,k.Title,k.Description,p,b,m);return f},setEventsID:function(a){this.eventsID=a},setContentURI:function(a){this.contentURI=a},getEventsID:function(){return this.eventsID},getEventsSelector:function(){return"#"+this.eventsID},getContentURI:function(){return this.contentURI}};$("#toggleWatch").change(function(){if($("#toggleWatch").val()==="past"){$("#past-events-container").show();$("#upcoming-events-container").hide()}else{$("#upcoming-events-container").show();$("#past-events-container").hide()}});
