var map;
var gdir;
	function PlaneIcon() {
	}
	PlaneIcon.prototype = new GControl();
	PlaneIcon.prototype.initialize = function(map) {
	var container = document.createElement("div");
	this.setButtonStyle_(container);
	var img=document.createElement("IMG");
	img.src="../images/icon.png";
	if(window.ActiveXObject){
		img.attachEvent('onclick',function(){setDirections("380 Nathan Road, Kowloon", "Hong Kong International Airport", "en")});
	}else{
		img.addEventListener('click',function(){setDirections("380 Nathan Road, Kowloon", "Hong Kong International Airport", "en")}, false);
	 }
	container.appendChild(img);
	 map.getContainer().appendChild(container);
	 return container;
	 }
	 PlaneIcon.prototype.getDefaultPosition = function() {
		 return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(225, 0));
	 }
	 PlaneIcon.prototype.setButtonStyle_ = function(button) {  
	 button.style.backgroundColor = "transparent"; 
	 button.style.textAlign = "center";
	 button.style.cursor = "pointer";
	 button.style.border = "0";
	 }
	  function load() {
	 if (GBrowserIsCompatible()) {
	 map = new GMap2(document.getElementById("content"));
	 gdir = new GDirections(map, document.getElementById("directions"));
	 GEvent.addListener(gdir, "load", onGDirectionsLoad);
	 GEvent.addListener(gdir, "error", handleErrors);
	 map.addControl(new GSmallMapControl());
	 map.addControl(new GMapTypeControl());
	 map.setCenter(new GLatLng(22.308120598513873,114.17185038328171),14);
	 var hotelicon = new GIcon(G_DEFAULT_ICON);
	 hotelicon.image = "../images/langham_logo.png";
	 iOptions = { icon:hotelicon};
	 var aIcon = new GIcon(G_DEFAULT_ICON);
	 aIcon.image = "../images/a_icon.png";
	 aOptions = { icon:aIcon};
	 var bIcon = new GIcon(G_DEFAULT_ICON);
	 bIcon.image = "../images/b_icon.png";
	 bOptions = { icon:bIcon};
	 var cIcon = new GIcon(G_DEFAULT_ICON);
	 cIcon.image = "../images/c_icon.png";
	 cOptions = { icon:cIcon};
	 var dIcon = new GIcon(G_DEFAULT_ICON);
	 dIcon.image = "../images/d_icon.png";
	 dOptions = { icon:dIcon};
	 var eIcon = new GIcon(G_DEFAULT_ICON);
	 eIcon.image = "../images/e_icon.png";
	 eOptions = { icon:eIcon};
	 var fIcon = new GIcon(G_DEFAULT_ICON);
	 fIcon.image = "../images/f_icon.png";
	 fOptions = { icon:fIcon};
	 var gIcon = new GIcon(G_DEFAULT_ICON);
	 gIcon.image = "../images/g_icon.png";
	 gOptions = { icon:gIcon};
	 var hIcon = new GIcon(G_DEFAULT_ICON);
	 hIcon.image = "../images/h_icon.png";
	 hOptions = { icon:hIcon};
	 var transportationIcon = new GIcon(G_DEFAULT_ICON);
	 transportationIcon.image = "../images/transportation_icon.png";
	 markerOptionsTransportation = { icon:transportationIcon };
	 var point = new GLatLng(22.308120598513873,114.17185038328171);
	 map.addOverlay(createMarker(point, iOptions,0));
	 var point1 = new GLatLng(22.321100520606634, 114.17019009590149);
map.addOverlay(createMarker(point1, aOptions,1));

	 var point2 = new GLatLng(22.312273999999999,114.168555);
map.addOverlay(createMarker(point2, cOptions,2));

	 var point3 = new GLatLng(22.307957,114.170372);
map.addOverlay(createMarker(point3, aOptions,3));

	 var point4 = new GLatLng(22.310687999999999,114.168971);
map.addOverlay(createMarker(point4, bOptions,4));

	 var point5 = new GLatLng(22.310217000000002,114.170434);
map.addOverlay(createMarker(point5, bOptions,5));

	 var point6 = new GLatLng(22.309934999999999,114.170675);
map.addOverlay(createMarker(point6, cOptions,6));

	 var point7 = new GLatLng(22.30917521569922, 114.16944175958633);
map.addOverlay(createMarker(point7, aOptions,7));

	 var point8 = new GLatLng(22.308180153578874, 114.17163580656051);
map.addOverlay(createMarker(point8, bOptions,8));

	 var point9 = new GLatLng(22.307996525380193,114.1715258359909);
map.addOverlay(createMarker(point9, bOptions,9));

	 var point10 = new GLatLng(22.307989080988676,114.17212128639221);
map.addOverlay(createMarker(point10, bOptions,10));

	 var point11 = new GLatLng(22.307044,114.170952);
map.addOverlay(createMarker(point11, bOptions,11));

	 var point12 = new GLatLng(22.305049,114.170501);
map.addOverlay(createMarker(point12, bOptions,12));

	 var point13 = new GLatLng(22.307798,114.172078);
map.addOverlay(createMarker(point13, bOptions,13));

	 var pointDefault = new GLatLng(22.308120598513873,114.17185038328171);

	 var mark = new GMarker(pointDefault,iOptions);
	 map.addOverlay(mark);
	 mark.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:300px\"><table border=\"0\"><tr><td><b>Eaton Hotel Hong Kong<br>Address: 380 Nathan Road, Kowloon<br>Tel: (852)2782 1818</b></td><td><img src=\"../images/eaton_location_map_ethkg_en.jpg\"></td></tr></table></div>");
	 map.addOverlay(createMarker(pointDefault, iOptions,0));
	 map.addControl(new PlaneIcon());

	 }
	 }
 function createMarker(point, number,index) {
	 var marker = new GMarker(point,number);

	 switch (index)
	 {

case 0:	 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Eaton Hotel Hong Kong<br>Address: 380 Nathan Road, Kowloon<br>Tel: ((852)2782 1818</b></td><td><img src=\"../images/eaton_location_map_ethkg_en.jpg\"></td></tr></table></div>");		 });
		 break; 

		 case 1:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Ladies' Market</b><br> One of the most popular street markets in Hong Kong, Ladies' Market is a must-visit destination for fashion lovers with an eye for bargain-priced clothing, bags, accessories, toys, cosmetics and household knick-knacks. The stalls making up this enjoyable market can be found on Tung Choi Street, Mong Kok. It is open from noon until 11:30pm.</td></tr></table></div>");
	 });
	 break;

		 case 2:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Yau Ma Tei Fruit Market</b><br> Yau Ma Tei Fruit Market is a wholesale fruit market and is a historically valuable site. It consists of several blocks of one or two storey stone buildings. Pre-World War II signboards are on the outer walls of the buildings. The busiest hours are 4 to 6 o'clock in the morning. Lorries and carts deliver boxes of fruit in and out of the market.</td></tr></table></div>");
	 });
	 break;

		 case 3:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Temple Street</b><br> Knock yourself out for some great bargains, fortune telling and local eateries at Temple Street! </td></tr></table></div>");
	 });
	 break;

		 case 4:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Broadway Cinematheque</b><br> Broadway Cinematheque is a cinema run by Broadway Circuit, provides wider spectrum of films than other cinemas in Hong Kong. The cinema hosts four houses with 640 seats. It also has a book store, Kubrick, about films and a cafe in adjacent.</td></tr></table></div>");
	 });
	 break;

		 case 5:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Mido Cafe</b><br> One of the last old style Hong Kong cafes in the area. A 1960's time bubble, it is one of the oldest, best preserved \</td></tr></table></div>");
	 });
	 break;

		 case 6:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Tin Hau Temple</b><br> A stop at the Tin Hau Temple provides a touch of Chinese culture. Locals believe that Tin Hau protects fisher folks from bad storms and they worship her at the temple. In front of the main temple, there is a row of fortune-tellers, who are only too keen to help temple visitors see into the future.</td></tr></table></div>");
	 });
	 break;

		 case 7:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Jade Market</b><br> A great place to find cheap jade stones for souvenirs.  Collectors and jade lovers gather at this unique market, where small stalls display everything from rare and valuable jade carvings to small and inexpensive trinkets.</td></tr></table></div>");
	 });
	 break;

		 case 8:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Yat Tung Heen, Eaton Hotel</b><br> An award winning Cantonese restaurant and is renowned for its healthy Chinese dining - all dishes without using MSG.  Featuring an extensive menu of Cantonese cuisine, it offers a wide array of delicacies including dim sum, double boiled soup, fresh seafood and seasonal specialties.</td></tr></table></div>");
	 });
	 break;

		 case 9:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Yagura, Eaton Hotel</b><br> Yagura is the new hotspot in Jordan for its stylish izakaya-style Japanese dining. Enjoy good sashimi, creative sushi roll, tempura, and robatayaki style dishes. \</td></tr></table></div>");
	 });
	 break;

		 case 10:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>T Bar, Eaton Hotel</b><br> T Bar featuring a wide selection of international beers, wines, spirits and cocktails. Daily live bands and sports shown.</td></tr></table></div>");
	 });
	 break;

		 case 11:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Sino Vegetarian Restaurant</b><br> A famous Chinese Vegetarian Restaurant in Jordan which is just a street away from our hotel. You can visit Temple Street after a perfect meal!</td></tr></table></div>");
	 });
	 break;

		 case 12:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Australia Dairy Company</b><br> A well known Hong Kong style Restaurant located next to Temple Street! Don't miss out if you coming to Hong Kong.</td></tr></table></div>");
	 });
	 break;

		 case 13:
		 GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("<div style=\"font:Arial, Helvetica, sans-serif;font-size:10px;color:#3F454F;text-autospace : ideograph-alpha;width:350px\"><table border=\"0\"><tr><td><b>Tsui Wah Restaurant</b><br> A popular Hong Kong local tea restaurant located opposite to Eaton Hotel, serving many different styles of meals from Western to Cantonese. </td></tr></table></div>");
	 });
	 break;

	 default : 
	 break;
 }
	 return marker;
}
	 function setDirections(fromAddress, toAddress, locale) {
	 if(fromAddress=="Eaton Hotel Hong Kong")
	 fromAddress = "380 Nathan Road, Kowloon";
	 if(toAddress=="")return;	 gdir.load("from: " + fromAddress + " HongKong to: " + toAddress + " HongKong",{locale:"en"});
	 }

	 function handleErrors(){
	 if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	 else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	 alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	 else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	 alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);
	 else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	 alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
	 else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	 alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	 else alert("An unknown error occurred.");
}
function onGDirectionsLoad(){
 }