﻿var menuid_click = null;
function getImg(SwfName, Id, menuid) {
    if (SwfDownload) {
        if (menuid_click != null) {
            menuid_click.className = 'menudiv';
        }
        if (menuid != null) {

            menuid.className = 'menudiv1';
            menuid_click = menuid;
        } else {
            menudivover(0);
        }
        $("#workframas").css({ "display": "block" });
        if (getbrowser()) {
            __flash__addCallback(getswf("workframas"), "getSwfName");
        }
        getswf("workframas").getSwfName(SwfName);
        if (getbrowser()) {
            __flash__addCallback(getswf("workframas"), "getImgClassId");
        }
        getswf("workframas").getImgClassId(Id);
    }
}

/*
*u用戶名
*p幣種
*m帳戶餘額
*t存款/取款
*c clubs/clubc
**/

function gameMoney(u) {
    if (jsondata == null)
        GetWebSiteContent();
    var mathId = Math.floor(Math.random() * 9000 + 1000);
    var obj = u.split("|");
    if (obj[2] == "undefined") {
        m = 0;
    }
    if (obj[4] == "undefined" || obj[4] == "" || obj[4] == null) {
        obj[4] = "clubs";
    }
    if (obj[3] == "1") {//存款
        if (obj[4] == "clubc")
            tb_show(jsondata["cktitle"], "mb_order.aspx?cardId=" + obj[0] + "&go=game&c=" + mathId + "&lan=" + lan + "&keepThis=true&TB_iframe=true&height=354&width=800", false);
    } else if (obj[3] == "2") {//取款
        if (obj[4] == "clubs")
            tb_show(jsondata["qktitle"], "salon_Withdrawal.aspx?action=create&go=game&cardId=" + obj[0] + "&money=" + obj[2] + "&lan=" + lan + "&gametype=" + obj[4] + "&moneyChip=" + obj[1] + "&c=" + mathId + "&keepThis=true&TB_iframe=true&height=440&width=800", false);
        else
            tb_show(jsondata["qktitle"], "Salon_Clubcdrawal.aspx?cardId=" + obj[0] + "&money=" + obj[2] + "&gametype=" + obj[4] + "&lan=" + lan + "&moneyChip=" + obj[1] + "&c=" + mathId + "&keepThis=true&TB_iframe=true&height=440&width=800", false);
    }
}
var chaturl = "";
function GetChatUrl(val) {
    chaturl = val;
}
function SetorderChatUrl() {
    return chaturl;
}

function regCallback(xml, cardID, cardPwd, clubtype, clubmoneytype) {
    var jsonreg = jsonRegister(objlan.toString());
    var jsonregdata = eval(jsonreg);
    clubccardID = cardID;
    if (xml == "10040") {
        switch (clubtype) {
            case "clubc":
                var jsonregdata1 = eval(jsonregdata[xml]);
                var jsonregdata40 = eval(eval(jsonregdata1)[clubtype])[clubmoneytype];
                alert(jsonregdata40);
                switch (clubmoneytype) {
                    case "CHY":
                        getclubcImg('order', 0);
                        break;
                    case "HKD":
                        getclubcImg("staffWin", "0");
                        break;
                    case "USD":
                        getclubcImg("staffWin", "0");
                        break;
                }
                break;
            case "clubs":
                alert(jsonregdata[xml][clubtype]);
                window.parent.SetLogin1(1, "salongame");
                break;
        }
    } else
        alert(jsonregdata[xml]);
}


function SetNetMoney(LoginId) {
    var Islan = SetGamelan();
    switch (LoginId.toString()) {
        case "1":
            if (Islan == "1") {
                if (confirm("您确认要立即存款？\r\n请先登陆游戏！"))
                    GetgameLogindefault("salongame");
            }
            else {
                if (confirm("您確認要立即存款？\r\n請先登陸遊戲！"))
                    GetgameLogindefault("salongame");
            }

            break;
        case "2":
            if (Islan == "1") {
                if (confirm("您确认要立即取款？\r\n请先登陆游戏！"))
                    GetgameLogindefault("salongame");
            }
            else {
                if (confirm("您確認要立即取款？\r\n請先登陸遊戲！"))
                    GetgameLogindefault("salongame");
            }
            break;
        case "3":
            GetgameLogindefault("salongame");
            break;
    }
}
function getNetLogin() {
    window.parent.SetLogin1(1, "salongame");
}

function gamePageTitle(path, gameslan) {
    SwitchLan(SetGamelanById(gameslan));

    $.get("/ReceiveResult.aspx?get=webgametitle&lan=" + SetGamelanById(gameslan) + "&gamepath=" + path + "&id=" + Math.floor(Math.random() * 10000), function(data) {
        document.title = data;
    });
}

//clubc
function getclubcImg(SwfName, Id) {
    try {
        if (getbrowser())
            __flash__addcallback(getswf("clubcdiv"), "getSwfName");
        getswf("clubcdiv").getSwfName(SwfName);

        if (getbrowser())
            __flash__addCallback(getswf("clubcdiv"), "getImgClassId");
        getswf("clubcdiv").getImgClassId(Id);
    } catch (err) { }
}

//Club C completed 
var clubccardID = "", clubccardPWD = ""
function clubccard() {
    return clubccardID;
}
function clubccardPWD() {
    return clubccardPWD
}
//推薦人ID
function getzyxId() {
    return zyxId;
}

function ShowPay(content) {
    alert(content);
}

function gotoClubcPremier() {
    window.open("http://www.saloncp.com");
}
function gotoFaceBookes() {
    window.open("http://www.facebook.com/salonintl");
}
function ShowPlaySilve() {
    return showzs;
}
