(function () {

    var getContextPath = function() {
        return (document.getElementsByTagName("html")[0]).getAttribute("data-context-path");
    };

    var absolutizePaths = function(relPaths, absPrefix) {
        var absPaths = [];
        for (var i = 0; i < relPaths.length; i++) {
            absPaths.push('order!' + absPrefix + relPaths[i]);
        }
        return absPaths;
    };

    // Don't forget to change spike-webapp/pom.xml => minify plugin
    var scripts = [
        "ext/jquery.livequery-1.1.1.min.js",
        "ext/jquery.ui-1.8.16.custom.min.js",
        "ext/jquery.tools-1.2.5.min.js",
        "ext/jquery.flot.min.js",
        "ext/jquery.li-scroller-1.0.min.js",
        "ext/jquery.lightbox-0.5.min.js",
        "ext/jquery.markitup.js",
        "ext/jquery.socialshareprivacy.js",
        "ext/excanvas.min.js",
        "ext/underscore.min.js",
        "ext/tag-it.js",
        
        "src/plugins/jquery.history.js",
        
        "ext/backbone.min.js",
        
        "src/application.js",
        
        "src/util/Messenger.js",
        "src/util/Heartbeat.js",
        "src/util/utils.js",
        
        "src/html/AjaxLoader.js",
        "src/html/Tooltip.js",
        "src/html/TextileTextarea.js",
        "src/html/Date.js",
        "src/html/Input.js",
        "src/html/Checkbox.js",
        "src/html/Form.js",
        "src/html/ImageHolder.js",
        "src/html/Tabs.js",
        "src/html/Toggler.js",
        "src/html/Slider.js",
        "src/html/LocaleSwitcher.js",
        "src/html/Tags.js",

        "src/controller/profiles/ProfileController.js",
        "src/controller/profiles/ProfilesController.js",
        
        "src/admin.js",
        "src/profiles/terms.js",
        "src/profile.js",
        "src/profiles/location.js",
        "src/profiles/trial.js",
        "src/profiles/match.js",
        "src/contact.js",
        "src/admin/invoice.js",
        "src/admin/i18n.js",
        "src/scrollable.js",
        "src/login.js",
        "src/goPremium.js",
        "src/bookingProcess.js",
        "src/overlay.js",
        "src/registerForm.js",
        "src/upload.js",
        "src/hauling.js",
        "src/layout.js",
        "src/widgets.js",
        "src/photos.js",
        "src/newbie.js"
    ];

    require(absolutizePaths(scripts, $('html').attr("data-context-path") + "/static/script/"));

})();

