LiveHelper=function(){this.checkboxes=[];this.markets={};this.Init=function(){this._setNextUpdateTimeout();};this.checkUpdates=function(){this.markets=Markets.getOpenedLiveEventMarkers();var a=this,b=this.getMarketsParamString(this.markets);$.getJSON(this._getUpdatesURL()+"&markets="+b,null,function(c){a.applyUpdates(c);});};this.applyUpdates=function(a){var b=a.CONTENT;for(catid in b){this.saveCheckboxesState();if($$("container_"+catid)){$$("container_"+catid).innerHTML=b[catid];}this.restoreCheckboxesState();this.restoreMarketHeaders();filterTopLinks("container_LIVE");}LiveHelper.redrawDependedViews(a.LIST);this._setNextUpdateTimeout();};this.saveCheckboxesState=function(){var a=$("#container_LIVE").find(".live-selection");this.checkboxes=[];for(var b=0;b<a.length;b++){if(a[b].checked){this.checkboxes.push(a[b].id);}}};this.restoreCheckboxesState=function(){for(var a=0;a<this.checkboxes.length;a++){if($$(this.checkboxes[a])){$$(this.checkboxes[a]).checked=true;}}};this.restoreMarketHeaders=function(){for(var a in this.markets){Markets.showFoot(this.markets[a],a);}};this._setNextUpdateTimeout=function(){if(LiveHelper.TIMER_FUNC){window.setTimeout(LiveHelper.TIMER_FUNC,this._getUpdatesInterval());}};this._getUpdatesInterval=function(){return initData.update_interval;};this._getUpdatesURL=function(){return this._constructCleanURL()+(this._hasGETParams()?"&":"?")+LiveHelper.UPDATE_FLAG+"=true";};this._constructCleanURL=function(){var a=window.location;return a.protocol+"//"+a.host+a.pathname+a.search;};this._hasGETParams=function(){return window.location.search!="";};this.getMarketsParamString=function(b){var a="";for(nMarketId in b){a+=Markets.parseEventID(nMarketId)+",";}a=a.substr(0,a.length-1);return a;};};LiveHelper.redrawDependedViews=function(a){var b=$("#"+LiveHelper.COTAINER_ID).find(".block-red-head");redrawSelectionsButtons(b.length==0);if($$("toc_events_categories")){$("#toc_events_categories").html(a);redrawTOC(b.length==0);}else{$("#toc_events_live").html(a);}};LiveHelper.COTAINER_ID="container_LIVE";LiveHelper.TIMER_FUNC="getLiveHelper().checkUpdates();";LiveHelper.UPDATE_FLAG="update";LiveHelper._instance=null;getLiveHelper=function(){if(!LiveHelper._instance){LiveHelper._instance=new LiveHelper();}return LiveHelper._instance;};