/*
 Platform.js <https://mths.be/platform>
 Copyright 2014-2018 Benjamin Tan <https://bnjmnt4n.now.sh/>
 Copyright 2011-2013 John-David Dalton
 Available under MIT license <https://mths.be/mit>
*/
(function(){var a="undefined"!==typeof window&&"undefined"!==typeof window.document?window.document:{},d="undefined"!==typeof module&&module.exports,b="undefined"!==typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,c=function(){for(var b,c=["requestFullscreen exitFullscreen fullscreenElement fullscreenEnabled fullscreenchange fullscreenerror".split(" "),"webkitRequestFullscreen webkitExitFullscreen webkitFullscreenElement webkitFullscreenEnabled webkitfullscreenchange webkitfullscreenerror".split(" "),
"webkitRequestFullScreen webkitCancelFullScreen webkitCurrentFullScreenElement webkitCancelFullScreen webkitfullscreenchange webkitfullscreenerror".split(" "),"mozRequestFullScreen mozCancelFullScreen mozFullScreenElement mozFullScreenEnabled mozfullscreenchange mozfullscreenerror".split(" "),"msRequestFullscreen msExitFullscreen msFullscreenElement msFullscreenEnabled MSFullscreenChange MSFullscreenError".split(" ")],d=0,k=c.length,p={};d<k;d++)if((b=c[d])&&b[1]in a){for(d=0;d<b.length;d++)p[c[0][d]]=
b[d];return p}return!1}(),k={change:c.fullscreenchange,error:c.fullscreenerror},l={request:function(d){var g=c.requestFullscreen;d=d||a.documentElement;if(/5\.1[.\d]* Safari/.test(navigator.userAgent))d[g]();else d[g](b&&Element.ALLOW_KEYBOARD_INPUT)},exit:function(){a[c.exitFullscreen]()},toggle:function(a){this.isFullscreen?this.exit():this.request(a)},onchange:function(a){this.on("change",a)},onerror:function(a){this.on("error",a)},on:function(b,c){var d=k[b];d&&a.addEventListener(d,c,!1)},off:function(b,
c){var d=k[b];d&&a.removeEventListener(d,c,!1)},raw:c};c?(Object.defineProperties(l,{isFullscreen:{get:function(){return!!a[c.fullscreenElement]}},element:{enumerable:!0,get:function(){return a[c.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return!!a[c.fullscreenEnabled]}}}),d?module.exports=l:window.screenfull=l):d?module.exports=!1:window.screenfull=!1})();
(function(){function a(a){a=String(a);return a.charAt(0).toUpperCase()+a.slice(1)}function d(a,b){var d=-1,B=a?a.length:0;if("number"==typeof B&&-1<B&&B<=w)for(;++d<B;)b(a[d],d,a);else c(a,b)}function b(b){b=String(b).replace(/^ +| +$/g,"");return/^(?:webOS|i(?:OS|P))/.test(b)?b:a(b)}function c(a,b){for(var c in a)v.call(a,c)&&b(a[c],c,a)}function k(b){return null==b?a(b):E.call(b).slice(8,-1)}function l(a,b){var c=null!=a?typeof a[b]:"number";return!/^(?:boolean|number|string|undefined)$/.test(c)&&
("object"==c?!!a[b]:!0)}function n(a){return String(a).replace(/([ -])(?!$)/g,"$1?")}function g(a,b){var c=null;d(a,function(d,m){c=b(c,d,m,a)});return c}function m(a){function d(c){return g(c,function(c,d){var e=d.pattern||n(d);!c&&(c=RegExp("\\b"+e+" *\\d+[.\\w_]*","i").exec(a)||RegExp("\\b"+e+" *\\w+-[\\w]*","i").exec(a)||RegExp("\\b"+e+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(a))&&((c=String(d.label&&!RegExp(e,"i").test(d.label)?d.label:c).split("/"))[1]&&!/[\d.]+/.test(c[0])&&(c[0]+=
" "+c[1]),d=d.label||d,c=b(c[0].replace(RegExp(e,"i"),d).replace(RegExp("; *(?:"+d+"[_-])?","i")," ").replace(RegExp("("+d+")[-_.]?(\\w)","i"),"$1 $2")));return c})}function h(b){return g(b,function(b,c){return b||(RegExp(c+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(a)||0)[1]||null})}var y=p,f=a&&"object"==typeof a&&"String"!=k(a);f&&(y=a,a=null);var v=y.navigator||{},u=v.userAgent||"";a||(a=u);var r=f?!!v.likeChrome:/\bChrome\b/.test(a)&&!/internal|\n/i.test(E.toString()),
w=f?"Object":"ScriptBridgingProxyObject",A=f?"Object":"Environment",B=f&&y.java?"JavaPackage":k(y.java),z=f?"Object":"RuntimeObject";A=(B=/\bJava/.test(B)&&y.java)&&k(y.environment)==A;var R=B?"a":"\u03b1",S=B?"b":"\u03b2",N=y.document||{},I=y.operamini||y.opera,K=x.test(K=f&&I?I["[[Class]]"]:k(I))?K:I=null,e,L=a;f=[];var M=null,J=a==u;u=J&&I&&"function"==typeof I.version&&I.version();var C=function(b){return g(b,function(b,c){return b||RegExp("\\b"+(c.pattern||n(c))+"\\b","i").exec(a)&&(c.label||
c)})}([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"]),q=function(b){return g(b,function(b,c){return b||RegExp("\\b"+(c.pattern||n(c))+"\\b","i").exec(a)&&(c.label||c)})}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"Edge"},"Midori","Nook Browser",
"PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},
{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),D=d([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad",
"iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),H=function(b){return g(b,function(b,c,d){return b||(c[D]||c[/^[a-z]+(?: +[a-z]+\b)*/i.exec(D)]||RegExp("\\b"+n(d)+"(?:\\b|\\w*\\d)","i").exec(a))&&d})}({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},
"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),t=function(c){return g(c,function(c,d){var e=d.pattern||n(d);if(!c&&(c=RegExp("\\b"+e+"(?:/[\\d.]+|[ \\w.]*)","i").exec(a))){var f=c,m=d.label||d,g={"10.0":"10","6.4":"10 Technical Preview",
"6.3":"8.1","6.2":"8","6.1":"Server 2008 R2 / 7","6.0":"Server 2008 / Vista","5.2":"Server 2003 / XP 64-bit","5.1":"XP","5.01":"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};e&&m&&/^Win/i.test(f)&&!/^Windows Phone /i.test(f)&&(g=g[/[\d.]+$/.exec(f)])&&(f="Windows "+g);f=String(f);e&&m&&(f=f.replace(RegExp(e,"i"),m));c=f=b(f.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/,
" $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}return c})}(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac",
"Windows 98;","Windows "]);C&&(C=[C]);H&&!D&&(D=d([H]));if(e=/\bGoogle TV\b/.exec(D))D=e[0];/\bSimulator\b/i.test(a)&&(D=(D?D+" ":"")+"Simulator");"Opera Mini"==q&&/\bOPiOS\b/.test(a)&&f.push("running in Turbo/Uncompressed mode");"IE"==q&&/\blike iPhone OS\b/.test(a)?(e=m(a.replace(/like iPhone OS/,"")),H=e.manufacturer,D=e.product):/^iP/.test(D)?(q||(q="Safari"),t="iOS"+((e=/ OS ([\d_]+)/i.exec(a))?" "+e[1].replace(/_/g,"."):"")):"Konqueror"!=q||/buntu/i.test(t)?H&&"Google"!=H&&(/Chrome/.test(q)&&
!/\bMobile Safari\b/i.test(a)||/\bVita\b/.test(D))||/\bAndroid\b/.test(t)&&/^Chrome/.test(q)&&/\bVersion\//i.test(a)?(q="Android Browser",t=/\bAndroid\b/.test(t)?t:"Android"):"Silk"==q?(/\bMobi/i.test(a)||(t="Android",f.unshift("desktop mode")),/Accelerated *= *true/i.test(a)&&f.unshift("accelerated")):"PaleMoon"==q&&(e=/\bFirefox\/([\d.]+)\b/.exec(a))?f.push("identifying as Firefox "+e[1]):"Firefox"==q&&(e=/\b(Mobile|Tablet|TV)\b/i.exec(a))?(t||(t="Firefox OS"),D||(D=e[1])):!q||(e=!/\bMinefield\b/i.test(a)&&
/\b(?:Firefox|Safari)\b/.exec(q))?(q&&!D&&/[\/,]|^[^(]+?\)/.test(a.slice(a.indexOf(e+"/")+8))&&(q=null),(e=D||H||t)&&(D||H||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(t))&&(q=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(t)?t:e)+" Browser")):"Electron"==q&&(e=(/\bChrome\/([\d.]+)\b/.exec(a)||0)[1])&&f.push("Chromium "+e):t="Kubuntu";u||(u=h(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",n(q),"(?:Firefox|Minefield|NetFront)"]));
if(e="iCab"==C&&3<parseFloat(u)&&"WebKit"||/\bOpera\b/.test(q)&&(/\bOPR\b/.test(a)?"Blink":"Presto")||/\b(?:Midori|Nook|Safari)\b/i.test(a)&&!/^(?:Trident|EdgeHTML)$/.test(C)&&"WebKit"||!C&&/\bMSIE\b/i.test(a)&&("Mac OS"==t?"Tasman":"Trident")||"WebKit"==C&&/\bPlayStation\b(?! Vita\b)/i.test(q)&&"NetFront")C=[e];"IE"==q&&(e=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(a)||0)[1])?(q+=" Mobile",t="Windows Phone "+(/\+$/.test(e)?e:e+".x"),f.unshift("desktop mode")):/\bWPDesktop\b/i.test(a)?(q="IE Mobile",t="Windows Phone 8.x",
f.unshift("desktop mode"),u||(u=(/\brv:([\d.]+)/.exec(a)||0)[1])):"IE"!=q&&"Trident"==C&&(e=/\brv:([\d.]+)/.exec(a))&&(q&&f.push("identifying as "+q+(u?" "+u:"")),q="IE",u=e[1]);if(J){if(l(y,"global"))if(B&&(e=B.lang.System,L=e.getProperty("os.arch"),t=t||e.getProperty("os.name")+" "+e.getProperty("os.version")),A){try{u=y.require("ringo/engine").version.join("."),q="RingoJS"}catch(Q){(e=y.system)&&e.global.system==y.system&&(q="Narwhal",t||(t=e[0].os||null))}q||(q="Rhino")}else"object"==typeof y.process&&
!y.process.browser&&(e=y.process)&&("object"==typeof e.versions&&("string"==typeof e.versions.electron?(f.push("Node "+e.versions.node),q="Electron",u=e.versions.electron):"string"==typeof e.versions.nw&&(f.push("Chromium "+u,"Node "+e.versions.node),q="NW.js",u=e.versions.nw)),q||(q="Node.js",L=e.arch,t=e.platform,u=(u=/[\d.]+/.exec(e.version))?u[0]:null));else k(e=y.runtime)==w?(q="Adobe AIR",t=e.flash.system.Capabilities.os):k(e=y.phantom)==z?(q="PhantomJS",u=(e=e.version||null)&&e.major+"."+e.minor+
"."+e.patch):"number"==typeof N.documentMode&&(e=/\bTrident\/(\d+)/i.exec(a))?(u=[u,N.documentMode],(e=+e[1]+4)!=u[1]&&(f.push("IE "+u[1]+" mode"),C&&(C[1]=""),u[1]=e),u="IE"==q?String(u[1].toFixed(1)):u[0]):"number"==typeof N.documentMode&&/^(?:Chrome|Firefox)\b/.test(q)&&(f.push("masking as "+q+" "+u),q="IE",u="11.0",C=["Trident"],t="Windows");t=t&&b(t)}u&&(e=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(u)||/(?:alpha|beta)(?: ?\d)?/i.exec(a+";"+(J&&v.appMinorVersion))||/\bMinefield\b/i.test(a)&&
"a")&&(M=/b/i.test(e)?"beta":"alpha",u=u.replace(RegExp(e+"\\+?$"),"")+("beta"==M?S:R)+(/\d+\+?/.exec(e)||""));if("Fennec"==q||"Firefox"==q&&/\b(?:Android|Firefox OS)\b/.test(t))q="Firefox Mobile";else if("Maxthon"==q&&u)u=u.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(D))"Xbox 360"==D&&(t=null),"Xbox 360"==D&&/\bIEMobile\b/.test(a)&&f.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(q)&&(!q||D||/Browser|Mobi/.test(q))||"Windows CE"!=t&&!/Mobi/i.test(a))if("IE"==q&&J)try{null===y.external&&
f.unshift("platform preview")}catch(Q){f.unshift("embedded")}else(/\bBlackBerry\b/.test(D)||/\bBB10\b/.test(a))&&(e=(RegExp(D.replace(/ +/g," *")+"/([.\\d]+)","i").exec(a)||0)[1]||u)?(e=[e,/BB10/.test(a)],t=(e[1]?(D=null,H="BlackBerry"):"Device Software")+" "+e[0],u=null):this!=c&&"Wii"!=D&&(J&&I||/Opera/.test(q)&&/\b(?:MSIE|Firefox)\b/i.test(a)||"Firefox"==q&&/\bOS X (?:\d+\.){2,}/.test(t)||"IE"==q&&(t&&!/^Win/.test(t)&&5.5<u||/\bWindows XP\b/.test(t)&&8<u||8==u&&!/\bTrident\b/.test(a)))&&!x.test(e=
m.call(c,a.replace(x,"")+";"))&&e.name&&(e="ing as "+e.name+((e=e.version)?" "+e:""),x.test(q)?(/\bIE\b/.test(e)&&"Mac OS"==t&&(t=null),e="identify"+e):(e="mask"+e,q=K?b(K.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(e)&&(t=null),J||(u=null)),C=["Presto"],f.push(e));else q+=" Mobile";if(e=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(a)||0)[1]){e=[parseFloat(e.replace(/\.(\d)$/,".0$1")),e];if("Safari"==q&&"+"==e[1].slice(-1))q="WebKit Nightly",M="alpha",u=e[1].slice(0,-1);else if(u==e[1]||u==(e[2]=
(/\bSafari\/([\d.]+\+?)/i.exec(a)||0)[1]))u=null;e[1]=(/\bChrome\/([\d.]+)/i.exec(a)||0)[1];537.36==e[0]&&537.36==e[2]&&28<=parseFloat(e[1])&&"WebKit"==C&&(C=["Blink"]);J&&(r||e[1])?(C&&(C[1]="like Chrome"),e=e[1]||(e=e[0],530>e?1:532>e?2:532.05>e?3:533>e?4:534.03>e?5:534.07>e?6:534.1>e?7:534.13>e?8:534.16>e?9:534.24>e?10:534.3>e?11:535.01>e?12:535.02>e?"13+":535.07>e?15:535.11>e?16:535.19>e?17:536.05>e?18:536.1>e?19:537.01>e?20:537.11>e?"21+":537.13>e?23:537.18>e?24:537.24>e?25:537.36>e?26:"Blink"!=
C?"27":"28")):(C&&(C[1]="like Safari"),e=(e=e[0],400>e?1:500>e?2:526>e?3:533>e?4:534>e?"4+":535>e?5:537>e?6:538>e?7:601>e?8:"8"));C&&(C[1]+=" "+(e+="number"==typeof e?".x":/[.+]/.test(e)?"":"+"));"Safari"==q&&(!u||45<parseInt(u))&&(u=e)}"Opera"==q&&(e=/\bzbov|zvav$/.exec(t))?(q+=" ",f.unshift("desktop mode"),"zvav"==e?(q+="Mini",u=null):q+="Mobile",t=t.replace(RegExp(" *"+e+"$"),"")):"Safari"==q&&/\bChrome\b/.exec(C&&C[1])&&(f.unshift("desktop mode"),q="Chrome Mobile",u=null,/\bOS X\b/.test(t)?(H=
"Apple",t="iOS 4.3+"):t=null);u&&0==u.indexOf(e=/[\d.]+$/.exec(t))&&-1<a.indexOf("/"+e+"-")&&(t=String(t.replace(e,"")).replace(/^ +| +$/g,""));C&&!/\b(?:Avant|Nook)\b/.test(q)&&(/Browser|Lunascape|Maxthon/.test(q)||"Safari"!=q&&/^iOS/.test(t)&&/\bSafari\b/.test(C[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(q)&&C[1])&&(e=C[C.length-1])&&f.push(e);f.length&&(f=["("+f.join("; ")+")"]);H&&D&&0>D.indexOf(H)&&f.push("on "+H);D&&f.push((/^on /.test(f[f.length-
1])?"":"on ")+D);if(t){var P=(e=/ ([\d.+]+)$/.exec(t))&&"/"==t.charAt(t.length-e[0].length-1);t={architecture:32,family:e&&!P?t.replace(e[0],""):t,version:e?e[1]:null,toString:function(){var a=this.version;return this.family+(a&&!P?" "+a:"")+(64==this.architecture?" 64-bit":"")}}}(e=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(L))&&!/\bi686\b/i.test(L)?(t&&(t.architecture=64,t.family=t.family.replace(RegExp(" *"+e),"")),q&&(/\bWOW64\b/i.test(a)||J&&/\w(?:86|32)$/.test(v.cpuClass||v.platform)&&!/\bWin64; x64\b/i.test(a))&&
f.unshift("32-bit")):t&&/^OS X/.test(t.family)&&"Chrome"==q&&39<=parseFloat(u)&&(t.architecture=64);a||(a=null);y={};y.description=a;y.layout=C&&C[0];y.manufacturer=H;y.name=q;y.prerelease=M;y.product=D;y.ua=a;y.version=q&&u;y.os=t||{architecture:null,family:null,version:null,toString:function(){return"null"}};y.parse=m;y.toString=function(){return this.description||""};y.version&&f.unshift(u);y.name&&f.unshift(q);t&&q&&(t!=String(t).split(" ")[0]||t!=q.split(" ")[0]&&!D)&&f.push(D?"("+t+")":"on "+
t);f.length&&(y.description=f.join(" "));return y}var f={"function":!0,object:!0},p=f[typeof window]&&window||this,A=f[typeof exports]&&exports;f=f[typeof module]&&module&&!module.nodeType&&module;var h=A&&f&&"object"==typeof global&&global;!h||h.global!==h&&h.window!==h&&h.self!==h||(p=h);var w=Math.pow(2,53)-1,x=/\bOpera/;h=Object.prototype;var v=h.hasOwnProperty,E=h.toString,z=m();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(p.platform=z,define(function(){return z})):A&&
f?c(z,function(a,c){A[c]=a}):p.platform=z}).call(this);
function buildIOSMeta(){for(var a=[{name:"viewport",content:"width=device-width, height=device-height, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"},{name:"apple-mobile-web-app-capable",content:"yes"},{name:"apple-mobile-web-app-status-bar-style",content:"black"}],d=0;d<a.length;d++){var b=document.createElement("meta");b.name=a[d].name;b.content=a[d].content;var c=window.document.head.querySelector('meta[name="'+b.name+'"]');c&&c.parentNode.removeChild(c);window.document.head.appendChild(b)}}
function hideIOSFullscreenPanel(){jQuery(".xxx-ios-fullscreen-message").css("display","none");jQuery(".xxx-ios-fullscreen-scroll").css("display","none");jQuery(".xxx-game-iframe-full").removeClass("xxx-game-iframe-iphone-se")}function buildIOSFullscreenPanel(){jQuery("body").append('<div class="xxx-ios-fullscreen-message"><div class="xxx-ios-fullscreen-swipe"></div></div><div class="xxx-ios-fullscreen-scroll"></div>')}
function showIOSFullscreenPanel(){jQuery(".xxx-ios-fullscreen-message").css("display","block");jQuery(".xxx-ios-fullscreen-scroll").css("display","block")}
function __iosResize(){window.scrollTo(0,0);if("iPhone"===platform.product)switch(window.devicePixelRatio){case 2:switch(window.innerWidth){case 568:320!==window.innerHeight&&jQuery(".xxx-game-iframe-full").addClass("xxx-game-iframe-iphone-se");break;case 667:375===window.innerHeight?hideIOSFullscreenPanel():showIOSFullscreenPanel();break;default:hideIOSFullscreenPanel()}break;case 3:switch(window.innerWidth){case 736:414===window.innerHeight?hideIOSFullscreenPanel():showIOSFullscreenPanel();break;
case 724:375===window.innerHeight?hideIOSFullscreenPanel():showIOSFullscreenPanel();break;default:hideIOSFullscreenPanel()}break;default:hideIOSFullscreenPanel()}}function iosResize(){__iosResize();setTimeout(function(){__iosResize()},500)}$(document).ready(function(){platform&&"iPhone"===platform.product&&"Safari"===platform.name&&(buildIOSFullscreenPanel(),buildIOSMeta())});jQuery(window).resize(function(){platform&&"iPhone"===platform.product&&"Safari"===platform.name&&iosResize()});
var s_iScaleFactor=1,s_bIsIphone=!1,s_iOffsetX,s_iOffsetY;
(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(ad|hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|tablet|treo|up\.(browser|link)|vodafone|wap|webos|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||
navigator.vendor||window.opera);$(window).resize(function(){sizeHandler()});function trace(a){console.log(a)}function isChrome(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function isIOS(){var a="iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";");for(-1!==navigator.userAgent.toLowerCase().indexOf("iphone")&&(s_bIsIphone=!0);a.length;)if(navigator.platform===a.pop())return!0;return s_bIsIphone=!1}
function getSize(a){var d=a.toLowerCase(),b=window.document,c=b.documentElement;if(void 0===window["inner"+a])a=c["client"+a];else if(window["inner"+a]!=c["client"+a]){var k=b.createElement("body");k.id="vpw-test-b";k.style.cssText="overflow:scroll";var l=b.createElement("div");l.id="vpw-test-d";l.style.cssText="position:absolute;top:-1000px";l.innerHTML="<style>@media("+d+":"+c["client"+a]+"px){body#vpw-test-b div#vpw-test-d{"+d+":7px!important}}</style>";k.appendChild(l);c.insertBefore(k,b.head);
a=7==l["offset"+a]?c["client"+a]:window["inner"+a];c.removeChild(k)}else a=window["inner"+a];return a}window.addEventListener("orientationchange",onOrientationChange);function onOrientationChange(){window.matchMedia("(orientation: portrait)").matches&&sizeHandler();window.matchMedia("(orientation: landscape)").matches&&sizeHandler()}function getIOSWindowHeight(){return document.documentElement.clientWidth/window.innerWidth*window.innerHeight}
function getHeightOfIOSToolbars(){var a=(0===window.orientation?screen.height:screen.width)-getIOSWindowHeight();return 1<a?a:0}
function sizeHandler(){window.scrollTo(0,1);if($("#canvas")){var a=navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?getIOSWindowHeight():getSize("Height");var d=getSize("Width");_checkOrientation(d,a);var b=Math.min(a/CANVAS_HEIGHT,d/CANVAS_WIDTH),c=CANVAS_WIDTH*b;b*=CANVAS_HEIGHT;if(b<a){var k=a-b;b+=k;c+=CANVAS_WIDTH/CANVAS_HEIGHT*k}else c<d&&(k=d-c,c+=k,b+=CANVAS_HEIGHT/CANVAS_WIDTH*k);k=a/2-b/2;var l=d/2-c/2,n=CANVAS_WIDTH/c;if(l*n<-EDGEBOARD_X||k*n<-EDGEBOARD_Y)b=Math.min(a/(CANVAS_HEIGHT-2*
EDGEBOARD_Y),d/(CANVAS_WIDTH-2*EDGEBOARD_X)),c=CANVAS_WIDTH*b,b*=CANVAS_HEIGHT,k=(a-b)/2,l=(d-c)/2,n=CANVAS_WIDTH/c;s_iOffsetX=-1*l*n;s_iOffsetY=-1*k*n;0<=k&&(s_iOffsetY=0);0<=l&&(s_iOffsetX=0);null!==s_oInterface&&s_oInterface.refreshButtonPos(s_iOffsetX,s_iOffsetY);null!==s_oMenu&&s_oMenu.refreshButtonPos(s_iOffsetX,s_iOffsetY);s_bIsIphone?(canvas=document.getElementById("canvas"),s_oStage.canvas.width=2*c,s_oStage.canvas.height=2*b,canvas.style.width=c+"px",canvas.style.height=b+"px",s_iScaleFactor=
2*Math.min(c/CANVAS_WIDTH,b/CANVAS_HEIGHT),s_oStage.scaleX=s_oStage.scaleY=s_iScaleFactor):s_bMobile||isChrome()?($("#canvas").css("width",c+"px"),$("#canvas").css("height",b+"px")):(s_oStage.canvas.width=c,s_oStage.canvas.height=b,s_iScaleFactor=Math.min(c/CANVAS_WIDTH,b/CANVAS_HEIGHT),s_oStage.scaleX=s_oStage.scaleY=s_iScaleFactor);0>k||(k=(a-b)/2);$("#canvas").css("top",k+"px");$("#canvas").css("left",l+"px");fullscreenHandler()}}
function _checkOrientation(a,d){s_bMobile&&ENABLE_CHECK_ORIENTATION&&(a>d?"landscape"===$(".orientation-msg-container").attr("data-orientation")?($(".orientation-msg-container").css("display","none"),s_oMain.startUpdate()):($(".orientation-msg-container").css("display","block"),s_oMain.stopUpdate()):"portrait"===$(".orientation-msg-container").attr("data-orientation")?($(".orientation-msg-container").css("display","none"),s_oMain.startUpdate()):($(".orientation-msg-container").css("display","block"),
s_oMain.stopUpdate()))}function playSound(a,d,b){return!1===DISABLE_SOUND_MOBILE||!1===s_bMobile?(s_aSounds[a].play(),s_aSounds[a].volume(d),s_aSounds[a].loop(b),s_aSounds[a]):null}function stopSound(a){!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||s_aSounds[a].stop()}function setVolume(a,d){}function setMute(a,d){!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||s_aSounds[a].mute(d)}
function createBitmap(a,d,b){var c=new createjs.Bitmap(a),k=new createjs.Shape;d&&b?k.graphics.beginFill("#fff").drawRect(0,0,d,b):k.graphics.beginFill("#ff0").drawRect(0,0,a.width,a.height);c.hitArea=k;return c}function createSprite(a,d,b,c,k,l){a=null!==d?new createjs.Sprite(a,d):new createjs.Sprite(a);d=new createjs.Shape;d.graphics.beginFill("#000000").drawRect(-b,-c,k,l);a.hitArea=d;return a}
function randomFloatBetween(a,d,b){"undefined"===typeof b&&(b=2);return parseFloat(Math.min(a+Math.random()*(d-a),d).toFixed(b))}function shuffle(a){for(var d=a.length,b,c;0!==d;)c=Math.floor(Math.random()*d),--d,b=a[d],a[d]=a[c],a[c]=b;return a}function formatTime(a){a/=1E3;var d=Math.floor(a/60);a=parseFloat(a-60*d).toFixed(1);var b="";b=10>d?b+("0"+d+":"):b+(d+":");return 10>a?b+("0"+a):b+a}
Array.prototype.sortOn=function(){var a=this.slice();if(!arguments.length)return a.sort();var d=Array.prototype.slice.call(arguments);return a.sort(function(a,c){for(var b=d.slice(),l=b.shift();a[l]==c[l]&&b.length;)l=b.shift();return a[l]==c[l]?0:a[l]>c[l]?1:-1})};function roundDecimal(a,d){var b=Math.pow(10,d);return Math.round(b*a)/b}function tweenVectors(a,d,b,c){c.set(a.getX()+b*(d.getX()-a.getX()),a.getY()+b*(d.getY()-a.getY()));return c}
function NoClickDelay(a){this.element=a;window.Touch&&this.element.addEventListener("touchstart",this,!1)}
NoClickDelay.prototype={handleEvent:function(a){switch(a.type){case "touchstart":this.onTouchStart(a);break;case "touchmove":this.onTouchMove(a);break;case "touchend":this.onTouchEnd(a)}},onTouchStart:function(a){a.preventDefault();this.moved=!1;this.element.addEventListener("touchmove",this,!1);this.element.addEventListener("touchend",this,!1)},onTouchMove:function(a){this.moved=!0},onTouchEnd:function(a){this.element.removeEventListener("touchmove",this,!1);this.element.removeEventListener("touchend",
this,!1);if(!this.moved){a=document.elementFromPoint(a.changedTouches[0].clientX,a.changedTouches[0].clientY);3===a.nodeType&&(a=a.parentNode);var d=document.createEvent("MouseEvents");d.initEvent("click",!0,!0);a.dispatchEvent(d)}}};function ctlArcadeResume(){null!==s_oMain&&s_oMain.startUpdate()}function ctlArcadePause(){null!==s_oMain&&s_oMain.stopUpdate()}
function getParamValue(a){for(var d=window.location.search.substring(1).split("&"),b=0;b<d.length;b++){var c=d[b].split("=");if(c[0]==a)return c[1]}}
(function(){function a(a){var c={focus:"visible",focusin:"visible",pageshow:"visible",blur:"hidden",focusout:"hidden",pagehide:"hidden"};a=a||window.event;a.type in c?document.body.className=c[a.type]:(document.body.className=this[d]?"hidden":"visible","hidden"===document.body.className?s_oMain.stopUpdate():s_oMain.startUpdate())}var d="hidden";d in document?document.addEventListener("visibilitychange",a):(d="mozHidden")in document?document.addEventListener("mozvisibilitychange",a):(d="webkitHidden")in
document?document.addEventListener("webkitvisibilitychange",a):(d="msHidden")in document?document.addEventListener("msvisibilitychange",a):"onfocusin"in document?document.onfocusin=document.onfocusout=a:window.onpageshow=window.onpagehide=window.onfocus=window.onblur=a})();
function fullscreenHandler(){ENABLE_FULLSCREEN&&!1!==screenfull.enabled&&(s_bFullscreen=screen.height<window.innerHeight+3&&screen.height>window.innerHeight-3?!0:!1,null!==s_oInterface&&s_oInterface.resetFullscreenBut(),null!==s_oMenu&&s_oMenu.resetFullscreenBut())}if(screenfull.enabled)screenfull.on("change",function(){s_bFullscreen=screenfull.isFullscreen;null!==s_oInterface&&s_oInterface.resetFullscreenBut();null!==s_oMenu&&s_oMenu.resetFullscreenBut()});
function CSpriteLibrary(){var a,d,b,c,k,l;this.init=function(n,g,m){b=d=0;c=n;k=g;l=m;a={}};this.addSprite=function(c,b){a.hasOwnProperty(c)||(a[c]={szPath:b,oSprite:new Image},d++)};this.getSprite=function(c){return a.hasOwnProperty(c)?a[c].oSprite:null};this._onSpritesLoaded=function(){k.call(l)};this._onSpriteLoaded=function(){c.call(l);++b===d&&this._onSpritesLoaded()};this.loadSprites=function(){for(var c in a)a[c].oSprite.oSpriteLibrary=this,a[c].oSprite.onload=function(){this.oSpriteLibrary._onSpriteLoaded()},
a[c].oSprite.src=a[c].szPath};this.getNumSprites=function(){return d}}
var CANVAS_WIDTH=1920,CANVAS_HEIGHT=768,EDGEBOARD_X=450,EDGEBOARD_Y=0,FONT1="OpenSans-BoldItalic",FONT2="Digital-7",FPS_TIME=1E3/30,DISABLE_SOUND_MOBILE=!1,STATE_LOADING=0,STATE_MENU=1,STATE_HELP=1,STATE_GAME=3,STATE_GAME_WAITING_FOR_BET=0,STATE_GAME_DEAL=1,STATE_GAME_CHOOSE_HOLD=2,STATE_GAME_DRAW=3,STATE_GAME_EVALUATE=4,ON_CARD_SHOWN="ON_CARD_SHOWN",ON_CARD_HIDE="ON_CARD_HIDE",ON_MOUSE_DOWN=0,ON_MOUSE_UP=1,ON_MOUSE_OVER=2,ON_MOUSE_OUT=3,ON_DRAG_START=4,ON_DRAG_END=5,ROYAL_FLUSH=0,STRAIGHT_FLUSH=
1,FOUR_OF_A_KIND=2,FULL_HOUSE=3,FLUSH=4,STRAIGHT=5,THREE_OF_A_KIND=6,TWO_PAIR=7,JACKS_OR_BETTER=8,HIGH_CARD=9,CARD_TWO=2,CARD_THREE=3,CARD_FOUR=4,CARD_FIVE=5,CARD_SIX=6,CARD_SEVEN=7,CARD_EIGHT=8,CARD_NINE=9,CARD_TEN=10,CARD_JACK=11,CARD_QUEEN=12,CARD_KING=13,CARD_ACE=14,SUIT_HEARTS=0,SUIT_DIAMONDS=1,SUIT_CLUBS=2,SUIT_SPADES=3,CARD_WIDTH=154,CARD_HEIGHT=240,BET_TYPE,TOTAL_MONEY,NUM_BETS=5,WIN_COMBINATIONS=9,COMBO_PRIZES,AUTOMATIC_RECHARGE,WIN_OCCURRENCE,GAME_CASH,MIN_WIN,NUM_HAND_FOR_ADS,ENABLE_FULLSCREEN,
ENABLE_CHECK_ORIENTATION;TEXT_GAMEOVER="GAME OVER";TEXT_PLAY="PLAY";TEXT_BET="BET";TEXT_WIN="WIN";TEXT_MONEY="MONEY";TEXT_DEAL="DEAL";TEXT_BET_ONE="BET ONE";TEXT_MAX_BET="BET MAX";TEXT_RECHARGE="RECHARGE";TEXT_EXIT="EXIT";TEXT_DRAW="DRAW";TEXT_NO_WIN="NO WIN";TEXT_CURRENCY="$";TEXT_CREDITS_DEVELOPED="DEVELOPED BY";var TEXT_PRELOADER_CONTINUE="START";TEXT_COMBO="Royal Flush;Straight Flush;Four of a Kind;Full House;Flush;Straight;Three of a Kind;Two Pairs;Jacks or Better".split(";");
TEXT_CONGRATULATIONS="Congratulations!";TEXT_SHARE_1="You collected <strong>";TEXT_SHARE_2=" points</strong>!<br><br>Share your score with your friends!";TEXT_SHARE_3="My score is ";TEXT_SHARE_4=" points! Can you do better?";
function CPreloader(){var a,d,b,c,k,l,n,g,m,f;this._init=function(){s_oSpriteLibrary.init(this._onImagesLoaded,this._onAllImagesLoaded,this);s_oSpriteLibrary.addSprite("progress_bar","./sprites/progress_bar.png");s_oSpriteLibrary.addSprite("200x200","./sprites/200x200.jpg");s_oSpriteLibrary.addSprite("but_start","./sprites/but_start.png");s_oSpriteLibrary.loadSprites();f=new createjs.Container;s_oStage.addChild(f)};this.unload=function(){m.unload();f.removeAllChildren()};this._onImagesLoaded=function(){};
this._onAllImagesLoaded=function(){this.attachSprites();s_oMain.preloaderReady()};this.attachSprites=function(){var p=new createjs.Shape;p.graphics.beginFill("black").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);f.addChild(p);p=s_oSpriteLibrary.getSprite("200x200");n=createBitmap(p);n.regX=.5*p.width;n.regY=.5*p.height;n.x=CANVAS_WIDTH/2;n.y=CANVAS_HEIGHT/2-80;f.addChild(n);g=new createjs.Shape;g.graphics.beginFill("rgba(0,0,0,0.01)").drawRoundRect(n.x-100,n.y-100,200,200,10);f.addChild(g);n.mask=g;p=
s_oSpriteLibrary.getSprite("progress_bar");c=createBitmap(p);c.x=CANVAS_WIDTH/2-p.width/2;c.y=CANVAS_HEIGHT/2+70;f.addChild(c);a=p.width;d=p.height;k=new createjs.Shape;k.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(c.x,c.y,1,d);f.addChild(k);c.mask=k;b=new createjs.Text("","30px "+FONT1,"#fff");b.x=CANVAS_WIDTH/2;b.y=CANVAS_HEIGHT/2+120;b.textBaseline="alphabetic";b.textAlign="center";f.addChild(b);p=s_oSpriteLibrary.getSprite("but_start");m=new CTextButton(CANVAS_WIDTH/2,CANVAS_HEIGHT/2+100,
p,TEXT_PRELOADER_CONTINUE,"Arial","#000",36,f);m.addEventListener(ON_MOUSE_UP,this._onButStartRelease,this);m.setVisible(!1);l=new createjs.Shape;l.graphics.beginFill("black").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);f.addChild(l);createjs.Tween.get(l).to({alpha:0},500).call(function(){createjs.Tween.removeTweens(l);f.removeChild(l)})};this._onButStartRelease=function(){s_oMain._onRemovePreloader()};this.refreshLoader=function(f){b.text=f+"%";100===f&&(m.setVisible(!0),b.visible=!1,c.visible=!1);
k.graphics.clear();f=Math.floor(f*a/100);k.graphics.beginFill("rgba(0,0,0,0.01)").drawRect(c.x,c.y,f,d)};this._init()}
function CMain(a){var d,b=0,c=0,k=STATE_LOADING,l,n;this.initContainer=function(){var a=document.getElementById("canvas");s_oStage=new createjs.Stage(a);createjs.Touch.enable(s_oStage);s_bMobile=jQuery.browser.mobile;!1===s_bMobile&&s_oStage.enableMouseOver(20);s_iPrevTime=(new Date).getTime();createjs.Ticker.framerate=30;createjs.Ticker.addEventListener("tick",this._update);navigator.userAgent.match(/Windows Phone/i)&&(DISABLE_SOUND_MOBILE=!0);s_oSpriteLibrary=new CSpriteLibrary;l=new CPreloader};
this.soundLoaded=function(){b++;l.refreshLoader(Math.floor(b/c*100))};this._initSounds=function(){var a=[];a.push({path:"./sounds/",filename:"card",loop:!1,volume:1,ingamename:"card"});a.push({path:"./sounds/",filename:"press_but",loop:!1,volume:1,ingamename:"press_but"});a.push({path:"./sounds/",filename:"win",loop:!1,volume:1,ingamename:"win"});a.push({path:"./sounds/",filename:"lose",loop:!1,volume:1,ingamename:"lose"});a.push({path:"./sounds/",filename:"press_hold",loop:!1,volume:1,ingamename:"press_hold"});
a.push({path:"./sounds/",filename:"soundtrack",loop:!0,volume:1,ingamename:"soundtrack"});c+=a.length;s_aSounds=[];for(var b=0;b<a.length;b++)s_aSounds[a[b].ingamename]=new Howl({src:[a[b].path+a[b].filename+".mp3"],autoplay:!1,preload:!0,loop:a[b].loop,volume:a[b].volume,onload:s_oMain.soundLoaded})};this._loadImages=function(){s_oSpriteLibrary.init(this._onImagesLoaded,this._onAllImagesLoaded,this);s_oSpriteLibrary.addSprite("bg_menu","./sprites/bg_menu.jpg");s_oSpriteLibrary.addSprite("but_menu_bg",
"./sprites/but_menu_bg.png");s_oSpriteLibrary.addSprite("but_game_bg","./sprites/but_game_bg.png");s_oSpriteLibrary.addSprite("but_exit","./sprites/but_exit.png");s_oSpriteLibrary.addSprite("audio_icon","./sprites/audio_icon.png");s_oSpriteLibrary.addSprite("bg_game","./sprites/bg_game.jpg");s_oSpriteLibrary.addSprite("card_spritesheet","./sprites/card_spritesheet.png");s_oSpriteLibrary.addSprite("msg_box","./sprites/msg_box.png");s_oSpriteLibrary.addSprite("but_left","./sprites/but_left.png");s_oSpriteLibrary.addSprite("but_right",
"./sprites/but_right.png");s_oSpriteLibrary.addSprite("hold","./sprites/hold.png");s_oSpriteLibrary.addSprite("logo_game","./sprites/logo_game.png");s_oSpriteLibrary.addSprite("paytable","./sprites/paytable.png");s_oSpriteLibrary.addSprite("display_bg","./sprites/display_bg.png");s_oSpriteLibrary.addSprite("big_display","./sprites/big_display.png");s_oSpriteLibrary.addSprite("selection","./sprites/selection.png");s_oSpriteLibrary.addSprite("card_selection","./sprites/card_selection.png");s_oSpriteLibrary.addSprite("but_fullscreen",
"./sprites/but_fullscreen.png");s_oSpriteLibrary.addSprite("but_info","./sprites/but_info.png");s_oSpriteLibrary.addSprite("logo_ctl","./sprites/logo_ctl.png");c+=s_oSpriteLibrary.getNumSprites();s_oSpriteLibrary.loadSprites()};this._onImagesLoaded=function(){b++;l.refreshLoader(Math.floor(b/c*100))};this.preloaderReady=function(){this._loadImages();!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||this._initSounds();d=!0};this._onRemovePreloader=function(){l.unload();s_oSoundTrack=playSound("soundtrack",
1,!0);this.gotoMenu()};this._onAllImagesLoaded=function(){};this.gotoMenu=function(){new CMenu;k=STATE_MENU};this.gotoGame=function(){n=new CGame(g);k=STATE_GAME;$(s_oMain).trigger("game_start")};this.gotoHelp=function(){new CHelp;k=STATE_HELP};this.stopUpdate=function(){d=!1;createjs.Ticker.paused=!0;$("#block_game").css("display","block");!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||Howler.mute(!0)};this.startUpdate=function(){s_iPrevTime=(new Date).getTime();d=!0;createjs.Ticker.paused=!1;$("#block_game").css("display",
"none");(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)&&s_bAudioActive&&Howler.mute(!1)};this._update=function(a){if(!1!==d){var c=(new Date).getTime();s_iTimeElaps=c-s_iPrevTime;s_iCntTime+=s_iTimeElaps;s_iCntFps++;s_iPrevTime=c;1E3<=s_iCntTime&&(s_iCurFps=s_iCntFps,s_iCntTime-=1E3,s_iCntFps=0);k===STATE_GAME&&n.update();s_oStage.update(a)}};s_oMain=this;var g=a;ENABLE_FULLSCREEN=g.fullscreen;ENABLE_CHECK_ORIENTATION=g.check_orientation;SHOW_CREDITS=g.show_credits;this.initContainer()}
var s_bMobile,s_bAudioActive=!0,s_iCntTime=0,s_iTimeElaps=0,s_iPrevTime=0,s_iCntFps=0,s_iCurFps=0,s_oDrawLayer,s_oStage,s_oMain=null,s_oSpriteLibrary,s_oSoundTrack=null,s_bFullscreen=!1,s_aSounds;
function CTextButton(a,d,b,c,k,l,n,g){var m,f,p,A,h,w,x,v,E,z,B,F;this._init=function(a,c,b,d,g,k,l,n){m=!1;A=[];h=[];F=n;E=createBitmap(b);f=b.width;p=b.height;n=Math.ceil(l/20);z=new createjs.Text(d,l+"px "+g,"#000000");var y=z.getBounds();z.textAlign="center";z.textBaseline="alphabetic";z.x=b.width/2+n;z.y=Math.floor(b.height/2)+y.height/3+n;B=new createjs.Text(d,l+"px "+g,k);B.textAlign="center";B.textBaseline="alphabetic";B.x=b.width/2;B.y=Math.floor(b.height/2)+y.height/3;v=new createjs.Container;
v.x=a;v.y=c;v.regX=b.width/2;v.regY=b.height/2;v.cursor="pointer";v.addChild(E,z,B);F.addChild(v);this._initListener()};this.unload=function(){v.off("mousedown",w);v.off("pressup",x);F.removeChild(v)};this.setVisible=function(a){v.visible=a};this.enable=function(){m=!1;E.filters=[];E.cache(0,0,f,p)};this.disable=function(){m=!0;var a=(new createjs.ColorMatrix).adjustSaturation(-100);E.filters=[new createjs.ColorMatrixFilter(a)];E.cache(0,0,f,p)};this._initListener=function(){w=v.on("mousedown",this.buttonDown);
x=v.on("pressup",this.buttonRelease)};this.addEventListener=function(a,c,b){A[a]=c;h[a]=b};this.buttonRelease=function(){m||(playSound("press_but",1,!1),v.scaleX=1,v.scaleY=1,A[ON_MOUSE_UP]&&A[ON_MOUSE_UP].call(h[ON_MOUSE_UP]))};this.buttonDown=function(){m||(v.scaleX=.9,v.scaleY=.9,A[ON_MOUSE_DOWN]&&A[ON_MOUSE_DOWN].call(h[ON_MOUSE_DOWN]))};this.setPosition=function(a,c){v.x=a;v.y=c};this.changeText=function(a){B.text=a;z.text=a};this.setX=function(a){v.x=a};this.setY=function(a){v.y=a};this.getButtonImage=
function(){return v};this.getX=function(){return v.x};this.getY=function(){return v.y};this._init(a,d,b,c,k,l,n,g);return this}
function CGfxButton(a,d,b,c){var k,l,n,g,m,f=[],p,A,h;this._init=function(a,b,d){k=!1;g=[];m=[];l=d.width;n=d.height;h=createBitmap(d);h.x=a;h.y=b;h.regX=d.width/2;h.regY=d.height/2;h.cursor="pointer";c.addChild(h);this._initListener()};this.unload=function(){h.off("mousedown",p);h.off("pressup",A);c.removeChild(h)};this.setVisible=function(a){h.visible=a};this._initListener=function(){p=h.on("mousedown",this.buttonDown);A=h.on("pressup",this.buttonRelease)};this.addEventListener=function(a,c,b){g[a]=
c;m[a]=b};this.addEventListenerWithParams=function(a,c,b,d){g[a]=c;m[a]=b;f=d};this.buttonRelease=function(){k||(playSound("press_but",1,!1),h.scaleX=1,h.scaleY=1,g[ON_MOUSE_UP]&&g[ON_MOUSE_UP].call(m[ON_MOUSE_UP],f))};this.buttonDown=function(){k||(h.scaleX=.9,h.scaleY=.9,g[ON_MOUSE_DOWN]&&g[ON_MOUSE_DOWN].call(m[ON_MOUSE_DOWN],f))};this.setPosition=function(a,c){h.x=a;h.y=c};this.setX=function(a){h.x=a};this.setY=function(a){h.y=a};this.enable=function(){k=!1;h.filters=[];h.cache(0,0,l,n)};this.disable=
function(){k=!0;var a=(new createjs.ColorMatrix).adjustSaturation(-100).adjustBrightness(40);h.filters=[new createjs.ColorMatrixFilter(a)];h.cache(0,0,l,n)};this.getButtonImage=function(){return h};this.getX=function(){return h.x};this.getY=function(){return h.y};this._init(a,d,b);return this}
function CToggle(a,d,b,c){var k,l,n,g;this._init=function(a,c,b,d){l=[];n=[];var f=new createjs.SpriteSheet({images:[b],frames:{width:b.width/2,height:b.height,regX:b.width/2/2,regY:b.height/2},animations:{state_true:[0],state_false:[1]}});k=d;g=createSprite(f,"state_"+k,b.width/2/2,b.height/2,b.width/2,b.height);g.x=a;g.y=c;g.stop();g.cursor="pointer";s_oStage.addChild(g);this._initListener()};this.unload=function(){g.off("mousedown",this.buttonDown);g.off("pressup",this.buttonRelease);s_oStage.removeChild(g)};
this._initListener=function(){g.on("mousedown",this.buttonDown);g.on("pressup",this.buttonRelease)};this.addEventListener=function(a,b,c){l[a]=b;n[a]=c};this.setActive=function(a){k=a;g.gotoAndStop("state_"+k)};this.buttonRelease=function(){g.scaleX=1;g.scaleY=1;playSound("press_but",1,!1);k=!k;g.gotoAndStop("state_"+k);l[ON_MOUSE_UP]&&l[ON_MOUSE_UP].call(n[ON_MOUSE_UP],k)};this.buttonDown=function(){g.scaleX=.9;g.scaleY=.9;l[ON_MOUSE_DOWN]&&l[ON_MOUSE_DOWN].call(n[ON_MOUSE_DOWN])};this.setPosition=
function(a,b){g.x=a;g.y=b};this._init(a,d,b,c)}
function CMenu(){var a,d,b,c,k,l,n,g,m,f,p,A=null,h=null,w;this._init=function(){n=createBitmap(s_oSpriteLibrary.getSprite("bg_menu"));s_oStage.addChild(n);var x=s_oSpriteLibrary.getSprite("but_menu_bg");g=new CTextButton(CANVAS_WIDTH/2,CANVAS_HEIGHT-164,x,TEXT_PLAY,FONT1,"#ffffff",40,s_oStage);g.addEventListener(ON_MOUSE_UP,this._onButPlayRelease,this);if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)x=s_oSpriteLibrary.getSprite("audio_icon"),k=CANVAS_WIDTH-x.width/4-10,l=x.height/2+10,f=new CToggle(CANVAS_WIDTH-
x.width/2+20,x.height/2+20,x,s_bAudioActive),f.addEventListener(ON_MOUSE_UP,this._onAudioToggle,this),setVolume("soundtrack",1);SHOW_CREDITS?(x=s_oSpriteLibrary.getSprite("but_info"),a=x.height/2+10,d=x.height/2+10,m=new CGfxButton(a,d,x,s_oStage),m.addEventListener(ON_MOUSE_UP,this._onButCreditsRelease,this),b=a+x.width+10,c=d):(b=x.height/2+10,c=x.height/2+10);x=window.document;var v=x.documentElement;A=v.requestFullscreen||v.mozRequestFullScreen||v.webkitRequestFullScreen||v.msRequestFullscreen;
h=x.exitFullscreen||x.mozCancelFullScreen||x.webkitExitFullscreen||x.msExitFullscreen;!1===ENABLE_FULLSCREEN&&(A=!1);A&&screenfull.enabled&&(x=s_oSpriteLibrary.getSprite("but_fullscreen"),p=new CToggle(b,c,x,s_bFullscreen,!0),p.addEventListener(ON_MOUSE_UP,this._onFullscreenRelease,this));w=new createjs.Shape;w.graphics.beginFill("black").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);s_oStage.addChild(w);createjs.Tween.get(w).to({alpha:0},500).call(function(){w.visible=!1});this.refreshButtonPos(s_iOffsetX,
s_iOffsetY)};this.unload=function(){g.unload();g=null;if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)f.unload(),f=null;A&&screenfull.enabled&&p.unload();SHOW_CREDITS&&m.unload();s_oStage.removeChild(n);n=null;s_oStage.removeChild(w);s_oMenu=w=null};this.refreshButtonPos=function(g,h){!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||f.setPosition(k-g,h+l);A&&screenfull.enabled&&p.setPosition(b+g,c+h);SHOW_CREDITS&&m.setPosition(a+g,d+h)};this._onButPlayRelease=function(){this.unload();$(s_oMain).trigger("start_session");
s_oMain.gotoGame()};this._onAudioToggle=function(){Howler.mute(s_bAudioActive);s_bAudioActive=!s_bAudioActive};this._onButCreditsRelease=function(){new CCreditsPanel};this.resetFullscreenBut=function(){A&&screenfull.enabled&&p.setActive(s_bFullscreen)};this._onFullscreenRelease=function(){s_bFullscreen?h.call(window.document):A.call(window.document.documentElement);sizeHandler()};s_oMenu=this;this._init()}var s_oMenu=null;
function CGame(a){var d,b,c,k,l,n,g,m,f,p,A,h=[],w,x,v,E,z,B,F,G;this._init=function(){s_oPayTableSettings=new CPayTableSettings;c=TOTAL_MONEY;k=GAME_CASH;E=createBitmap(s_oSpriteLibrary.getSprite("bg_game"));s_oStage.addChild(E);G=new createjs.Container;G.x=600;G.y=530;s_oStage.addChild(G);B=new CPayTable(550,149);d=!1;A=n=m=g=0;l=parseFloat(BET_TYPE[g]*(m+1));B.setCreditColumn(m);p=STATE_GAME_WAITING_FOR_BET;z=new CInterface(c,BET_TYPE[g]);F=new CGameOver;x=new CGameSettings;v=new CHandEvaluator;
f=0;w=[];w=x.getShuffledCardDeck();MIN_WIN=COMBO_PRIZES[COMBO_PRIZES.length-1]*BET_TYPE[g]*(m+1);this.placeFakeCardForStarting();setVolume("soundtrack",.5)};this.unload=function(){z.unload();F.unload();s_oStage.removeAllChildren()};this.resetHand=function(){f=n=0;w=[];w=x.getShuffledCardDeck();for(var a=0;a<h.length;a++)h[a].reset();z.resetHand();B.resetHand();this.checkMoney();d=!1;p=STATE_GAME_WAITING_FOR_BET};this.checkMoney=function(){c<l&&(m=g=0,l=parseFloat(BET_TYPE[g]*(m+1)),B.setCreditColumn(m),
c<l?this._gameOver():(z.refreshMoney(c,l),z.refreshBet(BET_TYPE[g])))};this.changeState=function(a){};this.placeFakeCardForStarting=function(){for(var a={images:[s_oSpriteLibrary.getSprite("card_spritesheet")],frames:{width:CARD_WIDTH,height:CARD_HEIGHT,regX:CARD_WIDTH/2,regY:CARD_HEIGHT/2},animations:{card_1_1:[0],card_1_2:[1],card_1_3:[2],card_1_4:[3],card_1_5:[4],card_1_6:[5],card_1_7:[6],card_1_8:[7],card_1_9:[8],card_1_10:[9],card_1_J:[10],card_1_Q:[11],card_1_K:[12],card_2_1:[13],card_2_2:[14],
card_2_3:[15],card_2_4:[16],card_2_5:[17],card_2_6:[18],card_2_7:[19],card_2_8:[20],card_2_9:[21],card_2_10:[22],card_2_J:[23],card_2_Q:[24],card_2_K:[25],card_3_1:[26],card_3_2:[27],card_3_3:[28],card_3_4:[29],card_3_5:[30],card_3_6:[31],card_3_7:[32],card_3_8:[33],card_3_9:[34],card_3_10:[35],card_3_J:[36],card_3_Q:[37],card_3_K:[38],card_4_1:[39],card_4_2:[40],card_4_3:[41],card_4_4:[42],card_4_5:[43],card_4_6:[44],card_4_7:[45],card_4_8:[46],card_4_9:[47],card_4_10:[48],card_4_J:[49],card_4_Q:[50],
card_4_K:[51],back:[52]}},b=0,c=0;5>c;c++){var d=new createjs.SpriteSheet(a);d=createSprite(d,"back",CARD_WIDTH/2,CARD_HEIGHT/2,CARD_WIDTH,CARD_HEIGHT);d.x=b;d.y=0;d.shadow=new createjs.Shadow("#000000",5,5,5);G.addChild(d);b+=180}};this.dealCards=function(){if(!(d||0>=c)){d=!0;G.removeAllChildren();if((k<MIN_WIN?WIN_OCCURRENCE+1:Math.floor(101*Math.random()))>WIN_OCCURRENCE){do this._createCard();while(v.evaluate(h)<HIGH_CARD);b=!1}else this._createCard(),b=!0;c-=l;c=parseFloat(c.toFixed(2));k+=
l;z.refreshMoney(c,l);playSound("card",1,!1);$(s_oMain).trigger("bet_placed",l);p=STATE_GAME_DEAL}};this._createCard=function(){for(var a=0;a<h.length;a++)h[a].unload();a=0;h=[];for(var b=0;5>b;b++){var c=new CCard(a,0,G,w[f].fotogram,w[f].rank,w[f].suit);c.addEventListener(ON_CARD_SHOWN,this._onCardShown);c.addEventListener(ON_CARD_HIDE,this._onCardHide);h.push(c);f++;this._checkDeckLength();a+=180;c.showCard()}};this.drawCards=function(){if(!d){d=!0;playSound("card",1,!1);for(var a=h.length,b=0;b<
h.length;b++)!1===h[b].isHold()&&(h[b].hideCard(),a--);a===h.length&&(p=STATE_GAME_DRAW,this._onCardShown())}};this._checkDeckLength=function(){f>=w.length&&(w=x.getShuffledCardDeck(),f=0)};this.assignWin=function(a){playSound("win",1,!1);for(var b=v.getSortedHand(),d=0;d<h.length;d++)for(var f=0;f<b.length;f++)if(b[f].rank===h[d].getRank()&&b[f].suit===h[d].getSuit()){h[d].highlight();break}B.showWinAnim(m,a);n=s_oPayTableSettings.getWin(m,a)*BET_TYPE[g];c+=n;c=parseFloat(c.toFixed(2));k-=n;z.refreshWin(n);
z.refreshMoney(c,l)};this.recharge=function(){c=TOTAL_MONEY;B.setCreditColumn(m);this.checkMoney();z.refreshMoney(c,l);z.refreshBet(BET_TYPE[g]);F.hide()};this._gameOver=function(){F.show()};this.onCardSelected=function(a){p===STATE_GAME_CHOOSE_HOLD&&a.toggleHold()};this._onCardShown=function(){if(p!==STATE_GAME_CHOOSE_HOLD){switch(p){case STATE_GAME_DEAL:p=STATE_GAME_CHOOSE_HOLD;z.setState(p);break;case STATE_GAME_DRAW:var a=v.evaluate(h);z.setState(p);a!==HIGH_CARD?s_oGame.assignWin(a):(playSound("lose",
1,!1),z.showLosePanel());A++;A===NUM_HAND_FOR_ADS?(A=0,$(s_oMain).trigger("save_score",[c]),$(s_oMain).trigger("show_interlevel_ad")):A===NUM_HAND_FOR_ADS-1&&$(s_oMain).trigger("share_event",[c]);p=STATE_GAME_EVALUATE;break;case STATE_GAME_EVALUATE:z.setState(p)}d=!1}};this._onCardHide=function(){if(p!==STATE_GAME_DRAW){p=STATE_GAME_DRAW;if(b){var a=0;do{s_oGame._changeCardValue();var c=v.evaluate(h);var d=c===HIGH_CARD?0:s_oPayTableSettings.getWin(m,c)*BET_TYPE[g];a++}while((c===HIGH_CARD||k<d)&&
5E3>a);if(5E3<=a){do s_oGame._changeCardValue(),c=v.evaluate(h);while(c<HIGH_CARD);b=!1}}else{do s_oGame._changeCardValue(),c=v.evaluate(h);while(c<HIGH_CARD)}for(a=0;5>a;a++)h[a].setHold(!1)}};this._changeCardValue=function(){for(var a=0;5>a;a++)!1===h[a].isHold()&&(h[a].changeInfo(w[f].fotogram,w[f].rank,w[f].suit),h[a].showCard(),f++,this._checkDeckLength())};this._onButDealRelease=function(){switch(p){case STATE_GAME_WAITING_FOR_BET:this.dealCards();break;case STATE_GAME_CHOOSE_HOLD:this.drawCards();
break;case STATE_GAME_EVALUATE:this.resetHand(),this.dealCards()}};this._onButLeftRelease=function(){if(!(0===g||d||p!==STATE_GAME_WAITING_FOR_BET&&p!==STATE_GAME_EVALUATE)){MIN_WIN=COMBO_PRIZES[COMBO_PRIZES.length-1];g--;var a=parseFloat(BET_TYPE[g]*(m+1));c<a?g++:(l=a,z.refreshMoney(c,l),z.refreshBet(BET_TYPE[g]),MIN_WIN=COMBO_PRIZES[COMBO_PRIZES.length-1]*BET_TYPE[g]*(m+1))}};this._onButRightRelease=function(){if(!(g===BET_TYPE.length-1||d||p!==STATE_GAME_WAITING_FOR_BET&&p!==STATE_GAME_EVALUATE)){g++;
var a=parseFloat(BET_TYPE[g]*(m+1));c<a?g--:(l=a,z.refreshMoney(c,l),z.refreshBet(BET_TYPE[g]),MIN_WIN=COMBO_PRIZES[COMBO_PRIZES.length-1]*BET_TYPE[g]*(m+1))}};this._onButBetOneRelease=function(){if(!(d||p!==STATE_GAME_WAITING_FOR_BET&&p!==STATE_GAME_EVALUATE)){m++;m===NUM_BETS&&(m=0);var a=parseFloat(BET_TYPE[g]*(m+1));c<a?0===m?m=NUM_BETS-1:m--:(l=a,z.refreshMoney(c,l),B.setCreditColumn(m),MIN_WIN=COMBO_PRIZES[COMBO_PRIZES.length-1]*BET_TYPE[g]*(m+1))}};this._onButBetMaxRelease=function(){if(!(d||
p!==STATE_GAME_WAITING_FOR_BET&&p!==STATE_GAME_EVALUATE)){d=!0;m=NUM_BETS-1;var a=parseFloat(BET_TYPE[g]*(m+1));c<a?this._gameOver():(l=a,z.refreshMoney(c,l),B.setCreditColumn(m),MIN_WIN=COMBO_PRIZES[COMBO_PRIZES.length-1]*BET_TYPE[g]*(m+1),this.resetHand(),this.dealCards())}};this.onExit=function(){this.unload();s_oMain.gotoMenu();$(s_oMain).trigger("end_session")};this.update=function(){};s_oGame=this;WIN_OCCURRENCE=a.win_occurrence;GAME_CASH=a.game_cash;BET_TYPE=a.bets;COMBO_PRIZES=a.combo_prizes;
TOTAL_MONEY=a.money;AUTOMATIC_RECHARGE=a.recharge;NUM_HAND_FOR_ADS=a.num_hand_before_ads;this._init()}var s_oGame,s_oPayTableSettings;
function CInterface(a,d){var b,c,k,l,n,g,m,f,p,A,h,w,x,v,E,z,B,F,G,y=null,O=null;this._init=function(a,d){var r=s_oSpriteLibrary.getSprite("but_exit");k=CANVAS_WIDTH-r.width/2-2;l=r.height/2+2;m=new CGfxButton(k,l,r,s_oStage);m.addEventListener(ON_MOUSE_UP,this._onExit,this);!1===DISABLE_SOUND_MOBILE||!1===s_bMobile?(n=m.getX()-r.width,g=r.height/2+2,x=new CToggle(n,g,s_oSpriteLibrary.getSprite("audio_icon"),s_bAudioActive),x.addEventListener(ON_MOUSE_UP,this._onAudioToggle,this),b=n-r.width-10,c=
g):(b=m.getX()-r.width-10,c=r.height/2+2);r=window.document;var u=r.documentElement;y=u.requestFullscreen||u.mozRequestFullScreen||u.webkitRequestFullScreen||u.msRequestFullscreen;O=r.exitFullscreen||r.mozCancelFullScreen||r.webkitExitFullscreen||r.msExitFullscreen;!1===ENABLE_FULLSCREEN&&(y=!1);y&&screenfull.enabled&&(r=s_oSpriteLibrary.getSprite("but_fullscreen"),G=new CToggle(b,c,r,s_bFullscreen,!0),G.addEventListener(ON_MOUSE_UP,this._onFullscreenRelease,this));r=createBitmap(s_oSpriteLibrary.getSprite("display_bg"));
r.x=480;r.y=25;s_oStage.addChild(r);r=new createjs.Text(TEXT_WIN,"21px "+FONT1,"#fff");r.x=490;r.y=32;r.textAlign="center";r.textBaseline="middle";s_oStage.addChild(r);r=createBitmap(s_oSpriteLibrary.getSprite("display_bg"));r.x=480;r.y=93;s_oStage.addChild(r);r=new createjs.Text(TEXT_BET,"21px "+FONT1,"#fff");r.x=490;r.y=100;r.textAlign="center";r.textBaseline="middle";s_oStage.addChild(r);r=createBitmap(s_oSpriteLibrary.getSprite("display_bg"));r.x=470;r.y=687;s_oStage.addChild(r);r=new createjs.Text(TEXT_MONEY,
"21px "+FONT1,"#fff");r.x=490;r.y=695;r.textAlign="center";r.textBaseline="middle";s_oStage.addChild(r);v=new createjs.Text(a.toFixed(2)+TEXT_CURRENCY,"29px "+FONT2,"#ffde00");v.x=590;v.y=CANVAS_HEIGHT-65;v.textAlign="center";s_oStage.addChild(v);z=new createjs.Text(d.toFixed(2)+TEXT_CURRENCY,"29px "+FONT2,"#ffde00");z.x=590;z.y=110;z.textAlign="center";s_oStage.addChild(z);E=new createjs.Text("0"+TEXT_CURRENCY,"29px "+FONT2,"#ffde00");E.x=590;E.y=40;E.textAlign="center";s_oStage.addChild(E);r=createBitmap(s_oSpriteLibrary.getSprite("big_display"));
r.x=770;r.y=686;s_oStage.addChild(r);B=new createjs.Text(d.toFixed(2)+TEXT_CURRENCY,"40px "+FONT2,"#ffde00");B.x=840;B.y=700;B.textAlign="center";s_oStage.addChild(B);r=s_oSpriteLibrary.getSprite("logo_game");u=createBitmap(r);u.x=CANVAS_WIDTH/2;u.y=17;u.regX=r.width/2;s_oStage.addChild(u);r=s_oSpriteLibrary.getSprite("but_left");f=new CGfxButton(744,722,r,s_oStage);f.addEventListener(ON_MOUSE_UP,this._onButLeftRelease,this);r=s_oSpriteLibrary.getSprite("but_right");p=new CGfxButton(930,722,r,s_oStage);
p.addEventListener(ON_MOUSE_UP,this._onButRightRelease,this);r=s_oSpriteLibrary.getSprite("but_game_bg");A=new CTextButton(1040,716,r,TEXT_BET_ONE,FONT1,"#ffffff",23,s_oStage);A.addEventListener(ON_MOUSE_UP,this._onButBetOneRelease,this);h=new CTextButton(1190,716,r,TEXT_MAX_BET,FONT1,"#ffffff",23,s_oStage);h.addEventListener(ON_MOUSE_UP,this._onButBetMaxRelease,this);w=new CTextButton(1340,716,r,TEXT_DEAL,FONT1,"#ffffff",30,s_oStage);w.addEventListener(ON_MOUSE_UP,this._onButDealRelease,this);F=
new createjs.Container;F.visible=!1;F.x=710;F.y=500;s_oStage.addChild(F);r=new createjs.Shape;r.graphics.beginFill("rgba(0,0,0,0.7)").drawRect(0,0,500,100);F.addChild(r);r=new createjs.Text(TEXT_NO_WIN,"50px "+FONT1,"#fff");r.x=250;r.y=20;r.textAlign="center";F.addChild(r);this.refreshButtonPos(s_iOffsetX,s_iOffsetY)};this.unload=function(){m.unload();f.unload();p.unload();A.unload();h.unload();w.unload();if(!1===DISABLE_SOUND_MOBILE||!1===s_bMobile)x.unload(),x=null;y&&screenfull.enabled&&G.unload();
s_oInterface=null};this.refreshButtonPos=function(a,d){m.setPosition(k-a,d+l);!1!==DISABLE_SOUND_MOBILE&&!1!==s_bMobile||x.setPosition(n-a,d+g);y&&screenfull.enabled&&G.setPosition(b-a,c+d)};this.setState=function(a){switch(a){case STATE_GAME_CHOOSE_HOLD:w.changeText(TEXT_DRAW);break;case STATE_GAME_DRAW:case STATE_GAME_EVALUATE:w.changeText(TEXT_DEAL)}};this.resetHand=function(){this.refreshWin(0);F.visible=!1};this.refreshMoney=function(a,b){v.text=a.toFixed(2)+TEXT_CURRENCY;z.text=b.toFixed(2)+
TEXT_CURRENCY};this.refreshWin=function(a){E.text=a.toFixed(2)+TEXT_CURRENCY};this.refreshBet=function(a){B.text=a.toFixed(2)+TEXT_CURRENCY};this.showLosePanel=function(){F.visible=!0};this._onButLeftRelease=function(){s_oGame._onButLeftRelease()};this._onButRightRelease=function(){s_oGame._onButRightRelease()};this._onButBetOneRelease=function(){s_oGame._onButBetOneRelease()};this._onButBetMaxRelease=function(){s_oGame._onButBetMaxRelease()};this._onButDealRelease=function(){s_oGame._onButDealRelease()};
this._onExit=function(){s_oGame.onExit()};this._onAudioToggle=function(){Howler.mute(s_bAudioActive);s_bAudioActive=!s_bAudioActive};this.resetFullscreenBut=function(){y&&screenfull.enabled&&G.setActive(s_bFullscreen)};this._onFullscreenRelease=function(){s_bFullscreen?O.call(window.document):y.call(window.document.documentElement);sizeHandler()};s_oInterface=this;this._init(a,d);return this}var s_oInterface=null;
function CGameSettings(){var a,d;this._init=function(){var b=-1;a=[];for(var c=0;52>c;c++){var d=(c+1)%13;1===d?(d=14,b++):0===d&&(d=13);a.push({fotogram:c,rank:d,suit:b})}};this.timeToString=function(a){a=Math.round(a/1E3);var c=Math.floor(a/60);a-=60*c;var b="";b=10>c?b+("0"+c+":"):b+(c+":");return 10>a?b+("0"+a):b+a};this.getShuffledCardDeck=function(){for(var b=[],c=0;c<a.length;c++)b[c]=a[c];for(d=[];0<b.length;)d.push(b.splice(Math.round(Math.random()*(b.length-1)),1)[0]);return d};this.getCardValue=
function(a){return(void 0)[a]};this._init()}
function CCard(a,d,b,c,k,l){var n,g,m,f,p,A,h,w,x,v,E;this._init=function(a,c,b,d,k,l){n=!1;E=b;g=d;m=k;f=l;b=s_oSpriteLibrary.getSprite("card_spritesheet");b=new createjs.SpriteSheet({images:[b],frames:{width:CARD_WIDTH,height:CARD_HEIGHT,regX:CARD_WIDTH/2,regY:CARD_HEIGHT/2},animations:{card_1_1:[0],card_1_2:[1],card_1_3:[2],card_1_4:[3],card_1_5:[4],card_1_6:[5],card_1_7:[6],card_1_8:[7],card_1_9:[8],card_1_10:[9],card_1_J:[10],card_1_Q:[11],card_1_K:[12],card_2_1:[13],card_2_2:[14],card_2_3:[15],
card_2_4:[16],card_2_5:[17],card_2_6:[18],card_2_7:[19],card_2_8:[20],card_2_9:[21],card_2_10:[22],card_2_J:[23],card_2_Q:[24],card_2_K:[25],card_3_1:[26],card_3_2:[27],card_3_3:[28],card_3_4:[29],card_3_5:[30],card_3_6:[31],card_3_7:[32],card_3_8:[33],card_3_9:[34],card_3_10:[35],card_3_J:[36],card_3_Q:[37],card_3_K:[38],card_4_1:[39],card_4_2:[40],card_4_3:[41],card_4_4:[42],card_4_5:[43],card_4_6:[44],card_4_7:[45],card_4_8:[46],card_4_9:[47],card_4_10:[48],card_4_J:[49],card_4_Q:[50],card_4_K:[51],
back:[52]}});h=createSprite(b,"back",CARD_WIDTH/2,CARD_HEIGHT/2,CARD_WIDTH,CARD_HEIGHT);h.x=a;h.y=c;h.stop();h.shadow=new createjs.Shadow("#000000",5,5,5);E.addChild(h);b=s_oSpriteLibrary.getSprite("hold");w=createBitmap(b);w.regX=b.width/2;w.x=a;w.y=c+76;w.visible=!1;E.addChild(w);b=s_oSpriteLibrary.getSprite("card_selection");v=createBitmap(b);v.x=a;v.y=c;v.regX=b.width/2;v.regY=b.height/2;v.visible=!1;E.addChild(v);x=new createjs.Shape;x.graphics.beginFill("rgba(255,255,255,0.01)").drawRect(a-
CARD_WIDTH/2,c-CARD_HEIGHT/2,CARD_WIDTH,CARD_HEIGHT);x.on("click",this._onSelected);x.cursor="pointer";E.addChild(x);p=[];A=[]};this.unload=function(){x.off("click",this._onSelected);E.removeChild(h)};this.reset=function(){n=!1;v.visible=!1;h.shadow=new createjs.Shadow("#000000",5,5,5)};this.addEventListener=function(a,b,c){p[a]=b;A[a]=c};this.changeInfo=function(a,b,c){g=a;m=b;f=c};this.setValue=function(){h.gotoAndStop(g);var a=this;createjs.Tween.get(h).to({scaleX:1},200).call(function(){a.cardShown()})};
this.setHold=function(a){n=a;w.visible=n};this.toggleHold=function(){createjs.Tween.hasActiveTweens(h)||(n=!n,w.visible=n,playSound("press_hold",1,!1))};this.showCard=function(){var a=this;createjs.Tween.get(h).to({scaleX:.1},200).call(function(){a.setValue()})};this.hideCard=function(){var a=this;createjs.Tween.get(h).to({scaleX:.1},200).call(function(){a.setBack()})};this.setBack=function(){h.gotoAndStop("back");var a=this;createjs.Tween.get(h).to({scaleX:1},200).call(function(){a.cardHidden()})};
this.cardShown=function(){p[ON_CARD_SHOWN]&&p[ON_CARD_SHOWN].call(A[ON_CARD_SHOWN])};this.cardHidden=function(){p[ON_CARD_HIDE]&&p[ON_CARD_HIDE].call(A[ON_CARD_HIDE],this)};this.highlight=function(){h.shadow=new createjs.Shadow("#fff000",0,0,15);v.visible=!0};this._onSelected=function(){s_oGame.onCardSelected(z)};this.getRank=function(){return m};this.getSuit=function(){return f};this.getFotogram=function(){return g};this.isHold=function(){return n};var z=this;this._init(a,d,b,c,k,l)}
function CGameOver(){var a,d,b,c;this._init=function(){c=new createjs.Container;s_oStage.addChild(c);var k=createBitmap(s_oSpriteLibrary.getSprite("msg_box"));c.addChild(k);a=new createjs.Text(TEXT_GAMEOVER,"32px "+FONT1,"#fff");a.textAlign="center";a.x=CANVAS_WIDTH/2;a.y=290;a.shadow=new createjs.Shadow("#000000",2,2,2);c.addChild(a);d=new CTextButton(CANVAS_WIDTH/2-100,450,s_oSpriteLibrary.getSprite("but_game_bg"),TEXT_RECHARGE,FONT1,"#fff",14,c);d.addEventListener(ON_MOUSE_UP,this._onRecharge,
this);b=new CTextButton(CANVAS_WIDTH/2+100,450,s_oSpriteLibrary.getSprite("but_game_bg"),TEXT_EXIT,FONT1,"#fff",14,c);b.addEventListener(ON_MOUSE_UP,this._onExit,this);this.hide()};this.unload=function(){d.unload();b.unload()};this.show=function(){c.visible=!0};this.hide=function(){c.visible=!1};this._onRecharge=function(){AUTOMATIC_RECHARGE&&s_oGame.recharge();$(s_oMain).trigger("recharge")};this._onExit=function(){$(s_oMain).trigger("end_session");s_oGame.onExit()};this._init()}
function CPayTable(a,d){var b,c,k,l,n;this._init=function(a,d){b=0;n=new createjs.Container;n.x=a;n.y=d;s_oStage.addChild(n);var f=createBitmap(s_oSpriteLibrary.getSprite("paytable"));n.addChild(f);f=278;var g=4;c=[];for(var m=0;m<NUM_BETS;m++){var h=createBitmap(s_oSpriteLibrary.getSprite("selection"));h.visible=!1;h.x=f;h.y=g;n.addChild(h);c.push(h);f+=100}f=275;g=27;l=[];for(m=0;m<WIN_COMBINATIONS;m++)h=new createjs.Text(TEXT_COMBO[m],"22px "+FONT1,"#fff000"),h.x=f,h.y=g,h.textAlign="right",h.textBaseline=
"middle",n.addChild(h),g+=22,l[m]=h;f=375;k=[];for(m=0;m<NUM_BETS;m++){g=27;k[m]=[];for(h=0;h<WIN_COMBINATIONS;h++){var w=new createjs.Text(s_oPayTableSettings.getWin(m,h),"22px "+FONT1,"#fff000");w.x=f;w.y=g;w.textAlign="right";w.textBaseline="middle";n.addChild(w);g+=22;k[m][h]=w}f+=100}};this.resetHand=function(){createjs.Tween.removeAllTweens();for(var a=0;a<NUM_BETS;a++)for(var b=0;b<WIN_COMBINATIONS;b++)k[a][b].alpha=1;for(a=0;a<WIN_COMBINATIONS;a++)l[a].alpha=1};this.setCreditColumn=function(a){for(var b=
0;b<NUM_BETS;b++)c[b].visible=!1;c[a].visible=!0};this.showWinAnim=function(a,c){var d=this;createjs.Tween.get(k[a][c]).to({alpha:b},100).call(function(){d.showWinAnim(a,c)});createjs.Tween.get(l[c]).to({alpha:b},100);b=1===b?0:1};this._init(a,d)}function CPayTableSettings(){var a;this._init=function(){a=[];for(var d=0;d<NUM_BETS;d++){a[d]=[];for(var b=0;b<WIN_COMBINATIONS;b++)a[d][b]=COMBO_PRIZES[b]*(d+1)}};this.getWin=function(d,b){return a[d][b]};this._init()}
function CHandEvaluator(){var a,d;this.evaluate=function(b){a=[];for(var c=0;c<b.length;c++)a[c]={rank:b[c].getRank(),suit:b[c].getSuit()};a.sort(this.compareRank);d=[0,1,2,3,4];return this.rankHand()};this.rankHand=function(){if(this._checkForRoyalFlush())return ROYAL_FLUSH;if(this._checkForStraightFlush())return STRAIGHT_FLUSH;if(this._checkForFourOfAKind())return FOUR_OF_A_KIND;if(this._checkForFullHouse())return FULL_HOUSE;if(this._checkForFlush())return FLUSH;if(this._checkForStraight())return STRAIGHT;
if(this._checkForThreeOfAKind())return THREE_OF_A_KIND;if(this._checkForTwoPair())return TWO_PAIR;if(this._checkForOnePair())return JACKS_OR_BETTER;this._identifyHighCard();return HIGH_CARD};this._checkForRoyalFlush=function(){return this._isRoyalStraight()&&this._isFlush()?!0:!1};this._checkForStraightFlush=function(){return this._isStraight()&&this._isFlush()?!0:!1};this._checkForFourOfAKind=function(){return a[0].rank===a[3].rank?(a.splice(4,1),d.splice(4,1),!0):a[1].rank===a[4].rank?(a.splice(0,
1),d.splice(0,1),!0):!1};this._checkForFullHouse=function(){return a[0].rank===a[1].rank&&a[2].rank===a[4].rank||a[0].rank===a[2].rank&&a[3].rank===a[4].rank?!0:!1};this._checkForFlush=function(){return this._isFlush()?!0:!1};this._checkForStraight=function(){return this._isStraight()?!0:!1};this._checkForThreeOfAKind=function(){return a[0].rank===a[1].rank&&a[0].rank===a[2].rank?(a.splice(3,1),a.splice(3,1),d.splice(3,1),d.splice(3,1),!0):a[1].rank===a[2].rank&&a[1].rank===a[3].rank?(a.splice(0,
1),a.splice(3,1),d.splice(0,1),d.splice(3,1),!0):a[2].rank===a[3].rank&&a[2].rank===a[4].rank?(a.splice(0,1),a.splice(0,1),d.splice(0,1),d.splice(0,1),!0):!1};this._checkForTwoPair=function(){return a[0].rank===a[1].rank&&a[2].rank===a[3].rank?(a.splice(4,1),d.splice(4,1),!0):a[1].rank===a[2].rank&&a[3].rank===a[4].rank?(a.splice(0,1),d.splice(0,1),!0):a[0].rank===a[1].rank&&a[3].rank===a[4].rank?(a.splice(2,1),d.splice(2,1),!0):!1};this._checkForOnePair=function(){for(var b=0;4>b;b++)if(a[b].rank===
a[b+1].rank&&a[b].rank>CARD_TEN){var c=a[b],k=a[b+1];a=[];a.push(c);a.push(k);d=[b,b+1];return!0}return!1};this._identifyHighCard=function(){for(var b=0;4>b;b++)a.splice(0,1)};this._isFlush=function(){return a[0].suit===a[1].suit&&a[0].suit===a[2].suit&&a[0].suit===a[3].suit&&a[0].suit===a[4].suit?!0:!1};this._isRoyalStraight=function(){return a[0].rank===CARD_TEN&&a[1].rank===CARD_JACK&&a[2].rank===CARD_QUEEN&&a[3].rank===CARD_KING&&a[4].rank===CARD_ACE?!0:!1};this._isStraight=function(){var b=a[0].rank+
1===a[1].rank&&a[1].rank+1===a[2].rank&&a[2].rank+1===a[3].rank;return b&&a[0].rank===CARD_TWO&&a[4].rank===CARD_ACE?!0:b&&a[3].rank+1===a[4].rank?!0:!1};this.compareRank=function(a,c){return a.rank<c.rank?-1:a.rank>c.rank?1:0};this.getSortedHand=function(){return a};this.getCardIndexInCombo=function(){return d}}
function CCreditsPanel(){var a,d,b,c,k,l,n,g,m,f;this._init=function(){f=new createjs.Container;f.alpha=0;s_oStage.addChild(f);d=createBitmap(s_oSpriteLibrary.getSprite("msg_box"));f.addChild(d);n=new createjs.Shape;n.graphics.beginFill("#0f0f0f").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);n.alpha=.01;n.on("click",this._onLogoButRelease);f.addChild(n);var p=s_oSpriteLibrary.getSprite("but_exit");a=CANVAS_WIDTH/2+240;c=new CGfxButton(a,270,p,f);c.addEventListener(ON_MOUSE_UP,this.unload,this);l=new createjs.Text(TEXT_CREDITS_DEVELOPED,
"34px "+FONT1,"#000");l.textAlign="center";l.textBaseline="alphabetic";l.x=CANVAS_WIDTH/2;l.y=340;l.outline=2;f.addChild(l);k=new createjs.Text(TEXT_CREDITS_DEVELOPED,"34px "+FONT1,"#fff");k.textAlign="center";k.textBaseline="alphabetic";k.x=CANVAS_WIDTH/2;k.y=340;f.addChild(k);p=s_oSpriteLibrary.getSprite("logo_ctl");b=createBitmap(p);b.regX=p.width/2;b.regY=p.height/2;b.x=CANVAS_WIDTH/2;b.y=CANVAS_HEIGHT/2;f.addChild(b);m=new createjs.Text("www.codethislab.com","30px "+FONT1,"#000");m.textAlign=
"center";m.textBaseline="alphabetic";m.x=CANVAS_WIDTH/2;m.y=450;m.outline=2;f.addChild(m);g=new createjs.Text("www.codethislab.com","30px "+FONT1,"#fff");g.textAlign="center";g.textBaseline="alphabetic";g.x=CANVAS_WIDTH/2;g.y=450;f.addChild(g);createjs.Tween.get(f).to({alpha:1},600,createjs.Ease.cubicOut);this.refreshButtonPos(s_iOffsetX,s_iOffsetY)};this.refreshButtonPos=function(a,b){};this.unload=function(){n.off("click",this._onLogoButRelease);c.unload();c=null;s_oStage.removeChild(f)};this._onLogoButRelease=
function(){window.open("http://www.codethislab.com/index.php?&l=en","_blank")};this._init()};