﻿function loginnet(id){
    if (chooesgame == "1") {				    
		$("#flashcontent").css({"display": "block"});
	 }else {					
		$("#flashcontent").css({"display": "none"});
		$("#username").val("");
		$("#password").val("");
		$("#code").val("");
	}			
}

function Readtelbet(objgamebg){
	var telurl=JsonTelBetUrl();
	var jsontelurl=eval(telurl);
	if ($.trim(jsontelurl[objgamebg]) != "") {
	    $("#unetlogin").css({"display": "block"});
		Isonclick = true;
		Istel = 1;
		$("#telbetform").attr("action", jsontelurl[objgamebg] + "/Default.aspx");
		$("#username").focus();
		document.getElementById("net2").disabled = false;
	}
	else {
		Isonclick = false;
		document.getElementById("net2").disabled = true;
		
	}
}

function getGameTelBet(serivcetel, slan){
	var jsonBytel = JsonTel();
	var telbyjson = eval(jsonBytel);
	var sline = "";	
	var line = serivcetel + "：";
	var objstrTel = telbyjson[gamebg];
	var strTel = objstrTel.split("|");
	$("#telphone").html("");
	$("#telphone").append("<li>"+line+"</li>");
	for (var r = 0; r < strTel.length; r++) {
		$("#telphone").append("<li style=\"margin-right:8px; overflow:hidden;\">"+strTel[r]+"</li>");
	}
	if(slan=="vi_VN"){
	    $("#telphone").css({"font-size":"11px"});
	}else{
	    $("#telphone").css({"font-size":"12px"});
	}
}

function ShowliveChat(){
    onliveChat();    
}

// For Club Live Chat
var newBar;
function onwinlivechat(){
   if(clubccardID!=""){
      SetLogin1(1,"salongame");
   }
   if(MzBrowser.safari){
       oncreateformlivechatardid("1",clubccardID);
    }
   else{
       newBar= window.open("../livechat/Index.aspx?roomid=1&cardId="+clubccardID+"","livechat","height=430, width=550, toolbar= no,directions=no,alwaysRaised=yes,hotkeys =yes, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300");
       newBar.foucs();
   }
}
//For Game Live Chat
var newBars;
function onwinlivechatcardId(roomid,cardid){
   newBars= window.open("../../livechat/Index.aspx?roomid="+roomid+"&cardId="+cardid+"","","height=430, width=550, toolbar= no,directions=no,alwaysRaised=yes,hotkeys =yes, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300");
}
function onwinlivechatclose(){
     $("#basic-modal-content").css({"display":"none"});
}

function oncreateformlivechatardid(roomid,cardid){
    var spb="<form name=\"t\" action=\"../../livechat/Index.aspx?roomid="+roomid+"&cardId="+cardid+"\" target=\"_blank\"></form>";
    $("#webloadbg").html(spb);
    document.t.submit();
}

function livechat(){
    return "open";
}

function CreateframeUrl(Id){
    $("#workframas").css({"display":"none"});
}

function SetLanChange(){
    try{
        if(getbrowser()){
            __flash__addCallback(getswf("workframas"), "SetLanChange");  
        }
        getswf("workframas").SetLanChange();        
    }catch(err){}
    try{
        if(getbrowser()){
            __flash__addCallback(getswf("clubcdiv"), "SetLanChange");  
        }
        getswf("clubcdiv").SetLanChange(); 
    }catch(err){}
}

var menudisplay="";
function menudivover(Id){
    for(var i=1;i<5;i++){
        menudisplay=Id;
        if(i.toString()==Id)
            $("#menu"+Id).css("display")=="none"?$("#menu"+Id).slideDown(1000):$("#menu"+Id).slideUp(1000);            
        else    
            $("#menu"+i).slideUp(1000);
    }    
}

function menuout(menuid){
    if(menuid=="1"){
        for(var i=1;i<5;i++){ 
            $("#menu"+i).css({"display":"none"});
        }
    }
}


var SwfDownload=false;
function ActivateBtn(){
    SwfDownload = true;
}

function mouseover_click(menuid){
    if(menuid!=menuid_click){
        menuid.className='menudiv';
    }
}
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){
      gameMoneyType=true;      
      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"){//存款
         $("#gameMoney").height("354");
         $("#gameMoney").attr("src","http://pay.salon-int.com/order.aspx?cardId="+obj[0]+"&go=game&c="+mathId);
      }else if(obj[3]=="2"){//取款
         $("#gameMoney").attr("height","443");
         $("#gameMoney").attr("src","userReg/salon_Withdrawal.aspx?action=create&go=game&cardId="+obj[0]+"&money="+obj[2]+"&gametype="+obj[4]+"&moneyChip="+obj[1]+"&c="+mathId);
      }      
      gameMoneySize();
}
**/
//u用戶名
//p幣種
//m帳戶餘額
//t存款/取款
//c clubs/clubc
function gameMoney(u,p,m,t){
      gameMoneyType=true;      
      var mathId=Math.floor(Math.random()*9000+1000);
      if(m=="undefined"){
        m=0;
      }        
      if(t=="1"){//存款
         $("#gameMoney").attr("height","354");
         $("#gameMoney").attr("src","http://pay.salon-int.com/order.aspx?cardId="+u+"&go=game&c="+mathId);
      }else if(t=="2"){//取款
        if(p=="HKD")
            $("#gameMoney").attr("height","334");
        else if(p=="CHY")
            $("#gameMoney").attr("height","440");
        else
            $("#gameMoney").attr("height","410");
         $("#gameMoney").attr("src","userReg/salon_Withdrawal.aspx?gameType=clubs&action=create&go=game&cardId="+u+"&money="+m+"&moneyChip="+p+"&c="+mathId);
      }     
      gameMoneySize();
      $("#errorhandler").css("top","100px");
}
function gameMoneySize(){
    if(gameMoneyType){
        errortruefalse = true;
        order_ResizeBoolean=false;
		Errorhtmlevent();
    }
}


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]);
}
//money net Notice
function SetmoneyNotice(){
    return moneyNotice;
}
//1 leftto right 2 righttoleft
function SetNoticeway(){
    return "1,cccccc,14";
}

function SetNetMoney(LoginId){
    var Islan=SetGamelan();
    switch(LoginId.toString()){
        case "1":
            if(Islan=="1"){
                 if(confirm("您确认要立即存款？\r\n请先登陆游戏！"))
                    window.parent.SetLogin1(1,"salongame");
            }    
            else{
                 if(confirm("您確認要立即存款？\r\n請先登陸遊戲！"))
                    window.parent.SetLogin1(1,"salongame");
            }     
            
            break;
        case "2":
            if(Islan=="1"){
                 if(confirm("您确认要立即取款？\r\n请先登陆游戏！"))
                    window.parent.SetLogin1(1,"salongame");
            }    
            else{
                if(confirm("您確認要立即取款？\r\n請先登陸遊戲！"))
                     window.parent.SetLogin1(1,"salongame");
            }
            break;
        case "3":
                 window.parent.SetLogin1(1,"salongame"); 
            break;    
    }
}
function getNetLogin(){
    window.parent.SetLogin1(1,"salongame");
}

function gamePageTitle(path){
    $.ajax({
		url: "../Ajax.aspx?action=l&lan=" + objlan + "&id=" + Math.floor(Math.random() * 10000),
		type: "GET",
		dataType: "html",
		error: function(xml){
			//alert(xml);
		},
		success: function(xml){
		   window.parent.Setpagetitle(path);
		}
	});
}

//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);
}
