anchor.diff:  $(function() {
   
     navigator.geolocation.getCurrentPosition(
  -    function( position ){
  -     
  -      var locationMarker;
  -      // Check to see if there is already a location.
  -      // There is a bug in FireFox where this gets
  -      // invoked more than once with a cahced result.
  -      if (locationMarker){
  -        return;
  -      }
  -       
  -      // Log that this is the initial position.
  -      console.log( "Initial Position Found" );
  -      console.log(position.coords.latitude);
  -      console.log(position.coords.longitude);
  +
  +    function(position){
  +
  +      console.log( "Geo-Location Found" );
   
         var current_lat = position.coords.latitude;
         var current_long = position.coords.longitude;
   
  -
  -
  -
  -      var center = new google.maps.LatLng(current_lat, current_long);
  -      var mapOptions = {
  -        center: center,
  -        disableDoubleClickZoom: true,
  -        // keyboardShortcuts: false,
  -        mapTypeControl: false,
  -        mapTypeId: google.maps.MapTypeId.ROADMAP,
  -        maxZoom: 18,
  -        minZoom: 18,
  -        panControl: false,
  -        rotateControl: false,
  -        scaleControl: false,
  -        scrollwheel: true,
  -        streetViewControl: true,
  -        zoom: 18,
  -        zoomControl: false
  -      };
  -      var map = new google.maps.Map(document.getElementById("map"), mapOptions);
  -      var size = new google.maps.Size(29.0, 37.0);
  -      var origin = new google.maps.Point(0, 0);
  -      var anchor = new google.maps.Point(13.0, 18.0);
  -      var greenMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/markergreen.png' %>',
  -        size,
  -        origin,
  -        anchor
  -      );
  -      var greenStarMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/green_star.png' %>',
  -        size,
  -        origin,
  -        anchor
  -      );
  -      var orangeMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/markerorangedrain.gif' %>',
  -        size,
  -        origin,
  -        anchor
  -      );
  -      var markerShadowImage = new google.maps.MarkerImage('<%= image_path 'markers/shadow.png' %>',
  -        new google.maps.Size(46.0, 37.0),
  -        origin,
  -        anchor
  -      );
  -
  -
  -      var activeThingId;
  -      var activeMarker;
  -      var activeInfoWindow;
  -      var isWindowOpen = false;
  -      var thingIds = [];
  -      var markers = [];
  -      function addMarker(thingId, point, color) {
  -        if(color == 'green') {
  -          var image = greenMarkerImage;
  -        } else if(color == 'orange') {
  -          var image = orangeMarkerImage;
  -        } else if(color == 'green_star'){
  -          var image = greenStarMarkerImage;
  -        }
  -        var marker = new google.maps.Marker({
  -          animation: google.maps.Animation.DROP,
  -          icon: image,
  -          map: map,
  -          position: point,
  -          shadow: markerShadowImage,
  -          thingId:thingId
  +      load_map(current_lat, current_long);
  +    },
  +    function( error ){
  +
  +      console.log( "Using Default Position " );
  +
  +      var current_lat = 37.804855;
  +      var current_long = -122.271304;
  +
  +      load_map(current_lat, current_long);
  +
  +    },
  +    {
  +      timeout: (5 * 1000),
  +      maximumAge: (1000 * 60 * 15),
  +      enableHighAccuracy: true
  +    }
  +  );
  +
  +
  +
  +  var load_map = function( current_lat, current_long ){
  +   
  +    var locationMarker;
  +    // Check to see if there is already a location.
  +    // There is a bug in FireFox where this gets
  +    // invoked more than once with a cahced result.
  +    if (locationMarker){
  +      return;
  +    }
  +     
  +
  +    console.log("current_lat" + current_lat);
  +    console.log("current_long" + current_long);
  +
  +
  +
  +    var center = new google.maps.LatLng(current_lat, current_long);
  +    var mapOptions = {
  +      center: center,
  +      disableDoubleClickZoom: true,
  +      // keyboardShortcuts: false,
  +      mapTypeControl: false,
  +      mapTypeId: google.maps.MapTypeId.ROADMAP,
  +      maxZoom: 18,
  +      minZoom: 18,
  +      panControl: false,
  +      rotateControl: false,
  +      scaleControl: false,
  +      scrollwheel: true,
  +      streetViewControl: true,
  +      zoom: 18,
  +      zoomControl: false
  +    };
  +    var map = new google.maps.Map(document.getElementById("map"), mapOptions);
  +    var size = new google.maps.Size(29.0, 37.0);
  +    var origin = new google.maps.Point(0, 0);
  +    var anchor = new google.maps.Point(13.0, 18.0);
  +    var greenMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/green-marker.png' %>',
  +      size,
  +      origin,
  +      anchor
  +    );
  +    var greenStarMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/green_star.png' %>',
  +      size,
  +      origin,
  +      anchor
  +    );
  +    var orangeMarkerImage = new google.maps.MarkerImage('<%= image_path 'markers/orange-marker.png' %>',
  +      size,
  +      origin,
  +      anchor
  +    );
  +    var markerShadowImage = new google.maps.MarkerImage('<%= image_path 'markers/shadow.png' %>',
  +      new google.maps.Size(46.0, 37.0),
  +      origin,
  +      anchor
  +    );
  +
  +
  +    var activeThingId;
  +    var activeMarker;
  +    var activeInfoWindow;
  +    var isWindowOpen = false;
  +    var thingIds = [];
  +    var markers = [];
  +    function addMarker(thingId, point, color) {
  +      if(color == 'green') {
  +        var image = greenMarkerImage;
  +      } else if(color == 'orange') {
  +        var image = orangeMarkerImage;
  +      } else if(color == 'green_star'){
  +        var image = greenStarMarkerImage;
  +      }
  +      var marker = new google.maps.Marker({
  +        animation: google.maps.Animation.DROP,
  +        icon: image,
  +        map: map,
  +        position: point,
  +        shadow: markerShadowImage,
  +        thingId:thingId
  +      });
  +      markers.push(marker);
  +      google.maps.event.addListener(marker, 'click', function() {
  +        if(activeInfoWindow) {
  +          activeInfoWindow.close();
  +        }
  +        var infoWindow = new google.maps.InfoWindow({
  +          maxWidth: 210
           });
  -        markers.push(marker);
  -        google.maps.event.addListener(marker, 'click', function() {
  -          if(activeInfoWindow) {
  -            activeInfoWindow.close();
  -          }
  -          var infoWindow = new google.maps.InfoWindow({
  -            maxWidth: 210
  -          });
  -          google.maps.event.addListener(infoWindow, 'closeclick', function() {
  -            isWindowOpen = false;
  -          });
  -          activeInfoWindow = infoWindow;
  -          activeThingId = thingId;
  -          activeMarker = marker;
  -          $.ajax({
  -            type: 'GET',
  -            url: '/info_window',
  -            data: {
  -              'thing_id': thingId
  -            },
  -            success: function(data) {
  -              // Prevent race condition, which could lead to multiple windows being open at the same time.
  -              if(infoWindow == activeInfoWindow) {
  -                infoWindow.setContent(data);
  -                infoWindow.open(map, marker);
  -                isWindowOpen = true;
  -              }
  -            }
  -          });
  +        google.maps.event.addListener(infoWindow, 'closeclick', function() {
  +          isWindowOpen = false;
           });
  -        thingIds.push(thingId);
  -      }
  -      function addMarkersAround(lat, lng, NE, SW) {
  -        var submitButton = $("#address_form input[type='submit']");
  +        activeInfoWindow = infoWindow;
  +        activeThingId = thingId;
  +        activeMarker = marker;
           $.ajax({
             type: 'GET',
  -          url: '/things.json',
  +          url: '/info_window',
  +          data: {
  +            'thing_id': thingId
  +          },
  +          success: function(data) {
  +            // Prevent race condition, which could lead to multiple windows being open at the same time.
  +            if(infoWindow == activeInfoWindow) {
  +              infoWindow.setContent(data);
  +              infoWindow.open(map, marker);
  +              isWindowOpen = true;
  +            }
  +          }
  +        });
  +      });
  +      thingIds.push(thingId);
  +    }
  +    function addMarkersAround(lat, lng, NE, SW) {
  +      var submitButton = $("#address_form input[type='submit']");
  +      $.ajax({
  +        type: 'GET',
  +        url: '/things.json',
  +        data: {
  +          'utf8': '✓',
  +          'authenticity_token': $('#address_form input[name="authenticity_token"]').val(),
  +          'NE': NE,
  +          'SW': SW,
  +          'lat': lat,
  +          'lng': lng,
  +          'limit': $('#address_form input[name="limit"]').val()
  +        },
  +        error: function(jqXHR) {
  +          $(submitButton).attr("disabled", false);
  +        },
  +        success: function(data) {
  +          $(submitButton).attr("disabled", false);
  +          if(data.errors) {
  +            $('#address').parent().addClass('error');
  +            $('#address').focus();
  +          } else {
  +            $('#address_label').removeClass('error', 500);
  +            $('#address').removeClass('error', 500);
  +            var i = -1;
  +            $(data).each(function(index, thing) {
  +              if($.inArray(thing.id, thingIds) == -1) {
  +                i += 1;
  +              } else {
  +                // continue
  +                return true;
  +              }
  +              
  +              var point = new google.maps.LatLng(thing.lat, thing.lng);
  +              var color = 'orange';
  +              if(thing.users.length > 0) {
  +                color = 'green';
  +              }
  +              if(thing.owned_by_you){
  +                color = 'green_star';
  +              }              
  +              
  +              addMarker(thing.id, point, color);
  +              
  +              if(index == data.length -1){
  +                //after markers are added
  +                urlActions();
  +              }
  +
  +            });
  +          }
  +        }
  +      });
  +    }
  +    var urlActions = function(){
  +      console.log(window.location.hash)
  +      if(window.location.hash.length > 0){
  +        //#2:54:failed
  +        var hash = window.location.hash.substring(1, window.location.hash.length);
  +        var parts = hash.split(":");
  +        if(parts.length > 2){
  +
  +          // use thing_id to highlight the thing we are talking about.
  +
  +          for(m in markers){
  +            if(markers[m].thingId == parts[1]){
  +              if(activeInfoWindow) {
  +                activeInfoWindow.close();
  +              }
  +              var infoWindow = new google.maps.InfoWindow({
  +                maxWidth: 210
  +              });
  +              google.maps.event.addListener(infoWindow, 'closeclick', function() {
  +                isWindowOpen = false;
  +              }); 
  +              activeInfoWindow = infoWindow;
  +              activeThingId = parts[1];
  +              activeMarker = markers[m];
  +              $.ajax({
  +                type: 'GET',
  +                url: '/status/info',
  +                data: {
  +                  'thing_id': parts[1],
  +                  'statuscode':parts[2]
  +                },
  +                success: function(data) {
  +                  // Prevent race condition, which could lead to multiple windows being open at the same time.
  +                  if(infoWindow == activeInfoWindow) {
  +                    infoWindow.setContent(data);
  +                    infoWindow.open(map, markers[m]);
  +                    isWindowOpen = true;
  +                  }
  +                }
  +              });
  +              break;
  +            }
  +          }
  +
  +
  +          var statusData = {user: parts[0],
  +                            thing:parts[1],
  +                            statusCode:parts[2]};
  +
  +          $.ajax("/status.json", {type:"POST", data:statusData, success:function(data){
  +            console.log("Thanks for reporting");
  +          }},"json");
  +        }
  +
  +      }
  +    
  +    }
  +
  +
  +    google.maps.event.addListener(map, 'idle', function() {
  +      markers = [];
  +      var bounds = map.getBounds();
  +      var NE = {lat: bounds.getNorthEast().lat(),  lng: bounds.getNorthEast().lng()};
  +      var SW = {lat: bounds.getSouthWest().lat(),  lng: bounds.getSouthWest().lng()};
  +
  +      // console.log(NE);
  +      // console.log(SW);
  +      // console.log(center.lat());
  +      // console.log(center.lng());
  +      
  +      addMarkersAround(center.lat(), center.lng(), NE, SW) ;
  +    });
  +
  +
  +
  +    google.maps.event.addListenerOnce(map, 'tilesloaded', function() {
  +      // addMarkersAround(center.lat(), center.lng(), null, null) ;
  +
  +
  +    });
  +    $('#address_form').live('submit', function() {
  +      var submitButton = $("#address_form input[type='submit']");
  +      $(submitButton).attr("disabled", true);
  +      if($('#address').val() === '') {
  +        $(submitButton).attr("disabled", false);
  +        $('#address').parent().addClass('error');
  +        $('#address').focus();
  +      } else {
  +        $.ajax({
  +          type: 'GET',
  +          url: '/address.json',
             data: {
               'utf8': '✓',
               'authenticity_token': $('#address_form input[name="authenticity_token"]').val(),
  -            'NE': NE,
  -            'SW': SW,
  -            'lat': lat,
  -            'lng': lng,
  -            'limit': $('#address_form input[name="limit"]').val()
  +            'city_state': $('#city_state').val(),
  +            'address': $('#address').val()
             },
             error: function(jqXHR) {
               $(submitButton).attr("disabled", false);
  +            $('#address').parent().addClass('error');
  +            $('#address').focus();
             },
             success: function(data) {
               $(submitButton).attr("disabled", false);
  
positive.code:                 errors.push($('#user_sms_number'));
                  $('#user_sms_number').parent().addClass('error');
                }
                if(data.errors.address_1) {
                  errors.push($('#user_address_1'));
                  $('#user_address_1').parent().addClass('error');
                }
                if(data.errors.address_2) {
                  errors.push($('#user_address_2'));
                  $('#user_address_2').parent().addClass('error');
                }
                if(data.errors.city) {
                  errors.push($('#user_city'));
                  $('#user_city').parent().addClass('error');
                }
                if(data.errors.state) {
                  errors.push($('#user_state'));
                  $('#user_state').parent().addClass('error');
                }
                if(data.errors.zip) {
                  errors.push($('#user_zip'));
                  $('#user_zip').parent().addClass('error');
                }
                if(data.errors.password) {
                  errors.push($('#user_password'));
                  $('#user_password').parent().addClass('error');
                }
                if(data.errors.current_password) {
                  errors.push($('#user_current_password'));
                  $('#user_current_password').parent().addClass('error');
                }
                errors[0].focus();
              },
              success: function(data) {
                $('#content').html(data);
              }
            });
          }
          return false;
        });
        $('#sign_out_link').live('click', function() {
          var link = $(this);
          $(link).addClass('disabled');
          $.ajax({
            type: 'DELETE',
            url: '/users/sign_out.json',
            error: function(jqXHR) {
              $(link).removeClass('disabled');
            },
            success: function(data) {
              $.ajax({
                type: 'GET',
                url: '/sidebar/combo_form',
                data: {
                  'flash': {
                    'warning': "<%= I18n.t("notices.signed_out") %>"
                  }
                },
                success: function(data) {
                  $('#content').html(data);
                }
              });
            }
          });
          return false;
        });
        $('#sign_in_form').live('submit', function() {
          var submitButton = $("#sign_in_form input[type='submit']");
          $(submitButton).attr("disabled", true);
          $.ajax({
            type: 'GET',
            url: '/users/sign_in',
            error: function(jqXHR) {
              $(submitButton).attr("disabled", false);
            },
            success: function(data) {
              activeInfoWindow.close();
              activeInfoWindow.setContent(data);
              activeInfoWindow.open(map, activeMarker);
            }
          });
          return false;
        });
        $('#back_link').live('click', function() {
          var link = $(this);
          $(link).addClass('disabled');
          $.ajax({
            type: 'GET',
            url: '/sidebar/search',
            error: function(jqXHR) {
              $(link).removeClass('disabled');
            },
            success: function(data) {
              $('#content').html(data);
            }
          });
          return false;
        });
        $('#reminder_form').live('submit', function() {
          var submitButton = $("#reminder_form input[type='submit']");
          $(submitButton).attr("disabled", true);
          $.ajax({
            type: 'POST',
            url: '/reminders.json',
            data: {
              'utf8': '✓',
              'authenticity_token': $('#reminder_form input[name="authenticity_token"]').val(),
              'reminder': {
                'from_user_id': $('#reminder_from_user_id').val(),
                'to_user_id': $('#reminder_to_user_id').val(),
                'thing_id': activeThingId
              }
            },
            error: function(jqXHR) {
              $(submitButton).attr("disabled", false);
            },
            success: function(data) {
              $.ajax({
                type: 'GET',
                url: '/info_window',
                data: {
                  'thing_id': activeThingId,
                  'flash': {
                    'notice': "<%= I18n.t("notices.reminder_sent") %>"
                  }
                },
                success: function(data) {
                  activeInfoWindow.close();
                  activeInfoWindow.setContent(data);
                  activeInfoWindow.open(map, activeMarker);
                }
              });
            }
          });
          return false;
        });
        // $('.alert-message').alert();
        // $('#tos').modal({
        //   backdrop: true,
        //   keyboard: true
        // });       
  
      },
      function( error ){
        console.log( "Something went wrong: ", error );
        $('#map').append('<h1 style="padding: 20px; margin: 0 auto">To proceed you must agree to share your location<br><img src="/assets/location-aware-agreement.png"></h1> ')
      },
      {
        timeout: (5 * 1000),
        maximumAge: (1000 * 60 * 15),
        enableHighAccuracy: true
      }
    );
  
  });
  
negative.code:             type: 'POST',
              url: '/users.json',
              data: {
                'utf8': '✓',
                'authenticity_token': $('#combo-form input[name="authenticity_token"]').val(),
                'user': {
                  'email': $('#user_email').val(),
                  'name': $('#user_name').val(),
                  'organization': $('#user_organization').val(),
                  'voice_number': $('#user_voice_number').val(),
                  'sms_number': $('#user_sms_number').val(),
                  'password': $('#user_password_confirmation').val(),
                  'password_confirmation': $('#user_password_confirmation').val()
                }
              },
              error: function(jqXHR) {
  