﻿var geocoder;
function gc_initialize() {
    geocoder = new GClientGeocoder();
}

function showLocation() {
    if (geocoder==null) gc_initialize();
    var address = this.document.forms[0].TextAddress.value + ', ' + this.document.getElementById(ddLandKeuze).value;
    geocoder.getLocations(address, addlocation);
}

function addlocation(response) {
    if (!response || response.Status.code != 200) {
        alert('Sorry, that address is not found.');
    }
    else {
        place = response.Placemark[0];
        SetCoord(place.Point.coordinates[1], place.Point.coordinates[0]);
    }
}

function SetCoord(lat, lng) {
    this.document.forms[0].Latitude.value = lat;
    this.document.forms[0].Longitude.value = lng;    
    this.document.forms[0].submit();
}

function Repost() {
    // this.document.forms[0].action = "GeoRepost.aspx";
    this.document.forms[0].submit();
}