下拉导航条制作

<div id="header">
    <!--登录-->
    <div id="hd-login" class="hd-login">
        <div class="mw clearfix">
            <div class="time fleft">
                <label id="timezone">GMT +8&nbsp;&nbsp;</label>
                <label id="time">2015-11-18  15:20:54</label>
            </div>


            <div class="separate fleft"></div>


            <div class="header-lang fleft">
            <div class="flag" id="current-lang">
                <span class="lzhcn"></span>
            </div>
            <!-- 语言切换 start -->
            <div class="lang-switch" id="langSwitch">
                <div class="triangle"></div>
                <ul>
                    
                    <li>
                        <a href="/zh-tw/index.aspx?lang=zh-tw">
                        <span class="flag">
                            <span class="lzhtw"></span>
                        </span>
                        繁体中文
                        </a>
                    </li>
                    <li>
                        <a href="/en-gb/index.aspx?lang=en-gb">
                        <span class="flag">
                            <span class="lengb"></span>
                        </span>
                        English
                        </a>
                    </li>
                    <li>
                        <a href="/vi-vn/index.aspx?lang=vi-vn">
                        <span class="flag">
                            <span class="lvivn"></span>
                        </span>
                        Việt Nam
                        </a>
                    </li>
                </ul>
            </div>
            <!-- 语言切换 end -->
            </div>


            <div id="headerLogin" class="hidden" style="display: block;">
                <form id="loginForm" action="/zh-cn/member/login.aspx?action=login" method="post" novalidate="novalidate">
                <input name="ioBB" id="ioBB" type="hidden">
                <div id="hd-btns" class="fright">
                    <button class="btn-login" id="btn-login">
                        <span title="登录">登录</span></button>
                    <a class="btn-register" href="/zh-cn/member/register.aspx"><span title="注册">注册</span></a>
                    <a class="btn-cs" href="https://uedbet.liaonow.com/?t=1&amp;n=" target="_blank" data-btncs="1">
                        <div class="gif"></div>
                        <span title="在线客服">在线客服</span> </a>
                </div>
                <div class="login-form fright">
                    <div id="username-box">
                        <input id="username" name="username" class="short lf-input" type="text" value="" autocomplete="off" placeholder="会员帐号" tabindex="1">
                        <a href="/zh-cn/help/index.aspx?a=account" class="lf-forget" data-shorttxt="?" data-longtxt="忘记?">
                            忘记?</a>
                    </div>
                    <div id="password-box">
                        <input id="password" name="password" class="short lf-input" type="password" value="" autocomplete="off" placeholder="密码" tabindex="2">
                        <a href="/zh-cn/member/forgotpwd.aspx" class="lf-forget" data-shorttxt="?" title="点击找回密码" data-longtxt="忘记?">忘记?</a>
                    </div>
                </div>
                </form>
            </div>
            <div id="headerPanel" class="logined-nav fright hidden" style="display: none;">
                <div class="fright">
                    <a class="btn-cs loginednav-a" href="https://uedbet.liaonow.com/?t=1&amp;n=" target="_blank" data-btncs="1">
                        <div class="gif"></div>
                        <span title="在线客服">在线客服</span> </a>
                </div>
                <ul class="">
                    <li><a href="/zh-cn/member/message.aspx" title="" class="loginednav-a"><span class="logo-user">
                    </span><span id="lb-membername"></span></a></li>
                    <li class="loginednav-i2"><a class="g-num-tips lognavi2-num" href="/zh-cn/member/message.aspx" id="new-msg"><span></span></a><a href="/zh-cn/member/safeSetting.aspx" title="" class="loginednav-a">个人中心</a> </li>
                    <li><a href="/zh-cn/payment/deposit.aspx" title="" class="loginednav-a">资金管理</a></li>
                    <li><a href="/zh-cn/payment/statement.aspx" title="" class="loginednav-a">催到账</a></li>
                    <li><a href="javascript:void(0)" id="btn-logout" title="" class="loginednav-a">退出</a></li>
                </ul>
            </div>
        </div>
    </div>
    <!--#header-login-->
    <!--导航-->
    <div id="site-nav">
        <div class="mw">
            <div class="site-logo fleft">
                <a href="/zh-cn/index.aspx" title="点击回到首页" id="top_logo_a"></a>
            </div>
            <div class="nav-items clearfix">
                <ul>
                    <li class="item pngFix it_sport" id="nav_sport">
                        <div class="line"></div>
                        <a href="/zh-cn/sportsbook/Default.aspx" target="_self" title="">
                        <span class="txt"></span>
                        <span class="video_logo"></span>
                        <span class="rotate-triangle"></span>
                        </a> 
                    </li>
                    <li class="item pngFix it_csn" id="nav_casino">
                        <div class="line"></div>
                        <a href="/zh-cn/livecasino/Default.aspx" target="_self" title="">
                        <span class="txt"></span>
                        <span class="rotate-triangle"></span>
                        </a>
                    </li>
                    <li class="item pngFix it_keno" id="nav_keno">
                        <div class="line"></div>
                        <a href="/zh-cn/keno/Default.aspx" target="_self" title="">
                        <span class="txt"></span>
                        <span class="rotate-triangle"></span>
                        </a>
                    </li>
                    <li class="item pngFix it_game" id="nav_game">
                        <div class="line"></div>
                        <a href="/zh-cn/betsoft/Default.aspx" target="_self" title="">
                        <span class="txt"></span>
                        <span class="rotate-triangle"></span>
                        </a>
                    </li>
                    <li class="item pngFix it_lotto">
                        <div class="line"></div>
                        <a href="/zh-cn/lotto/Default.aspx" target="_self" title="">
                        <span class="txt"></span>
                        </a>
                    </li>
                    <!-- <li class="item pngFix it_act">
                        <div class="line"></div>
                        <a href="/zh-cn/promotions/promotions.aspx" target="_self" title="">
                        <span class="txt"></span>
                        </a>
                    </li> -->
                    <li class="item pngFix it_promocode" id="nav_coupon">
                        <div class="line"></div>
                        <a href="/zh-cn/promotions/promotions.aspx" target="_self" title="">
                        <span class="txt"></span>
                        <span class="rotate-triangle"></span>
                        </a> 
                    </li>
                    <li class="item pngFix it_mobile">
                        <div class="line"></div>
                        <a href="/zh-cn/mobile/Default.aspx" target="_self" title="">
                        <span class="txt"></span>
                        </a> 
                    </li>
                </ul>
                <div class="lineEnd">
                </div>
            </div>
        </div>
    </div>
    <!--#site-nav-->
    <div class="header_sd">
    </div>
    <div class="nh_csn" style="z-index: 99; height: 0px;">
        <div class="nh_cnt" id="nh_cnt" style="opacity: 0;">
            <div class="nh_dsc">
                <div class="nh_dsc_num">
                </div>
                <div class="nh_dsc_unit">
                    ‰</div>
                <div class="nh_dsc_text">
                    全平台,每天返水<br>
                    无上限</div>
            </div>
            
            <div class="nh_ea">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_ea_dice">
                </div>
                <div class="nh_ea_title">
                </div>
                <div class="nh_ea_info">
                    全球占有率最高的平台</div>
                <div class="nh_ea_start">
                    <a href="javascript:;" class="st">立即游戏</a>
                    <!-- <a href="http://download.uedbet.com/ea/uedbet_ea_cn.exe" class="dl">客户端</a> 
                    <a href="#" class="dl">客户端</a>
                    <a href="#" class="dl">手机版</a> -->
                </div>
                <!--
                <div class="nh_ea_rcm">
                </div> -->
            </div> 
            <div class="nh_gd">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_gd_card">
                </div>
                <div class="nh_gd_title">
                </div>
                <div class="nh_gd_info">
                    最创新,最具特色的平台</div>
                <div class="nh_gd_start">
                    <a href="javascript:;" class="st">立即游戏</a></div>
            </div>
            <div class="nh_kp">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_kp_chips">
                </div>
                <div class="nh_kp_title">
                </div>
                <div class="nh_kp_info">
                    14桌,7画面,最奢华视觉</div>
                <div class="nh_kp_start">
                    <a href="javascript:;" class="st">立即游戏</a></div>
            </div>
            <div class="nh_pt">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_pt_bell">
                </div>
                <div class="nh_pt_title">
                </div>
                <div class="nh_pt_info">
                    全球顶尖公司必选平台</div>
                <div class="nh_pt_start">
                    <a href="javascript:;" class="st">立即游戏</a><a href="javascript:;" class="dl" name_attr="pt">客户端下载</a></div>
                <div class="nh_pt_rcm">
                </div>
            </div>
             
            
            <div class="nh_cnt_sd">
                <div class="p1">
                </div>
                <div class="p2">
                </div>
                <div class="p3">
                </div>
            </div>
        </div>
        <div class="header_sd nh_sd">
        </div>
    </div>
    <div class="nh_keno" style="z-index: 99; height: 0px;">
        <div class="nh_cnt" id="keno_cnt" style="opacity: 0;">
            <div class="nh_knad">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_knad_num">
                </div>
             <!--   <div class="nh_knad_text">
                    全球最高赔率水位</div> -->
                <div class="nh_knad_info">
                    业内第一,每天返水
                </div>
                <div class="nh_knad_start">
                    <a href="javascript:;" class="st">立即游戏</a></div>
            </div>
            
            <div class="nh_gm">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <!--
                <div class="nh_gm_ued">
                </div>
                <div class="nh_gm_num">
                </div>
                <div class="nh_gm_unit">
                    %</div>
                <div class="nh_gm_text">
                    每天高额返水<br>
                    无上限</div>
                    -->
                <div class="nh_app_android">
                </div>
                <!--
                    <div class="nh_kp_title"></div>
                    -->
                <div class="nh_gm_info">
                    全面支持三星、小米、华为、中兴、HTC、魅族、LG等安卓智能机</div>
                
                <div class="nh_gm_start">
                    <a href="javascript:;" class="st">手机打开 a.k.uedapp.net 可安装</a></div>
                
            </div>
            <div class="nh_app">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_app_phone">
                </div>
                <!--
                    <div class="nh_kp_title"></div>
                    -->
                <div class="nh_app_info">
                    冬日寒冷,躲在被窝里玩的keno快乐彩,暖暖的,很贴心。</div>
                <div class="nh_app_start">
                    <a href="javascript:;" class="st">手机打开 i.k.uedapp.net 可安装</a></div>
            </div>


            <div class="nh_cnt_sd">
                <div class="p1">
                </div>
                <div class="p2">
                </div>
                <div class="p3">
                </div>
            </div>
        </div>
        <div class="header_sd nh_sd">
        </div>
    </div>


    <!-- 体育 start -->
    <div class="nh_sport" style="z-index: 99; height: 0px;">
        <div class="nh_cnt" id="nh_sport" style="opacity: 0;">
            <div class="nh_spad">
                <div class="nh_spad_num">
                </div>
                <div class="nh_spad_unit">
                    ‰</div>
                <div class="nh_dsc_text">
                    每周返水<br>
                    不设上限</div>
            </div>
            <div class="nh_bet">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_sport_bet">
                </div>
                <!--
                    <div class="nh_kp_title"></div>
                    -->
                <div class="nh_app_info">
                    全球第一款IOS体育客户端,比网页版流畅300%</div>
                <div class="nh_app_start">
                    <a href="javascript:;" class="st">苹果手机打开 i.s.uedapp.net 可安装</a></div>
            </div>
            <div class="nh_2d">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_sport_phone">
                </div>
                <!--
                    <div class="nh_kp_title"></div>
                    -->
                <div class="nh_gm_info">
                    使用手机QQ或者微信扫一扫可立即进行手机投注</div>
                <div class="nh_gm_start">
                    <a href="http://s.ued1.me" class="st">安卓手机打开 a.s.uedapp.net 可安装</a></div>
            </div>
            <div class="nh_3d">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_sport_live">
                </div>
                <div class="nh_gm_info">全年提供数万场体育赛事直播</div>
                <div class="nh_gm_start">体育直播</div>
            </div>
            <div class="nh_cnt_sd">
                <div class="p1">
                </div>
                <div class="p2">
                </div>
                <div class="p3">
                </div>
            </div>
        </div>
        <div class="header_sd nh_sd">
        </div>
    </div>
    <!-- 体育 end -->


    <div class="nh_game" style="z-index: 99; height: 0px;">
        <div class="nh_cnt" id="nh_game" style="opacity: 0;">
            <div class="nh_spad2">
                <div class="nh_spad_num2">
                </div>
                <div class="nh_spad_unit">
                    %</div>
                <div class="nh_dsc_text">
                    每天返水<br>
                    不设上限</div>
            </div>
            <div class="nh_sl">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_game_bet">
                </div>
                <!--
                    <div class="nh_kp_title"></div>
                    -->
                <div class="nh_app_info">
                    全球最佳PT平台,每周至少有两个30A奖池大奖诞生</div>
                <div class="nh_app_start">
                    <a href="javascript:;" class="st">立即游戏</a></div>
            </div>
            <div class="nh_bs" name_attr="bs">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_betsoft">
                </div>
                <div class="nh_gm_info">
                    全球首款覆盖所有手机平台老虎机游戏</div>
                <div class="nh_app_start">
                    <a href="/betsoft/Default.aspx" class="st">立即游戏</a></div>
            </div>
            <div class="nh_cl" name_attr="pt">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_game_client">
                </div>
                <!--
                    <div class="nh_kp_title"></div>
                    -->
                <div class="nh_gm_info">
                    UED PT客户端</div>
                <div class="nh_gm_start">
                    <a href="" class="st">下载客户端</a></div>
            </div>
            <div class="nh_cnt_sd">
                <div class="p1">
                </div>
                <div class="p2">
                </div>
                <div class="p3">
                </div>
            </div>
        </div>
        <div class="header_sd nh_sd">
        </div>
    </div>




    <div class="nh_coupon" style="z-index: 99; height: 0px;">
        <div class="nh_cnt" id="nh_coupon" style="opacity: 0;">
        <!--
            <div class="nh_ptcp">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_coupon_ptcp">
                </div>
                <div class="nh_pt_countdown" id="ptCountdown">
                    <input type="hidden" value="" />
                    <div class="day"></div>
                    <div class="hour"></div>
                    <div class="min"></div>
                    <div class="secound"></div>
                </div>
                <div class="nh_pt_couponremains" id="ptCouponRemains" data-ajaxurl="/zh-cn/promotioncode/ptgame.aspx">
                    <em></em>
                </div>
                <div class="nh_pt_couponnone" id="ptCouponNone">
                    暂无优惠券
                </div>
                <div class="nh_app_info">
                    上个自然周老虎机流水≥1万,每周一15点开抢
                </div>
                <div class="nh_app_start">
                    <a href="javascript:;" class="st">立即抢券</a>
                </div>
            </div>
            -->
            <div class="nh_spcp">
                <div class="nh_item"></div>
                <div class="nh_line"></div>
                <div class="nh_coupon_sport_bg"></div>
                <div class="nh_sport_countdown" id="sportCountdown">
                    <input type="hidden" value="">
                    <div class="day"></div>
                    <div class="hour"></div>
                    <div class="min"></div>
                    <div class="secound"></div>
                </div>
                <div class="nh_sport_couponremains" id="sportCouponRemains" data-ajaxurl="/zh-cn/promotioncode/sportdays.aspx">
                    <em></em>
                </div>
                <div class="nh_sport_couponnone" id="sportCouponNone">
                    暂无优惠券
                </div>
                <div class="nh_app_info">
                    前一天体育流水≥3888可抢,每日20:00开抢
                </div>
                <div class="nh_app_start">
                    <a href="javascript:;" class="st">立即抢券</a>
                </div>
            </div>
            <div class="nh_alcp">
                <div class="nh_item">
                </div>
                <div class="nh_line">
                </div>
                <div class="nh_alcp_bg">
                </div>
                <!--
                    <div class="nh_kp_title"></div>
                    -->


                <div class="nh_alcp_countdown" id="alcpCountdown">
                    <input type="hidden" value="">
                    <div class="day"></div>
                    <div class="hour"></div>
                    <div class="min"></div>
                    <div class="secound"></div>
                </div>
                <div class="nh_alcp_couponremains" id="alcpCouponRemains" data-ajaxurl="/zh-cn/promotioncode/super.aspx">
                    <em></em>
                </div>
                <div class="nh_alcp_couponnone" id="alcpCouponNone">
                    暂无优惠券
                </div>


                <div class="nh_gm_info">
                    前一天老虎机流水≥3888可抢,每日19:00开抢
                </div>
                <div class="nh_gm_start">
                    <a href="" class="st">立即抢券</a></div>
            </div>
            <div class="nh_cnt_sd">
                <div class="p1">
                </div>
                <div class="p2">
                </div>
                <div class="p3">
                </div>
            </div>
        </div>
        <div class="header_sd nh_sd">
        </div>
    </div>

</div>


// JavaScript Document
var suffix = document.domain;
suffix = suffix.substring(suffix.lastIndexOf("."));
$(function () {

    //弹窗不需初始化
    if (window.top == window) {
        //InitHeaderPromotion();
        BindPromotionEvent();
    }

    //setFooter();
    $("input").filter("[type=text],[type=password]").attr("autocomplete", "off");
    $(".browser-updatetips span").click(function () { $(".browser-updatetips").hide(); });
    $(".input-datepicker .btn-datepicker").click(function () { $(this).siblings("input").datepicker("show"); });

    //contact cs
    $("body").on("click", "a[data-btncs]", function (e) {
        window.open($(this).attr("href"), "liaonow", "width=500,height=650,location=no"); return false;
    });
    //$("a[data-btncs]").click(function() { window.open($(this).attr("href"), "liaonow", "width=500,height=650,location=no"); return false; });

    if (window.top == window.self) { $("html").css("backgroundColor", "#6e6d71"); }


    //#region input-4
    $("body").on("blur focus", ".uedinput-4", function (e) {
        if (e.type == "focusin") {
            $(this).parent().addClass('focus');
        }
        else if (e.type == "focusout") {
            $(this).parent().removeClass('focus');
        }
    });
    //#endregion


    $(".lf-input").keyup(function () {
        var $a = $(this).siblings("a");
        if ($(this).val() != "") {
            $(this).attr("class", "long");
            $a.text($a.attr("data-shorttxt"));
        }
        else {
            $(this).attr("class", "short");
            $a.text($a.attr("data-longtxt"));
        }
    });

    //#region auto resize image
    function resizeImg() {
        if ($("#resize-img").length == 0) { return; }
        var width = $(window).width(),
		    height = $(window).height() - $("#header").outerHeight();

        $("#resize-img").css({ "width": width, "height": height });
        var $img = $("#resize-img").children("img");
        $img.css({ "width": "100%", "height": "auto" });
        var imgHeight = $img.height(), imgWidth = $img.width();
        if (imgHeight != 0) {
            if (imgHeight < height) { $img.css({ "width": "auto", "height": height }); $img.css({ "marginLeft": -(($img.width() - width) / 2), "marginTop": 0 }); }
            else { $img.css({ "width": "100%", "height": "auto" }); $img.css({ "marginLeft": 0, "marginTop": -(($img.height() - height) / 2) }); }
        }
    }

    $(window).load(function () { resizeImg(); });
    $(window).resize(function () { resizeImg(); });
    //#endregion


    //#region register form
    var SwitchForms = {
        _showFormCls: 'form-account',
        _$slider: $(".slider"),
        _formCfg: { 'a': 'form-account', 'p': 'form-phone', 'e': 'form-email', 'q': 'form-qq' },
        _sliderCfg: { 'a': { top: "12px" }, 'p': { top: "51px" }, 'e': { "top": "90px" }, 'q': { "top": "130px"} },


        showForm: function (itemname) {
            if (typeof this._formCfg[itemname] == 'undefined') {
                return false;
            }
            var cls = this._formCfg[itemname];
            $(".rf-forms").removeClass(this._showFormCls).addClass(cls).find("input").val("");
            this._showFormCls = cls;
        },
        slider: function (itemname) {
            if (typeof this._sliderCfg[itemname] != 'undefined') {
                this._$slider.css(this._sliderCfg[itemname]);
            }
        }
    };

    $('.rf-items').mouseover(function (e) {
        var $target = $(e.target);
        var itemname = $target.attr("data-item");
        SwitchForms.slider(itemname);
        SwitchForms.showForm(itemname);
    });

    $("body").on("focus keydown keyup blur", "input[type=text],input[type=password]", function (e) {
        switch (e.type) {
            case "focusin":
                $(this).siblings("label").hide();
                if ($(this).val() != "") { return; }
                var name = $(this).attr("name");
                $('[data-for="' + name + '"]').show();
                break;
            case "focusout":
                if ($(this).val() != "") { return; }
                $(this).siblings("label").show();
                var name = $(this).attr("name");
                $('[data-for="' + name + '"]').hide();
                break;
            case "keydown": break; //$(this).siblings("label").hide(); break;
            case "keyup": break;
        }
    });
    //#endregion

    //#region password check
    String.prototype.strReverse = function () { var b = ""; for (var a = 0; a < this.length; a++) { b = this.charAt(a) + b } return b };
    function checkPassword(f) {
        if (!f) { return 0 }
        var h = 8;
        if (f.length < h) { return 0 }
        var g = 0;
        var e = "abcdefghijklmnopqrstuvwxyz";
        var d = "01234567890";
        var a = "~)!@#$%^&*()_+-={}[]|:;<>?,./";
        if (f.length >= 10) { g += 20 }
        if (f.length >= 12) { g += 20 }
        if (f.match(/[a-z]/g)) { g += 20 }
        if (f.match(/[0-9]/g)) { g += 20 }
        if (f.match(/[A-Z]/g)) { g += 20 }
        for (var i = 0; i < a.length; i++) {
            if (f.indexOf(a[i]) != -1) { g += 20; break }
        }
        for (var i = 0; i < 23; i++) {
            var b = e.substring(i, parseInt(i + 3));
            var c = b.strReverse();
            if (f.indexOf(b) != -1 || f.indexOf(c) != -1) {
                g -= 20
            }
            b = e.toUpperCase().substring(i, parseInt(i + 3)); c = b.strReverse(); if (f.indexOf(b) != -1 || f.indexOf(c) != -1) { g -= 20 }
        }
        for (var i = 0; i < 8; i++) { var b = d.substring(i, parseInt(i + 3)); var c = b.strReverse(); if (f.indexOf(b) != -1 || f.toLowerCase().indexOf(c) != -1) { g -= 20 } } return Math.max(g, 0)
    };

    var delayKey,
    displayPasswdMeter = function (n, item) {
        var s, $node = $('.pwd-strong');

        if (n < 60) {
            s = '弱';
        } else if (n < 80) {
            s = '一般';
        } else {
            s = '强';
        }

        $node.show().text('密码强度:' + s);
    };

    $('#password').bind({
        blur: function () {

        },
        keyup: function (e) {
            var el = this;
            if (this.value.length < 8) {
                $('.pwd-strong').hide();
                $("[data-valmsg-for='password']").show();
                return;
            }

            $("[data-valmsg-for='password']").hide();
            delayKey && clearTimeout(delayKey);
            delayKey = setTimeout(function () {
                displayPasswdMeter(checkPassword(el.value), $(el).parent());
            }, 10);
        }
    });
    //#endregion 

    //#region summarys block animation
    var SummarysAnimation = {
        _$activeEl: $('[data-summary="2"]'), //当前活动块元素
        _range: 30,                          //高度变化范围
        _speed: 400,
        _timer: null,

        clearTimer: function () { this._timer != null && clearTimeout(this._timer); },
        IsEqual: function ($target) {
            if ($target.attr("data-summary") == this._$activeEl.attr("data-summary")) { return true; }
            return false;
        },
        animate: function ($target) {
            if (this.IsEqual($target)) { return false; }

            this._timer != null && clearTimeout(this._timer);
            var self = this;
            this._timer = setTimeout(function () {
                $target.stop(true, true).animate({ "marginTop": (parseInt($target.css("marginTop")) - self._range) + "px" }, self._speed, "linear");
                self._$activeEl.stop(true, true).animate({ "marginTop": (parseInt(self._$activeEl.css("marginTop")) + self._range) + "px" }, self._speed, "linear");
                self._$activeEl = $target;
            }, 300);
        }
    };

    $("div[data-summary]").mouseenter(function (e) {
        $target = $(this);
        var dataSummary = $target.attr("data-summary");
        if (dataSummary != 1 && dataSummary != 2 && dataSummary != 3) { return; }
        SummarysAnimation.animate($target);
    });
    $("div[data-summary]").mouseleave(function (e) {
        SummarysAnimation.clearTimer();
    });
    //#endregion

    //#region account safe status
    window.AccountSafe = { $el: $(".account-safe") };
    AccountSafe.Model = { infotrue: 0, bindcard: 0, bindphone: 0, bindemail: 0, complete: 0 };
    AccountSafe.safetxts = [l.SafeLevel1, l.SafeLevel2, l.SafeLevel3, l.SafeLevel4];
    AccountSafe.Bar = function (p) {

        var $e = $(".illustration .dial");
        $e.knob({ width: 52, height: 52, lineCap: "round", thickness: ".15", angleOffset: 180, readOnly: true, displayInput: false, fgColor: "#98C2F3", bgColor: "#E6F0FB" });

        var i = 0;

        var t = setInterval(function () {
            i += 5;
            if (i >= 100) { $e.val(i).trigger("configure", { bgColor: "#98C2F3" }); $(".safe-percent").html("100%"); clearInterval(t); return; }

            if (i >= p) { i = p; clearInterval(t); }
            $e.val(i).trigger("change");
            $(".safe-percent").html(i + "%");
        }, 30);
    };
    AccountSafe.Render = function () {
        var i = 0, infotrue = bindcard = bindphone = bindemail = 0;
        infotrue = this.Model.infotrue; bindcard = this.Model.bindcard; bindphone = this.Model.bindphone; bindemail = this.Model.bindemail;

        i = this.Model.complete;
        this.Bar(i);

        this.$el.find(".safe-level").html(this.safetxts[i > 0 ? (Math.floor((i - 1) / 25)) : 0]);

        var $r = $("#as-trueinfo"), $c = $("#as-bindcard"), $p = $("#as-bindphone"), $e = $("#as-bindemail");

        infotrue == 1 ? $r.attr("class", "logo-trueinfo-on") : $r.attr("class", "logo-trueinfo");
        bindcard == 1 ? $c.attr("class", "logo-bindcard-on") : $c.attr("class", "logo-bindcard");
        bindphone == 1 ? $p.attr("class", "logo-bindphone-on") : $p.attr("class", "logo-bindphone");
        bindemail == 1 ? $e.attr("class", "logo-bindemail-on") : $e.attr("class", "logo-bindemail");
    }
    AccountSafe.Init = function (infotrue, bindcard, bindphone, bindemail) {
        this.Model.complete = this.$el.find(".safe-percent").attr("data-complete");

        this.Model.infotrue = infotrue == 1 ? 1 : 0; this.Model.bindcard = bindcard == 1 ? 1 : 0; this.Model.bindphone = bindphone == 1 ? 1 : 0; this.Model.bindemail = bindemail == 1 ? 1 : 0;
        this.Render();
    }
    AccountSafe.Get = function () {
        var url = "/service/accountsafe.ashx";
        $.get(url, function (respone) {
            if (respone && respone._err == null) {
                AccountSafe.Init(respone.r, respone.c, respone.p, respone.e);
            }
        });
    }
    //#endregion

    //#region Elevator
    var Elevator = { HidePopupTimer: null, HidePopup: function () {
        this.HidePopupTimer = setTimeout(function () { $("#elevator_item .qr-popup").hide(); }, 500);
    }
    };

    $("#elevator_item .qr").click(function () { $("#elevator_item .qr-popup").show(); });
    $("#elevator_item .qr, #elevator_item .qr-popup").mouseleave(function () { Elevator.HidePopup(); }).mouseenter(function () { Elevator.HidePopupTimer != null && clearTimeout(Elevator.HidePopupTimer); })

    $("#elevator_item").hide();
    $(window).scroll(function () {
        if ($(window).scrollTop() > 100) {
            $("#elevator_item").fadeIn(500);
        }
        else {
            $("#elevator_item").fadeOut(500);
        }
    });
    $("#elevator_item #elevator").click(function () { $('body,html').animate({ scrollTop: 0 }, 500); return false; });
    //#endregion
    addNavEvent();

    //初始化存款教程
    HomeCourse.init();

    //多语言选择框
    HeaderLangSwtich.Init();
})

//#region tips  block
//fast
Tips = {
    Show: function(msg, css) {
        var $block = $(".g-tips-block2");
        if ($block.length == 0) { $block = $("<div></div>").attr("class", "g-tips-block2").css(css).appendTo("body") };
        $block.html(msg).hide().show(100,function() { setTimeout(function() { $block.hide(); }, 300); });
    }
};

Tips2 = { timer: null, $el: null };
Tips2.Show = function(content, offset, arcls) {
    var _self = this;
    _self.$el != null && _self.RunHide();
    //var $tipsBlock = $(".g-poptips");
    //if ($tipsBlock.length == 0) {
    $tipsBlock = $('<div class="g-poptips"><div class="bd"></div><div class="ar"><em>◆</em><span>◆</span></div></div>').appendTo("body");
    $tipsBlock.mouseenter(function() { clearTimeout(_self.timer); }).mouseleave(function() { _self.Hide(); })
    //}

    $tipsBlock.find(".bd").html(content);
    $tipsBlock.find(".ar").attr("class", "ar " + arcls);
    $tipsBlock.css({ left: offset.left, top: offset.top }).show();
    _self.$el = $tipsBlock;
};
Tips2.Hide = function() {
    if (this.$el == null) { return; }
    var _self = this, $tipsBlock = this.$el;
    _self.timer = setTimeout(function() { _self.RunHide(); }, 300);
}
Tips2.RunHide = function() {
    this.$el.remove(); this.$el = null;
}


var tipsBlock = { timer: null };
tipsBlock.Show = function($target) {
    tipsBlock.timer != null && clearTimeout(tipsBlock.timer);
    var $tipsBlock = $(".g-tips-block");
    if ($tipsBlock.length == 0) {
        $tipsBlock = $('<div class="g-tips-block"><div class="close"></div><div class="title"></div><p></p><div class="logo-sj6-b"></div></div>').appendTo("body");
        $tipsBlock.find(".close").click(function() { $tipsBlock.hide(); });
        $tipsBlock.mouseenter(function() { clearTimeout(tipsBlock.timer); }).mouseleave(function() { tipsBlock.Hide(); })
    }

    $tipsBlock.find(".title").html($target.attr("data-title"));
    $tipsBlock.find("p").html($target.attr("data-content"));

    var top = $target.offset().top, left = $target.offset().left;
    top -= $tipsBlock.innerHeight() + 20;
    left -= parseInt($tipsBlock.innerWidth() / 2, 10);

    var of = $target.attr("data-offset");
    if (typeof of != "undefined" && of != "") {
        var _of = of.split("|");
        left += parseInt(_of[0], 10);
        top += parseInt(_of[1], 10);
    }

    $tipsBlock.css({ top: top, left: left }).show();

    tipsBlock.$el = $target;
};
tipsBlock.Hide = function() {
    var $tipsBlock = $(".g-tips-block");
    tipsBlock.timer = setTimeout(function() { $tipsBlock.hide(); tipsBlock.$el = null; }, 300);
}
$("[data-showtips='true']").mouseenter(function(e) { tipsBlock.Show($(e.currentTarget)); }).mouseleave(function() { tipsBlock.Hide(); });

//#endregion


//#region Message
Message = {unread: 0, timer: null};
Message.BackendApi = {
    TestDelMsg: function() { dialog.info(l.Message, "success"); },
    SR: { deling: false, reading: false },
    DelMsg: function(action, $cbs, ids) {
        if (this.SR.deling) { return false; }
        var _self = this;
        _self.SR.deling = true;
        $.post("message.aspx", { action: action, ids: ids }, function(response) {
            _self.SR.deling = false;
            if (response._err != "" && response._err != null) {
                dialog.info(l.Message, response._err);
            }
            else {
                // var button = {};
                // button[l.OK] = function() {
                //     dialog.close();
                //     utility.closePopUp();
                // };
                // dialog.info(l.Message, response.m, button);
                $cbs.closest("li").slideToggle("normal", function() { $(this).remove(); });
            }
        });
    },
    ReadMsg: function(id) {
        id = parseInt(id, 10);
        if (id == 0) { return; }
        if (this.SR.reading) { return false; }
        _self = this;
        _self.SR.reading = true;
        $.post("message.aspx", { action: "read", id: id }, function(response) {
            _self.SR.reading = false;
        });
    },
    Get: function(callback) {
        $.get("/service/message.ashx", function(res) {
            if (res.success) {
                Message.unread = res.result.c;
                if (Message.unread > 0) {
                    $("#new-msg").find("span").html(Message.unread).attr("title", $.validator.format(l.UnReadMessage, Message.unread)).parent().show();
                    $(".t-2", ".mc-nav .bd").first().html($.validator.format(l.UnReadMessage, Message.unread));
                }
                else {
                    $("#new-msg").hide();
                    $(".t-2", ".mc-nav .bd").first().html(l.NoneUnReadMessage);
                }
                typeof callback != "undefined" && callback();
            }
        });
    }
};

/*
(function() {
    if (!utility.isLogined() || Message.unread > 0) { return; }
    Message.BackendApi.Get();
    setTimeout(arguments.calle, 5000)
})();
*/


//Message.BackendApi.Get();
//setInterval(function() { Message.BackendApi.Get(); }, 10000);

//#endregion


//#region LoadingImg
function UBLoading($el, frameIndex, frames, frameTime) {
    this.$el = $el;
    this.timer = null;
    this.frameIndex = frameIndex;this.frames = frames;this.frameTime = frameTime;
}
UBLoading.prototype.Run = function() {
    var _self = this;
    _self.timer = setInterval(function() {
        var position = 0;
        position = (_self.frameIndex % _self.frames) * 30;
        _self.$el.css({ "background-position": "0px -" + position + "px" });
        _self.frameIndex++;
    }, this.frameTime);
}
UBLoading.prototype.Stop = function() {
    this.timer != null && clearInterval(this.timer);
}
//#endregion


//#region Valid
Valid = {
    IsEmail: function(email) {
        var re = /^[a-z0-9][a-z0-9_.-]+@[a-z0-9|-]+(.[a-z0-9|-]+)*[.][a-z0-9]+$/i;
        return re.test(email);
    },
    IsMobile: function(mobile) {
        var re = /^0{0,1}(13\d|14\d|15\d|17\d|18\d)\d{8}$/g;
        return re.test(mobile);
    },
    IsMoney: function(money) {
        var re = /^\d+(\.\d{1,2})?$/i;
        return re.test(money);
    }
};
//#endregion


//#region IOSONOFF
var IosOnOff = {};
IosOnOff.On = function(self) {
    $(self).trigger('iosonoff.start');

    var left = $(self).width() - $(self).find(".slider").width();

    $(self).children().attr("class", "on");
    $(self).find(".slider").animate({left: left}, 300, "easeInOut", function() {
        $(self).trigger('iosonoff.end');
    });
}
IosOnOff.Off = function(self) {
    $(self).trigger('iosonoff.start');

    $(self).children().attr("class", "off");
    $(self).find(".slider").animate({left: 0}, 300, "easeInOut", function() {
        $(self).trigger('iosonoff.end');
    });
}
IosOnOff.Switch = function(self) {
    if($(self).find(".slider").css("left") == "0px") { this.On(self); }
    else { this.Off(self); }
}
//#endregion


/* joe*/
var csnTimeout = null;
var kenoTimeout = null;
var csnTimeoutB = null;
var kenoTimeoutB = null;
var couponTimeout = null;
var couponTimeoutB = null;

var sportTimeout = null;
var gameTimeout = null;
var sportTimeoutB = null;
var gameTimeoutB = null;

function setFooter(){
	var url = window.location.href;

    if($("#content").attr("data-heightauto") == "false") {
        return;
    }
	// if(url.indexOf("/zh-cn/keno/") < 0 && url.indexOf("/zh-cn/livecasino/") < 0 && url.indexOf("/zh-cn/sportsbook/") < 0){
    if(url.indexOf("/"+gv.lang+"/keno/") < 0 && url.indexOf("/"+gv.lang+"/livecasino/") < 0 && url.indexOf("/"+gv.lang+"/sportsbook/") < 0){
	    var windowH = $(this).height(); //窗口高度
	    var headerH = $("#header").height();
	    var footerH = $("#footer").height();
	    $("#content").css({ "min-height": (windowH - headerH -footerH -1) + "px", "overflow": "hidden" });
	}
}

setFooter();

function addNavEvent(){
	$("#nav_casino").mouseenter(function(){
		clearTimeout(csnTimeout);
		csnTimeout = null;
		if(csnTimeoutB == null){
			csnTimeoutB = setTimeout(function(){
				showCasino();
			},200);
		}
	});
	
	$("#nav_casino").mouseleave(function(){
		clearTimeout(csnTimeoutB);
		csnTimeoutB=null;
		hiddCasino();
	});
	$(".nh_csn").mouseenter(function(){
		clearTimeout(csnTimeout);
		csnTimeout = null;
		if(csnTimeoutB == null){
			csnTimeoutB = setTimeout(function(){
				showCasino();
			},200);
		}
	});
	$(".nh_csn").mouseleave(function(){
		clearTimeout(csnTimeoutB);
		csnTimeoutB=null;
		hiddCasino();
	});
	
	
	$("#nav_keno").mouseenter(function(){
		clearTimeout(kenoTimeout);
		kenoTimeout = null;
		if(kenoTimeoutB == null){
			kenoTimeoutB = setTimeout(function(){
				showKeno();
			},200);
		}
		
	});
	
	$("#nav_keno").mouseleave(function(){
		clearTimeout(kenoTimeoutB);
		kenoTimeoutB=null;
		hiddKeno();
	});
	$(".nh_keno").mouseenter(function(){
		clearTimeout(kenoTimeout);
		kenoTimeout = null;
		if(kenoTimeoutB == null){
			kenoTimeoutB = setTimeout(function(){
				showKeno();
			},200);
		}
	});
	$(".nh_keno").mouseleave(function(){
		clearTimeout(kenoTimeoutB);
		kenoTimeoutB=null;
		hiddKeno();
	});
	
	
	
	$("#nav_sport").mouseenter(function(){
		clearTimeout(sportTimeout);
		sportTimeout = null;
		if(sportTimeoutB == null){
			sportTimeoutB = setTimeout(function(){
				showSport();
			},200);
		}
		
	});
	
	$("#nav_sport").mouseleave(function(){
		clearTimeout(sportTimeoutB);
		sportTimeoutB=null;
		hiddSport();
	});
	$(".nh_sport").mouseenter(function(){
		clearTimeout(sportTimeout);
		sportTimeout = null;
		if(sportTimeoutB == null){
			sportTimeoutB = setTimeout(function(){
				showSport();
			},200);
		}
	});
	$(".nh_sport").mouseleave(function(){
		clearTimeout(sportTimeoutB);
		sportTimeoutB=null;
		hiddSport();
	});
	

    /* */
    $("#nav_coupon").mouseenter(function(){

        if($(this).attr("data-enable") == "false") {
            return;
        }

        clearTimeout(couponTimeout);
        couponTimeout = null;
        if(couponTimeoutB == null){
            couponTimeoutB = setTimeout(function(){
                showCoupon();
            },200);
        }
        
    });
    
    $("#nav_coupon").mouseleave(function(){
        if($(this).attr("data-enable") == "false") {
            return;
        }
        
        clearTimeout(couponTimeoutB);
        couponTimeoutB=null;
        hiddCoupon();
    });
    $(".nh_coupon").mouseenter(function(){
        clearTimeout(couponTimeout);
        couponTimeout = null;
        if(couponTimeoutB == null){
            couponTimeoutB = setTimeout(function(){
                showCoupon();
            },200);
        }
    });
    $(".nh_coupon").mouseleave(function(){
        clearTimeout(couponTimeoutB);
        couponTimeoutB=null;
        hiddCoupon();
    });
    /* */
	
	
	$("#nav_game").mouseenter(function(){
		clearTimeout(gameTimeout);
		gameTimeout = null;
		if(gameTimeoutB == null){
			gameTimeoutB = setTimeout(function(){
				showGame();
			},200);
		}
		
	});
	
	$("#nav_game").mouseleave(function(){
		clearTimeout(gameTimeoutB);
		gameTimeoutB=null;
		hiddGame();
	});
	$(".nh_game").mouseenter(function(){
		clearTimeout(gameTimeout);
		gameTimeout = null;
		if(gameTimeoutB == null){
			gameTimeoutB = setTimeout(function(){
				showGame();
			},200);
		}
	});
	$(".nh_game").mouseleave(function(){
		clearTimeout(gameTimeoutB);
		gameTimeoutB=null;
		hiddGame();
	});
	
	
	$(".nh_ea, .nh_gd, .nh_kp, .nh_pt, .nh_knad, .nh_sl, .nh_bs").mouseenter(function(){
		if($(event.target).attr("class") != "dl"){
            $(this).find(".st").html(l.EnterGame);
			$(this).addClass("hover");
		}
		
	});
	$(".nh_ea, .nh_gd, .nh_kp, .nh_pt, .nh_knad, .nh_sl, .nh_bs").mouseleave(function(){
		if($(event.target).attr("class") != "dl"){
            $(this).find(".st").html(l.PlayNow);
			$(this).removeClass("hover");
		}
	});
	$(".nh_app, .nh_2d, .nh_cl, .nh_sl, .nh_gm, .nh_ptcp, .nh_alcp, .nh_spcp, .nh_bet, .nh_3d").mouseover(function(){
		$(this).addClass("hover");
		});
    $(".nh_app, .nh_2d, .nh_cl, .nh_sl, .nh_gmi, .nh_ptcp, .nh_alcp, .nh_spcp, .nh_bet, .nh_3d").mouseout(function () {
		$(this).removeClass("hover");
		});
	
	//导航效果
	$(".pngFix").mouseenter(function(){
		// var navId = $(this).attr("id");
		// if(navId == "nav_casino"){
			
		
		// }else if( navId == "nav_keno"){
			
		// }
	//	$(this).addClass("over");
	});
	$(".pngFix").mouseleave(function(){
		// $(this).removeClass("over");
	});
	
	//click
	$(".nh_ea").click(function(event){
		if($(event.target).attr("class") != "dl"){
			openEaHd();
		}
	});
	$(".nh_gd").click(function(){
		openGdHd();
	});
	$(".nh_kp").click(function(){
			openCrownHd();
	});
	$(".nh_pt").click(function(event){
		if($(event.target).attr("class") != "dl"){
			openPtHd();
		}
	});
	
	$("[name_attr='pt']").click(function(){
        if(gv.lang == "vi-vn") {
            return;
        }

        // if($(this).attr("class") == "pt_dld"){
            var buttons = {};
            buttons[l.IKnow] = function () { dialog.close(); window.location.href="http://cdn.jackpotmatrix.com/uedbetprod/d/setup.exe";};
             //   buttons[l.OK] = function () { dialog.close(); window.location.href="http://download.uedbet.com/pt/ued_cn.exe";};

            dialog.info(l.Message, l.PTDownLoadTip,buttons);
        // }else{
        //     window.open("http://download1.uedbet.com:808/ued_cn.msi");
        // }
	});	
	
	$(".nh_gm").click(function(){
		//openKeno();
		//downloadAndroid();
		downloadKeno();
	});
	$(".nh_knad").click(function(){
		openKeno();
		
	});
	
	
	$(".nh_app").click(function(){
		downloadKeno();
	});
	
	$(".nh_bet").click(function(){
		// window.location = "/zh-cn/sportsbook/";
        //window.location = "/"+gv.lang+"/sportsbook/";
        if(gv.lang == "vi-vn") {
            return;
        }
        window.open("http://i.s.uedapp.net");
	});
	
	$(".nh_2d").click(function(){
		// var url = $(this).find(".st").attr("href");
		// window.location = "http://s.uedbet" + suffix;
        if(gv.lang == "vi-vn") {
            return;
        }
        window.open("http://a.s.uedapp.net");
	});
    $(".nh_3d").click(function(){
        //体育直播
        //window.open("/" + gv.lang + "/liveevent/","_blank");
        if(gv.lang  == "zh-tw") {
            window.open("/" + gv.lang + "/liveevent/", "liveevent", "width=600,height=605,status=yes,toolbar=no,menubar=no,location=no,resizable=no");    
        }
        else {
            window.open("/" + gv.lang + "/liveevent/","_blank");
        }
    });
	$(".nh_sl").click(function(){
        //越南市场未开放
        if(gv.lang == "vi-vn") {
            //window.location.href = "/vi-vn/ComingSoon.aspx";
            return;
        }

        if(gv.lang == "zh-cn"){
            window.location = "/ptcasino/launch.aspx?type=game";
        }else{
            window.location = "/"+gv.lang+"/ptcasino/launch.aspx?type=game";
        }

	});
    $(".nh_bs").click(function(){
        //越南市场未开放
        if(gv.lang == "vi-vn") {
            //window.location.href = "/vi-vn/ComingSoon.aspx";
            return;
        }

        window.location = "/"+gv.lang+"/betsoft/Default.aspx";
    });

    $(".nh_ptcp").click(function(){
        // window.location = "/zh-cn/promotioncode/ptgame.aspx";
        window.location = "/"+gv.lang+"/promotioncode/ptgame.aspx";
    });
    $(".nh_alcp").click(function(){
        // window.location = "/zh-cn/promotioncode/super.aspx";
        window.location = "/"+gv.lang+"/promotioncode/super.aspx";
    });
    $(".nh_spcp").click(function () {
        // window.location = "/zh-cn/promotioncode/sportdays.aspx";
        window.location = "/"+gv.lang+"/promotioncode/sportdays.aspx";
    });
	// $(".nh_cl").click(function(){
	// 	//window.open("http://download.uedbet.com/pt/ued_cn.exe");
	// 	window.location = "http://download.uedbet.com/pt/ued_cn.exe";
	// });

    $("#top_logo_a").mousedown(function(){
        $(this).addClass("press");
    });
    $("#top_logo_a").mouseup(function(){
        $(this).removeClass("press");
    });


    //aglimit
    $(".nh_ag_close").click(function(){
        $("#ag_limit").fadeOut();
    });
    $("[ag_limit]").click(function(){
        //越南市场未开放
        if(gv.lang == "vi-vn") {
            //window.location.href = "/vi-vn/ComingSoon.aspx";
            return;
        }

        var agLimit = $(this).attr("ag_limit");
        var agurl = "/integration/aggame/game.aspx";
        agurl += "?oddtype=" + agLimit;
        $("#ag_limit").fadeOut();
        var ref = window.open(agurl,"ag","depended=yes,height=766,width=1290"); 
        ref.focus();
    });

     /* 设置语言*/
    // $("#current_language").mouseenter(function(){
    //     $("#choose_language").fadeIn(100);
    // });
    // $("#choose_language").mouseleave(function(){
    //     $("#choose_language").fadeOut(100);
    // });
    /* 设置语言 end*/
}

function showSport(){ 
	$(".it_sport").addClass("over");
	$(".nh_sport").css({"z-index":100});
	// if(csnTimeout != null){
		// clearTimeout(csnTimeout);
		// csnTimeout = null;
	// }
	
	$(".nh_sport").stop(true).animate({"height":"205px"},200,"easeInQuart",function(){
		// $(".nh_csn").css({"overflow":"visible"});
		if(check()){
			$("#nh_sport").stop(true).animate({"opacity":1},200,"easeInQuart",function(){});
		}
		
	});
}

function showCasino(){ 
	$(".it_csn").addClass("over");
	$(".nh_csn").css({"z-index":100});
	// if(csnTimeout != null){
		// clearTimeout(csnTimeout);
		// csnTimeout = null;
	// }
	
	$(".nh_csn").stop(true).animate({"height":"205px"},200,"easeInQuart",function(){
		// $(".nh_csn").css({"overflow":"visible"});
		if(check()){
			$("#nh_cnt").stop(true).animate({"opacity":1},200,"easeInQuart",function(){});
		}
		
	});
}

function showKeno(){ 
	$(".it_keno").addClass("over");
	$(".nh_keno").css({"z-index":100});
	// if(kenoTimeout != null){
		// clearTimeout(kenoTimeout);
		// kenoTimeout = null;
	// }
	
	$(".nh_keno").stop(true).animate({"height":"205px"},200,"easeInQuart",function(){
		// $(".nh_csn").css({"overflow":"visible"});
		if(check()){
			$("#keno_cnt").stop(true).animate({"opacity":1},200,"easeInQuart",function(){});
		}
		
	});
}

function showGame(){ 
	$(".it_game").addClass("over");
	$(".nh_game").css({"z-index":100});
	// if(csnTimeout != null){
		// clearTimeout(csnTimeout);
		// csnTimeout = null;
	// }
	
	$(".nh_game").stop(true).animate({"height":"205px"},200,"easeInQuart",function(){
		// $(".nh_csn").css({"overflow":"visible"});
		if(check()){
			$("#nh_game").stop(true).animate({"opacity":1},200,"easeInQuart",function(){});
		}
		
	});
}

function showCoupon() {
    $("#nav_coupon").addClass("over");
    $(".nh_coupon").css({"z-index":100});

    if ($(".nh_coupon").height() == 0) {
        //执行自定义事件
        $(document).trigger("CouponDropDownShow");
    }

    $(".nh_coupon").stop(true).animate({"height":"205px"},200,"easeInQuart",function(){
        // $(".nh_csn").css({"overflow":"visible"});
        if(check()){
            $("#nh_coupon").stop(true).animate({"opacity":1},200,"easeInQuart",function(){});
        }

    });

   
}

function hiddCasino(){
	$(".nh_csn").css({"z-index":99});
	csnTimeout = setTimeout(function(){
		csnTimeout = null;
		$(".it_csn").removeClass("over");
		if(check()){
			$("#nh_cnt").stop(true).animate({"opacity":0},200,"easeInQuart",function(){
				
				$(".nh_csn").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
				// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}else{
			$("#nh_cnt").stop(true).animate({"top":"0px"},200,"easeInQuart",function(){
				
				$(".nh_csn").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
					// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}
		
	},250);
}

function hiddKeno(){
	$(".nh_keno").css({"z-index":99});
	kenoTimeout = setTimeout(function(){
		kenoTimeout = null;
		$(".it_keno").removeClass("over");
		if(check()){
			$("#keno_cnt").stop(true).animate({"opacity":0},200,"easeInQuart",function(){
				
				$(".nh_keno").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
				// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}else{
			$("#keno_cnt").stop(true).animate({"top":"0px"},200,"easeInQuart",function(){
				
				$(".nh_keno").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
					// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}
		
	},250);
}



function hiddSport(){
	$(".nh_sport").css({"z-index":99});
	sportTimeout = setTimeout(function(){
		sportTimeout = null;
		$(".it_sport").removeClass("over");
		if(check()){
			$("#nh_sport").stop(true).animate({"opacity":0},200,"easeInQuart",function(){
				
				$(".nh_sport").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
				// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}else{
			$("#nh_sport").stop(true).animate({"top":"0px"},200,"easeInQuart",function(){
				
				$(".nh_sport").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
					// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}
		
	},250);
}

function hiddGame(){
	$(".nh_game").css({"z-index":99});
	gameTimeout = setTimeout(function(){
		gameTimeout = null;
		$(".it_game").removeClass("over");
		if(check()){
			$("#nh_game").stop(true).animate({"opacity":0},200,"easeInQuart",function(){
				
				$(".nh_game").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
				// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}else{
			$("#nh_game").stop(true).animate({"top":"0px"},200,"easeInQuart",function(){
				
				$(".nh_game").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
					// $(".nh_csn").css({"overflow":"hidden"});
				});
			});
		}
		
	},250);
}

function hiddCoupon() {
    $(".nh_coupon").css({"z-index":99});
    couponTimeout = setTimeout(function(){
        couponTimeout = null;
        $("#nav_coupon").removeClass("over");
        if(check()){
            $("#nh_coupon").stop(true).animate({"opacity":0},200,"easeInQuart",function(){
                
                $(".nh_coupon").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
                // $(".nh_csn").css({"overflow":"hidden"});
                });
            });
        }else{
            $("#nh_coupon").stop(true).animate({"top":"0px"},200,"easeInQuart",function(){
                
                $(".nh_coupon").stop(true).animate({"height":"0px"},200,"easeInQuart",function(){
                    // $(".nh_csn").css({"overflow":"hidden"});
                });
            });
        }

        //执行自定义事件
        $(document).trigger("CouponDropDownHide");
    },250);

}

function openCrownHd(){
	if(uv.l == null){
			dialog.info(l.Message, l.LoginThenEnter);
	}
    else{
        //越南市场未开放
        // if(gv.lang == "vi-vn") {
        //     window.location.href = "/vi-vn/ComingSoon.aspx";
        //     return;
        // }
		window.open("/integration/ld/getcasinourl.aspx","ld","depended=yes,height=766,width=1290");
	}
}

function openGdHd(){
	if(uv.l == null){
			dialog.info(l.Message, l.LoginThenEnter);
	}
    else {
        //越南市场未开放
        //if(gv.lang == "vi-vn") {
        //    //window.location.href = "/vi-vn/ComingSoon.aspx";
        //    return;
        //}
		window.open("/integration/gd/getcasinourl.aspx","gd","depended=yes,height=766,width=1290");
	}
}
function openEaHd(){
    //越南市场未开放
    if(gv.lang == "vi-vn") {
        //window.location.href = "/vi-vn/ComingSoon.aspx";
        return;
    }

	if(uv.l == null){
		dialog.info(l.Message, l.LoginThenEnter);
	}else{
		$("#ag_limit").fadeIn();
	}
}
function openPtHd(){
    //越南市场未开放
    if(gv.lang == "vi-vn") {
        //window.location.href = "/vi-vn/ComingSoon.aspx";
        return;
    }

    if(gv.lang == "zh-cn"){
        window.open("/ptcasino/launch.aspx"); 
    }else{
        window.open("/"+gv.lang+"/ptcasino/launch.aspx");  
    }
}

function openKeno(){
    if(gv.lang == "vi-vn") {
        return;
    }

	if(uv.l == null){
		dialog.info(l.Message, l.LoginThenEnter);
	}else{
	//	window.location.href="/zh-cn/keno/keno.aspx";
		// window.open("/zh-cn/keno/keno.aspx");
        var tempWindow = window.open("_blank", "lotto");
        tempWindow.location = "/zh-cn/keno/keno.aspx";
        tempWindow.focus();
	}
}
function downloadKeno(){
	// window.location.href="/zh-cn/mobile/Default.aspx?scroll=app";
    if(gv.lang == "vi-vn") {
        return;
    }

    window.location.href="/"+gv.lang+"/mobile/Default.aspx?scroll=app";
}
function downloadAndroid(){
	window.location.href="http://android.uedbet.com";
}

function check(){
	var bro = navigator.userAgent;//获取浏览器用户代理信息;

	if ($.support.leadingWhitespace){ 
		return true;
	}else{
		return false;
	}
}
/* joe end*/

/* 倒计时 */
//cd:天,时,分,秒元素
//callback:倒计时完成后执行的方法
//begintime:开始时间(2014/10/10 10:10)
function Countdown(cd, begintime, callback){
    var self = this;
    var nowStr = $("#time").text();
    nowStr = nowStr.replace(/-/g, "/");
    this.now = new Date(nowStr); //new Date(uv.t);
    this.now = this.now.getTime();
    this.beginTime = new Date(begintime);
    this.beginTime = this.beginTime.getTime();
    this.isstart = false; //是否已开始

    this.timer = null;

    this.timing = function () {
        var $this = this;

        var time = [];
        var value = $this.beginTime - $this.now;
        if (value <= 0) {
            time[0] = "00";
            time[1] = "00";
            time[2] = "00";
            time[3] = "00";
            this.isstart = true;
            clearInterval(this.timer);
            if (typeof callback != "undefined") { callback(); }
        } else {
            time[0] = Math.floor(value / (1000 * 60 * 60 * 24));
            value = value % (1000 * 60 * 60 * 24);
            time[1] = Math.floor(value / (1000 * 60 * 60));
            value = value % (1000 * 60 * 60);
            time[2] = Math.floor(value / (1000 * 60));
            value = value % (1000 * 60);
            time[3] = Math.floor(value / (1000));
        }
        //$("#"+cd).find(str).each(function(index, element){
        $(cd).each(function (index, element) {
            $(element).html(self.zero(time[index]));
        });

        $this.now += 1000;
        //setTimeout(function(){$this.timing();},1000);
    }

    this.zero = function(n){
        var n = parseInt(n, 10);
        if(n > 0){
            if(n <= 9){
                n = "0" + n;    
            }
            return String(n);
        }else{
            return "00";    
        }
    }

    this.timing();
    if(this.isstart == false)
    this.timer = setInterval(function(){ self.timing(); }, 1000);
}

/* 倒计时 end */


//#region 获取可抢得优惠券剩余票数
function PromoCodeRemain(id) {
    this.$el = $("#"+id);
    if(this.$el.length == 0) { return; }
    this.url = this.$el.attr("data-ajaxurl");
    if(this.url.length == 0) { return; }
    this.url += "?action=remain";

    this.timer = null;
}

PromoCodeRemain.prototype.Run = function () {
    var self = this;
    var $el = this.$el, url = this.url;

    $el.show();
    $.getJSON(url, function (res) {
        //出错
        if (res.status_code != "00") {
            //dialog.info("提示",ErrorMsg[res.status_code]);
            return;
        }

        var count = res.count;
        $el.find("em").html(count);

        if (count != 0) {
            //5秒轮训
            self.timer = setTimeout(function () { self.Run(); }, 5000);
        }
    });
}

PromoCodeRemain.prototype.Stop = function () {
    clearTimeout(this.timer);
}
//#endregion

//初始化头部优惠码倒计时
function InitHeaderPromotion() {

    if($("#ptCountdown").length == 0 && $("#alcpCountdown").length == 0 && $("#sportCountdown").length == 0) {
        return;
    }

    //对象集合
    var PromoRemainList = {};

    //var promotionstarttime = $("#ptCountdown").find("[type='hidden']").val();
    var alcpPromotionStartTime = $("#alcpCountdown").find("[type='hidden']").val();
    var sportPromotionStartTime = $("#sportCountdown").find("[type='hidden']").val();

    //pt588优惠券活动活动
    /*
    if (promotionstarttime.length == 0) {
        $("#ptCountdown").hide();
        $("#ptCouponNone").show();
    }
    else {

        //开始倒计时
        var ptcd = new Countdown("#ptCountdown div", promotionstarttime, function () {
            //隐藏状态
            if ($("#nh_coupon").css("opacity") == "0") {
                return;
            }

            //倒计时结束
            $("#ptCountdown").hide();
            if (typeof PromoRemainList.PT == "undefined") {
                PromoRemainList.PT = new PromoCodeRemain("ptCouponRemains");
            }

            PromoRemainList.PT.Run();
        });

        //导航“优惠券”展开
        $(document).bind("CouponDropDownShow", function (e) {
            //活动未开始
            if (ptcd.isstart == false) {
                return;
            }

            $("#ptCountdown").hide();
            if (typeof PromoRemainList.PT == "undefined") {
                PromoRemainList.PT = new PromoCodeRemain("ptCouponRemains");
            }
            PromoRemainList.PT.Run();

        }).bind("CouponDropDownHide", function (e) {
            //活动未开始
            if (ptcd.isstart == false) {
                return;
            }

            typeof PromoRemainList.PT != "undefined" && PromoRemainList.PT.Stop();
        });
    }
    */

    //pt88优惠券活动
    if (alcpPromotionStartTime.length == 0) {
        $("#alcpCountdown").hide();
        $("#alcpCouponNone").show();
    }
    else {

        //开始倒计时
        var alcpcd = new Countdown("#alcpCountdown div", alcpPromotionStartTime, function () {
            //隐藏状态
            if ($("#nh_coupon").css("z-index") == "99") {
                return;
            }

            //倒计时结束
            $("#alcpCountdown").hide();
            if (typeof PromoRemainList.ALCP == "undefined") {
                PromoRemainList.ALCP = new PromoCodeRemain("alcpCouponRemains");
            }

            PromoRemainList.ALCP.Run();
        });

        //导航“优惠券”展开
        $(document).bind("CouponDropDownShow", function (e) {
            //活动未开始
            if (alcpcd.isstart == false) {
                return;
            }

            $("#alcpCountdown").hide();
            if (typeof PromoRemainList.ALCP == "undefined") {
                PromoRemainList.ALCP = new PromoCodeRemain("alcpCouponRemains");
            }
            PromoRemainList.ALCP.Run();

        }).bind("CouponDropDownHide", function (e) {
            //活动未开始
            if (alcpcd.isstart == false) {
                return;
            }

            typeof PromoRemainList.ALCP != "undefined" && PromoRemainList.ALCP.Stop();
        });
    }

    //sport88优惠券活动
    if (sportPromotionStartTime.length == 0) {
        $("#sportCountdown").hide();
        $("#sportCouponNone").show();
    }
    else {

        //开始倒计时
        var sportcd = new Countdown("#sportCountdown div", sportPromotionStartTime, function () {

            //隐藏状态
            if ($("#nh_coupon").css("z-index") == "99") {
                return;
            }

            //倒计时结束
            $("#sportCountdown").hide();
            if (typeof PromoRemainList.SPORT == "undefined") {
                PromoRemainList.SPORT = new PromoCodeRemain("sportCouponRemains");
            }

            PromoRemainList.SPORT.Run();
        });

        //导航“优惠券”展开
        $(document).bind("CouponDropDownShow", function (e) {
            //活动未开始
            if (sportcd.isstart == false) {
                return;
            }

            $("#sportCountdown").hide();
            if (typeof PromoRemainList.SPORT == "undefined") {
                PromoRemainList.SPORT = new PromoCodeRemain("sportCouponRemains");
            }
            PromoRemainList.SPORT.Run();

        }).bind("CouponDropDownHide", function (e) {
            //活动未开始
            if (sportcd.isstart == false) {
                return;
            }

            typeof PromoRemainList.SPORT != "undefined" && PromoRemainList.SPORT.Stop();
        });
    }

}


function BindPromotionEvent() {

    var ptStartTime, sportStartTime;
    var ajaxing = false;

    $(document).bind("CouponDropDownShow", function (e) {//导航“优惠券”展开

        //第一次展开才需要去获取优惠券的开始时间
        if (typeof ptStartTime != 'undefined') {
            return;
        }

        GetPromotionTime();
    });


    //获取优惠券活动的开始时间
    function GetPromotionTime() {
        if (ajaxing) {
            return;
        }
        ajaxing = true;
        var url = "/service/promotions.ashx";
        $.getJSON(url, function (res) {
            ajaxing = false;
            ptStartTime = res.ptstarttime;
            sportStartTime = res.sportstarttime;

            //设置开始时间
            $("#alcpCountdown").find("[type='hidden']").val(ptStartTime);
            $("#sportCountdown").find("[type='hidden']").val(sportStartTime);

            //初始化
            InitHeaderPromotion();
        });
    }
}


// #region 存款教程
var HomeCourse = {
    obj:$("#win_course"),
    courseFlux : null,
    browser:"",
    onAnimate:false,
    init:function(){
        var $this = this;
        if($this.obj == null || $this.obj.length  == 0){
            return;
        }
        if(uv.l == null){
            $("#course_icon").hide();
            return;
        }
        
        $this.checkBrowser();
        $this.courseFlux = new flux.slider("#course_imgs_list", {autoplay:false, pagination:false});

        //读取cookies
        var ck = jQuery.cookie("h_course2");
        if(ck == null && uv.l != null){
            setTimeout(function(){
                $this.show();
            }, 5000);    
        }

        //设置弹窗位置
        $this.setWinPosition();


        $("#course_icon").click(function(){
            $this.show();
        });
        

        $("#left_ctrl, #right_ctrl").click(function(){
            $self = $(this);
            var direction = $self.attr("direction");
            $this.changeImage(direction);
        });
        //region 跟随鼠标切换图标
        $("#left_ctrl, #right_ctrl").mousemove(function(e){
            var $self = $(this);
            var x,y;
            var $target = $(e.target); 
            if($target.hasClass("wcs_c_icon")){
                var _x,_y;
                if($this.browser == "ff"){
                    _x = e.originalEvent.layerX;
                    _y = e.originalEvent.layerY;
                }else{
                    _x = e.offsetX;
                    _y = e.offsetY;
                }
                x = _x-$target.width()/2 + $this.px2Int($target.css("left"));
                y = _y-$target.height()/2 + $this.px2Int($target.css("top"));
            }else{
                if($this.browser == "ff"){
                    x = e.originalEvent.layerX;
                    y = e.originalEvent.layerY;
                }else{
                    x = e.offsetX;
                    y = e.offsetY;
                }
            }
            var w, h, _w, _h;
            w = $self.width();
            h = $self.height();
            // _w = $target.width()/2;
            // _h = $target.height()/2;
            _w = 0;
            _h = 0;
            if(x<-_w || y<-_h || x>w+_w || y>h+_h){
                $self.children("div").fadeOut(200);
            }else{
                $self.children("div").css({left:x,top:y});
            }
        });
        $("#left_ctrl, #right_ctrl").mouseenter(function(){
            var $self = $(this);
            $self.children("div").fadeIn(200);
        });
        $("#left_ctrl, #right_ctrl").mouseleave(function(){
            var $self = $(this);
            $self.children("div").fadeOut(200);
        });
        //endregion

        $("#close_win_course").click(function(event) {
            $this.close();
        });

        $(window).resize(function(){
            $this.setWinPosition();
        });
    },
    px2Int:function(px){
        px = px.replace("px", "");
        return parseInt(px,10);
    },
    setWinPosition:function(){
        //设置弹窗位置
        var top = ($(window).height() - 1080)/2;
        top = top < -100 ? -100 : top;
        $("#course_fixed").css({"top":top+"px"});
    },
    depositPopup:function(){
        // var $this = this;
        // var imgIndex;
        // var bankcode = $("input[name='bankType']:checked").attr("data-bankcode");
        // bankcode = bankcode.toLowerCase();
        // if(bankcode == "alipay"){
        //     imgHeight.
        // }else if(bankcode == "cmbc"){

        // }else if(bankcode == "ccb"){

        // }else if(bankcode == "icbc"){

        // }else{

        // }
        
        // HomeCourse.courseFlux.showImage(imgIndex, "bars");
        // if (jQuery.cookie("h_course2") == null) {
        //     setTimeout(function () {
        //         $this.show();
        //     }, 1000);
        // }
    },
    checkBrowser:function(){
        var $this = this;
        if((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)){
            $this.browser = "ie";
        }else if(navigator.userAgent.indexOf('Firefox') >= 0){
            $this.browser = "ff";
        }else if(navigator.userAgent.indexOf('Opera') >= 0){
            $this.browser = "op";
        }else if(navigator.userAgent.indexOf("Chrome") >= 0) {
            $this.browser = "cm";
        }else if(navigator.userAgent.indexOf("Safari") >= 0){
            $this.browser = "sf";
        }else if(navigator.userAgent.indexOf("rv:11.0") >= 0){
            $this.browser = "ie";
        }else{
            $this.browser = "ie";
        }
    },
    changeImage:function(direction){
        var $this = this;
        var nextIndex = 0;
        if(direction == "right"){
            nextIndex = $this.courseFlux.currentImageIndex - 1;
            nextIndex = nextIndex < 0 ? $this.courseFlux.images.length - 1 : nextIndex;
        }else{
            direction = "left";
            nextIndex = ($this.courseFlux.currentImageIndex + 1)%$this.courseFlux.images.length;
        }

        var method = "cube";
        var opt = {direction:direction};

        if($this.browser == "ie"){
            method = "explode";
        }

        $this.courseFlux.showImage(nextIndex, method, opt);
    },
    show:function(){
        var $this = this;
        $this.showAnimate();
        jQuery.cookie("h_course2","1",{expires:1,path:"/"});
    },
    showAnimate:function(){
        var $this = this;
        // if($this.onAnimate){
        //     return;
        // }
        // $this.onAnimate = true;
        $("#course_fixed").show();
        $("#course_icon").addClass("hide_anim_icon");
        setTimeout(function(){
            $("#course_main").addClass("show_anim_main");
            // $this.obj.addClass("show_anim");
            $("#course_bg").addClass("show_anim_shadow");
        },100);
        // setTimeout(function(){
        //     $this.onAnimate = false;
        // },1000);
    },
    close:function(){
        var $this = this;
        $this.hideAnimate();
        //jQuery.cookie("h_course2","1",{expires:1,path:"/"});
    },
    hideAnimate:function(){
        var $this = this;
        // $this.obj.removeClass("show_anim").addClass("hide_anim");
        // if($this.onAnimate){
        //     return;
        // }
        // $this.onAnimate = true;
        $("#course_bg").removeClass("show_anim_shadow");
        $("#course_main").removeClass("show_anim_main");
        // if(false){
        //     $("#course_fixed").hide();
        // }else{
            setTimeout(function(){
                $("#course_fixed").hide();
                $("#course_icon").removeClass("hide_anim_icon");
                // $this.onAnimate = false;
            },500);
        // }
    }
};
// #regionend 

//头部语言切换
var HeaderLangSwtich = function() {

    var $langSwitch = $("#langSwitch");

    var timer;
    function BindEvent() {
        $("#current-lang").mouseenter(function(){
            clearTimeout(timer);
            $langSwitch.stop(true,true).fadeIn();
        }).mouseleave(function() {
            HideLangSwitch();
        });

        $langSwitch.mouseenter(function() {
            clearTimeout(timer);
        }).mouseleave(function() {
            HideLangSwitch();
        });
    }

    //隐藏语言选择框
    function HideLangSwitch() {
        timer = setTimeout(function(){
            $langSwitch.stop(true,true).fadeOut();
        }, 200);
    }

    return {Init: function(){ BindEvent();}}
}();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值