﻿var x;
var y;
var z;
var img_link;
var vpix;
var shopname;
var shopaddress;
var shopid;
var message;
var marker;
//img_link = "/googlemap/iconadmpointer.png";
img_link = "/googlemap/iconuserpointer.png";
function onload_gmap() {
	if (GBrowserIsCompatible()) {
	
		var map = new GMap2(document.getElementById("map"));
		
		gx = document.getElementById("googlemapX").value;
		gy = document.getElementById("googlemapY").value;
		z = 16;
		if (x == "")
		{
			x = 22.364046;
			y = 114.136962;
			z = 10;
		}
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(gx, gy), z);

		function createMarker(point, img_link) 
		{	
			var iconP = new GIcon();
			iconP.shadow = "";
			iconP.image = img_link;
				
//			iconP.iconSize = new GSize(50, 50);
//			iconP.iconAnchor = new GPoint(25, 25);
			iconP.iconSize = new GSize(41, 63);
			iconP.iconAnchor = new GPoint(11, 58);
			markerOptions = { icon:iconP };
				
			var marker = new GMarker(point, markerOptions);
			return marker;
		}
		
		
		var point = new GLatLng(gx,gy);
		map.addOverlay(createMarker(point,img_link));
		
		// for the tip window of current shop for big map
		var message = "<table border='0' cellspacing='5'><tr><td align='left' width='210'>";
		if (vpix != "")
			message += "<img src='" + vpix + "' width='197' height='146'><br>";
		message += "<b>\U : </b><a href='/shop/default.asp?type=view&shopid=" + shopid + "'>"+ shopname +"</a><br>"
				 + "<b>a} : </b>" + shopaddress + "<br></td></tr>"
				 + "</table>";
			

	}

}

