﻿//var notip = "javascript:alert('敬请期待');";
//var currentUrl = location.href;

//name:名称 url:链接地址 img:内页导航列表的二级菜单图片 regex:判断当权url的正则表达式 dshow:是否在首页显示 lshow:是否在内页导航栏显示
//var bzmap = {
//    //==**一级目录**==//
//    110000:{name:'首页',url:'http://localhost:16377/Default.aspx'},
//    
//    //==**二级目录**==//
//    110100:{name:'账号中心',url:'http://localhost:16377/AccountCenter/AccountModify.aspx',img:'/images/8zsq_36.jpg',regex:null,dshow:true,lshow:true},
//    110200:{name:'充值中心',url:'http://localhost:16377/BillingCenter/BillingIndex.aspx',img:'/images/8zsq_66.jpg',regex:null,dshow:true,lshow:true},
//    110300:{name:'客服中心',url:'http://210.21.221.149/Default.aspx',img:null,regex:null,dshow:true,lshow:true},
//    110400:{name:'商务中心',url:notip,img:null,regex:null,dshow:true,lshow:true},
//    110500:{name:'推广中心',url:notip,img:null,regex:null,dshow:true,lshow:true},
//    110600:{name:'账号登陆',url:'http://localhost:16377/LoginCenter/Login.aspx',img:null,regex:/\/LoginCenter\/Login.aspx/i,dshow:false,lshow:false},
//    110700:{name:'用户协议',url:'http://localhost:16377/BZDcoument/UserAgreement.aspx',img:null,regex:/\/BZDcoument\/UserAgreement.aspx/i,dshow:false,lshow:false},
//    110800:{name:'帮助中心',url:'http://localhost:16377/HelpCenter/HelpIndex.aspx',img:'/images/8zsq_125.jpg',regex:null,dshow:false,lshow:true},
//    
//    //==**三级目录**==//
//    
//    //=*账号中心部分*=//
//    110101:{name:'账号注册' ,  url:'http://localhost:16377/AccountCenter/Register.aspx'                ,dshow:true,lshow:false,regex:/\/AccountCenter\/Register/i    },
//    110102:{name:'账号管理' ,  url:'http://localhost:16377/AccountCenter/AccountModify.aspx'           ,dshow:true,lshow:true,regex:/\/AccountCenter\/Account/i     },
//    110103:{name:'密码管理' ,  url:'http://localhost:16377/AccountCenter/PWCenter.aspx'                ,dshow:true,lshow:true,regex:/\/AccountCenter\/(PW|GamePW)/i          },
//    110104:{name:'防沉迷认证' ,url:'http://localhost:16377/AccountCenter/AntiIndulgeIDCardSearch.aspx' ,dshow:true,lshow:true,regex:/\/AccountCenter\/AntiIndulge/i },
//    
//    //=*充值中心部分*=//
//    110201:{name:'充值八泽币'  ,url:'http://localhost:16377/BillingCenter/ChargeTypeSelect.aspx',dshow:true,lshow:false,regex:null},
//    110202:{name:'兑换游戏元宝',url:'http://localhost:16377/BillingCenter/BillingIndex.aspx',dshow:true,lshow:false,regex:null},
//    110203:{name:'我要充值',url:'http://localhost:16377/BillingCenter/BillingIndex.aspx',dshow:false,lshow:true,regex:/\/BillingCenter\/(Bank|BZPoint|Card|Other|MobilCard|BillingIndex|ChargeSuccess|ChargeTypeSelect)/i},
//    110204:{name:'转赠八泽币'  ,url:'http://localhost:16377/BillingCenter/TransferBZPoint.aspx',dshow:true,lshow:true,regex:/\/BillingCenter\/Transfer/i},
//    110205:{name:'账户明细查询',url:'http://localhost:16377/BillingCenter/BillingDetails.aspx',dshow:true,lshow:true,regex:/\/BillingCenter\/BillingDetails/i},
//    110206:{name:'充值帮助',url:'http://localhost:16377/HelpCenter/HelpIndex.aspx',dshow:false,lshow:true,regex:null},
//    
//    //=*客服中心部分*=//
//    110301:{name:'获得客服帮助' ,url:'http://210.21.221.149/CSHelpCenter/Main.aspx',dshow:true,lshow:true,regex:/\/CSHelpCenter/i},
//    110302:{name:'服务守则'     ,url:'http://210.21.221.149/ServiceRule.aspx',dshow:true,lshow:true,regex:/\/ServiceRule.aspx/i},
//    110303:{name:'客服FAQ'      ,url:'http://210.21.221.149/CSFAQ/Main.aspx',dshow:true,lshow:true,regex:/\/CSFAQ/i},
//    110304:{name:'违规处理'     ,url:'http://210.21.221.149/ViolationHandling.aspx',dshow:true,lshow:true,regex:/\/ViolationHandling.aspx/i},
//    110305:{name:'表格下载'     ,url:'http://210.21.221.149/FormsDownload.aspx',dshow:true,lshow:true,regex:/\/FormsDownload.aspx/i},
//    
//    
//    //=*商务中心部分*=//
//    110401:{name:'商务中心',url:notip,dshow:true,lshow:true,regex:null},
//    110402:{name:'商务合作',url:notip,dshow:true,lshow:true,regex:null},
//    
//    
//    //=*推广中心部分*=//
//    110501:{name:'公司简介',url:notip,dshow:true,lshow:true,regex:null},
//    110502:{name:'推广合作',url:notip,dshow:true,lshow:true,regex:null},
//    110503:{name:'渠道合作',url:notip,dshow:true,lshow:true,regex:null},
//    
//    //=*帮助中心*=//
//    110801:{name:'热点问题',url:'http://localhost:16377/HelpCenter/HelpIndex.aspx',dshow:true,lshow:true,regex:/\/HelpCenter\/HelpIndex/i},
//    110802:{name:'购卡支付帮助',url:'http://210.21.221.149/HelpCenter/CardIndex.aspx',dshow:true,lshow:true,regex:/\/HelpCenter\/Card/i},
//    110803:{name:'如何充值',url:'http://210.21.221.149/HelpCenter/ChargeIndex.aspx',dshow:true,lshow:true,regex:/\/HelpCenter\/Charge/i}
//};
var sStr = " | ";
var bStr = "<br/>";
var gStr = "  &gt;  ";
//首页列表 模块间的横线
var lStr = "<div style=\" padding-top:10px; padding-bottom:10px; text-align:center;\"><img src=\"/images/index-xian.gif\" width=\"214\" height=\"1\" /></div>";
//首页列表 模块模板
var mTemplate = "<div style=\"padding-left:19px;\"><img src=\"/images/index-tubiao.gif\" width=\"5\" height=\"7\" style=\"margin-right:7px;\" /><span class=\"zi-1\">{0}</span></div><div style=\"padding-left:31px;\" class=\"zi-2\">{1}</div>";
//首页列表 链接模板
var lTemplate = "<a  href=\"{0}\">{1}</a>";
//内页导航条 模板
var bTemplate = "<div style=\"padding-left:15px; float:left;\">{0}</div>";
//内页导航列表 模板
var iTemplate = "<div style=\"width:200px; height:35px; padding-left:30px; padding-top:25px;\"><img src=\"{0}\" /></div><div style=\" width:218px;height:{3}px;background:url({1}) no-repeat 13px 0px;\">{2}</div>";
//内页导航列表 链接模板
var kTemplate = /*"<div style=\" padding-left:45px; padding-top:18px;\"><a href=\"{0}\" class=\"leftmenu\">{1}</a></div>";*/"<div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;'><div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div><a href='{0}' class='leftmenu'>{1}</a></div><div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div>";
//生成首页列表
function createDefaultMenu()
{
    var html = new Array();
    for(var k in bzmap)
    {
        if(k%10000 !=0 && k%100 ==0 && bzmap[k].dshow)
        {
            var temp = new Array();
            var test = new Array();
            for(var j in bzmap)
            {
                if(j-k>0 && j-k<100 && bzmap[j].dshow)
                {
                    test[test.length] = bzmap[j].name;
                    if(temp.length !=0)
                    {
                        if(getByteLen(test.join(sStr)) >32)
                        {
                            temp[temp.length] = bStr;
                            test.length = 0;
                        }
                        else
                        {
                            temp[temp.length] = sStr;
                        }
                    }
                    temp[temp.length] = lTemplate.format(bzmap[j].url,bzmap[j].name);
                }
            }
            html[html.length] = mTemplate.format(bzmap[k].name,temp.join(""));
        }
    }
    document.write(html.join(lStr).replace(/\|/g," | "));
}

//生成内页导航条
function createInnerBar()
{
    var cnode = null;
    var fnode = null;
    var gnode = null;
    
    //三级节点中寻找
    for(var k in bzmap)
    {
        if(k%100 != 0)
        {
            if(bzmap[k].regex != null && bzmap[k].regex.test(currentUrl))
            {
                cnode = bzmap[k];
                fnode = bzmap[k-k%100];
                gnode = bzmap[k-k%10000];
                break;
            }
        }
    }
    
    //二级目录中寻找
    for(var k in bzmap)
    {
        if(k%10000 != 0 && k%100 == 0)
        {
            if(bzmap[k].regex != null && bzmap[k].regex.test(currentUrl))
            {
                fnode = bzmap[k];
                gnode = bzmap[k-k%10000];
                break;
            }
        }
    }
    
    var html = new Array();
    
    if(gnode != null)
    {
        html[html.length] = lTemplate.format(gnode.url,gnode.name);
    }
    if(fnode != null)
    {
        html[html.length] = lTemplate.format(fnode.url,fnode.name);
    }
    if(cnode != null)
    {
        html[html.length] = lTemplate.format(cnode.url,cnode.name);
    }
    if(html.length > 0)
    {
        document.write(bTemplate.format(html.join(gStr)));
    }
}

function createInnerMenu()
{
    var cid = null;
    var fid = null;
    
    for(var k in bzmap)
    {
        if(k%100 != 0)
        {
            if(bzmap[k].regex != null && bzmap[k].regex.test(currentUrl))
            {
                cid = k;
                fid = k-k%100;
                break;
            }
        }
    }
    if(cid == 110203)
    {
        var octRegex = /\/BillingCenter\/(Bank|Card|MobilCard|Other|BZPoint)/i;// /\/BillingCenter\/(Bank|BZPoint|Card|MobilCard|Other|ChargeTypeSelect)/i
        if(octRegex.test(currentUrl))
        {
            if(currentUrl.indexOf("gameid") >-1)
            {
                var gid = parseInt(currentUrl.split("gameid=")[1],10);
                if(gid > 0)
                {
                    document.write(octstr.format("ChargeGamePoint.aspx?gameid="+gid,"?gameid="+gid));
                    return;
                }
            }
            document.write(octstr.format("ChargeBZPoint.aspx",""));
            return;
        }
        
    }
    
    if(fid != null && bzmap[fid].lshow)
    {
        var temp = new Array();
        for(var k in bzmap)
        {
            if(k-fid >0 && k-fid < 100 && bzmap[k].lshow)
            {
                if(k==cid)
                {
                    temp[temp.length] = kTemplate.format(bzmap[k].url,"<span>"+bzmap[k].name+"</span>");
                }
                else
                {
                    temp[temp.length] = kTemplate.format(bzmap[k].url,bzmap[k].name);
                }
            }
        }
        var bimg = "/images/8zsq_43_2.jpg";
        var bh = temp.length*30;
        document.write(iTemplate.format(bzmap[fid].img,bimg,temp.join(""),bh));
    }
}

function changeMenu(o)
{
    var all = $("divOtherChargeType").childNodes;
    for(var i=0;i<all.length;i++)
    {
        if(all[i].childNodes[0] != o)
        {
            all[i].childNodes[1].style.display = "none";
        }
    }
    var p = o.parentNode;
    if(p.childNodes[1].style.display == "none")
    {
        p.childNodes[1].style.display = "";
    }
    else
    {
        p.childNodes[1].style.display = "none";
    }
}

function hideChangeByBZPoint()
{
    var o = document.getElementById("divBZPoint");
    if(o != null)
    {
        o.style.display = "none";
    }
}

var oct = new Array();
oct[oct.length] = "<div style=' width:200px; height:35px; padding-left:30px; padding-top:25px;'><img src='/images/8zsq_78.jpg' width='148' height='23' /></div>";
oct[oct.length] = "<div style=' width:218px; height:189px; background:url(/images/8zsq_43_2.jpg) no-repeat 13px 0px;' id = 'divOtherChargeType'>";

if(currentUrl.indexOf("gameid") >-1)
{
    oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
    oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
    oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>八泽点券充值</span></a></div><div style ='display:none'>";
    oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/BZPoint/{0}' class='leftmenu'>·立即充值</a></div>";
    //oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Charge/ExplainBZPoint.aspx' class='leftmenu' target = '_blank'>·什么是八泽点券</a></div>";
    oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Charge/ExplainBZPoint.aspx' class='leftmenu'  target = '_blank'>·什么是八泽点券</a></div></div>";
    oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";
}

oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>八泽游戏一卡通充值</span></a></div><div style ='display:none'>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Other/BuyVirtualCard.aspx{1}' class='leftmenu' >·购买充值卡</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Card/{0}' class='leftmenu'>·立即充值</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Card/BZCard.aspx' class='leftmenu'  target = '_blank'>·操作帮助</a></div></div>";
oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";

oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>网上银行充值</span></a></div><div style ='display:none'>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Other/OpenNetBank.aspx{1}' class='leftmenu'>·网银开通流程</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Bank/{0}' class='leftmenu'>·立即充值</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Card/BankCard.aspx' class='leftmenu' target = '_blank'>·操作帮助</a></div></div>";
oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";

oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>神州行充值卡充值</span></a></div><div style ='display:none'>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/MobilCard/{0}' class='leftmenu'>·立即充值</a></div>";
//oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='#' class='leftmenu' target = '_blank'>·购买神州行</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Card/SZXCard.aspx' class='leftmenu' target = '_blank'>·操作帮助</a></div></div>";
oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";

oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>固定电话充值</span></a></div><div style ='display:none'>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Other/BuyTelephoneCard.aspx{1}' class='leftmenu'>·购买声讯卡</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Card/{0}' class='leftmenu'>·立即充值</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Card/Telephone.aspx' class='leftmenu' target = '_blank'>·操作帮助</a></div></div>";
oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";

oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>短信充值</span></a></div><div style ='display:none'>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Other/BuyShotMessageCard.aspx{1}' class='leftmenu'>·购买短信卡</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Card/{0}' class='leftmenu'>·立即充值</a></div>";
oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Card/ShotMessage.aspx' class='leftmenu' target = '_blank'>·操作帮助</a></div></div>";
oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";

//oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
//oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
//oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>使用点券充值</span></a></div><div style ='display:none'>";
//oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/BZPoint/{0}' class='leftmenu'>·立即充值</a></div>";
////oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Charge/ExplainBZPoint.aspx' class='leftmenu' target = '_blank'>·什么是八泽点券</a></div>";
//oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Charge/ExplainBZPoint.aspx' class='leftmenu'  target = '_blank'>·什么是八泽点券</a></div></div>";
//oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";

//oct[oct.length] = "<div style=' width:218px; float:left;'><div style=' width:169px; height:15px; float:left; padding-left:45px; padding-top:12px;' onclick = 'javascript:changeMenu(this)'>";
//oct[oct.length] = "<div style=' width:10px; height:12px; float:left; padding-top:5px;'><img src='/images/index-tubiao.gif' /></div>";
//oct[oct.length] = "<a href='javascript:void(0)' class='leftmenu'><span>充值卡充值</span></a></div><div style ='display:none'>";
//oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Card/{0}' class='leftmenu'>·立即充值</a></div>";
//oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/BillingCenter/Other/BuyBZCard.aspx{1}' class='leftmenu'>·购买充值卡</a></div>";
//oct[oct.length] = "<div style=' width:159px; height:15px; float:left; padding-left:55px; padding-top:8px;'><a href='/HelpCenter/Card/BZCard.aspx' class='leftmenu' target = '_blank'>·操作帮助</a></div></div>";
//oct[oct.length] = "<div style=' width:194px; height:5px;  float:left; padding-left:20px;'><img src='/images/8zsq_fenge.jpg' /></div></div>";
oct[oct.length] = "</div>";
var octstr = oct.join("");