<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ @License(content = "This code is licensed under GNU AFFERO GENERAL PUBLIC LICENSE Version 3")
  -->

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>\ilikeplaces\src\main\webapp\WEB-INF\pages\ai\ilikeplaces\widgets\DownTownHeatMap.xhtml</title>
</head>
<body>
<div class="by" itsnat:nocache="true" xmlns:itsnat="http://itsnat.org/itsnat">

<script type="text/javascript">


 var stylez = [
  {
    featureType: "road.highway",
    elementType: "geometry",
    stylers: [
      { visibility: "on" },
      { hue: "#00e5ff" },
      { saturation: -80 },
      { lightness: 40 }
    ]
  },{
    featureType: "road.arterial",
    elementType: "geometry",
    stylers: [
      { visibility: "on" },
      { hue: "#00e5ff" },
      { saturation: -90 },
      { lightness: 40 }
    ]
  },{
    featureType: "road.local",
    elementType: "geometry",
    stylers: [
      { hue: "#00e5ff" },
      { visibility: "on" },
      { invert_lightness: true },
      { saturation: 0 },
      { lightness: 80 }
    ]
  },{
    featureType: "road.local",
    elementType: "labels",
    stylers: [
      { lightness: 51 },
      { saturation: 49 },
      { hue: "#ff7700" },
      { visibility: "on" }
    ]
  },{
    featureType: "water",
    elementType: "geometry",
    stylers: [
      { hue: "#0022ff" },
      { saturation: 69 }
    ]
  },{
    featureType: "poi",
    elementType: "geometry",
    stylers: [
      { hue: "#ffff00" },
      { saturation: -80 },
      { visibility: "on" }
    ]
  },{
    featureType: "landscape.natural",
    elementType: "all",
    stylers: [
      { saturation: -54 }
    ]
  }
];






markerIcon = "http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=1|14|000|glyphish_map-marker|16|4bf202|892e40";

focusLat = 0;
focusLng = 0;
zoom = 5;

listOfHotSpots = new Array();

function clearHotSpots(){
    try{
        for(var i in listOfHotSpots){
            listOfHotSpots[i].setMap(null);
        }
    }catch(err){
        alert(err);
    }
}

function getColoredMarkerWithIntensity(intensity){
    if(Math.log(intensity)/Math.log(10) < 1 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|00b7fa|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 2 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|f94c7d|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 3 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|f9c405|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 4 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|fb150f|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 5 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|f8f509|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 6 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|009d00|892e40';
    }
    if(Math.log(intensity)/Math.log(10) >= 6 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|004fa1|892e40';
    }
}


function zoomMap(){
    map.setZoom(zoom);
}

function initialize_DownTownHeatMap_map(){

 var DWN_TWN_ID = 'dwntwn';

    myLatlng = new google.maps.LatLng(focusLat,focusLng);
    var myOptions = {
        zoom: 5,
        center: myLatlng,
        mapTypeId: DWN_TWN_ID,
        mapTypeControlOptions:{
            style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
            position:google.maps.ControlPosition.TOP_LEFT,
            mapTypeIds: [DWN_TWN_ID, google.maps.MapTypeId.SATELLITE]

        },
        zoomControl:false,
        navigationControlOptions:{
            style:google.maps.NavigationControlStyle.SMALL,
            position:google.maps.ControlPosition.TOP_RIGHT
        },
        streetViewControl:false
    };

    map = new google.maps.Map(document.getElementById("DownTownHeatMap_map"), myOptions);


    panoramioLayerOpts = {suppressInfoWindows:true, clickable:false, map:map};
    panoramioLayerOptsInfo = {suppressInfoWindows:false, clickable:true};
    panoramioLayerOptsNoInfo = {suppressInfoWindows:true, clickable:false};

    panoramioLayer = new google.maps.panoramio.PanoramioLayer(panoramioLayerOpts);
    panoramioLayer.setMap(null);

    google.maps.event.addListener(map, 'zoom_changed', function() {
        if(map.getZoom() > 16){
            panoramioLayer.setOptions(panoramioLayerOptsInfo);
        }else{
            panoramioLayer.setOptions(panoramioLayerOptsNoInfo);
        }
    });

     google.maps.event.addDomListener(document.getElementById('mapCustomControlsShowHide'), 'click', function() {
        var mapCustomControlsShowHideText = document.getElementById('mapCustomControlsShowHideText');
        if(panoramioLayer.getMap() == map){
            panoramioLayer.setMap(null);
            mapCustomControlsShowHideText.innerHTML='Show Pics';
        }else{
            panoramioLayer.setMap(map);
            mapCustomControlsShowHideText.innerHTML='Hide Pics';
        }
     });
     document.getElementById('mapCustomControlsShowHide').index = 1;
     map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(document.getElementById('mapCustomControlsShowHide'));

     google.maps.event.addDomListener(document.getElementById('mapCustomControlsSearchBox'), 'click', function() {
        //nothing so far
     });
     document.getElementById('mapCustomControlsSearchBox').index = 1;
     map.controls[google.maps.ControlPosition.TOP_CENTER].push(document.getElementById('mapCustomControlsSearchBox'));


     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSNW'), 'click', function() {
     map.panBy(-30, -30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSN'), 'click', function() {
     map.panBy(0, -50);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSNE'), 'click', function() {
     map.panBy(30, -30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSW'), 'click', function() {
     map.panBy(-50, 0);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSE'), 'click', function() {
     map.panBy(50, 0);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSSW'), 'click', function() {
     map.panBy(-30, 30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSS'), 'click', function() {
     map.panBy(0, +50);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSSE'), 'click', function() {
     map.panBy(30, 30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomIn'), 'click', function() {
     map.setZoom(map.getZoom()+1);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomOut'), 'click', function() {
     map.setZoom(map.getZoom()-1);
     });

     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomInMain'), 'click', function() {
     map.setZoom(map.getZoom()+1);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomOutMain'), 'click', function() {
     map.setZoom(map.getZoom()-1);
     });

     document.getElementById('mapCustomControlsNEWS').index = 1;
     map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('mapCustomControlsNEWS'));


     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomInMain'), 'click', function() {
     map.setZoom(map.getZoom()+1);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomOutMain'), 'click', function() {
     map.setZoom(map.getZoom()-1);
     });

     document.getElementById('mapCustomControlsNEWSZoomMain').index = 1;
     map.controls[google.maps.ControlPosition.TOP_RIGHT].push(document.getElementById('mapCustomControlsNEWSZoomMain'));


    <!--panoramioSingleClickEvent = undefined;-->

    <!--runPanoramioIfNotDblClick = function(){-->
        <!--if(panoramioSingleClickEvent != undefined){-->
            <!--alert(panoramioSingleClickEvent);-->
        <!--}else{-->
        <!--}-->
    <!--}-->

    <!--google.maps.event.addListener(panoramioLayer, 'click', function(event) {-->
        <!--panoramioSingleClickEvent = event;-->
        <!--runPanoramioIfNotDblClick();-->
    <!--});-->


    var styledMapOptions = {
        name: "DownTown"
    };

    var dwntwnMapTyp = new google.maps.StyledMapType(stylez, styledMapOptions);

    map.mapTypes.set(DWN_TWN_ID, dwntwnMapTyp);

    initialGmapLoadListener = google.maps.event.addListener(map, 'bounds_changed', function() {
        setTimeout("zoomMap()",10);
        google.maps.event.removeListener(initialGmapLoadListener);
    });

    placeMarker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        title:"Is it here? if so, click on this marker!!!",
        icon:"http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=|11|eee|glyphish_map-marker|16|cc2200|cc2200"
    });


    infowindow = new google.maps.InfoWindow({
        content: "Zoom to street level & Point marker to EXACT place. Click the marker to confirm!",
        maxWidth:400
    });

    infowindow.open(map,placeMarker);

    var geocoder = new google.maps.Geocoder();

    geocodetoinfowindow = function(){
        if(map.getZoom() > 13){
            infowindow.setContent("Tracking you...");
            geocoder.geocode(
            {
                location:map.getCenter()
            },
            function(geocoderResult,geocoderStatus){
                if(geocoderStatus == google.maps.GeocoderStatus.OK){
                    infowindow.setContent("Vicinity.. "+geocoderResult[0].address_components[0].long_name+", " + geocoderResult[geocoderResult.length-1].address_components[geocoderResult[geocoderResult.length-1].address_components.length-1].long_name);
                }else{
                    infowindow.setContent("Hope you know where you are!!");
                }
            }
            );
        }
    };

    alertWithPlaceMarkBox = function(){
        if(map.getZoom() > 10 ){
            if(18 > map.getZoom()){
                if(!confirm("Not yet in street level. " + (18 - map.getZoom()) + " more levels to go. Ingore and continue?")){
                    return;
                }
            }

            if(confirm("We don't want your friends to end up next doors do we... \nMark this as exact place of event?")){
                infowindow.setContent("That's the place you selected!");
                map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
                infowindow.setPosition(placeMarker.getPosition());
                DownTownHeatMapWOEIDUpdate(map.getCenter().lat(), map.getCenter().lng()).focus();
                window.location.href = "/page/_org?category=143&woehint=" + placeMarker.getPosition().lat() + "," + placeMarker.getPosition().lng();
            }
        }else{
            alert("Zoom to Street Level! "+ (18-(map.getZoom())) + " levels more to go...");
        }
    };

    google.maps.event.addListener(placeMarker, 'click', function() {
        alertWithPlaceMarkBox();
    });

    runIfNotDblClick = function(event){
        if(singleClick){
            map.setCenter(currentSingleClickEvent.latLng);
            setTimeout("alertWithPlaceMarkBox()",500);
        }
    };

    singleClick = false;
    currentSingleClickEvent = undefined;

    google.maps.event.addListener(map, 'click', function(event) {// duh! :-( google map zoom on double click!
        singleClick = true;
        currentSingleClickEvent = event;
        setTimeout("runIfNotDblClick()", 500);
    });

    google.maps.event.addListener(map, 'dblclick', function(event) {// duh! :-( google map zoom on double click!
        singleClick = false;
    });

    google.maps.event.addListener(map, 'center_changed', function() {
        placeMarker.setPosition(map.getCenter());
    });

    google.maps.event.addListener(map, 'zoom_changed', function() {
        infowindow.setContent("Zoom to Street Level! "+ (18-(map.getZoom())) + " levels more to go...");
        infowindow.setPosition(placeMarker.getPosition());

        geocodetoinfowindow();

    });

    google.maps.event.addListener(map, 'zoom_changed', function() {
        var myOptions;
        if(map.getZoom()>19){
            myOptions = {
                 //mapTypeId: google.maps.MapTypeId.ROADMAP,
                draggable:true//TODO, set to false
            };
            map.setOptions(myOptions);
        }else{
            myOptions = {
                draggable:true
            };
            map.setOptions(myOptions);
        }
    });

    google.maps.event.addListener(map, 'dragstart', function() {
        infowindow.setContent("Point the marker to the EXACT place.<br/>Click on the marker to confirm!");
        infowindow.setPosition(placeMarker.getPosition());
    });

    function listenerCallOnDownTownHeatMapBBUpdate(){
             var curr = DownTownHeatMapBBUpdate(
                map.getBounds().getSouthWest().lat(),
                map.getBounds().getSouthWest().lng(),
                map.getBounds().getNorthEast().lat(),
                map.getBounds().getNorthEast().lng());
            clearHotSpots();
            curr.focus();
            curr.blur();
    }

    google.maps.event.addListener(map, 'dragend', function() {
        if(map.getZoom()>10){
            listenerCallOnDownTownHeatMapBBUpdate();
        }
    });

    google.maps.event.addListener(map, 'zoom_changed', function() {
        if(map.getZoom()>10){
            listenerCallOnDownTownHeatMapBBUpdate();
        }
    });

    google.maps.event.addListener(map, 'dragend', function() {
        geocodetoinfowindow();
    });
}

initialize_gmap_scripts_done = false;

function initialize_gmap_scripts(){//wise any changes also to initialize_gmap_scripts_transparently
    if(!initialize_gmap_scripts_done){
        document.getElementById("DownTownHeatMap_load_click").style.display = "none";
        document.getElementById("DownTownHeatMap_map_wrapper").style.display = "block";
        var scripts = document.createElement("script");
        scripts.type = "text/javascript";
        scripts.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize_DownTownHeatMap_map&libraries=adsense,panoramio";
        document.body.appendChild(scripts);
        initialize_gmap_scripts_done = true;
    }else{
        //map already loaded
    }

}

function initialize_gmap_scripts_transparently(){//wise any changes also to initialize_gmap_scripts
    if(!initialize_gmap_scripts_done){
        var scripts = document.createElement("script");
        scripts.type = "text/javascript";
        scripts.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize_DownTownHeatMap_map&libraries=adsense,panoramio";
        document.body.appendChild(scripts);
    }else{
        //map already loaded
    }

}


</script>
    <div class="by" style="overflow:hidden;" id="DownTownHeatMap_load_click">
        <div></div>
        <div class="by center" title="fun places map!" style="cursor:pointer;">
            Stuff's loading... It's gonna be great.. but just a moment!
        </div>
        <div></div>
    </div>
    <div class="by" style="overflow:hidden;display:none;" id="DownTownHeatMap_map_wrapper">
        <div id="DownTownHeatMap_map" class="by vtip" title="Double-click to Zoom" style="height:600px;font-size:12px;">
        </div>
    </div>
    <div class="by center">
        <div class="by2 center">
            <input type="text" class="by center" id="DownTownHeatMapWOEID" value="0,0" readonly="readonly" style="background-color:transparent;color:transparent;border:none;font-family: Impact, Charcoal, sans-serif;"/>
        </div>
        <div class="by2 center">
            <input type="text" class="by center" id="DownTownHeatMapBB" value="0,0" readonly="readonly" style="background-color:transparent;color:transparent;border:none;font-family: Impact, Charcoal, sans-serif;"/>
        </div>
    </div>
    <div style="display:none;">
        <div id="mapCustomControlsShowHide" style="width:180px;">
                    <div id="mapCustomControlsShowHideText" class="btn use100" style="font-size:18px;text-align:center;cursor:pointer;">Show Pics</div>&nbsp;
        </div>
        <div id="mapCustomControlsNEWS" class="by5">
            <div class="by" style="height:45px;">
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSNW" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_upperleft_32.png" style="height:100%;" alt="&#8598;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSN" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_up_32.png" style="height:100%;" alt="&uarr;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSNE" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_upperright_32.png" style="height:100%;" alt="&#8599;"/></div>
                </div>
            </div>
            <div class="by" style="height:45px;">
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSW" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_left_32.png" style="height:100%;" alt="&larr;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSZoom" class="by" style="font-size:24px;font-weight:bold;text-align:center;">
                        &nbsp;</div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSE" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_right_32.png" style="height:100%;" alt="&rarr;"/></div>
                </div>
            </div>
            <div class="by" style="height:45px;">
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSSW" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_lowerleft_32.png" style="height:100%;" alt="&#8601;"/></div>
                </div>
                <div class="by3" style="height:45px;">

                    <div id="mapCustomControlsNEWSS" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_down_32.png" style="height:100%;" alt="&darr;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSSE" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_lowerright_32.png" style="height:100%;" alt="&#8600;"/></div>
                </div>

            </div>
            <div class="by" style="height:20px;">&nbsp;
            </div>
            <div class="by" style="height:45px;">
                <div class="by" style="height:45px;">
                    <div id="mapCustomControlsNEWSZoomIn" class="by2" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_in_32.png" style="height:100%;" alt="-"/></div>
                    <div id="mapCustomControlsNEWSZoomOut" class="by2" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_out_32.png" style="height:100%;" alt="-"/></div>
                </div>
            </div>
        </div>
        <div class="by">
            <div class="by" id="mapCustomControlsNEWSZoomMain" style="height:50px;width:100px;">
                <div id="mapCustomControlsNEWSZoomInMain" class="by2" style="height:100%;">
                    <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_in_32.png"  style="height:100%;" alt="-"/></div>
                <div id="mapCustomControlsNEWSZoomOutMain" class="by2" style="height:100%;">
                    <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_out_32.png" style="height:100%;" alt="-"/></div>
            </div>
        </div>
        <div id="mapCustomControlsSearchBox" style="width:200px;">
                    <div class="use100">
                        <div class="use100">
                            <div class="use100">
                                <input class="vtip use100 center layer_2"
                                   id="seachboxMap"
                                   style="border:1px solid #ccc;border-bottom-color:#999;border-right-color:#999;font-size:14px;height:24px;vertical-align:top;"
                                   value="e.g. las vegas, united states"
                                   onfocus="javascript:this.value='';"
                                   tabindex="1"
                                   onchange="javascript:$('#searchButtonMap').click();"
                                    />
                            </div>
                            <div class="use25p use50 use25a">
                            <div class="btn use100"
                                   id="searchButtonMap"
                                   onclick="javascript:try{seachboxMap = document.getElementById('seachboxMap');new google.maps.Geocoder().geocode({address:seachboxMap.value},function(geocoderResult,geocoderStatus){if(geocoderStatus == google.maps.GeocoderStatus.OK){if(!(zoomInHint = !zoomInHint)){}map.setCenter(geocoderResult[0].geometry.location); var llb = geocoderResult[0].geometry.viewport; map.fitBounds(llb);}else{alert('No find '+seachboxMap.value+' :(  (try city, state or a larger place)');;}});}catch(err){}"
                                   style="font-size:18px;cursor:pointer;background-color;#FD78E1;border:1px;text-align:center;"
                                   >&nbsp;Search&nbsp;</div>
                         </div>
                        <br/>
                    </div>
        </div>
    </div>
</div>
</body>
</html><commit_msg>Safety Commit<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ @License(content = "This code is licensed under GNU AFFERO GENERAL PUBLIC LICENSE Version 3")
  -->

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>\ilikeplaces\src\main\webapp\WEB-INF\pages\ai\ilikeplaces\widgets\DownTownHeatMap.xhtml</title>
</head>
<body>
<div class="by" itsnat:nocache="true" xmlns:itsnat="http://itsnat.org/itsnat">

<script type="text/javascript">


 var stylez = [
  {
    featureType: "road.highway",
    elementType: "geometry",
    stylers: [
      { visibility: "on" },
      { hue: "#00e5ff" },
      { saturation: -80 },
      { lightness: 40 }
    ]
  },{
    featureType: "road.arterial",
    elementType: "geometry",
    stylers: [
      { visibility: "on" },
      { hue: "#00e5ff" },
      { saturation: -90 },
      { lightness: 40 }
    ]
  },{
    featureType: "road.local",
    elementType: "geometry",
    stylers: [
      { hue: "#00e5ff" },
      { visibility: "on" },
      { invert_lightness: true },
      { saturation: 0 },
      { lightness: 80 }
    ]
  },{
    featureType: "road.local",
    elementType: "labels",
    stylers: [
      { lightness: 28 },
      { saturation: 67 },
      { hue: "#0800ff" },
      { visibility: "on" }
    ]
  },{
    featureType: "water",
    elementType: "geometry",
    stylers: [
      { hue: "#0022ff" },
      { saturation: 69 }
    ]
  },{
    featureType: "poi",
    elementType: "geometry",
    stylers: [
      { hue: "#ffff00" },
      { saturation: -80 },
      { visibility: "on" }
    ]
  },{
    featureType: "landscape.natural",
    elementType: "all",
    stylers: [
      { saturation: -54 }
    ]
  }
];






markerIcon = "http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=1|14|000|glyphish_map-marker|16|4bf202|892e40";

focusLat = 0;
focusLng = 0;
zoom = 5;

listOfHotSpots = new Array();

function clearHotSpots(){
    try{
        for(var i in listOfHotSpots){
            listOfHotSpots[i].setMap(null);
        }
    }catch(err){
        alert(err);
    }
}

function getColoredMarkerWithIntensity(intensity){
    if(Math.log(intensity)/Math.log(10) < 1 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|00b7fa|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 2 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|f94c7d|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 3 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|f9c405|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 4 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|fb150f|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 5 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|f8f509|892e40';
    }
    if(Math.log(intensity)/Math.log(10) < 6 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|009d00|892e40';
    }
    if(Math.log(intensity)/Math.log(10) >= 6 ){
        return 'http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=' + intensity + '|14|000|glyphish_map-marker|16|004fa1|892e40';
    }
}


function zoomMap(){
    map.setZoom(zoom);
}

function initialize_DownTownHeatMap_map(){

 var DWN_TWN_ID = 'dwntwn';

    myLatlng = new google.maps.LatLng(focusLat,focusLng);
    var myOptions = {
        zoom: 5,
        center: myLatlng,
        mapTypeId: DWN_TWN_ID,
        mapTypeControlOptions:{
            style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
            position:google.maps.ControlPosition.TOP_LEFT,
            mapTypeIds: [DWN_TWN_ID, google.maps.MapTypeId.SATELLITE]

        },
        zoomControl:false,
        navigationControlOptions:{
            style:google.maps.NavigationControlStyle.SMALL,
            position:google.maps.ControlPosition.TOP_RIGHT
        },
        streetViewControl:false
    };

    map = new google.maps.Map(document.getElementById("DownTownHeatMap_map"), myOptions);


    panoramioLayerOpts = {suppressInfoWindows:true, clickable:false, map:map};
    panoramioLayerOptsInfo = {suppressInfoWindows:false, clickable:true};
    panoramioLayerOptsNoInfo = {suppressInfoWindows:true, clickable:false};

    panoramioLayer = new google.maps.panoramio.PanoramioLayer(panoramioLayerOpts);
    panoramioLayer.setMap(null);

    google.maps.event.addListener(map, 'zoom_changed', function() {
        if(map.getZoom() > 16){
            panoramioLayer.setOptions(panoramioLayerOptsInfo);
        }else{
            panoramioLayer.setOptions(panoramioLayerOptsNoInfo);
        }
    });

     google.maps.event.addDomListener(document.getElementById('mapCustomControlsShowHide'), 'click', function() {
        var mapCustomControlsShowHideText = document.getElementById('mapCustomControlsShowHideText');
        if(panoramioLayer.getMap() == map){
            panoramioLayer.setMap(null);
            mapCustomControlsShowHideText.innerHTML='Show Pics';
        }else{
            panoramioLayer.setMap(map);
            mapCustomControlsShowHideText.innerHTML='Hide Pics';
        }
     });
     document.getElementById('mapCustomControlsShowHide').index = 1;
     map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(document.getElementById('mapCustomControlsShowHide'));

     google.maps.event.addDomListener(document.getElementById('mapCustomControlsSearchBox'), 'click', function() {
        //nothing so far
     });
     document.getElementById('mapCustomControlsSearchBox').index = 1;
     map.controls[google.maps.ControlPosition.TOP_CENTER].push(document.getElementById('mapCustomControlsSearchBox'));


     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSNW'), 'click', function() {
     map.panBy(-30, -30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSN'), 'click', function() {
     map.panBy(0, -50);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSNE'), 'click', function() {
     map.panBy(30, -30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSW'), 'click', function() {
     map.panBy(-50, 0);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSE'), 'click', function() {
     map.panBy(50, 0);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSSW'), 'click', function() {
     map.panBy(-30, 30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSS'), 'click', function() {
     map.panBy(0, +50);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSSE'), 'click', function() {
     map.panBy(30, 30);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomIn'), 'click', function() {
     map.setZoom(map.getZoom()+1);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomOut'), 'click', function() {
     map.setZoom(map.getZoom()-1);
     });

     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomInMain'), 'click', function() {
     map.setZoom(map.getZoom()+1);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomOutMain'), 'click', function() {
     map.setZoom(map.getZoom()-1);
     });

     document.getElementById('mapCustomControlsNEWS').index = 1;
     map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('mapCustomControlsNEWS'));


     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomInMain'), 'click', function() {
     map.setZoom(map.getZoom()+1);
     });
     google.maps.event.addDomListener(document.getElementById('mapCustomControlsNEWSZoomOutMain'), 'click', function() {
     map.setZoom(map.getZoom()-1);
     });

     document.getElementById('mapCustomControlsNEWSZoomMain').index = 1;
     map.controls[google.maps.ControlPosition.TOP_RIGHT].push(document.getElementById('mapCustomControlsNEWSZoomMain'));


    <!--panoramioSingleClickEvent = undefined;-->

    <!--runPanoramioIfNotDblClick = function(){-->
        <!--if(panoramioSingleClickEvent != undefined){-->
            <!--alert(panoramioSingleClickEvent);-->
        <!--}else{-->
        <!--}-->
    <!--}-->

    <!--google.maps.event.addListener(panoramioLayer, 'click', function(event) {-->
        <!--panoramioSingleClickEvent = event;-->
        <!--runPanoramioIfNotDblClick();-->
    <!--});-->


    var styledMapOptions = {
        name: "DownTown"
    };

    var dwntwnMapTyp = new google.maps.StyledMapType(stylez, styledMapOptions);

    map.mapTypes.set(DWN_TWN_ID, dwntwnMapTyp);

    initialGmapLoadListener = google.maps.event.addListener(map, 'bounds_changed', function() {
        setTimeout("zoomMap()",10);
        google.maps.event.removeListener(initialGmapLoadListener);
    });

    placeMarker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        title:"Is it here? if so, click on this marker!!!",
        icon:"http://chart.apis.google.com/chart?chst=d_simple_text_icon_below&chld=|11|eee|glyphish_map-marker|16|cc2200|cc2200"
    });


    infowindow = new google.maps.InfoWindow({
        content: "Zoom to street level & Point marker to EXACT place. Click the marker to confirm!",
        maxWidth:400
    });

    infowindow.open(map,placeMarker);

    var geocoder = new google.maps.Geocoder();

    geocodetoinfowindow = function(){
        if(map.getZoom() > 13){
            infowindow.setContent("Tracking you...");
            geocoder.geocode(
            {
                location:map.getCenter()
            },
            function(geocoderResult,geocoderStatus){
                if(geocoderStatus == google.maps.GeocoderStatus.OK){
                    infowindow.setContent("Vicinity.. "+geocoderResult[0].address_components[0].long_name+", " + geocoderResult[geocoderResult.length-1].address_components[geocoderResult[geocoderResult.length-1].address_components.length-1].long_name);
                }else{
                    infowindow.setContent("Hope you know where you are!!");
                }
            }
            );
        }
    };

    alertWithPlaceMarkBox = function(){
        if(map.getZoom() > 10 ){
            if(18 > map.getZoom()){
                if(!confirm("Not yet in street level. " + (18 - map.getZoom()) + " more levels to go. Ingore and continue?")){
                    return;
                }
            }

            if(confirm("We don't want your friends to end up next doors do we... \nMark this as exact place of event?")){
                infowindow.setContent("That's the place you selected!");
                map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
                infowindow.setPosition(placeMarker.getPosition());
                DownTownHeatMapWOEIDUpdate(map.getCenter().lat(), map.getCenter().lng()).focus();
                window.location.href = "/page/_org?category=143&woehint=" + placeMarker.getPosition().lat() + "," + placeMarker.getPosition().lng();
            }
        }else{
            alert("Zoom to Street Level! "+ (18-(map.getZoom())) + " levels more to go...");
        }
    };

    google.maps.event.addListener(placeMarker, 'click', function() {
        alertWithPlaceMarkBox();
    });

    runIfNotDblClick = function(event){
        if(singleClick){
            map.setCenter(currentSingleClickEvent.latLng);
            setTimeout("alertWithPlaceMarkBox()",500);
        }
    };

    singleClick = false;
    currentSingleClickEvent = undefined;

    google.maps.event.addListener(map, 'click', function(event) {// duh! :-( google map zoom on double click!
        singleClick = true;
        currentSingleClickEvent = event;
        setTimeout("runIfNotDblClick()", 500);
    });

    google.maps.event.addListener(map, 'dblclick', function(event) {// duh! :-( google map zoom on double click!
        singleClick = false;
    });

    google.maps.event.addListener(map, 'center_changed', function() {
        placeMarker.setPosition(map.getCenter());
    });

    google.maps.event.addListener(map, 'zoom_changed', function() {
        infowindow.setContent("Zoom to Street Level! "+ (18-(map.getZoom())) + " levels more to go...");
        infowindow.setPosition(placeMarker.getPosition());

        geocodetoinfowindow();

    });

    google.maps.event.addListener(map, 'zoom_changed', function() {
        var myOptions;
        if(map.getZoom()>19){
            myOptions = {
                 //mapTypeId: google.maps.MapTypeId.ROADMAP,
                draggable:true//TODO, set to false
            };
            map.setOptions(myOptions);
        }else{
            myOptions = {
                draggable:true
            };
            map.setOptions(myOptions);
        }
    });

    google.maps.event.addListener(map, 'dragstart', function() {
        infowindow.setContent("Point the marker to the EXACT place.<br/>Click on the marker to confirm!");
        infowindow.setPosition(placeMarker.getPosition());
    });

    function listenerCallOnDownTownHeatMapBBUpdate(){
             var curr = DownTownHeatMapBBUpdate(
                map.getBounds().getSouthWest().lat(),
                map.getBounds().getSouthWest().lng(),
                map.getBounds().getNorthEast().lat(),
                map.getBounds().getNorthEast().lng());
            clearHotSpots();
            curr.focus();
            curr.blur();
    }

    google.maps.event.addListener(map, 'dragend', function() {
        if(map.getZoom()>10){
            listenerCallOnDownTownHeatMapBBUpdate();
        }
    });

    google.maps.event.addListener(map, 'zoom_changed', function() {
        if(map.getZoom()>10){
            listenerCallOnDownTownHeatMapBBUpdate();
        }
    });

    google.maps.event.addListener(map, 'dragend', function() {
        geocodetoinfowindow();
    });
}

initialize_gmap_scripts_done = false;

function initialize_gmap_scripts(){//wise any changes also to initialize_gmap_scripts_transparently
    if(!initialize_gmap_scripts_done){
        document.getElementById("DownTownHeatMap_load_click").style.display = "none";
        document.getElementById("DownTownHeatMap_map_wrapper").style.display = "block";
        var scripts = document.createElement("script");
        scripts.type = "text/javascript";
        scripts.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize_DownTownHeatMap_map&libraries=adsense,panoramio";
        document.body.appendChild(scripts);
        initialize_gmap_scripts_done = true;
    }else{
        //map already loaded
    }

}

function initialize_gmap_scripts_transparently(){//wise any changes also to initialize_gmap_scripts
    if(!initialize_gmap_scripts_done){
        var scripts = document.createElement("script");
        scripts.type = "text/javascript";
        scripts.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize_DownTownHeatMap_map&libraries=adsense,panoramio";
        document.body.appendChild(scripts);
    }else{
        //map already loaded
    }

}


</script>
    <div class="by" style="overflow:hidden;" id="DownTownHeatMap_load_click">
        <div></div>
        <div class="by center" title="fun places map!" style="cursor:pointer;">
            Stuff's loading... It's gonna be great.. but just a moment!
        </div>
        <div></div>
    </div>
    <div class="by" style="overflow:hidden;display:none;" id="DownTownHeatMap_map_wrapper">
        <div id="DownTownHeatMap_map" class="by vtip" title="Double-click to Zoom" style="height:600px;font-size:12px;">
        </div>
    </div>
    <div class="by center">
        <div class="by2 center">
            <input type="text" class="by center" id="DownTownHeatMapWOEID" value="0,0" readonly="readonly" style="background-color:transparent;color:transparent;border:none;font-family: Impact, Charcoal, sans-serif;"/>
        </div>
        <div class="by2 center">
            <input type="text" class="by center" id="DownTownHeatMapBB" value="0,0" readonly="readonly" style="background-color:transparent;color:transparent;border:none;font-family: Impact, Charcoal, sans-serif;"/>
        </div>
    </div>
    <div style="display:none;">
        <div id="mapCustomControlsShowHide" style="width:180px;">
                    <div id="mapCustomControlsShowHideText" class="btn use100" style="font-size:18px;text-align:center;cursor:pointer;">Show Pics</div>&nbsp;
        </div>
        <div id="mapCustomControlsNEWS" class="by5">
            <div class="by" style="height:45px;">
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSNW" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_upperleft_32.png" style="height:100%;" alt="&#8598;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSN" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_up_32.png" style="height:100%;" alt="&uarr;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSNE" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_upperright_32.png" style="height:100%;" alt="&#8599;"/></div>
                </div>
            </div>
            <div class="by" style="height:45px;">
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSW" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_left_32.png" style="height:100%;" alt="&larr;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSZoom" class="by" style="font-size:24px;font-weight:bold;text-align:center;">
                        &nbsp;</div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSE" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_right_32.png" style="height:100%;" alt="&rarr;"/></div>
                </div>
            </div>
            <div class="by" style="height:45px;">
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSSW" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_lowerleft_32.png" style="height:100%;" alt="&#8601;"/></div>
                </div>
                <div class="by3" style="height:45px;">

                    <div id="mapCustomControlsNEWSS" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_down_32.png" style="height:100%;" alt="&darr;"/></div>
                </div>
                <div class="by3" style="height:45px;">
                    <div id="mapCustomControlsNEWSSE" class="by" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/arrow_sans_lowerright_32.png" style="height:100%;" alt="&#8600;"/></div>
                </div>

            </div>
            <div class="by" style="height:20px;">&nbsp;
            </div>
            <div class="by" style="height:45px;">
                <div class="by" style="height:45px;">
                    <div id="mapCustomControlsNEWSZoomIn" class="by2" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_in_32.png" style="height:100%;" alt="-"/></div>
                    <div id="mapCustomControlsNEWSZoomOut" class="by2" style="font-size:24px;font-weight:bold;text-align:center;cursor:pointer;height:100%;">
                        <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_out_32.png" style="height:100%;" alt="-"/></div>
                </div>
            </div>
        </div>
        <div class="by">
            <div class="by" id="mapCustomControlsNEWSZoomMain" style="height:50px;width:100px;">
                <div id="mapCustomControlsNEWSZoomInMain" class="by2" style="height:100%;">
                    <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_in_32.png"  style="height:100%;" alt="-"/></div>
                <div id="mapCustomControlsNEWSZoomOutMain" class="by2" style="height:100%;">
                    <img src="http://c1606662.cdn.cloudfiles.rackspacecloud.com/zoom_out_32.png" style="height:100%;" alt="-"/></div>
            </div>
        </div>
        <div id="mapCustomControlsSearchBox" style="width:200px;">
                    <div class="use100">
                        <div class="use100">
                            <div class="use100">
                                <input class="vtip use100 center layer_2"
                                   id="seachboxMap"
                                   style="border:1px solid #ccc;border-bottom-color:#999;border-right-color:#999;font-size:14px;height:24px;vertical-align:top;"
                                   value="e.g. las vegas, united states"
                                   onfocus="javascript:this.value='';"
                                   tabindex="1"
                                   onchange="javascript:$('#searchButtonMap').click();"
                                    />
                            </div>
                            <div class="use25p use50 use25a">
                            <div class="btn use100"
                                   id="searchButtonMap"
                                   onclick="javascript:try{seachboxMap = document.getElementById('seachboxMap');new google.maps.Geocoder().geocode({address:seachboxMap.value},function(geocoderResult,geocoderStatus){if(geocoderStatus == google.maps.GeocoderStatus.OK){if(!(zoomInHint = !zoomInHint)){}map.setCenter(geocoderResult[0].geometry.location); var llb = geocoderResult[0].geometry.viewport; map.fitBounds(llb);}else{alert('No find '+seachboxMap.value+' :(  (try city, state or a larger place)');;}});}catch(err){}"
                                   style="font-size:18px;cursor:pointer;background-color;#FD78E1;border:1px;text-align:center;"
                                   >&nbsp;Search&nbsp;</div>
                         </div>
                        <br/>
                    </div>
        </div>
    </div>
</div>
</body>
</html>
{'fraction_non_alphanumeric': 0.1530386970466947, 'fraction_numerical': 0.025492564668638314, 'mean_word_length': 2.75, 'pattern_counts': {'":': 0, '<': 295, '<?xml version=': 2, '>': 299, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3837499', 'n_tokens_mistral': 15921, 'n_tokens_neox': 14611, 'n_words': 1970}