var pAvailableTablesWindow; var pCashierWindow; var pRulesWindow; var pHelpWindow; var pUserInfoWindow; var pSettingsWindow; // // Load the given image list. Used for preloading. // function LoadImages(pImageList) { pImages = new Array(); for (var i=0; i<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + '$' + num + '.' + cents); } // FormatCurrency() function FormatTwoDecimalPlaces(num) { if (isNaN(num)) { num = "0"; } sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + num + '.' + cents); } // FormatCurrency() // // Check to see if some of our cookie values have not // been set. This can be used to force users to come // in through our login. // function VerifyCookiesValid() { if (!GetFromCookie("Password")) { // The password is no longer set in the cookie; // force this user to log in again! LogoutFlash(); } } // VerifyCookiesValid() // // Extract the rank from the given card code // function MapCardToRank(lCode, bShort) { var szRank; // Check that we don't have an empty string if (lCode == "") { return ""; } // Determine our rank var lModulus = lCode % 20; switch (lCode % 20) { case 1: if (bShort) szRank = "A"; else szRank = "Ace"; break; case 2: if (bShort) szRank = "2"; else szRank = "Two"; break; case 3: if (bShort) szRank = "3"; else szRank = "Three"; break; case 4: if (bShort) szRank = "4"; else szRank = "Four"; break; case 5: if (bShort) szRank = "5"; else szRank = "Five"; break; case 6: if (bShort) szRank = "6"; else szRank = "Six"; break; case 7: if (bShort) szRank = "7"; else szRank = "Seven"; break; case 8: if (bShort) szRank = "8"; else szRank = "Eight"; break; case 9: if (bShort) szRank = "9"; else szRank = "Nine"; break; case 10: if (bShort) szRank = "10"; else szRank = "Ten"; break; case 11: if (bShort) szRank = "J"; else szRank = "Jack"; break; case 12: if (bShort) szRank = "Q"; else szRank = "Queen"; break; case 13: if (bShort) szRank = "K"; else szRank = "King"; break; default: return "N/A"; } // switch (lCode % 20) return szRank; } // MapCardToRank() // // Extract the suit from the given card code // function MapCardToSuit(lCode, bShort) { // Determine our suit lModulus = lCode % 20; switch ((lCode-lModulus) / 20) { case 0: if (bShort) szSuit = "D"; else szSuit = " of Diamonds"; break; case 1: if (bShort) szSuit = "H"; else szSuit = " of Hearts"; break; case 2: if (bShort) szSuit = "S"; else szSuit = " of Spades"; break; case 3: if (bShort) szSuit = "C"; else szSuit = " of Clubs"; break; default: return "N/A"; } // switch (lCode / 20) return szSuit; } // MapCardToSuit() // // Turn the given card code into a string // function MapCardToString(lCode, bShort) { // Check that we don't have an empty string if (lCode == "") { return ""; } // Get our rank and suit strings var szRank = MapCardToRank(lCode, bShort); var szSuit = MapCardToSuit(lCode, bShort); // Return the appropriate value if (szRank == "N/A" || szSuit == "N/A") { return "N/A"; } else { return szRank + szSuit; } } // MapCardToString() // // Determine the blackjack value of the given hand sum // function GetBJValue(lSum, lNumCards, bAce, bSplit) { if (bAce && lSum < 12) { lSum += 10; } if (lSum == 21 && lNumCards == 2 && !bSplit) { return "Blackjack"; } else if (lSum <= 21) { return lSum; } else { return "busted"; } } // GetBJValue() var szMsg = new Array("Watching blackjack is fun, but playing it is even better!", "Our beautiful dealer would love to deal you in!", "Nothing beats the feeling of being dealt blackjack!", "Now you know what you're missing!", "Blackjack is a popular game, and it's easy to see why!"); function PickMessage() { var i = Math.floor((5 * Math.random())); if (i == 5) i = 4; var szString = ""; if (i < 0 || i > 4) { szString = i + ": "; } return szMsg[i]; }