var centerLat = 25.013068400;
var centerLong = 121.529376148;
var mapCenterCrosshair;
var mapObj;
var iconCenter = new GIcon();
var iconObj = iconCenter;
var finishPost;

// Initialize UrMap
function initMap() {
		
	// Create map
	var map = new GMap2(document.getElementById('map'));
	map.setCenter(new GLatLng(centerLat, centerLong), 16);
	map.addControl(new GSmallMapControl());
    //map.addControl(new GLargeMapControl()); 
    map.addControl(new GMapTypeControl());
	mapObj = map;

	// Hotspot icon for center
	//	var iconCenter = new GIcon();
	//	iconObj = iconCenter;
	//	iconCenter.image = 'images/icon_w_unknown.gif';
	iconCenter.iconWidth = 20;
	iconCenter.iconHeight = 20;
	iconCenter.iconAnchor = new GPoint(7, 0);

	var centerPoint = new GLatLng(centerLat, centerLong); 
	var centerMarker = new GMarker(centerPoint, iconCenter);
	mapCenterCrosshair = centerMarker;
	map.addOverlay(centerMarker);

	// Add hotspot markers
	var bounds = map.getBounds();
}

//function checkIsFinishPost() {
//	if (finishPost ==1)
//		alert(finishPost);
//	else
//		alert('else ' + finishPost);
//	alert("RichTextBoxMsg = " + document.Form1.RichTextBoxMsg.value);
//}

// Recenter map
function BtnRecenterMap_OnClick() {
	mapObj.setCenter(new GLatLng(centerLat, centerLong));
}

// Center map to hotspot
function LinkHotspot_OnClick(hotspotLon, hotspotLat) {
	var latLon = new GLatLng(hotspotLat, hotspotLon);
	mapObj.setCenter(latLon);
	repositionCenterMarker(latLon);
}

// Button click
function clickButton(e, buttonid){ 
	var bt = document.getElementById(buttonid); 
	if (typeof bt == 'object'){ 
		//submitForm();
		bt.click(); 
		return true;
	}
}

