// *** Copyright (c) Iain Lawrie 2009 ***
/*	
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.
*/


//*** switch between maps ***
function mapSwitch(mapTo, mapFrom, useToExtent) {
    var fromZoom = mapFrom.zoom;
    activeMap = mapTo;
    if (Marker900913.map != null && diffMaps) {
        //alert(Marker900913.map.div.id);
        mapFrom.removeLayer(Marker900913);
    }
    if (Marker27700.map != null) mapFrom.removeLayer(Marker27700);
    if (lblGrid.map != null) mapFrom.removeLayer(lblGrid);
    if (Square.map != null) mapFrom.removeLayer(Square);
    if (Grid.map != null) mapFrom.removeLayer(Grid);
    mapFrom.events.unregister('mousemove', mapFrom, MouseMove);
    mapFrom.events.unregister('moveend', mapFrom, MoveEnd);
    switch (mapTo.div.id) {// set grid and square styles here
        case 'gsatmap': Grid.style.strokeColor = "#FF8800"; Square.style = style_red; lblGrid.styleMap = style_map; break;
        case 'ghybmap': Grid.style.strokeColor = "#FF8800"; Square.style = style_red; lblGrid.styleMap = style_map; break;
        case 'gphysmap': Grid.style.strokeColor = "#336699"; Square.style = style_green; lblGrid.styleMap = style_map_blue; break;
        case 'gnormmap': Grid.style.strokeColor = "#336699"; Square.style = style_green; lblGrid.styleMap = style_map_blue; break;
        case 'bingmap': Grid.style.strokeColor = "#336699"; Square.style = style_green; lblGrid.styleMap = style_map_blue; break;
        case 'osmap': Grid.style.strokeColor = "#336699"; Square.style = style_green; lblGrid.styleMap = style_map_blue; break;
    }
    mapTo.events.register('moveend', mapTo, MoveEnd);
    mapTo.events.register('mousemove', mapTo, MouseMove);
    mapTo.addLayers([Grid, Square, lblGrid]);
    if (mapTo.projection == 'EPSG:27700') {
        if (Marker27700.map == null) mapTo.addLayer(Marker27700);
    }
    else {
        if (mapTo == mapFrom && diffMaps) {
            if (Marker900913.map == null) mapTo.addLayer(Marker900913);
        }
    }
    for (var keyMap in mapList) if (mapFrom == mapList[keyMap]) { var zoomFromScale = zoomList[keyMap]; var mapFromx = keyMap; }
    for (var keyZoom in zoomFromScale) if (fromZoom == zoomFromScale[keyZoom]) var zoomx = keyZoom;
    for (var mapx in mapList) {
        if (mapTo == mapList[mapx]) {//select map and do things with it
            if (useToExtent) {
                bounds = mapTo.getExtent();
                var zoom = mapTo.zoom;
            }
            else {
                var zoomToScale = zoomList[mapx];
                var bounds = mapFrom.getExtent().clone();
                bounds = bounds.transform(new OpenLayers.Projection('' + mapFrom.projection), new OpenLayers.Projection('' + mapTo.projection));
                var zoom = zoomList[mapx][zoomx];
            }
            mapTo.zoomToExtent(bounds);
            mapTo.zoomTo(zoom);
            if (mapx != mapFromx) {
                $(document.getElementById(mapTo.div.id)).show();
                $(document.getElementById(mapFrom.div.id)).hide();
            }
        }
        else {//do all the unselected maps here - switch off the divs
            if (mapList[mapx] != mapFrom) $(document.getElementById(mapList[mapx].div.id)).hide();
        }
    }
    controlList = [];
    if (typeof Navigation != "undefined") activeMap = Navigation(activeMap);
    if (typeof Measure != "undefined") activeMap = Measure(activeMap);
    if (typeof Draw != "undefined") activeMap = Draw(activeMap);
    redrawLayers();
}
//^^^ switch between maps ^^^

//*** set up google maps ***
function setMap(mapdiv, layer) {
    var lyrName;
    var baseLayer = new OpenLayers.Layer.Google(lyrName, { type: layer, sphericalMercator: true, isBaseLayer: true });
    //var extent = new OpenLayers.Bounds(-982188, 6818756, 347236, 8055406);// might need to add outwith extent for layers to restrict this much
    var extent = new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34);
    var Options = { controls: [new OpenLayers.Control.Navigation(), new OpenLayers.Control.Permalink('permalink')], minZoomLevel: 6, maxResolution: 5000, maxExtent: extent, units: 'm', projection: EPSG900913 }
    var map = new OpenLayers.Map(mapdiv, Options);
    map.addLayers([baseLayer]);
    return map;
}
//^^^ set up google maps ^^^

//*** Redraws layers over base map ***
function redrawLayers() {
    Grid.redraw();
    Square.redraw();
    lblGrid.redraw();
    Marker27700.redraw();
    Marker900913.redraw();
}
//^^^ Redraws layers over base map ^^^

//*** convert National Grid Reference to Eastings/Northings ***
function NGR_EN(strGridRef) {
    strGridRef = strGridRef.replace(/ /gi, "").toUpperCase();
    var intEasting = parseInt("SNHTO".indexOf(strGridRef.charAt(0)) / 3) * 500000;
    intEasting += parseInt("VQLFAWRMGBXSNHCYTOJDZUPKE".indexOf(strGridRef.charAt(1)) / 5) * 100000;
    intEasting += parseInt((strGridRef.substr(2, strGridRef.substr(2).length / 2) + "00000").substring(0, 5), 10);
    var intNorthing = "SNHTO".indexOf(strGridRef.charAt(0)) % 3 * 500000;
    intNorthing += "VQLFAWRMGBXSNHCYTOJDZUPKE".indexOf(strGridRef.charAt(1)) % 5 * 100000;
    intNorthing += parseInt((strGridRef.substr(2 + strGridRef.substr(2).length / 2) + "00000").substring(0, 5), 10);
    this.getEasting = function() { return intEasting; }
    this.getNorthing = function() { return intNorthing; }
    this.getOpenSpacePoint = function() { return new OpenSpace.MapPoint(intEasting, intNorthing); }
}
//^^^ convert National Grid Reference to Eastings/Northings ^^^

//*** convert Eastings/Northings to National Grid Reference ***
function EN_NGR(intEasting, intNorthing) {
    var strNGR = "SNHTOJ".charAt(parseInt(intNorthing / 500000) % 3 + parseInt(intEasting / 500000) % 3 * 3);
    strNGR += "VQLFAWRMGBXSNHCYTOJDZUPKE".charAt(parseInt(intNorthing / 100000) % 5 + parseInt(intEasting / 100000) % 5 * 5);
    var Tet = "ABCDEFGHIJKLMNPQRSTUVWXYZ".charAt(parseInt(intNorthing / 2000) % 5 + parseInt(intEasting / 2000) % 5 * 5);
    //    this.getNGR10 = function() { return strNGR + (1000000 + intEasting + "").substr(2) + (1000000 + intNorthing + "").substr(2); }
    this.getNGR8 = function() { return strNGR + (1000000 + intEasting + "").substr(2, 4) + (1000000 + intNorthing + "").substr(2, 4); }
    this.getNGR6 = function() { return strNGR + (1000000 + intEasting + "").substr(2, 3) + (1000000 + intNorthing + "").substr(2, 3); }
    this.getNGR4 = function() { return strNGR + (1000000 + intEasting + "").substr(2, 2) + (1000000 + intNorthing + "").substr(2, 2); }
    this.getNGRT = function() { return strNGR + (1000000 + intEasting + "").substr(2, 1) + (1000000 + intNorthing + "").substr(2, 1) + Tet; }
    this.getNGR2 = function() { return strNGR + (1000000 + intEasting + "").substr(2, 1) + (1000000 + intNorthing + "").substr(2, 1); }
    this.getNGR0 = function() { return strNGR; }
    this.getEN100 = function() { return "" + parseInt(intEasting / 100000) + parseInt(intNorthing / 100000); }
}
//^^^ convert Eastings/Northings to National Grid Reference ^^^

//*** add autosize grid ***
function autogrid(map, layer, label) {
    layer.destroyFeatures();
    if (label) label.destroyFeatures();
    var gridsize = 100000;
    var zoomLevel = map.zoom;
    if (map.projection == 'EPSG:900913') {
        zoomLevel -= 1;
        var extent = map.getExtent().clone();
        extent = extent.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:27700")).toArray();
    }
    else {
        var extent = map.getExtent().toArray();
    }
    switch (zoomLevel) {
        case 12: gridsize = 10; break;
        case 11: gridsize = 100; break;
        case 10: gridsize = 100; break;
        case 9: gridsize = 100; break;
        case 8: gridsize = 1000; break;
        case 7: gridsize = 1000; break;
        case 6: gridsize = 1000; break;
        case 5: gridsize = 10000; break;
        case 4: gridsize = 10000; break;
        case 3: gridsize = 10000; break;
        case 2: gridsize = 10000; break;
    }
    var EastMin = parseInt(extent[0] / gridsize) * gridsize;
    var EastMax = parseInt(extent[2] / gridsize + 1) * gridsize;
    var NorthMin = parseInt(extent[1] / gridsize) * gridsize;
    var NorthMax = parseInt(extent[3] / gridsize + 1) * gridsize;
    if (EastMin < 0) EastMin = 0;
    if (NorthMin < 0) NorthMin = 0;
    if (EastMax > 800000) EastMax = 800001;
    if (NorthMax > 1300000) NorthMax = 1300000;
    for (var eTemp = EastMin; eTemp <= EastMax; eTemp += gridsize) {
        var pointList = [];
        for (var p = NorthMin; p <= NorthMax; p += (NorthMax - NorthMin) / 10) {
            var point = new OpenLayers.Geometry.Point(eTemp, p);
            pointList.push(point);
        }
        var lineString = new OpenLayers.Geometry.LineString(pointList);
        var ftrLine = new OpenLayers.Feature.Vector(lineString.transform(new OpenLayers.Projection("EPSG:27700"), new OpenLayers.Projection('' + map.projection)));
        layer.addFeatures(ftrLine);
        if (label) {
            var pointLabel = new OpenLayers.Geometry.Point(eTemp, NorthMax - (NorthMax - NorthMin) / 2);
            var ftrLabel = new OpenLayers.Feature.Vector(pointLabel.transform(new OpenLayers.Projection("EPSG:27700"), new OpenLayers.Projection('' + map.projection)));
            ftrLabel.attributes = { grid: eTemp, align: "cb" };
            label.addFeatures(ftrLabel);
        }
    }
    for (var nTemp = NorthMin; nTemp <= NorthMax; nTemp += gridsize) {
        var pointList = [];
        for (var p = EastMin; p <= EastMax; p += (EastMax - EastMin) / 10) {
            var point = new OpenLayers.Geometry.Point(p, nTemp);
            pointList.push(point);
        }
        var lineString = new OpenLayers.Geometry.LineString(pointList);
        var ftrLine = new OpenLayers.Feature.Vector(lineString.transform(new OpenLayers.Projection("EPSG:27700"), new OpenLayers.Projection('' + map.projection)));
        layer.addFeatures(ftrLine);
        if (label) {
            var pointLabel = new OpenLayers.Geometry.Point(EastMax - (EastMax - EastMin) / 2, nTemp);
            var ftrLabel = new OpenLayers.Feature.Vector(pointLabel.transform(new OpenLayers.Projection("EPSG:27700"), new OpenLayers.Projection('' + map.projection)));
            ftrLabel.attributes = { grid: nTemp, align: "ct" };
            label.addFeatures(ftrLabel);
        }
    }
}
//^^^ add autosize grid ^^^

function controlSwitch(map, control, cursor) {
    clearTable('tblMeasure');
     for (var key in controlList) {
         controlList[key].deactivate();
    }
    control.activate();
    document.getElementById(map.div.id).style.cursor = cursor;
    return false;
}

//*** return formatted Date and Time ***
function DateTime() {
    var now = new Date();
    this.getFDate = function() { return (100 + now.getDate() + "").substr(1) + "/" + (101 + now.getMonth() + "").substr(1) + "/" + now.getFullYear().toString().substr(0, 4); }
    this.getFTime = function() { return (100 + now.getHours() + "").substr(1) + ":" + (100 + now.getMinutes() + "").substr(1) + ":" + (100 + now.getSeconds() + "").substr(1); }
}
//^^^ return formatted Date and Time ^^^

//*** return point based on search phrase ***
function searchGazetteer(SearchPhrase,tblID) {
    Marker27700.destroyFeatures();
    //Marker900913.destroyFeatures();
    if (SearchPhrase != "") {
        var gridPoint = new NGR_EN(SearchPhrase);
        var ptLocation = gridPoint.getOpenSpacePoint();
        if (isNaN(gridPoint.getEasting()) || isNaN(gridPoint.getNorthing()) || gridPoint.getNorthing() < 0) {
            ptLocation = null;
            osGaz = new OpenSpace.Gazetteer();
            gazArray = osGaz.getLocations(SearchPhrase, function (gzLookup) {
                if (gzLookup != "") { for (key in gzLookup) { addRow(tblID, key, gzLookup); } }
                else {
                    clearTable(tblID);
                    ConMenu.style.display = "none";
                    postcodeService = new OpenSpace.Postcode();
                    postcodeService.getLonLat(SearchPhrase, function (pcLookup) {
                        if (pcLookup != null) {
                            if (isNaN(pcLookup.getEasting()) || isNaN(pcLookup.getNorthing())) {
                                alert("nothing found - check search phrase for errors");
                            }
                            else {
                                activeMap.setCenter(pcLookup.transform(new OpenLayers.Projection("EPSG:27700"), new OpenLayers.Projection('' + activeMap.projection)), activeMap.zoom);
                                var Marker = new OpenLayers.Geometry.Point(activeMap.getCenter().lon, activeMap.getCenter().lat)
                                var cloneMarker = Marker.clone();
                                markFeature27700 = new OpenLayers.Feature.Vector(Marker.transform(new OpenLayers.Projection('' + activeMap.projection), EPSG27700));
                                Marker27700.addFeatures(markFeature27700);
                                //markFeature900913 = new OpenLayers.Feature.Vector(cloneMarker.transform(new OpenLayers.Projection('' + activeMap.projection), EPSG900913));
                                //Marker900913.addFeatures(markFeature900913);
                                redrawLayers();
                            }
                        }
                        else {
                            alert("nothing found - check search phrase for errors");
                        }
                    });
                }
            });

        }
        else {
            if (SearchPhrase.length % 2 == 0 && ptLocation != null) {
                activeMap.setCenter(ptLocation.transform(new OpenLayers.Projection("EPSG:27700"), new OpenLayers.Projection('' + activeMap.projection)), activeMap.zoom);
                var Marker = new OpenLayers.Geometry.Point(activeMap.getCenter().lon, activeMap.getCenter().lat)
                var cloneMarker = Marker.clone();
                markFeature27700 = new OpenLayers.Feature.Vector(Marker.transform(new OpenLayers.Projection('' + activeMap.projection), EPSG27700));
                Marker27700.addFeatures(markFeature27700);
                //markFeature900913 = new OpenLayers.Feature.Vector(cloneMarker.transform(new OpenLayers.Projection('' + activeMap.projection), EPSG900913));
                //Marker900913.addFeatures(markFeature900913);
                redrawLayers();
            }
            else {
                alert("nothing found - check search phrase for errors");
            } 
        }
    }
    return false;
}
//^^^ return point based on search phrase ^^^

//*** read draw layer from GISimport box for import into map ***
function GISimport(LayerbyID, Memo, Combo) {
    var tlayer = new OpenLayers.Layer.Vector();
    var layer = osMap.getLayer(LayerbyID);
    var g = new OpenLayers.Format.GeoJSON();
    var txtGIS = Memo;
    tlayer.features = g.read(txtGIS.value);
    layer.addFeatures(tlayer.features);
    layer.redraw();
    txtGIS.value = "";
    Combo.options[0].selected = true;
}
//^^^ read draw layer from GISimport box for import into map ^^^

//*** write draw layer to GISexport box for copy to clipboard ***
function GISexport(LayerbyID, Memo, Combo) {
    var layer = osMap.getLayer(LayerbyID);
    var g = new OpenLayers.Format.GeoJSON();
    var txtGIS = Memo;
    txtGIS.value = g.write(layer.features);
    txtGIS.focus();
    txtGIS.select();
    Combo.options[0].selected = true;
}
//^^^ write draw layer to GISexport box for copy to clipboard ^^^

//*** set layer visibility ***
function layerDisplay(LayerbyID, checkbox) {
    var layer = activeMap.getLayer(LayerbyID);
    if (layer != null) {
        layer.setVisibility(checkbox.checked);
    }
}
//^^^ set layer visibility ^^^

//*** set default view to cookie ***
function defView(map) {
    createCookie('gdefmap', map.div.id, 365);
    createCookie('gdefpoint', map.getCenter().transform(new OpenLayers.Projection('' + map.projection), new OpenLayers.Projection("EPSG:27700")).toShortString(), 365);
    createCookie('gdefzoom', map.getZoom(), 365);
    return false;
}
//^^^ set default view to cookie ^^^

//*** get default view from cookie or URL ***
function getdefView(viewType) {
    var strDefMap, strDefPoint, intDefZoom;
    if (args.base !== undefined && viewType != 'cookie') {
        Marker27700.destroyFeatures();
        //Marker900913.destroyFeatures();
        var Marker = new OpenLayers.Geometry.Point(args.lon, args.lat)
        //var cloneMarker = Marker.clone();
        markFeature27700 = new OpenLayers.Feature.Vector(Marker);
        Marker27700.addFeatures([markFeature27700]);
        strDefMap = args.base;
        strDefPoint = args.lon + ',' + args.lat;
        intDefZoom = parseInt(args.zoom);
    }
    else {
        if (strDefMap == null) strDefMap = readCookie('gdefmap');
        strDefPoint = readCookie('gdefpoint');
        intDefZoom = parseInt(readCookie('gdefzoom'));
        if (typeof (OpenSpace) == "undefined" && readCookie('gdefmap') == 'osmap') {
            alert("Ordnance Survey map unavailable - Using Google Streetview for this session");
            if (intDefZoom > 1) intDefZoom = intDefZoom + 1;
            strDefMap = 'gnormmap';
        }
    }
    var tMap;
    if (strDefMap == null) (typeof (OpenSpace) != "undefined") ? strDefMap = 'osmap' : strDefMap = 'gnormmap';
    if (strDefPoint == null) strDefPoint = '306407, 522032';
    if (isNaN(intDefZoom)) intDefZoom = 0;
    switch (strDefMap) {
        case 'gsatmap': tMap = gsatMap; break;
        case 'ghybmap': tMap = ghybMap; break;
        case 'gphysmap': tMap = gphysMap; break;
        case 'gnormmap': tMap = gnormMap; break;
        case 'bingmap': tMap = bingMap; break;
        case 'osmap': tMap = osMap; break;
    }
    //    document.getElementById('rd' + strDefMap).checked = true;

    var MapPoint = new OpenLayers.LonLat(strDefPoint.split(',')[0], strDefPoint.split(',')[1]);
    MapPoint.transform(new OpenLayers.Projection("EPSG:27700"), new OpenLayers.Projection('' + tMap.projection));
    tMap.setCenter(MapPoint,intDefZoom);
    return tMap
}
//^^^ get default view from cookie ^^^


//*** set element state ***
function edatSwitch(arr, state, att) {
    for (i = 0; i < arr.length; i++) { (att == 'disabled') ? arr[i].disabled = !state : arr[i].checked = state; }
}
//^^^ set element state ^^^

//^^^ copyright Iain Lawrie (c) 2009 ^^^



//*** Open Source Code ***
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name, "", -1);
}

function addBookmark(title, url) {
    if (window.sidebar) { // Firefox 
        window.sidebar.addPanel(title, url, '');
    } else if (window.opera) { //Opera 
        var a = document.createElement("A");
        a.rel = "sidebar";
        a.target = "_search";
        a.title = title;
        a.href = url;
        a.click();
    } else if (window.external) { //IE 
        window.external.AddFavorite(url, title);
    }
}

var BrowserDetect = {
    init: function() {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function(data) {
        for (var i = 0; i < data.length; i++) {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function(dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
    },
    dataBrowser: [
		{
		    string: navigator.userAgent,
		    subString: "Chrome",
		    identity: "Chrome"
		},
		{ string: navigator.userAgent,
		    subString: "OmniWeb",
		    versionSearch: "OmniWeb/",
		    identity: "OmniWeb"
		},
		{
		    string: navigator.vendor,
		    subString: "Apple",
		    identity: "Safari",
		    versionSearch: "Version"
		},
		{
		    prop: window.opera,
		    identity: "Opera"
		},
		{
		    string: navigator.vendor,
		    subString: "iCab",
		    identity: "iCab"
		},
		{
		    string: navigator.vendor,
		    subString: "KDE",
		    identity: "Konqueror"
		},
		{
		    string: navigator.userAgent,
		    subString: "Firefox",
		    identity: "Firefox"
		},
		{
		    string: navigator.vendor,
		    subString: "Camino",
		    identity: "Camino"
		},
		{		// for newer Netscapes (6+)
		    string: navigator.userAgent,
		    subString: "Netscape",
		    identity: "Netscape"
		},
		{
		    string: navigator.userAgent,
		    subString: "MSIE",
		    identity: "Explorer",
		    versionSearch: "MSIE"
		},
		{
		    string: navigator.userAgent,
		    subString: "Gecko",
		    identity: "Mozilla",
		    versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
		    string: navigator.userAgent,
		    subString: "Mozilla",
		    identity: "Netscape",
		    versionSearch: "Mozilla"
		}
	],
    dataOS: [
		{
		    string: navigator.platform,
		    subString: "Win",
		    identity: "Windows"
		},
		{
		    string: navigator.platform,
		    subString: "Mac",
		    identity: "Mac"
		},
		{
		    string: navigator.userAgent,
		    subString: "iPhone",
		    identity: "iPhone/iPod"
		},
		{
		    string: navigator.platform,
		    subString: "Linux",
		    identity: "Linux"
		}
	]

};
BrowserDetect.init();
