var GodGameClass = {
	BlockAction: false,
	//method
	goQuery: function() {
		if (this.BlockAction) return;
		this.BlockAction = true;
		var hash = $H();
		hash['action'] = 'getAK' + GameType;
		this.DataListQuery(hash, '/func/GodGameFunc.php');
	},
	DataListQuery: function(Vars, Api) {
		var req = new Ajax.Request(Api,
									{method: 'post',
									 parameters: Vars.toQueryString(),
									 onComplete: GodGameClass.QueryDone
									});
	},
	QueryDone: function(r) {
		GodGameClass.BlockAction = false;
		var ResultObj = r.responseText.evalJSON();
		switch (ResultObj.info) {
			case 'getAKmjSuccess':
				window.location = 'http://www.godgame.com.tw/pchome/mj/?secret=' + ResultObj.Data[0].AK;
				break;
			case 'getAKmjFail':
				window.location = '/oops/5';
				break;
			case 'getAKbigtwoSuccess':
				window.location = 'http://www.godgame.com.tw/pchome/bigtwo/?secret=' + ResultObj.Data[0].AK;
				break;
			case 'getAK13pokerSuccess':
				window.location = 'http://www.godgame.com.tw/pchome/13poker/?secret=' + ResultObj.Data[0].AK;
				break;
			case 'getAKbigtwoFail':
				window.location = '/oops/5';
				break;
			case 'ErrorLogin':
				if (typeof(JWASet) == 'undefined') JWASet = {};
				if (typeof(JWASet.CollectConfirmAction) != 'function') {
					JWASet.CollectConfirmAction = function() {
						JumpWinClass.BtnClickAction();
						window.location = LoginLink;
					}
				}//end if
				if (typeof(JWASet.CollectCancelAction) != 'function') {
					JWASet.CollectCancelAction = function() {
						JumpWinClass.BtnClickAction();
					}
				}//end if
				var EventSet = [{id:'Confirm', Subject:'登入', Action:'CollectConfirmAction'}, {id:'Cancel', Subject:'關閉', Action:'CollectCancelAction'}];
				JumpWinClass.Trigger({Msg:'進行遊戲前，請先登入', Events:EventSet, Closeable:false});
				break;
			default:
				//alert(ResultObj.info);
				//$('BtnFBWinConfirm').disabled = false;
				//$('BtnFBWinCancel').disabled = false;
		}//end switch
	},
	ClickAction: function() {
		if (typeof(LoginLink) != 'undefined') {
			if (typeof(JWASet) == 'undefined') JWASet = {};
			if (typeof(JWASet.GameletLoginAction) != 'function') {
				JWASet.GameletLoginAction = function() {
					JumpWinClass.BtnClickAction();
					window.location = LoginLink;
				}
			}//end if
			var EventSet = [{id:'Confirm', Subject:'登入', Action:'GameletLoginAction'}];
			JumpWinClass.Trigger({Msg:'您尚未進行登入, 本遊戲須登入後才能玩', Events:EventSet, Closeable:false});
		} else this.goQuery();
	}
};
/*中文*/