/* Js for , Version=1775247071 */
 v.lang = {"confirmDelete":"Do you want to delete it?","deleteing":"Deleting","doing":"Doing","loading":"Loading","updating":"Updating","timeout":"Timeout. Please try it again.","errorThrown":"Error : ","continueShopping":"Continue shopping","required":"Required","back":"Back","continue":"Continue","bindWechatTip":"Posting sets the limit for binding WeChat. Please bind WeChat user first.","importTip":"Old layout data will be replaced","fullImportTip":"Old article, product, layout data will be replaced and import test data"};;$(document).ready(function()
{   
    $.setAjaxForm('#replyForm', function(data)
    {
        if(data.result == 'success')
        {
            setTimeout(function(){parent.location.reload()}, 1500);
        }
        else
        {
            if(data.reason == 'needChecking')
            {
                $('#captchaBox').html(Base64.decode(data.captcha)).show();
            }

            if(response.locate) window.location.href = response.locate;
        }
    }); 
});
$(document).ready(function()
{
    if($("#headNav nav > a:first-child").text() == 'Login'){
        $("#headNav nav > a:first-child").text('Log in'); 
    }
    if($("#headNav nav > a:last-child").text() == 'Register'){
        $("#headNav nav > a:last-child").text('Sign up'); 
    }

    $('#siteNav a[href="/user-register.html"]').remove();
    setTimeout(function() {$('#language').after($('#siteNav'));}, 200);
    
    if(typeof headerList != 'undefined') return false;
    headerList = true;
    searchICON = '<a class="search-but">' + '<i' + ' class="icon icon-search"></i></a>';
    $("#navbar li.nav-item-searchbar").prepend(searchICON);
    
    $("#words").attr('placeholder','Search');
    
    $(".search-but").click(function(){
        $("#searchbar").fadeToggle();
    });
    
    $("#reg #panel-pure #heading-title").text('Register');
    $("#login #login-region .panel-heading span").text('Login'); 
    $(".m-user-login .page-wrapper").before('<div class="banner-wrap"><div class="banner"><h3>Welcome to login</h3></div></div>');
    $(".m-user-register .page-wrapper").before('<div class="banner-wrap"><div class="banner"><h3>Welcome to register</h3></div></div>');
    $(".m-extension .page-wrapper").before('<div class="banner-wrap"><div class="banner"><h3>Extension</h3></div></div>');

    $('#language').insertAfter('#navbarWrapper');
    $('#language').next().remove();
    
    if(location.pathname.includes('download')) 
    {
        $('.article table a').click(function(e)
        {
            e.preventDefault();
            if($(this).attr('href').includes('dl'))
            {
                location.href = "/page/downloadComplete.html";
                sessionStorage.setItem('downloadUrl', $(this).attr('href'));
            }
        })
    }
    
    if(!location.href.includes('/page')) $('.navbar-nav li').removeClass('active');
});

// $(function(){
//     window.Intercom('boot', {
//       app_id: "buxeg11n",
//       bottom: 80,
//       right: 26,
//     });
// });

if(screen.width > 767){
    $("#navbar .dropdown").mouseover(function(e){
        $(this).addClass('open');
    });
    $("#navbar .dropdown").mouseout(function(e) {
        $(this).removeClass('open');
    });
};

function getCaptcha($ele)
{
    $.get(createLink('guarder', 'getCaptcha'), function(response)
    {
        if(response.result == 'success')
        {
            $ele.html(response.captchaContent);
        }
    })
}

$('#captchaBox').on('click', '.img-wrapper', function()
{
    getCaptcha($(this));
});
;
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});
