var $jscomp={scope:{},IteratorResult:function(){},Iterator:function(){},Iterable:function(){}};$jscomp.Iterable.prototype.$$iterator=function(){};$jscomp.makeIterator=function(a){if(a.$$iterator)return a.$$iterator();if(!(a instanceof Array)&&"string"!=typeof a)throw Error();var d=0;return{next:function(){return d==a.length?{done:!0}:{done:!1,value:a[d++]}}}};$jscomp.copyProperties=function(a,d){for(var b in d)a[b]=d[b]}; $jscomp.inherits=function(a,d){function b(){}b.prototype=d.prototype;a.superClass_=d.prototype;a.prototype=new b;a.prototype.constructor=a;a.base=function(a,b,g){var h=Array.prototype.slice.call(arguments,2);return d.prototype[b].apply(a,h)}}; var OLClass=function(a,d){this.ID=a.ID;this.ClassNameShort=a.ClassNameShort;this.ClassNameLong=a.ClassNameLong;this.NationalTeams=a.NationalTeams;this.Hidden="undefined"!==typeof a.Hidden?a.Hidden:!1;this.MaxPointsInRoundCompetition=10;this.FirstRace=99999;this.NumberOfRaces=this.LastRace=0;this.Event=d;this.SubClasses=a.SubClasses;this.InSubClasses=a.InSubClasses;this.isClassCombination=this.SubClasses&&0this.LastRace&&(this.LastRace=e.RaceNo)}};OLClass.prototype.getSmartFollowUrl=function(a){return"/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_smart+"/"+a+"/"}; OLClass.prototype.getSmartFollowLink=function(a,d){"undefined"===typeof d&&(d=Texts.SmartFollow);return"undefined"===typeof this.Races[a]?"":!0===this.Races[a].NoResults?"":this.Races[a].TimingPoints[0].hasCompetitors()?""+d+"":d}; OLClass.prototype.getExtraLink=function(a,d){return this.hasSubClasses()||"undefined"===typeof d.CurrentRace&&a!=this.Event.Headers.CurrentRace||d.IsThisClassExluded(this.ClassNameShort)?"":this.Races[a].TimingPoints[0].hasCompetitors()?""+d.GetTitle()+"":d.GetTitle()}; OLClass.prototype.getTimingPointTitle=function(a,d,b){"undefined"===typeof b&&(b=!1);var e="";0"+Texts.lopputulokset+""}return Texts.lopputulokset}var d="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_tilanne+"/"+a+"/0/",b=this.getTimingPointTitle(a,0);return!0===this.Races[a].NoResults?"": "Relay"==this.Event.Headers.EventType?this.Races[a].TimingPoints[0].hasResultsTotal()?""+b+"":b:this.Races[a].TimingPoints[0].hasResultsRace()?""+b+"":b}; OLClass.prototype.AreThereAnyResults=function(){if("Relay"==this.Event.Headers.EventType){if(!0!==this.Races[this.LastRace].NoResults&&this.Races[this.LastRace].TimingPoints[0].hasResultsTotal())return!0}else for(var a in this.Races)if(!0===this.Races[a].NoResults)break;else if(this.Races[a].TimingPoints[0].hasResultsRace())return!0;return!1}; OLClass.prototype.GetFirstIntermediatePointWithResults=function(a){if(!0===this.Races[a].NoResults)return null;for(var d in this.Races[a].TimingPoints)if(0!=d&&this.Races[a].TimingPoints[d].hasResultsRace())return this.Races[a].TimingPoints[d].PointNumber;return null};OLClass.prototype.GetLastIntermediatePointWithResults=function(a){var d=null,b;for(b in this.Races[a].TimingPoints)if(0!=b){if(!this.Races[a].TimingPoints[b].hasResultsRace())break;d=this.Races[a].TimingPoints[b].PointNumber}return d}; OLClass.prototype.getIntermediateResultsLinks=function(a,d,b,e){if(!0===this.Races[a].NoResults)return"";"undefined"===typeof d&&(d=" ");"undefined"===typeof b&&(b=!1);"undefined"===typeof e&&(e=!1);var f=!1;if(b&&this.Races[a].TimingPoints.length>this.MaxPointsInRoundCompetition)var g=this.GetLastIntermediatePointWithResults(a),f=!0;b=[];var h="",k="",h=null,l;for(l in this.Races[a].TimingPoints)if(h=this.Races[a].TimingPoints[l].PointNumber,0!=h){if(f)if(e)if(null==g&&h>this.MaxPointsInRoundCompetition)break; else if(null!=g&&h>g&&h>this.MaxPointsInRoundCompetition)break;else{if(null!=g&&hg)break;h="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_tilanne+"/"+a+"/"+l+"/";k=this.getDistanceInKM(a,l);""!=k&&(k=this.getDistanceInKM(a,l),"Relay"==this.Event.Headers.EventType?this.Races[a].TimingPoints[l].hasResultsTotal()?b.push(""+k+""):b.push(k):this.Races[a].TimingPoints[l].hasResultsRace()? b.push(""+k+""):b.push(k))}return 0!=b.length?b.join(d)+d:""};OLClass.prototype.hasCompetitors=function(a){return this.Races&&this.Races[a]?this.Races[a].TimingPoints[0].hasCompetitors():!1};OLClass.prototype.getLeaderBoardLink=function(){return""+Texts.Leaderboard+""}; OLClass.prototype.getStartListLink=function(a){return 0==a?(a="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_kilpailijat+"/",""+Texts.StartingList+""):this.Races[a].TimingPoints[0].hasCompetitors()?(a="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_kilpailijat+"/p"+a+"/",""+Texts.StartingList+""):Texts.StartingList}; OLClass.prototype.getSplitsLink=function(a){return!0===this.Races[a].NoResults?"":this.Races[a].TimingPoints[0].hasResultsRace()?""+Texts.Rastivaliajat+"":Texts.Rastivaliajat}; OLClass.prototype.getTotalResultsLink=function(a){return!0===this.Races[a].NoResults?"":this.Races[a].TimingPoints[0].hasResultsTotal()?""+Texts.TotalTimes+"":Texts.TotalTimes}; OLClass.prototype.getRaceResultsLink=function(a){if(!0===this.Races[a].NoResults)return"";if(this.Races[a].TimingPoints[0].hasResultsRace()){if("Relay"==this.Event.Headers.EventType)return a="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_legtimes+"/"+a+"/",""+Texts.LegTimes+"";a="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_racetimes+"/"+a+"/";return""+Texts.RaceTimes+""}return"Relay"== this.Event.Headers.EventType?Texts.LegTimes:Texts.RaceTimes};OLClass.prototype.getLegResultsLink=function(a){var d="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_legtimes+"/"+a+"/";return!0===this.Races[a].NoResults?"":this.Races[a].TimingPoints[0].hasResultsRace()?""+Texts.LegTimes+"":Texts.LegTimes}; OLClass.prototype.setDistance=function(a,d,b,e){console.log("Updating "+this.ClassNameShort+"-"+a+"-"+d+" "+this.Races[a].TimingPoints[d].DistanceStr+" => "+e);this.Races[a].TimingPoints[d].DistanceStr=e;this.Races[a].TimingPoints[d].DistanceMeters=b}; OLClass.prototype.getDistanceInKM=function(a,d){var b=this.Races[a].TimingPoints[d].DistanceMeters;return 0===b?(b=this.Races[a].TimingPoints[d].DistanceStr,"0"===b?"":b):"Swimming"==this.Event.Headers.Discipline?b+" m":(b/1E3).toFixed(1).replace(".",",")+" km"};OLClass.prototype.hasSubClasses=function(){return null!=this.SubClasses&&0a&&(a="0"+a);var d=this.Races[1].MassStart.getMinutes();10>d&&(d="0"+d);var b=this.Races[1].MassStart.getSeconds();return 0b&&(b="0"+b),a+":"+d+":"+b):a+":"+d};var OLClassRace=function(a,d){this.RaceNo=a.RaceNo;this.SetMassStart(a,d);this.MultiRaceType=a.MultiRaceType;this.TimingPoints=[];this.Qualification=a.Qualification;this.StartInterval=a.StartIntervalSec?new OLTime(a.StartIntervalSec*OLTime.TimePrecision,this.RaceNo,0):null;this.NoResults=!0===a.NoResults?!0:!1;this.BigRelay="undefined"!=typeof a.BigRelay?a.BigRelay:!1;for(var b in a.TimingPoints){var e=new OLTimingPoint(a.TimingPoints[b]);this.TimingPoints[e.PointNumber]=e}}; OLClassRace.prototype.SetMassStart=function(a,d){var b=this.MassStart;d&&!0===d?this.MassStartStr=this.MassStart=null:null!==a.MassStartStr&&""!=a.MassStartStr?this.MassStart=new Date((new Date(a.MassStartStr)).getTime()+OLTime.TimeZoneDiffToLocalMS):0=this.Qualification[f].FirstRankToQualify&&b.push(g),e=null):a<=this.Qualification[f].LastRankToQualify&&d>=this.Qualification[f].FirstRankToQualify&&(null!==e&&this.Qualification[f].LastRankToQualify>e&&(e=this.Qualification[f].LastRankToQualify), b.push(g))}null!==e&&d>e&&b.push("-")}return b.join("/")}; OLClassRace.prototype.GetQualificationExplanation=function(){var a="";if(null!==this.Qualification&&this.Qualification&&0"+(""+Texts.Qualification+":"),a=a+"
    ",d;for(d in this.Qualification)a+="
  • ",a+=this.Qualification[d].Title+", "+Texts.Sijat+" "+this.Qualification[d].FirstRankToQualify+"-",null!==this.Qualification[d].LastRankToQualify&&(a+=this.Qualification[d].LastRankToQualify),a+="
  • ";a+="
";a+="

"}return a}; OLClassRace.prototype.getNumberOfIntermediaries=function(){var a=0,d;for(d in this.TimingPoints)0!=this.TimingPoints[d].PointNumber&&this.TimingPoints[d].Public&&++a;return a};var OLClub=function(a,d,b){this.ID=a[b.ID];this.District=this.ClubNameShort=this.ClubNameLong=null;this.FileFormat=b;0",d=this.Event.Headers.AllowFollowAll?d+(""+Texts.Favourites+""):d+Texts.Favourites,d=d+"
    ",e;for(e in this.FavouritesByBaseBib)d+="
  • "+this.FavouritesByBaseBib[e].getCompetitorLink(null,!0,a)+"
  • ";d+="
"}return d}; OLCompetitors.prototype.GetClubByLongName=function(a){for(var d in this.Clubs)if(this.Clubs[d].ClubNameLong==a)return this.Clubs[d];return null}; OLCompetitors.prototype.SaveBigRelayTmpResult=function(a,d,b,e,f){console.log("OLCompetitors.SaveBigRelayTmpResult() Offset="+d);var g=!1,h={};-3==d?(h.Class=this.Event.ClassesByID[b],h.RaceNo=e,h.Point=f):(h.Class=this.Event.ClassesByID[a[this.Event.JsonFileFormats.OLBigRelayResult.Class+d]],h.RaceNo=a[this.Event.JsonFileFormats.OLBigRelayResult.RaceNo+d],h.Point=a[this.Event.JsonFileFormats.OLBigRelayResult.Point+d]);h.BaseBib=a[this.Event.JsonFileFormats.OLBigRelayResult.BaseBib+d];h.Name=a[this.Event.JsonFileFormats.OLBigRelayResult.Name+ d];h.Nationality=a[this.Event.JsonFileFormats.OLBigRelayResult.Nationality+d];h.Bib=a[this.Event.JsonFileFormats.OLBigRelayResult.Bib+d];h.TimeTotal=a[this.Event.JsonFileFormats.OLBigRelayResult.TimeTotalStr+d];h.TimeTotalSecs=a[this.Event.JsonFileFormats.OLBigRelayResult.TimeTotalSecs+d];h.RankTotal=a[this.Event.JsonFileFormats.OLBigRelayResult.RankTotal+d];h.DiffTotal=a[this.Event.JsonFileFormats.OLBigRelayResult.DiffTotal+d];h.TimeRace=a[this.Event.JsonFileFormats.OLBigRelayResult.TimeRaceStr+ d];h.TimeRaceSecs=a[this.Event.JsonFileFormats.OLBigRelayResult.TimeRaceSecs+d];h.RankRace=a[this.Event.JsonFileFormats.OLBigRelayResult.RankRace+d];h.DiffRace=a[this.Event.JsonFileFormats.OLBigRelayResult.DiffRace+d];h.Competitor=this.CompetitorsByBaseBib[h.BaseBib];this.TmpBigRelayResultsByBaseBib[h.BaseBib]?(b=this.TmpBigRelayResultsByBaseBib[h.BaseBib],b.Name!=h.Name&&(b.Name=h.Name,g=!0),b.Nationality!=h.Nationality&&(b.Nationality=h.Nationality,g=!0),b.Bib!=h.Bib&&(b.Bib=h.Bib,g=!0),b.TimeTotal!= h.TimeTotal&&(b.TimeTotal=h.TimeTotal,g=!0),b.TimeTotalSecs!=h.TimeTotalSecs&&(b.TimeTotalSecs=h.TimeTotalSecs,g=!0),b.RankTotal!=h.RankTotal&&(b.RankTotal=h.RankTotal,g=!0),b.DiffTotal!=h.DiffTotal&&(b.DiffTotal=h.DiffTotal,g=!0),b.TimeRace!=h.TimeRace&&(b.TimeRace=h.TimeRace,g=!0),b.TimeRaceSecs!=h.TimeRaceSecs&&(b.TimeRaceSecs=h.TimeRaceSecs,g=!0),b.RankRace!=h.RankRace&&(b.RankRace=h.RankRace,g=!0),b.DiffRace!=h.DiffRace&&(b.DiffRace=h.DiffRace,g=!0)):(g=!0,this.TmpBigRelayResults.push(h),this.TmpBigRelayResultsByBaseBib[h.BaseBib]= h);g&&-3!=d&&(a.ChangedClassIDs[h.Class.ID]=h.Class.ID,a.ChangedRaceNos[h.RaceNo]=h.RaceNo,a.ChangedTimingPoints[h.Point]=h.Point,a.ChangedCompetitorID=h.Competitor.ID,a.ChangedCompetitorBib=h.Bib)};var OLControl=function(a,d,b){this.SplitDistance=this.ControlCode=null;this.SplitTime=new OLTime;this.SplitDifference=new OLTime;this.SplitTotalResults=this.SplitRank=null;this.CumulativeTime=new OLTime;this.CumulativeDifference=new OLTime;this.RelayRank=this.CumulativeRank=null;this.FileFormat=b;this.UpdateData(a,d)}; OLControl.prototype.UpdateData=function(a,d){this.ControlCode=parseInt(a[this.FileFormat.ControlCode]);this.SplitDistance=parseInt(a[this.FileFormat.SplitDistance]);this.SplitRank=parseInt(a[this.FileFormat.SplitRank]);this.SplitTotalResults=parseInt(a[this.FileFormat.SplitTotalResults]);this.CumulativeRank=parseInt(a[this.FileFormat.CumulativeRank]);this.RelayRank=parseInt(a[this.FileFormat.RelayRank]);this.SplitTime.UpdateData(a[this.FileFormat.SplitTime],d,-3);this.SplitDifference.UpdateData(a[this.FileFormat.SplitDifference], d,-3);this.CumulativeTime.UpdateData(a[this.FileFormat.CumulativeTime],d,-3);this.CumulativeDifference.UpdateData(a[this.FileFormat.CumulativeDifference],d,-3);return!0};function _instanceof(a,d){return null!=d&&"undefined"!==typeof Symbol&&d[Symbol.hasInstance]?d[Symbol.hasInstance](a):a instanceof d}function _classCallCheck(a,d){if(!_instanceof(a,d))throw new TypeError("Cannot call a class as a function");}function _defineProperties(a,d){for(var b=0;bthis.LastReceivedPkgID[a])this.LastReceivedPkgID[a]=d;b&&0a&&(a=this.LastReceivedPkgID[e],this.SocketIOCOnnection&&(this.SocketIOCOnnection.io.opts.query.LastReceivedPkgID=this.LastReceivedPkgID[e]));this.updateOnlineStatusStr(a)};OLEvent.prototype.GetClassIDByName=function(a){return this.ClassesByName[a.toLowerCase()].ID};OLEvent.prototype.GetClassByName=function(a){return this.ClassesByName[a.toLowerCase()]}; OLEvent.prototype.SocketIOStopFollowing=function(){this.Headers.AllowFollowAll||(console.log("SocketIOStopFollowing"),this.SendToSocketIO("stop_following",JSON.stringify([])));this.FollowingTimingPoints=[];this.FollowingBaseBibs=[];this.StartedFollowing=[]};OLEvent.prototype.SocketIOStartFollowingFavourite=function(a){this.Headers.AllowFollowAll||(a={Type:"Favourite",BaseBib:a},console.log("SocketIOStartFollowingFavourite "+JSON.stringify(a)),this.SendToSocketIO("start_following",JSON.stringify(a)))}; OLEvent.prototype.SocketIOStopFollowingFavourite=function(a){this.Headers.AllowFollowAll||(a={BaseBib:a},console.log("SocketIOStopFollowingFavourite "+JSON.stringify(a)),this.SendToSocketIO("stop_following_favourite",JSON.stringify(a)))}; OLEvent.prototype.SocketIOStartFollowing=function(a){"Results"==a.Type&&null!==a.Point&&"undefined"!==typeof a.Point?a.LastReceivedPkgID=this.LastReceivedPkgID["results_"+a.ClassID+"_"+a.RaceNo+"_"+a.Point]:"Results"==a.Type?(console.log(this.LastReceivedPkgID["results_"+a.ClassID+"_"+a.RaceNo]),a.LastReceivedPkgID=this.LastReceivedPkgID["results_"+a.ClassID+"_"+a.RaceNo]):"Splits"==a.Type?a.LastReceivedPkgID=this.LastReceivedPkgID["splits_"+a.ClassID+"_"+a.RaceNo]:"TopResults"!=a.Type&&(a.LastReceivedPkgID= -2);this.Headers.AllowFollowAll||this.SendToSocketIO("start_following",JSON.stringify(a));var d=a.ClassID+"-"+a.RaceNo+"-"+a.Point;this.FollowingTimingPoints[d]||(this.FollowingTimingPoints[d]=d);0 Reload"),$.event.trigger({type:"ResetTimeChanged", old_r:d.ResetTime,new_r:a.ResetTime,time:new Date})):a.Headers.Online!=d.Headers.Online&&(console.log("Online-status has changed -> Reload"),$.event.trigger({type:"ResetTimeChanged",old_r:d.ResetTime,new_r:a.ResetTime,time:new Date}));var e=!1,f=!1,g=!1,h=!1;d.HyperLinks=a.Headers.HyperLinks;for(var k in d.HyperLinks)d.HyperLinks[k].Updated&&null!==d.HyperLinks[k].Updated&&(d.HyperLinks[k].Updated=new Date(d.HyperLinks[k].Updated),f=!0);for(var l in a.Classes)for(var q in a.Classes[l].Races){k=a.Classes[l].ID; var u=a.Classes[l].Races[q].RaceNo;d.ClassesByID[k].SetMassStart(u,a.Classes[l].Races[q],d.Headers.RollingStart)&&(g=!0);for(var r in a.Classes[l].Races[q].TimingPoints){var n=a.Classes[l].Races[q].TimingPoints[r].PointNumber,v=d.ClassesByID[k].Races[u].TimingPoints[n].DistanceStr,x=a.Classes[l].Races[q].TimingPoints[r].DistanceMeters,E=a.Classes[l].Races[q].TimingPoints[r].DistanceStr;if(d.ClassesByID[k].Races[u].TimingPoints[n].DistanceMeters!=x||v!=E)d.ClassesByID[k].setDistance(u,n,x,E),e=!0}}a= !1;d.AreThereAnyResults&&(a=!0);d.UpdateAreThereAnyResults();d.AreThereAnyResults!=a&&(h=!0);(e||f||h||g)&&$.event.trigger({type:"ForceUpdateOnlineTable",message:"OLEvent.UpdateEventStatus()",KmUpdated:e,MassStartUpdated:g,HyperlinksUpdated:f,AreThereAnyResultsUpdated:h})},error:function(a){console.log("Error downloading event data for timing point kilometers (ju/ve)");console.log(a)}})}; OLEvent.prototype.ConnectToServer=function(){this.updateOnlineStatusStr("Offline");OnlineConnection=!1;null!=this.TimeoutTimer&&(clearTimeout(this.TimeoutTimer),this.TimeoutTimer=null);this.DoNotDownloadChangesWhenConnecting&&(this.LastReceivedPkgID=-3);this.connectSocketIO()};OLEvent.prototype.connectPolling=function(){console.log("Connecting to polling data source: "+this.EventID+" LastReceivedPkgID="+this.LastReceivedPkgID+" ResetTime="+this.ResetTime);this.PollForDataUpdates()}; OLEvent.prototype.PollForDataUpdates=function(){console.log("Polling for data updates: "+this.EventID+" LastReceivedPkgID="+this.LastReceivedPkgID+" ResetTime="+this.ResetTime);var a="http://"+window.location.host+"/"+WwwRoot+"/cgi/onlinedata.cgi?SSE=0&EventID="+this.EventID+"&LastReceivedPkgID="+this.LastReceivedPkgID+"&ResetTime="+this.ResetTime+"&a="+(new Date).getTime(),d=this;$.ajax({url:a,success:function(a){for(var e in a)console.log(JSON.stringify(a[e])),OnlineConnection=!0,$.event.trigger({type:"DataUpdateReceived", message:a[e]});d.ConnectionActivity(!0);setTimeout(function(){d.PollForDataUpdates()},6E3+1E3*Math.random())},error:function(a){console.log(a);409==a.status&&$.event.trigger({type:"ResetTimeChanged",old_r:d.ResetTime,time:new Date});d.updateOnlineStatusStr("Offline");OnlineConnection=!1;setTimeout(function(){d.PollForDataUpdates()},1E4+1E3*Math.random())}})}; OLEvent.prototype.connectSSE=function(){console.log("Connecting to Server Sent Events source: "+this.EventID+" LastReceivedPkgID="+this.LastReceivedPkgID+" ResetTime="+this.ResetTime);if(window.EventSource){var a="http://"+window.location.host+"/"+WwwRoot+"/cgi/onlinedata.cgi?SSE=1&EventID="+this.EventID+"&LastReceivedPkgID="+this.LastReceivedPkgID+"&ResetTime="+this.ResetTime+"&a="+(new Date).getTime();this.SSEConnection=new EventSource(a);console.log(this.SSEConnection);var d=this;this.SSEConnection.addEventListener("message", function(a){var e=$.parseJSON(a.data);console.log(a);OnlineConnection=!0;$.event.trigger({type:"DataUpdateReceived",message:e});d.ConnectionActivity(!0)},!1);this.SSEConnection.addEventListener("open",function(a){console.log("SSE OPENED");console.log(a);d.ConnectionActivity(!0)},!1);this.SSEConnection.addEventListener("ping",function(a){d.ConnectionActivity(!0)},!1);this.SSEConnection.addEventListener("ResetChanged",function(a){console.log(a);console.log("Reset Changed");$.event.trigger({type:"ResetTimeChanged", old_r:d.ResetTime,time:new Date});d.ConnectionActivity(!0)},!1);this.SSEConnection.addEventListener("RequestError",function(a){console.log(a);console.log("RequestError");d.ReConnectToServer()},!1);this.SSEConnection.addEventListener("error",function(a){d.updateOnlineStatusStr("Offline");OnlineConnection=!1;console.log(a);console.log("SSE ERROR");a.readyState==EventSource.CLOSED?console.log("SSE Closed"):a.readyState==EventSource.CONNECTING&&console.log("SSE Reconnecting...")},!1)}else console.log("SSE NOT SUPPORTED")}; OLEvent.prototype.connectSocketIO=function(){var a=nodejs_base_url+"/"+this.EventID,d=-2,d=this.Headers.AllowFollowAll?this.LastReceivedPkgID.results:this.LastReceivedPkgID.Event>this.LastReceivedPkgID.Competitors?this.LastReceivedPkgID.Event:this.LastReceivedPkgID.Competitors;console.log("Connecting to Socket.IO source: "+a+" LastReceivedPkgID="+d+" ResetTime="+this.ResetTime);try{this.SocketIOCOnnection=io(a,{query:{LastReceivedPkgID:d,ResetTime:this.ResetTime}});var b=this;this.SocketIOCOnnection.on("o2", function(a){console.log("'"+a+"'");a=$.parseJSON(a);OnlineConnection=!0;$.event.trigger({type:"DataUpdateReceived",message:a});b.ConnectionActivity(!0)});this.SocketIOCOnnection.on("ResetChanged",function(a){console.log(a);console.log("Reset Changed");$.event.trigger({type:"ResetTimeChanged",old_r:b.ResetTime,time:new Date});b.ConnectionActivity(!1)});this.SocketIOCOnnection.on("error",function(a){"Invalid namespace"==a?(console.log("SocketIO ERROR Attempted to connect to invalid namespace "),b.ConnectionActivity(!1), b.ReconnectSocketIO()):(console.log("SocketIO ERROR Error on socket.io client ",a),b.ConnectionActivity(!1))});this.SocketIOCOnnection.on("connect",function(){console.log("SocketIO OPENED "+this.id+" "+this.io.engine.transports);b.UserSettings.NotificationsConnectionStatus&&$.notify(Texts.ConnectedToServer,"success");$.event.trigger({type:"SocketIOConnected",time:new Date});for(var a in b.SocketIOSendBuffer){var d=b.SocketIOSendBuffer[a];console.log("Sending from buffer to SocketIO: "+d.Event+" "+ d.Data);this.emit(d.Event,d.Data)}b.SocketIOSendBuffer=[];b.ConnectionActivity(!0);this.io.engine.on("upgrade",function(a){console.log("Socket.IO transport upgraded")})});this.SocketIOCOnnection.on("disconnect",function(){console.log("SocketIO DISCONNECTED "+this.id);console.log(b);console.log(this);b.UserSettings.NotificationsConnectionStatus&&$.notify(Texts.ServerDisconnected,"warn");OnlineConnection=!1;b.ConnectionActivity(!1);b.SendToSocketIO("stop_following",JSON.stringify([]));for(var a in b.StartedFollowing){var d= JSON.parse(b.StartedFollowing[a]);d.LastReceivedPkgID=this.io.opts.query.LastReceivedPkgID;b.SendToSocketIO("start_following_after_reconnect",JSON.stringify(d))}for(a in b.StartedFollowing)d=JSON.parse(b.StartedFollowing[a]),d.LastReceivedPkgID=this.io.opts.query.LastReceivedPkgID,b.SendToSocketIO("start_following_after_reconnect",JSON.stringify(d));for(a in b.StartedFollowingFavourites)d=JSON.parse(b.StartedFollowingFavourites[a]),d.LastReceivedPkgID=this.io.opts.query.LastReceivedPkgID,b.SendToSocketIO("start_following_after_reconnect", JSON.stringify(d));!1!==b.StartedFollowingNewLeader&&(d=JSON.parse(b.StartedFollowingNewLeader),d.LastReceivedPkgID=this.io.opts.query.LastReceivedPkgID,b.SendToSocketIO("start_following_after_reconnect",JSON.stringify(d)));for(a in b.TopicsSubscribed)b.SendToSocketIO("subscribe_to_topic_after_reconnect",b.TopicsSubscribed[a])});this.SocketIOCOnnection.on("connect_error",function(){console.log("SocketIO Connect error "+this.id);b.UserSettings.NotificationsConnectionStatus&&$.notify(Texts.ServerDisconnected, "warn");OnlineConnection=!1;b.ConnectionActivity(!1)});this.SocketIOCOnnection.on("connect_timeout",function(){console.log("SocketIO Connection timeout "+this.id);b.UserSettings.NotificationsConnectionStatus&&$.notify(Texts.ServerDisconnected,"warn");OnlineConnection=!1;b.ConnectionActivity(!1)});this.SocketIOCOnnection.on("reconnect_attempt",function(){console.log("SocketIO Reconnect attempt "+this.id);OnlineConnection=!1;b.ConnectionActivity(!1)});this.SocketIOCOnnection.on("reconnecting",function(a){console.log("SocketIO Reconnecting... "+ a+" "+this.id);OnlineConnection=!1;b.ConnectionActivity(!1)});this.SocketIOCOnnection.on("reconnect_error",function(a){console.log("SocketIO Reconnect error "+this.id);b.UserSettings.NotificationsConnectionStatus&&$.notify(Texts.ReconnectFailed,"warn");console.log(a);OnlineConnection=!1;b.ConnectionActivity(!1)});this.SocketIOCOnnection.on("reconnect_failed",function(){console.log("SocketIO Reconnect failed "+this.id);b.UserSettings.NotificationsConnectionStatus&&$.notify(Texts.ReconnectFailed,"warn"); OnlineConnection=!1;b.ConnectionActivity(!1)});this.SocketIOCOnnection.on("pong",function(a){b.ConnectionActivity(!0)})}catch(e){console.log("ERROR: socket.io encountered a problem: "+e),this.ConnectionActivity(!1)}}; OLEvent.prototype.connectWebSocket=function(){console.log("Connecting websocket: "+this.EventID+" LastReceivedPkgID="+this.LastReceivedPkgID+" ResetTime="+this.ResetTime);var a="undefined"!==typeof hepjee?"ws://127.0.0.1:8081/ws2/"+WwwRoot+"/?EventID="+this.EventID+"&LastReceivedPkgID="+this.LastReceivedPkgID+"&ResetTime="+this.ResetTime:"ws://"+window.location.host+"/ws2/"+WwwRoot+"/?EventID="+this.EventID+"&LastReceivedPkgID="+this.LastReceivedPkgID+"&ResetTime="+this.ResetTime+"&a="+(new Date).getTime(); try{this.websocket=new WebSocket(a)}catch(d){console.log(d)}var b=this;this.websocket.onopen=function(a){console.log("Websocket connected!");b.updateOnlineStatusStr(b.LastReceivedPkgID);OnlineConnection=!0};this.websocket.onmessage=function(a){"ping"==a.data?b.websocket.send("pong"):(a=$.parseJSON(a.data),OnlineConnection=!0,$.event.trigger({type:"DataUpdateReceived",message:a}))};this.websocket.onerror=function(a){console.log("Websocket-error:");console.log(a);b.updateOnlineStatusStr("Offline"); OnlineConnection=!1};this.websocket.onclose=function(){b.updateOnlineStatusStr("Offline");OnlineConnection=!1;console.log("Websocket closed");setTimeout(function(){b.connectWebSocket()},5E3)}}; OLEvent.prototype.updateOnlineStatusStr=function(a){this.OnlineStatusStr=a;console.log("OLEvent.updateOnlineStatusStr() str="+a);"Offline"==this.OnlineStatusStr?$("#OnlineStatusIcon").hasClass("Offline")||$("#OnlineStatusIcon").addClass("Offline"):($("#OnlineStatusIcon").hasClass("Offline")&&($("#OnlineStatusIcon").removeClass("Offline"),this.updateOnlineStatus()),$("#OnlineStatusIcon").prop("title",a))}; OLEvent.prototype.updateOnlineStatus=function(){if("Offline"==this.OnlineStatusStr)$("#OnlineStatusClock").html(this.OnlineStatusStr);else{var a=this,d=this.GetNow(),b=1E3-d.getTime()%1E3,e=d.getHours();10>e&&(e="0"+e);var f=d.getMinutes();10>f&&(f="0"+f);d=d.getSeconds();10>d&&(d="0"+d);this.ClockStr=e+":"+f+":"+d;$("#OnlineStatusClock").html(this.ClockStr);this.StatusTimer=setTimeout(function(){a.updateOnlineStatus()},b)}}; OLEvent.prototype.GetNow=function(){return new Date(OLTime.GetDateNow().getTime()+OLTime.TimeZoneDiffToLocalMS)}; OLEvent.prototype.syncClock=function(){var a=(new Date).getTime(),d=this;$.ajax({url:"/"+WwwRoot+"/online/online_time.json?a="+a,success:function(b){var e=(new Date).getTime();b=b-e+parseInt((e-a)/2,0);OLTime.FakeNow?console.log("Not synchronizing because of fakenow, but diff is = "+b+" ms"):(OLTime.TimeCorrection=b,console.log("Synchronizing clock diff="+b+" ms"));$.event.trigger({type:"ClockSyncReceived",message:"hep",time:new Date});setTimeout(function(){d.syncClock()},6E5)},error:function(a){console.log(a.message)}})}; OLEvent.prototype.DownloadCompetitorData=function(a){var d="/"+WwwRoot+"/online/online_"+this.EventID+"_competitor.json?BaseBib="+a.Competitor.BaseBib+"&a="+(new Date).getTime();console.log("Downloading "+d);$.ajax({url:d,success:function(b){a.onCompetitorDataDownloaded(b)},error:function(b){a.onCompetitorDataDownloaded(b)}})};OLEvent.prototype.UpdateAreThereAnyResults=function(){for(var a in this.Classes)this.Classes[a].AreThereAnyResults()&&(this.AreThereAnyResults=!0)}; OLEvent.prototype.GetHyperLinks=function(){var a="";if(this.BigRelay)this.AreThereAnyResults&&(a+="
  • "+Texts.lehdistotulokset+"
  • ");else{if(this.Headers.Online||!this.AreThereAnyResults)a+="
  • "+Texts.lahtolistakaikkisarjoittain+"
  • ",a+="
  • "+Texts.lahtolistaseuroittain+"
  • ";this.AreThereAnyResults&&(a+="
  • "+Texts.tuloksetkaikkisarjat+"
  • ",a+="
  • "+Texts.lehdistotulokset+"
  • ")}if(this.HyperLinks)for(var d in this.HyperLinks)if("TextOnly"==this.HyperLinks[d].Type)a+= "
  • "+this.HyperLinks[d].Title+"
  • ";else if("PPResultsXML"==this.HyperLinks[d].Type&&this.AreThereAnyResults){var b=this.HyperLinks[d].Url;0==b.includes("/")&&(b="/tulokset/"+b);var e=Texts.XmlTulokset;this.Headers.ControlSplits&&(e=Texts.XmlTuloksetRva);"MultiRace"==this.Headers.EventType&&(e+=" "+this.Races[this.HyperLinks[d].RaceNo].RaceTitle);a+="
  • "+e+" ";this.Headers.Online&&(a+="("+Texts.paivitetty+" "+OLTime.PrintTime(this.HyperLinks[d].Updated)+ ") ");a+="(PP)
  • "}else"IOFResultListXML"==this.HyperLinks[d].Type&&this.AreThereAnyResults?(b=this.HyperLinks[d].Url,0==b.includes("/")&&(b="/tulokset/"+b),e=Texts.XmlTulokset,"MultiRace"==this.Headers.EventType&&(e+=" "+this.Races[this.HyperLinks[d].RaceNo].RaceTitle),a+="
  • "+e+" ",this.Headers.Online&&(a+="("+Texts.paivitetty+" "+OLTime.PrintTime(this.HyperLinks[d].Updated)+") "),a+="(IOF)
  • "):!this.Headers.Online&&this.AreThereAnyResults|| "IOFStartListXML"!=this.HyperLinks[d].Type?"ExternalLink"==this.HyperLinks[d].Type&&(a+="
  • "+this.HyperLinks[d].Title+"
  • "):(b=this.HyperLinks[d].Url,0==b.includes("/")&&(b="/tulokset/"+b),e=Texts.XmlLahtolistat,"MultiRace"==this.Headers.EventType&&(e+=" "+this.Races[this.HyperLinks[d].RaceNo].RaceTitle),a+="
  • "+e+" ",this.Headers.Online&&(a+="("+Texts.paivitetty+ " "+OLTime.PrintTime(this.HyperLinks[d].Updated)+") "),a+="(IOF)
  • ");return a};OLEvent.prototype.GetBadgeTypeTxt=function(){return Texts[this.Headers.BadgeType]?Texts[this.Headers.BadgeType]:this.Headers.BadgeType?this.Headers.BadgeType:Texts.Badge};OLEvent.prototype.GetRaceTitle=function(a){return this.Races[a].GetRaceTitle()}; OLEvent.prototype.SetFollowNewLeader=function(a){a&&!1===this.StartedFollowingNewLeader?this.SendToSocketIO("start_following",JSON.stringify({Type:"NewLeader"})):a||!1===this.StartedFollowingNewLeader||this.SendToSocketIO("stop_following_newleader",JSON.stringify([]))};OLEvent.prototype.setUserSettings=function(a){this.UserSettings=a};var OLEventRace=function(a){this.RaceTimeZoneMin=this.RaceTitle=this.RaceDate=this.RaceNo=this.PrecisionSplitsShow=this.PrecisionSplitsRank=this.PrecisionIntermediariesShow=this.PrecisionIntermediariesRank=this.PrecisionResultsShow=this.PrecisionResultsRank=null;this.UpdateData(a)}; OLEventRace.prototype.UpdateData=function(a){this.PrecisionResultsRank=a.PrecisionResultsRank;this.PrecisionResultsShow=a.PrecisionResultsShow;this.PrecisionIntermediariesRank=a.PrecisionIntermediariesRank;this.PrecisionIntermediariesShow=a.PrecisionIntermediariesShow;this.PrecisionSplitsRank=a.PrecisionSplitsRank;this.PrecisionSplitsShow=a.PrecisionSplitsShow;this.RaceDate=a.RaceZeroTime?new Date(a.RaceZeroTime):new Date(a.RaceDate);this.RaceTitle=a.RaceTitle;this.RaceTimeZoneMin=a.RaceTimeZoneMin; this.RaceNo=a.RaceNo;OLTime.PrecisionResultsRank[a.RaceNo]=this.PrecisionResultsRank;OLTime.PrecisionResultsShow[a.RaceNo]=this.PrecisionResultsShow;OLTime.PrecisionIntermediariesRank[a.RaceNo]=this.PrecisionIntermediariesRank;OLTime.PrecisionIntermediariesShow[a.RaceNo]=this.PrecisionIntermediariesShow;OLTime.PrecisionSplitsRank[a.RaceNo]=this.PrecisionSplitsRank;OLTime.PrecisionSplitsShow[a.RaceNo]=this.PrecisionSplitsShow;OLTime.RaceDates[a.RaceNo]=this.RaceDate}; OLEventRace.prototype.GetRaceTitle=function(){return this.RaceTitle=="Race "+this.RaceNo?this.RaceNo+". "+Texts.day:""!=this.RaceTitle?this.RaceTitle:this.RaceNo+". "+Texts.day};var OLExtra=function(a){if(this.constructor===OLExtra)throw Error(" Object of Abstract Class OLExtra cannot be created");console.log("OLExtra-rakentaja");this.OverridePiril\u00e4Points=!1;this.ClassesToFollow={};this.OverrideResultTable=!1;this.Index="?";for(var d in a)this[d]=a[d];a=this.ExcludeClasses;this.ExcludeClasses={};for(var b in a)this.ExcludeClasses[a[b]]=a[b];console.log(this)};OLExtra.prototype.GetClassesToFollow=function(){return this.ClassesToFollow};OLExtra.prototype.IsNarrow=function(){return!1}; OLExtra.prototype.SortResults=function(){throw Error("Function SortResults must be defined in a class inherited from OLExtra");};OLExtra.prototype.GetColumns=function(){throw Error("Function GetColumns must be defined in a class inherited from OLExtra");};OLExtra.prototype.GetPoints=function(){throw Error("Function GetPoints must be defined in a class inherited from OLExtra if OverridePiril\u00e4Points=true");}; OLExtra.prototype.GetOnlineHeaderLowerStaticText=function(){throw Error("Function GetOnlineHeaderLowerStaticText must be defined in a class inherited from OLExtra");};OLExtra.prototype.GetOnlineHtmlTitlePrefix=function(a){throw Error("Function GetOnlineHeaderLowerStaticText must be defined in a class inherited from OLExtra");};OLExtra.prototype.IsThisClassExluded=function(a){throw Error("Function GetOnlineHeaderLowerStaticText must be defined in a class inherited from OLExtra");}; OLExtra.prototype.GetTitle=function(){throw Error("Function GetTitle must be defined in a class inherited from OLExtra");};var OLExtraAktia=function(a){console.log("OLExtraAktia-rakentaja");OLExtraAktia.base(this,"constructor",a);this.OverrideResultTable=!0;this.RaceNo=this.CurrentClass=null;this.DataJsonURL="";this.ResultsByBaseBib={};this.Index=a.Cup};$jscomp.copyProperties(OLExtraAktia,OLExtra);$jscomp.inherits(OLExtraAktia,OLExtra); OLExtraAktia.prototype.GetPoints=function(a){return 0 this.RaceNo)break;g=this.GetPoints(a[d]["RaceRank_"+g]);null!==g&&++b.NumberOfRaces;0=this.RaceNo||4==this.RaceNo&&2<=b.NumberOfRaces||3<=b.NumberOfRaces)?(b.EnoughRaces=!0,e.sort(function(a,b){return b-a}),b.TotalPoints=0,null!==e[0]&&0"+this.Title+" "+this.Season+" "+Texts.UnofficialTotalPoints+" "};OLExtraAktia.prototype.GetOnlineHtmlTitlePrefix=function(a){return this.Title+" "+this.Season+" "+Texts.UnofficialTotalPoints+" | "+a};OLExtraAktia.prototype.IsThisClassExluded=function(a){return"undefined"!==typeof this.ExcludeClasses[a]}; OLExtraAktia.prototype.GetTitle=function(){return this.Title+" "+this.Season+" yhteispisteet"};var OLExtraKalevanKierros=function(a){console.log("OLExtraKalevanKierros-rakentaja");OLExtraKalevanKierros.base(this,"constructor",a);this.Points=[];this.Index=a.Cup;for(var d in a.Points){var b=a.Points[d].shift();this.Points[b]=a.Points[d]}};$jscomp.copyProperties(OLExtraKalevanKierros,OLExtra);$jscomp.inherits(OLExtraKalevanKierros,OLExtra);OLExtraKalevanKierros.prototype.SortResults=function(a,d){return a.RacesTmp==d.RacesTmp?d.TotalTmp-a.TotalTmp:d.RacesTmp-a.RacesTmp}; OLExtraKalevanKierros.prototype.GetColumns=function(a,d,b){b=["Show",Texts.Sij,Texts.nro];var e=[{data:"ShowTmp",visible:!1},{data:"RankTmp",sClass:"numbercell"},{data:function(a,b,d,e){return a.Competitor?a.Competitor.LicenseNumber&&0!=a.Competitor.LicenseNumber?a.Competitor.LicenseNumber:"":"?"},sClass:"numbercell"}],f={data:function(b,e,f,g){return b.Competitor&&null!=b.Competitor.Nationality?b.Competitor.getNatPrint(d||a.NationalTeams):"?"}};b.push(Texts.Nimi);e.push({data:function(a,b,d,e){return a.Competitor? a.GetNameStd():"?"}});a.NationalTeams||(b.push(""),e.push(f));b.push(Texts.Seura);e.push({data:function(a,b,d,e){return a.Competitor?a.Competitor.Club.ClubNameLong:"?"}});var g=[],h;for(h in this.Races)g[e.length]=h,b.push(this.Races[h]),e.push({data:function(a,b,d,e){return a.Competitor?(b=g[e.col],null==a.CupPointsTmp[b]?"-":a.CupPointsTmp[b].toFixed(2)):"?"},sClass:"numbercell"});b.push(Texts.Diciplines);e.push({data:"RacesTmp",sClass:"numbercell"});b.push(Texts.Total);e.push({data:function(a, b,d,e){return null==a.TotalTmp?"-":a.TotalTmp.toFixed(2)},sClass:"numbercell"});return[b,e]}; OLExtraKalevanKierros.prototype.UpdateData=function(a,d,b,e){console.log("OLExtraKalevanKierros.UpdateData()");this.ClassesToFollow={};this.ClassesToFollow[b.ID]=b.ID;for(var f in a){a[f].ShowTmp=!0;a[f].RankTmp="";a[f].RacesTmp=0;a[f].TotalTmp=null;a[f].CupPointsTmp=[];for(var g in this.Races)d=a[f].Competitor.LicenseNumber,b=null,this.Races[g]==this.CurrentRace&&a[f].Competitor?null!=a[f].Results[0].TimeRace.Time&&(b=a[f].Competitor.GetRacePoints(e),a[f].RacesTmp+=1):0"+this.Title+" "+this.Season+" "+Texts.UnofficialTotalPoints+" "};OLExtraKalevanKierros.prototype.GetOnlineHtmlTitlePrefix=function(a){return this.Title+" "+this.Season+" "+Texts.UnofficialTotalPoints+" | "+a}; OLExtraKalevanKierros.prototype.IsThisClassExluded=function(a){return"undefined"!==typeof this.ExcludeClasses[a]};OLExtraKalevanKierros.prototype.GetTitle=function(){return this.Title+" "+this.Season+" yhteispisteet"};var OLExtraTeamCompetition=function(a){console.log("OLExtraTeamCompetition-rakentaja");OLExtraTeamCompetition.base(this,"constructor",a);this.OverrideResultTable=!0;this.Index=a.TeamCompetition;this.RaceNo=this.CurrentClass=null;this.DataJsonURL="";this.ResultsByBaseBib={};this.ResultsByTeamID={};this.ResultsToBeDownloaded=[];this.RankPoints=!1;this.RankPointClasses=a.RankPoints?a.RankPoints:[];this.Teams={};for(var d in a.Teams)"undefined"===typeof this.Teams[a.Teams[d].Class]&&(this.Teams[a.Teams[d].Class]= []),this.Teams[a.Teams[d].Class].push({ID:a.Teams[d].ID,Name:a.Teams[d].Name,Members:a.Teams[d].Members})};$jscomp.copyProperties(OLExtraTeamCompetition,OLExtra);$jscomp.inherits(OLExtraTeamCompetition,OLExtra);OLExtraTeamCompetition.prototype.SortResultsInitialResultSec=function(a,d){return null==a.ResultSec&&null!=d.ResultSec?1:null!=a.ResultSec&&null==d.ResultSec?-1:a.ResultSec-d.ResultSec}; OLExtraTeamCompetition.prototype.SortResultsInitialRankPoints=function(a,d){return null==a.Rank&&null!=d.Rank?1:null!=a.Rank&&null==d.Rank?-1:a.Rank-d.Rank}; OLExtraTeamCompetition.prototype.SortResultsResultSec=function(a,d){return a.sort(function(a,e){var f=d[a.TeamID].ResultSec,g=d[e.TeamID].ResultSec;return f==g?a.TeamID==e.TeamID?a.TitleRow&&!e.TitleRow?-1:!a.TitleRow&&e.TitleRow?1:null==a.ResultSec&&null!=e.ResultSec?1:null!=a.ResultSec&&null==e.ResultSec?-1:a.ResultSec-e.ResultSec:(""+a.TeamID).localeCompare(e.TeamID):null==f&&null!=g?1:null!=f&&null==g?-1:f-g})}; OLExtraTeamCompetition.prototype.SortResultsRankPoints=function(a,d){return a.sort(function(a,e){var f=d[a.TeamID].Rank,g=d[e.TeamID].Rank;return f==g?a.TeamID==e.TeamID?a.TitleRow&&!e.TitleRow?-1:!a.TitleRow&&e.TitleRow?1:null==a.Rank&&null!=e.Rank?1:null!=a.Rank&&null==e.Rank?-1:a.Rank-e.Rank:(""+a.TeamID).localeCompare(e.TeamID):null==f&&null!=g?1:null!=f&&null==g?-1:f-g})}; OLExtraTeamCompetition.prototype.GetColumns=function(a,d,b){var e=this;return[["","","","",""],[{data:"ShowTmp",visible:!1},{data:"RankTmp",sClass:"numbercell"},{data:function(a,d,e,k){return a.TitleRow?a.TeamName:a.Competitor?a.Competitor.getCompetitorLink(b,!0):"?"}},{data:function(a,b,d,k){return a.ClassNameShort!=e.CurrentClass.ClassNameShort?a.ClassNameShort:""}},{data:function(a,b,d,k){return e.RankPoints?a.Rank:a.Result},sClass:"timecell"}]]}; OLExtraTeamCompetition.prototype.UpdateData=function(a,d,b,e){this.CurrentClass=b;this.RankPoints=this.RankPointClasses.includes(b.ClassNameShort);this.RaceNo=e;this.CompetitorsByBaseBib=d;console.log("OLExtraTeamCompetition.UpdateData() RankPoints="+this.RankPoints);this.ResultsToBeDownloaded=[];this.ClassesToFollow={};this.ClassesToFollow[b.ID]=b.ID;if(d=0==a.length)this.ResultsByTeamID={};b=[];for(var f in this.Teams[this.CurrentClass.ClassNameShort]){var g=this.Teams[this.CurrentClass.ClassNameShort][f]; b.push(g.ID);if(d){var h={RankTmp:"",ShowTmp:1"+this.GetTitle()+" "}; OLExtraTeamCompetition.prototype.GetOnlineHtmlTitlePrefix=function(a){return this.GetTitle()+" "+a};OLExtraTeamCompetition.prototype.IsThisClassExluded=function(a){return"undefined"===typeof this.Teams[a]};OLExtraTeamCompetition.prototype.GetTitle=function(){return this.Title[Language]};OLExtraTeamCompetition.prototype.IsNarrow=function(){return!0};var OLIndividualCompetitor=function(a,d,b,e){this.ID=a[e.JsonFileFormats.OLIndividualCompetitor.CompetitorID];this.Team=this.NameFirst=this.NameLast=this.WRCode=this.LicenseNumber=this.Nationality=this.Club=this.BaseBib=null;this.FileFormats=e.JsonFileFormats;this.Races=[];this.isFavourite=!1;this.Event=e;this.UpdateData(a,d,b)}; OLIndividualCompetitor.prototype.UpdateData=function(a,d,b){this.BaseBib=null!=a[this.FileFormats.OLIndividualCompetitor.BaseBib]?a[this.FileFormats.OLIndividualCompetitor.BaseBib]:null;this.Club="object"==typeof d[a[this.FileFormats.OLIndividualCompetitor.ClubID]]?d[a[this.FileFormats.OLIndividualCompetitor.ClubID]]:b;this.Nationality=null!=a[this.FileFormats.OLIndividualCompetitor.Nationality]?a[this.FileFormats.OLIndividualCompetitor.Nationality]:"";this.LicenseNumber=null!=a[this.FileFormats.OLIndividualCompetitor.LicenseNumber]? a[this.FileFormats.OLIndividualCompetitor.LicenseNumber]:0;this.WRCode=null!=a[this.FileFormats.OLIndividualCompetitor.WRCode]?a[this.FileFormats.OLIndividualCompetitor.WRCode]:"";this.NameLast=null!=a[this.FileFormats.OLIndividualCompetitor.NameLast]?a[this.FileFormats.OLIndividualCompetitor.NameLast]:"";this.NameFirst=null!=a[this.FileFormats.OLIndividualCompetitor.NameFirst]?a[this.FileFormats.OLIndividualCompetitor.NameFirst]:"";this.Team=null!=a[this.FileFormats.OLIndividualCompetitor.Team]? a[this.FileFormats.OLIndividualCompetitor.Team]:null;if(a.ChangedClassIDs){for(var e in this.Races)a.ChangedClassIDs[this.Races[e].Class.ID]=this.Races[e].Class.ID,a.ChangedRaceNos[this.Races[e].RaceNo]=this.Races[e].RaceNo;a.ChangedTimingPointsAll=!0}};OLIndividualCompetitor.prototype.GetRacePoints=function(a){return this.Races[a]?this.Races[a].GetRacePoints():null}; OLIndividualCompetitor.prototype.UpdateStartTimeReal=function(a){var d=a.shift();return 0==this.Races.length||null==this.Races[d]?!1:this.Races[d].UpdateStartTimeReal(a)};OLIndividualCompetitor.prototype.UpdateRaceData=function(a,d,b,e){this.Races[d]?this.Races[d].UpdateData(a,b,e):this.Races[d]=new OLIndividualCompetitorRace(a,b,e,this.FileFormats);a.ChangedClassIDs&&(a.ChangedClassIDs[this.Races[d].Class.ID]=this.Races[d].Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPointsAll=!0)}; OLIndividualCompetitor.prototype.UpdateSplits=function(a,d,b,e){if(this.Races[d])this.Races[d].UpdateSplits(a);else return!1;a.ChangedClassIDs&&(a.ChangedClassIDs[this.Races[d].Class.ID]=this.Races[d].Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPointsAll=!0)};OLIndividualCompetitor.prototype.ClearRaces=function(){this.Races=[]}; OLIndividualCompetitor.prototype.UpdateBadges=function(a){if(0==this.Races.length)return!1;var d=a[this.FileFormats.OLUpdateBadge.RaceNo-1];a.ChangedClassIDs&&(a.ChangedClassIDs[this.Races[d].Class.ID]=this.Races[d].Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPoints[0]=0);return this.Races[d].UpdateBadges(a[this.FileFormats.OLUpdateBadge.Badge1-1],a[this.FileFormats.OLUpdateBadge.Badge2-1])}; OLIndividualCompetitor.prototype.UpdateResult=function(a){if(0==this.Races.length)return!1;var d=a.shift(),b=a[this.FileFormats.OLResult.Point-2];a.ChangedClassIDs&&(a.ChangedClassIDs[this.Races[d].Class.ID]=this.Races[d].Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPoints[b]=b);return this.Races[d].UpdateResult(a,b)}; OLIndividualCompetitor.prototype.getNatPrint=function(a){return a&&"OTH"!=this.Nationality&&""!=this.Nationality?""+this.Nationality+"":this.Nationality}; OLIndividualCompetitor.prototype.getCompetitorLink=function(a,d,b){var e=[];e.push("Competitor");e.push(this.BaseBib);a&&e.push(a);b=this.GetNameStd(a,b);d&&a&&this.Races&&this.Races[a]&&(b+=" ("+this.Races[a].Bib+")");return''+b+""}; OLIndividualCompetitor.prototype.getClubLink=function(a,d){if(null===this.Club||null===this.Club.ClubNameLong||""==this.Club.ClubNameLong)return"";var b=[];b.push("ClubResults");b.push(encodeURIComponent(this.Club.ClubNameLong));a&&b.push(a);b='';b=d?b+this.Club.ClubNameShort:b+this.Club.ClubNameLong;return b+""}; OLIndividualCompetitor.prototype.getCertificateLink=function(a){return""+Texts.Certificate+""}; OLIndividualCompetitor.prototype.GetFavouriteButton=function(a){return this?this.isFavourite?"":"":"?"}; OLIndividualCompetitor.prototype.GetNameStd=function(a,d){if(d){var b=this.NameFirst.split("-");return 2==b.length?b[0].substr(0,1)+"-"+b[1].substr(0,1)+". "+this.NameLast:this.NameFirst.substr(0,1)+". "+this.NameLast}return this.NameFirst+" "+this.NameLast};var OLIndividualCompetitorRace=function(a,d,b,e){this.Competitor=b[a[e.OLIndividualCompetitorRace.CompetitorID]];this.Status=this.RaceNo=null;this.PenaltyTime=new OLTime;this.StartTimeTable=new OLTime;this.StartTimeReal=new OLTime;this.Class=this.Bib=this.Badge2=this.Badge1=null;this.Results=[];this.RacePoints=this.Splits=null;this.FileFormats=e;this.ShootingPenalties=this.RankTmp=this.WorstPossibleRankTmp=this.BestPossibleRankTmp=this.RunningTimeTmp=null;this.UpdateData(a,d)}; OLIndividualCompetitorRace.prototype.UpdateData=function(a,d){this.RaceNo=a[this.FileFormats.OLIndividualCompetitorRace.RaceNo];this.Status=a[this.FileFormats.OLIndividualCompetitorRace.Status];this.Badge1=a[this.FileFormats.OLIndividualCompetitorRace.Badge1];this.Badge2=a[this.FileFormats.OLIndividualCompetitorRace.Badge2];this.Bib=a[this.FileFormats.OLIndividualCompetitorRace.Bib];this.RacePoints=this.FileFormats.OLIndividualCompetitorRace.RacePoints&&a[this.FileFormats.OLIndividualCompetitorRace.RacePoints]? a[this.FileFormats.OLIndividualCompetitorRace.RacePoints]:null;this.ShootingPenalties=this.FileFormats.OLIndividualCompetitorRace.ShootingPenalties&&a[this.FileFormats.OLIndividualCompetitorRace.ShootingPenalties]?a[this.FileFormats.OLIndividualCompetitorRace.ShootingPenalties]:null;null!=this.Class?this.Class.ID!=a[this.FileFormats.OLIndividualCompetitorRace.ClassID]&&(this.Class=d[a[this.FileFormats.OLIndividualCompetitorRace.ClassID]]):this.Class=d[a[this.FileFormats.OLIndividualCompetitorRace.ClassID]]; this.PenaltyTime.UpdateData(a[this.FileFormats.OLIndividualCompetitorRace.PenaltyTime],this.RaceNo,0);this.StartTimeTable.UpdateData(a[this.FileFormats.OLIndividualCompetitorRace.StartTimeTable],this.RaceNo,-2);this.StartTimeReal.UpdateData(a[this.FileFormats.OLIndividualCompetitorRace.StartTimeReal],this.RaceNo,-1);if(null!=a[this.FileFormats.OLIndividualCompetitorRace.Results])for(var b in a[this.FileFormats.OLIndividualCompetitorRace.Results])this.UpdateResult(a[this.FileFormats.OLIndividualCompetitorRace.Results][b], a[this.FileFormats.OLIndividualCompetitorRace.Results][b][this.FileFormats.OLResult.Point-2])};OLIndividualCompetitorRace.prototype.UpdateStartTimeReal=function(a){a.ChangedClassIDs&&(a.ChangedClassIDs[this.Class.ID]=this.Class.ID,a.ChangedRaceNos[this.RaceNo]=this.RaceNo,a.ChangedTimingPointsAll=!0);this.StartTimeReal.UpdateData(a[this.FileFormats.OLStartTimeReal.StartTimeReal-2],this.RaceNo,-1)}; OLIndividualCompetitorRace.prototype.UpdateResult=function(a,d){if(this.Results[d])return this.Results[d].UpdateData(a,this.RaceNo);this.Results[d]=new OLResult(a,this.RaceNo,this.FileFormats.OLResult);return!0};OLIndividualCompetitorRace.prototype.UpdateBadges=function(a,d){this.Badge1=a;this.Badge2=d;return!0}; OLIndividualCompetitorRace.prototype.UpdateSplits=function(a){if(this.Splits)return this.Splits.UpdateData(a,this.RaceNo);this.Splits=new OLSplits(a,this.RaceNo,this.FileFormats.OLSplits,this.FileFormats.OLControl);return!0};OLIndividualCompetitorRace.prototype.GetNameStd=function(a){return this.Competitor.NameFirst+" "+this.Competitor.NameLast}; OLIndividualCompetitorRace.prototype.GetRaceTimeNow=function(){if("OP"==this.Status&&null===this.Results[0].TimeRace.Time){var a=this.Competitor.Event.GetNow(),d=(null===this.StartTimeReal.Time?this.StartTimeTable.Time:this.StartTimeReal.Time)+OLTime.RaceDates[this.RaceNo].getTime()+OLTime.TimeZoneDiffToLocalMS,a=a-d;null!=this.PenaltyTime.Time&&(a+=this.PenaltyTime.Time);0>a&&(a=0);this.RunningTimeTmp=new OLTime(a,this.RaceNo,-4);this.RunningTimeTmp.Time=a}else this.RunningTimeTmp=null;return this.RunningTimeTmp}; OLIndividualCompetitorRace.prototype.GetPossibleFinalClasses=function(){return null===this.BestPossibleRankTmp||null===this.WorstPossibleRankTmp?"":this.Class.GetPossibleFinalClasses(this.RaceNo,this.BestPossibleRankTmp,this.WorstPossibleRankTmp)};OLIndividualCompetitorRace.HowManyOpenAndFinished=function(a){var d=0,b;for(b in a)"OP"!=a[b].Status&&null===a[b].Results[0].TimeRace.Time||++d;return d}; OLIndividualCompetitorRace.prototype.HowManyFinishedBeforeMe=function(a){var d=0,b;for(b in a)null!==a[b].Results[0].TimeRace.Time&&null!==this.RunningTimeTmp&&a[b].Results[0].TimeRace.getValueRank()";e.appendChild(g);I.appendChild(e);I.appendChild(document.createElement("tbody"));I.appendChild(document.createElement("tfoot")); $("#online_content").append(I);$("#online_content").append(A);$("#online_content").append(L);""!=b&&(A.innerHTML=b);""!=d&&(L.innerHTML=d);f();x()}function b(a){w.startDownloadCompetitorData();setInterval(function(){m.DownloadEventData()},18E4)}function e(){G.innerHTML=''+m.Headers.EventTitle+"";z=B="";m.Headers.AllowFollowAll||(V=M=N=-1,m.SocketIOStopFollowing());t="Relay"==m.Headers.EventType?new OLShowEventIndexRelay(m,w):new OLShowEventIndexIndividual(m,w); D(C,A,t,null,null);d(t.Columns)}function f(){$("#OnlineTable tbody").unbind("click");$("#OnlineTable tbody").on("click","a",function(a){a.preventDefault();$.event.trigger({type:"LinkClicked",url:this.href,title:"default",time:new Date})});$("#OnlineHeaderLower").unbind("click");$("#OnlineHeaderLower").on("click","a",function(a){$(this).hasClass("ExternalLink")||(a.preventDefault(),$.event.trigger({type:"LinkClicked",url:this.href,title:"default",time:new Date}))});$("#OnlineFooterLower").unbind("click"); $("#OnlineFooterLower").on("click","a",function(a){$(this).hasClass("ExternalLink")||(a.preventDefault(),$.event.trigger({type:"LinkClicked",url:this.href,title:"default",time:new Date}))});$("#OnlineYearSelection").unbind("click");$("#OnlineYearSelection").on("click","a",function(a){$(this).hasClass("ExternalLink")||(a.preventDefault(),$.event.trigger({type:"LinkClicked",url:this.href,title:"default",time:new Date}))})}function g(a){K.SetUserSettingsFromLocalStorage();m.Headers.AllowFollowAll?(w.DownloadAllResults(), H()):(H(),m.Headers.Online&&m.ConnectToServer(),$("#DownloadStatus").dialog("close"));if(!m.FollowingFavourites){for(var b in w.FavouritesByBaseBib)m.SocketIOSubscribe(b);m.FollowingFavourites=!0}}function h(a){console.log(a);console.log("window.location.reload()");window.location.reload()}function k(a){H();m.Headers.Online&&m.ConnectToServer();$("#DownloadStatus").dialog("close");for(var b in S)Y(S[b]);S=[]}function l(a){console.log("onSocketIOStopFollowing");m.SocketIOStopFollowing()}function q(a){K.InitializeMessagingIfNecessary()} function u(a){a.message.DoNotStopFollowing||m.SocketIOStopFollowing();var b={};if(a.message.Type&&"TopResults"==a.message.Type)b.Type="TopResults",b.ClassID=a.message.ClassID,b.RaceNo=a.message.RaceNo,b.Point=a.message.Point,m.SocketIOStartFollowing(b);else if(a.message.PostID)b.Type="ResultboardPost",b.ResultBoardPostNo=a.message.PostID,m.SocketIOStartFollowing(b);else if(null!==a.message.BaseBib&&0"+Texts.LegTimes+" "+b+". "+Texts.leg+" "+f.getDistanceInKM(b,e)+"",z=Texts.LegTimes+" "+b+". "+Texts.leg+" "+f.getDistanceInKM(b,e)+" | "+f.ClassNameShort):0==e?m.Headers.IsRoundCompetition&&m.Headers.Online?(B="

    "+Texts.RoundsStatus+"

    ",z=Texts.RoundsStatus+" | "+f.ClassNameShort):(B="

    "+Texts.Maali+" "+f.getDistanceInKM(b, e)+"

    ",z=Texts.Maali+" "+f.getDistanceInKM(b,e)+" | "+f.ClassNameShort):(B="

    "+Texts.Valiaika+" "+f.getDistanceInKM(b,e)+"

    ",z=Texts.Valiaika+" "+f.getDistanceInKM(b,e)+" | "+f.ClassNameShort);t=m.ClassesByID[a].Races[b].BigRelay?new OLShowStandingsRaceRelayBig(f,b,e,m,w.TmpBigRelayResults,w.TmpBigRelayResultsByBaseBib):new OLShowStandingsRace(b,e,w.CompetitorRaces[a][b],f,m);D(C,A,t,m.ClassesByID[a],b);d(t.Columns)}function v(a,b,e){console.log("ShowStandingsTotal("+a+","+b+","+e+")"); G.innerHTML=m.Headers.EventTitle;var f=m.ClassesByID[a];"Relay"==m.Headers.EventType?0==e?b==f.LastRace?(B="

    "+Texts.Maali+" "+f.getDistanceInKM(b,e)+"

    ",z=Texts.Maali+" "+f.getDistanceInKM(b,e)+" | "+f.ClassNameShort):(B="

    "+b+". "+Texts.Vaihto+" "+f.getDistanceInKM(b,e)+"

    ",z=b+". "+Texts.Vaihto+" "+f.getDistanceInKM(b,e)+" | "+f.ClassNameShort):(B="

    "+b+". "+Texts.leg+" "+Texts.Valiaika+" "+f.getDistanceInKM(b,e)+"

    ",z=b+". "+Texts.leg+" "+Texts.Valiaika+" "+f.getDistanceInKM(b, e)+" | "+f.ClassNameShort):"Pursuit"==f.Races[b].MultiRaceType?0==e?(B="

    "+Texts.Maali+" "+f.getDistanceInKM(b,e)+"

    ",z=Texts.Maali+" "+f.getDistanceInKM(b,e)+" | "+f.ClassNameShort):(B="

    "+Texts.Valiaika+" "+f.getDistanceInKM(b,e)+"

    ",z=Texts.Valiaika+" "+f.getDistanceInKM(b,e)+" | "+f.ClassNameShort):(B="

    "+Texts.TotalTimes+"

    ",z=Texts.TotalTimes+" | "+f.ClassNameShort);t=m.ClassesByID[a].Races[b].BigRelay?new OLShowStandingsTotalRelayBig(f,b,e,m,w.TmpBigRelayResults,w.TmpBigRelayResultsByBaseBib): new OLShowStandingsTotal(b,e,w.CompetitorRaces[a][b],f,m);D(C,A,t,m.ClassesByID[a],b);d(t.Columns)}function x(a){null!=t&&null!=t.DelayedUpdateMSec&&0$("#OnlineTable_wrapper").width()&&($("#OnlineTable_wrapper").addClass("full-width-table"),$("#OnlineTable_fade").length||$("#OnlineTable_wrapper").before('
    ')),t.TableStyleClass&&""!=t.TableStyleClass&&$("#OnlineTable_wrapper").addClass(t.TableStyleClass),0==T.dataTableExt.afnFiltering.length&&T.dataTableExt.afnFiltering.push(function(a, b,d){return"true"===b[0]}),T.fnDraw(),null!=t&&null!=t.SomethingHighlighted&&t.SomethingHighlighted&&t.SetHighlightUpdateTimer())}function D(a,b,d,e,f){console.log("PrintHeadersAndFooters()");if(null==d||"OLShowResultBoardAuto"!=d.Name||"StatusBoardInteractive"!=d.DisplayMode.Action)a.innerHTML="";if(null!==e&&e&&null!==f){a.innerHTML=1"+e.ClassNameLong+" "+m.GetRaceTitle(f)+""):a.innerHTML+ ("

    "+e.ClassNameLong+"

    ");var g;g=""+("< "+Texts.sarjat+" - ");"Relay"==m.Headers.EventType?g=e.Races[f].BigRelay?g+(e.getStartListLink(f)+" - "):g+(e.getSmartFollowLink(f)+" - "):(g+=e.getStartListLink(f)+" - ",g+=e.getSmartFollowLink(f)+" - ");g+=e.getIntermediateResultsLinks(f," - ",m.Headers.IsRoundCompetition);g+=e.getFinishResultsLink(f);f!=e.FirstRace&&"Continuation"==e.Races[f].MultiRaceType? g+=" - "+e.getTotalResultsLink(f):f!=e.FirstRace&&"Pursuit"==e.Races[f].MultiRaceType?g+=" - "+e.getRaceResultsLink(f):"Relay"==m.Headers.EventType&&1"}R();d&&"function"===typeof d.GetOnlineHeaderLower&&(a.innerHTML+=d.GetOnlineHeaderLower());a.innerHTML+=B;b.hidden=d&&"function"=== typeof d.IsOnlineFooterUpperHidden?d.IsOnlineFooterUpperHidden():!1;b.innerHTML=d&&"function"===typeof d.GetOnlineFooterUpper?d.GetOnlineFooterUpper():"";L.hidden=d&&"function"===typeof d.IsOnlineFooterLowerHidden?d.IsOnlineFooterLowerHidden():!1;G.hidden=d&&"function"===typeof d.IsOnlineHeaderUpperHidden?d.IsOnlineHeaderUpperHidden():!1;OnlineHeaderMenu.hidden=d&&"function"===typeof d.IsOnlineHeaderMenuHidden?d.IsOnlineHeaderMenuHidden():!1;C.hidden=d&&"function"===typeof d.IsOnlineHeaderLowerHidden? d.IsOnlineHeaderLowerHidden():!1;O.hidden=m.Headers.Online?d&&"function"===typeof d.IsOnlineStatusHidden?d.IsOnlineStatusHidden():!1:!0;aa.hidden=d&&"function"===typeof d.IsOnlineLanguageSelectionHidden?d.IsOnlineLanguageSelectionHidden():!1}function ga(a){$("#OnlineTable").unbind("click");console.log("ShowResultBoard() "+JSON.stringify(a));$("#OnlineTable").remove();I=null;I=document.createElement("div");I.setAttribute("id","OnlineTable");G.innerHTML=m.Headers.EventTitle;if(a.action||a.DisplayID)if(t= null,"rounds"==a.action){var b=m.GetClassByName(a.Class),e=parseInt(a.RaceNo);!m.Headers.AllowFollowAll&&P(b.ID,e)?Q(b.ID,e):t=new OLShowResultBoard(I,w.CompetitorRaces[b.ID][e],b,e,a);D(C,A,t,null,null)}else if("latest"==a.action){var f=e=b=null;a.Class&&""!=a.Class&&(b=a.Class);a.RaceNo&&""!=a.RaceNo&&null!==parseInt(a.RaceNo)&&(e=parseInt(a.RaceNo));a.Point&&""!=a.Point&&null!==parseInt(a.Point)&&(f=parseInt(a.Point));t=new OLShowResultBoardAuto(a.action,m.ClassesByName,m.Headers,b,e,f);D(C,A, t,null,null);d(t.Columns);$(".LatestBoardSelection").change(function(){console.log($(this).attr("name")+"="+$(this).val());var a=t.Class;t.Class&&(a=t.Class.ClassNameShort.toLowerCase());var b=t.RaceNo,d=t.TimingPoint,e=$(this).attr("name"),f=$(this).val();""==f&&(f=null);"Class"==e&&(a=f);"RaceNo"==e&&(b=f);"Point"==e&&(d=f);e="?action=latest";null!==a&&(e+="&Class="+a);null!==b&&(e+="&RaceNo="+b);null!==d&&(e+="&Point="+d);console.log(e);$.event.trigger({type:"LinkClicked",url:e,title:"default", time:new Date})})}else""!=a.DisplayID&&(t=new OLShowResultBoardAuto(a.DisplayID,m.ClassesByName,m.Headers),D(C,A,t,null,null),d(t.Columns));else C.innerHTML="< "+Texts.takaisin+"",C.innerHTML+="

    "+Texts.Resultboard+" "+JSON.stringify(a)+"

    ",a=""+OLShowResultBoard.GetSelectionHtml(m.ClassesByID),I.innerHTML=a;$("#online_content").append(I);$("#OnlineTable").on("click","a",function(a){a.preventDefault();$.event.trigger({type:"LinkClicked", url:this.href,title:"default",time:new Date})})}function da(b){console.log("ShowAllResults() ClassID="+b);G.innerHTML=m.Headers.EventTitle;void 0===b?(B="

    "+Texts.tuloksetkaikkisarjat+"

    ",z=Texts.tuloksetkaikkisarjat,b=null):z=B="";a();var d="",d="Relay"==m.Headers.EventType?"AllResultsByClassRelay":"AllResultsByClassIndividual";t=new OLShowListGeneric(d,m,w.CompetitorsByBaseBib,w.Clubs,b);D(C,A,t,null,null)}function ea(b,e){console.log("ShowStartList("+b+","+e+")");G.innerHTML=m.Headers.EventTitle; var f=m.ClassesByID[b];B="

    "+Texts.StartingList+"

    ";z=Texts.StartingList+" | "+f.ClassNameShort;void 0!=e&&m.ClassesByID[b].Races[e].BigRelay?(t=new OLShowStartListRelayBig(e,w.RelayCompetitorsByClassID[b],f,m.Headers.ShowFlags),D(C,A,t,m.ClassesByID[b],e),d(t.Columns)):"Relay"==m.Headers.EventType?(a(),t=new OLShowListGeneric("RelayStartListWithRunners",m,w.CompetitorsByBaseBib,w.Clubs,b),D(C,A,t,null,null)):(t=new OLShowStartListIndividual(w.CompetitorRaces[b][e],f,e,m),D(C,A,t,m.ClassesByID[b], e),d(t.Columns))}function R(){var a="",a=""==z?Texts?Texts.Online_Results:"Online-tulokset | Online-results | Online-resultat":z;m&&(a+=" | "+m.Headers.EventTitle);document.title=a}function ha(a){console.log("onForceResetOnlineTable()");d(t.Columns)}function ia(a){"OLEvent.UpdateEventStatus()"==a.message&&(console.log(a),null!==t&&(!0!==a.KmUpdated||"OLShowSmartFollowRace"!=t.Name&&"OLShowSmartFollowTotal"!=t.Name||H(),D(C,A,t,m.ClassesByID[t.ClassID],t.RaceNo)));x()}function Y(a){0< "+Texts.sarjat+"",B="

    "+Texts.AllFavourites+"

    ",z=Texts.AllFavourites,t=new OLShowFavourites(w.FavouritesByBaseBib,m.Headers.ShowFlags),D(C,A,t,null,null),d(t.Columns);else if(f[0]===Texts.url_resultboard||"tulostaulu"===f[0])console.log("tulostaulu"),m.DoNotDownloadChangesWhenConnecting=!0,ga(g);else if(f[1]==Texts.url_tilanne||"tilanne"===f[1])g=m.GetClassIDByName(f[0]),l=parseInt(f[2]),b=parseInt(f[3]), !m.Headers.AllowFollowAll&&m.ClassesByID[g].Races[l].BigRelay&&fa(g,l,b)?(N=f=g,M=l,V=b,w.changeClassAndRaceAndPoint(f,l,b)):!m.Headers.AllowFollowAll&&P(g,l)?Q(g,l):"Relay"==m.Headers.EventType||"Pursuit"==m.ClassesByID[g].Races[l].MultiRaceType?v(g,l,b):n(g,l,b);else if(f[1]==Texts.url_lopputulokset||"lopputulokset"===f[1])g=m.GetClassIDByName(f[0]),da(g);else if(f[1]==Texts.url_leaderboard||"karki"===f[1])g=m.GetClassIDByName(f[0]),G.innerHTML=m.Headers.EventTitle,b=m.ClassesByID[g],B="

    "+Texts.Leaderboard+ "

    ",z=Texts.Leaderboard+" | ",z="VE"==b.ClassNameShort?z+Texts.VenlojenViesti:"JU"==b.ClassNameShort?z+Texts.JukolanViesti:z+b.ClassNameLong,t=new OLShowLeaderBoard(b,m,w.CompetitorsByBaseBib),D(C,A,t,b,null),d(t.Columns);else if(f[1]===Texts.url_totaltimes||"yhteisajat"===f[1])g=m.GetClassIDByName(f[0]),l=parseInt(f[2]),!m.Headers.AllowFollowAll&&P(g,l)?Q(g,l):v(g,l,0);else if(f[1]===Texts.url_extra||"cup"===f[1]||"extra"===f[1])g=m.GetClassIDByName(f[0]),b=f[2],l=parseInt(f[3]),!m.Headers.AllowFollowAll&& P(g,l)?Q(g,l):(f=g,console.log("ShowExtra("+f+","+b+","+l+")"),G.innerHTML=m.Headers.EventTitle,x=m.ClassesByID[f],"undefined"!==typeof m.Extras[b]&&(b=m.Extras[b],B=b.GetOnlineHeaderLowerStaticText(),z=b.GetOnlineHtmlTitlePrefix(x.ClassNameShort),t=new OLShowExtra(l,x,w.CompetitorRaces[f][l],w.CompetitorsByBaseBib,m.Headers.ShowFlags,b),D(C,A,t,m.ClassesByID[f],l)),d(t.Columns));else if(f[1]===Texts.url_racetimes||f[1]===Texts.url_legtimes||"osuusajat"===f[1])g=m.GetClassIDByName(f[0]),l=parseInt(f[2]), !m.Headers.AllowFollowAll&&m.ClassesByID[g].Races[l].BigRelay&&fa(g,l,0)?(N=b=g,M=l,V=0,w.changeClassAndRaceAndPoint(b,l,0)):!m.Headers.AllowFollowAll&&P(g,l)?Q(g,l):n(g,l,0);else if(f[1]===Texts.url_smart||"smart"===f[1])g=m.GetClassIDByName(f[0]),l=parseInt(f[2]),!m.Headers.AllowFollowAll&&P(g,l)?Q(g,l):(b=g,console.log("ShowSmartFollow("+b+","+l+")"),f=m.ClassesByID[b],G.innerHTML=m.Headers.EventTitle,1"+Texts.SmartFollow+"",z=Texts.SmartFollow+ " | "+f.ClassNameShort):"Relay"==m.Headers.EventType?(B="

    "+Texts.SmartFollow+" "+l+". "+Texts.osuus+"

    ",z=Texts.SmartFollow+" "+l+". "+Texts.osuus+" | "+f.ClassNameShort):(B="

    "+Texts.SmartFollow+"

    ",z=Texts.SmartFollow+" | "+f.ClassNameShort),t="Relay"==m.Headers.EventType||"Pursuit"==f.Races[l].MultiRaceType?new OLShowSmartFollowTotal(w.CompetitorRaces[b][l],f,l,m.Headers):new OLShowSmartFollowRace(w.CompetitorRaces[b][l],f,l,m.Headers),D(C,A,t,m.ClassesByID[b],l),d(t.Columns));else if(f[1]=== Texts.url_kilpailijat||"kilpailijat"===f[1])if(g=m.GetClassIDByName(f[0]),""!=f[2])if(l=f[2],"p"===l.substring(0,1))l=l.substring(1),l=l=parseInt(l),m.Headers.AllowFollowAll||m.ClassesByID[g].Races[l].BigRelay||!P(g,l)?ea(g,l):Q(g,l);else{if(e(),console.log(x),!x||!x[0]||"Feedback"!=decodeURIComponent(x[0])){var x=[];x.push("Competitor");x.push(parseInt(f[2]));f[3]&&x.push(parseInt(f[3]));l=window.location.origin+"/"+WwwRoot+"/"+Language+"/"+EventID+"/"+ManipulateGet(x,window.location.search);l={Url:l}; console.log(l);history.pushState(l,l.Title,l.Url);H(b)}}else ea(g);else if(!(f[0]!==Texts.url_kilpailijat&&"kilpailijat"!==f[0]||f[1]!==Texts.url_sarjoittain&&"sarjoittain"!==f[1]))console.log("ShowStartListByClass()"),G.innerHTML=m.Headers.EventTitle,B="

    "+Texts.StartingList+"

    ",a(),b="",b="Relay"==m.Headers.EventType?"StartListByClassRelay":"StartListByClassIndividual",t=new OLShowListGeneric(b,m,w.CompetitorsByBaseBib,w.Clubs),D(C,A,t,null,null);else if(!(f[0]!==Texts.url_kilpailijat&&"kilpailijat"!== f[0]||f[1]!==Texts.url_seuroittain&&"seuroittain"!==f[1]))console.log("ShowStartListByClub()"),G.innerHTML=m.Headers.EventTitle,B="

    "+Texts.StartingList+"

    ",z=Texts.StartingList,a(),b="",b="Relay"==m.Headers.EventType?"StartListByClubRelay":"StartListByClubIndividual",t=new OLShowListGeneric(b,m,w.CompetitorsByBaseBib,w.Clubs),D(C,A,t,null,null);else if(f[0]===Texts.url_lopputulokset||"lopputulokset"===f[0])da();else if(f[0]===Texts.url_selected||"valikoidut"===f[0])console.log("ShowSelectedResults()"), G.innerHTML=m.Headers.EventTitle,B="

    "+Texts.aluejalehdistotulokset+"

    ",a(),t=new OLShowSelectedResults("SelectedResults",m,w.Clubs),D(C,A,t,null,null);else if(f[0]===Texts.url_kilpailijat||"kilpailijat"===f[0])e(),console.log(x),x&&x[0]&&"Feedback"==decodeURIComponent(x[0])||(x=[],x.push("Competitor"),x.push(parseInt(f[1])),f[2]&&x.push(parseInt(f[2])),l=window.location.origin+"/"+WwwRoot+"/"+Language+"/"+EventID+"/"+ManipulateGet(x,window.location.search),l={Url:l},console.log(l),history.pushState(l, l.Title,l.Url),H(b));else if(f[1]===Texts.url_rva||"rva"===f[1])g=m.GetClassIDByName(f[0]),l=parseInt(f[2]),m.Headers.AllowFollowAll||m.ClassesByID[g].Races[l].BigRelay||!P(g,l)?(b=g,console.log("ShowSplits("+b+","+l+")"),f=m.ClassesByID[b],G.innerHTML=m.Headers.EventTitle,"Relay"==m.Headers.EventType?(B="

    "+Texts.Rastivaliajat+" "+l+". "+Texts.Leg+"

    ",z=Texts.Rastivaliajat+" "+l+". "+Texts.Leg+" | "+f.ClassNameShort):1"+Texts.Rastivaliajat+" "+m.GetRaceTitle(l)+"", z=l+" "+Texts.Rastivaliajat+" | "+f.ClassNameShort):(B="

    "+Texts.Rastivaliajat+"

    ",z=Texts.Rastivaliajat+" | "+f.ClassNameShort),t="Relay"==m.Headers.EventType?f.Races[l].BigRelay?new OLShowSplitsRelayBig(l,w.RelayCompetitorsByClassID[b],f,m.Headers.ShowFlags):new OLShowSplitsRelay(l,w.CompetitorRaces[b][l],f,m.Headers.ShowFlags):new OLShowSplitsIndividual(l,w.CompetitorRaces[b][l],f,m.Headers.ShowFlags,m.Headers.FinishLineControlCode),D(C,A,t,f,l),d(t.Columns)):Q(g,l)}function fa(a,b,d){return a!= N?(console.log("Class changed! ClassID="+a+" current_ClassID="+N),!0):b!=M?(console.log("Race changed! RaceNo="+b+" current_RaceNo="+M),!0):d!=V?(console.log("PointNo changed! PointNo="+b+" current_PointNo="+V),!0):!1}function P(a,b){return a!=N?(console.log("Class changed! ClassID="+a+" current_ClassID="+N),!0):b!=M?(console.log("Race changed! RaceNo="+b+" current_RaceNo="+M),!0):!1}function ca(a){console.log("CheckBigRelayUpdate");W=!1;Z==m.LastReceivedPkgID.OnlineData?(a.DoNotUpdate=!1,x(a)):(console.log(Z+ " != "+m.LastReceivedPkgID.OnlineData),W=!0,setTimeout(function(){ca(a)},1E3))}function Q(a,b){N=a;M=b;w.changeClassAndRace(a,b)}var t=null,K=new OLUserSettings;new OLCookieBar({agreeBtn:{background:"#188C44"}});(function(){var a=window.location.pathname.split("/");""==a[0]&&a.shift();WwwRoot="";Language=null;for(var b in a)if(null===Language)"fi"==a[b]||"sv"==a[b]||"en"==a[b]||"se"==a[b]?(Language=a[b],Texts=OLTexts.getLanguageArray(Language)):""!=a[b]&&(""!=WwwRoot&&(WwwRoot+="/"),WwwRoot+=a[b]); else if(""!=a[b]){EventID=a[b];break}})();var W=!1,Z=null,G=document.createElement("h1");G.setAttribute("id","OnlineHeaderUpper");var C=document.createElement("div");C.setAttribute("id","OnlineHeaderLower");var B="",z="",aa=document.createElement("div");aa.setAttribute("id","OnlineLanguageSelection");var O=document.createElement("div");O.setAttribute("id","OnlineStatus");O.innerHTML="OfflineOffline"; O.hidden=!0;var A=document.createElement("div");A.setAttribute("id","OnlineFooterUpper");var L=document.createElement("div");L.setAttribute("id","OnlineFooterLower");var y;y='
    ";y+="
    ";var J=$("body");$("head").append('');"undefined"!=typeof IsJukola&&IsJukola&&J.addClass("style-jukola");"undefined"!=typeof IsEmbedded&&IsEmbedded&&J.addClass("embedded");J.append('
    ');$("#online_content").innerHTML= "";$("#online_content").append(y);$("#online_content").append(O);$("#online_content").append(G);$("#online_content").append(C);$("#MainMenuPanel").append(aa);y="";null===EventID?(y+="fi ",y+="sv ",y+="en "): (y+="fi ",y+="sv ",y+="en ");$("#OnlineLanguageSelection").html(y);OnlineConnection= !1;y="";if(null!==Language){null!==EventID&&(y+=""+Texts.kisan_etusivu+" ");y+=""+Texts.tulosten_etusivu+" ";y+=""+Texts.palaute+" ";y+=''+Texts.haku_tuloksista+" ";var J=WwwRoot.substring(0,WwwRoot.length-4),X=Language;"sv"==X&&(X="se");y=null!==EventID?y+(""+Texts.BackToPreviousVersion+" "):y+(""+Texts.BackToPreviousVersion+" ");y+=""}L.innerHTML=y;$(document).on("LinkClicked",function(a){var b={};b.href=""+window.location.href;b.origin=""+window.location.origin;b.pathname=""+window.location.pathname;b.search=""+window.location.search;"default"===a.title&&(a.title=EventID);a={Url:a.url};history.pushState(a,a.Title,a.Url);H(b)});window.addEventListener("popstate",H,!1);y=document.createElement("div"); y.setAttribute("id","CompetitorPopup");$("#online_content").append(y);var ba=!1;$("#CompetitorPopup").dialog({autoOpen:!1,resizable:!1,modal:!0,draggable:!0,width:900,position:{my:"center",at:"top+10%",of:window},open:function(){$("body").addClass("noscroll popup-open");$(".ui-widget-overlay").bind("click",function(){$("#CompetitorPopup").dialog("close")})},close:function(a,b){ba=!0;console.log("Popup closed");$(".grecaptcha-badge").addClass("hidden");var d={};d.href=""+window.location.href;d.origin= ""+window.location.origin;d.pathname=""+window.location.pathname;d.search=""+window.location.search;var e={Url:d.origin+d.pathname+ManipulateGet(null,d.search)};history.pushState(e,e.Title,e.Url);H(d);ba=!1;$("body").removeClass("noscroll popup-open")},closeOnEscape:!0});$("#CompetitorPopup").html("");var m=null,F=null;if(!0===EventError)O.hidden=!0,OnlineHeaderMenu.hidden=!0,t=new OLNoEvent("EventError"),$("#online_content").append(A),$("#online_content").append(L),R(),H();else if(null===Language)O.hidden= !0,OnlineHeaderMenu.hidden=!0,t=new OLNoEvent("LanguageSelection"),$("#online_content").append(A),$("#online_content").append(L),f(),R(),H();else if(null===EventID||"haku"===EventID||"palaute"===EventID)O.hidden=!0,t=new OLNoEvent("EventSelection",SplitGetToParams(window.location.search)),$("#online_content").append(A),$("#online_content").append(L),f(),"haku"===EventID||"palaute"===EventID?(y={},y.href=""+window.location.href,y.origin=""+window.location.origin,y.pathname=""+window.location.pathname, y.search=""+window.location.search,J=[],"palaute"===EventID?J.push("Feedback"):"haku"===EventID&&J.push("Search"),J={Url:window.location.origin+"/"+WwwRoot+"/"+Language+"/"+ManipulateGet(J)},console.log(J),history.pushState(J,J.Title,J.Url),H(y)):(H(),R());else{$(document).on("EventDataLoaded",b);$(document).on("CompetitorDataLoaded",g);$(document).on("DataUpdateReceived",Y);$(document).on("AllResultsDownloaded",k);$(document).on("SingleResultsDownloaded",r);$(document).on("ResetTimeChanged",h);$(document).on("ForceResetOnlineTable", ha);$(document).on("ForceUpdateOnlineTable",ia);$(document).on("SocketIOStartFollowing",u);$(document).on("SocketIOStopFollowing",l);$(document).on("SocketIOConnected",q);window.twttr=function(a,b,d){var e=a.getElementsByTagName(b)[0],f=window.twttr||{};if(a.getElementById(d))return f;a=a.createElement(b);a.id=d;a.src="https://platform.twitter.com/widgets.js";e.parentNode.insertBefore(a,e);f._e=[];f.ready=function(a){f._e.push(a)};return f}(document,"script","twitter-wjs");y=document.createElement("div"); y.setAttribute("id","DownloadStatus");$("#online_content").append(y);$("#DownloadStatus").dialog({autoOpen:!1,resizable:!1,modal:!0,dialogClass:"no-close",draggable:!1,width:900,closeOnEscape:!1});$("#DownloadStatus").html("
    ");var m=new OLEvent(EventID),w=new OLCompetitors(m);K.setCurrentEvent(m);K.setCurrentCompetitors(w);m.setUserSettings(K);var N=-1,M=-1,V=-1,U=null,I=null,T=null,S=[]}AddToFavourites=function(a){console.log("AddToFavourites() "+ a);K.AddToFavourites(a)&&x()};RemoveFromFavourites=function(a){console.log("onRemoveFromFavourites() "+a);K.RemoveFromFavourites(a)&&x()};toggleMenu=function(){var a=document.getElementById("MainMenuPanel"),b=document.getElementById("MainMenuPanelContent"),d=document.getElementById("OnlineFooterLower").innerHTML,d=d+K.getSettingSelectionHTML(),e;e='"; a.classList.toggle("active");$(b).html(e+d);K.setEventHandlers();$("#MainMenuPanelContent").unbind("click");$("#MainMenuPanelContent").on("click","a",function(a){$(this).hasClass("ExternalLink")||(a.preventDefault(),toggleMenu(),$.event.trigger({type:"LinkClicked",url:this.href,title:"default",time:new Date}))})};DisplayResultNotification=function(a,b,d){var e=window.location.protocol+"//"+window.location.host+"/"+WwwRoot+"/online/online_"+m.EventID+"_statuslist.json?a="+(new Date).getTime(),e=e+ ("&Get="+JSON.stringify([[a.BaseBib,b,d]]));console.log(e);$.ajax({type:"GET",url:e,async:!1}).done(function(e){if("undefined"!==typeof e[0]&&(e=e[0],e.BaseBib==a.BaseBib&&null!==e.Result&&!K.isNotificationAlreadySent("notification-competitor-"+e.BaseBib+"-"+b+"-"+d+"-"+e.Result))){var f=ManipulateGet(["Competitor",a.BaseBib,b],window.location.search),g=a.GetNameStd(!1),h=e.Result+", "+Texts.Sijoitus+" "+e.Rank+".";null!=e.Diff&&(h+=" ("+e.Diff+")");"Relay"!=m.Headers.EventType&&(g+=" "+m.ClassesByID[e.ClassID].getTimingPointTitle(b, d,!0));$.notify({title:g,content:h,url:f},{style:"OLResultNotification",autoHideDelay:1E4,clickToHide:!1})}})};$("#SearchButton").on("click",function(){localStorage.removeItem("SearchWords");var a={};a.href=""+window.location.href;a.origin=""+window.location.origin;a.pathname=""+window.location.pathname;a.search=""+window.location.search;var b=[];b.push("Search");b={Url:window.location.origin+window.location.pathname+ManipulateGet(b,window.location.search)};console.log(b);history.pushState(b,b.Title, b.Url);H(a)})});function SplitGetToParams(a){var d={};if(a&&""!=a){a=a.substring(1).split("&");for(var b in a)null===d&&(d={}),temp=a[b].split("="),""!=temp[0]&&""!=temp[1]&&(d[temp[0]]=temp[1])}return d} function ManipulateGet(a,d){var b="",e=!1;if(d&&""!=d){var f=d.substring(1).split("&"),g;for(g in f){var h=f[g].split("="),k=h[0],h=h[1];"Popup"==k?null!==a&&(b+="&Popup="+a.join(";"),e=!0):b+="&"+k+"="+h}}null===a||e||(b+="&Popup="+a.join(";"));""!=b&&"&"==b.substr(0,1)&&(b=b.substr(1));""!=b&&"?"!=b.substr(0,1)&&(b="?"+b);return b}function IsArrayEmpty(a){for(var d in a)return!1;return!0}function die(){throw Error("Die");};var OLNoEvent=function(a,d){this.Name="OLNoEvent";this.SubName=a;this.Year=this.CurrentYear=(new Date).getFullYear();this.jsonURL=this.Table=null;var b=this;this.SelectionDiv=document.createElement("div");this.SelectionDiv.setAttribute("id","SelectionDiv");$("#online_content").append(this.SelectionDiv);var e="";if("LanguageSelection"==this.SubName)e+="

    Valitse kieli / V\u00e4lj spr\u00e5k / Choose language

    ",this.SelectionDiv.innerHTML=e;else if("EventError"!=this.SubName&&"EventSelection"==this.SubName){d.Year&&(this.Year=parseInt(d.Year));e+="

    "+Texts.valitse_kilpailu+"

    ";if(null!==EventYears){var e=e+"
      ",f;for(f in EventYears)f=EventYears[f],e+="
    • "+f+"
    • ";e+="
    "}this.SelectionDiv.innerHTML=e;$("#Year_"+this.Year).addClass("selected"); e=["",""];this.SetJsonUrl();f={processing:!0,ordering:!1,columns:[{data:function(a,b,d,e){return null!==a.EventID&&null!==a.EventTitle?""+a.EventTitle+"":"?"}},{data:function(a,b,d,e){return!0===a.Online?"ONLINE":""},sClass:"Nationality"}],info:!1,paging:!1,ajax:b.jsonURL};var g=document.createElement("table");g.setAttribute("id","EventSelection");g.setAttribute("class","display nowrap compact");var h=document.createElement("thead"), k=document.createElement("tr"),l;for(l in e)k.innerHTML+=""+e[l]+"";h.appendChild(k);g.appendChild(h);g.appendChild(document.createElement("tbody"));g.appendChild(document.createElement("tfoot"));this.SelectionDiv.appendChild(g);this.Table=$(g).DataTable(f);this.Year==this.CurrentYear?setInterval(function(){b.Table.ajax.reload(null,!1)},9E4):b.Table.ajax.reload(null,!1);g.className+=" EventSelection";$("#EventSelection_wrapper").addClass("narrow-table")}}; OLNoEvent.prototype.SetJsonUrl=function(){this.jsonURL="/"+WwwRoot+"/online/online_events_dt.json";null!==EventYears&&(this.jsonURL+="?Year="+this.Year)};OLNoEvent.prototype.ChangeYear=function(a){console.log("Eventlist year changed from "+this.Year+" to "+a);a!=this.Year&&($("#Year_"+this.Year).removeClass("selected"),this.Year=a,this.SetJsonUrl(),this.Table.ajax.url(this.jsonURL),this.Table.ajax.reload(null,!1),$("#Year_"+this.Year).addClass("selected"))};var OLRelayCompetitor=function(a,d,b,e,f){this.ID=a[f.JsonFileFormats.OLRelayCompetitor.CompetitorID];this.Bib=this.Class=this.Nationality=this.Club=this.BaseBib=null;this.TeamNo=0;this.FileFormats=f.JsonFileFormats;this.Event=f;this.Races=[];this.isFavourite=!1;this.UpdateData(a,d,b,e)}; OLRelayCompetitor.prototype.UpdateData=function(a,d,b,e){this.BaseBib=null!=a[this.FileFormats.OLRelayCompetitor.BaseBib]?a[this.FileFormats.OLRelayCompetitor.BaseBib]:null;this.Club="object"==typeof d[a[this.FileFormats.OLRelayCompetitor.ClubID]]?d[a[this.FileFormats.OLRelayCompetitor.ClubID]]:e;this.Nationality=null!=a[this.FileFormats.OLRelayCompetitor.Nationality]?a[this.FileFormats.OLRelayCompetitor.Nationality]:"";this.TeamNo=null!=a[this.FileFormats.OLRelayCompetitor.TeamNo]?a[this.FileFormats.OLRelayCompetitor.TeamNo]: 0;this.Bib=null!=a[this.FileFormats.OLRelayCompetitor.Bib]?a[this.FileFormats.OLRelayCompetitor.Bib]:null;null!=this.Class?this.Class.ID!=a[this.FileFormats.OLRelayCompetitor.ClassID]&&(this.Class=b[a[this.FileFormats.OLRelayCompetitor.ClassID]]):this.Class=b[a[this.FileFormats.OLRelayCompetitor.ClassID]];if(a.ChangedClassIDs){for(var f in this.Races)a.ChangedRaceNos[this.Races[f].RaceNo]=this.Races[f].RaceNo;a.ChangedClassIDs[this.Class.ID]=this.Class.ID;a.ChangedTimingPointsAll=!0}if(null!=a[this.FileFormats.OLRelayCompetitor.Races])for(var g in a[this.FileFormats.OLRelayCompetitor.Races])d= a[this.FileFormats.OLRelayCompetitor.Races][g],b=d[this.FileFormats.OLRelayCompetitorRace.RaceNo],this.Races[b]&&(console.log("Updating RaceNo="+b),this.Races[b].UpdateData(d,this.Bib,this.Class))}; OLRelayCompetitor.prototype.UpdateRaceData=function(a,d,b,e){this.Races[d]?this.Races[d].UpdateData(a,this.Bib,this.Class):this.Races[d]=new OLRelayCompetitorRace(a,e,this.FileFormats,this.Bib,this.Class);a.ChangedClassIDs&&(a.ChangedClassIDs[this.Races[d].Class.ID]=this.Races[d].Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPointsAll=!0)}; OLRelayCompetitor.prototype.UpdateSplits=function(a,d,b,e){if(this.Races[d])this.Races[d].UpdateSplits(a);else return!1;a.ChangedClassIDs&&(a.ChangedClassIDs[this.Races[d].Class.ID]=this.Races[d].Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPointsAll=!0)};OLRelayCompetitor.prototype.ClearRaces=function(){this.Races=[]}; OLRelayCompetitor.prototype.UpdateStartTimeReal=function(a){var d=a.shift();a.ChangedClassIDs&&(a.ChangedClassIDs[this.Class.ID]=this.Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPointsAll=!0);return 0==this.Races.length||null==this.Races[d]?!1:this.Races[d].UpdateStartTimeReal(a)}; OLRelayCompetitor.prototype.UpdateResult=function(a){var d=a.shift(),b=a[this.FileFormats.OLResult.Point-2];a.ChangedClassIDs&&(a.ChangedClassIDs[this.Class.ID]=this.Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPoints[b]=b);return 0==this.Races.length||null==this.Races[d]?!1:this.Races[d].UpdateResult(a,b)}; OLRelayCompetitor.prototype.getNatPrint=function(a){return a&&"OTH"!=this.Nationality&&""!=this.Nationality?""+this.Nationality+"":this.Nationality}; OLRelayCompetitor.prototype.getCompetitorLink=function(a,d,b){var e=[];e.push("Competitor");e.push(this.BaseBib);a&&e.push(a);a=this.Club.ClubNameLong;1'+a+""}; OLRelayCompetitor.prototype.GetFavouriteButton=function(a){return this.isFavourite?"":""};OLRelayCompetitor.prototype.GetRunnerLink=function(a,d){return this.Races[a].GetRunnerLink(d)}; OLRelayCompetitor.prototype.GetNameStd=function(a){if(null===this.Club||null===this.Club.ClubNameLong||""==this.Club.ClubNameLong)return"";var d=this.Club.ClubNameLong;1"+this.Club.ClubNameLong+""}; OLRelayCompetitor.prototype.UpdateBadges=function(a){if(0==this.Races.length)return!1;var d=a[this.FileFormats.OLUpdateBadge.RaceNo-1];a.ChangedClassIDs&&(a.ChangedClassIDs[this.Class.ID]=this.Class.ID,a.ChangedRaceNos[d]=d,a.ChangedTimingPointsAll=!0);return this.Races[d].UpdateBadges(a[this.FileFormats.OLUpdateBadge.Badge1-1],a[this.FileFormats.OLUpdateBadge.Badge2-1])};var OLRelayCompetitorRace=function(a,d,b,e,f){this.Competitor=d[a[b.OLRelayCompetitorRace.CompetitorID]];this.Status=this.RaceNo=null;this.PenaltyTime=new OLTime;this.StartTimeReal=new OLTime;this.NameFirst=this.NameLast=this.Class=this.Bib=this.Badge2=this.Badge1=null;this.Results=[];this.Splits=null;this.FileFormats=b;this.ShootingPenalties=this.RunningTimeTmp=null;this.UpdateData(a,e,f)}; OLRelayCompetitorRace.prototype.UpdateData=function(a,d,b){this.RaceNo=a[this.FileFormats.OLRelayCompetitorRace.RaceNo];this.Status=a[this.FileFormats.OLRelayCompetitorRace.Status];this.Badge1=a[this.FileFormats.OLRelayCompetitorRace.Badge1];this.Badge2=a[this.FileFormats.OLRelayCompetitorRace.Badge2];this.ShootingPenalties=this.FileFormats.OLRelayCompetitorRace.ShootingPenalties&&a[this.FileFormats.OLRelayCompetitorRace.ShootingPenalties]?a[this.FileFormats.OLRelayCompetitorRace.ShootingPenalties]: null;this.Bib=d;this.Class=b;this.PenaltyTime.UpdateData(a[this.FileFormats.OLRelayCompetitorRace.PenaltyTime],this.RaceNo,0);this.NameLast=a[this.FileFormats.OLRelayCompetitorRace.NameLast];this.NameFirst=a[this.FileFormats.OLRelayCompetitorRace.NameFirst];this.StartTimeReal.UpdateData(a[this.FileFormats.OLRelayCompetitorRace.StartTimeReal],this.RaceNo,-1);if(null!=a[this.FileFormats.OLRelayCompetitorRace.Results])for(var e in a[this.FileFormats.OLRelayCompetitorRace.Results])this.UpdateResult(a[this.FileFormats.OLRelayCompetitorRace.Results][e], a[this.FileFormats.OLRelayCompetitorRace.Results][e][this.FileFormats.OLResult.Point-2])};OLRelayCompetitorRace.prototype.UpdateStartTimeReal=function(a){this.StartTimeReal.UpdateData(a[this.FileFormats.OLStartTimeReal.StartTimeReal-2],this.RaceNo,-1)};OLRelayCompetitorRace.prototype.UpdateResult=function(a,d){if(this.Results[d])return this.Results[d].UpdateData(a,this.RaceNo);this.Results[d]=new OLResult(a,this.RaceNo,this.FileFormats.OLResult);return!0}; OLRelayCompetitorRace.prototype.UpdateSplits=function(a){if(this.Splits)return this.Splits.UpdateData(a,this.RaceNo);this.Splits=new OLSplits(a,this.RaceNo,this.FileFormats.OLSplits,this.FileFormats.OLControl);return!0};OLRelayCompetitorRace.prototype.GetNameStd=function(a){return a?(a=this.NameFirst.split("-"),2==a.length?a[0].substr(0,1)+"-"+a[1].substr(0,1)+". "+this.NameLast:this.NameFirst.substr(0,1)+". "+this.NameLast):this.NameFirst+" "+this.NameLast}; OLRelayCompetitorRace.prototype.GetRunnerLink=function(a){a=this.GetNameStd(a);var d=[];d.push("Competitor");d.push(this.Competitor.BaseBib);d.push(this.RaceNo);return''+a+""}; OLRelayCompetitorRace.prototype.GetRaceTimeNow=function(){if("OP"==this.Status)if(this.StartTimeReal.Time){var a=this.Competitor.Event.GetNow(),d=this.StartTimeReal.Time+OLTime.RaceDates[this.RaceNo].getTime()+OLTime.TimeZoneDiffToLocalMS,a=a-d;0>a&&(a=0);this.RunningTimeTmp=new OLTime(a,this.RaceNo,-4);this.RunningTimeTmp.Time=a}else this.RunningTimeTmp=null;else this.RunningTimeTmp=null;return this.RunningTimeTmp}; OLRelayCompetitorRace.prototype.UpdateBadges=function(a,d){this.Badge1=a;this.Badge2=d;return!0};var OLResult=function(a,d,b){this.DiffTmp=this.RankTmp="";this.TimeTotal=new OLTime;this.TimeRace=new OLTime;this.ChangedTime=null;this.FileFormat={};a&&(this.FileFormat={},this.FileFormat.Point=b.Point+-2,this.FileFormat.TimeRace=b.TimeRace+-2,this.FileFormat.TimeTotal=b.TimeTotal+-2,this.UpdateData(a,d))}; OLResult.prototype.UpdateData=function(a,d){this.DiffTmp=this.RankTmp="";var b;b=0|this.TimeRace.UpdateData(a[this.FileFormat.TimeRace],d,a[this.FileFormat.Point]);a.length<=this.FileFormat.TimeTotal?this.TimeTotal.UpdateData(a[this.FileFormat.TimeRace],d,a[this.FileFormat.Point]):b|=this.TimeTotal.UpdateData(a[this.FileFormat.TimeTotal],d,a[this.FileFormat.Point]);b&&!ProcessingFile&&(this.ChangedTime=new Date);return b}; OLResult.getStatusText=function(a){a="Status_"+a;return null!=Texts[a]?Texts[a]:"?"}; OLResult.prototype.clone=function(){var a=new OLResult;a.TimeRace.Time=this.TimeRace.Time;a.TimeRace.PrecisionRank=this.TimeRace.PrecisionRank;a.TimeRace.PrecisionShow=this.TimeRace.PrecisionShow;a.TimeTotal.Time=this.TimeTotal.Time;a.TimeTotal.PrecisionRank=this.TimeTotal.PrecisionRank;a.TimeTotal.PrecisionShow=this.TimeTotal.PrecisionShow;null!==this.ChangedTime&&(a.ChangedTime=new Date(this.ChangedTime.getTime()));return a};var OLShowClubResults=function(a,d,b,e){this.Name="OLShowClubResults";this.RaceNo=d;this.Event=b;this.current_competitors=e;this.Club=this.current_competitors.GetClubByLongName(a);this.CompetitorsToFollow=[];this.ClassesToFollow=[];this.ResultsToBeDownloaded=[];this.PopupTable_1_DT=null;console.log("OLShowClubResults.OLShowClubResults()");$("#CompetitorPopup").html("");$("#CompetitorPopup").dialog("open");var f=e="";null===this.Club?(e=Texts.virhe+"!",f+=Texts.Seuraa+' "'+a+'" '+Texts.ei_loydy+".

    "): (e=Texts.ClubResults+": "+this.Club.ClubNameLong,a=b.GetRaceTitle(d),a!=d+". "+Texts.day?e+=" "+a:1
    ");f+="";$("#CompetitorPopup").html(f)}; OLShowClubResults.prototype.UpdateData=function(){console.log("OLShowClubResults.UpdateData()");this.CompetitorsToFollow=[];this.ClassesToFollow=[];this.ResultsToBeDownloaded=[];for(var a in this.current_competitors.CompetitorsByID)if(this.current_competitors.CompetitorsByID[a].Club==this.Club&&"NA"!=this.current_competitors.CompetitorsByID[a].Status){var d={ShowTmp:!0,Rank:""};d.Competitor=this.current_competitors.CompetitorsByID[a];d.BaseBib=d.Competitor.BaseBib;d.Bib="";d.NameFirst=d.Competitor.NameFirst; d.NameLast=d.Competitor.NameLast;d.ClassID="";d.ClassNameShort="";d.ResultRace="";d.ResultRaceSec="";d.StartTimeTable="";d.StartTimeTableSec="";d.Diff="";d.DiffSec="";d.Status="?";this.ResultsToBeDownloaded.push([d.BaseBib,this.RaceNo,0]);this.CompetitorsToFollow.push(d)}this.RefreshExternalData()}; OLShowClubResults.prototype.RefreshExternalData=function(){if(0";g.appendChild(h);e.appendChild(g);e.appendChild(document.createElement("tbody"));e.appendChild(document.createElement("tfoot"));$("#PopupTable_1_div").append(e);this.PopupTable_1_DT=$(e).DataTable(d);null!==b&&this.PopupTable_1_DT.order(b).draw();$("#PopupTable_1 tbody").unbind("click");$("#PopupTable_1 tbody").on("click","a",function(a){a.preventDefault();$.event.trigger({type:"LinkClicked",url:this.href,title:"default", time:new Date})});console.log(this.ClassesToFollow)};var OLShowCompetitorIndividual=function(a,d,b){this.Competitor=a;this.RaceNo=d;this.Event=b;this.RollingStart=b.Headers.RollingStart;this.Name="OLShowCompetitorIndividual";this.ClassesToFollow=[];console.log("OLShowCompetitorIndividual.OLShowCompetitorIndividual()");$("#CompetitorPopup").html("");$("#CompetitorPopup").dialog("open");d=a.NameFirst+" "+a.NameLast;null!=a.Club&&null!=a.Club.ClubNameLong&&(d+=" "+a.Club.ClubNameLong);$("#CompetitorPopup").dialog("option","title",d);this.UpdateData()}; OLShowCompetitorIndividual.prototype.GetTitlePrefix=function(){var a=this.Competitor.NameFirst+" "+this.Competitor.NameLast;null!=this.Competitor.Club&&null!=this.Competitor.Club.ClubNameLong&&(a+=" "+this.Competitor.Club.ClubNameLong);return a};OLShowCompetitorIndividual.prototype.UpdateData=function(){this.ClassesToFollow=[];this.Event.DownloadCompetitorData(this)}; OLShowCompetitorIndividual.prototype.onCompetitorDataDownloaded=function(a){var d="",b="";$("#CompetitorPopup").html(b);console.log("onCompetitorDataDownloaded");console.log(a);var e=this.RaceNo;if(!e||""==e||0==e)for(var f in a.Races){e=a.Races[f].RaceNo;break}b=a.Races[e].Bib+" ";b+=this.Competitor.NameFirst+" "+this.Competitor.NameLast;null!=this.Competitor.Club&&null!=this.Competitor.Club.ClubNameLong&&(b+=" "+this.Competitor.Club.ClubNameLong);$("#CompetitorPopup").dialog("option","title",b); b="
      "+("
    • "+this.Competitor.GetFavouriteButton(!0)+"
    • ");""!=this.Event.Headers.CertificateTemplate&&""!=a.Races[e].Results[0].TimeRace&&(b+="
    • "+this.Competitor.getCertificateLink(e)+"
    • ");if(this.Event.Headers.ShareTwitter)var e=this.Event.Headers.TwitterShareTags.substring(1),g=window.location.href,d="twitter_share_"+this.Competitor.BaseBib,b=b+("");this.Event.Headers.ShareFacebook&&(b+="
    • "+this.Competitor.getCertificateLink(e)+"
    • ");if(this.Event.Headers.ShareTwitter)var e=this.Event.Headers.TwitterShareTags.substring(1),f=window.location.href,d= "twitter_share_"+this.Competitor.BaseBib,b=b+('
    • ");this.Event.Headers.ShareFacebook&&(b+='
      ',function(a,b,d){var e=a.getElementsByTagName(b)[0];a.getElementById(d)||(a=a.createElement(b),a.id=d,a.src="//connect.facebook.net/fi_FI/sdk.js#xfbml=1&version=v2.5",e.parentNode.insertBefore(a,e))}(document, "script","facebook-jssdk"),b=b+'
    • ";b+="
    ";b+="

    "+a.ClassNameLong+"

    ";this.ClassesToFollow[a.ClassID]=a.ClassID;var b=b+"",e=null,g;for(g in a.Races)if(!(0";this.NarrowVersion?b+="":(b+="",b+="",b+="",b+="",b+="",this.Event.Headers.Online&&(b+=""),b+="",b+="");this.NarrowVersion&&(this.Event.Headers.ControlSplits&&null!=e.Splits&&0"+Texts.Rastivaliajat+""):b+="");b+="";if(""!=e.Results[k].TimeTotal||""!=e.Results[k].DiffTotal||""!=e.Results[k].ClockTime){h+="";this.NarrowVersion||(h+="");h+="";h+="";h+="";h+="";this.Event.Headers.Online&& (h+="");if(!this.NarrowVersion){if(0"+q+""}else h+="";h+=""}h+=""}this.NarrowVersion&& ""!=e.Results[k].TimeRace&&1",h+="",0"+q+""):h+="",h+="",h+="",h+="",h+="");!this.NarrowVersion&&isNaN(this.RaceNo)&&this.Event.Headers.ControlSplits&&null!=e.Splits&&0",h+="",f=[],f.push("Competitor"),f.push(this.Competitor.BaseBib),f.push(e.RaceNo),f=ManipulateGet(f,window.location.search),h+="",h=this.Event.Headers.Online?h+"":h+"")}else b+="",this.NarrowVersion? b+="":(b+="",b+=""),b+="",b+="",b+="",this.Event.Headers.Online&&(b+=""),this.NarrowVersion||(0"+q+""):b+="", b+=""),b+=""}b+=h}b+="";if(0"+Texts.Rastivaliajat+""),b=b+"",b=b+"",b=b+(""),b=b+(""),b=b+(""),b=e.SplitDistances?b+(""):b+(""),b=b+(""),b=b+"",u;for(u in e.Splits)b+="",b+="",b+="",b+="",b+="",b+="",b+="",b+="",b+="",null!=e.Splits[u].SplitDistance?(b+="",b+=""):e.SplitDistances&&(b+="",b+=""),b+="",b+="";b+=""}b+="
    ";b+="
    ";b+="
    ";b+="
    ";b+="";$("#CompetitorPopup").html($("#CompetitorPopup").html()+b);""!=d&&twttr.widgets.load(document.getElementById(d));$("#RelayCompetitorTable").unbind("click");$("#RelayCompetitorTable").on("click","a",function(a){a.preventDefault();$.event.trigger({type:"LinkClicked",url:this.href,title:"default", time:new Date})});this.Event.AreWeFollowingBaseBib(this.Competitor.BaseBib)?console.log("Already following BaseBib "+this.Competitor.BaseBib):$.event.trigger({type:"SocketIOStartFollowing",message:{BaseBib:this.Competitor.BaseBib},time:new Date})};OLShowCompetitorRelay.prototype.CheckIfIdListed=function(a){console.log("OLShowCompetitorRelay.CheckIfIdListed Id="+a);return this.Competitor.ID==a};var OLShowEventIndexIndividual=function(a,d){this.Name="OLShowEventIndexIndividual";this.RaceNo=this.ClassID=-1;this.ResultTable=[];this.Event=a;this.current_competitors=d;this.IsRoundCompetition=a.Headers.IsRoundCompetition;this.TableStyleClass=null;this.IsClassNameShort=700>window.innerWidth;var b=768>=window.innerWidth,e=0,f=!1,g;for(g in a.Classes)if(!a.Classes[g].Hidden){a.Classes[g].FirstRace!=a.Classes[g].LastRace&&(f=!0);for(var h=a.Classes[g].FirstRace;h<=a.Classes[g].LastRace;++h)a.Classes[g].getNumberOfIntermediaries(h)> e&&(e=a.Classes[g].getNumberOfIntermediaries(h)),"undefined"!=typeof a.Classes[g].Races[h]&&this.ResultTable.push({RaceNo:h,Class:a.Classes[g],ShowTmp:!1,ClassNameTmp:"x"})}this.TableStyleClass=b?"compact":"narrow-table";console.log("Multirace="+f);this.Columns=" ".split(" ");this.Columns2=[{data:"ShowTmp",visible:!1},{data:"ClassNameTmp",render:function(a,b,d){return"display"===b||"filter"===b?d.Class?d.ClassNameTmp:"?":d.Class.ID},visible:!b},{data:function(a,b,d,e){return a.Class?a.Class.FirstRace!= a.Class.LastRace?a.RaceNo:" ":"?"},visible:f&&!b},{data:function(a,b,d,e){return a.Class?a.Class.getStartListLink(a.RaceNo):"?"},visible:!b},{data:function(a,b,d,e){return a.Class?a.Class.getSmartFollowLink(a.RaceNo):"?"},visible:!b},{data:function(b,d,e,f){return b.Class?b.Class.getIntermediateResultsLinks(b.RaceNo," ",a.Headers.IsRoundCompetition,!0):"?"},visible:!b},{data:function(a,b,d,e){return a.Class?a.Class.getFinishResultsLink(a.RaceNo):"?"},visible:!b},{data:function(a,b,d,e){return a.Class&& a.Class.Races?a.RaceNo!=a.Class.FirstRace&&"Continuation"==a.Class.Races[a.RaceNo].MultiRaceType?a.Class.getTotalResultsLink(a.RaceNo):a.RaceNo!=a.Class.FirstRace&&"Pursuit"==a.Class.Races[a.RaceNo].MultiRaceType?a.Class.getRaceResultsLink(a.RaceNo):"":"?"},visible:!b},{data:function(b,d,e,f){return b.Class?a.Headers.ControlSplits?b.Class.getSplitsLink(b.RaceNo):"":"?"},visible:!b},{data:function(b,d,e,f){if(0==b.RaceNo)return d=b.Class.getStartListLink(b.RaceNo),d+=" - "+b.Class.getMassStartTimeStr(), d+="
    "+b.Class.getFinishResultsLink(b.RaceNo),this2.Event.Headers.Online&&(d+="
    "+b.Class.getLeaderBoardLink()),d;if(b.Class){d=""+b.Class.ClassNameLong.repeat(1);b.Class.FirstRace!=b.Class.LastRace&&(d+=" - "+a.GetRaceTitle(b.RaceNo));d+="
    ";d=b.Class.Races[b.RaceNo].BigRelay?d+b.Class.getStartListLink(b.RaceNo):d+b.Class.getSmartFollowLink(b.RaceNo);0"+Texts.valiajat+": "+b.Class.getIntermediateResultsLinks(b.RaceNo, " ")+"");d+="
    "+b.Class.getFinishResultsLink(b.RaceNo);b.RaceNo!=b.Class.FirstRace&&"Continuation"==b.Class.Races[b.RaceNo].MultiRaceType?d+="
    "+b.Class.getTotalResultsLink(b.RaceNo):b.RaceNo!=b.Class.FirstRace&&"Pursuit"==b.Class.Races[b.RaceNo].MultiRaceType&&(d+="
    "+b.Class.getRaceResultsLink(b.RaceNo));a.Headers.ControlSplits&&(d+="
    "+b.Class.getSplitsLink(b.RaceNo));for(var g in a.Extras)d+="
    "+b.Class.getExtraLink(b.RaceNo,a.Extras[g]);return d+ "
    "}return"?"},visible:b}];for(var k in a.Extras)this.Columns.push(""),this.Columns2.push({data:function(b,d,e,f){return b.Class&&b.Class.Races?b.Class.getExtraLink(b.RaceNo,a.Extras[k]):"?"},visible:!b});this.TableInit={data:this.ResultTable,columns:this.Columns2,ordering:!1,info:!1,paging:!1};this.UpdateData()}; OLShowEventIndexIndividual.prototype.UpdateData=function(){console.log("OLShowEventIndexIndividual.UpdateData()");var a="",d="",b;for(b in this.ResultTable)this.ResultTable[b].ShowTmp=this.ResultTable[b].Class.Races[this.ResultTable[b].RaceNo].TimingPoints[0].hasCompetitors(),this.ResultTable[b].ShowTmp&&(d=this.ResultTable[b].Class.ClassNameLong.repeat(1),this.ResultTable[b].ClassNameTmp=d==a?"":d.repeat(1),a=d.repeat(1));this.Event.Headers.ShowCombinationClassesFirst&&this.ResultTable.sort(OLSortClassesCombinationClassesFirst)}; OLShowEventIndexIndividual.prototype.GetOnlineHeaderLower=function(){var a;a=""};var OLShowEventIndexRelay=function(a,d){this.Name="OLShowEventIndexRelay";this.RaceNo=this.ClassID=-1;this.Event=a;this.current_competitors=d;this.Columns=[];this.Rows=[];this.TableStyleClass=null;this.NumberOfClasses=0;this.ClassNameShort=this.CountDownStartTime=this.CountDownTimer=null;var b=0,e=768>=window.innerWidth,f;for(f in a.Classes)if(!a.Classes[f].Hidden){for(var g=!1,h=!1,k=a.Classes[f].FirstRace;k<=a.Classes[f].LastRace;++k)"undefined"!=typeof a.Classes[f].Races[k]&&a.Classes[f].Races[k].TimingPoints[0].hasCompetitors()&& (0==h&&(this.Rows.push({RaceNo:0,Class:a.Classes[f]}),h=!0),this.Rows.push({RaceNo:k,Class:a.Classes[f]}),g=!0,a.Classes[f].getNumberOfIntermediaries(k)>b&&(b=a.Classes[f].getNumberOfIntermediaries(k)));g&&++this.NumberOfClasses}1==this.NumberOfClasses&&(this.CountDownStartTime=a.Classes[0].Races[1].MassStart,this.ClassNameShort=a.Classes[0].ClassNameShort);this.TableStyleClass=e?"compact":"narrow-table";a.Headers.Jukola&&(this.Columns=["",Texts.Leg,Texts.joukkueet,Texts.valiajat,Texts.vaihtotilanne, Texts.LegTimes],a.Headers.ControlSplits?this.Columns.push(Texts.rva):this.Columns.push(""),this.Columns.push(Texts.FollowRelay));var l=this;this.TableInit={data:this.Rows,columns:[{data:"row.Class.ClassNameLong",render:function(a,b,d){return"display"===b||"filter"===b?d.Class?d.RaceNo==d.Class.FirstRace?d.Class.ClassNameLong:" ":"?":d.Class.ID},visible:!1},{data:function(a,b,d,e){return a.Class?0==a.RaceNo?a.Class.ClassNameLong:a.RaceNo:"?"},sClass:"legnumbercell"},{data:function(a,b,d,e){return a.Class? 0==a.RaceNo?(b=a.Class.getStartListLink(a.RaceNo),b+=" - "+a.Class.getMassStartTimeStr()):a.Class.Races[a.RaceNo].BigRelay?a.Class.getStartListLink(a.RaceNo):a.Class.getSmartFollowLink(a.RaceNo):"?"},visible:!e},{data:function(a,b,d,e){return 0==a.RaceNo?" ":a.Class?a.Class.getIntermediateResultsLinks(a.RaceNo):"?"},visible:!e},{data:function(a,b,d,e){return a.Class?a.Class.getFinishResultsLink(a.RaceNo):"?"},visible:!e},{data:function(a,b,d,e){if(a.Class){if(0==a.RaceNo)return l.Event.Headers.Online? a.Class.getLeaderBoardLink():"";if(a.Class.Races)return 1"+Texts.valiajat+": "+b.Class.getIntermediateResultsLinks(b.RaceNo," ")+""),d+="
    "+b.Class.getFinishResultsLink(b.RaceNo),1"+b.Class.getRaceResultsLink(b.RaceNo)),a.Headers.ControlSplits&&(d+="
    "+b.Class.getSplitsLink(b.RaceNo)), d+""):"?"},visible:e}],createdRow:function(a,b,d){0==b.RaceNo?$(a).addClass("classTitle"):$(a).addClass("legTitle")},searching:!1,info:!1,paging:!1}};OLShowEventIndexRelay.prototype.UpdateData=function(){}; OLShowEventIndexRelay.prototype.GetOnlineHeaderLower=function(){var a;a="";if(1==this.NumberOfClasses&&this.Event.Headers.Online){a+="
    ";var d=this.CountDownStartTime.getHours();10>d&&(d="0"+d);var b=this.CountDownStartTime.getMinutes();10>b&&(b="0"+b);var e=this.CountDownStartTime.getSeconds();10>e&&(e="0"+e);var f=this.Event.GetNow(),g=f-this.CountDownStartTime, h=new OLTime(g,1,-4);a+=Texts.RelayStartTime+": "+d+":"+b+":"+e+"
    ";f"+Texts.TimeToStart+": "+h+"
    "):(h.Time=g,a+=""+Texts.TimeFromStart+": "+h+"
    ");d="/"+WwwRoot+"/"+Language+"/"+EventID+"/"+this.ClassNameShort.toLowerCase()+"/"+Texts.url_leaderboard+"/";a+=""+Texts.Leaderboard+"";a+="
    "}var k=this;this.CountDownTimer=setTimeout(function(){k.SetCountDown()}, 1E3);return a};OLShowEventIndexRelay.prototype.SetCountDown=function(){if(1==this.NumberOfClasses&&this.Event.Headers.Online){var a=this,d=this.Event.GetNow(),b=d-this.CountDownStartTime,e=new OLTime(b,1,-4);d'+('');h+='';h+='';a&&a.EventID&&(h+='');h=h+('
    ')+('');h+='';h+='
    ';h+='
    ';h+="";h+="