// open and close side menu function clickMenu(menu) { child = $(menu); if (child) { if (child.className.indexOf('hidden') >= 0) { //Effect.BlindDown(child, {duration: 0.5}); var classNew = child.className.replace(new RegExp('hidden'), ''); child.className = classNew; if (menu == 'lmbt') { classNew = $('my-box2-head').className.replace(new RegExp('head'), ''); $('my-box2-head').className = classNew; $('my-box2-head').className += ' head-closed'; } } else { //Effect.BlindUp(child, {duration: 0.5}); child.className += ' hidden'; if (menu == 'lmbt') { var classNew = $('my-box2-head').className.replace(new RegExp('head-closed'), ''); $('my-box2-head').className = classNew; $('my-box2-head').className += ' head'; } } } saveMenuState(menu); return false; } // save menu state function saveMenuState(menu) { // date for ajax request var date = new Date(); var http_request = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Msxml2.XMLHTTP") : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false))); if (http_request) { http_request.open('GET', '/ajax-set-cookie/MyMenu/' + menu + '/?' + date.getTime(), true); http_request.send(null); } } function coupon(state) { switch(state) { case 'hide': if(!$('coupon-content').hasClassName('hidden')) { $('head-coupon-bottom').removeClassName('head-bottom-open'); $('coupon-content').addClassName('hidden'); } break; case 'open': if($('coupon-content').hasClassName('hidden')) { $('head-coupon-bottom').addClassName('head-bottom-open'); $('coupon-content').removeClassName('hidden'); } break; } //var myAjax = new Ajax.Request('/ajax-set-cookie/MyCoupon/change-state/', {method: 'get'}); } /* function addMatch(event, type, outcome, page) { // date for ajax request var date = new Date(); var myAjax = new Ajax.Request('/ajax-set-cookie/MyCoupon/' + event + '/' + type + '/' + outcome + '/' + page + '/?' + date.getTime(), {method: 'get', onComplete: couponResponse}); markOutcome(outcome, true); if ($('outcome' + outcome)) { var tdCount = $('outcome' + outcome).childNodes.length; for (var i = 0; i < tdCount; i++) { if ($('outcome' + outcome).childNodes[i].tagName && $('outcome' + outcome).childNodes[i].tagName.toLowerCase() == 'a') { $('tooltiptext').innerHTML = getOddsTextToTooltip($('outcome' + outcome).childNodes[i]); } } } return false; } */ function addMatch(event, type, outcome, page) { // date for ajax request var date = new Date(); if (page != 'my-coupon') { var myAjax = new Ajax.Request('/ajax-set-cookie/MyCoupon/' + event + '/' + type + '/' + outcome + '/' + page + '/?' + date.getTime(), {method: 'get', onComplete: couponResponse}); } else { var myAjax = new Ajax.Request('/ajax-my-coupon/' + event + '/' + type + '/' + outcome + '/' + page + '/?' + date.getTime(), {method: 'get', onComplete: function(response){myCouponResponse(response, outcome)}}); } markOutcome(outcome, true); if ($('outcome' + outcome)) { var tdCount = $('outcome' + outcome).childNodes.length; for (var i = 0; i < tdCount; i++) { if ($('outcome' + outcome).childNodes[i].tagName && $('outcome' + outcome).childNodes[i].tagName.toLowerCase() == 'a') { $('tooltiptext').innerHTML = getOddsTextToTooltip($('outcome' + outcome).childNodes[i]); } } } return false; } function myCouponResponse(response, outcome) { $('my-coupon-table-data').innerHTML = response.responseText; sortables_init(); } function couponResponse(response) { var tmpText = response.responseText.split('~'); if (tmpText[0] > 0) { unmarkOutcome(tmpText[0]); } if (tmpText[1]) { $('coupon-outcomes').innerHTML = '(' + tmpText[1] + ')'; if (tmpText[1] == '0') { if ($('coupon-arrow').hasClassName('return-box-2')) { $('coupon-arrow').removeClassName('return-box-2'); $('coupon-arrow').addClassName('return-box-1'); } } else { if ($('coupon-arrow').hasClassName('return-box-1')) { $('coupon-arrow').removeClassName('return-box-1'); $('coupon-arrow').addClassName('return-box-2'); } } } else { $('coupon-outcomes').innerHTML = '(0)'; } if (tmpText[2]) { $('coupon-content').innerHTML = tmpText[2]; //coupon('open'); } else { $('coupon-content').innerHTML = ''; //coupon('hide'); } } function removeMatch(event, type, outcome, page) { // date for ajax request var date = new Date(); var myAjax = new Ajax.Request('/ajax-set-cookie/MyCoupon/' + event + '/' + type + '/' + outcome + '/' + page + '/remove/?' + date.getTime(), {method: 'get', onComplete: couponResponse}); unmarkOutcome(outcome); if ($('outcome' + outcome)) { var tdCount = $('outcome' + outcome).childNodes.length; for (var i = 0; i < tdCount; i++) { if ($('outcome' + outcome).childNodes[i].tagName && $('outcome' + outcome).childNodes[i].tagName.toLowerCase() == 'a') { $('tooltiptext').innerHTML = getOddsTextToTooltip($('outcome' + outcome).childNodes[i]); } } } } function disableMatch(event, type, outcome, page) { // date for ajax request var date = new Date(); var myAjax = new Ajax.Request('/ajax-set-cookie/MyCoupon/' + event + '/' + type + '/' + outcome + '/' + page + '/change-state/?' + date.getTime(), {method: 'get', onComplete: couponResponse}); } function deleteCoupon(message1, message2, page) { if ($('coupon-arrow').hasClassName('return-box-1')) { var type = 1; } else { var type = 2; } switch (type) { case 1: alert(message1); break; case 2: if (confirm(message2)) { couponUnmarkAll(); // date for ajax request var date = new Date(); var myAjax = new Ajax.Request('/ajax-set-cookie/MyCoupon/delete/' + page + '/?' + date.getTime(), {method: 'get', onComplete: couponResponse}); //coupon('hide'); } break; } return false; } function couponUnmarkAll() { var div = $('coupon-content'); var divCount = div.childNodes.length; for (var i = 0; i < divCount; i++) { if (div.childNodes[i].tagName && div.childNodes[i].tagName.toLowerCase() == 'table') { var table = div.childNodes[i]; var inC = table.childNodes.length; for (var j = 0; j < inC; j++) { if (table.childNodes[j].tagName && table.childNodes[j].tagName.toLowerCase() == 'tbody') { var tbody = table.childNodes[j]; var tbCount = tbody.childNodes.length; for (var k = 0; k < tbCount; k++) { if (tbody.childNodes[k].tagName && tbody.childNodes[k].tagName.toLowerCase() == 'tr' && tbody.childNodes[k].id != '') { unmarkOutcome(tbody.childNodes[k].id.substr(3)); } } } } } } } function markOutcome(outcomeId, efect) { var prefixArr = new Array('outcome', 'n-outcome', 'houtcome'); var pCount = prefixArr.length; var change = false; for (var j = 0; j < pCount; j++) { if ($(prefixArr[j] + outcomeId)) { var tdParent = $(prefixArr[j] + outcomeId).parentNode; var pChild = tdParent.childNodes.length; for (var i = 0; i < pChild; i++) { if (tdParent.childNodes[i].tagName && tdParent.childNodes[i].tagName.toLowerCase() == 'td' && tdParent.childNodes[i].id !== '') { if ((prefixArr[j] + outcomeId) == tdParent.childNodes[i].id && $(prefixArr[j] + outcomeId).hasClassName('in-coupon')) { unmarkOutcome(outcomeId); return; } else { $(tdParent.childNodes[i].id).removeClassName('in-coupon'); var tdCell = $(tdParent.childNodes[i].id); var cellCount = tdCell.childNodes.length; for (var k = 0; k < cellCount; k++) { if (tdCell.childNodes[k].tagName && tdCell.childNodes[k].tagName.toLowerCase() == 'a') { tdCell.childNodes[k].setAttribute('id', 'tmpIE6'); var node = $('tmpIE6'); if (node.hasClassName('ico-remove')) { node.removeClassName('ico-remove'); node.addClassName('ico-add'); if (prefixArr[j] + outcomeId == tdParent.childNodes[i].id) { change = true; } } node.removeAttribute('id'); } } } } } var tdCell = $(prefixArr[j] + outcomeId); var cellCount = tdCell.childNodes.length; for (var k = 0; k < cellCount; k++) { if (tdCell.childNodes[k].tagName && tdCell.childNodes[k].tagName.toLowerCase() == 'a') { tdCell.childNodes[k].setAttribute('id', 'tmpIE6'); var node = $('tmpIE6'); if (node.hasClassName('ico-add')) { if (!change) { changeTooltipText(node, 'remove', false); } } else if (node.hasClassName('ico-remove')) { changeTooltipText(node, 'add', false); } else { $(prefixArr[j] + outcomeId).addClassName('in-coupon'); } node.removeAttribute('id'); } } if (efect) { //Effect.Pulsate(prefixArr[j] + outcomeId, {pulses: 3, duration: 1}); } } } } function getOddsTextToTooltip(node) { node.setAttribute('id', 'tmpIE6'); text = 'Add to My Coupon'; if ($($('tmpIE6').parentNode.id).hasClassName('in-coupon') || $('tmpIE6').hasClassName('ico-remove')) { text = 'Remove from My Coupon'; } node.removeAttribute('id'); return text; } function changeTooltipText(node, action, onlyText) { switch (action) { case 'add': if (!onlyText) { node.removeClassName('ico-remove'); node.addClassName('ico-add'); } break; case 'remove': if (!onlyText) { node.removeClassName('ico-add'); node.addClassName('ico-remove'); } break; } } function unmarkOutcome(outcomeId) { var prefixArr = new Array('outcome', 'n-outcome', 'houtcome'); var pCount = prefixArr.length; for (var j = 0; j < pCount; j++) { if ($(prefixArr[j] + outcomeId) && $(prefixArr[j] + outcomeId).hasClassName('in-coupon')) { //Effect.Pulsate(prefixArr[j] + outcomeId, {pulses: 3, duration: 1}); //setTimeout("$('" + prefixArr[j] + outcomeId + "').removeClassName('in-coupon')", 0); $(prefixArr[j] + outcomeId).removeClassName('in-coupon'); var tdCell = $(prefixArr[j] + outcomeId); var cellCount = tdCell.childNodes.length; for (var k = 0; k < cellCount; k++) { if (tdCell.childNodes[k].tagName && tdCell.childNodes[k].tagName.toLowerCase() == 'a') { tdCell.childNodes[k].setAttribute('id', 'tmpIE6'); var node = $('tmpIE6'); changeTooltipText(node, 'add', true); node.removeAttribute('id'); } } } else if ($(prefixArr[j] + outcomeId)) { var tdCell = $(prefixArr[j] + outcomeId); var cellCount = tdCell.childNodes.length; for (var k = 0; k < cellCount; k++) { if (tdCell.childNodes[k].tagName && tdCell.childNodes[k].tagName.toLowerCase() == 'a') { tdCell.childNodes[k].setAttribute('id', 'tmpIE6'); var node = $('tmpIE6'); changeTooltipText(node, 'add', true); if (node.hasClassName('ico-remove')) { node.removeClassName('ico-remove'); node.addClassName('ico-add'); } node.removeAttribute('id'); } } } } } function calculator(odds) { var oddsArr = odds.split('|'); var betVal = new Array(); var sum = 0; for (i = 0; i < oddsArr.length; i++) { sum += 1 / oddsArr[i]; } for (i = 0; i < oddsArr.length; i++) { betVal[i] = round((sum / oddsArr[i]) * 100) / 100; } alert(betVal); } function popupOpen(url, type) { switch(type) { default: window.open(url, '_blank', "width=810,height=500,scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no"); break; } } function showHideTimeZone() { if (document.getElementById('tz-menu').className == 'hidden fake-option-group') { document.getElementById('tz-menu').className = 'fake-option-group'; } else { document.getElementById('tz-menu').className = 'hidden fake-option-group'; } } function changeTimeZone(id) { window.location.href = '/time_zone/' + id + '/?return=' + encodeURIComponent(document.URL); } function showHideOddsFormat() { if (document.getElementById('of-menu').className == 'hidden fake-option-group') { document.getElementById('of-menu').className = 'fake-option-group'; } else { document.getElementById('of-menu').className = 'hidden fake-option-group'; } } function changeOddsFormat(format) { // date for ajax request var date = new Date(); var http_request = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Msxml2.XMLHTTP") : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false))); if (http_request) { http_request.open('GET', '/ajax-set-cookie/OddsFormat/' + format + '/?' + date.getTime(), true); http_request.onreadystatechange = function() { if (http_request.readyState == 4 && http_request.status == 200) { window.location.reload(); } }; http_request.send(null); } } function changeRightMenuSureValueBetsType(e) { var li = e.parentNode; var text = li.innerHTML.stripTags(); var ul = li.parentNode; var cli = ul.childNodes.length; for (var i = 0; i < cli; i++) { if (ul.childNodes[i].tagName && ul.childNodes[i].tagName.toLowerCase() == 'li') { if (ul.childNodes[i].className.indexOf('r') == -1) { var tli = ul.childNodes[i]; if (tli.innerHTML.indexOf(''; var newId = tli.id.split('-'); var id = newId[0] + '-' + newId[1] + '-' + newId[2] + '-' + newId[3]; if ($(id) && !$(id).hasClassName('hidden')) { $(id).addClassName('hidden'); } } } } } var newId = li.id.split('-'); var id = newId[0] + '-' + newId[1] + '-' + newId[2] + '-' + newId[3]; if ($(id) && $(id).hasClassName('hidden')) { $(id).removeClassName('hidden'); } li.innerHTML = '' + text + ''; } function setBookmarksTournament(idTournament, addText, removeText) { var date = new Date(); var http_request = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Msxml2.XMLHTTP") : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false))); if (http_request) { http_request.open('GET', '/ajax-bookmarks-tournament/' + idTournament + '/' + encodeURIComponent(addText) + '/' + encodeURIComponent(removeText) + '/?' + date.getTime(), true); http_request.onreadystatechange = function() { if (http_request.readyState == 4 && http_request.status == 200) { setBookmarksTournamentMenu(http_request, addText, removeText, idTournament); } }; http_request.send(null); } return false; } function setBookmarksTournamentMenu(response, addText, removeText, idTournament) { var menu = response.responseText; var menuArr = menu.split('~'); if (menuArr[0] == 'add') { menu = menuArr[1]; if ($('addRemoveBookmark')) { $('addRemoveBookmark').innerHTML = removeText; } } else if ($('addRemoveBookmark')) { $('addRemoveBookmark').innerHTML = addText; } // Change the menu $('bookmarks-menu').innerHTML = menu; if ($('mbc_' + idTournament)) { $('mbc_' + idTournament).checked = false; } if ($('mbcp_' + idTournament)) { $('mbcp_' + idTournament).checked = false; } } function clear_search(f) { f.value = ''; f.style.color = '#000000'; } function showAllTournamentEvents() { var showAll = false; var child = ''; var child2 = ''; var child3 = ''; for (var i = 0; i < $('sct-table').childNodes.length; i++) { child = $('sct-table').childNodes[i]; if (child.tagName && child.tagName.toLowerCase() == 'table') { for (var j = 0; j < child.childNodes.length; j++) { child2 = child.childNodes[j]; if (child2.tagName && child2.tagName.toLowerCase() == 'tbody') { for (var k = 0; k < child2.childNodes.length; k++) { child3 = child2.childNodes[k]; if (child3.tagName && child3.tagName.toLowerCase() == 'tr' && child3.className.indexOf('inactive') != -1 && child3.className.indexOf('hidden') != -1) { //child3.removeClassName('hidden'); classNew = child3.className.replace(new RegExp('hidden'), ''); child3.className = classNew; showAll = true; } } } } } } if (showAll) { $('show-all-link').addClassName('hidden'); } return false; }