var xmlDoc; //all the acronyms in order var arrPositions = new Array('SB','BB','UTG','UTG+1','MP1','MP2','MP3','HJ','CO','OTB'); //array will be populated with acronyms in actual order var arrPositions2 = new Array('','','','','','','','',''); //images of the board cards, for preloading var boardcard1; var boardcard2; var boardcard3; var boardcard4; var boardcard5; //how many chip stacks should we show in the chip image var chipcount=1; //for preloading the chip stack images var chips1 = new Image(); var chips2 = new Image(); var chips3 = new Image(); var chips4 = new Image(); //how many chips are in front, in the pot, of each player var player0count=0; var player1count=0; var player2count=0; var player3count=0; var player4count=0; var player5count=0; var player6count=0; var player7count=0; var player8count=0; var player9count=0; var street = 0; //what is the current bet (total) var lastbet = '0'; var lastaction = ''; var difference = 0; var lastplayerinpot = 0; var gametype; var arrAllTimers = new Array(); var secondsrunning = 0; var intervalID; var started = false; var playing = false; var pauseimage = new Image(); var aryBoard = new Array; var numposition; var showingcards = false; var bigblind = 0; var smallblind = 0; var pocket; var playersleft = 0; var ready = false; var text = ''; function init() { //the xml text var history = document.getElementById('history').value; xml = loadXML(history); gametype = getvalue(xmlDoc, 'gametype', 0); text += gametype + ' hand
\n'; document.getElementById("divPotValue").innerHTML = '0'; text = 'Hand History by Hold\'Em Hand History (iPhone App)
watch animated replay

\n'; smallblind = getvalue(xmlDoc,'smallblind', 0); smallblind = parseNum(removecommas(smallblind)); bigblind = getvalue(xmlDoc, 'bigblind', 0); bigblind = parseNum(removecommas(bigblind)); text += 'Blinds ' + format(addcommas(smallblind)) + ' / ' + format(addcommas(bigblind)); //Number of players at the table var players = getvalue(xmlDoc, 'players', 0); playersleft = parseNum(players); ante = getvalue(xmlDoc, 'ante', 0); if(ante == 'NaN') { ante = '0'; } ante = parseNum(removecommas(ante)); if(ante > 0) { text += ' / ' + format(addcommas(ante)); } text += '
\n'; chipcount = 1; //Hero's cards pocket = getvalue(xmlDoc, 'cards', 0); if(pocket != '') { //Hero card 1 var pocket1 = pocket.substring(0,2); //Hero card 2 var pocket2 = pocket.substring(2,4); //draw Hero's hole cards document.getElementById('imgPos0Pocket1').src = '/images/' + pocket1 + '.png'; document.getElementById('imgPos0Pocket2').src = '/images/' + pocket2 + '.png'; document.getElementById('divHeroBox').className = 'herobox'; } var herochips = getvalue(xmlDoc, 'chips', 0); document.getElementById('divPos0Total').innerHTML = format(addcommas(herochips)); var board = xmlDoc.getElementsByTagName('board'); var streets = board[0].getElementsByTagName('card').length; for(i=0;i (arrPositions.length-1)) { numposition = 0; } //show empty seats for less than 9 players if((i+1) <= players) { document.getElementById('divPos' + (i)).style.display = ''; } //draw the acronym on the label for each player document.getElementById('divPos' + i + 'Position').innerHTML = arrPositions[numposition]; document.getElementById('divPos' + i + 'Pot').innerHTML = ante * -1; if(arrPositions[numposition] != 'SB' && arrPositions[numposition] != 'BB') { var pot = document.getElementById("divPotValue").innerHTML; if(pot.length == 0) { pot = '0'; } pot = parseNum(removecommas(pot)); pot = pot + ante; document.getElementById('divPotValue').innerHTML = format(addcommas(pot)); } //if we're drawing the small blind if(arrPositions[numposition] == 'SB') { //put the price of the small blind in their pot total inpot = smallblind + ante; document.getElementById('divPos' + i + 'Pot').innerHTML = format(addcommas(inpot * -1)); //add small blind to table pot var pot = document.getElementById("divPotValue").innerHTML; if(pot.length == 0) { pot = '0'; } pot = parseNum(removecommas(pot)); pot = pot + inpot; document.getElementById('divPotValue').innerHTML = format(addcommas(pot)); //put a one chip image out document.getElementById("divPos" + i + "Chips").innerHTML = ''; //update chip total var totalchips = removecommas(document.getElementById('divPos' + i + 'Total').innerHTML); if(totalchips != '') { document.getElementById('divPos' + i + 'Total').innerHTML = eval("format(addcommas(totalchips - smallblind))"); } //show the chip count under the chips document.getElementById('divPos' + i + 'Count').innerHTML = format(addcommas(smallblind)); //set what this player has in front of him in the pot eval("player" + i + "count = smallblind;"); if(players == 2) { document.getElementById('divPos' + i + 'Button').innerHTML = ''; } } //if we're drawing the big blind if(arrPositions[numposition] == 'BB') { //put the price of the big blind in their pot total inpot = bigblind + ante; document.getElementById('divPos' + i + 'Pot').innerHTML = format(addcommas(inpot * -1)); //add big blind to the table pot var pot = document.getElementById("divPotValue").innerHTML; if(pot.length == 0) { pot = '0'; } pot = parseNum(removecommas(pot)); pot = pot + inpot; document.getElementById('divPotValue').innerHTML = format(addcommas(pot)); //put the two chip image in front of player document.getElementById('divPos' + i + 'Chips').innerHTML = ''; //update chip total var totalchips = removecommas(document.getElementById('divPos' + i + 'Total').innerHTML); if(totalchips != '') { document.getElementById('divPos' + i + 'Total').innerHTML = eval("format(addcommas(totalchips - bigblind))"); } //show the chip count under the chips document.getElementById('divPos' + i + 'Count').innerHTML = format(addcommas(bigblind)); //set what this player has in front of him in the pot eval("player" + i + "count = bigblind;"); //set the last bet lastbet = bigblind; } if(arrPositions[numposition] == 'OTB') { document.getElementById('divPos' + i + 'Button').innerHTML = ''; } //save seat positions to array arrPositions2[i] = arrPositions[numposition]; numposition++; } } text += players + ' players
\n'; //Set stack sizes var stacks = xmlDoc.getElementsByTagName('stack'); text += 'Stacks:
\n'; text += 'Hero: ' + format(addcommas(herochips)) + '
\n'; for(i=0;i < stacks.length;i++) { position = getvalue(stacks[i], 'position', 0); amount = getvalue(stacks[i], 'amount', 0); pos = find(arrPositions2,position); if(position == 'SB') { amount = parseNum(removecommas(amount)) - smallblind; } if(position == 'BB') { amount = parseNum(removecommas(amount)) - bigblind; } document.getElementById('divPos' + pos + 'Total').innerHTML = format(addcommas(amount)); text += position + ': ' + format(addcommas(amount)) + '
\n'; } text + '
\n'; text += 'Hero is ' + arrPositions[heroposition] + ' with

\n'; //straddles var preflop = xmlDoc.getElementsByTagName('preflop'); for(k=0;k < preflop.length;k++) { action = getvalue(preflop[k], 'action', 0); if(action == 'straddle') { position = getvalue(preflop[k], 'position', 0); amount = getvalue(preflop[k], 'amount', 0); allin = getvalue(preflop[k], 'allin', 0); position = find(arrPositions2,position); if(chipcount < 4) { chipcount = chipcount + 1; } document.getElementById('divPos' + position + 'Action').innerHTML = action; document.getElementById('divPos' + position + 'Action').style.fontSize = '10pt'; document.getElementById('divPos' + position + 'Action').style.color = 'rgb(255,0,0)'; var playerinpot = document.getElementById('divPos' + position + 'Pot').innerHTML; if(playerinpot.length == 0) { playerinpot = '0'; } playerinpot = parseNum(removecommas(playerinpot)); playerinpot = playerinpot - (parseNum(amount) + parseNum(lastbet)); document.getElementById('divPos' + position + 'Pot').innerHTML = format(addcommas(playerinpot)); var inpot = document.getElementById('divPotValue').innerHTML; if(inpot.length == 0) { inpot = '0'; } inpot = parseNum(removecommas(inpot)); inpot = inpot + parseNum(parseNum(amount) + parseNum(lastbet)); document.getElementById('divPotValue').innerHTML = format(addcommas(inpot)); document.getElementById('divPos' + position + 'Action').style.visibility = 'visible'; document.getElementById("divPos" + position + "Chips").innerHTML = ''; var totalchips = removecommas(document.getElementById('divPos' + position + 'Total').innerHTML); if(totalchips != '' && totalchips != '0') { document.getElementById('divPos' + position + 'Total').innerHTML = eval("format(addcommas(totalchips - (parseNum(amount) + parseNum(lastbet))))"); } if(allin == 'yes') { document.getElementById('divPos' + position + 'Total').innerHTML = 'ALL-IN'; } //has anyone raised the pot before it gets to the BB? if(lastbet != eval("parseNum(player" + position + "count)")) { lastbet = eval("parseNum(player" + position + "count) + (parseNum(amount) + parseNum(lastbet))"); } else { //BB is raising a limped pot lastbet = eval("parseNum(player" + position + "count) + parseNum(amount)"); } eval("player" + position + "count = parseNum(lastbet);"); document.getElementById('divPos' + position + 'Count').innerHTML = eval("format(addcommas(player" + position + "count))"); text += format(addcommas(amount)) + '
\n'; } } //load names var names = xmlDoc.getElementsByTagName('names'); for(i=0;i < names.length;i++) { name = getvalue(names[i], 'name', 0); position = getvalue(names[i], 'position', 0); pos = find(arrPositions2,position); document.getElementById('divPos' + pos + 'Position').innerHTML = name; } showdiscuss(); document.getElementById('divDiscuss').style.display = ''; ready = true; } function start(mode) { switch(mode) { case 1: interval = 750;break; case 2: interval = 1;break; } started = true; playing = true; document.getElementById('divHint').style.visibility = 'hidden'; //preflop action street = 0; var preflop = xmlDoc.getElementsByTagName('preflop'); //set the increment between the hand actions var seconds = 1; //set the number of chip stacks to show in images //start the timer to keep track of how long the script has run intervalID = setInterval('keeptime()', interval); text += 'PREFLOP
\n'; for(k=0;k < preflop.length;k++) { position = getvalue(preflop[k], 'position', 0); action = getvalue(preflop[k], 'action', 0); amount = getvalue(preflop[k], 'amount', 0); allin = getvalue(preflop[k], 'allin', 0); //numerical position pos = find(arrPositions2,position); var arrParams = new Array(); arrParams[0] = pos; arrParams[1] = action; arrParams[2] = amount; arrParams[3] = allin; arrParams[4] = street; delay('showaction', arrParams, seconds); //handle delays for different action types switch(action) { case 'check': seconds = seconds + 1; break; case 'bet': seconds = seconds + 3; break; case 'raise': seconds = seconds + 3; break; case 'call': seconds = seconds + 2; break; case 'fold': seconds = seconds + 1; break; } } //reset the actions and chips, etc delay('reset()',Array(),seconds); if(aryBoard.length >= 3) { //show flop cards var arrParams = new Array(); arrParams[0] = 1; delay('showstreet', arrParams, seconds + 2); } //flop action street = 1; var flop = xmlDoc.getElementsByTagName('flop'); seconds = seconds + 4; for(k=0;k < flop.length;k++) { position = getvalue(flop[k], 'position', 0); action = getvalue(flop[k], 'action', 0); amount = getvalue(flop[k], 'amount', 0); allin = getvalue(flop[k], 'allin', 0); //numerical position pos = find(arrPositions2,position); var arrParams = new Array(); arrParams[0] = pos; arrParams[1] = action; arrParams[2] = amount; arrParams[3] = allin; arrParams[4] = street; delay('showaction', arrParams, seconds); //handle delays for different action types switch(action) { case 'check': seconds = seconds + 1; break; case 'bet': seconds = seconds + 3; break; case 'raise': seconds = seconds + 3; break; case 'call': seconds = seconds + 2; break; case 'fold': seconds = seconds + 1; break; } } //reset the actions and chips, etc delay('reset()',Array(),seconds); if(aryBoard.length >= 4) { //show turn cards var arrParams = new Array(); arrParams[0] = 4; delay('showstreet', arrParams, seconds+2); } //turn action street = 4; var turn = xmlDoc.getElementsByTagName('turn'); seconds = seconds + 4; for(k=0;k < turn.length;k++) { position = getvalue(turn[k], 'position', 0); action = getvalue(turn[k], 'action', 0); amount = getvalue(turn[k], 'amount', 0); allin = getvalue(turn[k], 'allin', 0); //numerical position pos = find(arrPositions2,position); var arrParams = new Array(); arrParams[0] = pos; arrParams[1] = action; arrParams[2] = amount; arrParams[3] = allin; arrParams[4] = street; delay('showaction', arrParams, seconds); //handle delays for different action types switch(action) { case 'check': seconds = seconds + 1; break; case 'bet': seconds = seconds + 3; break; case 'raise': seconds = seconds + 3; break; case 'call': seconds = seconds + 2; break; case 'fold': seconds = seconds + 1; break; } } //reset the actions and chips, etc delay('reset()',Array(),seconds); if(aryBoard.length == 5) { //show river var arrParams = new Array(); arrParams[0] = 5; delay('showstreet', arrParams, seconds+2); } //river action street = 5; var river = xmlDoc.getElementsByTagName('river'); seconds = seconds + 4; for(k=0;k < river.length;k++) { position = getvalue(river[k], 'position', 0); action = getvalue(river[k], 'action', 0); amount = getvalue(river[k], 'amount', 0); allin = getvalue(river[k], 'allin', 0); //numerical position pos = find(arrPositions2,position); var arrParams = new Array(); arrParams[0] = pos; arrParams[1] = action; arrParams[2] = amount; arrParams[3] = allin; arrParams[4] = street; delay('showaction', arrParams, seconds); //handle delays for different action types switch(action) { case 'check': seconds = seconds + 1; break; case 'bet': seconds = seconds + 3; break; case 'raise': seconds = seconds + 3; break; case 'call': seconds = seconds + 2; break; case 'fold': seconds = seconds + 1; break; } } delay('reset()',Array(),seconds); //show the hole cards of players still in the hand delay('showdown', arrParams, seconds+1); if(mode == 1) { delay('showad', arrParams, seconds+8); } } function showaction(position, action, amount, allin, street) { amount = parseNum(removecommas(amount)); switch(action) { case 'check': //draw the action type document.getElementById('divPos' + position + 'Action').innerHTML = action; document.getElementById('divPos' + position + 'Action').style.color = 'white'; document.getElementById('divPos' + position + 'Action').style.visibility = 'visible'; lastaction = 'check'; text += arrPositions[position] + ' checks
\n'; break; case 'fold': //draw the action type document.getElementById('divPos' + position + 'Action').innerHTML = action; document.getElementById('divPos' + position + 'Action').style.color = 'rgb(153,153,153)'; document.getElementById('divPos' + position + 'Action').style.visibility = 'visible'; if(position == 0 && pocket != '') { document.getElementById('imgPos' + position + 'Pocket1').className = 'dim'; document.getElementById('imgPos' + position + 'Pocket2').className = 'dim'; } //did they muck face up? var showdown = xmlDoc.getElementsByTagName('showdown'); showdownfound = false; for(i=0;i < showdown.length;i++) { showdownposition = getvalue(showdown[i], 'position', 0); showdowncards = getvalue(showdown[i], 'cards', 0); pos = find(arrPositions2, showdownposition); if(pos == position) { showdownfound = true; var card1 = showdowncards.substring(0,2); var card2 = showdowncards.substring(2,4); document.getElementById('imgPos' + pos + 'Pocket1').src = '/images/' + card1 + '.png'; document.getElementById('imgPos' + pos + 'Pocket2').src = '/images/' + card2 + '.png'; } } if(showdownfound==false) { //hide the cards in 1 second var arrBlank = new Array(); delay(function(){eval("document.getElementById('divPos' + position + 'Cards').style.visibility = 'hidden';");},arrBlank,0); } playersleft = playersleft - 1; text += arrPositions[position] + ' folds
\n'; break; case 'bet': //show bet action and amount document.getElementById('divPos' + position + 'Action').innerHTML = action + '
' + format(addcommas(amount)) + ""; document.getElementById('divPos' + position + 'Action').style.color = 'rgb(51,255,51)'; //how much does this player have in front of him that is in the pot var playerinpot = document.getElementById('divPos' + position + 'Pot').innerHTML; if(playerinpot.length == 0) { playerinpot = 0; } else { if(playerinpot != 0) { playerinpot = parseNum(removecommas(playerinpot)); } } playerinpot = playerinpot - amount; document.getElementById('divPos' + position + 'Pot').innerHTML = format(addcommas(playerinpot)); var inpot = document.getElementById('divPotValue').innerHTML; if(inpot.length == 0) { inpot = 0; } else { inpot = parseNum(removecommas(inpot)); } inpot = inpot + amount; document.getElementById('divPotValue').innerHTML = format(addcommas(inpot)); document.getElementById('divPos' + position + 'Action').style.visibility = 'visible'; document.getElementById('divPos' + position + 'Chips').innerHTML = ''; difference = amount; lastbet = amount; eval("player" + position + "count = amount;"); document.getElementById('divPos' + position + 'Count').innerHTML = eval("format(addcommas(player" + position + "count))"); var totalchips = removecommas(document.getElementById('divPos' + position + 'Total').innerHTML); if(totalchips != '' && totalchips != '0') { totalchips = parseNum(totalchips); document.getElementById('divPos' + position + 'Total').innerHTML = eval("format(addcommas(totalchips - amount))"); } if(allin == 'yes') { document.getElementById('divPos' + position + 'Total').innerHTML = 'ALL-IN'; playersleft = playersleft - 1; } lastaction = 'bet'; lastplayerinpot = position; text += arrPositions[position] + ' bets ' + format(addcommas(amount)); if(allin == 'yes') { text += ' ALL-IN'; } text += '
\n'; break; case 'call': document.getElementById('divPos' + position + 'Action').innerHTML = action + '
' + format(addcommas(amount)) + ''; document.getElementById('divPos' + position + 'Action').style.color = 'rgb(255,255,51)'; var playerinfront = document.getElementById('divPos' + position + 'Count').innerHTML; if(playerinfront.length == 0) { playerinfront = 0; } else { playerinfront = parseNum(removecommas(playerinfront)); } playerinfront = playerinfront + amount; document.getElementById('divPos' + position + 'Count').innerHTML = format(addcommas(playerinfront)); var playerinpot = document.getElementById('divPos' + position + 'Pot').innerHTML; if(playerinpot.length == 0) { playerinpot = 0; } else { playerinpot = parseNum(removecommas(playerinpot)); } playerinpot = playerinpot - amount; var inpot = document.getElementById('divPotValue').innerHTML; if(inpot.length == 0) { inpot = 0; } else { inpot = parseNum(removecommas(inpot)); } inpot = inpot + amount; document.getElementById('divPotValue').innerHTML = format(addcommas(inpot)); document.getElementById('divPos' + position + 'Action').style.visibility = 'visible'; document.getElementById('divPos' + position + 'Chips').innerHTML = ''; document.getElementById('divPos' + position + 'Pot').innerHTML = format(addcommas(playerinpot)); var totalchips = removecommas(document.getElementById('divPos' + position + 'Total').innerHTML); if(totalchips != '' && totalchips != '0') { totalchips = parseNum(totalchips); document.getElementById('divPos' + position + 'Total').innerHTML = eval("format(addcommas(totalchips - amount))"); } if(allin == 'yes') { document.getElementById('divPos' + position + 'Total').innerHTML = 'ALL-IN'; playersleft = playersleft - 1; } lastaction = 'call'; text += arrPositions[position] + ' calls ' + format(addcommas(amount)); if(allin == 'yes') { text += ' ALL-IN'; } text += '
\n'; break; case 'raise': if(chipcount < 4) { chipcount = chipcount + 1; } document.getElementById('divPos' + position + 'Action').innerHTML = action + '
' + format(addcommas(amount)) + '
'; document.getElementById('divPos' + position + 'Action').style.color = 'rgb(255,0,0)'; var playerinfront = document.getElementById('divPos' + position + 'Count').innerHTML; prevplayerinfront = 0; if(playerinfront.length == 0) { playerinfront = 0; } else { playerinfront = parseNum(removecommas(playerinfront)); prevplayerinfront = playerinfront; } playerinfront = (lastbet + amount); document.getElementById('divPos' + position + 'Count').innerHTML = format(addcommas(playerinfront)); var playerinpot = document.getElementById('divPos' + position + 'Pot').innerHTML; var prevplayerinpot = 0; if(playerinpot.length == 0) { playerinpot = 0; } else { playerinpot = parseNum(removecommas(playerinpot)); if(playerinpot != 0) { prevplayerinpot = playerinpot; } } //only should add to previous value if after pre-flop if(prevplayerinfront != (prevplayerinpot * -1)) { playerinpot = playerinpot + ((lastbet + amount) * -1); } else { playerinpot = (lastbet + amount) * -1; } document.getElementById('divPos' + position + 'Pot').innerHTML = format(addcommas(playerinpot)); var inpot = document.getElementById('divPotValue').innerHTML; if(inpot.length == 0) { inpot = 0; } else { inpot = parseNum(removecommas(inpot)); } inpot = inpot + ((amount + lastbet) + (prevplayerinfront * -1)); document.getElementById('divPotValue').innerHTML = format(addcommas(inpot)); document.getElementById('divPos' + position + 'Action').style.visibility = 'visible'; document.getElementById('divPos' + position + 'Chips').innerHTML = ''; var totalchips = removecommas(document.getElementById('divPos' + position + 'Total').innerHTML); if(totalchips != '' && totalchips != '0') { totalchips = parseNum(removecommas(totalchips)); if(street == 0) { //player has less than a BB in the pot (is the SB) if(prevplayerinpot < bigblind && prevplayerinpot > 0) { totalchips = totalchips - ((amount + bigblind) - smallblind); } else { //player is the BB totalchips = totalchips - (amount + bigblind); } } else { totalchips - totalchips - amount; } document.getElementById('divPos' + position + 'Total').innerHTML = format(addcommas(totalchips)); } if(allin == 'yes') { document.getElementById('divPos' + position + 'Total').innerHTML = 'ALL-IN'; playersleft = playersleft - 1; } difference = eval('parseNum(player' + position + 'count) + (amount + parseNum(lastbet))') - lastbet; lastbet = parseNum(amount) + parseNum(lastbet); eval("player" + position + "count = parseNum(lastbet);"); lastaction = 'raise'; lastplayerinpot = position; text += arrPositions[position] + ' raises to ' + format(addcommas(lastbet)); if(allin == 'yes') { text += ' ALL-IN'; } text += '
\n'; break; } } function showstreet(which) { chipcount = 1; switch(which) { case '1': document.getElementById('imgBoard1').src = boardcard1.src; document.getElementById('imgBoard2').src = boardcard2.src; document.getElementById('imgBoard3').src = boardcard3.src; text += '
FLOP
\n'; text += '
\n'; break; case '4': document.getElementById('imgBoard4').src = boardcard4.src; text += '
TURN
\n'; text += '
\n'; break; case '5': document.getElementById('imgBoard5').src = boardcard5.src; text += '
RIVER
\n'; text += '
\n'; break; } } function showdown() { var showdown = xmlDoc.getElementsByTagName('showdown'); var winpos = -1; text += '
SHOWDOWN
\n'; for(i=0;i < showdown.length;i++) { position = getvalue(showdown[i], 'position', 0); cards = getvalue(showdown[i], 'cards', 0); winner = getvalue(showdown[i], 'winner', 0); pos = find(arrPositions2,position); if(cards != '') { var card1 = cards.substring(0,2); var card2 = cards.substring(2,4); document.getElementById('imgPos' + pos + 'Pocket1').src = '/images/' + card1 + '.png'; document.getElementById('imgPos' + pos + 'Pocket2').src = '/images/' + card2 + '.png'; document.getElementById('divPos' + pos + 'Cards').style.visibility = 'visible'; text += arrPositions[pos] + ' shows
\n'; } if(winner == 'yes') { document.getElementById('divPos' + pos + 'Action').innerHTML = 'WINNER'; document.getElementById('divPos' + pos + 'Action').style.color = 'rgb(0,204,0)'; document.getElementById('divPos' + pos + 'Action').style.visibility = 'visible'; winpos = pos; document.getElementById('divPos' + pos + 'Action').style.top = '80px'; } } if(winpos != -1) { text += '
' + arrPositions[winpos] + ' wins ' + document.getElementById('divPotValue').innerHTML + '
\n'; } } function hidecards() { var showdown = xmlDoc.getElementsByTagName('showdown'); for(i=0;i < showdown.length;i++) { position = getvalue(showdown[i], 'position', 0); pos = find(arrPositions2,position); document.getElementById('imgPos' + pos + 'Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos' + pos + 'Pocket2').src = '/images/cardback.png'; } } function showcards() { var showdown = xmlDoc.getElementsByTagName('showdown'); for(i=0;i < showdown.length;i++) { position = getvalue(showdown[i], 'position', 0); cards = getvalue(showdown[i], 'cards', 0); pos = find(arrPositions2,position); if(cards != '') { var card1 = cards.substring(0,2); var card2 = cards.substring(2,4); document.getElementById('imgPos' + pos + 'Pocket1').src = '/images/' + card1 + '.png'; document.getElementById('imgPos' + pos + 'Pocket2').src = '/images/' + card2 + '.png'; document.getElementById('divPos' + pos + 'Cards').style.visibility = 'visible'; } } } function hidecards() { var showdown = xmlDoc.getElementsByTagName('showdown'); for(i=0;i < showdown.length;i++) { position = getvalue(showdown[i], 'position', 0); pos = find(arrPositions2,position); if(pos != 0) { document.getElementById('imgPos' + pos + 'Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos' + pos + 'Pocket2').src = '/images/cardback.png'; } } } function reset() { for(i=0;i<=9;i++) { document.getElementById('divPos' + i + 'Action').style.visibility = 'hidden'; document.getElementById('divPos' + i + 'Chips').innerHTML = ''; document.getElementById('divPos' + i + 'Count').innerHTML = ''; for(j=0;j<=8;j++) { eval("player" + j + "count = '0';"); } } if(playersleft <= 1) { showcards(); //remove extra all-in chips from pot if(lastaction == 'raise' || lastaction == 'bet') { //bet / raise with no call amount = eval('parseNum(player' + lastplayerinpot + 'count)') ; newamount = amount - difference; pot = parseNum(removecommas(document.getElementById('divPotValue').innerHTML)); pot = pot - difference; document.getElementById('divPotValue').innerHTML = addcommas(pot); inpot = parseNum(removecommas(document.getElementById('divPos' + lastplayerinpot + 'Pot').innerHTML)); inpot = inpot + difference; document.getElementById('divPos' + lastplayerinpot + 'Pot').innerHTML = addcommas(inpot); } } lastaction = ''; lastplayerinpot = 0; difference = 0; text += 'Pot is ' + document.getElementById('divPotValue').innerHTML + '
\n'; } function delay(funct, params, seconds) { var strparams = ''; if(params.length > 0) { for (x in params) { strparams = strparams + '"' + params[x] + '",'; } strparams = strparams.substring(0,(strparams.length-1)); var f = funct + '(' + strparams + ')'; } else { var f = funct; } timerID = setTimeout(f, seconds * interval); var arrTimerInfo = new Array(); arrTimerInfo[0] = timerID; arrTimerInfo[1] = f; arrTimerInfo[2] = seconds; arrAllTimers.push(arrTimerInfo); } function getvalue(obj, node, index) { if(obj.getElementsByTagName(node)[0].hasChildNodes()) { return obj.getElementsByTagName(node)[index].childNodes[0].nodeValue; } else { return ''; } } function remove(arr,value) { var i = find(arr,value); if(i != -1) { arr.splice(i, 1); } } function find(arr, value) { for(f=0;f 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function removecommas(str) { str = str.replace(/\,/g,''); str = str.replace(/\$/g,''); return str; } function parseNum(num) { num = String(num); num = num.replace(/\$/g,''); switch(gametype) { case "tournament": return parseInt(num); break; case "cash": return parseFloat(num); break; } } function format(str) { if(gametype == 'cash') { if(str != '') { str = parseNum(str) str = str.toFixed(2); str = '$' + str.toString(); } return str; } else { return str; } } function playpause() { if(ready) { if(playing) { pause(); } else { play(); } } } function pause() { playing = false; clearInterval(intervalID); for(i=0;i 0) { eval("arrAllTimers[i][0] = setTimeout('" + arrAllTimers[i][1] + "'," + arrAllTimers[i][2] + " * interval);"); } } intervalID = setInterval('keeptime()', interval); } document.getElementById('imgPlayPause').src = '/images/playerpause.png'; } function stop() { pause(); resetall(); init(); } function resetall() { player0count=0; player1count=0; player2count=0; player3count=0; player4count=0; player5count=0; player6count=0; player7count=0; player8count=0; player9count=0; lastbet = '0'; arrAllTimers = new Array(); secondsrunning = 0; started = false; playing = false; document.getElementById('divPotValue').innerHTML = '0'; document.getElementById('imgBoard1').src = '/images/cardtrans.png'; document.getElementById('imgBoard2').src = '/images/cardtrans.png'; document.getElementById('imgBoard3').src = '/images/cardtrans.png'; document.getElementById('imgBoard4').src = '/images/cardtrans.png'; document.getElementById('imgBoard5').src = '/images/cardtrans.png'; document.getElementById('divPos0Chips').innerHTML = ''; document.getElementById('divPos1Chips').innerHTML = ''; document.getElementById('divPos2Chips').innerHTML = ''; document.getElementById('divPos3Chips').innerHTML = ''; document.getElementById('divPos4Chips').innerHTML = ''; document.getElementById('divPos5Chips').innerHTML = ''; document.getElementById('divPos6Chips').innerHTML = ''; document.getElementById('divPos7Chips').innerHTML = ''; document.getElementById('divPos8Chips').innerHTML = ''; document.getElementById('divPos9Chips').innerHTML = ''; document.getElementById('divPos0Count').innerHTML = ''; document.getElementById('divPos1Count').innerHTML = ''; document.getElementById('divPos2Count').innerHTML = ''; document.getElementById('divPos3Count').innerHTML = ''; document.getElementById('divPos4Count').innerHTML = ''; document.getElementById('divPos5Count').innerHTML = ''; document.getElementById('divPos6Count').innerHTML = ''; document.getElementById('divPos7Count').innerHTML = ''; document.getElementById('divPos8Count').innerHTML = ''; document.getElementById('divPos9Count').innerHTML = ''; document.getElementById('divPos0Action').innerHTML = ''; document.getElementById('divPos1Action').innerHTML = ''; document.getElementById('divPos2Action').innerHTML = ''; document.getElementById('divPos3Action').innerHTML = ''; document.getElementById('divPos4Action').innerHTML = ''; document.getElementById('divPos5Action').innerHTML = ''; document.getElementById('divPos6Action').innerHTML = ''; document.getElementById('divPos7Action').innerHTML = ''; document.getElementById('divPos8Action').innerHTML = ''; document.getElementById('divPos9Action').innerHTML = ''; document.getElementById('divPos0Pot').innerHTML = ''; document.getElementById('divPos1Pot').innerHTML = ''; document.getElementById('divPos2Pot').innerHTML = ''; document.getElementById('divPos3Pot').innerHTML = ''; document.getElementById('divPos4Pot').innerHTML = ''; document.getElementById('divPos5Pot').innerHTML = ''; document.getElementById('divPos6Pot').innerHTML = ''; document.getElementById('divPos7Pot').innerHTML = ''; document.getElementById('divPos8Pot').innerHTML = ''; document.getElementById('divPos9Pot').innerHTML = ''; document.getElementById('divPos0Total').innerHTML = ''; document.getElementById('divPos1Total').innerHTML = ''; document.getElementById('divPos2Total').innerHTML = ''; document.getElementById('divPos3Total').innerHTML = ''; document.getElementById('divPos4Total').innerHTML = ''; document.getElementById('divPos5Total').innerHTML = ''; document.getElementById('divPos6Total').innerHTML = ''; document.getElementById('divPos7Total').innerHTML = ''; document.getElementById('divPos8Total').innerHTML = ''; document.getElementById('divPos9Total').innerHTML = ''; document.getElementById('divPos0Action').style.visibility = 'hidden'; document.getElementById('divPos1Action').style.visibility = 'hidden'; document.getElementById('divPos2Action').style.visibility = 'hidden'; document.getElementById('divPos3Action').style.visibility = 'hidden'; document.getElementById('divPos4Action').style.visibility = 'hidden'; document.getElementById('divPos5Action').style.visibility = 'hidden'; document.getElementById('divPos6Action').style.visibility = 'hidden'; document.getElementById('divPos7Action').style.visibility = 'hidden'; document.getElementById('divPos8Action').style.visibility = 'hidden'; document.getElementById('divPos9Action').style.visibility = 'hidden'; document.getElementById('divPos0Action').style.top = '10px'; document.getElementById('divPos1Action').style.top = '10px'; document.getElementById('divPos2Action').style.top = '10px'; document.getElementById('divPos3Action').style.top = '10px'; document.getElementById('divPos4Action').style.top = '10px'; document.getElementById('divPos5Action').style.top = '10px'; document.getElementById('divPos6Action').style.top = '10px'; document.getElementById('divPos7Action').style.top = '10px'; document.getElementById('divPos8Action').style.top = '10px'; document.getElementById('divPos9Action').style.top = '10px'; document.getElementById('divPos0Action').style.left = '12px'; document.getElementById('divPos1Action').style.left = '12px'; document.getElementById('divPos2Action').style.left = '12px'; document.getElementById('divPos3Action').style.left = '12px'; document.getElementById('divPos4Action').style.left = '12px'; document.getElementById('divPos5Action').style.left = '12px'; document.getElementById('divPos6Action').style.left = '12px'; document.getElementById('divPos7Action').style.left = '12px'; document.getElementById('divPos8Action').style.left = '12px'; document.getElementById('divPos9Action').style.left = '12px'; document.getElementById('imgPos0Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos1Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos2Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos3Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos4Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos5Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos6Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos7Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos8Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos9Pocket1').src = '/images/cardback.png'; document.getElementById('imgPos0Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos1Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos2Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos3Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos4Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos5Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos6Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos7Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos8Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos9Pocket2').src = '/images/cardback.png'; document.getElementById('imgPos0Pocket1').className = ''; document.getElementById('imgPos1Pocket1').className = ''; document.getElementById('imgPos2Pocket1').className = ''; document.getElementById('imgPos3Pocket1').className = ''; document.getElementById('imgPos4Pocket1').className = ''; document.getElementById('imgPos5Pocket1').className = ''; document.getElementById('imgPos6Pocket1').className = ''; document.getElementById('imgPos7Pocket1').className = ''; document.getElementById('imgPos8Pocket1').className = ''; document.getElementById('imgPos9Pocket1').className = ''; document.getElementById('imgPos0Pocket2').className = ''; document.getElementById('imgPos1Pocket2').className = ''; document.getElementById('imgPos2Pocket2').className = ''; document.getElementById('imgPos3Pocket2').className = ''; document.getElementById('imgPos4Pocket2').className = ''; document.getElementById('imgPos5Pocket2').className = ''; document.getElementById('imgPos6Pocket2').className = ''; document.getElementById('imgPos7Pocket2').className = ''; document.getElementById('imgPos8Pocket2').className = ''; document.getElementById('imgPos9Pocket2').className = ''; document.getElementById('divPos0Cards').style.visibility = 'visible'; document.getElementById('divPos1Cards').style.visibility = 'visible'; document.getElementById('divPos2Cards').style.visibility = 'visible'; document.getElementById('divPos3Cards').style.visibility = 'visible'; document.getElementById('divPos4Cards').style.visibility = 'visible'; document.getElementById('divPos5Cards').style.visibility = 'visible'; document.getElementById('divPos6Cards').style.visibility = 'visible'; document.getElementById('divPos7Cards').style.visibility = 'visible'; document.getElementById('divPos8Cards').style.visibility = 'visible'; document.getElementById('divPos9Cards').style.visibility = 'visible'; document.getElementById('divPos0').style.display = 'none'; document.getElementById('divPos1').style.display = 'none'; document.getElementById('divPos2').style.display = 'none'; document.getElementById('divPos3').style.display = 'none'; document.getElementById('divPos4').style.display = 'none'; document.getElementById('divPos5').style.display = 'none'; document.getElementById('divPos6').style.display = 'none'; document.getElementById('divPos7').style.display = 'none'; document.getElementById('divPos8').style.display = 'none'; document.getElementById('divPos9').style.display = 'none'; } function keeptime() { secondsrunning = secondsrunning + 1; } function loadXML(text) { try //Internet Explorer { xmlDoc=new ActiveXObject('Microsoft.XMLDOM'); xmlDoc.async='false'; xmlDoc.loadXML(text); return xmlDoc; } catch(e) { parser=new DOMParser(); xmlDoc=parser.parseFromString(text,'text/xml'); return xmlDoc; } } function toggleshowcards() { if(showingcards==false) { showcards(); document.getElementById('imgHole').src = '/images/hole_cards_hide.png'; showingcards = true; } else { hidecards(); document.getElementById('imgHole').src = '/images/hole_cards_show.png'; showingcards = false; } } var div = document.createElement("DIV"); function showad() { if(window.innerHeight) { myHeight = window.innerHeight + window.scrollMaxY; } else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight )) { myHeight = document.body.scrollHeight; } else { myHeight = document.body.offsetHeight; } html = "
"; div.innerHTML = html; document.body.appendChild(div); document.getElementById('divAd').style.display = ''; } function closead() { document.getElementById('divAd').style.display = 'none'; document.body.removeChild(div); }