var mts_chat_options = {};
(function () {
    var contaner = document.createElement("div");
    contaner.id = "online_chat";
    document.body.appendChild(contaner);

    mts_chat_options = {
        serverName: 'https://chat-server.mgts.ru',
        loginUrl: 'https://login.mgts.ru:443/amserver/UI/Login?service=chat&goto=',
        checkAuthorize: 'https://chat-server.mgts.ru/api/webchat/GetAuthorizeToken',
        afterLogin: 'http://chat-client.mgts.ru/Chat/AfterLogin',
        slidingExpirationLocalState: '{"months":0, "days":0, "hours": 0, "minutes": 15, "seconds": 0}',
        slidingExpirationReadMessage: '{"months":0, "days":0, "hours": 0, "minutes": 0, "seconds": 30}',
        allowedFileExtensions: ['.png', '.bmp', '.gif', '.jpg', '.jpeg', '.txt', '.doc', '.docx', '.xls', '.xlsx', '.pdf'],
        urlStyle: "https://chat-client.mgts.ru/online_chat/style/window.css",
        urlsBundles: [
            "https://chat-client.mgts.ru/online_chat/vendors~window.bundle.js",
            "https://chat-client.mgts.ru/online_chat/window.bundle.js"
        ],
        chatBotName: "Ева",
        chatBotAvatar: "",
        chatName: "МГТС",
        chatSystemName: "МГТС",
        chatSystemAvatar: "",
        baseHost: "https://chat-client.mgts.ru",
    };

    var fontscss = "@font-face {font-family: 'Corpid'; src: url('https://chat-client.mgts.ru/online_chat/fonts/CorpidE1SCd_Regular.eot'); src: url('https://chat-client.mgts.ru/online_chat/fonts/CorpidE1SCd_Regular.eot?#iefix') format('embedded-opentype'), url('https://chat-client.mgts.ru/online_chat/fonts/CorpidE1SCd_Regular.woff2') format('woff2'), url('https://chat-client.mgts.ru/online_chat/fonts/CorpidE1SCd_Regular.woff') format('woff'), url('https://chat-client.mgts.ru/online_chat/fonts/CorpidE1SCd_Regular.ttf') format('truetype'), url('https://chat-client.mgts.ru/online_chat/fonts/CorpidE1SCd_Regular.svg#Corpid') format('svg');font-style: normal;font-weight: normal;}";
    var fontsstyle = document.createElement("style");
    fontsstyle.appendChild(document.createTextNode(fontscss));
    document.head.appendChild(fontsstyle);
    var imagescss = ".chat_pkMMXIX .chat__header-close { background: url('https://chat-client.mgts.ru/online_chat/imgs/close.svg') no-repeat center;}"
        + ".chat_pkMMXIX .chat__message[data-status='load'] .chat__message-inner:before {background: url('https://chat-client.mgts.ru/online_chat/imgs/loader.png') no-repeat center;}"
        + ".chat_pkMMXIX .chat__rate_stars .chat__rate-items label { background: url('https://chat-client.mgts.ru/online_chat/imgs/star.svg') no-repeat center center transparent;}"
        + ".chat_pkMMXIX .chat__rate_stars .chat__rate-items label.is-active { background-image: url('https://chat-client.mgts.ru/online_chat/imgs/star_red.svg');}"
        + ".chat_pkMMXIX .chat__rate_stars .chat__rate-items input:checked + label {background-image: url('https://chat-client.mgts.ru/online_chat/imgs/star_red.svg');}"
        + ".chat_pkMMXIX .chat__file.is-load .chat__file-icon:before { background: url('https://chat-client.mgts.ru/online_chat/imgs/loader_file.svg') no-repeat center center;}"
        + ".chat_pkMMXIX .chat__file-icon:after { background: url('https://chat-client.mgts.ru/online_chat/imgs/file-dowload.svg') no-repeat center center;}"
        + ".chat_pkMMXIX .chat__send {background-image: url('https://chat-client.mgts.ru/online_chat/imgs/upsvg.svg');}"
        + ".chat_pkMMXIX .chat__send[disabled] {background-image: url('https://chat-client.mgts.ru/online_chat/imgs/upsvg_disabled.svg');}"
        + ".chat_pkMMXIX .chat__send[disabled]:hover {background-image: url('https://chat-client.mgts.ru/online_chat/imgs/upsvg.svg');}"
        + ".chat_pkMMXIX .chat__tags-trigger {background-image: url('https://chat-client.mgts.ru/online_chat/imgs/tags.svg');}"
        + ".chat_pkMMXIX .chat__tags-trigger.is-active {background-image: url('https://chat-client.mgts.ru/online_chat/imgs/tags_active.svg');}"
        + ".chat_pkMMXIX .chat .icon_sound-off {background: url('https://chat-client.mgts.ru/online_chat/imgs/volume.svg') center center no-repeat;}"
        + ".chat_pkMMXIX .chat .icon_sound-on {background: url('https://chat-client.mgts.ru/online_chat/imgs/volume_off.svg') center center no-repeat;}";
    var imagesstyle = document.createElement("style");
    imagesstyle.appendChild(document.createTextNode(imagescss));
    document.head.appendChild(imagesstyle);
    var style = document.createElement("link");
    style.href = "https://chat-client.mgts.ru/online_chat/style/button.css";
    style.rel = "stylesheet";
    document.head.appendChild(style);

    var scripts = ["https://chat-client.mgts.ru/online_chat/vendors~polyfill.bundle.js",
        "https://chat-client.mgts.ru/online_chat/polyfill.bundle.js",
        "https://chat-client.mgts.ru/online_chat/vendors~button~window.bundle.js",
        "https://chat-client.mgts.ru/online_chat/button.bundle.js"];

    for (var i = 0; i < scripts.length; i++) {
        var script = document.createElement("script");
        script.src = scripts[i];
        script.defer = true;
        document.head.appendChild(script);
    }
})();