﻿var lijst;
var htb;

function searchObjects(address, country, hiddenTextBox, verzamingGuid, count, errorMsg) {
    geocoder = new GClientGeocoder();
    address = address + " " + country;
    htb = hiddenTextBox;

    geocoder.getLatLng(address, function(r) {
        if (r) {
            script = document.createElement('script'); 
            script.type = 'text/javascript'; 
            script.src = 'http://www.objectmap.nl/WebService/Locator.ashx?guid=' + verzamingGuid + '&count=' + count + '&lat=' + r.lat() + '&lng=' + r.lng(); 
            document.getElementsByTagName('head')[0].appendChild(script);  
        } else {
            alert(errorMsg);
        }
    });
}

function completeResult(result) {
    htb.value = result;
    document.forms[0].submit();
}