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("555 Shanghai Street, Mongkok, Kowloon, Hong Kong", "hong kong airport", "en")});
	}else{
		img.addEventListener('click',function(){setDirections("555 Shanghai Street, Mongkok, Kowloon, Hong Kong", "hong kong 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.318150305935045, 114.1681382060051),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.318150305935045, 114.1681382060051);
	 map.addOverlay(createMarker(point, iOptions,0));
	 var point1 = new GLatLng(22.317845107754546,114.16871219873428);
map.addOverlay(createMarker(point1, aOptions,1));

	 var point2 = new GLatLng(22.31822226313243,114.16818380355835);
map.addOverlay(createMarker(point2, bOptions,2));

	 var point3 = new GLatLng(22.307336454455846,114.1702088713646);
map.addOverlay(createMarker(point3, bOptions,3));

	 var point4 = new GLatLng(22.319078302807053,114.17273819446564);
map.addOverlay(createMarker(point4, bOptions,4));

	 var point5 = new GLatLng(22.319120484336437,114.16894555091858);
map.addOverlay(createMarker(point5, bOptions,5));

	 var point6 = new GLatLng(22.32523418998978,114.17210251092911);
map.addOverlay(createMarker(point6, aOptions,6));

	 var point7 = new GLatLng(22.321100520606634,114.17019009590149);
map.addOverlay(createMarker(point7, cOptions,7));

	 var point8 = new GLatLng(22.325556740073224,114.17389154434204);
map.addOverlay(createMarker(point8, cOptions,8));

	 var point9 = new GLatLng(22.317840145176998,114.16871219873428);
map.addOverlay(createMarker(point9, aOptions,9));

	 var point10 = new GLatLng(22.307338935931323,114.17021155357361);
map.addOverlay(createMarker(point10, aOptions,10));

	 var point11 = new GLatLng(22.329154363537004,114.16336923837662);
map.addOverlay(createMarker(point11, aOptions,11));

	 var point12 = new GLatLng(22.309130549721125,114.16951954364776);
map.addOverlay(createMarker(point12, aOptions,12));

	 var point13 = new GLatLng(22.31844309705825,114.16811943054199);
map.addOverlay(createMarker(point13, bOptions,13));

	 var point14 = new GLatLng(22.317981578568155,114.16825354099273);
map.addOverlay(createMarker(point14, bOptions,14));

	 var point15 = new GLatLng(22.318150305935045, 114.1681382060051);
map.addOverlay(createMarker(point15, aOptions,15));

	 var point16 = new GLatLng(22.31818008133157,114.16811406612396);
map.addOverlay(createMarker(point16, bOptions,16));

	 var pointDefault = new GLatLng(22.318150305935045, 114.1681382060051);

	 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>Langham Place, Mongkok, Hong Kong<br>Address: 555 Shanghai Street, Mongkok, Kowloon, Hong Kong<br>Tel: (852) 3552 3388</b></td><td><img src=\"../images/hotel.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>Langham Place, Mongkok, Hong Kong<br>Address: 555 Shanghai Street, Mongkok, Kowloon, Hong Kong<br>Tel: ((852) 3552 3388</b></td><td><img src=\"../images/hotel.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>Langham Place Shopping Mall - Ozone</b><br> Ozone, on Levels 12 and 13 at the very top of the Langham Place Shopping Mall, is one of the few upscale hangouts in Mongkok.  Here you will find live entertainment, the coolest bars and the best cafes.</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>Ming Court - Langham Place, Mongkok, Hong Kong</b><br> Visit Ming Court on the 6th floor of Langham Place Hotel to tray traditional Chinese dim sum for lunch or afternoon tea.  All the dim sum dishes are streamed in authentic bamboo streamers.</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>Dai Pai Dong</b><br> Probably the most basic - yet delicious - is the Dai Pai Dong.  Dai Pai Dongs originated in the 1850s as low cost payment food stalls where ordinary people could stop for a quick bite to eat.  If you have never eaten at a Dai Pai Dong, you have never had real Hong Kong food.</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>Chuen Cheung Kui</b><br> Waiting for a table for an hour is no news to Chuen Cheung Kui. Every night there are always people lining up outside. But don't give up on dining in this restaurant just because of this - the best Hakka cuisine is worth waiting for.</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>Little Sheep</b><br> Hong Kong people are especially keen on hotpot. No matter whether it's Summer or Winter, Hong Kong people always like to have hotpot. Ever since Little Sheep arrived in Hong Kong a few years ago, it has been one of the \"hot\" hotpot places.</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>Flower Market</b><br> Dozens of flower sellers trade cheek by jowl around this fragrant, colourful block sandwiched between Flower Market Road nad Prince Edward Road West.</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>Goldfish Street</b><br> All kinds of aquatic life forms, freshwater and tropical, can be found here, from lowly minnows to monstrously bulbous Japanese goldfish to terrapins and turtles.  The huge range of accessories on sale makes this area a shopping paradise for the fish fancier.</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>Yuen Po Street Bird Garden</b><br> Yuen Po Street Bird Garden is filled with the calls of all manner of feathered creatures and is a favourite gathering spot for elderly gents giving their songbirds their daily airing - in Hong Kong people literally walk their birds.  Be sure to browse the market thoroughly before deciding on any cage purchases.</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>Langham Place Shopping Mall</b><br> Langham Place Mall, the latest landmark of Mongkok, has become one of the hottest hangouts in town. The 15-storey complex also contains a cinema of six houses, providing ultimate entertainment in one single place. It features over 300 shops and restaurants, including the luxury department store Seibu. From fashion labels to casual wear, to accessories and electronics, it can satisfy every shopper's needs. </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>Night Bazaars and Ladies Market</b><br> If modern-style malls don't satisfy your shopping desire, the Retail Market in Mongkok will complete your shopping adventure in Hong Kong.  The bargain basements prices are usually flexible if you're in the mood for some haggling, but don't expect much more than a 20 per cent reduction.</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>Sham Shui Po Electrical Goods</b><br> All around Kowloon you will find these computer hubs, whole buildings taken over by people selling high-tech gear both real and pirated.  Some of them have shops while other work from stalls or tiny cupboard-like outlets within these malls.</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>Jade Market</b><br> Top quality jade is highly prized in Chinese culture, not only for its beauty but also because it is believed to ward off evil spirits and to be good for your health.  Parents often give their son or daughter a jade bracelet or pendant as a symbol of their love and protection.</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>Tokoro - Langham Place, Mongkok, Hong Kong</b><br> The charismatic Chef Hirayama and his team star in this robatayaki-style theatre restaurant, creating Japanese food with flair in an energetic atmosphere.</td></tr></table></div>");
	 });
	 break;

		 case 14:
		 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>The Place - Langham Place, Mongkok, Hong Kong</b><br> Step into the sparkling dining room with lofty ceilings and light streaming in through windows on three sides.  Choose a sumptuous buffet or enjoy a la carte of eastern and western delicacies.</td></tr></table></div>");
	 });
	 break;

		 case 15:
		 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>Langham Place, Mongkok, Hong Kong </b><br> Address: 555 Shanghai Street, Mongkok, Kowloon, Hong Kong<br>Tel: (852) 3552 3388</td></tr></table></div>");
	 });
	 break;

		 case 16:
		 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>Portal - Work & Play - Langham Place, Mongkok, Hong Kong</b><br> Spend the afternoon here and see just how effortlessly, a productive working day can segue into a lively and relaxing evening.</td></tr></table></div>");
	 });
	 break;

	 default : 
	 break;
 }
	 return marker;
}
	 function setDirections(fromAddress, toAddress, locale) {
	 if(fromAddress=="Langham Place, Mongkok, Hong Kong")
	 fromAddress = "555 Shanghai Street, Mongkok, Kowloon, Hong Kong";
	 if(toAddress=="")return;	 gdir.load("from: " + fromAddress + " Hong Kong to: " + toAddress + " Hong Kong",{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(){
 }
