/* Js for , Version=1777631584 */
 v.lang = {"confirmDelete":"\u60a8\u78ba\u5b9a\u8981\u57f7\u884c\u522a\u9664\u64cd\u4f5c\u55ce\uff1f","deleteing":"\u522a\u9664\u4e2d","doing":"\u8655\u7406\u4e2d","loading":"\u52a0\u8f09\u4e2d","updating":"\u66f4\u65b0\u4e2d...","timeout":"\u7db2\u7d61\u8d85\u6642,\u8acb\u91cd\u8a66","errorThrown":"\u57f7\u884c\u51fa\u932f\uff1a","continueShopping":"\u7e7c\u7e8c\u8cfc\u7269","required":"\u5fc5\u586b","back":"\u8fd4\u56de","continue":"\u7e7c\u7e8c","bindWechatTip":"\u767c\u5e16\u529f\u80fd\u8a2d\u7f6e\u4e86\u7d81\u5b9a\u5fae\u4fe1\u7684\u9650\u5236\uff0c\u8acb\u5148\u7d81\u5b9a\u5fae\u4fe1\u6703\u54e1\u3002","importTip":"\u53ea\u5c0e\u5165\u4e3b\u984c\u7684\u98a8\u683c\u548c\u6a23\u5f0f","fullImportTip":"\u5c07\u6703\u5c0e\u5165\u6e2c\u8a66\u6578\u64da\u4ee5\u53ca\u66ff\u63db\u7ad9\u9ede\u6587\u7ae0\u3001\u7522\u54c1\u7b49\u6578\u64da"};;v.fullScreen = 0;;$().ready(function() { $('#execIcon').tooltip({title:$('#execInfoBar').html(), html:true, placement:'right'}); }); ;$(document).ready(function()
{
    $('.nav-system-book').addClass('active');
    $('#navbar li.active').parents('li').addClass('active');
    $('#article' + v.objectID).addClass('active');
    $('#article' + v.objectID).parents('dd').each(function()
    {
        $(this).attr('class', $(this).attr('class').replace('closed', 'opened'));
        $(this).addClass('active');
    })
    if(v.fullScreen)
    {
        $('html, body').css('height', '100%');

        var hash = window.location.hash;
        if(hash.indexOf('#article') === 0)
        {
            var $selected = $(hash);
            if($selected.length) $selected[0].scrollIntoView();
        }

        $('.article').each(function()
        {
            var $article = $(this);
            var $a = $article.children('a');
            if($a.length) $a.attr('href', $a.attr('href') + '#' + $article.attr('id'));
        });
    }

    $('dd > span').click(function()
    {
        if($(this).parent().attr('class').indexOf('closed') != '-1')
        {
            $(this).parent().attr('class', $(this).parent().attr('class').replace('closed', 'opened'));
            $(this).parent().find('dd').each(function()
            {
                $(this).attr('class', $(this).attr('class').replace('closed', 'opened'));
            })
        }
        else
        {
            $(this).parent().attr('class', $(this).parent().attr('class').replace('opened', 'closed'));
            $(this).parent().find('dd').each(function()
            {
                $(this).attr('class', $(this).attr('class').replace('opened', 'closed'));
            })
        }
    });

    $('dd a').click(function()
    {
        if($('.article.book-content').length !== 0)
        {
            getContent(this);
            return false;
        }
    });

    $('body').on("click",".icon-next a, .icon-previous a, .previous a, .next a",function()
    {
        if($('.article.book-content').length !== 0)
        {
            getContent(this);
            return false;
        }
    });

    $('body').on("blur",'.popover input',function()
    {
        $('[data-toggle="popover"]').popover('hide');
        return false;
    });


    function getContent(obj)
    {
        if($(obj).parent().attr('class').indexOf('disabled') != '-1') return false;
        var url = $(obj).attr('href');
        if($('.article.book-content').length !== 0)
        {
            $('.col-md-9').load(url + ' .col-md-9 > div', function(response)
            {
                if($(response).find('.col-md-9').length === 0)
                {
                    $('.col-md-9').html("<div class='article book-content'>" + $(response).find('.modal-dialog').html() + "</div>")
                }
                $('.breadcrumb').html($(response).find('.breadcrumb').html());
                init();
            });
        }
        else
        {
            $.get(url, function(data)
            {   
                $('.fullScreen-content').html($(data).find('.fullScreen-content').html());
                $('.fullScreen-nav').html($(data).find('.fullScreen-nav').html());
                init();
            })
        }
    }

    function init()
    {
        var objectID = $('#id').val();
        $('.article').removeClass('active');
        $('#article' + objectID).addClass('active');
        $('#article' + objectID).parents('dd').each(function()
        {
            $(this).attr('class', $(this).attr('class').replace('closed', 'opened'));
            $(this).addClass('active');
        })
        if($(".books dd.article.active > a").attr('href'))
        {
            if($(".qrcode-mobile").length)
            {
                articleID = $(".books dd.article.active").attr('id').substr('7');
                if($(".qrcode-mobile").attr('data-src'))
                {
                    length = $(".qrcode-mobile").attr('data-src').indexOf('qrcode');
                    $(".qrcode-mobile").attr('data-src', createLink('misc', 'qrcode', 'articleID=' + articleID));
                }
                else
                {
                    length = $(".qrcode-mobile").attr('src').indexOf('qrcode');
                    $(".qrcode-mobile").attr('src', createLink('misc', 'qrcode', 'articleID=' + articleID));
                }
            }
        }
        $('[data-toggle="popover"]').popover(
        { 
            content : v.scheme + "://" + v.httpHost + $(".books dd.article.active a").attr('href'),
            template : '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><input class="form-control" type="text" value=' + v.scheme + "://" + v.httpHost + $(".books dd.article.active a").attr('href') + '></div></div>',
            trigger : 'click',
        });
        $('[data-toggle="popover"]').tooltip({placement : 'right', title : v.copySuccess, trigger : 'manual'});
    }

    $(window).keydown(function(e)
    {
        if(e.keyCode == 37) getContent($('.previous a'));
        if(e.keyCode == 39) getContent($('.next a'));
    });

    init();
});
/**header**/
if(typeof(allSwitch) === 'undefined')
{
    allSwitch = true;
    ;(function (){
        var iconNav   = [ 
                        '<span><i class="icon icon-home"></i></span>',
                        '<span><i class="icon icon-user"></i></span>',
                        '<span><i class="icon icon-plane"></i></span>',
                        '<span><i class="icon icon-phone"></i></span>',
                        '<span><i class="icon icon-globe"></i></span>'
                    ]; 
        $('#navbarCollapse .nav').children('li').each(function (index)
        {
            $(this).find('a').append(iconNav[index]);
        });
        
        var lognUrl  = $('#siteNav a').eq(0).attr('href');
        var exitUrl  = $('#siteNav a').eq(1).attr('href');
        var lognHtml = $('#siteNav a').eq(0).html();
        var exitHtml = $('#siteNav a').eq(1).html();
        if(lognHtml != '登録')
        {
            lognHtml   = "信息";
            lognHtmlIm = "箇人信息";
        }
        else
        {
            lognHtml   = "登録";
            lognHtmlIm = "立卽登録";
        }
        var sideHtml = '<button class="qqIcon btn">' +
                       '<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=944855755&site=qq&menu=yes">' +
                       '<div class="front"><i class="icon icon-qq"></i><span>客服</span></div>' +
                       '<div class="title"><span>點擊諮詢</span></div></a>' +
                       '</button>' + 
                       '<button class="qqIcon btn">' +
                       '<a target="_blank" href="http://www.xieshengcar.com/index.php/page/7.html">' +
                       '<div class="front"><i class="icon icon-plane"></i><span>租車</span></div>' +
                       '<div class="title"><span>我要租車</span></div></a>' +
                       '</button>'+
                       '<button class="qqIcon btn">' +
                       '<a href="' + lognUrl + '">' +
                       '<div class="front"><i class="icon icon-key"></i><span>' + lognHtml + '</span></div>' +
                       '<div class="title"><span>' + lognHtmlIm + '</span></div></a>' +
                       '</button>' + 
                       '<button class="qqIcon btn">' +
                       '<a href="' + exitUrl + '">' +
                       '<div class="front"><i class="icon icon-lock"></i><span>' + exitHtml + '</span></div>' +
                       '<div class="title"><span>我要' + exitHtml + '</span></div></a>' +
                       '</button>';
        $('#rightDocker').append(sideHtml);
        
    })();
}

;
var hash = window.location.hash.substring(1);
var browserLanguage = navigator.language || navigator.userLanguage; 
var resolution      = screen.availWidth + ' X ' + screen.availHeight;
$.get(createLink('log', 'record', "hash=" + hash), {browserLanguage:browserLanguage, resolution:resolution});
