function GetPlayText(r1,r2,r3,r4){r1>>=1;r2>>=1;r3>>=1;r4>>=1;var h1=HandRank[(r1<<4)|r2];var h2=HandRank[(r3<<4)|r4];var n1=(h1==0xCF?"Gee Joon":["0","1","2","3","4","5","6","7","8","9","Gong","Wong","Pair"][h1>>4]);var n2=(h2==0xCF?"Gee Joon":["0","1","2","3","4","5","6","7","8","9","Gong","Wong","Pair"][h2>>4]);return(h1>h2?n2+"/"+n1:n1+"/"+n2)}function Flip(id,width,initial,final,delay){setTimeout("Obj('"+id+"').className = '"+initial+"';",delay);setTimeout("Obj('"+id+"').style.width = '"+width+"px';",delay);var speed=2;for(var x=0;x<(width>>1);x++){setTimeout("Obj('"+id+"').style.width = '"+(width-(x<<1))+"px';",delay);delay+=speed}setTimeout("Obj('"+id+"').className = '"+final+"';",delay);delay+=speed;for(var x=((width>>1)-1);x>=0;x--){setTimeout("Obj('"+id+"').style.width = '"+(width-(x<<1))+"px';",delay);delay+=speed}setTimeout("Obj('"+id+"').style.width = '"+width+"px';",delay);return delay}function PrepareData(){var r1,r2,r3,r4;var id=0;var pip1=[3,5,7,8,9,6,7,0,1,4,6,0,4,8,2,2];var pip2=[6,5,7,8,9,6,7,0,1,4,6,0,4,8,2,2];for(r1=0;r1<16;r1++){HandRank[(r1<<4)|r1]=(12<<4)|((r1+15)&15)}for(r2=1;r2<16;r2++){for(r1=0;r1<r2;r1++){var code1=(r1<<4)|r2;var code2=(r2<<4)|r1;switch(code1){case 0x4E:case 0x4F:HandRank[code1]=(11<<4)|r2;HandRank[code2]=HandRank[code1];break;case 0x3E:case 0x3F:case 0xDE:case 0xDF:HandRank[code1]=(10<<4)|r2;HandRank[code2]=HandRank[code1];break;default:var mp=0;var p1=(pip1[r1]+pip1[r2])%10;mp=(p1>mp?p1:mp);var p2=(pip2[r1]+pip1[r2])%10;mp=(p2>mp?p2:mp);var p3=(pip1[r1]+pip2[r2])%10;mp=(p3>mp?p3:mp);var p4=(pip2[r1]+pip2[r2])%10;mp=(p4>mp?p4:mp);HandRank[code1]=(mp<<4)|(mp>0?r2:0);HandRank[code2]=HandRank[code1];break}}}for(r2=1;r2<16;r2++){for(r1=0;r1<r2;r1++){PrepareHand(id++,r1,r1,r2,r2)}}for(r3=0;r3<16;r3++){for(r2=1;r2<16;r2++){if(r2!=r3){for(r1=0;r1<r2;r1++){if(r1!=r3){PrepareHand(id++,r1,r2,r3,r3)}}}}}for(r4=3;r4<16;r4++){for(r3=2;r3<r4;r3++){for(r2=1;r2<r3;r2++){for(r1=0;r1<r2;r1++){PrepareHand(id++,r1,r2,r3,r4)}}}}}function PrepareHand(id,r1,r2,r3,r4){if(r1>r2){r1^=r2;r2^=r1;r1^=r2}if(r1>r3){r1^=r3;r3^=r1;r1^=r3}if(r1>r4){r1^=r4;r4^=r1;r1^=r4}if(r2>r3){r2^=r3;r3^=r2;r2^=r3}if(r2>r4){r2^=r4;r4^=r2;r2^=r4}if(r3>r4){r3^=r4;r4^=r3;r3^=r4}Combination[id]=(r1<<12)|(r2<<8)|(r3<<4)|r4;UniqueID[Combination[id]]=id}function Obj(i){return document.getElementById(i)}function Hide(o){Obj(o).style.display="none"}function Show(o){Obj(o).style.display="block"}function ChipHTML(a){var s=a;var d=[1000000,500000,250000,100000,50000,25000,10000,5000,2500,1000,500,100,50,25,10,5,1,0.50,0.25,0.10,0.05,0.01];var h="";var n=0;var t=0;var c=0;if(a>0){for(var x=0;x<d.length;x++){a=parseFloat(a.toFixed(2));n=(a<d[x]?0:parseInt(a/d[x]));for(var y=0;y<n;y++){h+="<div class='chip"+d[x].toFixed(2).replace(/\.00/,"").replace(/\./,"")+"' style='top:"+t+"px;'></div>";t-=5;a-=d[x];c++}}}if(s>0){h+="<div class='chiplabel'>"+Font.DrawString(Font.FormatNumber(s,"$",(s==parseInt(s)?0:2)))+"</div>"}return h}function ChipSelectorObject(){this.ChipSize=5;this.Denom=0;this.Coord=[{x:9,y:379},{x:53,y:399},{x:99,y:417},{x:147,y:431}];this.SetTo=function(n){if(this.Denom!=n){Slide("chipsel",this.Coord[this.Denom],this.Coord[n],100,100,0);this.Denom=n;this.ChipSize=[5,25,100,500][this.Denom]}}}function ChipStackObject(id,left,top){this.Amount=0;this.ID=id;this.Left=left;this.Obj="chipstack"+this.ID;this.Top=top;this.Decrease=function(i,a,delay,update){a=Math.min(Game.Wager[i].Bet,a);if(a<1){return}Game.Wager[i].Bet-=a;delay=this.SlideTo(2,a,100,100,delay);if(update){setTimeout("Game.Update();",delay)}return delay};this.Increase=function(i,a,delay,update){a=Math.min(Game.ChipStack[2].Amount,Math.min(Game.Wager[i].MaxBet-Game.Wager[i].Bet,a));if(a<1){return}Game.Wager[i].Bet+=a;delay=this.SlideFrom(2,a,100,100,delay);if(update){setTimeout("Game.Update();",delay)}return delay};this.SlideTo=function(dst,amt,fps,dur,delay){var src=this.ID;setTimeout("Obj('slider"+src+"').style.left = '"+this.Left+"px';",delay);setTimeout("Obj('slider"+src+"').style.top  = '"+this.Top+"px';",delay);setTimeout("Obj('slider"+src+"').innerHTML  = ChipHTML("+amt+");",delay);setTimeout("Game.ChipStack["+src+"].SetTo(Game.ChipStack["+src+"].Amount - "+amt+");",delay);delay=Slide("slider"+src,{x:Game.ChipStack[src].Left,y:Game.ChipStack[src].Top},{x:Game.ChipStack[dst].Left,y:Game.ChipStack[dst].Top},fps,dur,delay);setTimeout("Game.ChipStack["+dst+"].SetTo(Game.ChipStack["+dst+"].Amount + "+amt+");",delay);setTimeout("Obj('slider"+src+"').innerHTML = '';",delay);return delay};this.SlideFrom=function(src,amt,fps,dur,delay){var dst=this.ID;setTimeout("Obj('slider"+dst+"').style.left = '"+Game.ChipStack[src].Left+"px';",delay);setTimeout("Obj('slider"+dst+"').style.top  = '"+Game.ChipStack[src].Top+"px';",delay);setTimeout("Obj('slider"+dst+"').innerHTML  = ChipHTML("+amt+");",delay);setTimeout("Game.ChipStack["+src+"].SetTo(Game.ChipStack["+src+"].Amount - "+amt+");",delay);delay=Slide("slider"+dst,{x:Game.ChipStack[src].Left,y:Game.ChipStack[src].Top},{x:Game.ChipStack[dst].Left,y:Game.ChipStack[dst].Top},fps,dur,delay);setTimeout("Game.ChipStack["+dst+"].SetTo(Game.ChipStack["+dst+"].Amount + "+amt+");",delay);setTimeout("Obj('slider"+dst+"').innerHTML = '';",delay);return delay};this.SetTo=function(a){this.Amount=a;Obj(this.Obj).innerHTML=ChipHTML(a)}}function FontObject(){this.Class=new Array();this.Class[" "]="symbol00";this.Class[","]="symbol01";this.Class["."]="symbol02";this.Class["/"]="symbol03";this.Class["<"]="symbol04";this.Class[">"]="symbol05";this.Class["?"]="symbol06";this.Class[";"]="symbol07";this.Class["'"]="symbol08";this.Class[":"]="symbol09";this.Class["\""]="symbol10";this.Class["["]="symbol11";this.Class["]"]="symbol12";this.Class["\\"]="symbol13";this.Class["{"]="symbol14";this.Class["}"]="symbol15";this.Class["|"]="symbol16";this.Class["`"]="symbol17";this.Class["~"]="symbol18";this.Class["!"]="symbol19";this.Class["@"]="symbol20";this.Class["#"]="symbol21";this.Class["$"]="symbol22";this.Class["%"]="symbol23";this.Class["^"]="symbol24";this.Class["&"]="symbol25";this.Class["*"]="symbol26";this.Class["("]="symbol27";this.Class[")"]="symbol28";this.Class["-"]="symbol29";this.Class["="]="symbol30";this.Class["_"]="symbol31";this.Class["+"]="symbol32";this.Class["0"]="digit0";this.Class["1"]="digit1";this.Class["2"]="digit2";this.Class["3"]="digit3";this.Class["4"]="digit4";this.Class["5"]="digit5";this.Class["6"]="digit6";this.Class["7"]="digit7";this.Class["8"]="digit8";this.Class["9"]="digit9";this.Class["A"]="uppera";this.Class["B"]="upperb";this.Class["C"]="upperc";this.Class["D"]="upperd";this.Class["E"]="uppere";this.Class["F"]="upperf";this.Class["G"]="upperg";this.Class["H"]="upperh";this.Class["I"]="upperi";this.Class["J"]="upperj";this.Class["K"]="upperk";this.Class["L"]="upperl";this.Class["M"]="upperm";this.Class["N"]="uppern";this.Class["O"]="uppero";this.Class["P"]="upperp";this.Class["Q"]="upperq";this.Class["R"]="upperr";this.Class["S"]="uppers";this.Class["T"]="uppert";this.Class["U"]="upperu";this.Class["V"]="upperv";this.Class["W"]="upperw";this.Class["X"]="upperx";this.Class["Y"]="uppery";this.Class["Z"]="upperz";this.Class["a"]="lowera";this.Class["b"]="lowerb";this.Class["c"]="lowerc";this.Class["d"]="lowerd";this.Class["e"]="lowere";this.Class["f"]="lowerf";this.Class["g"]="lowerg";this.Class["h"]="lowerh";this.Class["i"]="loweri";this.Class["j"]="lowerj";this.Class["k"]="lowerk";this.Class["l"]="lowerl";this.Class["m"]="lowerm";this.Class["n"]="lowern";this.Class["o"]="lowero";this.Class["p"]="lowerp";this.Class["q"]="lowerq";this.Class["r"]="lowerr";this.Class["s"]="lowers";this.Class["t"]="lowert";this.Class["u"]="loweru";this.Class["v"]="lowerv";this.Class["w"]="lowerw";this.Class["x"]="lowerx";this.Class["y"]="lowery";this.Class["z"]="lowerz";this.DrawString=function(s){var h="";var x;h+="<img alt='' class='font labelleft' src='trans.gif' />";for(x=0;x<s.length;x++){h+="<img alt='' class='font "+this.Class[s.substr(x,1)]+"' src='trans.gif' />"}h+="<img alt='' class='font labelright' src='trans.gif' />";return h};this.FormatNumber=function(n,c,d){var sign=(n<0?"-":"");n=Math.abs(n);var str=Math.abs(n).toFixed(d);var regex=new RegExp("(-?[0-9]+)([0-9]{3})");while(regex.test(str)){str=str.replace(regex,"$1,$2")}return sign+c+str}}function HotSpotObject(shape,coords,over,out,down,up,click,dblclick){this.Coord=coords;this.Enabled=false;this.IsCapturing=false;this.IsHovering=false;this.Shape=shape;this.Click=click||function(a,c,s){return true};this.DoubleClick=dblclick||function(a,c,s){return true};this.Down=down||function(a,c,s){return true};this.Hover=over||function(a,c,s){return true};this.Leave=out||function(a,c,s){return true};this.Up=up||function(a,c,s){return true};switch(this.Shape){case"rect":case"rectangle":case"square":this.Contains=function(x,y){return(x>=this.Coord[0])&&(x<=this.Coord[2])&&(y>=this.Coord[1])&&(y<=this.Coord[3])};break;case"circ":case"circle":case"oval":case"ellipse":this.Contains=function(x,y){this.cx=(this.Coord[0]+this.Coord[2])>>1;this.cy=(this.Coord[1]+this.Coord[3])>>1;this.rx=(this.Coord[2]-this.Coord[0])>>1;this.ry=(this.Coord[3]-this.Coord[1])>>1;var dx=x-this.cx;var dy=y-this.cy;return((((dx*dx)/(this.rx*this.rx))+((dy*dy)/(this.ry*this.ry)))<=1)};break;case"poly":case"polygon":this.Contains=function(x,y){this.Points=this.Coord.length>>1;if(this.Points<3){return false}var inside=false;var newX,oldX,x1,x2;var newY,oldY,y1,y2;oldX=this.Coord[this.Coord.length-2];oldY=this.Coord[this.Coord.length-1];for(var p=0;p<this.Points;p++){newX=this.Coord[(p<<1)+0];newY=this.Coord[(p<<1)+1];if(newX>oldX){x1=oldX;x2=newX;y1=oldY;y2=newY}else{x1=newX;x2=oldX;y1=newY;y2=oldY}if(((newX<x)==(x<=oldX))&&(((y-y1)*(x2-x1))<((y2-y1)*(x-x1)))){inside=!inside}oldX=newX;oldY=newY}return inside};break}}function GameObject(){this.Button=false;this.CaptureStart={X:-1,Y:-1};this.ChipSelector=new ChipSelectorObject();this.DealerComb=0;this.DealerHand=0;this.DealerTile=[-1,-1,-1,-1];this.PlayerBanker=false;this.PlayerComb=0;this.PlayerHand=0;this.PlayerHouseWay=false;this.PlayerTile=[-1,-1,-1,-1];this.PlayerSet=[false,false,false,false];this.IsCapturing=false;this.IsHovering=false;this.State=0;this.Wager=new Array();this.Wager["bet"]=new WagerObject(0,5000);this.ChipStack=[new ChipStackObject(0,379,256),new ChipStackObject(1,757,40),new ChipStackObject(2,575,460)];this.HotSpot=[new HotSpotObject("oval",[3,415,45,451],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.ChipSelector.SetTo(0);return true},function(a,c,s){return true}),new HotSpotObject("oval",[47,435,89,471],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.ChipSelector.SetTo(1);return true},function(a,c,s){return true}),new HotSpotObject("oval",[93,453,135,489],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.ChipSelector.SetTo(2);return true},function(a,c,s){return true}),new HotSpotObject("oval",[141,467,183,503],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.ChipSelector.SetTo(3);return true},function(a,c,s){return true}),new HotSpotObject("circ",[355,217,446,309],function(a,c,s){Obj("wager").style.backgroundPosition="-91px 0";Obj("message").innerHTML=Font.DrawString("Click to increase bet.  Shift+click to decrease.  Maximum Bet: "+Font.FormatNumber(Game.Wager["bet"].MaxBet,"$",0));return true},function(a,c,s){Obj("wager").style.backgroundPosition="0 0";Obj("message").innerHTML="";return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){if(Game.State==2){Game.NewHand(false)}if(s){Game.ChipStack[0].Decrease("bet",Game.ChipSelector.ChipSize,0,true)}else{Game.ChipStack[0].Increase("bet",Game.ChipSelector.ChipSize,0,true)}return true},function(a,c,s){return true}),new HotSpotObject("circ",[330,536,390,596],function(a,c,s){Obj("btn_deal").style.backgroundPosition="0 -60px";return true},function(a,c,s){Obj("btn_deal").style.backgroundPosition="0 0";return true},function(a,c,s){Obj("btn_deal").style.backgroundPosition="0 -120px";return true},function(a,c,s){Obj("btn_deal").style.backgroundPosition="0 -60px";return true},function(a,c,s){Game.Deal();return true},function(a,c,s){return true}),new HotSpotObject("circ",[410,536,470,596],function(a,c,s){Obj("btn_clear").style.backgroundPosition="-60px -60px";return true},function(a,c,s){Obj("btn_clear").style.backgroundPosition="-60px 0";return true},function(a,c,s){Obj("btn_clear").style.backgroundPosition="-60px -120px";return true},function(a,c,s){Obj("btn_clear").style.backgroundPosition="-60px -60px";return true},function(a,c,s){Game.ClearBets();return true},function(a,c,s){return true}),new HotSpotObject("circ",[330,536,390,596],function(a,c,s){Obj("btn_split").style.backgroundPosition="-120px -60px";return true},function(a,c,s){Obj("btn_split").style.backgroundPosition="-120px 0";return true},function(a,c,s){Obj("btn_split").style.backgroundPosition="-120px -120px";return true},function(a,c,s){Obj("btn_split").style.backgroundPosition="-120px -60px";return true},function(a,c,s){Game.Split();return true},function(a,c,s){return true}),new HotSpotObject("circ",[410,536,470,596],function(a,c,s){Obj("btn_houseway").style.backgroundPosition="-180px -60px";return true},function(a,c,s){Obj("btn_houseway").style.backgroundPosition="-180px 0";return true},function(a,c,s){Obj("btn_houseway").style.backgroundPosition="-180px -120px";return true},function(a,c,s){Obj("btn_houseway").style.backgroundPosition="-180px -60px";return true},function(a,c,s){Game.HouseWay();return true},function(a,c,s){return true}),new HotSpotObject("circ",[330,536,390,596],function(a,c,s){Obj("btn_rebet").style.backgroundPosition="-240px -60px";return true},function(a,c,s){Obj("btn_rebet").style.backgroundPosition="-240px 0";return true},function(a,c,s){Obj("btn_rebet").style.backgroundPosition="-240px -120px";return true},function(a,c,s){Obj("btn_rebet").style.backgroundPosition="-240px -60px";return true},function(a,c,s){Game.NewHand(true);return true},function(a,c,s){return true}),new HotSpotObject("circ",[410,536,470,596],function(a,c,s){Obj("btn_newhand").style.backgroundPosition="-300px -60px";return true},function(a,c,s){Obj("btn_newhand").style.backgroundPosition="-300px 0";return true},function(a,c,s){Obj("btn_newhand").style.backgroundPosition="-300px -120px";return true},function(a,c,s){Obj("btn_newhand").style.backgroundPosition="-300px -60px";return true},function(a,c,s){Game.NewHand(false);return true},function(a,c,s){return true}),new HotSpotObject("rect",[285,380,335,480],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.Toggle(0);return true},function(a,c,s){return true}),new HotSpotObject("rect",[345,380,395,480],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.Toggle(1);return true},function(a,c,s){return true}),new HotSpotObject("rect",[405,380,455,480],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.Toggle(2);return true},function(a,c,s){return true}),new HotSpotObject("rect",[465,380,515,480],function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){return true},function(a,c,s){Game.Toggle(3);return true},function(a,c,s){return true})];this.ClearBets=function(){if(this.Wager["bet"].Bet>0){this.ChipStack[0].Decrease("bet",this.Wager["bet"].Bet,0,false)}this.Update()};this.Deal=function(){Hide("chipsel");Hide("chipsel0");Hide("chipsel1");Hide("chipsel2");Hide("chipsel3");Hide("btn_deal");Hide("btn_clear");this.HotSpot[0].Enabled=false;this.HotSpot[1].Enabled=false;this.HotSpot[2].Enabled=false;this.HotSpot[3].Enabled=false;this.HotSpot[4].Enabled=false;this.HotSpot[5].Enabled=false;this.HotSpot[6].Enabled=false;var deck=[];for(x=0;x<32;x++){deck[x]=x}for(x=0;x<32;x++){var r=parseInt(Math.random()*32);if(r!=x){deck[x]^=deck[r];deck[r]^=deck[x];deck[x]^=deck[r]}}this.PlayerTile=[deck[0],deck[1],deck[2],deck[3]];this.DealerTile=[deck[4],deck[5],deck[6],deck[7]];var r1=this.PlayerTile[0]>>1;var r2=this.PlayerTile[1]>>1;var r3=this.PlayerTile[2]>>1;var r4=this.PlayerTile[3]>>1;if(r1>r2){r1^=r2;r2^=r1;r1^=r2}if(r1>r3){r1^=r3;r3^=r1;r1^=r3}if(r1>r4){r1^=r4;r4^=r1;r1^=r4}if(r2>r3){r2^=r3;r3^=r2;r2^=r3}if(r2>r4){r2^=r4;r4^=r2;r2^=r4}if(r3>r4){r3^=r4;r4^=r3;r3^=r4}this.PlayerComb=(r1<<12)|(r2<<8)|(r3<<4)|r4;this.PlayerHand=UniqueID[this.PlayerComb];r1=this.DealerTile[0]>>1;r2=this.DealerTile[1]>>1;r3=this.DealerTile[2]>>1;r4=this.DealerTile[3]>>1;if(r1>r2){r1^=r2;r2^=r1;r1^=r2}if(r1>r3){r1^=r3;r3^=r1;r1^=r3}if(r1>r4){r1^=r4;r4^=r1;r1^=r4}if(r2>r3){r2^=r3;r3^=r2;r2^=r3}if(r2>r4){r2^=r4;r4^=r2;r2^=r4}if(r3>r4){r3^=r4;r4^=r3;r3^=r4}this.DealerComb=(r1<<12)|(r2<<8)|(r3<<4)|r4;this.DealerHand=UniqueID[this.DealerComb];var delay=0;for(var x=0;x<4;x++){Obj("playertile"+x).style.left="800px";Obj("playertile"+x).style.top="0px";Obj("playertile"+x+"b").className="v"+TileClass[this.PlayerTile[x]];Obj("dealertile"+x).style.left="800px";Obj("dealertile"+x).style.top="0px";Obj("dealertile"+x+"b").className="vtile_blank";Show("playertile"+x);Show("dealertile"+x)}delay=Slide("playertile0",{x:800,y:0},{x:294,y:380},100,100,delay);delay=Flip("playertile0b",50,"vtile_blank","v"+TileClass[this.PlayerTile[0]],delay);delay=Slide("playertile1",{x:800,y:0},{x:348,y:380},100,100,delay);delay=Flip("playertile1b",50,"vtile_blank","v"+TileClass[this.PlayerTile[1]],delay);delay=Slide("playertile2",{x:800,y:0},{x:402,y:380},100,100,delay);delay=Flip("playertile2b",50,"vtile_blank","v"+TileClass[this.PlayerTile[2]],delay);delay=Slide("playertile3",{x:800,y:0},{x:456,y:380},100,100,delay);delay=Flip("playertile3b",50,"vtile_blank","v"+TileClass[this.PlayerTile[3]],delay);delay=Slide("dealertile0",{x:800,y:0},{x:294,y:30},100,100,delay);delay=Slide("dealertile1",{x:800,y:0},{x:348,y:30},100,100,delay);delay=Slide("dealertile2",{x:800,y:0},{x:402,y:30},100,100,delay);delay=Slide("dealertile3",{x:800,y:0},{x:456,y:30},100,100,delay);setTimeout("Obj('playerhand').innerHTML = Font.DrawString('Select 2 tiles');",delay);setTimeout("Game.State = 1; Game.Update();",delay)};this.Split=function(){this.HotSpot[7].Enabled=false;this.HotSpot[8].Enabled=false;Hide("btn_split");Hide("btn_houseway");if(Obj("Warning").checked){var hw=parseInt((this.PlayerBanker?OptimalPB:OptimalDB).substr(this.PlayerHand,1));var comb=this.PlayerComb;var ohi,olo,phi,plo;switch(hw){case 1:ohi=HandRank[(((comb>>12)&15)<<4)|((comb>>8)&15)];olo=HandRank[(((comb>>4)&15)<<4)|((comb>>0)&15)];break;case 2:ohi=HandRank[(((comb>>12)&15)<<4)|((comb>>4)&15)];olo=HandRank[(((comb>>8)&15)<<4)|((comb>>0)&15)];break;case 3:ohi=HandRank[(((comb>>12)&15)<<4)|((comb>>0)&15)];olo=HandRank[(((comb>>8)&15)<<4)|((comb>>4)&15)];break}var t1=this.PlayerTile[0]>>1;var t2=this.PlayerTile[1]>>1;var t3=this.PlayerTile[2]>>1;var t4=this.PlayerTile[3]>>1;if(this.PlayerSet[0]&&this.PlayerSet[1]){phi=HandRank[(t1<<4)|t2];plo=HandRank[(t3<<4)|t4]}if(this.PlayerSet[0]&&this.PlayerSet[2]){phi=HandRank[(t1<<4)|t3];plo=HandRank[(t2<<4)|t4]}if(this.PlayerSet[0]&&this.PlayerSet[3]){phi=HandRank[(t1<<4)|t4];plo=HandRank[(t2<<4)|t3]}if(this.PlayerSet[1]&&this.PlayerSet[2]){phi=HandRank[(t2<<4)|t3];plo=HandRank[(t1<<4)|t4]}if(this.PlayerSet[1]&&this.PlayerSet[3]){phi=HandRank[(t2<<4)|t4];plo=HandRank[(t1<<4)|t3]}if(this.PlayerSet[2]&&this.PlayerSet[3]){phi=HandRank[(t3<<4)|t4];plo=HandRank[(t1<<4)|t2]}if(olo>ohi){ohi^=olo;olo^=ohi;ohi^=olo}if(plo>phi){phi^=plo;plo^=phi;phi^=plo}if((plo!=olo)||(phi!=ohi)){if(!confirm("That is not the best play.  Are you sure you want to continue?")){this.HotSpot[7].Enabled=true;this.HotSpot[8].Enabled=true;Show("btn_split");Show("btn_houseway");return}}}this.SetPlayerHand()};this.SetPlayerHand=function(){var delay=0;Obj("playerlo0").style.left="285px";Obj("playerlo0").style.top="380px";Obj("playerlo1").style.left="339px";Obj("playerlo1").style.top="380px";Obj("playerhi0").style.left="410px";Obj("playerhi0").style.top="378px";Obj("playerhi1").style.left="410px";Obj("playerhi1").style.top="432px";var start0,end0;var start1,end1;var start2,end2;var start3,end3;var lo0={x:285,y:380};var lo1={x:339,y:380};var hi0={x:435,y:353};var hi1={x:435,y:407};var ph1,ph2;if(this.PlayerSet[0]&&this.PlayerSet[1]){ph1=HandRank[((this.PlayerTile[0]>>1)<<4)|(this.PlayerTile[1]>>1)];ph2=HandRank[((this.PlayerTile[2]>>1)<<4)|(this.PlayerTile[3]>>1)];start0={x:294,y:345};start1={x:348,y:345};start2={x:402,y:380};start3={x:456,y:380};if(ph1>=ph2){end0=hi0;end1=hi1;end2=lo0;end3=lo1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[0]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[1]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[2]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[3]]}else{end0=lo0;end1=lo1;end2=hi0;end3=hi1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[2]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[3]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[0]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[1]]}}else if(this.PlayerSet[0]&&this.PlayerSet[2]){ph1=HandRank[((this.PlayerTile[0]>>1)<<4)|(this.PlayerTile[2]>>1)];ph2=HandRank[((this.PlayerTile[1]>>1)<<4)|(this.PlayerTile[3]>>1)];start0={x:294,y:345};start1={x:348,y:380};start2={x:402,y:345};start3={x:456,y:380};if(ph1>=ph2){end0=hi0;end1=lo0;end2=hi1;end3=lo1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[0]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[2]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[1]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[3]]}else{end0=lo0;end1=hi0;end2=lo1;end3=hi1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[1]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[3]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[0]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[2]]}}else if(this.PlayerSet[0]&&this.PlayerSet[3]){ph1=HandRank[((this.PlayerTile[0]>>1)<<4)|(this.PlayerTile[3]>>1)];ph2=HandRank[((this.PlayerTile[1]>>1)<<4)|(this.PlayerTile[2]>>1)];start0={x:294,y:345};start1={x:348,y:380};start2={x:402,y:380};start3={x:456,y:345};if(ph1>=ph2){end0=hi0;end1=lo0;end2=lo1;end3=hi1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[0]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[3]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[1]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[2]]}else{end0=lo0;end1=hi0;end2=hi1;end3=lo1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[1]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[2]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[0]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[3]]}}else if(this.PlayerSet[1]&&this.PlayerSet[2]){ph1=HandRank[((this.PlayerTile[1]>>1)<<4)|(this.PlayerTile[2]>>1)];ph2=HandRank[((this.PlayerTile[0]>>1)<<4)|(this.PlayerTile[3]>>1)];start0={x:294,y:380};start1={x:348,y:345};start2={x:402,y:345};start3={x:456,y:380};if(ph1>=ph2){end0=lo0;end1=hi0;end2=hi1;end3=lo1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[1]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[2]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[0]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[3]]}else{end0=hi0;end1=lo0;end2=lo1;end3=hi1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[0]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[3]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[1]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[2]]}}else if(this.PlayerSet[1]&&this.PlayerSet[3]){ph1=HandRank[((this.PlayerTile[1]>>1)<<4)|(this.PlayerTile[3]>>1)];ph2=HandRank[((this.PlayerTile[0]>>1)<<4)|(this.PlayerTile[2]>>1)];start0={x:294,y:380};start1={x:348,y:345};start2={x:402,y:380};start3={x:456,y:345};if(ph1>=ph2){end0=lo0;end1=hi0;end2=lo1;end3=hi1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[1]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[3]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[0]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[2]]}else{end0=hi0;end1=lo0;end2=hi1;end3=lo1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[0]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[2]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[1]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[3]]}}else if(this.PlayerSet[2]&&this.PlayerSet[3]){ph1=HandRank[((this.PlayerTile[2]>>1)<<4)|(this.PlayerTile[3]>>1)];ph2=HandRank[((this.PlayerTile[0]>>1)<<4)|(this.PlayerTile[1]>>1)];start0={x:294,y:380};start1={x:348,y:380};start2={x:402,y:345};start3={x:456,y:345};if(ph1>=ph2){end0=lo0;end1=lo1;end2=hi0;end3=hi1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[2]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[3]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[0]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[1]]}else{end0=hi0;end1=hi1;end2=lo0;end3=lo1;Obj("playerhi0").className="h"+TileClass[this.PlayerTile[0]];Obj("playerhi1").className="h"+TileClass[this.PlayerTile[1]];Obj("playerlo0").className="v"+TileClass[this.PlayerTile[2]];Obj("playerlo1").className="v"+TileClass[this.PlayerTile[3]]}}this.PlayerHi=(ph1>=ph2?ph1:ph2);this.PlayerLo=(ph1>=ph2?ph2:ph1);delay=Slide("playertile0",start0,end0,100,250,0);delay=Slide("playertile1",start1,end1,100,250,0);delay=Slide("playertile2",start2,end2,100,250,0);delay=Slide("playertile3",start3,end3,100,250,0);setTimeout("Hide('playertile0'); Hide('playertile1'); Hide('playertile2'); Hide('playertile3');",delay);setTimeout("Show('playerlo0'); Show('playerlo1'); Show('playerhi0'); Show('playerhi1');",delay);setTimeout("Game.Finish();",delay)};this.HouseWay=function(){var delay=0;Hide("btn_split");Hide("btn_houseway");Game.HotSpot[7].Enabled=false;Game.HotSpot[8].Enabled=false;this.PlayerHouseWay=true;Slide("houseway2",{x:800,y:0},{x:460,y:245},100,150,0);delay+=150;var hw=parseInt(HouseWay.substr(this.PlayerHand,1));var comb=this.PlayerComb;var sep;switch(hw){case 1:sep=[(comb>>12)&15,(comb>>8)&15,(comb>>4)&15,(comb>>0)&15];break;case 2:sep=[(comb>>12)&15,(comb>>4)&15,(comb>>8)&15,(comb>>0)&15];break;case 3:sep=[(comb>>12)&15,(comb>>0)&15,(comb>>4)&15,(comb>>8)&15];break}var h1=HandRank[(sep[0]<<4)|sep[1]];var h2=HandRank[(sep[2]<<4)|sep[3]];if(h2>h1){sep[0]^=sep[2];sep[2]^=sep[0];sep[0]^=sep[2];sep[1]^=sep[3];sep[3]^=sep[1];sep[1]^=sep[3]}var hi1,hi2,lo1,lo2,sorted;if((((this.PlayerTile[0]>>1)==sep[0])&&((this.PlayerTile[1]>>1)==sep[1]))||(((this.PlayerTile[0]>>1)==sep[1])&&((this.PlayerTile[1]>>1)==sep[0]))){hi1=0;hi2=1;lo1=2;lo2=3;sorted=[this.PlayerTile[0],this.PlayerTile[1],this.PlayerTile[2],this.PlayerTile[3]]}else if((((this.PlayerTile[0]>>1)==sep[0])&&((this.PlayerTile[2]>>1)==sep[1]))||(((this.PlayerTile[0]>>1)==sep[1])&&((this.PlayerTile[2]>>1)==sep[0]))){hi1=0;hi2=2;lo1=1;lo2=3;sorted=[this.PlayerTile[0],this.PlayerTile[2],this.PlayerTile[1],this.PlayerTile[3]]}else if((((this.PlayerTile[0]>>1)==sep[0])&&((this.PlayerTile[3]>>1)==sep[1]))||(((this.PlayerTile[0]>>1)==sep[1])&&((this.PlayerTile[3]>>1)==sep[0]))){hi1=0;hi2=3;lo1=1;lo2=2;sorted=[this.PlayerTile[0],this.PlayerTile[3],this.PlayerTile[1],this.PlayerTile[2]]}else if((((this.PlayerTile[1]>>1)==sep[0])&&((this.PlayerTile[2]>>1)==sep[1]))||(((this.PlayerTile[1]>>1)==sep[1])&&((this.PlayerTile[2]>>1)==sep[0]))){hi1=1;hi2=2;lo1=0;lo2=3;sorted=[this.PlayerTile[1],this.PlayerTile[2],this.PlayerTile[0],this.PlayerTile[3]]}else if((((this.PlayerTile[1]>>1)==sep[0])&&((this.PlayerTile[3]>>1)==sep[1]))||(((this.PlayerTile[1]>>1)==sep[1])&&((this.PlayerTile[3]>>1)==sep[0]))){hi1=1;hi2=3;lo1=0;lo2=2;sorted=[this.PlayerTile[1],this.PlayerTile[3],this.PlayerTile[0],this.PlayerTile[2]]}else if((((this.PlayerTile[2]>>1)==sep[0])&&((this.PlayerTile[3]>>1)==sep[1]))||(((this.PlayerTile[2]>>1)==sep[1])&&((this.PlayerTile[3]>>1)==sep[0]))){hi1=2;hi2=3;lo1=0;lo2=1;sorted=[this.PlayerTile[2],this.PlayerTile[3],this.PlayerTile[0],this.PlayerTile[1]]}if(!this.PlayerSet[hi1]){this.PlayerSet[hi1]=true;Slide("playertile"+hi1,{x:(hi1*54)+294,y:380},{x:(hi1*54)+294,y:345},100,100,0)}if(!this.PlayerSet[hi2]){this.PlayerSet[hi2]=true;Slide("playertile"+hi2,{x:(hi2*54)+294,y:380},{x:(hi2*54)+294,y:345},100,100,0)}if(this.PlayerSet[lo1]){this.PlayerSet[lo1]=false;Slide("playertile"+lo1,{x:(lo1*54)+294,y:345},{x:(lo1*54)+294,y:380},100,100,0)}if(this.PlayerSet[lo2]){this.PlayerSet[lo2]=false;Slide("playertile"+lo2,{x:(lo2*54)+294,y:345},{x:(lo2*54)+294,y:380},100,100,0)}delay+=100;setTimeout("Obj('playerhand').innerHTML = Font.DrawString(GetPlayText("+sorted+"));",delay);setTimeout("Game.SetPlayerHand();",delay)};this.Finish=function(){var delay=0;delay=Flip("dealertile0b",50,"vtile_blank","v"+TileClass[this.DealerTile[0]],delay);delay=Flip("dealertile1b",50,"vtile_blank","v"+TileClass[this.DealerTile[1]],delay);delay=Flip("dealertile2b",50,"vtile_blank","v"+TileClass[this.DealerTile[2]],delay);delay=Flip("dealertile3b",50,"vtile_blank","v"+TileClass[this.DealerTile[3]],delay);delay+=250;var dhi,dlo,phi,plo;var hw=parseInt(HouseWay.substr(this.DealerHand,1));var comb=this.DealerComb;var sep;switch(hw){case 1:sep=[(comb>>12)&15,(comb>>8)&15,(comb>>4)&15,(comb>>0)&15];break;case 2:sep=[(comb>>12)&15,(comb>>4)&15,(comb>>8)&15,(comb>>0)&15];break;case 3:sep=[(comb>>12)&15,(comb>>0)&15,(comb>>4)&15,(comb>>8)&15];break}var h1=HandRank[(sep[0]<<4)|sep[1]];var h2=HandRank[(sep[2]<<4)|sep[3]];dhi=(h1>h2?h1:h2);dlo=(h1>h2?h2:h1);if(h2>h1){sep[0]^=sep[2];sep[2]^=sep[0];sep[0]^=sep[2];sep[1]^=sep[3];sep[3]^=sep[1];sep[1]^=sep[3]}var start0={x:294,y:30};var start1={x:348,y:30};var start2={x:402,y:30};var start3={x:456,y:30};var lo0={x:285,y:30};var lo1={x:339,y:30};var hi0={x:435,y:3};var hi1={x:435,y:57};var end0,end1,end2,end3;Obj("dealerlo0").style.left="285px";Obj("dealerlo0").style.top="30px";Obj("dealerlo1").style.left="339px";Obj("dealerlo1").style.top="30px";Obj("dealerhi0").style.left="410px";Obj("dealerhi0").style.top="28px";Obj("dealerhi1").style.left="410px";Obj("dealerhi1").style.top="82px";var ihi1,ihi2,ilo1,ilo2,sorted;if((((this.DealerTile[0]>>1)==sep[0])&&((this.DealerTile[1]>>1)==sep[1]))||(((this.DealerTile[0]>>1)==sep[1])&&((this.DealerTile[1]>>1)==sep[0]))){ihi1=0;ihi2=1;ilo1=2;ilo2=3;end0=hi0;end1=hi1;end2=lo0;end3=lo1;sorted=[this.DealerTile[0],this.DealerTile[1],this.DealerTile[2],this.DealerTile[3]]}else if((((this.DealerTile[0]>>1)==sep[0])&&((this.DealerTile[2]>>1)==sep[1]))||(((this.DealerTile[0]>>1)==sep[1])&&((this.DealerTile[2]>>1)==sep[0]))){ihi1=0;ihi2=2;ilo1=1;ilo2=3;end0=hi0;end1=lo0;end2=hi1;end3=lo1;sorted=[this.DealerTile[0],this.DealerTile[2],this.DealerTile[1],this.DealerTile[3]]}else if((((this.DealerTile[0]>>1)==sep[0])&&((this.DealerTile[3]>>1)==sep[1]))||(((this.DealerTile[0]>>1)==sep[1])&&((this.DealerTile[3]>>1)==sep[0]))){ihi1=0;ihi2=3;ilo1=1;ilo2=2;end0=hi0;end1=lo0;end2=lo1;end3=hi1;sorted=[this.DealerTile[0],this.DealerTile[3],this.DealerTile[1],this.DealerTile[2]]}else if((((this.DealerTile[1]>>1)==sep[0])&&((this.DealerTile[2]>>1)==sep[1]))||(((this.DealerTile[1]>>1)==sep[1])&&((this.DealerTile[2]>>1)==sep[0]))){ihi1=1;ihi2=2;ilo1=0;ilo2=3;end0=lo0;end1=hi0;end2=hi1;end3=lo1;sorted=[this.DealerTile[1],this.DealerTile[2],this.DealerTile[0],this.DealerTile[3]]}else if((((this.DealerTile[1]>>1)==sep[0])&&((this.DealerTile[3]>>1)==sep[1]))||(((this.DealerTile[1]>>1)==sep[1])&&((this.DealerTile[3]>>1)==sep[0]))){ihi1=1;ihi2=3;ilo1=0;ilo2=2;end0=lo0;end1=hi0;end2=lo1;end3=hi1;sorted=[this.DealerTile[1],this.DealerTile[3],this.DealerTile[0],this.DealerTile[2]]}else if((((this.DealerTile[2]>>1)==sep[0])&&((this.DealerTile[3]>>1)==sep[1]))||(((this.DealerTile[2]>>1)==sep[1])&&((this.DealerTile[3]>>1)==sep[0]))){ihi1=2;ihi2=3;ilo1=0;ilo2=1;end0=lo0;end1=lo1;end2=hi0;end3=hi1;sorted=[this.DealerTile[2],this.DealerTile[3],this.DealerTile[0],this.DealerTile[1]]}Obj("dealerhi0").className="h"+TileClass[this.DealerTile[ihi1]];Obj("dealerhi1").className="h"+TileClass[this.DealerTile[ihi2]];Obj("dealerlo0").className="v"+TileClass[this.DealerTile[ilo1]];Obj("dealerlo1").className="v"+TileClass[this.DealerTile[ilo2]];Slide("dealertile0",start0,end0,100,250,delay);Slide("dealertile1",start1,end1,100,250,delay);Slide("dealertile2",start2,end2,100,250,delay);Slide("dealertile3",start3,end3,100,250,delay);delay+=250;setTimeout("Hide('dealertile0'); Hide('dealertile1'); Hide('dealertile2'); Hide('dealertile3');",delay);setTimeout("Show('dealerlo0'); Show('dealerlo1'); Show('dealerhi0'); Show('dealerhi1');",delay);setTimeout("Obj('dealerhand').innerHTML = Font.DrawString(GetPlayText("+sorted+"));",delay);delay+=250;phi=this.PlayerHi;plo=this.PlayerLo;var outcome=0;if(this.PlayerBanker){if((dhi<=phi)&&(dlo<=plo)){outcome=1}else if((dhi>phi)&&(dlo>plo)){outcome=-1}}else{if((phi<=dhi)&&(plo<=dlo)){outcome=-1}else if((phi>dhi)&&(plo>dlo)){outcome=1}}switch(outcome){case-1:setTimeout("Obj('message').innerHTML = Font.DrawString('Dealer wins');",delay);this.Wager["bet"].Win=this.Wager["bet"].Bet*-1;delay=this.ChipStack[0].SlideTo(1,this.Wager["bet"].Bet,100,250,delay);setTimeout("Game.ChipStack[1].SetTo(0);",delay);break;case 0:this.Wager["bet"].Win=0;setTimeout("Obj('message').innerHTML = Font.DrawString('Push');",delay);delay=this.ChipStack[0].SlideTo(2,this.Wager["bet"].Bet+this.Wager["bet"].Win,100,250,delay);break;case 1:setTimeout("Obj('message').innerHTML = Font.DrawString('Player wins');",delay);this.Wager["bet"].Win=this.Wager["bet"].Bet*19/20;setTimeout("Game.ChipStack[1].SetTo("+this.Wager["bet"].Win+");",delay);delay=this.ChipStack[1].SlideTo(0,this.Wager["bet"].Win,100,250,delay);delay+=250;delay=this.ChipStack[0].SlideTo(2,this.Wager["bet"].Bet+this.Wager["bet"].Win,100,250,delay);break}setTimeout("Game.State = 2; Game.Update();",delay)};this.GetEventInfo=function(e){var o=Obj("capture");var x=0;var y=0;var a=e.altKey;var c=e.ctrlKey;var s=e.shiftKey;if(e.offsetX||e.offsetY){x=e.offsetX;y=e.offsetY}else{while(o){x+=o.offsetLeft;y+=o.offsetTop;o=o.offsetParent}x=e.pageX-x;y=e.pageY-y}return{X:x,Y:y,Alt:a,Ctrl:c,Shift:s,Button:Game.Button}};this.GlobalMouseDown=function(e){Game.Button=true};this.GlobalMouseUp=function(e){Game.Button=false;Game.IsCapturing=false;for(var h=0;h<Game.HotSpot.length;h++){Game.HotSpot[h].IsCapturing=false}};this.MouseClick=function(e){var evt=Game.GetEventInfo(e?e:window.event);for(var h=0;h<Game.HotSpot.length;h++){if(Game.HotSpot[h].Enabled&&Game.HotSpot[h].Contains(evt.X,evt.Y)&&Game.HotSpot[h].Contains(Game.CaptureStart.X,Game.CaptureStart.Y)){Game.IsCapturing=false;Game.IsHovering=true;Game.HotSpot[h].IsCapturing=false;Game.HotSpot[h].IsHovering=true;Game.HotSpot[h].Click(evt.Alt,evt.Ctrl,evt.Shift)}}};this.MouseDoubleClick=function(e){var evt=Game.GetEventInfo(e?e:window.event);for(var h=0;h<Game.HotSpot.length;h++){if(Game.HotSpot[h].Enabled&&Game.HotSpot[h].Contains(evt.X,evt.Y)&&Game.HotSpot[h].Contains(Game.CaptureStart.X,Game.CaptureStart.Y)){Game.IsCapturing=false;Game.IsHovering=true;Game.HotSpot[h].IsCapturing=false;Game.HotSpot[h].IsHovering=true;Game.HotSpot[h].DoubleClick(evt.Alt,evt.Ctrl,evt.Shift)}}};this.MouseDown=function(e){var evt=Game.GetEventInfo(e?e:window.event);Game.CaptureStart.X=evt.X;Game.CaptureStart.Y=evt.Y;for(var h=0;h<Game.HotSpot.length;h++){if(Game.HotSpot[h].Enabled&&Game.HotSpot[h].Contains(evt.X,evt.Y)){Game.IsCapturing=true;Game.HotSpot[h].IsCapturing=true;Game.HotSpot[h].Down(evt.Alt,evt.Ctrl,evt.Shift)}}};this.MouseMove=function(e){var evt=Game.GetEventInfo(e?e:window.event);var NewCap=false;var NewHov=false;for(var h=0;h<Game.HotSpot.length;h++){if(Game.HotSpot[h].Enabled){if(Game.IsCapturing&&Game.Button){if(Game.HotSpot[h].Contains(evt.X,evt.Y)){if(Game.HotSpot[h].IsCapturing){if(!Game.HotSpot[h].IsHovering){Game.HotSpot[h].IsHovering=true;Game.HotSpot[h].Down(evt.Alt,evt.Ctrl,evt.Shift)}}else{if(Game.HotSpot[h].IsHovering){Game.HotSpot[h].IsHovering=false;Game.HotSpot[h].Leave(evt.Alt,evt.Ctrl,evt.Shift)}}}else{if(Game.HotSpot[h].IsHovering){Game.HotSpot[h].IsHovering=false;Game.HotSpot[h].Leave(evt.Alt,evt.Ctrl,evt.Shift)}}}else{if(Game.HotSpot[h].Contains(evt.X,evt.Y)){if(!Game.HotSpot[h].IsHovering){Game.HotSpot[h].IsHovering=true;Game.HotSpot[h].Hover(evt.Alt,evt.Ctrl,evt.Shift)}}else{if(Game.HotSpot[h].IsHovering){Game.HotSpot[h].IsHovering=false;Game.HotSpot[h].Leave(evt.Alt,evt.Ctrl,evt.Shift)}}}}else{if(Game.HotSpot[h].IsCapturing||Game.HotSpot[h].IsHovering){Game.HotSpot[h].IsCapturing=false;Game.HotSpot[h].IsHovering=false;Game.HotSpot[h].Leave()}}NewCap=(NewCap||Game.HotSpot[h].IsCapturing?true:false);NewHov=(NewHov||Game.HotSpot[h].IsHovering?true:false)}Game.IsCapturing=NewCap;Game.IsHovering=NewHov};this.MouseOut=function(e){Game.IsHovering=false;for(var h=0;h<Game.HotSpot.length;h++){if(Game.HotSpot[h].IsHovering){Game.HotSpot[h].IsHovering=false;Game.HotSpot[h].Leave()}}};this.MouseUp=function(e){var evt=Game.GetEventInfo(e?e:window.event);for(var h=0;h<Game.HotSpot.length;h++){Game.IsCapturing=false;Game.HotSpot[h].IsCapturing=false;if(Game.HotSpot[h].Enabled&&Game.HotSpot[h].Contains(evt.X,evt.Y)){Game.HotSpot[h].IsHovering=true;if(Game.HotSpot[h].IsCapturing){Game.HotSpot[h].Up(evt.Alt,evt.Ctrl,evt.Shift)}else{Game.HotSpot[h].Hover(evt.Alt,evt.Ctrl,evt.Shift)}}else{Game.HotSpot[h].IsHovering=false}}};this.NewHand=function(rebet){Hide("btn_rebet");Hide("btn_newhand");Game.HotSpot[0].Enabled=false;Game.HotSpot[1].Enabled=false;Game.HotSpot[2].Enabled=false;Game.HotSpot[3].Enabled=false;Game.HotSpot[4].Enabled=false;Game.HotSpot[5].Enabled=false;Game.HotSpot[6].Enabled=false;Game.HotSpot[7].Enabled=false;Game.HotSpot[8].Enabled=false;Game.HotSpot[9].Enabled=false;Game.HotSpot[10].Enabled=false;Game.HotSpot[11].Enabled=false;Game.HotSpot[12].Enabled=false;Game.HotSpot[13].Enabled=false;Game.HotSpot[14].Enabled=false;Obj("message").innerHTML="";Obj("dealerhand").innerHTML="";Obj("playerhand").innerHTML="";this.Wager["bet"].LastBet=this.Wager["bet"].Bet;this.Wager["bet"].Bet=0;this.Wager["bet"].Win=0;this.PlayerSet=[false,false,false,false];var delay=0;Slide("dealerlo0",{x:285,y:30},{x:-50,y:-100},100,100,delay);Slide("dealerlo1",{x:339,y:30},{x:-50,y:-100},100,100,delay);Slide("dealerhi0",{x:410,y:28},{x:-100,y:-50},100,100,delay);Slide("dealerhi1",{x:410,y:82},{x:-100,y:-50},100,100,delay);Slide("playerlo0",{x:285,y:380},{x:-50,y:-100},100,100,delay);Slide("playerlo1",{x:339,y:380},{x:-50,y:-100},100,100,delay);Slide("playerhi0",{x:410,y:378},{x:-100,y:-50},100,100,delay);Slide("playerhi1",{x:410,y:432},{x:-100,y:-50},100,100,delay);delay+=100;setTimeout("Hide('dealertile0');",delay);setTimeout("Hide('dealertile1');",delay);setTimeout("Hide('dealertile2');",delay);setTimeout("Hide('dealertile3');",delay);setTimeout("Hide('dealerlo0');",delay);setTimeout("Hide('dealerlo1');",delay);setTimeout("Hide('dealerhi0');",delay);setTimeout("Hide('dealerhi1');",delay);setTimeout("Hide('playertile0');",delay);setTimeout("Hide('playertile1');",delay);setTimeout("Hide('playertile2');",delay);setTimeout("Hide('playertile3');",delay);setTimeout("Hide('playerlo0');",delay);setTimeout("Hide('playerlo1');",delay);setTimeout("Hide('playerhi0');",delay);setTimeout("Hide('playerhi1');",delay);if(this.PlayerBanker){Slide("banker",{x:300,y:240},{x:138,y:24},100,250,0)}else if(Obj("Banking").checked){Slide("banker",{x:138,y:24},{x:300,y:240},100,250,0)}this.PlayerBanker=Obj("Banking").checked&&(!this.PlayerBanker);if(this.PlayerHouseWay){this.PlayerHouseWay=false;Slide("houseway2",{x:460,y:347},{x:800,y:0},100,250,0);Hide("houseway2")}if(rebet){var i=Game.ChipStack[2].Amount;var a=(this.Wager["bet"].LastBet>i?i:this.Wager["bet"].LastBet);Game.ChipStack[0].Increase('bet',a,0,false)}setTimeout("Game.State = 0; Game.Update();",251)};this.Toggle=function(n){this.PlayerSet[n]=!this.PlayerSet[n];if(this.PlayerSet[n]){Slide("playertile"+n,{x:(n*54)+294,y:380},{x:(n*54)+294,y:345},100,100,0)}else{Slide("playertile"+n,{x:(n*54)+294,y:345},{x:(n*54)+294,y:380},100,100,0)}setTimeout("Game.Update();",100)};this.Update=function(){switch(this.State){case 0:if(this.Wager["bet"].Bet>0){Show("btn_deal");Show("btn_clear");this.HotSpot[5].Enabled=true;this.HotSpot[6].Enabled=true}else{Hide("btn_deal");Hide("btn_clear");this.HotSpot[5].Enabled=false;this.HotSpot[6].Enabled=false}Hide("btn_split");Hide("btn_houseway");Hide("btn_rebet");Hide("btn_newhand");Show("chipsel");Show("chipsel0");Show("chipsel1");Show("chipsel2");Show("chipsel3");this.HotSpot[0].Enabled=true;this.HotSpot[1].Enabled=true;this.HotSpot[2].Enabled=true;this.HotSpot[3].Enabled=true;this.HotSpot[4].Enabled=true;this.HotSpot[7].Enabled=false;this.HotSpot[8].Enabled=false;this.HotSpot[9].Enabled=false;this.HotSpot[10].Enabled=false;this.HotSpot[11].Enabled=false;this.HotSpot[12].Enabled=false;this.HotSpot[13].Enabled=false;this.HotSpot[14].Enabled=false;break;case 1:var tc=0;tc+=(this.PlayerSet[0]?1:0);tc+=(this.PlayerSet[1]?1:0);tc+=(this.PlayerSet[2]?1:0);tc+=(this.PlayerSet[3]?1:0);if(tc==2){Show("btn_split");this.HotSpot[7].Enabled=true;if((this.PlayerSet[0]&&this.PlayerSet[1])||(this.PlayerSet[2]&&this.PlayerSet[3])){Obj("playerhand").innerHTML=Font.DrawString(GetPlayText(this.PlayerTile[0],this.PlayerTile[1],this.PlayerTile[2],this.PlayerTile[3]))}else if((this.PlayerSet[0]&&this.PlayerSet[2])||(this.PlayerSet[1]&&this.PlayerSet[3])){Obj("playerhand").innerHTML=Font.DrawString(GetPlayText(this.PlayerTile[0],this.PlayerTile[2],this.PlayerTile[1],this.PlayerTile[3]))}else{Obj("playerhand").innerHTML=Font.DrawString(GetPlayText(this.PlayerTile[0],this.PlayerTile[3],this.PlayerTile[1],this.PlayerTile[2]))}}else{Obj("playerhand").innerHTML=Font.DrawString("Select 2 tiles");Hide("btn_split");this.HotSpot[7].Enabled=false}Hide("btn_deal");Hide("btn_clear");Show("btn_houseway");Hide("btn_rebet");Hide("btn_newhand");this.HotSpot[0].Enabled=false;this.HotSpot[1].Enabled=false;this.HotSpot[2].Enabled=false;this.HotSpot[3].Enabled=false;this.HotSpot[4].Enabled=false;this.HotSpot[5].Enabled=false;this.HotSpot[6].Enabled=false;this.HotSpot[8].Enabled=true;this.HotSpot[9].Enabled=false;this.HotSpot[10].Enabled=false;for(var n=0;n<4;n++){if(this.PlayerSet[n]){this.HotSpot[n+11].Coord=[(n*54)+294,345,(n*54)+344,445]}else{this.HotSpot[n+11].Coord=[(n*54)+294,380,(n*54)+344,480]}}this.HotSpot[11].Enabled=true;this.HotSpot[12].Enabled=true;this.HotSpot[13].Enabled=true;this.HotSpot[14].Enabled=true;break;case 2:Hide("btn_deal");Hide("btn_clear");Hide("btn_split");Hide("btn_houseway");Show("btn_rebet");Show("btn_newhand");this.HotSpot[0].Enabled=false;this.HotSpot[1].Enabled=false;this.HotSpot[2].Enabled=false;this.HotSpot[3].Enabled=false;this.HotSpot[4].Enabled=false;this.HotSpot[5].Enabled=false;this.HotSpot[6].Enabled=false;this.HotSpot[7].Enabled=false;this.HotSpot[8].Enabled=false;this.HotSpot[9].Enabled=true;this.HotSpot[10].Enabled=true;this.HotSpot[11].Enabled=false;this.HotSpot[12].Enabled=false;this.HotSpot[13].Enabled=false;this.HotSpot[14].Enabled=false;break}}}function Slide(id,from,to,fps,ms,delay){var dx=to.x-from.x;var dy=to.y-from.y;var frames=(ms*fps/1000);var speed=ms/frames;var ox=dx/frames;var oy=dy/frames;var o="Obj('"+id+"')";setTimeout(o+".style.left = '"+from.x+"px'; "+o+".style.top = '"+from.y+"px'; Show('"+id+"');",delay);for(frame=0;frame<frames;frame++){delay+=speed;setTimeout(o+".style.left = '"+parseInt(from.x+(frame*ox))+"px'; "+o+".style.top = '"+parseInt(from.y+(frame*oy))+"px';",delay)}delay+=speed;setTimeout(o+".style.left = '"+to.x+"px'; "+o+".style.top = '"+to.y+"px';",delay);return delay};function WagerObject(id,max){this.Bet=0;this.ChipStack=id;this.LastBet=0;this.LastWin=0;this.MaxBet=max;this.Win=0}var Combination=[];var Font=new FontObject();var Game=new GameObject();var HandRank=[];var HouseWay="11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111121111111111111111111111111211121112111211111111111111211112111111111111111111111111111111111111111133131131113111131111131111113111111131111111131111111113111111111131111111111131111111111113111111111111113333133113311133111133111123311111133111111133111122113311111111133111111111133111122112113311112211211211133333313331133311133321123331111133311111133311122113331111111133311111111133311122112113331112211211211111133333333133331133331113333111133331111133331121113333111111133331111111133331121112113333112111211211111111113333333333133333113333311133333111133333111113333311111133333111111133333111111113333311111111111111111111111133333333333323333331133333311133333322113333331111133333311111133333322112113333332211211211111111111111111111133333333333333133333331133333331113333333111133333331111133333331111113333333111111111111111111111111111111111113333333333333333133333333113333333311133333333111133333333111113333333311111111111111111111111111111111111111111133333333333333333313333333331133333333311133333333311113333333331111111111111111111111111111111111111111111111111133333333333333333333133333333331133333333331113333333333111111111111111111111111111111111111111111111111111111111113333333333333333333333133333333333113333333333311111111111111111111111111111111111111111111111111111111111111111111133333333333333333333333313333333333331111111111111111111111111111111111211211111111111111111111111111221111111111111133333331133133333333113313212222222221222222222211111111111211111222221112222221121111111111111222221112122222221122123333333333333312222222221222222222211111111111211111222221112222221121111111111111222221112122222221122121111111111111111133313213232111221222222232132133113313333312223123111333333331112221133233333122231331113333333311122223333333332322233222322332333332233323321233332332113333233331331133211331113233331111133211331113111111111321323213212132133132312312212311132321321132333321112132321221131333321112221112132222322313222222222322333332233323311331333331222312311133333333111222233333333223222332223322222222222333222332212232232222122112231122111211111113333333212323123112322223111333333333133333311222222122332333312233323322233332332213333233331331133211331113233331111133211331113111111131313111111311113111111111111111311323333233222333333233233222223322232223222222223333133113321133111322222222222222322222223133111113331133122223123231213313333311311322112222222221233322233212222222221233322233222211223222212222221132211312233333223333331232312133232222311232133333213333331122322111222222222123332223322222222112221131133333311233323312322223223322112221221223333322333333333333333221121122222333332223112112222322222322331221221121113112222232233233332222222222232222233332222321133313322222223322333222322113331311333132222223223322333222222333333333333332113331322222223223323333222222333333322333233223332333233332323332222222332233322232211333131133313233333332222333231121133313233112222311321133122122211331131133313111131111111331131111133113111111131111111111211222232222232233122123113111311222223223323333222222222223222223333222232113331332222222332233322232211333131133313222222322332233322222233333333333333211333132222222322332333322222233333332233323322333233323333232333222222233223332223221133313113331323333333222233323112113331323311222231133113312222221133113113331311113111111133113111113311311111113111111113222222222223332223321133313113331332233323112233323113113331322112233323112212222322222222";var OptimalDB="11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111121111111111111111111111111211121112111211111111111111211112111111111111111111111111111111111111111133131131113111131111131111113111111131111111131111111113111111111131111111111131111111111113111111111111213333133113311133111133111123311111133111111133111122113311111111133111111111133111122112113311112211211211133333313331133311133321123331111133311111133311122113331111111133311111111133311122112113331112211211211111133333333133331133331113333111133331111133331121113333111111133331111111133331121112113333112111211211111111113333333333133333113333311133333111133333111113333311111133333111111133333112112113333311211211211111111111111133333333333323333331133333311133333322113333331111133333311111133333322112113333332211211211111111111111111111133333333333333133333331133333331113333333111133333331111133333331111113333333111111111111111111111111111111111113333333333333333133333333113333333311133333333111133333333111113333333311111111111111111111111111111111111111111133333333333333333313333333331133333333311133333333311113333333331111111111111111111111111111111111111111111111111133333333333333333333133333333331133333333131113333333313111211111111111111111111111111111111111111111111111111111113333333333333333333333133333333333113333333333311111111111111111111111111111111111111111111111111111111111111111111133333333333333333333333313333333333331111111111111111111111111111111111211211111111111111111111111111221111111111111133333331133133333333113313212222222221222222222211111111111211111222221112222221121111111111111222221112122221221122123333333333333312222222221222222222211111111111211111222221112222221121111111111111222221112122221221122121111111111111111131333213233111221222322232132133113313133312222123111333333231112221131233333122221331113233333311132223333333332322233222322332333332232323321233333332113333233333333333222331223233333131133221332213111111133321323313313132323332312312232313133331321133223331113133331222133223332133221112133232322333222232222322111212211321311331313331222212211122333323111322232333223223223322223322223222222333222232113231332222222222233322233232333333333333222222323312233222212233333333133333311333132122332333332233323322233333332113333233333333333222332223233333131133221332213111111131313113111311113111111111111111111322323233222333323233233311333331233223222222223333333333322233222323222222222222322222223233222223331131121213123221223313332312321322112222222221133322233212222222221133322233221111213222222222221332223312222322222232231232212233233222311222233323223332331123322331222222222123332223322222222222222221113211331133323331322222222222233222333222332222233223323333333222331233222231222222111112133322222222311223231231113312332332333233233322222232322222233332323323333333322222222222333222332111111111113112222222223322333222322333333333333331113331322233232232323233332333333333333333333222222223232332222332222222232233322233212113111333313233333333222333231121111111232113333333331122233222333333333333333111122112211222122111313311113111122112211211111212332222222233122223123111331222233233323333222222222222222223333222332333333332222222232233322233211111111133313222222322332233322222233333333333333111333132222322223332333323232233333333333333322222222223333232233222222223223332223321233313133331323333333322233323112111311111211223333333113222222221333333133331311112211221132213111133311311311112211121113222223222223322223323233333123333333233333212233223212123313322133233333112312222322212222";var OptimalPB="11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111121111111111111111111111111211121112111211111111111111211112111111111111111111111111111111111111111133131131113111131111131111113111111131111111131111111113111111111131111111111131111111111113111111111111213333133113311133111133111123311111133111111133111122113311111111133111111111133111122112113311112211211211133333313331133311133321123331111133311111133311122113331111111133311111111133311122112113331112211211211111133333333133331133331113333111133331111133331121113333111111133331111111133331121112113333112111211211111111113333333333133333113333311133333111133333111113333311111133333111111133333112112113333311211211211111111111111133333333333323333331133333311133333312113333331111133333311111133333322112113333332211211211111111111111111111133333333333333133333331133333331113333333111133333331111133333331111113333333111111111111111111111111111111111113333333333333333133333333113333333311133333333111133333333111113333333311111111111111111111111111111111111111111133333333333333333313333333331133333333311133333333311113333333331111111111111111111111111111111111111111111111111133333333333333333333133333333331133333333131113333333313111211111111111111111111111111111111111111111111111111111113333333333333333333333133333333333113333333333311111111111111111111111111111111111111111111111111111111111111111111133333333333333333333333313333333333331111111111111111111111111111111111211211111111111111111111111111221111111111111133333331133133333333113313212222222221222222222211111111111211111222221112222221121111111111111222221112122221221122123333333333333312222222221222222222211111111111211111222221112222221121111111111111222221112122221221122121111111111111111131313213233111221222322232132133113313333312222123111333333231112221131233333122221331113233333311132223333333332322233222322332333332232323321233333332113333233333333333222331223233333131133221332213111111133321323313313132333332312312232313133333322133223331113133333222133223332133221112133232322313222332222322111212211321311331313331222212211122333323111322232333323223222322223322323222222323222232222232232222222222233322233232333333333333312222323312232222212233313333133333311333131122332333332233323321233333332113333233333333333222332223233333131133221332213111111131313113111311113111111111111311111322323233212333323233233111313311231223222222223333333333322233222323222222222222222222222133222223331131121313122221223113332312321322112222222221233322233212222222221133322233221111213222222222223332223322222322222232231232212233232222311232233333223332331133323331222222222123332223322222222222222221113211331133323331322222222222333222332222332222233223323333333223331333222231222222111112133322222222331222231231113312232332333233332322222232222222233332323323333333322222222222333222332111111111133112222222223322333222322333333333333331113331322223232232323333232332333333333333333222222222233332322332222222232233322233212333131333313233333332222333231121113111133112333333331132223222233333331333333111122112211322131111313311113111122112211211111212332222232233122223123111331222223233323333222222222222222223333222332333333332222222232233322233211331131133313222222222332233322232233333333333333111333132222222223332333322232233333333333333322232222223333232233222222223223332223321233313133331323333333222233323112113311311311222333333113322222221333113133331311113211221133213111113311311111113211111113222222222223332223323233333123333333233333212233323212123313322133233333112312222322212222";var TileClass=["tile_1_2","tile_2_4","tile_1_4","tile_2_3","tile_2_5","tile_3_4","tile_2_6","tile_3_5","tile_3_6","tile_4_5","tile_1_5","tile_1_5","tile_1_6","tile_1_6","tile_4_6","tile_4_6","tile_5_6","tile_5_6","tile_2_2","tile_2_2","tile_3_3","tile_3_3","tile_5_5","tile_5_5","tile_1_3","tile_1_3","tile_4_4","tile_4_4","tile_1_1","tile_1_1","tile_6_6","tile_6_6"];var UniqueID=[];try{var OnLoad=window.onload}catch(e){}window.onload=function(){try{OnLoad()}catch(e){}PrepareData();Obj("capture").onselectstart=function(){return false};Obj("capture").ondragstart=function(){return false};Obj("capture").onmousemove=Game.MouseMove;Obj("capture").onmousedown=Game.MouseDown;Obj("capture").onmouseup=Game.MouseUp;Obj("capture").onclick=Game.MouseClick;Obj("capture").ondblclick=Game.MouseDoubleClick;Obj("capture").onmouseout=Game.MouseOut;document.body.onmousedown=Game.GlobalMouseDown;document.body.onmouseup=Game.GlobalMouseUp;Show("gamemain");Show("chipsel");Show("chipsel0");Show("chipsel1");Show("chipsel2");Show("chipsel3");Show("chipstack0");Show("chipstack1");Show("chipstack2");Show("houseway1");Game.ChipStack[2].SetTo(1000);Obj("game").scrollIntoView();Game.Update()};