    function EuclideanProjection(s){ this.s=s; }
    EuclideanProjection.prototype=new google.maps.Projection();
    EuclideanProjection.prototype.fromLatLngToPixel=function(latlng,zoom){
      return new google.maps.Point( Math.ceil(this.s[zoom].w*(latlng.lng()+180)/360), Math.ceil(this.s[zoom].h*(90-latlng.lat())/180) );
    };
    EuclideanProjection.prototype.fromPixelToLatLng=function(pixel,zoom,unbounded){
      return new google.maps.LatLng( (0.5-(pixel.y/this.s[zoom].h))*180, ((pixel.x/this.s[zoom].w)-0.5)*360, unbounded);
    };
    EuclideanProjection.prototype.tileCheckRange=function(tile,zoom,size){
      if(zoom >= tile.length || tile.x < 0 || tile.y < 0) return false;
      if(tile.x >= Math.ceil(this.s[zoom].w/256)) return false;
      if(tile.y >= Math.ceil(this.s[zoom].h/256)) return false;
      return true;
    }
    EuclideanProjection.prototype.getWrapWidth=function(zoom) {
      return this.s[zoom].w;
    }
 
    function ImageMapType(name, layerdef, pathpattern) {
      var myCopyright = new google.maps.CopyrightCollection("");
      myCopyright.addCopyright(new google.maps.Copyright('', new google.maps.LatLngBounds(new google.maps.LatLng(-90,-180), new google.maps.LatLng(90,180)), 0, ''));
      var tilelayers = [new google.maps.TileLayer(myCopyright, 0, layerdef.length-1, {opacity:1, isPng:!!/\.png$/.exec(pathpattern), tileUrlTemplate:pathpattern})];
      return new google.maps.MapType(tilelayers, new EuclideanProjection(layerdef), name);
    }
	// 定義地圖各級尺寸 
    var imgmaptype=ImageMapType("01", [{w:936,h:964},{w:1872,h:1927},{w:2807,h:2891},{w:3743,h:3854},{w:4679,h:4818}], 'front/{Z}_{Y}_{X}.jpg');
	// 增加地圖控制組件及設定位置為右上
    var map = new google.maps.Map2(document.getElementById("map1"));
	var topLeft = new GControlPosition(G_ANCHOR_TOP_LEFT,  new GSize(10,10));
    map.addControl(new google.maps.LargeMapControl(), topLeft);
	// 設定滑鼠滾輪縮放
	map.enableScrollWheelZoom()
	// 載入地圖及設定起始中心點
    map.addMapType(imgmaptype);
	//map.addControl(new google.maps.OverviewMapControl());
    map.setCenter(new google.maps.LatLng(43.31950207468879, -83.84615384615385), 0, imgmaptype);
	// 設定點擊增加標記及顯示座標
	var myLatLng = new GLatLng(0, 0);
	document.getElementById('inLatLng').value = myLatLng.toString();
	var myMarker = new GMarker( myLatLng );
	map.addOverlay( myMarker );
	GEvent.addListener(map, "click", function( overlay, point ){
							if(point){
								//設定標註座標
								myMarker.setLatLng(point);
								document.getElementById('inLatLng').value = point.toString();
							}
						});

	// 移動中心點至目標及增加標記
	function move(Lat,Lng,page) {
	// 自訂標籤
	//var icon=new GIcon();
	//icon.image = "arrow.gif";
	//icon.iconSize = new GSize(30,50);
	//icon.iconAnchor = new GPoint(15,50);
	//icon.shadowSize = new GSize(15,50);
	map.clearOverlays();
	map.setZoom(2);
	map.panTo(new GLatLng(Lat,Lng));
	var pos = new GLatLng(Lat,Lng);
	//var mark = new GMarker(pos, {icon:icon});
	var mark = new GMarker(pos);
	map.addOverlay(mark);
	window.open('introduction/'+page+'.html','content');
	}

  	function GC() {  
   	var center = map.getCenter();
	document.getElementById('GC').value = center.toString();
  	} 

