function load(){
	if (GBrowserIsCompatible()) {
		var physWithLabels = [ G_PHYSICAL_MAP.getTileLayers()[0], G_HYBRID_MAP.getTileLayers()[1] ];
var physWithLabelsMap = new GMapType(physWithLabels, G_PHYSICAL_MAP.getProjection(), "Hybrid Terrain");
		map = new GMap2(document.getElementById("map"));
		map.addMapType(G_PHYSICAL_MAP);
		map.addMapType(physWithLabelsMap);
		map.setCenter(new GLatLng(51.504829231091406, -0.1137685775756836), 13, G_PHYSICAL_MAP);
		var mapControl = new GHierarchicalMapTypeControl();
		mapControl.clearRelationships();
		mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, "Labels", false);
		mapControl.addRelationship(G_PHYSICAL_MAP, physWithLabelsMap, "Labels", false);
		map.addControl(mapControl);
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
	}
}
var map;
var resultText = "";
var markers = new Array();
var htmls = new Array();
var points = new Array();
var zooms = new Array();
var end;
var i=1;

function createMarker(point, title, html){
	var myIcon;
	myIcon = new GIcon();
	myIcon.image = "http://www.travelplatz.com/js/iconr/iconr"+ i + ".png";
	myIcon.iconSize = new GSize(20, 34);
	myIcon.shadow = "http://www.travelplatz.com/js/shadow50.png";
	myIcon.shadowSize = new GSize(37, 34);
	myIcon.iconAnchor = new GLatLng(34, 10);
	myIcon.infoWindowAnchor = new GPoint(5, 5);
	var marker = new GMarker(point,{"icon":myIcon, "clickable":true, "title":title});
	GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
		map.removeOverlay(marker);
		markers[i] = marker;
		htmls[i] = html;
		resultText =  resultText + "<a href=javascript:changePlace("+ i +")>"+ i + " " + title +"</a><br />";
		i++;
		if(i >end){i=1}
		return marker;
}
function createMarker1(point, title, html){
	var myIcon;
	myIcon = new GIcon();
	myIcon.image = "http://www.travelplatz.com/js/iconb/iconb"+ i + ".png";
	myIcon.iconSize = new GSize(20, 34);
	myIcon.shadow = "http://www.travelplatz.com/js/shadow50.png";
	myIcon.shadowSize = new GSize(37, 34);
	myIcon.iconAnchor = new GLatLng(34, 10);
	myIcon.infoWindowAnchor = new GPoint(5, 5);
	var marker = new GMarker(point,{"icon":myIcon, "clickable":true, "title":title});
	GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
		map.removeOverlay(marker);
		markers[i] = marker;
		htmls[i] = html;
		resultText =  resultText + "<a href=javascript:changePlace("+ i +")>"+ i + " " + title +"</a><br />";
		i++;
		if(i >end){i=1}
		return marker;
}

function clearMarker(){
	map.clearOverlays();
}

function changePlace(i) {
	markers[i].openInfoWindowHtml(htmls[i]);
}
function changePlace1(i) {
   markers[i].openInfoWindowHtml(htmls[i]);
   map.setCenter(points[i],zooms[i]);
}

function loadMap(url){
	var request = GXmlHttp.create();
	request.open("GET", url, true);
	request.onreadystatechange = function(){
	if(request.readyState==4){
		var xml = request.responseXML;
		var place = xml.documentElement.getElementsByTagName("items");
		end = place.length;
		resultText="";
		for(var i=0; i<place.length; i++){
			var lat = parseFloat(place[i].getElementsByTagName("lat")[0].firstChild.nodeValue);
			var lng = parseFloat(place[i].getElementsByTagName("lon")[0].firstChild.nodeValue);
			var point = new GLatLng(lat, lng);
			var html = "<div style='width:200px'>";
			if(place[i].getElementsByTagName("name").length != 0){
				html += "<b style='color: red; font-size: small; font-weight: 400; font-style: normal;'>";
				var name = place[i].getElementsByTagName("name")[0].firstChild.nodeValue;
			}
			if(place[i].getElementsByTagName("url").length != 0){
				var link = place[i].getElementsByTagName("url")[0].firstChild.nodeValue;
				html += "<a href='" + link + "' target='_blank'>" + name + "</a></b><br />";
			}else{
				html += name;
				html += "</b><br />";
			}
			if(place[i].getElementsByTagName("info").length != 0){
				html += "<font size='-1'>";
				html += place[i].getElementsByTagName("info")[0].firstChild.nodeValue;
				html += "</font><br />";
			}else{
				html += "";
				html += "</div>";
			}
			var title = place[i].getElementsByTagName("name")[0].firstChild.nodeValue;
			var marker = createMarker(point, title, html);
			map.addOverlay(marker);
			}
			document.getElementById("map_right").innerHTML = resultText;
		}
	}
	request.send('');
}
function loadMap1(url){
	var request = GXmlHttp.create();
	request.open("GET", url, true);
	request.onreadystatechange = function(){
	if(request.readyState==4){
		var xml = request.responseXML;
		var place = xml.documentElement.getElementsByTagName("items");
		end = place.length;
		resultText="";
		for(var i=0; i<place.length; i++){
			var lat = parseFloat(place[i].getElementsByTagName("lat")[0].firstChild.nodeValue);
			var lng = parseFloat(place[i].getElementsByTagName("lon")[0].firstChild.nodeValue);
			var point = new GLatLng(lat, lng);
			var html = "<div style='width:200px'>";
			if(place[i].getElementsByTagName("name").length != 0){
				html += "<b style='color: red; font-size: small; font-weight: 400; font-style: normal;'>";
				var name = place[i].getElementsByTagName("name")[0].firstChild.nodeValue;
			}
			if(place[i].getElementsByTagName("url").length != 0){
				var link = place[i].getElementsByTagName("url")[0].firstChild.nodeValue;
				html += "<a href='" + link + "' target='_blank'>" + name + "</a></b><br />";
			}else{
				html += name;
				html += "</b><br />";
			}
			if(place[i].getElementsByTagName("info").length != 0){
					html += "<font size='-1'>";
					html += place[i].getElementsByTagName("info")[0].firstChild.nodeValue;
					html += "<br/><a href=javascript:map.zoomIn()>zoomIn</a> | <a href=javascript:map.zoomOut()>zoomOut</a></font></div>";
			}else{
					html += "";
					html += "</div>";
			}
			var title = place[i].getElementsByTagName("name")[0].firstChild.nodeValue;
			var marker = createMarker1(point, title, html);
			map.addOverlay(marker);
			}
			document.getElementById("map_right").innerHTML = resultText;
		}
	}
	request.send('');
}
onload = load;
onunload = GUnload;
