var tabRow; var mc = new Ext.util.MixedCollection(); var halfGames = new Ext.util.MixedCollection(); var changeColors =new Array('#cc3366', '#ff9900', '#ffff00'); var width = 0; var objItems = new Ext.util.MixedCollection(); var objTabs = new Ext.util.MixedCollection(); var objColumns = new Ext.util.MixedCollection(); var lastSmartMoneyPopup; var objAlerts = new Ext.util.MixedCollection(); var objMasterTab; var selectedRows = new Ext.util.MixedCollection(); var changeColumns = new Ext.util.MixedCollection(); var connected = true; var lastUpdate = new Date(); var runner2 = new Ext.util.TaskRunner(); function getWindowHeight() { var windowHeight = 0; if (typeof(window.innerHeight) == 'number') { windowHeight = window.innerHeight; } else { if (document.documentElement && document.documentElement.clientHeight) { windowHeight = document.documentElement.clientHeight; } else { if (document.body && document.body.clientHeight) { windowHeight = document.body.clientHeight; } } } return windowHeight; } function HighlightColumn(column, bookId) { cells = document.getElementsByTagName("TD"); for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) { var cell = cells[cellIndex]; if (cell) { var idx = cell.id; var previousColor = cell.getAttribute('previousColor'); if (idx == 'sb' + bookId) { if (cell.style.backgroundColor != '#ff6600' && cell.style.backgroundColor != 'rgb(255, 102, 0)') { cell.setAttribute('previousColor', cell.style.backgroundColor + ''); cell.style.backgroundColor = '#ff6600'; } else { cell.style.backgroundColor = previousColor; } } } } } soundManager.url = '/soundmanager2.swf'; soundManager.onload = function() { soundManager.createSound('steam','sounds/steam.mp3'); soundManager.createSound('smartmoney','sounds/smartmoney.mp3'); soundManager.createSound('urgent','sounds/urgent.mp3'); soundManager.createSound('final','sounds/final.mp3'); } function DHTMLSound(sound) { soundManager.play(sound); } function testHit(id, e) { if (window.event) e = window.event; var srcEl = e.srcElement? e.srcElement : e.target; id2 = srcEl.id; if (id2.indexOf("_") > -1 && id2.indexOf("t") == 0) { ids = id2.split('_'); openWin("SportsbookLineHistory.aspx?eventId=" + id.replace('e', '') + "&sportsbookId=" + ids[1] + "&half=" + ids[2], "LinesPopup" + id + id2, 800, 400); } } function highlightRow(id, color) { var elem = Ext.get(Ext.query(id)); if (elem.elements.length > 0 && elem.elements[0].innerHTML != data) { elem.elements[0].style.backgroundColor = changeColors[currentIndex]; } } function showEventChanged(id) { var o = document.getElementById(id); if (o != null) { o.style.display=''; } } function setLine(eventId, sportsbookId, lineKey, lineType, line, money1, money2, money3) { var key = "#" + eventId + " #" + lineKey; var value = line + "#" + money1 + "#" + money2 + "#" + money3; var value2 = objItems.get(key); if (value != value2) { objItems.removeKey(key); objItems.add(key, value); var elem = Ext.get(Ext.query("#" + eventId)); if (elem.elements.length > 0) { var parentNode = getDivSportNode(elem.elements[0] ); var visitorLine = (lineType == 3) ? line : line/-1; handleElementCheckOdds(visitorLine, key + "_1", parentNode, sportsbookId); handleElementCheckOdds(line, key+ "_2", parentNode, sportsbookId); handleElementCheckOdds(money1, key + "_m1", parentNode, sportsbookId); handleElementCheckOdds(money2, key + "_m2", parentNode, sportsbookId); handleElementCheckOdds(money3, key + "_m3", parentNode, sportsbookId); } } } function setpct(rowid, cellid, itemid, itemtext) { var key = "#" + rowid + " #" + cellid + " #" + itemid; var value = itemtext; var value2 = objItems.get(key); if (value != value2) { objItems.removeKey(key); objItems.add(key, value); handleElementCheck(itemtext,key , null); } } function setBets(rowid, cellid, itemtext) { var key = "#" + rowid + " span#bets"; var value = itemtext; var value2 = objItems.get(key); if (value != value2) { objItems.removeKey(key); objItems.add(key, value); handleElementCheck(itemtext, key, null); } } function handleElementCheckOdds(data, id, parentNode, sportsbookId ) { var elem = Ext.get(Ext.query(id)); var currentValue = ''; if (elem.elements.length > 0 && elem.elements[0].innerHTML != data) { mc.add(id, elem); currentValue = elem.elements[0].innerHTML; if (currentValue != data) { elem.elements[0].innerHTML = data; elem.applyStyles({ 'background-color': '#FF0000' }); var sportsbookId = "#" + parentNode.id + " #sbh" + sportsbookId; changeColumns.add(sportsbookId, sportsbookId); Ext.get(Ext.query(sportsbookId)).applyStyles({ 'background-image': 'url(/images/head_mid_changed.gif)' }); window.setTimeout("handleColorChange('" + id + "', 1)", 10000); if (parentNode) checkTabHighlight(parentNode); } } return currentValue; } function handleElementCheck(data, id, parentNode ) { var elem = Ext.get(Ext.query(id)); var currentValue = ''; if (elem.elements.length > 0 && elem.elements[0].innerHTML != data) { mc.add(id, elem); currentValue = elem.elements[0].innerHTML; if (currentValue != data) { elem.elements[0].innerHTML = data; elem.applyStyles({ 'background-color': '#FF0000' }); window.setTimeout("handleColorChange('" + id + "', 1)", 5000); if (parentNode) checkTabHighlight(parentNode); } } return currentValue; } function setRed(id) { var elem = Ext.get(Ext.query(id)); if (elem.elements.length > 0) elem.elements[0].style.color = '#FF0000'; } function setTeamRed(id) { setRed(id + " #tmh"); setRed(id + " #tmv"); } function handleColorChange(currentId, currentIndex) { var elem = mc.get(currentId); if (!elem) return; elem.elements[0].style.backgroundColor = changeColors[currentIndex]; if (changeColors.length > currentIndex + 1) window.setTimeout("handleColorChange('" + currentId + "', " + (currentIndex + 1) + ")", 15000); } function settimescore(gridTable, rowid, time1data, time2data, period1data, period2data) { handleElementCheck(time1data, "#" + rowid + " #time1", null); var currentValue = handleElementCheck(time2data, "#" + rowid + " #time2", null); handleElementCheck(period1data, "#" + rowid + " #period1", null); handleElementCheck(period2data, "#" + rowid + " #period2", null); if (period2data == 'FINAL') { setGameColor(rowid, '#BBDDFF'); } else if (period2data == 'HALF') { setGameColor(rowid, '#339999'); } else if (currentValue == '' && period2data != '') { setGameColor(rowid, '#FF9999'); } } function init() { } function clearColumnHeaderCurrent(obj) { if (obj.indexOf("divSport" + _currentSportId) == -1) return; Ext.get(Ext.query(obj)).applyStyles({ 'background-image': 'url(/images/head_mid.gif)' }); } function clearColumnHeader(obj) { Ext.get(Ext.query(obj)).applyStyles({ 'background-image': 'url(/images/head_mid.gif)' }); } function clearchanges(){ for (var i = 1; i<20; i++) { clearTabHighlight('' + i); } mc.each(clearChangeAll); changeColumns.each(clearColumnHeader); } function clearTab() { clearTabHighlight('' + _currentSportId); mc.each(clearChange, true); changeColumns.each(clearColumnHeaderCurrent); } function clearChangeAll(obj) { var parentNode = obj.elements[0].parentNode; while (true) { if (parentNode.id.indexOf("divSport") > -1){ break; } else{ parentNode = parentNode.parentNode; } } obj.applyStyles({ 'background-color': '' }); mc.remove(obj); } function clearChange(obj, onlyActive) { var parentNode = obj.elements[0].parentNode; while (true) { if (parentNode.id.indexOf("divSport") > -1){ break; } else{ parentNode = parentNode.parentNode; } } if (!onlyActive || parentNode.style.display != 'none') { clearTabHighlight(parentNode.id.replace('divSport', '')); obj.applyStyles({ 'background-color': '' }); mc.remove(obj); } } function setImage(elem) { elem.style.backgroundImage = 'url(/images/head_mid_changed.gif)'; } function getDivSportNode(objNode) { var parentNode = objNode; while (true) { if (parentNode.id.indexOf("divSport") > -1){ break; } else{ parentNode = parentNode.parentNode; } } return parentNode; } function clearTabHighlight(sportId) { var key = 'ft' + sportId; var o = objTabs.get(key); if (o) { o = document.getElementById(key); o.style.color='#999999'; o.style.fontWeight = ''; objTabs.removeKey(key); } } function checkTabHighlight(gridTable) { if (!gridTable) return; var key = gridTable.id.replace('divSport', 'ft'); var o = objTabs.get(key); if (!o) { o = document.getElementById(key); o.style.color='red'; o.style.fontWeight = 'bold'; objTabs.add(key, o); } } function smalert(sportid, sb, vdate, vnss, detail) { var x; var y; var key = "last_sm_alert|" + sb + "|" + vdate + "|" + vnss + "|"; var o = objAlerts.get(key); if (o != null) return; objAlerts.add(key, ""); x = (screen.width / 2 - 370); y = (screen.height / 2 - 150); DHTMLSound("smartmoney"); openWin("/smpopup2.aspx?sport_id=" + sportid + "&v_date=" + vdate + "&v_nss=" + vnss + "&sb=" + sb + "&detail=" + detail, "smPopup", 740, 300); } function steamalert(sportid, vnss, playid) { var x; var y; var key = "last_steam_alert|" + playid; var o = objAlerts.get(key); if (o != null) return; objAlerts.add(key, ""); x = (screen.width / 2 - 370); y = (screen.height / 2 - 150); DHTMLSound("steam"); openWin("/steampopup.aspx?play_id=" + playid + "&sport_id=" + sportid + "&v_nss=" + vnss , "stmPopup" + vnss, 740, 300); } function popupFinal(game) { var o = objAlerts.get('final' + game); if (o != null) return; objAlerts.add('final' + game, ""); DHTMLSound("final"); } function popupBestBets() { var x; var y; lasttime = document.body.getAttribute("bestbets_popup"); if (lasttime != null) { return; } document.body.setAttribute("bestbets_popup", new Date().toString()); x = (screen.width / 2 - 370); y = (screen.height / 2 - 200); DHTMLSound("urgent"); openWin("/bestbetpopup.aspx" , "bestbet", 740, 400); } function popupSquarePlay() { var x; var y; lasttime = document.body.getAttribute("squareplay_popup"); if (lasttime != null) { return; } document.body.setAttribute("squareplay_popup", new Date().toString()); x = (screen.width / 2 - 370); y = (screen.height / 2 - 200); DHTMLSound("urgent"); openWin("/squareplaypopup.aspx" , "Square Play Popup", 540, 300); } function clearLines(src) { if (src) { var id = src.id; if (id && id.indexOf("}") > 0 ) src.innerHTML = " "; if (src.childNodes) { for(var index=0;index < src.childNodes.length;index++) { var childNode = src.childNodes[index]; clearLines(childNode); } } } } function smteam(gridTable, rowid, on) { if (gridTable == null) return null; row = getRwow(gridTable, rowid); if (row) { cell = getCell(row, "teambox"); if (!cell) return; if (on == 0) { cell2 = getCell(row, "timebox"); if (!cell) return; cell.style.backgroundColor = cell2.style.backgroundColor; } else { cell.style.backgroundColor = "#66FF66"; } } } function setBackground(tableRow, color) { tableRow.style.backgroundColor = color; //for (var i = 0; i < tableRow.cells.length; i++) { // setColor(tableRow.cells(i), color); //} } function setColor(object, color) { var previousColor = object.getAttribute('previousColor'); if (previousColor) object.setAttribute('previousColor', color); else object.style.backgroundColor = color; } function openWin(url, window, height, width) { var oWnd = radopen(url, window); oWnd.setSize(height,width); } function openWin2(url, window, height, width) { var oWnd = radopen(url, window); oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move); oWnd.setSize(height,width); } function openInfo(eventId, obj) { var oWnd = radopen("eventinfo.aspx?Update=1&EventId=" + eventId, "INFO1"); oWnd.set_title('Info'); oWnd.setSize(450,170); oWnd.set_offsetElementID('dl' + eventId); oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move); oWnd.show(); } function popupInjuries(sportId) { var x; var y; x = (screen.width / 2 - 300); y = (screen.height / 2 - 200); DHTMLSound("urgent"); openWin("injurypopup.asp?sport_id=" + sportId, "injuryPopup" + sportId, 1200, 400); } function popupLineWatcher() { var x; var y; x = (screen.width / 2 - 300); y = (screen.height / 2 - 200); openWin("/LineWatcherPopup.aspx?s=-1", "lineWatcherPopup", 550, 400); } function popupArbPlay(t) { openWin("/SurebetsPopup.aspx?s=-1&t=" + t, "surebetsPopup", 800, 500); } function popupMopPlay(t) { openWin("/MopPopup.aspx?s=-1&t=" + t, "mopPopup", 550, 400); } function popupWeather(t) { DHTMLSound("urgent"); openWin("/WeatherPopup.aspx?s=-1&t=" + t, "weatherPopup",550,800); } function popup(t) { openWin("/popup.aspx?t=" + t, "popup", "Popup",300,400); } function setGameColor(eventId, color) { var gameRow = document.getElementById( eventId); if (gameRow) { gameRow.style.backgroundColor = color; } } function setitemred(table, eventId, itemId1, itemId2, value) { handleElementCheck(value, "#" + eventId + " #" + itemId1 + " #" + itemId2, null); } function highlightRow(obj) { var color = selectedRows.get(obj.id) if (color) { selectedRows.removeKey(obj.id); obj.style.backgroundColor = color; } else { selectedRows.add(obj.id, obj.style.backgroundColor); obj.style.backgroundColor = '#FFFF33'; } } function ShowOdds(sender, sportId) { if (_currentSportId != "0") { // Hide the current grid. div = document.getElementById('divSport' + _currentSportId); if (div != null) { div.style.display = 'none'; } // Set the previous tab background if (!tabRow || !tabRow.cells[0] || !tabRow.parentNode) { tabRow = document.getElementById(initialClientId); SetCellImage(tabRow.rows[0].cells[0], 'images/tabs/tab_left_gray.gif'); tabRow.style.background = 'url(images/tabs/tab_bg_gray.gif)'; SetCellImage(tabRow.rows[0].cells[2], 'images/tabs/tab_right_gray.gif'); } else { SetCellImage(tabRow.cells[0], 'images/tabs/tab_left_gray.gif'); tabRow.parentNode.parentNode.style.background = 'url(images/tabs/tab_bg_gray.gif)'; SetCellImage(tabRow.cells[2], 'images/tabs/tab_right_gray.gif'); } } // Show the newly selected grid. div = document.getElementById('divSport' + sportId); tabRow = sender.parentNode.parentNode.parentNode; SetCellImage(tabRow.cells[0], 'images/tabs/tab_left.gif'); tabRow.parentNode.parentNode.style.background = 'url(images/tabs/tab_bg.gif)'; SetCellImage(tabRow.cells[2], 'images/tabs/tab_right.gif'); if (div != null) { div.style.display = ''; _currentSportId = sportId; _activeTab = sender; } } function SetHalfTime(id, minutes) { var halfGame = halfGames.get(id); if (!halfGame) { halfGames.add(id, minutes); // Start a simple clock task that updates a div once per minute var task = { run: function(){ var minutes = halfGames.get(id); minutes = (minutes - 1) ; halfGames.removeKey(id); halfGames.add(id, minutes); var elem1 = Ext.get(Ext.query("#" + id + " #period1")); var elem2 = Ext.get(Ext.query("#" + id + " #period2")); elem1.elements[0].innerHTML = 'Half '; if (minutes > 0) elem2.elements[0].innerHTML = (minutes/ -1) + ' min'; else elem2.elements[0].innerHTML = '+' + (minutes/ -1) + ' min'; }, interval: 60000 //15 seconds } runner2.start(task); } } function SetCellImage(cell, image) { var oImages = cell.getElementsByTagName("img"); if (!oImages) return; if (oImages.length > 0) { oImages[0].src = image; } }