try {

function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
	    ro = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
	    ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();

function getData(key) {
	http.open('POST', 'http://apartamento-nuevayork.com/mapas-nueva-york/getData.php');
	http.onreadystatechange = handleResponseGetData;
	http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	http.send('key=' + key);
}

function createMarker(point, icon, html, title) {
	var marker = new GMarker(point,  {icon: icon, clickable: true, title:title});
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html, {maxWidth:300});});
	return marker;
}

function handleResponseGetData() {

    if(http.readyState == 4){
        var response = http.responseText;
		//alert(response);


		var markerTitle;
		var markerHtml;

		

		var icon = new GIcon();
		icon.iconSize = new GSize(12, 20);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);		

        var update = new Array();
		var points = new Array();
		var pointInd = -1;

        if(response.indexOf('|' != -1)) {
            update = response.split('|');

			var map = new GMap(document.getElementById("map"));
			map.setMapType(G_NORMAL_MAP);
			map.addControl(new GSmallMapControl());
			map.centerAndZoom(
				new GPoint(parseFloat(update[0]), parseFloat(update[1])),
				parseInt(update[2]));	

			for (i=3; i<update.length-1; i+=6) { // update hat ein Element zu viel
				icon.image 		= update[i];
				icon.shadow 	= update[i+1];
				var point = new GPoint(fdc(update[i+2]), fdc(update[i+3]));	

				markerTitle		= update[i+4];
				
				//alert(markerTitle);

				markerTitle		= unescape(markerTitle);

				markerHtml		= update[i+5];

				map.addOverlay(createMarker(point, icon, markerHtml, markerTitle));

			}

        }

    }

}





} catch (e) {

	alert(e);

}