function load() {
	      		if (GBrowserIsCompatible()) {
				map = new GMap2(document.getElementById("map"));
				///////////////map.setCenter(new GLatLng(-33.91241224672639,18.41878685233625), 13,G_HYBRID_MAP); 
                                map.setCenter(new GLatLng(10.0,9.0), 2,G_HYBRID_MAP); 
				map.addControl(new GLargeMapControl());
				//map.addControl(new GMapTypeControl());
				map.enableContinuousZoom();
                
				hpmain = createMarker (new GLatLng (-33.91241224672639,18.41878685233625), "http://maps.google.com/mapfiles/kml/pal4/icon28.png", hptext, 15);
				/////////hpct = createMarker (new GLatLng (-33.9687371826071,18.59907914155747), "http://maps.google.com/mapfiles/kml/pal2/icon56.png",aptext, 11);
                                hpct = createMarker (new GLatLng (51.531237,-0.095680), "http://maps.google.com/mapfiles/kml/pal4/icon28.png",aptext, 11);
                                hp3 = createMarker (new GLatLng (-26.190605,28.089294), "http://maps.google.com/mapfiles/kml/pal4/icon28.png",text3, 11);
                                
                                map.addOverlay (hpmain);
                                map.addOverlay (hpct);
                                map.addOverlay (hp3);
              
				//hpct = loadKML("cape_town_international_location");
				/*hpare = loadKML("airpor_route_poly-line",function (){
					hpare.gotoDefaultViewport(map);
					map.setZoom (map.getZoom() - 1 );
				});*/
				
				var div = document.createElement ("div");
				div.className = "map_button_set";
				var pos = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(5,5));
				pos.apply(div);
				map.getContainer().appendChild(div); 
				
				var hybrid = makeMapButton ("Hybrid", function () {
					map.setMapType (G_HYBRID_MAP);	
					this.style.background = "#99CC00";
					mapview.style.background = "";
					this.onmouseout = function () {return;};
					mapview.onmouseout = function () { 
						this.style.background = "";
					}			
				});
				var mapview = makeMapButton ("Map", function () {
					map.setMapType (G_NORMAL_MAP);
					this.style.background = "#99CC00";
					hybrid.style.background = "";
					this.onmouseout = function () {return;};	
					hybrid.onmouseout = function () { 
						this.style.background = "";
					}			
				});
				hybrid.onclick ()
				div.appendChild (mapview);
				div.appendChild (hybrid);
				var br = document.createElement ("br");
				br.style.clear = "both";
				div.appendChild (br);
				hybrid.style.border = "0";
				hybrid.style.width = (hybrid.offsetWidth -1 ) + "px";
			}
    		}
		function makeMapButton (text, onclck) {
			
			var div = document.createElement ("div");
			div.innerHTML =text;
			div.className = "map_buttom";
			div.onclick = onclck;
			//div
			
			div.onmouseover = function () {
				this.style.background = "#99CC00";
			}

			div.onmouseout = function () { 
				this.style.background = "";
			}
			return div;
		}
		function loadKML (file, loaded) {
			kml = new GGeoXml("http://hp.graydotdev1.com/staging/" +file + ".kml?kml=6");
			map.addOverlay(kml);
			if (loaded) GEvent.addListener(kml, "load", loaded);
			return kml;
		}
		function toggleKML (ob,zoom) { 
			if(ob.isHidden() || 1) {
				ob.show();
				GEvent.trigger(hpct,"click")
                ob.gotoDefaultViewport(map);
				if (zoom) map.setZoom (zoom)
				else map.setZoom (map.getZoom() - 1 );			
			} else {
				ob.hide();
			}
		}
		function toggleDirectionDive (arow, div) {
			$(div).style.display = ($(div).style.display == "block") ? "none" : "block";
		} 
        
        function createMarker (point, icon, html, zoom) {
            var gicon = new GIcon(); 
            gicon.image = icon;
            gicon.iconAnchor = new GPoint(9, 34);
            gicon.infoWindowAnchor = new GPoint(9, 2);
            gicon.infoShadowAnchor = new GPoint(18, 25);
            var marker = new GMarker (point, gicon);  
            //marker.getGInfoWindow().enableMaximize();
            GEvent.addListener (marker,"click", function (point) {
                map.setCenter(point,zoom);
                /* Below the openInfoWindow function is used to popup the info box */
                //marker.openInfoWindowHtml (html); 
            });
            return marker;            
        }
