<!--


//****************************************IMPORTANT**********************************************//
//                                                                                               //
//          This code has been generated by Damien Thiery from ROMANIAN PROPERTIES LTD           //
//    Please ask the permission to use the code by email at dthiery@RomanianPropertiesLtd.co.uk  //   
//                          before using any part of the code                                    //                                      
//                               © 2005-2008 Copyright                                           //
//                                                                                               //
//***********************************************************************************************//
 
var map;
var geoXml = new GGeoXml("http://www.romanianpropertiesltd.co.uk/airports2.kml");
//var cityXml = new GGeoXml("http://www.romanianpropertiesltd.co.uk/city6.kml");
var toggleState = 1;
				var icon_contact = new GIcon();
		    icon_contact.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
		    icon_contact.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
		    icon_contact.iconSize = new GSize(12, 20);
		    icon_contact.shadowSize = new GSize(22, 20);
		    icon_contact.iconAnchor = new GPoint(6, 20);
		    icon_contact.infoWindowAnchor = new GPoint(5, 1);
var numberoftowns = 1;
var Bucharest = new GMarker(new GLatLng(44.485465, 26.021419),{title:"Bucharest",icon :icon_contact}); 

var BUCHAREST_HTML = '<div style="width: 210px; 	padding-right: 10px"><a href="http://www.romananianpropertiesltd.co.uk/chitilaresidence.htm">Chitila Residence, Bucharest</a>	</div>';



function Load() {
    if (GBrowserIsCompatible()) {
				//RECTANGLE
				//function Rectangle(bounds, opt_weight, opt_color) {  this.bounds_ = bounds;  this.weight_ = opt_weight || 2;  
				//this.color_ = opt_color || "#888888";}Rectangle.prototype = new GOverlay();
				//Rectangle.prototype.initialize = function(map) {  
				// Create the DIV representing our rectangle  
				//var div = document.createElement("div");  
				//div.style.border = this.weight_ + "px solid " + this.color_;  
				//div.style.position = "absolute";  
				//map.getPane(G_MAP_MAP_PANE).appendChild(div);  
				//this.map_ = map;  this.div_ = div;}
				//Rectangle.prototype.remove = function() {  
				//this.div_.parentNode.removeChild(this.div_);}
				//Rectangle.prototype.copy = function() {  
				//return new Rectangle(
				//this.bounds_, this.weight_, this.color_,this.backgroundColor_, this.opacity_);}
				//Rectangle.prototype.redraw = function(force) {  
				//if (!force) return;  
				//var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest());  
				//var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast());  
				//this.div_.style.width = Math.abs(c2.x - c1.x) + "px";  
				//this.div_.style.height = Math.abs(c2.y - c1.y) + "px";  
				//this.div_.style.left = (Math.min(c2.x, c1.x) - this.weight_) + "px";  
				//this.div_.style.top = (Math.min(c2.y, c1.y) - this.weight_) + "px";}

				map = new GMap2(document.getElementById("map"),{mapTypes:[G_HYBRID_MAP,G_NORMAL_MAP]});
				map.addControl(new GSmallMapControl());
				map.addControl(new GMapTypeControl(),new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(10, 10)));
        map.addControl(new GOverviewMapControl(new GSize(60,60)));
				map.setCenter(new GLatLng(44.485465, 26.021419),11);
				map.enableDoubleClickZoom();
        map.addOverlay(geoXml);

				GEvent.addListener(Bucharest, "click", function() {
				Bucharest.openInfoWindowHtml(BUCHAREST_HTML);
	  		});

				
				function createMarker(point, town,index) {  
				var marker = new GMarker(point, icon);  
				GEvent.addListener(marker, "click", function() {    
				marker.openInfoWindowHtml(town);  });  
				return marker;
				}
	  
		map.addOverlay(Bucharest);

		bounds = map.getBounds();
				var southWest = bounds.getSouthWest();
				var northEast = bounds.getNorthEast();
				var lngDelta = (northEast.lng() - southWest.lng()) / 7-0.8;
				var latDelta = (northEast.lat() - southWest.lat()) / 9;
				var rectBounds = new GLatLngBounds(    new GLatLng(southWest.lat() + latDelta, southWest.lng() + lngDelta),    new GLatLng(northEast.lat() - latDelta, northEast.lng() - lngDelta));
				//map.addOverlay(new Rectangle(rectBounds));
 
        function positionOverview(x,y) {
           var omap=document.getElementById("map_overview");
           omap.style.left = x+"px";
           omap.style.top = y+"px";
           // == restyling ==
           omap.firstChild.style.border = "1px solid gray";
           omap.firstChild.firstChild.style.left="4px";
           omap.firstChild.firstChild.style.top="4px";
           omap.firstChild.firstChild.style.width="90px";
           omap.firstChild.firstChild.style.height="90px";
        }
      
			  GEvent.addListener(map, "moveend", function() {  
			  var center = map.getCenter();  
//			  document.getElementById("message").innerHTML = center.toString();
});

  			var ovcontrol = new GOverviewMapControl(new GSize(120,120)); 
        map.addControl(ovcontrol);
			  var ovmap = ovcontrol.getOverviewMap();      
    	}
			
function TextualZoomControl() {}
TextualZoomControl.prototype = new GControl();
				
TextualZoomControl.prototype.initialize = function(map) {  
      	var container = document.createElement("div");  
				var zoomInDiv = document.createElement("div");  
				this.setButtonStyle_(zoomInDiv);  
				container.appendChild(zoomInDiv);  
				zoomInDiv.appendChild(document.createTextNode("Zoom In"));  
				GEvent.addDomListener(zoomInDiv, "click", function() {    
				map.zoomIn();  });  
				var zoomOutDiv = document.createElement("div");  
				this.setButtonStyle_(zoomOutDiv);  
				container.appendChild(zoomOutDiv);  
				zoomOutDiv.appendChild(document.createTextNode("Zoom Out"));  
				GEvent.addDomListener(zoomOutDiv, "click", function() {    
				map.zoomOut();  });  
				map.getContainer().appendChild(container);  
				return container;
        }
TextualZoomControl.prototype.getDefaultPosition = function() 
				{  
				return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7,63));
				}

        //Sets the proper CSS for the given button element.
        TextualZoomControl.prototype.setButtonStyle_ = function(button) 
				{  
                              button.style.textDecoration = "none";
                              button.style.color = "#000";
                              button.style.backgroundColor = "#fff";
                              button.style.font = "7pt arial";
                              button.style.border = "1px solid #000";
                              button.style.padding = "2px";
                              button.style.marginBottom = "3px";
                              button.style.textAlign = "center";
                              button.style.width = "45px";
                              button.style.cursor = "pointer";
				}
				map.addControl(new TextualZoomControl());
				map.setCenter(new GLatLng(44.485465, 26.021419), 11);
    map.addOverlay(geoXml);
//    map.addOverlay(cityXml);
		}

		
		
function toggleMyKml() {
  if (toggleState == 1) {
    map.removeOverlay(geoXml);
    toggleState = 0;
  } else {
    map.addOverlay(geoXml);
    toggleState = 1;
  }
}
function toggleMyCity() {
  if (toggleState == 1) {
		map.removeOverlay(Bucharest);
    toggleState = 0;
  } else {
		map.addOverlay(Bucharest);
		//map.addOverlay(createMarker(new GLatLng(46.19,23.05), "Abrud",1));
		//map.addOverlay(createMarker(new GLatLng(46.19,23.44), "Bucharest",1));
    toggleState = 1;
  }
}

    function getIcon(images) {
      var icon = null;
      if (images) {
        if (icons[images[0]]) {
          icon = icons[images[0]];
        } else {
          icon = new GIcon();
          icon.image = "markermanager/" + images[0] + ".png";
          var size = iconData[images[0]];
          icon.iconSize = new GSize(size.width, size.height);
          icon.iconAnchor = new GPoint(size.width >> 1, size.height >> 1);
          icon.shadow = "markermanager/" + images[1] + ".png";
          size = iconData[images[1]];
          icon.shadowSize = new GSize(size.width, size.height);
          icons[images[0]] = icon;
        }
      }
      return icon;
    }
    function setupOfficeMarkers() {
      mgr = new GMarkerManager(map);
      for (var i in officeLayer) {
        var layer = officeLayer[i];
        var markers = [];
        for (var j in layer["places"]) {
          var place = layer["places"][j];
          var icon = getIcon(place["icon"]);
          var posn = new GLatLng(place["posn"][0], place["posn"][1]);
          markers.push(new GMarker(posn, { title: place["name"], icon: icon }));
        }
        mgr.addMarkers(markers, layer["zoom"][0], layer["zoom"][1]);
      }
      mgr.refresh();
    }//-->

