﻿
google.load("maps", "2");

$(window).load(function() {

    $.ajax({
        url: '/_webhandlers/get-flickr-feed.ashx',
        success: function(data) {
            $("#flickr-feed-wrapper").html(data);
        }
    });

    $.ajax({
        url: '/_webhandlers/get-twitter-feed.ashx',
        success: function(data) {
            $("#twitter-feed-wrapper").html(data);
        }
    });

    loadGoogleMap();
    
});

function qrcodeclick() {
    if ($("#qrcode-body").css("display") == "none") {
        $('#qrcode-body').fadeIn('slow');
    }
    else {
        $('#qrcode-body').fadeOut('slow');
    }
}


function loadGoogleMap() {
    var map = new google.maps.Map2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new google.maps.LatLng(40, -92), 4);

    var iconBlue = new GIcon();
    iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
    iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconBlue.iconSize = new GSize(12, 20);
    iconBlue.shadowSize = new GSize(22, 20);
    iconBlue.iconAnchor = new GPoint(6, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);

    var markerMinneapolis = new GMarker(new GLatLng(44.979722, -93.263611), { title: "Minneapolis, MN" });
    GEvent.addListener(markerMinneapolis, "click", function() {
        location.href = "http://maps.google.com/maps?q=Minneapolis+MN";
    });
    map.addOverlay(markerMinneapolis);

    var markerSeattle = new GMarker(new GLatLng(47.6061115, -122.331944), { title: "Seattle, WA" });
    GEvent.addListener(markerSeattle, "click", function() {
        location.href = "http://maps.google.com/maps?q=Seattle+WA";
    });
    map.addOverlay(markerSeattle);

    var markerChicago = new GMarker(new GLatLng(41.85, -87.65), { title: "Chicago, IL" });
    GEvent.addListener(markerChicago, "click", function() {
        location.href = "http://maps.google.com/maps?q=Chicago+IL";
    });
    map.addOverlay(markerChicago);

    var markerNewYork = new GMarker(new GLatLng(40.714167, -74.005833), { title: "New York, NY" });
    GEvent.addListener(markerNewYork, "click", function() {
        location.href = "http://maps.google.com/maps?q=New+York+NY";
    });
    map.addOverlay(markerNewYork);

    var markerWiscasset = new GMarker(new GLatLng(44.002778, -69.665556), { title: "Wiscasset, ME", icon: iconBlue });
    GEvent.addListener(markerWiscasset, "click", function() {
        location.href = "http://maps.google.com/maps?q=Wiscasset+ME";
    });
    map.addOverlay(markerWiscasset);

    var markerNewark = new GMarker(new GLatLng(39.816944, -75.749444), { title: "Newark, DE", icon: iconBlue });
    GEvent.addListener(markerNewark, "click", function() {
        location.href = "http://maps.google.com/maps?q=Newark+DE";
    });
    map.addOverlay(markerNewark);

    var markerTariffville = new GMarker(new GLatLng(41.908611, -72.76), { title: "Tariffville, CT", icon: iconBlue });
    GEvent.addListener(markerTariffville, "click", function() {
        location.href = "http://maps.google.com/maps?q=Tariffville+CT";
    });
    map.addOverlay(markerTariffville);

    var markerJensenBeach = new GMarker(new GLatLng(27.254444, -80.229722), { title: "Jensen Beach, FL", icon: iconBlue });
    GEvent.addListener(markerJensenBeach, "click", function() {
        location.href = "http://maps.google.com/maps?q=Jensen+Beach+FL";
    });
    map.addOverlay(markerJensenBeach);

    var markerBuckeye = new GMarker(new GLatLng(33.370278, -112.583611), { title: "Buckeye, AZ", icon: iconBlue });
    GEvent.addListener(markerBuckeye, "click", function() {
        location.href = "http://maps.google.com/maps?q=Buckeye+AZ";
    });
    map.addOverlay(markerBuckeye);

    var markerDecatur = new GMarker(new GLatLng(39.840278, -88.954722), { title: "Decatur, IL", icon: iconBlue });
    GEvent.addListener(markerDecatur, "click", function() {
        location.href = "http://maps.google.com/maps?q=Decatur+IL";
    });
    map.addOverlay(markerDecatur);

    var markerMaroa = new GMarker(new GLatLng(40.036389, -88.956944), { title: "Maroa, IL", icon: iconBlue });
    GEvent.addListener(markerMaroa, "click", function() {
        location.href = "http://maps.google.com/maps?q=Maroa+IL";
    });
    map.addOverlay(markerMaroa);

}
