﻿
function GeoCodeAddress(addressElement, hiddenLatElement, hiddenLngElement) {
    var geocoder;
    var address = addressElement.value;
    
    geocoder = new window.google.maps.Geocoder();
    if (address) {
        geocoder.geocode({ 'address': address }, function (results, status) {
            if (status == window.google.maps.GeocoderStatus.OK) {
                //send to hidden fields
                if (hiddenLatElement) {
                    hiddenLatElement.value = results[0].geometry.location.lat();                    
                }
                if (hiddenLngElement) {
                    hiddenLngElement.value = results[0].geometry.location.lng();
                }
            }
        });
    }
}

function AddressQueryObject() {
    this.value = '';

    this.AppendToValue = function (stringValue) {
        this.value = this.value + stringValue + ' ';
    };
}
