var pk2GAMESTATE = 0; // 0 = not playing, 1=dealing, 2=selecting holds, 3=dealing again, 4=concluding.
var pk2CREDITS = 1000;
var pk2DISCARD = new Array(0,0,0,0,0);
var pk2HAND = new Array(0,0,0,0,0);
var pk2WINNINGS = 0;
var pk2CARDS = new Array(0,0,0,0,0);
var pk2SUIT = new Array(0,0,0,0,0);
var pk2FLUSH = false;
var pk2CACHED = false;
function pk2DEALROLLOVER(pk2X) {
if ((pk2GAMESTATE == 0) || (pk2GAMESTATE == 2)) {
(pk2X) ? document.images.pk2DEALBUTTON.src = "http://pic.geocities.com/images/gadgetfactory/pk2/deal_over-down_56x28.gif" : document.images.pk2DEALBUTTON.src = "http://pic.geocities.com/images/gadgetfactory/pk2/deal_up_56x28.gif";
}
}
function pk2HOLDCARD(pk2X) {
if (pk2GAMESTATE == 2) {
pk2SHELL = pk2DISCARD[pk2X];
pk2DISCARD[pk2X] = pk2HAND[pk2X];
pk2HAND[pk2X] = pk2SHELL;
if (pk2X == 0) {
(pk2HAND[0] == 0) ? document.images.pk2HOLD0.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif" : document.images.pk2HOLD0.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_over-down.gif";
}
if (pk2X == 1) {
(pk2HAND[1] == 0) ? document.images.pk2HOLD1.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif" : document.images.pk2HOLD1.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_over-down.gif";
}
if (pk2X == 2) {
(pk2HAND[2] == 0) ? document.images.pk2HOLD2.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif" : document.images.pk2HOLD2.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_over-down.gif";
}
if (pk2X == 3) {
(pk2HAND[3] == 0) ? document.images.pk2HOLD3.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif" : document.images.pk2HOLD3.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_over-down.gif";
}
if (pk2X == 4) {
(pk2HAND[4] == 0) ? document.images.pk2HOLD4.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif" : document.images.pk2HOLD4.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_over-down.gif";
}
}
}
function pk2DONEDEAL() {
for (pk2X = 0; pk2X < 5; pk2X++) {
pk2DISCARD[pk2X] = pk2HAND[pk2X];
pk2HAND[pk2X] = 0;
}
pk2GAMESTATE = 2;
}
function pk2LOADIMAGES(){
var pk2IMAGECACHE = new Array(40);
for (var pk2X=0; pk2X<40; pk2X++) pk2IMAGECACHE[pk2X] = new Image();
for (var pk2X=0; pk2X<4; pk2X++) pk2IMAGECACHE[pk2X].src = "http://pic.geocities.com/images/gadgetfactory/pk2/suit" + pk2X + "_42x44.gif";
for (var pk2X=1; pk2X<14; pk2X++) {
pk2IMAGECACHE[pk2X+3].src = "http://pic.geocities.com/images/gadgetfactory/pk2/card0" + pk2X + "_42x24.gif";
pk2IMAGECACHE[pk2X+16].src = "http://pic.geocities.com/images/gadgetfactory/pk2/card1" + pk2X + "_42x24.gif";
}
for (var pk2X=0; pk2X<10; pk2X++) pk2IMAGECACHE[pk2X+29].src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + pk2X + ".gif";
pk2CACHED=true;
}
function pk2DEAL() {
if ((pk2GAMESTATE == 0) && (pk2CREDITS > 4)) {
document.images.pk2CARD1a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif";
document.images.pk2CARD1b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif";
document.images.pk2CARD2a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif";
document.images.pk2CARD2b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif";
document.images.pk2CARD3a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif";
document.images.pk2CARD3b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif";
document.images.pk2CARD4a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif";
document.images.pk2CARD4b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif";
document.images.pk2CARD5a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif";
document.images.pk2CARD5b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif";
if (pk2CACHED==false) pk2LOADIMAGES();
pk2CREDITS = pk2CREDITS - 5;
pk2DISPLAYCREDITS();
pk2GAMESTATE = 1;
for (var pk2X = 0; pk2X < 5; pk2X++) {
pk2HAND[pk2X] = (Math.floor(Math.random() * 52) + 1);
pk2DISCARD[pk2X] = 0;
if ((pk2HAND[pk2X] == pk2HAND[pk2X-1]) || (pk2HAND[pk2X] == pk2HAND[pk2X-2]) || (pk2HAND[pk2X] == pk2HAND[pk2X-3]) || (pk2HAND[pk2X] == pk2HAND[pk2X-4])) pk2X--;
}
pk2DISPLAYHAND();
setTimeout("pk2DONEDEAL();",2000);
}
else if (pk2GAMESTATE == 2) {
pk2GAMESTATE = 3;
if (pk2HAND[0] == 0) {document.images.pk2CARD1a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif"; document.images.pk2CARD1b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif"; }
if (pk2HAND[1] == 0) {document.images.pk2CARD2a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif"; document.images.pk2CARD2b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif"; }
if (pk2HAND[2] == 0) {document.images.pk2CARD3a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif"; document.images.pk2CARD3b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif"; }
if (pk2HAND[3] == 0) {document.images.pk2CARD4a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif"; document.images.pk2CARD4b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif"; }
if (pk2HAND[4] == 0) {document.images.pk2CARD5a.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_top_42x24.gif"; document.images.pk2CARD5b.src = "http://pic.geocities.com/images/gadgetfactory/pk2/card_bottom_42x44.gif"; }
for (var pk2X = 0; pk2X < 5; pk2X++){
if (pk2HAND[pk2X] == 0) {
pk2NEXTCARD = (Math.floor(Math.random() * 52) + 1);
((pk2NEXTCARD == pk2HAND[0]) || (pk2NEXTCARD == pk2HAND[1]) || (pk2NEXTCARD == pk2HAND[2]) || (pk2NEXTCARD == pk2HAND[3]) || (pk2NEXTCARD == pk2HAND[4]) || (pk2NEXTCARD == pk2DISCARD[0]) || (pk2NEXTCARD == pk2DISCARD[1]) || (pk2NEXTCARD == pk2DISCARD[2]) || (pk2NEXTCARD == pk2DISCARD[3]) || (pk2NEXTCARD == pk2DISCARD[4])) ? pk2X = pk2X - 1 : pk2HAND[pk2X] = pk2NEXTCARD;
}
}
pk2DISPLAYHAND();
document.images.pk2HOLD0.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif";
document.images.pk2HOLD1.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif";
document.images.pk2HOLD2.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif";
document.images.pk2HOLD3.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif";
document.images.pk2HOLD4.src="http://pic.geocities.com/images/gadgetfactory/pk2/hold_up.gif";
setTimeout("pk2GAMEDONE();",2000)
}
}
function pk2GAMEDONE() {
pk2FLUSH = false;
pk2WINNINGS = 0;
for (var pk2X = 0; pk2X < 5; pk2X++) {
pk2CARDS[pk2X] = (pk2HAND[pk2X] - (Math.floor((pk2HAND[pk2X] - 1)/13) * 13));
pk2SUIT[pk2X] = Math.floor((pk2HAND[pk2X] - 1)/13);
}
if ((pk2SUIT[0] == pk2SUIT[1]) && (pk2SUIT[1] == pk2SUIT[2]) && (pk2SUIT[2] == pk2SUIT[3]) && (pk2SUIT[3] == pk2SUIT[4])) pk2FLUSH = true;
pk2CARDS.sort(function(pk2A,pk2B) {return pk2A - pk2B;});
if (((pk2CARDS[0] == pk2CARDS[1]) && (pk2CARDS[0] > 9)) || ((pk2CARDS[1] == pk2CARDS[2]) && (pk2CARDS[1] > 9)) || ((pk2CARDS[2] == pk2CARDS[3]) && (pk2CARDS[2] > 9)) || ((pk2CARDS[3] == pk2CARDS[4]) && (pk2CARDS[3] > 9))) pk2WINNINGS = 5;
if (((pk2CARDS[0] == pk2CARDS[1]) && (pk2CARDS[2] == pk2CARDS[3])) || ((pk2CARDS[0] == pk2CARDS[1]) && (pk2CARDS[3] == pk2CARDS[4])) || ((pk2CARDS[1] == pk2CARDS[2]) && (pk2CARDS[3] == pk2CARDS[4]))) pk2WINNINGS =10;
if (((pk2CARDS[0] == pk2CARDS[1]) && (pk2CARDS[1] == pk2CARDS[2])) || ((pk2CARDS[1] == pk2CARDS[2]) && (pk2CARDS[2] == pk2CARDS[3])) || ((pk2CARDS[2] == pk2CARDS[3]) && (pk2CARDS[3] == pk2CARDS[4]))) pk2WINNINGS = 15;
if (pk2CARDS[0] == (pk2CARDS[4] + 4)) pk2WINNINGS = 20;
if (pk2FLUSH == true) pk2WINNINGS = 25;
if (((pk2CARDS[0] == pk2CARDS[1]) && (pk2CARDS[1] == pk2CARDS[2]) && (pk2CARDS[3] == pk2CARDS[4])) || ((pk2CARDS[2] == pk2CARDS[3]) && (pk2CARDS[3] == pk2CARDS[4]) && (pk2CARDS[0] == pk2CARDS[1]))) pk2WINNINGS = 35;
if (((pk2CARDS[0] == pk2CARDS[1]) && (pk2CARDS[1] == pk2CARDS[2]) && (pk2CARDS[2] == pk2CARDS[3])) || ((pk2CARDS[1] == pk2CARDS[2]) && (pk2CARDS[2] == pk2CARDS[3]) && (pk2CARDS[3] == pk2CARDS[4]))) pk2WINNINGS = 100;
if ((pk2CARDS[0] == (pk2CARDS[4] + 4)) && (pk2FLUSH == true)) pk2WINNINGS=250;
if ((pk2WINNINGS == 250) && (pk2CARDS[4] == 13)) pk2WINNINGS = 5000;
pk2CREDITS = pk2CREDITS + pk2WINNINGS;
pk2DISPLAYCREDITS();
pk2GAMESTATE = 0;
}
function pk2DISPLAYHAND() {
if (document.images.pk2CARD1a.src != pk2CARDTOP(pk2HAND[0])) setTimeout("document.images.pk2CARD1a.src = pk2CARDTOP(pk2HAND[0])",400);
if (document.images.pk2CARD1b.src != pk2CARDBOT(pk2HAND[0])) setTimeout("document.images.pk2CARD1b.src = pk2CARDBOT(pk2HAND[0])",400);
if (document.images.pk2CARD2a.src != pk2CARDTOP(pk2HAND[1])) setTimeout("document.images.pk2CARD2a.src = pk2CARDTOP(pk2HAND[1])",800);
if (document.images.pk2CARD2b.src != pk2CARDBOT(pk2HAND[1])) setTimeout("document.images.pk2CARD2b.src = pk2CARDBOT(pk2HAND[1])",800);
if (document.images.pk2CARD3a.src != pk2CARDTOP(pk2HAND[2])) setTimeout("document.images.pk2CARD3a.src = pk2CARDTOP(pk2HAND[2])",1200);
if (document.images.pk2CARD3b.src != pk2CARDBOT(pk2HAND[2])) setTimeout("document.images.pk2CARD3b.src = pk2CARDBOT(pk2HAND[2])",1200);
if (document.images.pk2CARD4a.src != pk2CARDTOP(pk2HAND[3])) setTimeout("document.images.pk2CARD4a.src = pk2CARDTOP(pk2HAND[3])",1600);
if (document.images.pk2CARD4b.src != pk2CARDBOT(pk2HAND[3])) setTimeout("document.images.pk2CARD4b.src = pk2CARDBOT(pk2HAND[3])",1600);
if (document.images.pk2CARD5a.src != pk2CARDTOP(pk2HAND[4])) setTimeout("document.images.pk2CARD5a.src = pk2CARDTOP(pk2HAND[4])",2000);
if (document.images.pk2CARD5b.src != pk2CARDBOT(pk2HAND[4])) setTimeout("document.images.pk2CARD5b.src = pk2CARDBOT(pk2HAND[4])",2000);
}
function pk2CARDTOP(pk2THISCARD) {
return "http://pic.geocities.com/images/gadgetfactory/pk2/card" + Math.floor((pk2THISCARD -1) / 26) + (pk2THISCARD - (Math.floor((pk2THISCARD - 1)/13) * 13)) + "_42x24.gif";
}
function pk2CARDBOT(pk2THISCARD) {
return "http://pic.geocities.com/images/gadgetfactory/pk2/suit" + Math.floor((pk2THISCARD - 1)/13) + "_42x44.gif";
}
function pk2DISPLAYCREDITS() {
document.images.pk2CREDIT0.src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + (pk2CREDITS - (Math.floor(pk2CREDITS / 10) * 10)) + ".gif";
document.images.pk2CREDIT10.src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + Math.floor(Math.floor(pk2CREDITS - (Math.floor(pk2CREDITS / 100) * 100)) / 10) + ".gif";
document.images.pk2CREDIT100.src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + Math.floor(Math.floor(pk2CREDITS - (Math.floor(pk2CREDITS / 1000) * 1000)) / 100) + ".gif";
document.images.pk2CREDIT1000.src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + Math.floor(Math.floor(pk2CREDITS - (Math.floor(pk2CREDITS / 10000) * 10000)) / 1000) + ".gif";
document.images.pk2CREDIT10000.src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + Math.floor(Math.floor(pk2CREDITS - (Math.floor(pk2CREDITS / 100000) * 100000)) / 10000) + ".gif";
document.images.pk2CREDIT100000.src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + Math.floor(Math.floor(pk2CREDITS - (Math.floor(pk2CREDITS / 1000000) * 1000000)) / 100000) + ".gif";
document.images.pk2CREDIT1000000.src = "http://pic.geocities.com/images/gadgetfactory/pk2/c" + Math.floor(Math.floor(pk2CREDITS - (Math.floor(pk2CREDITS / 10000000) * 10000000)) / 1000000) + ".gif";
}
function pk2PAYOUTROLLOVER(pk2X) {
if (pk2X == 1) document.images.pk2PAYOUTS.src = "http://pic.geocities.com/images/gadgetfactory/pk2/view_payouts_over_102x28.gif";
else document.images.pk2PAYOUTS.src = "http://pic.geocities.com/images/gadgetfactory/pk2/view_payouts_up_102x28.gif"
}
function pk2SHOWPAYOUTS() {
if (navigator.userAgent.indexOf('AOL') != -1)
{
Newwindow=window.open("http://www.geocities.com/gadgetfactory/pops/pok_payout.html","Payouts","resizable=yes,scrollbars=no,status=0,width=200,height=280");
Newwindow.creator = self;
}
else
Newwindow=window.open("http://www.geocities.com/gadgetfactory/pops/pok_payout.html","Payouts","resizable=yes,scrollbars=no,status=0,width=200,height=280");
}
document.write('
 |   |  |
 |
 |  |  |  |  | ');
document.write(' |  | | ');
document.write(' |
| |  | |  | ');
document.write('
| |  |  |  |  |  | ');
document.write(' |  |  |
  |  |  | ');
document.write('  | ');
document.write(' |  |  |  |  |
|  |
 |
 |
 |  |  |
');