var MODULE = "OS_G_II_3";
var TYPE = "gm";
var DEBUG = true;

function loadJSON() {
    var doc = document.createElement("script");
    doc.type = "text/javascript";
    if (TYPE === "gm") {
        doc.src = "./Scripts/Games/" + MODULE + "/JSON.js";
        document.title = "Gra";
    }
    if (TYPE === "wc") {
        doc.src = "./Scripts/WorkCards/" + MODULE + "/JSON.js";
        document.title = "Karta pracy";
    }

    if (TYPE === "ex") {
        doc.src = "./Scripts/Exams/" + MODULE + "/JSON.js";
        document.title = "Sprawdzian";
    }

    if (doc.src === undefined || doc.src.length == 0) {
        console.error("TYPE not specified");
    }

    document.getElementsByTagName('head')[0].appendChild(doc);


}

document.onreadystatechange = function () {
    var state = document.readyState;
    if (state == 'interactive') {
        loadJSON();
    } else if (state == 'complete') {
        this.game = new Global.Main();
    }
}; 