function getAddress(map, infoHtml, markerOptions, address, id) 
{
	//alert(address);
	 geocoder.getLatLng(address, 
	 
	 	function(point) 
	 	{
			if (!point) 
			{
			
			}
			else
			{
				var marker = new GMarker(point, markerOptions);
				map.addOverlay(marker);
				marker.bindInfoWindowHtml('<span style="font-size: 9pt;"><strong>{$location.name|escape}</strong><br>{$location.city|escape}<br><a href="{$location.url}">Lees meer</a></span>');
				saveMarker(point, id);
			}
		}
	);
}

function addLocation(map, infoHtml, markerOptions, latLong)
{
	coords = latLong.split(",");
	
	var marker = new GMarker(new GLatLng(coords[0], coords[1]), markerOptions);
	map.addOverlay(marker);
	marker.bindInfoWindowHtml(infoHtml);
}

function saveMarker(point, id)
{
	ajaxCall("postmarker.php", "lat=" + point.lat() + "&lng=" + point.lng() + "&i=" + id);
}

function ajaxCall(url, post) 
{
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            
        }
    }
    self.xmlHttpReq.send(post);
}

