if(typeof(SB)=="undefined"||SB==null){var SB=new Object();SB.atTheRaces=new Object();}if(typeof(SB.atTheRaces)=="undefined"||SB.atTheRaces==null){SB.atTheRaces=new Object();}SB.atTheRaces.ManageTimeOuts=new Object();var timeouts=new Object();SB.atTheRaces.ManageTimeOuts.Add=function(c,b,a){timeouts[c]=setTimeout(b,a);};SB.atTheRaces.ManageTimeOuts.RemoveAll=function(){for(key in timeouts){clearTimeout(timeouts[key]);}};SB.atTheRaces.Popup=new Object();SB.atTheRaces.Popup.ShowTAndC=function(){window.opener.location.href="/t/info/rules/rules.aspx#atTheRaces";window.opener.focus();};SB.atTheRaces.Popup.ShowFAQ=function(){window.open("/t/eventbrowsing/AtTheRacesFAQs.aspx","AtTheRacesStreamingFAQs","width=600,height=470,resizable,scrollbars");};SB.atTheRaces.Popup.ShowSystemTest=function(){window.open("http://sportingbet.test.atr.servecast.net/pe_storage/systemtest/main.asp?streams=W300&Waudio=2&Wvideo=3&br=13&check_events=ignore&audience=4","ATRSystemTest","width=600,height=470,resizable,scrollbars");};SB.atTheRaces.schedule=new Object();SB.atTheRaces.schedule.GetRacesFor=function(c){var b="/modules/eventbrowsing/AtTheRaces/ATRSchedule.ascx?raceCourse="+c.value;var a=new SB.atTheRaces.AhahDivReplacer(b,function(d){$("#ATRScheduleAndPricesContainer").html(d);attatchToPricesLinks();});a.replaceDiv();};SB.atTheRaces.schedule.GetPricesForRace=function(a,d){var c="/modules/eventbrowsing/AtTheRaces/ATRSchedulePrices.ascx?&eventClassId="+d+"&BookId="+a;var b=new SB.atTheRaces.AhahDivReplacer(c,function(e){$("#aTRPricesCtrl").html(e);attatchToPricesLinks();});b.replaceDiv();};SB.atTheRaces.schedule.UpdateStreaming=function(c){var b="/misc/webServices/eventbrowsing/DisplayPlayerForATREvent.ashx?bookId="+c;var a=new SB.atTheRaces.AhahDivReplacer(b,function(d){var e=d.toString().replace(/RACE_BOOK_ID/g,c);$("#tEventbrowsingATRStreamingPopupPlayerDiv").html(e);});a.replaceDiv();};SB.atTheRaces.schedule.UpdatePopupFor=function(a,b){SB.atTheRaces.schedule.GetPricesForRace(a,b);SB.atTheRaces.schedule.UpdateStreaming(a);};AddPriceButton=function(a){this.anchor=a;this.attachToAnchor();};AddPriceButton.prototype={attachToAnchor:function(){var a=this;$(this.anchor).click(function(b){var c=document.getElementById("racePricesUrl");if(typeof(c)!="undefined"&&c!=null){window.opener.location=c.innerHTML;window.blur();}});}};SB.atTheRaces.AhahDivReplacer=function(a,b){this.url=a;this.callBack=b;this.options=this.createOptions();};SB.atTheRaces.AhahDivReplacer.prototype={createOptions:function(){var a=this;var b={type:"GET",url:a.url,timeout:45000,success:function(d,c){a.callBack(d);},error:function(){}};return b;},replaceDiv:function(){jQuery.ajax(this.options);}};function attatchToPricesLinks(){try{$("tr.normalRow").each(function(){new AddPriceButton(this);});}catch(a){}}$(document).ready(function(){attatchToPricesLinks();});
