﻿var debugMode = false;
if(!console) {
    var console = {};
}
var nameSpace = 'WLF4';
var root = this;



var WLF4 = {

    jsLibPath: '/static/js/lib/',
    jsSectionPath: '/static/js/section/',
    jsCommonPath: '/static/js/common/',
    
    init: function() {
        WLF4.structure.init();
        WLF4.section.init();
    },


    structure: {
        init: function() {
            var skeleton = 'structure';
            try {
                $.getScript( WLF4.jsCommonPath + skeleton + '.js' , function() {
                    console.groupCollapsed(skeleton.toUpperCase());
                        eval(skeleton).init();
                    console.groupEnd();
                }); 
            } catch (e) {
                console.group();
                    console.error('ERROR ON LOADING: ' + skeleton);
                console.groupEnd();
            }
        }
    },
    

    section: {
        init: function() {
            var section = $('body').attr('id') || false;
            if(section) {
                try {
                    $.getScript( WLF4.jsSectionPath + section + '.js' , function() {
                        console.groupCollapsed(section.toUpperCase());
                            eval(section).init();
                        console.groupEnd();
                    });
                } catch (e) {
                    console.group();
                        console.error('ERROR ON LOADING: ' + section);
                    console.groupEnd();
                }
                
            }
        }
    }
};


$(document).ready(function() {
    $.getScript( eval(nameSpace).jsLibPath + 'debugger.js' , function() {
        Debugger.init(nameSpace, 'init');
    });
});