KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/gwsolutions/superbowl/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/gwsolutions/superbowl/coverage_superbowl.js


    var clickedLat;
    var clickedLon;
    var lastTechSelected = '4G';
    var showAllOperators = false;
    var LAYER_COV = 0;      // this needs to be 0 when we only have 1 layer
    var LAYER_REG = 1;      // this needs to be 0 when we have 2 layers
                            // and set COV to 1
	var USE_ORDINAL = false;	
    var USE_ONESCORE = false;			
	var MINI_SCORES = true;
    var USE_TILES = true;
    var SHOW_CUSTOM_PINS = true;

    var map;
    var infowindow = "";
    var canvas_name = "";
    var mapCenter = new google.maps.LatLng(37.596329, -122.227199); 		// levi stadium 37.402, -121.969
    var markers = [];
    var initialZoom = 10;
    var mobileZoom = 10;
    var MAX_ZOOM = 20;
    var MIN_ZOOM = 4;
    var GRAD_ZOOM = 15;     // the starting point where the gradient will show up.
    var oldTimey = [{ "featureType": "administrative", "stylers": [{ "visibility": "off"}] }, { "featureType": "poi", "stylers": [{ "visibility": "off"}] }, { "featureType": "road", "stylers": [{ "visibility": "simplified"}] }, { "featureType": "water", "stylers": [{ "visibility": "simplified"}] }, { "featureType": "transit", "stylers": [{ "visibility": "simplified"}] }, { "featureType": "landscape", "stylers": [{ "visibility": "simplified"}] }, { "featureType": "road.highway", "stylers": [{ "visibility": "off"}] }, { "featureType": "road.local", "stylers": [{ "visibility": "on"}] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [{ "visibility": "on"}] }, { "featureType": "water", "stylers": [{ "color": "#84afa3" }, { "lightness": 52}] }, { "stylers": [{ "saturation": -77}] }, { "featureType": "road"}];
    var mutedBrown = [{ "elementType": "geometry", "stylers": [{ "hue": "#ff4400" }, { "saturation": -68 }, { "lightness": -4 }, { "gamma": 0.72}] }, { "featureType": "poi", "stylers": [{ "visibility": "off"}] }, { "featureType": "road", "elementType": "labels.icon" }, { "featureType": "landscape.man_made", "elementType": "geometry", "stylers": [{ "hue": "#0077ff" }, { "gamma": 3.1}] }, { "featureType": "water", "stylers": [{ "hue": "#00ccff" }, { "gamma": 0.44 }, { "saturation": -33}] }, { "featureType": "poi.park", "stylers": [{ "hue": "#44ff00" }, { "saturation": -23}] }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": [{ "hue": "#007fff" }, { "gamma": 0.77 }, { "saturation": 65 }, { "lightness": 99}] }, { "featureType": "water", "elementType": "labels.text.stroke", "stylers": [{ "gamma": 0.11 }, { "weight": 5.6 }, { "saturation": 99 }, { "hue": "#0091ff" }, { "lightness": -86}] }, { "featureType": "transit.line", "elementType": "geometry", "stylers": [{ "lightness": -48 }, { "hue": "#ff5e00" }, { "gamma": 1.2 }, { "saturation": -23}] }, { "featureType": "transit", "elementType": "labels.text.stroke", "stylers": [{ "saturation": -64 }, { "hue": "#ff9100" }, { "lightness": 16 }, { "gamma": 0.47 }, { "weight": 2.7}]}];
    var apple = [{ "featureType": "landscape.man_made", "elementType": "geometry", "stylers": [{ "color": "#f7f1df"}] }, { "featureType": "landscape.natural", "elementType": "geometry", "stylers": [{ "color": "#d0e3b4"}] }, { "featureType": "landscape.natural.terrain", "elementType": "geometry", "stylers": [{ "visibility": "off"}] }, { "featureType": "poi", "elementType": "labels", "stylers": [{ "visibility": "off"}] }, { "featureType": "poi.business", "elementType": "all", "stylers": [{ "visibility": "off"}] }, { "featureType": "poi.medical", "elementType": "geometry", "stylers": [{ "color": "#fbd3da"}] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [{ "color": "#bde6ab"}] }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": [{ "visibility": "off"}] }, { "featureType": "road", "elementType": "labels", "stylers": [{ "visibility": "off"}] }, { "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [{ "color": "#ffe15f"}] }, { "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [{ "color": "#efd151"}] }, { "featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [{ "color": "#ffffff"}] }, { "featureType": "road.local", "elementType": "geometry.fill", "stylers": [{ "color": "black"}] }, { "featureType": "transit.station.airport", "elementType": "geometry.fill", "stylers": [{ "color": "#cfb2db"}] }, { "featureType": "water", "elementType": "geometry", "stylers": [{ "color": "#a2daf2"}]}];
    var paper = [{ "featureType": "administrative", "elementType": "all", "stylers": [{ "visibility": "off"}] }, { "featureType": "landscape", "elementType": "all", "stylers": [{ "visibility": "simplified" }, { "hue": "#0066ff" }, { "saturation": 74 }, { "lightness": 100}] }, { "featureType": "poi", "elementType": "all", "stylers": [{ "visibility": "simplified"}] }, { "featureType": "road", "elementType": "all", "stylers": [{ "visibility": "simplified"}] }, { "featureType": "road.highway", "elementType": "all", "stylers": [{ "visibility": "off" }, { "weight": 0.6 }, { "saturation": -85 }, { "lightness": 61}] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [{ "visibility": "on"}] }, { "featureType": "road.arterial", "elementType": "all", "stylers": [{ "visibility": "on"}] }, { "featureType": "road.local", "elementType": "all", "stylers": [{ "visibility": "on"}] }, { "featureType": "transit", "elementType": "all", "stylers": [{ "visibility": "simplified"}] }, { "featureType": "water", "elementType": "all", "stylers": [{ "visibility": "simplified" }, { "color": "#5f94ff" }, { "lightness": 26 }, { "gamma": 5.86}]}];
    var mapbox = [{ "featureType": "water", "stylers": [{ "saturation": 43 }, { "lightness": -11 }, { "hue": "#0088ff"}] }, { "featureType": "road", "elementType": "geometry.fill", "stylers": [{ "hue": "#ff0000" }, { "saturation": -100 }, { "lightness": 99}] }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": [{ "color": "#808080" }, { "lightness": 54}] }, { "featureType": "landscape.man_made", "elementType": "geometry.fill", "stylers": [{ "color": "#ece2d9"}] }, { "featureType": "poi.park", "elementType": "geometry.fill", "stylers": [{ "color": "#ccdca1"}] }, { "featureType": "road", "elementType": "labels.text.fill", "stylers": [{ "color": "#767676"}] }, { "featureType": "road", "elementType": "labels.text.stroke", "stylers": [{ "color": "#ffffff"}] }, { "featureType": "poi", "stylers": [{ "visibility": "off"}] }, { "featureType": "landscape.natural", "elementType": "geometry.fill", "stylers": [{ "visibility": "on" }, { "color": "#b8cb93"}] }, { "featureType": "poi.park", "stylers": [{ "visibility": "on"}] }, { "featureType": "poi.sports_complex", "stylers": [{ "visibility": "on"}] }, { "featureType": "poi.medical", "stylers": [{ "visibility": "on"}] }, { "featureType": "poi.business", "stylers": [{ "visibility": "simplified"}]}];
    
    var lunarlandscape = [{ "stylers": [{ "hue": "#ff1a00" }, { "invert_lightness": true }, { "saturation": -100 }, { "lightness": 33 }, { "gamma": 0.5}] }, { "featureType": "water", "elementType": "geometry", "stylers": [{ "color": "#2D333C"}]}];
    var paledawn = [{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"lightness":33}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2e5d4"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"}]},{"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},{"featureType":"road","elementType":"all","stylers":[{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]}];
    var mostlyGreyscale = [{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"lightness":33}]},{"featureType":"administrative","elementType":"labels","stylers":[{"saturation":"-100"}]},{"featureType":"administrative","elementType":"labels.text","stylers":[{"gamma":"0.75"}]},{"featureType":"administrative.neighborhood","elementType":"labels.text.fill","stylers":[{"lightness":"-37"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#f9f9f9"}]},{"featureType":"landscape.man_made","elementType":"geometry","stylers":[{"saturation":"-100"},{"lightness":"40"},{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"labels.text.fill","stylers":[{"saturation":"-100"},{"lightness":"-37"}]},{"featureType":"landscape.natural","elementType":"labels.text.stroke","stylers":[{"saturation":"-100"},{"lightness":"100"},{"weight":"2"}]},{"featureType":"landscape.natural","elementType":"labels.icon","stylers":[{"saturation":"-100"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"saturation":"-100"},{"lightness":"80"}]},{"featureType":"poi","elementType":"labels","stylers":[{"saturation":"-100"},{"lightness":"0"}]},{"featureType":"poi.attraction","elementType":"geometry","stylers":[{"lightness":"-4"},{"saturation":"-100"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"},{"visibility":"on"},{"saturation":"-95"},{"lightness":"62"}]},{"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},{"featureType":"road","elementType":"all","stylers":[{"lightness":20}]},{"featureType":"road","elementType":"labels","stylers":[{"saturation":"-100"},{"gamma":"1.00"}]},{"featureType":"road","elementType":"labels.text","stylers":[{"gamma":"0.50"}]},{"featureType":"road","elementType":"labels.icon","stylers":[{"saturation":"-100"},{"gamma":"0.50"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"},{"saturation":"-100"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"lightness":"-13"}]},{"featureType":"road.highway","elementType":"labels.icon","stylers":[{"lightness":"0"},{"gamma":"1.09"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"},{"saturation":"-100"},{"lightness":"47"}]},{"featureType":"road.arterial","elementType":"geometry.stroke","stylers":[{"lightness":"-12"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"saturation":"-100"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"},{"lightness":"77"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"lightness":"-5"},{"saturation":"-100"}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"saturation":"-100"},{"lightness":"-15"}]},{"featureType":"transit.station.airport","elementType":"geometry","stylers":[{"lightness":"47"},{"saturation":"-100"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]},{"featureType":"water","elementType":"geometry","stylers":[{"saturation":"53"}]},{"featureType":"water","elementType":"labels.text.fill","stylers":[{"lightness":"-42"},{"saturation":"17"}]},{"featureType":"water","elementType":"labels.text.stroke","stylers":[{"lightness":"61"}]}];
    var myOptions = {
        zoom: initialZoom,
        center: mapCenter,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        mapTypeControl: false,
        panControl: false,
        zoomControl: false,
        scaleControl: false,
        streetViewControl: false,
        styles: mostlyGreyscale
    }

    var mobileOptions = {
        zoom: mobileZoom,
        center: mapCenter,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        mapTypeControl: false,
        panControl: false,
        zoomControl: false,
        scaleControl: false,
        streetViewControl: false,
        styles: paledawn
    }

	var pinsVary = [{"Location":"Super Bowl City","Latitude":37.793438,"Longitude":-122.394463, 
                    "Color":"#ffcc00", "BG":"#fdbf3b", 
                    "Pin":"pin-super-bowl-city.png","Pin-Width":"60","Pin-Height":"45",
                    "Pin-Anchor-W":"0","Pin-Anchor-H":"60"},
				{"Location":"Game Day Fan Plaza","Latitude":37.399268,"Longitude":-121.974176, 
                    "Color":"#3366ff", "BG":"#7b9afa", 
                    "Pin":"pin-fan-zone.png","Pin-Width":"39","Pin-Height":"61",
                    "Pin-Anchor-W":"69","Pin-Anchor-H":"61"},
				{"Location":"Levi Stadium","Latitude":37.404245,"Longitude": -121.969412, 
                    "Color":"#009933", "BG":"#62b67b", 
                    "Pin":"pin-game.png","Pin-Width":"60","Pin-Height":"61",
                    "Pin-Anchor-W":"0","Pin-Anchor-H":"30"}];

    var pins = [{"Location":"Super Bowl City","Latitude":37.793438,"Longitude":-122.394463, 
                    "Color":"#ffcc00", "BG":"#fdbf3b", 
                    "Pin":"pin2-super-bowl-city.png","Pin-Width":"60","Pin-Height":"74",
                    "Pin-Anchor-W":"0","Pin-Anchor-H":"37"},
				{"Location":"Game Day Fan Plaza","Latitude":37.399054,"Longitude":-121.973146, 
                    "Color":"#3366ff", "BG":"#7b9afa", "AltLat":37.401486,"AltLng":-121.989520,
                    "Pin":"pin2-fan-zone.png","Pin-Width":"60","Pin-Height":"74",
                    "Pin-Anchor-W":"0","Pin-Anchor-H":"37"},
				{"Location":"Levi Stadium","Latitude":37.403631,"Longitude":-121.969852, 
                    "Color":"#009933", "BG":"#62b67b", 
                    "Pin":"pin2-game.png","Pin-Width":"60","Pin-Height":"74",
                    "Pin-Anchor-W":"0","Pin-Anchor-H":"37"}];

    var scoreData = [
            {   "Location":"Super Bowl City",
                "Data": [
                    {"Operator": "AT&T",
                     "Voice":   99,
                     "Data":    96,
                     "Overall": 97,
                    }, {"Operator": "Sprint",
                     "Voice":   95,
                     "Data":    93,
                     "Overall": 94,
                    }, {"Operator": "T-Mobile",
                     "Voice":   96,
                     "Data":    92,
                     "Overall": 91,
                    }, {"Operator": "Verizon",
                     "Voice":   98,
                     "Data":    97,
                     "Overall": 98,
                    }, {"Operator": "Wi-Fi",
                     "Voice":   96,
                     "Data":    97,
                     "Overall": 96,
                    }
                ]   
                               
            },
            {   "Location":"Game Day Fan Plaza",
                "Data": [
                    {"Operator": "AT&T",
                     "Voice":   99,
                     "Data":    96,
                     "Overall": 97,
                    }, {"Operator": "Sprint",
                     "Voice":   95,
                     "Data":    93,
                     "Overall": 94,
                    }, {"Operator": "T-Mobile",
                     "Voice":   96,
                     "Data":    92,
                     "Overall": 91,
                    }, {"Operator": "Verizon",
                     "Voice":   98,
                     "Data":    97,
                     "Overall": 98,
                    }, {"Operator": "Wi-Fi",
                     "Voice":   96,
                     "Data":    97,
                     "Overall": 96,
                    }
                ]   
                               
            },
            {   "Location":"Levi Stadium",
                "Data": [
                    {"Operator": "AT&T",
                     "Voice":   98,
                     "Data":    97,
                     "Overall": 96,
                    }, {"Operator": "Sprint",
                     "Voice":   94,
                     "Data":    95,
                     "Overall": 93,
                    }, {"Operator": "T-Mobile",
                     "Voice":   95,
                     "Data":    93,
                     "Overall": 92,
                    }, {"Operator": "Verizon",
                     "Voice":   97,
                     "Data":    96,
                     "Overall": 97,
                    }, {"Operator": "Wi-Fi",
                     "Voice":   94,
                     "Data":    95,
                     "Overall": 95,
                    }
                ]   
                               
            },


        ];

        // These are the PER-LOCATION RANKINGS
        var rankData = [
            {   "Location":"Super Bowl City",
                "Data": [
                    {"Operator": "AT&T",
                     "Voice":   1,
                     "Data":    2,
                     "Overall": 1,
                    }, {"Operator": "Sprint",
                     "Voice":   3,
                     "Data":    4,
                     "Overall": 3,
                    }, {"Operator": "T-Mobile",
                     "Voice":   4,
                     "Data":    3,
                     "Overall": 4,
                    }, {"Operator": "Verizon",
                     "Voice":   2,
                     "Data":    1,
                     "Overall": 2,
                    }, {"Operator": "Wi-Fi",
                     "Voice":   5,
                     "Data":    5,
                     "Overall": 5,
                    }
                ]   
                               
            },
            {   "Location":"Game Day Fan Plaza",
                "Data": [
                    {"Operator": "AT&T",
                     "Voice":   1,
                     "Data":    2,
                     "Overall": 2,
                    }, {"Operator": "Sprint",
                     "Voice":   2,
                     "Data":    3,
                     "Overall": 3,
                    }, {"Operator": "T-Mobile",
                     "Voice":   3,
                     "Data":    1,
                     "Overall": 4,
                    }, {"Operator": "Verizon",
                     "Voice":   4,
                     "Data":    4,
                     "Overall": 1,
                    }, {"Operator": "Wi-Fi",
                     "Voice":   5,
                     "Data":    5,
                     "Overall": 5,
                    }
                ]   
                               
            },
            {   "Location":"Levi Stadium",
                "Data": [
                    {"Operator": "AT&T",
                     "Voice":   1,
                     "Data":    3,
                     "Overall": 1,
                    }, {"Operator": "Sprint",
                     "Voice":   4,
                     "Data":    4,
                     "Overall": 4,
                    }, {"Operator": "T-Mobile",
                     "Voice":   3,
                     "Data":    5,
                     "Overall": 5,
                    }, {"Operator": "Verizon",
                     "Voice":   2,
                     "Data":    1,
                     "Overall": 2,
                    }, {"Operator": "Wi-Fi",
                     "Voice":   5,
                     "Data":    2,
                     "Overall": 4,
                    }
                ]   
                               
            },


        ];
    /*
	var OS_voice = [{"Location":"Super Bowl City","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
				  {"Location":"Game Day Fan Plaza","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
				  {"Location":"Levi Stadium","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
                ];
    var OS_packet = [{"Location":"Super Bowl City","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
				  {"Location":"Game Day Fan Plaza","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
				  {"Location":"Levi Stadium","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
                ];

    var OS_overall = [{"Location":"Super Bowl City","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
				  {"Location":"Game Day Fan Plaza","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
				  {"Location":"Levi Stadium","AT&T":"99","Sprint":"96","T-Mobile":"97","Verizon":"98","WiFi":"95"},
                ];
*/
    var chartOptions = {
            //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
            scaleBeginAtZero : false,

            //Boolean - Whether grid lines are shown across the chart
            scaleShowGridLines : true,

            //String - Colour of the grid lines
            scaleGridLineColor : "rgba(0,0,0,.05)",

            //Number - Width of the grid lines
            scaleGridLineWidth : 1,

            //Boolean - Whether to show horizontal lines (except X axis)
            scaleShowHorizontalLines: true,

            //Boolean - Whether to show vertical lines (except Y axis)
            scaleShowVerticalLines: true,

            //Boolean - If there is a stroke on each bar
            barShowStroke : true,

            //Number - Pixel width of the bar stroke
            barStrokeWidth : 1,

            //Number - Spacing between each of the X value sets
            barValueSpacing : 18,

            //Number - Spacing between data sets within X values
            barDatasetSpacing : 2,

            //String - A legend template
            legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><div style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",

            // String - Template string for single tooltips
            tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",

            responsive: true,

            showTooltips: true,

            customTooltips: false,

            

        };
    
    // OVERALL DATA
    var overallData = {
            labels: ["Overall","Voice", "Data"],
            datasets: [
                {
                    label: "AT&T",
                    fillColor: "rgba(30,178,234,0.8)",
                    strokeColor: "rgba(30,178,234,0.8)",
                    highlightFill: "rgba(30,178,234,1.0)",
                    highlightStroke: "rgba(30,178,234,1.0)",
                    data: [97, 96, 97]
                },
                {
                    label: "Sprint",
                    fillColor: "rgba(255,221,5,0.8)",
                    strokeColor: "rgba(255,221,5,0.8)",
                    highlightFill: "rgba(255,221,5,1.0)",
                    highlightStroke: "rgba(255,221,5,1.0)",
                    data: [93, 93, 94]
                }
                ,
                {
                    label: "T-Mobile",
                    fillColor: "rgba(237,0,140,0.8)",
                    strokeColor: "rgba(237,0,140,0.8)",
                    highlightFill: "rgba(237,0,140,1.0)",
                    highlightStroke: "rgba(237,0,140,1.0)",
                    data: [92, 94, 92]
                }
                ,
                {
                    label: "Verizon",
                    fillColor: "rgba(235,28,36,0.8)",
                    strokeColor: "rgba(235,28,36,0.8)",
                    highlightFill: "rgba(235,28,36,1.0)",
                    highlightStroke: "rgba(235,28,36,1.0)",
                    data: [96, 95, 96]
                }
                ,
                {
                    label: "Wi-Fi",
                    fillColor: "rgba(252,132,0,0.8)",
                    strokeColor: "rgba(252,132,0,0.8)",
                    highlightFill: "rgba(252,132,0,1)",
                    highlightStroke: "rgba(252,132,0,1)",
                    data: [92, 94, 93]
                }
            ]
        };

        // OVERALL RANKINGS
    var overallRankings = {
            labels: ["Overall","Voice", "Data"],
            datasets: [
                {
                    label: "AT&T",
                    fillColor: "rgba(30,178,234,0.8)",
                    strokeColor: "rgba(30,178,234,0.8)",
                    highlightFill: "rgba(30,178,234,1.0)",
                    highlightStroke: "rgba(30,178,234,1.0)",
                    data: [1, 1, 2]
                },
                {
                    label: "Sprint",
                    fillColor: "rgba(255,221,5,0.8)",
                    strokeColor: "rgba(255,221,5,0.8)",
                    highlightFill: "rgba(255,221,5,1.0)",
                    highlightStroke: "rgba(255,221,5,1.0)",
                    data: [3, 3, 3]
                }
                ,
                {
                    label: "T-Mobile",
                    fillColor: "rgba(237,0,140,0.8)",
                    strokeColor: "rgba(237,0,140,0.8)",
                    highlightFill: "rgba(237,0,140,1.0)",
                    highlightStroke: "rgba(237,0,140,1.0)",
                    data: [4, 5, 4]
                }
                ,
                {
                    label: "Verizon",
                    fillColor: "rgba(235,28,36,0.8)",
                    strokeColor: "rgba(235,28,36,0.8)",
                    highlightFill: "rgba(235,28,36,1.0)",
                    highlightStroke: "rgba(235,28,36,1.0)",
                    data: [2, 2, 1]
                }
                ,
                {
                    label: "Wi-Fi",
                    fillColor: "rgba(252,132,0,0.8)",
                    strokeColor: "rgba(252,132,0,0.8)",
                    highlightFill: "rgba(252,132,0,1)",
                    highlightStroke: "rgba(252,132,0,1)",
                    data: [5, 4, 5]
                }
            ]
        };

        function getLocationData(location) {
            var returnData = dataTemplate;

            for (var i = 0; i < returnData.datasets.length; i++)
            {
                var operator = returnData.datasets[i].label;
                var opData = lookupValues(location,operator);
                returnData.datasets[i].data = opData;
            }

            //alert(JSON.stringify(returnData));

            return returnData;
        }

        function lookupValues(location,operator)
        {
            var returnData = [];
            var curData = scoreData;
            if (!USE_ONESCORE) curData = rankData;

            for (var i = 0; i < curData.length; i++)
            {
                if (curData[i].Location == location)
                {
                    for (var j = 0; j < curData[i].Data.length; j++)
                    {
                        if (curData[i].Data[j].Operator == operator)
                        {
                            returnData.push(curData[i].Data[j].Overall);
                            returnData.push(curData[i].Data[j].Voice);
                            returnData.push(curData[i].Data[j].Data);

                        }
                    }
                }
            }
            return returnData;
        }


    // Plot carriers grouped by score
        var dataTemplate = {
            labels: ["Overall","Voice", "Data"],
            datasets: [
                {
                    label: "AT&T",
                    fillColor: "rgba(30,178,234,0.8)",
                    strokeColor: "rgba(30,178,234,0.8)",
                    highlightFill: "rgba(30,178,234,1.0)",
                    highlightStroke: "rgba(30,178,234,1.0)",
                    data: [97, 96, 97]
                },
                {
                    label: "Sprint",
                    fillColor: "rgba(255,221,5,0.8)",
                    strokeColor: "rgba(255,221,5,0.8)",
                    highlightFill: "rgba(255,221,5,1.0)",
                    highlightStroke: "rgba(255,221,5,1.0)",
                    data: [93, 93, 94]
                }
                ,
                {
                    label: "T-Mobile",
                    fillColor: "rgba(237,0,140,0.8)",
                    strokeColor: "rgba(237,0,140,0.8)",
                    highlightFill: "rgba(237,0,140,1.0)",
                    highlightStroke: "rgba(237,0,140,1.0)",
                    data: [92, 94, 92]
                }
                ,
                {
                    label: "Verizon",
                    fillColor: "rgba(235,28,36,0.8)",
                    strokeColor: "rgba(235,28,36,0.8)",
                    highlightFill: "rgba(235,28,36,1.0)",
                    highlightStroke: "rgba(235,28,36,1.0)",
                    data: [96, 95, 96]
                }
                ,
                {
                    label: "Wi-Fi",
                    fillColor: "rgba(252,132,0,0.8)",
                    strokeColor: "rgba(252,132,0,0.8)",
                    highlightFill: "rgba(252,132,0,1)",
                    highlightStroke: "rgba(252,132,0,1)",
                    data: [92, 94, 93]
                }
            ]
        };
    						
	
	
    var OneScore = [
        {"Operator":"AT&T",
         "Overall": 99,
         "Voice":   97,
         "Data":    98},
         {"Operator":"Verizon",
         "Overall": 98,
         "Voice":   99,
         "Data":    96},
         {"Operator":"Sprint",
         "Overall": 91,
         "Voice":   93,
         "Data":    92},
         {"Operator":"T-Mobile",
         "Overall": 93,
         "Voice":   91,
         "Data":    94},
         {"Operator":"Wi-Fi",
         "Overall": 96,
         "Voice":   94,
         "Data":    95},
    ];
    		
    var maptiler = new google.maps.ImageMapType({
        getTileUrl: function (coord, zoom) {
           
            var path = base_path.replace('{0}', tile_folder) + zoom + "/" + coord.x + "/" + coord.y + "/";
            //var path = base_path + zoom + "/" + coord.x + "/" + coord.y + "/";

            var measurement = getMeasurement();

            // if we are plotting the "best tech" there is no separation of 2g/3g/4g
            if (measurement == 'tech')
                path += $("#carrier").val() + "_tech_all.png";
            else
                path += $("#carrier").val() + "_" + measurement + "_" + $("#tech").val() + ".png";

            //alert(path);
            return path + "?20160208";      // append the date to the URL to prevent old version coming up
        },
        tileSize: new google.maps.Size(256, 256),
        isPng: true
    });

    var regionLayer = new google.maps.ImageMapType({
        getTileUrl: function (coord, zoom) {
            //return zoom + "/" + coord.x + "/" + (Math.pow(2,zoom)-coord.y-1) + ".png"; 

            var path = base_path.replace('{0}', 'superbowl_poly/') + zoom + "/" + coord.x + "/" + coord.y + "/geo.png";
            //alert(path);
            return path;
        },
        tileSize: new google.maps.Size(256, 256),
        isPng: true
    });

    var debugLayer = new google.maps.ImageMapType({
        getTileUrl: function (coord, zoom) {
            //return zoom + "/" + coord.x + "/" + (Math.pow(2,zoom)-coord.y-1) + ".png"; 

            var path = base_path.replace('{0}', 'debug') + zoom + "/" + coord.x + "/" + coord.y + "/debug.png";

            return path;
        },
        tileSize: new google.maps.Size(256, 256),
        isPng: true
    });


    // INITIALIZE SOME CHART STUFF
    Chart.defaults.global.pointHitDetectionRadius = 1;
    Chart.defaults.global.customTooltips = function(tooltip) {
        //alert('tooltip');
        var tooltipEl = $('#chartjs-tooltip');

        if (!tooltip) {
            tooltipEl.css({
                opacity: 0
            });
            return;
        }

        tooltipEl.removeClass('above below');
        tooltipEl.addClass(tooltip.yAlign);

        var innerHtml = '';
        for (var i = tooltip.labels.length - 1; i >= 0; i--) {
        	innerHtml += [
        		'<div class="chartjs-tooltip-section">',
        		'	<span class="chartjs-tooltip-key" style="background-color:' + tooltip.legendColors[i].fill + '"></span>',
        		'	<span class="chartjs-tooltip-value">' + tooltip.labels[i] + '</span>',
        		'</div>'
        	].join('');
        }
        tooltipEl.html(innerHtml);

        $("#overall_results").html(innerHtml);

        tooltipEl.css({
            opacity: 1,
            left: tooltip.chart.canvas.offsetLeft + tooltip.x + 'px',
            top: tooltip.chart.canvas.offsetTop + tooltip.y + 'px',
            fontFamily: tooltip.fontFamily,
            fontSize: tooltip.fontSize,
            fontStyle: tooltip.fontStyle,
            zIndex: 99999
        });
    };
    var randomScalingFactor = function() {
        return Math.round(Math.random() * 100);
    };


    function changeCarrier() {
        if ($("#carrier").val() == 'wifi')
            $("#tech").val('wifi');
        else if ($("#tech").val() == 'wifi')
            $("#tech").prop('selectedIndex', 0);

        
    }


    function changeTech() {
        if ($("#tech").val() == 'wifi')
            $("#carrier").val('wifi');
        else if ($("#carrier").val() == 'wifi')
            $("#carrier").prop('selectedIndex', 0);
    }

    function getMeasurement() {
        var measurement = 'signal';
        
        return measurement;
    }
    /*
    function pixelOffsetToLatLng(offsetx,offsety) {
      var latlng = map.getCenter();
      var scale = Math.pow(2, map.getZoom());
      var nw = new google.maps.LatLng(
          map.getBounds().getNorthEast().lat(),
          map.getBounds().getSouthWest().lng()
      );

      var worldCoordinateCenter = map.getProjection().fromLatLngToPoint(latlng);
      var pixelOffset = new google.maps.Point((offsetx/scale) || 0,(offsety/scale) ||0);

      var worldCoordinateNewCenter = new google.maps.Point(
          worldCoordinateCenter.x - pixelOffset.x,
          worldCoordinateCenter.y + pixelOffset.y
      );

      var latLngPosition = map.getProjection().fromPointToLatLng(worldCoordinateNewCenter);

      return latLngPosition;
    }
    */
    function repositionMap(location) {

        var pin = arrMatching(pins,'Location',location);
        var pinLat = pin.Latitude;
        var pinLng = pin.Longitude;
        /*
        try {

            var winW = $(window).width();
            var winH = $(window).height();
            var screenCenterW = winW/2;
            var screenCenterH = winH/2;
            var scale = Math.pow(2, map.getZoom());
        
            var pop = $("#location_popup");
            var locH = pop.outerHeight();
            var locBottom = pop.position().top + pop.outerHeight(true);

        
        
            //alert(pinLat + "," + pinLng);

            var offCenterH = Math.abs(screenCenterH - locBottom + (20*scale));
        
            var originLatLng = pixelOffsetToLatLng(0,0);
            var deltaLatLng = pixelOffsetToLatLng(0,offCenterH);
        
            //alert(pinLat + "," + pinLng);
            var deltaY = originLatLng.lat() - deltaLatLng.lat();
            //alert(originLatLng.lat() +","+ deltaLatLng.lat() );

            var newLat = pinLat + deltaY;
            var newLatLng = google.maps.LatLng(newLat,pinLng);

            map.setCenter(newLatLng);
        }
        catch (ex) {*/
            //alert(location);
            //alert(JSON.stringify(pin));
            //alert(pin.Latitude);
            //alert(pin.Longitude);
            var pinLL = new google.maps.LatLng(pin.Latitude,pin.Longitude);
            //alert(pinLL);
            if (pinLL)
                map.setCenter(pinLL);
        //}
        //alert(neBoundInPx + "," + swBoundInPx + "," + procY);
        //alert(newLatLng);
        
        //alert('half:' + (winH/2));
        //alert('win-loc:' + (winH - locH));
        /*var ov = new google.maps.OverlayView();
        ov.setMap(map);
        ov.draw();
        var scale = Math.pow(2,map.getZoom());
        var proj = ov.getProjection();
        var wc = proj.fromLatLngToContainerPixel(map.getCenter());

        alert(wc);*/
        
    }

    function setSize() {
        
    
        var winH = $(window).height();
        // firefox fix, wasn't getting window height
        try {
            if (!(window.mozInnerScreenX == null))
                winH = window.innerHeight;
            }
            catch (ex) {
            }
        var winW = $(window).width();
        //var headH = eval($(".masthead-container").css('height').replace('px', ''));
        var headH = $(".masthead-container").outerHeight();
        var mapH = winH - headH - 10;

        

        //mapH = mapH - 50;

        //alert(winH);
        //alert(headH);
        //alert(mapH);
        //alert(winW);
        $("#map_canvas").height(mapH);
        $("#map_canvas").width(winW);
        //$("#map_canvas").css('height', mapH + 'px !IMPORTANT');

        // in some cases if we're changing the window size and have previously closed the menu via the legend button
        // we could lose the legend entirely, so bring it back...
        if (isMenuVisible() == false && $("#legend").is(":visible") == false) {
            showHideLegend();
        }

        google.maps.event.trigger(map, "resize");
    }

    function isMenuVisible() {
        return ($("#legendbutton").is(":visible"));
    }

    function isMobile() {
        var check = false;
           (function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true })(navigator.userAgent || navigator.vendor || window.opera);
            return check;
    }

    function populateOverall() {
        
        var ctx = document.getElementById("overallChart").getContext("2d");

        var data = null;
        var currOptions = chartOptions;

        if (USE_ONESCORE) data = overallData;
        else {
            data = overallRankings;
            currOptions.scaleOverride = true;
            currOptions.scaleSteps = 4;
            currOptions.scaleStepWidth = -1;
            currOptions.scaleStartValue = 5;
            
        }
        var myBarChart = new Chart(ctx).Bar(data, currOptions);
        

        //$("#chart_legend").html(myBarChart.generateLegend());
    }

    function populateLocation(location) {
        closeOverall();
        $("#location_name").html(location);
        var ctx = document.getElementById("locationChart").getContext("2d");

        var myBarChart = new Chart(ctx).Bar(getLocationData(location), chartOptions);
        

        //$("#chart_legend_loc").html(myBarChart.generateLegend());
    }

    function initialize() {

        if (getParameterByName('show') == 'rank') {
            $("#overall_logo").hide();
            $("#overall_text").html('Overall Rankings from Super Bowl weekend');
            $("#location_logo").hide();
            $("#location_text").html('Rankings');
            USE_ONESCORE = false;
        }
        else { 
            $("#overall_logo").show();
            $("#overall_text").html('Results from Super Bowl weekend');
            $("#location_logo").show();
            $("#location_text").html('values');
            USE_ONESCORE = true
            
        }

        if (getParameterByName('init') != 'off')
            populateOverall();
        else {
            closeOverall();            
        }
        //populateLocation('Levi Stadium');

        $(".activate").click(function() {
            var location = $(this).attr('location');
            
            
            triggerLocation(location);


        });
        $("#center_popup_close").click(function() { $("#center_popup").hide() });
        $("#location_popup_close").click(function() { $("#location_popup").hide() });

        var useOption = myOptions;
        if (isMobile()) useOption = mobileOptions;

        map = new google.maps.Map(document.getElementById("map_canvas"), useOption);
        if (getParameterByName('init') == 'off')
        {
            repositionMap('Levi Stadium');
            map.setZoom(16);
        }
        //map.overlayMapTypes.insertAt(LAYER_REG, regionLayer);
        if (USE_TILES)
            map.overlayMapTypes.insertAt(LAYER_COV, maptiler);

        
        setSize();
        if (USE_TILES)
            clearAndReload();
        //initializeCarriers();
        
        google.maps.event.addListener(map, 'click', function (e) {
            closeOverall();
            closePopup();
            closeLocation();
        });
        /*
        google.maps.event.addListener(map, 'bounds_changed', function () {
            updateCarriers();
        });

       
        */
		
        //if (getParameterByName('show') != '')
		    loadPins();
		
        
        google.maps.event.addListener(map, 'zoom_changed', function () {
            //$(".masthead-title").html('zoom: ' + map.getZoom());
            //if (map.getCenter())
              //  $(".masthead-title").append(map.getCenter().toString());
            if (map.getZoom() > MAX_ZOOM)
                map.setZoom(MAX_ZOOM);
            if (map.getZoom() < MIN_ZOOM)
                map.setZoom(MIN_ZOOM);
            if (map.getZoom() >= GRAD_ZOOM)
            {
                $("#gradient_on").show();
                $("#gradient_off").hide();
            }
            else {
                $("#gradient_off").show();
                $("#gradient_on").hide();
            }
            var pinfo = pins[1];
            if (map.getZoom() > 13)
            {
                 markers[1].setPosition(new google.maps.LatLng(pinfo.Latitude,pinfo.Longitude));
            }
            else {
                markers[1].setPosition(new google.maps.LatLng(pinfo.AltLat,pinfo.AltLng));
            }
        });


        $(window).on('resize', function () {
            setSize();

        });
    }

	
	function loadPins()
	{
		for (var i = 0; i < pins.length; i++)
		{
			var obj = pins[i];
            addPin(obj);
		}
	}
    
	
    function getBasicIcon(file,w,h,aw,ah)
    {
        // default works as 60,74,30,74
        return new google.maps.MarkerImage('images/' + file,
		    new google.maps.Size(60, 74),
		    new google.maps.Point(0, 0),
		    new google.maps.Point(30, 74)
		);
    }

    function addPin(obj)
    {
        var title = obj.Location;
		var myLatLng = {lat: obj.Latitude, lng: obj.Longitude};

        if (obj.AltLat){
            var myLatLng = {lat: obj.AltLat, lng: obj.AltLng};
        }

        var w = obj["Pin-Width"];
        var h = obj["Pin-Height"];
        var aw = obj["Pin-Anchor-W"];
        var ah = obj["Pin-Anchor-H"];
        //alert('images/' + obj.Pin);
        //alert(w + ',' + h + ',' + a);
        /*
        var icon = { url: 'images/' + obj.Pin,
                     size: new google.maps.Size(w,h),
                     origin: new google.maps.Point(0,0),
                     anchor: new google.maps.Point(aw,ah)
                      };
        */
        //if (!custom) icon = 
        //if (custom) icon = 
        var icon = getBasicIcon(obj.Pin,w,h,aw,ah);
         
        var marker = new google.maps.Marker();
        
        if (SHOW_CUSTOM_PINS)             
		    marker = new google.maps.Marker({
				position: myLatLng,
				map: map,
				title: title,
                icon: icon
		        });
        else 
			marker = new google.maps.Marker({
				position: myLatLng,
				map: map,
				title: title
		        });

		google.maps.event.addListener(marker,'click',function() {
                //closeOverall();
                if (MINI_SCORES)
                    triggerLocation(marker.title);
                    //hookScores(map,marker,obj);
                else
                    hookIt(map,marker,obj);
            
		    });

        markers.push(marker);

        return marker;
    }	

    function triggerLocation(location) {
        
        /*for (var i = 0; i < markers.length; i++)
        {
            if (markers[i].title == location)
                new google.maps.event.trigger( markers[i], 'click' );
        }*/
        var details = arrMatching(pins,'Location',location);

        var myLatLng = {lat: details.Latitude, lng: details.Longitude};
        var thisLL = new google.maps.LatLng(details.Latitude,details.Longitude);
        //alert(thisLL);
        //alert('l:'+location);
        //alert(JSON.stringify(details));
        if (thisLL)
            map.setCenter(thisLL);
        map.setZoom(16);

        showLocation(location);
    }

    function showLocation(location) {
        if (isMobile())
            hideLegend();

        $(".location-buttons").children().removeClass("active-state");
        //$(".location-buttons").
        $("li[location='" + location + "']").addClass("active-state");
        
        closePopup();
        closeOverall();
        $("#location_popup").css("display","table");
        $("#location_popup").show();
        populateLocation(location);
        repositionMap(location);
    }

    function showOverall() {
        closePopup();
        closeLocation();
        map.setCenter(mapCenter);
        map.setZoom(initialZoom);
        
        $("#center_popup").css("display","table");
        $("#center_popup").show();
        populateOverall();
    }

	function closeOverall()
    {
        $("#center_popup").hide();
    }	

    function closeLocation()
    {
        $("#location_popup").hide();
    }

    function closePopup()
    {
        if (infowindow != "")
			infowindow.close();
    }

    
    function hookScores(map,marker,obj) {
        repositionMap(marker.title);
        showLocation(marker.title);
        //openLocation(marker.title);
        //$("#location_popup").css("display","table");
        //$("#location_popup").show();

        
        var title = marker.title;
        
		if (infowindow != "")
			infowindow.close();
		var borderColor = obj.BG;
		var captionColor = "#ffffff";
		var titleName = title;
		var photo = '';
		var disableAutoPan = false;

        

        //canvas_name = 'ctx_' + title;

        //var content = '<canvas id="' + canvas_name + '" width="100%" style="min-width: 300px;" height="300"></canvas>';

        
        /*
        var content = $("#location_popup").clone().wrap('<div />').html();

        infowindow = new InfoBubble({
		    map : map,
		    content : content,
		    shadowStyle : 0,
		    padding : 0,
		    backgroundColor : 'rgb(255,255,255)',
		    borderRadius : 0,
		    arrowSize : 10,
		    borderWidth : 0,
		    borderColor : borderColor,
		    disableAutoPan : disableAutoPan,
		    hideCloseButton : false,
		    arrowPosition : 50,
		    backgroundClassName : 'popbubble',
		    arrowStyle : 0,
				
		});
        */
		//infowindow.setBubbleOffset(0,bubbleOffsetHeight);

        /*
        google.maps.event.addListener(infowindow, 'domready', function() {
            //infowindow.close();
//            if (canvas_name != "") {
//                alert(canvas_name);
//                var ctx1 = document.getElementById(canvas_name).getContext("2d");

//                var myBarChart1 = new Chart(ctx1).Bar(locationData, chartOptions);
//            }
        });
        */
		//infowindow.open(map, marker);
        
		currentMarker = marker;
		//currentData = jData;

        

    }

	function hookIt(map,marker,obj) {		
		
		var title = marker.title;
        
		if (infowindow != "")
			infowindow.close();
		var borderColor = obj.BG;
		var captionColor = "#ffffff";
		var titleName = title;
		var photo = '';
		var disableAutoPan = false;

		
        //var voice = arrMatching(OS_voice,'Location',title);
        //var packet = arrMatching(OS_packet,'Location',title);
        //var overall = arrMatching(OS_overall,'Location',title);

        var thisData = arrMatching(scoreData,'Location',title);



		var content = '<table class="pop-table">' +
                        '<tr><td colspan="4" class="pop-title" style="color:{bg}">{title}</td></tr>' +
                        '<tr><td colspan="4" class="pop-subtitle"><img src="images/One-Score-Logo-final-tm.png" width="128" height="30" alt=""  style="vertical-align:top"><span style="font-size:130%; line-height:30px;">values</span></td></tr>' +
                        '<tr><td></td><td class="pop-head">Overall</td><td class="pop-head">Voice</td><td class="pop-head">Data</td></tr>' +
                        '<tr><td class="pop-carrier">AT&T</td><td class="pop-ranking">{a1}</td><td class="pop-ranking">{a2}</td><td class="pop-ranking">{a3}</td></tr>' +
                        '<tr><td class="pop-carrier">Sprint</td><td class="pop-ranking">{s1}</td><td class="pop-ranking">{s2}</td><td class="pop-ranking">{s3}</td></tr>' +
                        '<tr><td class="pop-carrier">T-Mobile</td><td class="pop-ranking">{t1}</td><td class="pop-ranking">{t2}</td><td class="pop-ranking">{t3}</td></tr>' +
                        '<tr><td class="pop-carrier">Verizon</td><td class="pop-ranking">{v1}</td><td class="pop-ranking">{v2}</td><td class="pop-ranking">{v3}</td></tr>' +
                        '<tr><td class="pop-carrier">Wi-Fi</td><td class="pop-ranking">{w1}</td><td class="pop-ranking">{w2}</td><td class="pop-ranking">{w3}</td></tr>' +
                        '<tr><td colspan="4" class="pop-foot">* indicates a tie</td></tr>' +
                        '<tr><td colspan="4" class="pop-pad">&nbsp;</td></tr>' +
                        '</table>';
		
        content = content.replace('{title}',title)
                         .replace('{bg}',obj.BG);

        content = content.replace('{a1}',formatOption(arrMatching(thisData.Data,'Operator','AT&T').Overall))
                          .replace('{a2}',formatOption(arrMatching(thisData.Data,'Operator','AT&T').Voice))
                          .replace('{a3}',formatOption(arrMatching(thisData.Data,'Operator','AT&T').Data));
                          
        content = content.replace('{s1}',formatOption(arrMatching(thisData.Data,'Operator','Sprint').Overall))
                          .replace('{s2}',formatOption(arrMatching(thisData.Data,'Operator','Sprint').Voice))
                          .replace('{s3}',formatOption(arrMatching(thisData.Data,'Operator','Sprint').Data));
        
        content = content.replace('{t1}',formatOption(arrMatching(thisData.Data,'Operator','T-Mobile').Overall))
                          .replace('{t2}',formatOption(arrMatching(thisData.Data,'Operator','T-Mobile').Voice))
                          .replace('{t3}',formatOption(arrMatching(thisData.Data,'Operator','T-Mobile').Data));
        
        content = content.replace('{v1}',formatOption(arrMatching(thisData.Data,'Operator','Verizon').Overall))
                          .replace('{v2}',formatOption(arrMatching(thisData.Data,'Operator','Verizon').Voice))
                          .replace('{v3}',formatOption(arrMatching(thisData.Data,'Operator','Verizon').Data));
        
        content = content.replace('{w1}',formatOption(arrMatching(thisData.Data,'Operator','Wi-Fi').Overall))
                          .replace('{w2}',formatOption(arrMatching(thisData.Data,'Operator','Wi-Fi').Voice))
                          .replace('{w3}',formatOption(arrMatching(thisData.Data,'Operator','Wi-Fi').Data));
        

		infowindow = new InfoBubble({
		    map : map,
		    content : content,
		    shadowStyle : 0,
		    padding : 0,
		    backgroundColor : 'rgb(255,255,255)',
		    borderRadius : 0,
		    arrowSize : 10,
		    borderWidth : 0,
		    borderColor : borderColor,
		    disableAutoPan : disableAutoPan,
		    hideCloseButton : false,
		    arrowPosition : 50,
		    backgroundClassName : 'popbubble',
		    arrowStyle : 0,
				
		});
		//infowindow.setBubbleOffset(0,bubbleOffsetHeight);
		infowindow.open(map, marker);
		currentMarker = marker;
		//currentData = jData;
			
		}
	
    function formatOption(value)
    {
        if (USE_ORDINAL) return toOrdinal(value);
        else return value;
    }

    function showHideLegend() {
		if ($("#legend").is(":visible")) {
		    hideLegend();
		}
		else {
		    showLegend();
		}
    }

    function hideLegend() {
        $("#legend").hide();
		$("#legendbutton").css('background-image', 'url(images/legend-btn.png)');
    }
     
    function showLegend() {
        var height = (showingLands ? legend_landon : legend_landoff) + legend_pad;
		$("#legend").css('height', height + 'px');
		$("#legend").show();
		$("#legendbutton").css('background-image', 'url(images/legend-close-btn.png)');
    }


	var legend_landoff = 270;
	var legend_landon = 410;
	var legend_pad = 38;

	var showingLands = true;
	
    

	function selectText(containerid) {
		if (document.selection) {
		var range = document.body.createTextRange();
		    range.moveToElementText(document.getElementById(containerid));
		    range.select();
		} else if (window.getSelection) {
		    var range = document.createRange();
		    range.selectNode(document.getElementById(containerid));
		    window.getSelection().addRange(range);
		}
	}

	function copyToClipboard(text) {
		window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
	}

		

    var popupContainer = '<div class="point_details">{0}</div>';
    var popupRow = '<div class="point_caption">{0}</div><div class="point_value">{1}</div>';

    if (!String.prototype.format) {
        String.prototype.format = function () {
            var args = arguments;
            return this.replace(/{(\d+)}/g, function (match, number) {
                return typeof args[number] != 'undefined'
            ? args[number]
            : match
          ;
            });
        };
    }

    function arrMatching(arr,field,match)
    {
        for(var i = 0; i < arr.length; i++)
        {
          if(arr[i][field] == match)
          {
            return arr[i];
          }
        }
        return null;
    }

    function colorTile(rgb) {
        return '<div class=\"color_tile\" style=\"background-color: RGB(' + rgb + ')\"></div>';
    }

    function clearAndReload() {

        map.overlayMapTypes.setAt(LAYER_COV, maptiler);
        //updateShortURL();
        $("#carrier").blur();
        //map.overlapMapTypes.setAt(LAYER_REG, regionLayer);
    }


    $(document).ready(function () {

        initialize();

        $("#showDebug").change(function () {
            if ($("#showDebug").is(':checked')) {
                map.overlayMapTypes.setAt(2, debugLayer);
            }
            else
                map.overlayMapTypes.setAt(2, null);
        });

    });



    /*
    Math helper
    */
    // Closure
    (function () {
        /**
        * Decimal adjustment of a number.
        *
        * @param {String}  type  The type of adjustment.
        * @param {Number}  value The number.
        * @param {Integer} exp   The exponent (the 10 logarithm of the adjustment base).
        * @returns {Number} The adjusted value.
        */
        function decimalAdjust(type, value, exp) {
            // If the exp is undefined or zero...
            if (typeof exp === 'undefined' || +exp === 0) {
                return Math[type](value);
            }
            value = +value;
            exp = +exp;
            // If the value is not a number or the exp is not an integer...
            if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
                return NaN;
            }
            // Shift
            value = value.toString().split('e');
            value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
            // Shift back
            value = value.toString().split('e');
            return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
        }

        // Decimal round
        if (!Math.round10) {
            Math.round10 = function (value, exp) {
                return decimalAdjust('round', value, exp);
            };
        }
        // Decimal floor
        if (!Math.floor10) {
            Math.floor10 = function (value, exp) {
                return decimalAdjust('floor', value, exp);
            };
        }
        // Decimal ceil
        if (!Math.ceil10) {
            Math.ceil10 = function (value, exp) {
                return decimalAdjust('ceil', value, exp);
            };
        }
    })();


    String.prototype.replaceAll = function (find, replace) {
        var str = this;
        return str.replace(new RegExp(find, 'g'), replace);
    }


    function getParameterByName(name) {
        name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
        var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
        return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }
		
	function pct(value) {
        if (value == "1") return 100;
        else return Math.round10(value*100,0);
    }
    	
	function toOrdinal (value) {
        if (value) {

        if (value.substr(0,1) == "*")
            value = value.replace('*','<span class="asterisk">*</span>');

		var s = String(value),
		  len = s.length,
		  end  = s.substr(len - 1, 1),
		  teen = len > 1 && s.substr(len - 2, 1) === "1",
		  ord = "th";
		if (end === "1" && !teen) {
		  ord = "st";
		} else if (end === "2" && !teen) {
		  ord = "nd";
		} else if (end === "3" && !teen) {
		  ord = "rd";
		}
		return value + '' + ord;
        }
        else return value;
	 }

	String.prototype.replaceAll = function (find,replace) {
		var str = this;
		return str.replace(new RegExp(find,'g'), replace);
	}

Anon7 - 2021