var VALID_INPUT_FIELDS=["text","password","checkbox","radio","textarea","file","fileupload"],BLANK_WINDOW_ATTRIBUTES="height=0,width=0,outerHeight=0,outerWidth=0,screenX=10,screenY=25,left=10,top=25,scrollbars=no,directories=no,toolbars=no,menubar=no,dependent=no,hotkeys=no,status=yes",ARRAY_DELIMITER="|",IFRED_CONFIRM_MSG_1='Do you want to save your Fred Bet in bet slip before proceeding?\n\nClick "Cancel" and then select the "Add to Slip" button if you want to save the bet.\n\nClick "OK" if you do not want to save the Fred bet.',IFRED_CONFIRM_MSG_2='Do you want to save your BIG6 bet in bet slip before proceeding?\n\nClick "Cancel" and then select the "Add to Slip" button if you want to save the bet.\n\nClick "OK" if you do not want to save the BIG6 bet.',dropdownsDitry,_currentLang,clockIntervalId=0,clockTimeoutId=0,clock=null,LANGUAGE_CODE_SPANISH="3082";function SetFormFieldFocus(fieldName){var element;eval("element = document.forms[0]."+fieldName+";");element!=null&&element.focus()}function FocusFirstFormField(){if(document.forms.length==0)return;var logInButton=document.getElementById("DisplayTopMenu1_DisplayTopNav1_ButtonLogin");if(logInButton!=null){logInButton.focus();return}for(var formObj=document.forms[0],formElmt,i=0;i<formObj.elements.length;i++){formElmt=formObj.elements[i];if(formElmt.type!=null)if(isValidFocusInputField(formElmt.type))if(!formElmt.disabled){DoFocusFormField(formElmt);break}}}function DoFocusFormField(formElmt){try{DefaultButton_Init()}catch(e){}formElmt.focus()}function isValidFocusInputField(fieldType){for(var i=0;i<VALID_INPUT_FIELDS.length;i++)if(fieldType.toLowerCase()==VALID_INPUT_FIELDS[i])return true;return false}function ResetCookie(name){document.cookie=name+"="+escape(0)}function CloseUserPopups(windowNameArray){if(windowNameArray!=null){for(var i=0;i<windowNameArray.length;i++)try{myWindow=window.open("",windowNameArray[i],BLANK_WINDOW_ATTRIBUTES);myWindow.close()}catch(e){}ResetCookie("PopupCookie",0);ResetCookie("SportsCookie",0);self.focus()}}function AppendToPopupCookie(_windowName){var cookieArray=GetPopupCookieValues(),newCookieValue="";if(cookieArray==null)newCookieValue=_windowName;else{for(var windowNameExists=false,i=0;i<cookieArray.length;i++)if(cookieArray[i]==_windowName)windowNameExists=true;if(windowNameExists)newCookieValue=cookieArray.join(ARRAY_DELIMITER);else newCookieValue=cookieArray.join(ARRAY_DELIMITER)+ARRAY_DELIMITER+_windowName}SetPopupCookieValue(newCookieValue)}function DeleteFromPopupCookie(_windowName){var newCookieValue="",cookieArray=GetPopupCookieValues();if(cookieArray!=null){for(var i=0;i<cookieArray.length;i++)if(cookieArray[i]!=_windowName)if(i==0)newCookieValue+=cookieArray[i];else newCookieValue+=ARRAY_DELIMITER+cookieArray[i];SetPopupCookieValue(newCookieValue)}}function GetPopupCookieValues(){var cookieName="popups=",cookieArray=null,allCookies=document.cookie,pos=allCookies.indexOf(cookieName);if(pos!=-1){var startPos=pos+cookieName.length,endPos=allCookies.indexOf(";",startPos);if(endPos==-1)endPos=allCookies.length;var cookieValue=allCookies.substring(startPos,endPos);cookieValue=unescape(cookieValue);cookieArray=cookieValue.split(ARRAY_DELIMITER)}return cookieArray}function SetPopupCookieValue(newValue){var COOKIE_PATH="/",cookieName="popups=";document.cookie=cookieName+escape(newValue)+"; path="+COOKIE_PATH}function DeletePopupCookie(){var cookieName="popups=",expiryDate=new Date;expiryDate.setFullYear(expiryDate.getFullYear()-1);document.cookie=cookieName+"; expires="+expiryDate}function ConfirmLogout(url,msg){if(confirm(msg))this.window.location=url;else this.window.close()}function HomeConfirmLogout(objstr,msg){confirm(msg)&&__doPostBack(objstr,"");CloseUserPopups(GetPopupCookieValues())}function DetermineIntPoolingMsgDisplayStatus(){var div=document.getElementById("IntPoolMsgDiv"),display=document.getElementById("IntPoolMsgDivStatus");if(display==null||div==null)return;if(display.value=="on")div.style.display="inline";else div.style.display="none"}function Big6MysteryBetCheckByCheckbox(Checkbox){var checkbox=document.getElementById(Checkbox);if(checkbox==null)return;dropdownsDitry=false;for(var elemHolder=null,i=1;i<=4;i++){elemHolder=null;elemHolder=document.getElementById("DisplayBig6FredGrid1_SeliFred"+i);if(elemHolder!=null)if(elemHolder.value!=0)dropdownsDitry=true}if(dropdownsDitry){var answer=confirm(IFRED_CONFIRM_MSG_1);if(answer){CleariFredDropdowns();EnableBetAmount();SetUpBetAmount()}else CleanAllCheckboxes()}}function EnableBetAmount(){elemHolder=document.getElementById("DisplayWagerEntryBox1_TextBoxBetAmount");if(elemHolder!=null){elemHolder.disabled=false;elemHolder.style.color=""}}function DisableBetAmount(){elemHolder=document.getElementById("DisplayWagerEntryBox1_TextBoxBetAmount");if(elemHolder!=null){elemHolder.disabled=true;if(navigator.userAgent.toLowerCase().indexOf("firefox")!=-1)elemHolder.style.color="#9D9DA1"}}function isFred(){var iFred1DropDown=document.getElementById("DisplayBig6FredGrid1_SeliFred1"),iFred1DropDownValue=0;if(iFred1DropDown!=null)iFred1DropDownValue=iFred1DropDown[iFred1DropDown.selectedIndex].value;var iFred2DropDown=document.getElementById("DisplayBig6FredGrid1_SeliFred2"),iFred2DropDownValue=0;if(iFred2DropDown!=null)iFred2DropDownValue=iFred2DropDown[iFred2DropDown.selectedIndex].value;var iFred3DropDown=document.getElementById("DisplayBig6FredGrid1_SeliFred3"),iFred3DropDownValue=0;if(iFred3DropDown!=null)iFred3DropDownValue=iFred3DropDown[iFred3DropDown.selectedIndex].value;var iFred4DropDown=document.getElementById("DisplayBig6FredGrid1_SeliFred4"),iFred4DropDownValue=0;if(iFred4DropDown!=null)iFred4DropDownValue=iFred4DropDown[iFred4DropDown.selectedIndex].value;if(iFred1DropDownValue>0||iFred2DropDownValue>0||iFred3DropDownValue>0||iFred4DropDownValue>0)return true;else return false}function CleariFredDropdowns(){for(var i=1;i<=4;i++){elemHolder=null;elemHolder=document.getElementById("DisplayBig6FredGrid1_SeliFred"+i);if(elemHolder!=null)elemHolder.selectedIndex=0}var TextBox=document.getElementById("DisplayWagerEntryBox1_TextBoxBetAmount");if(TextBox!=null)TextBox.value="0.00"}function iFredDropDownChanged(Dropdown){!isFred()&&document.getElementById("Big6SessionDirty").value!="dirty"&&EnableBetAmount();isFred()&&document.getElementById("Big6SessionDirty").value!="dirty"&&DisableBetAmount();if(document.getElementById("Big6SessionDirty").value=="dirty"||iFredAreAnyCheckBoxesActive()){var answer=confirm(IFRED_CONFIRM_MSG_2);if(answer){CleanAllCheckboxes();SetUpBetAmountAlways();if(document.getElementById("Big6SessionDirty").value=="dirty"){document.getElementById("ifredreset").value="true";document.forms[0].submit()}}else{EnableBetAmount();document.getElementById(Dropdown).selectedIndex=0}}else{CleanAllCheckboxes();SetUpBetAmountAlways()}}function SetUpBetAmount(){var TextBox=document.getElementById("DisplayWagerEntryBox1_TextBoxBetAmount"),F1=document.getElementById("DisplayBig6FredGrid1_SeliFred1"),F2=document.getElementById("DisplayBig6FredGrid1_SeliFred2"),F3=document.getElementById("DisplayBig6FredGrid1_SeliFred3"),F4=document.getElementById("DisplayBig6FredGrid1_SeliFred4"),userCurrency=document.getElementById("UserCurrency_HiddenField"),iFredsCombinedInt=(5*F4.value+10*F1.value+20*F2.value+50*F3.value)*userCurrency.value.replace(",","."),iFredsCombined=txtFormatCurrency(iFredsCombinedInt,2);if(TextBox!=null&&iFredsCombinedInt>0){TextBox.value=iFredsCombined;if(iFredsCombinedInt>0)DisableBetAmount();else EnableBetAmount()}}function txtFormatCurrency(amount,numDigits){var multiplier=Math.pow(10,numDigits),result=""+Math.round(amount*multiplier),part1=result.substr(0,result.length-numDigits),part2=result.substr(result.length-numDigits,result.length);if(_currentLang==LANGUAGE_CODE_SPANISH)return part1+","+part2;else return part1+"."+part2}function SetUpBetAmountAlways(){var TextBox=document.getElementById("DisplayWagerEntryBox1_TextBoxBetAmount"),F1=document.getElementById("DisplayBig6FredGrid1_SeliFred1"),F2=document.getElementById("DisplayBig6FredGrid1_SeliFred2"),F3=document.getElementById("DisplayBig6FredGrid1_SeliFred3"),F4=document.getElementById("DisplayBig6FredGrid1_SeliFred4"),userCurrency=document.getElementById("UserCurrency_HiddenField"),iFredsCombinedInt=(5*F4.value+10*F1.value+20*F2.value+50*F3.value)*userCurrency.value.replace(",","."),iFredsCombined=txtFormatCurrency(iFredsCombinedInt,2);if(TextBox!=null){TextBox.value=iFredsCombined;if(iFredsCombinedInt>0)DisableBetAmount();else EnableBetAmount()}}function iFredAreAnyCheckBoxesActive(){var lastRow=parseInt(GetNumberOfRunners()),firstRow=1,EnabledColumns=GetNumberOfColumns(),selectionCheckboxes=new Array(EnabledColumns);for(col=0;col<EnabledColumns;col++){var selectionArray=new Array(lastRow-firstRow);for(row=firstRow;row<=lastRow;row++){var checkbox=document.getElementById("BetGrid_chk_s_"+col+"_"+row);if(checkbox!=null&&checkbox.checked==true)return true}}var checkbox_field=document.getElementById("BetGrid_chk_AllRunners_0");if(checkbox_field!=null&&checkbox_field.checked==true)return true;var dropdown_mys=document.getElementById("BetGrid_ddl_MysterySelection_0");if(dropdown_mys!=null&&dropdown_mys.selectedIndex>0)return true;return false}function CleanAllCheckboxes(){var lastRow=parseInt(GetNumberOfRunners()),firstRow=1,EnabledColumns=GetNumberOfColumns(),selectionCheckboxes=new Array(EnabledColumns);for(col=0;col<EnabledColumns;col++){var selectionArray=new Array(lastRow-firstRow);for(row=firstRow;row<=lastRow;row++){var checkbox=document.getElementById("BetGrid_chk_s_"+col+"_"+row);if(checkbox!=null)checkbox.checked=false}}var checkbox_field=document.getElementById("BetGrid_chk_AllRunners_0");if(checkbox_field!=null)checkbox_field.checked=false;var dropdown_mys=document.getElementById("BetGrid_ddl_MysterySelection_0");if(dropdown_mys!=null)dropdown_mys.selectedIndex=0}Date.prototype.addSeconds=function(seconds){this.setSeconds(this.getSeconds()+seconds,this.getMilliseconds());return this};function WorldTime(userTime,options){this.settings=options;this.currentTime=new Date(userTime);this.startTime=new Date(userTime);this.clockTimeoutId=0;this.clockIntervalId=0}WorldTime.prototype={intervalEnabled:false,offset:0,init:function(){var sec=(new Date).getSeconds();this.offset=60-sec;this.displayTime();this.setTimeout();this.offset=60;return this},formatTime:function(time){var currentHour=(new Date(time)).getHours(),currentMinute=(new Date(time)).getMinutes();switch(this.settings.clockFormat){case "r":case "e":return (currentHour>12?currentHour-12:currentHour==0?currentHour+12:currentHour)+":"+(currentMinute<10?"0":"")+currentMinute+" "+(currentHour<12?"AM":"PM")+this.settings.timeZone;break;case "s":return (currentHour<10?"0":"")+currentHour+":"+(currentMinute<10?"0":"")+currentMinute+" "+this.settings.timeZone}},formatDate:function(){switch(this.settings.clockFormat){case "r":case "s":return " - "+(this.startTime.getDate()!=this.currentTime.getDate()?this.settings.tomorrowFormatted:this.settings.todayFormatted);break;case "e":return ""}},setTimeout:function(){var myClock=this;clockTimeoutId=window.setTimeout(function(){myClock.displayTime();myClock.setInterval()},myClock.offset*1e3)},setInterval:function(){var myClock=this;clockIntervalId=window.setInterval(function(){myClock.displayTime()},6e4);clockIntervals.push(clockIntervalId)},displayTime:function(){this.currentTime.addSeconds(this.offset);var formattedTime=this.formatTime(this.currentTime)+this.formatDate();document.getElementById(this.settings.elementId).innerHTML=formattedTime},destroy:function(){while(clockIntervals.length>0)window.clearInterval(clockIntervals.pop());clockTimeoutId>0&&window.clearTimeout(clockTimeoutId)}};var clockIntervals=[];function HaloService(){this.ServiceUrl="/HaloService.svc"}HaloService.prototype={isAuthenticated:function(errorHandler){if(errorHandler==null)errorHandler=this.serviceError;var response=this._ajaxJsonGet("IsAuthenticated",null);if(response.status==200){var result=window["eval"]("("+response.responseText+")");return result.IsAuthenticatedResult}else errorHandler(response)},serviceError:function(){alert("An error connecting to the TAB service.")},_ajaxJsonGet:function(method,data){var url=this.ServiceUrl+"/"+method;return $.ajax({url:url,data:data,type:"GET",async:false,processData:true,contentType:"application/json",timeout:1e4,dataType:"json"})},_ajaxJsonGetAsync:function(method,data,callback,errorHandler){var url=this.ServiceUrl+"/"+method;$.ajax({url:url,data:data,type:"GET",processData:true,contentType:"application/json",timeout:1e4,dataType:"json",success:callback,error:errorHandler})},_ajaxJsonPost:function(method,data){var url=this.ServiceUrl+"/"+method;return $.ajax({url:url,data:data,type:"POST",processData:true,contentType:"application/json",timeout:1e4,dataType:"json"})},_ajaxJsonPostAsync:function(method,data,callback,errorHandler){var url=this.ServiceUrl+"/"+method;$.ajax({url:url,data:data,type:"POST",processData:true,contentType:"application/json",timeout:1e4,dataType:"json",success:callback,error:errorHandler})}};