/**
 *
 * @project     fcmq2009
 * @purpose     config file that contains options for the client application
 * @author      Alexandre Dubé - Mapgears inc. (adube@mapgears.com)
 * @copyright
 * <b>Copyright (c) 2009 Mapgears Inc.</b>
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

/**
 * options object.  Each element is mandatory unless specified otherwise.
 */
options = {
    // widget and layer enabling
    'enableDistanceCalculator': true,
    'enableGroomers': true,
    'enableLegend': true, // 'enableLegend': false, doesn't work
    'enableRouting': true,
    'enableSearch': true,
    'enableMoreLayers': true,
    'enableShieldLayer': true,
    'enableServiceLayer': true,
    'enableArgParser': true,
    'enableAdPopup': true,

    'debug': false,

    'QCBBOX': "-96.657715,32.404648,-52.097168,61.208809",

    // Zoom to below coordinates when enabling groomers
    'zoomToOnGroomersActivate': false,
    'groomersLat': 47.32672316405059,
    'groomersLng': -71.03897094726562,
    'groomersZoom': 9,

    // Montreal
    'initLat': 49.5,
    'initLng': -76.3,

    'initZoom': 6,

    'dataLevels': [8,9,10,12,19],

    'tempOverlaysIdsDataLevelRelations': {8: 8, 9: 9, 10: 9, 12: 19, 19: 19},

    'encode': true,

    /**
     * 'lang': the lang is now set in index.html.  See gLANG.
     */
    //'lang': 'fr',
    
    /**
     * Property: pg2geojsonURL 
     * {String} The url to the pg2geojson server.  Simply choose from the
     * following values and leave the other ones *commented* 
     */
    'pg2geojsonURL': "../server/htdocs/pg2geojson.php?",
    //'pg2geojsonURL': "/pg2geojson/pg2geojson.php?",

    'layer': 'foo',

    'styleProperty': 'style',

    'classProperty': 'class',

    'lengthProperty': 'long',

    'directionProperty': 'directions',

    'angleProperty': 'angle',

    'angleFactorProperty': 'anglefactor',

    'numberProperty': 'numero',

    'minZoomProperty': 'niveau',

    'startIdProperty': 'startid',
    
    'endIdProperty': 'endid',

    'serviceProperties': {
        'name': 'commerce',
        'address': 'adresse',
        'city': 'ville',
        'phone': 'tel',
        'site_internet': 'site_internet'
    },

    'groomerProperties': {
        'datefrom': "datefrom",
        'dateto': "dateto",
        'hourfrom': "hourfrom",
        'hourto': "hourto"
    },

    'idFromLevel': {
        8: 'id8',
        9: 'id9'
    },

    'valueFieldFromLevel': {
        'same': "1",
        '8'   : "2",
        '9'   : "3"
    },

    /**
     * APIProperty: serviceMinZoom
     * {Integer} The zoom level where the service markers should appear.
     */
    'serviceMinZoom' : 10,

    /**
     * APIProperty: groomersMinZoom
     * {Integer} The zoom level where the groomers markers should appear in
     *           their 'small' marker version.
     */
    'groomersMinZoom' : 5,

    /**
     * APIProperty: groomersSwapZoom
     * {Integer} The zoom level where the small groomer markers should be
     *           replaced the normal groomer markers.
     */
    'groomersSwapZoom' : 9,

    'lengthUnit': 'Meter',

    /**
     * Property: lengthPrecision
     * {Integer} To set precision after the decimal point of length values.
     */
    'lengthPrecision': 2,

    'overlayId': 'id',

    'currentStyle': '0',

    /**
     * Property: ratio (Optional)
     * {Float} The ratio of the viewport bounds used to get the features.  The
     *         bigger this number is, the bigger the bounds (and longer the 
     *         requests) but requests are made less often.
     */
    'ratio': 1.2,

    /**
     * GoogleMaps icons from : http://gmapicons.googlepages.com/
     */
    'markers': {
        '1': { // "Routing Start Icon"
            'offsetx': 212, 'offsety': 63,
            // image & shadow are optionals
            'image': {'image': 'img/start.png', 'printImage': 'img/start.gif'
                      ,'width': 60, 'height': 40}
         ,'shadow': {'image': 'img/shadow.png', 'width': 60, 'height': 46}
        },
        '2': { // "Routing End Icon"
            'offsetx': 212, 'offsety': 102,
            // image & shadow are optionals
            'image': {'image': 'img/end.png', 'printImage': 'img/end.gif'
                      ,'width': 60, 'height': 40}
         ,'shadow': {'image': 'img/shadow.png', 'width': 60, 'height': 46}
        },
        '3' : { // "Shields" ## BUG ##, see addShields in main.js
            'image': {'width': 19, 'height': 23}
        },
        '4': { // services
            '1': { // secured hotels
                'image': {'image': './img/services/icon/hotel_sec.png',
                          'width': 16, 'height': 18 }
            },
            '2': { // heb
                'image': {'image': './img/services/icon/heb.png',
                          'width': 18, 'height': 18 }
            },
            '3': { // restaurant
                'image': {'image': './img/services/icon/resto.png',
                          'width': 18, 'height': 18 }
            },
            '4': { // loc
                'image': {'image': './img/services/icon/loc.png',
                          'width': 18, 'height': 18 }
            },
            '5': { // rep
                'image': {'image': './img/services/icon/rep.png',
                          'width': 18, 'height': 18 }
            },
            '6': { // gaz station
                'image': {'image': './img/services/icon/ess.png',
                          'width': 18, 'height': 17 }
            },
            '7': { // bar
                'image': {'image': './img/services/icon/bar.png',
                          'width': 18, 'height': 17 }
            },
            '20': { // articcat
                'image': {'image': './img/services/icon/articcat.png',
                          'width': 18, 'height': 15 }
            },
            '21': { // polaris
                'image': {'image': './img/services/icon/polaris.png',
                          'width': 18, 'height': 13 }
            },
            '22': { // brp
                'image': {'image': './img/services/icon/brp.png',
                          'width': 18, 'height': 18 }
            },
            '23': { // yamaha
                'image': {'image': './img/services/icon/yamaha.png',
                          'width': 18, 'height': 18 }
            }
        },
        '5': { // groomers
            '1': { // normal groomers
                'image': {'image': './img/groomer.png',
                          'width': 60, 'height': 39 }
            },
            '2': { // selected groomer
                'image': {'image': './img/groomer_selected.png',
                          'width': 60, 'height': 39 }
            },

            '3': { // small groomers
                'image': {'image': './img/small_groomer.png',
                          'width': 9, 'height': 9 }
            },
            '4': { // selected small groomer
                'image': {'image': './img/small_groomer_selected.png',
                          'width': 9, 'height': 9 }
            },
            '5': { // groomer for legend
                'image': {'image': './img/groomer_legend.png',
                          'width': 29, 'height': 18 }
            }
        },
        '6': { // "Routing Relay Icon"
            // image & shadow are optionals
            'image': {'image': 'img/relay.png', 'printImage': 'img/relay.gif'
                      ,'width': 60, 'height': 40}
         ,'shadow': {'image': 'img/shadow.png', 'width': 60, 'height': 46}
        },
        '7': { // "Routing TempRelay Icon"
            // image & shadow are optionals
            'image': {'image': 'img/icon18.png'
                      ,'width': 16, 'height': 16}
         ,'shadow': {'image': 'img/icon18s.png', 'width': 26, 'height': 16}
        }
    },

    'styles': {
        'default': {'color':'#333333', 'width':8},
        'select': {'color':'#ffff00', 'width':8},
        'hover': {'color':'#ffffcc', 'width':8},
        'routing': {'color':'#ffff00', 'width':12},
        '0': { // trails
            '1': {'color':'#0000ff', 'width':5, 'opacity': 0.7},
            '2': {'color':'#008000', 'width':5, 'opacity': 0.7},
            '3': {'color':'#ff8000', 'width':5, 'opacity': 0.7},
            '4': {'color':'#808080', 'width':5, 'opacity': 0.7},
            // closed trails
            '5': {'color':'#ff0000', 'width':7, 'opacity': 0.7},
            '6': {'color':'#ff0000', 'width':7, 'opacity': 0.7},
            '7': {'color':'#ff0000', 'width':7, 'opacity': 0.7},
            '8': {'color':'#ff0000', 'width':7, 'opacity': 0.7}
        },
        '1': { // groomer paths
            '1': {'color':'#800000', 'width':9, 'opacity': 0.7}
        }
    },

    // ######
    // legend
    // ######

    'legend': {
        'offsetx': 0, 'offsety': 30
    },

    // ##################
    // more button offset
    // ##################

    'more': {
        'offsetx': 340, 'offsety': 7
    },

    'legendUpArrow': 'img/Crystal_Clear_action_2uparrow.png',

    'legendDownArrow': 'img/Crystal_Clear_action_2downarrow.png',

    'kmValue': 'distanceCalculatorKMValue',

    'milesValue': 'distanceCalculatorMilesValue',

    /**
     * APIProperty: resetSelectionOnClickOut
     * {Boolean} Enables the unselection of temp overlays when a click is made
     *           on the map but hover nothing.
     */
    'resetSelectionOnClickOut': false,

    // #######
    // routing
    // #######

    'directionTableClassName': 'directionTable',

    'directionDivId': 'directionDiv',

    'directionDivTableContainerId': 'directionDivContainer',

    'transQuebecCheckBox': 'transQuebecCheckBox',

    'autoRecenterCheckBox': "routingAutoRecenterCheckBox",

    'directionTitle': "directionTitle",

    'routingDiv': {
        'offsetx': 70, 'offsety': 3
    },

    /**
     * Property: routingRatio (Optional)
     * {Float} The ratio of the viewport bounds to use when recentering after a
     *         routing query.  The bigger this number is, the bigger the bounds
     *         is.
     */
    'routingRatio': 1.2,

    'cardinalDirectionsOrder': [
        22.5, 67.5, 112.5, 157.5, 202.5, 247.5, 292.5, 337.5, 360.0
    ],

    'cardinalDirections': {
      22.5 : "n",
      67.5 : "ne",
      112.5: "e",
      157.5: "se",
      202.5: "s",
      247.5: "sw",
      292.5: "w",
      337.5: "nw",
      360.0: "n"
    },

    'turnDirectionsOrder': [30, 90, 180],

    /**
     * Property: turnDirections (Mandatory)
     * {Object} Contains degree:code for "turning" directions.  The first value
     *          MUST be "c" (for 'continue') and the last key MUST be 180.
     * 
     *          "c" --> continue
     *          "t" --> turn
     *          "w" --> wide turn
     */
    'turnDirections': {
      30 : "c",
      90 : "t",
      180: "w"
    },

    // ##########
    // PleaseWait
    // ##########
    'pleaseWait': true,

    // ################
    // TempOverlayPopup
    // ################
    'tempOverlayPopupOptions': {
        'offset': {
            'top': 30,
            'bottom': -170,
            'left': 20,
            'right': -200,
            'center': -90
        },
        'xBorder': 100,
        'yBorder': 200
    },

    /**
     * APIProperty: unselectKey
     * {String} The key to keep pressed to unselect the tempOverlays.  Can be
     *          'shift' or 'ctrl'.  If set to 'none', then no key is needed to
     *          be pressed for unselection.
     */
    'unselectKey': "shift",

    // ######
    // Print
    // ######

    'printUrl': './print.html',
    'printPreviewWidth': 656,
    'printPreviewHeight': 450,
    
    // ###############
    // AdPopupManager
    // ###############

    'adPopupClassName': "divAdPopup",

    /**
     * APIProperty: adPopupHideDelay
     * {Integer} Hide all popup after this value in milliseconds
     */
    'adPopupHideDelay': 10000
};

