
var OTOS = window.OTOS || {};
OTOS.ElementConfig = function () {

    return {

        /**
         * An object containing all the servers, cameras and imageareas
         */
        SERVERDATA: null,


        /**
         * The current period
         */
        PERIOD: 'WEEK',


        /**
         * The current column count
         */
        COLUMN_COUNT: 3,


        /**
         * The current statistics type
         */
        STAT_TYPE: 1,


        /**
         * The current chart type
         */
        CHART_TYPE: 'FC_2_3_Column3D',


        /**
         * The current hour
         */
        HOUR: '00',

        /**
         *
         */
        ELEMENT_ROUNDING_SETTINGS: {
            radius: 8,
            headerBg: '#fafafa',
            borderColor: '#cccccc',
            contentBg: '#ffffff',
            footerBg: '#ffffff',
            corners: {
                topLeft: true,
                topRight: true,
                bottomLeft: true,
                bottomRight: true
            }
        },


        /**
         * A function for initializing the main page
         *
         * @param   {object}    request     The xmlhttp-request, which responseText-property contains
         *                                  the json-formatted string with all the data of the servers
         * @param   {function}  callback    The callback function which will be called after handling
         *                                  the response.
         */
        init: function (request, callback) {

            var response = OTOS.Util.trim(request.responseText);

            if (response == 'false') {
                alert('Virhe palvelimen tietoja haettaessa');
                return;
            } // if

            OTOS.ElementConfig.SERVERDATA = eval(request.responseText); // evaluate the json-formatted response
            callback();

        }

    };

}();
