
//To be shared by different frames

function runMgGame(gameId, mode) {
    var url = '/mg/gamelaunch.jsp' + '?gameId='+ gameId + '&gameMode=' + mode;
    window.open(url,'oneclick','width=800,height=628,resizable=yes,scrollbars=1');
};

function popWin(url) {	
    window.open(url,'go','width=694,height=588,resizable=yes,scrollbars=1');
};

function playForReal(gameId) {
	var tmp = window.location.href;
	var swFlag = tmp.lastIndexOf("&single-wallet=true") != -1;
	var url;
	
	if (swFlag) {
		url = '/games/launch-game.do?gameId=' + gameId + '&gameMode=real';
	} else {
		url = '/mg/gamelaunch.jsp?gameId='+ gameId + '&gameMode=real';
	}
	window.parent.location=url;
}

function reloadFlash() {
	// do it this way to avoid xss errors
	var myObj = parent.document.getElementById("casinoFrame");
	myObj["src"] = myObj["src"];
}

 

   function GamesPager(tabNames) {
	   
        this.tabList = new Array();
        this.tabIndex = new Array();
		
		
		for(var i = 0; i <tabNames.length; i++)
		{
			this.tabList[this.tabList.length] = tabNames[i];
			this.tabIndex[tabNames[i]] = true;
			
		}
        

        this.activeTabStyle = "mg_tab_active";
        this.inactiveTabStyle = "mg_tab_inactive";
    };

    GamesPager.prototype.switchTab = function (groupId) {

        if (!this.tabIndex[groupId]) {
            // we do not have such tab.
            return;
        }

        for (var i = 0; i < this.tabList.length; i++) {
            var tabElement = document.getElementById("tab_" + this.tabList[i]);
            var tabGroup = document.getElementById("grp_" + this.tabList[i]);

            if (groupId == this.tabList[i]) {
                tabElement.className = this.activeTabStyle;
                tabGroup.style.display = "";
            } else {
                tabElement.className = this.inactiveTabStyle;
                tabGroup.style.display = "none";
            }
        }
    };

    GamesPager.prototype.runGame = function (gameId, mode) {
        runMgGame(gameId, mode);
    };

