
var gameInProgress=false;var leaveGameMsg="";var confirmForfeitMsg="";var forfeitButtonText="";var exitGameText="";var confirmExitGameMsg="";var singlePlayerGame=false;window.onload=function(){new Ajax.Request('/index.php',{method:'post',asynchronous:true,parameters:{action:'ccg',actionType:'ajax',pageAction:'play',subAction:'getLocalizedStrings'},onSuccess:function(transport){var response=transport.responseText.evalJSON();if(response.status=='Success'){leaveGameMsg=response.leaveGameLocalized;confirmForfeitMsg=response.confirmForfeitLocalized;forfeitButtonText=response.forfeitButtonLocalized;exitGameText=response.exitGameButtonLocalized;confirmExitGameMsg=response.confirmExitGameLocalized;}}});}
window.onbeforeunload=function(){if(gameInProgress){return leaveGameMsg;}
else{return;}}
window.onunload=function(){if(!window.onbeforeunload&&gameInProgress){alert(leaveGameMsg);}}
function reloadPage(){gameInProgress=false;window.location.reload();}
function setGameInProgress(inProgress,isSinglePlayer){gameInProgress=inProgress;singlePlayerGame=isSinglePlayer;if(gameInProgress){if(isSinglePlayer){$('forfeitBtn').update(exitGameText);updateEvilPointPool(0);}else{$('forfeitBtn').update(forfeitButtonText);updateEvilPointPool(0);}}
else{$('forfeitBtn').update('');updateEvilPointPool('--');}}
function forfeitCCG(){if(gameInProgress){if(singlePlayerGame){if(confirm(confirmExitGameMsg))
extCall('ccgEmbed','ForfeitGame()');}else{if(confirm(confirmForfeitMsg))
extCall('ccgEmbed','ForfeitGame()');}}}
function updateEvilPointPool(totalValue){$('totalEPPool').update(totalValue);}
function getUserAgent(){return window.navigator.userAgent;}
function showDeckManager(){new Ajax.Request('/index.php',{method:'post',asynchronous:false,parameters:{actionType:'ajax',action:'ccg',pageAction:'showDeckManager'},onSuccess:function(transport){var response=transport.responseText.evalJSON();switch(response.status){case'error':Stackbox.get().activate({content:response.msg});break;case'redirect':window.location.href=response.msg;break;}}});}