
if (licenseAvailable == "!OK")
{
    showModal();
    var ck = document.cookie;

    if (document.cookie.indexOf("open") >= 0) {
    }
    else
    {
        showModal();
        document.cookie = "open=1";
    }

}

function showModal() {
    console.log('Show modal!');
    $('#alert-services').modal('show');
}

$('#services-reg').click(function () {
    window.location=url+"frontend/user/profile#services-register";
    $('#alert-services').modal('hide');
   // $('#alert-services-reg').modal('show');
});
$('#services-sign').click(function () {
    $('#alert-services-reg').modal('hide');
    $('#alert-services-reg-2').modal('show');
})

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var g_Flash = null;
var g_cbData = "";

function InitViolet() {
    g_Flash = document.getElementById('LectorEditorOnline');
    //g_Flash = $('#LectorEditorOnline');
    //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
}
;

function GetClipboardItem() {
    var cbData = window.clipboardData ? window.clipboardData.getData('Text') : g_cbData;
    g_Flash.SetVariable("clipboardData", cbData);
    g_Flash.SetVariable("command", "Get Text");
}
;

function SetClipboardItem(args) {
    if (window.clipboardData)
        window.clipboardData.setData('Text', args);
    else
        g_cbData = args;
    g_Flash.SetVariable("command", "Set OK");
}
;

function SetWindowTitle(fileName) {
    if (fileName == "")
        document.title = "Violet Online";
    else {
        var docName = fileName.substring(0, fileName.length - 4);
        document.title = "Violet Online - " + docName;
    }
}
;

function SetWindowState() {
    var full = (g_Flash.width == "100%");
    g_Flash.width = full ? "800" : "100%";
    g_Flash.height = full ? "580" : "100%";
}
;

// Handle all the FSCommand messages in a Flash movie.
function LectorEditorOnline_DoFSCommand(command, args) {
    switch (command) {
        case "Set Title":
            SetWindowTitle(args);
            break;
        case "Get Clipboard":
            GetClipboardItem();
            break;
        case "Set Clipboard":
            SetClipboardItem(args);
            break;
        case "Set State":
            SetWindowState();
            break;
        case "Quit":
            window.open('', '_self').close();
            break;
        case "trace":
            alert(args);
            break;
        case "Check License":
            showModal();
            break;
    }
}
;

// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
    document.write('<script language=\"VBScript\"\>\n');
    document.write('On Error Resume Next\n');
    document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
    document.write('  Call LectorEditorOnline_DoFSCommand(command, args)\n');
    document.write('End Sub\n');
    document.write('</script\>\n');
}
;

$(document).ready(function () {
    InitViolet();
})