//alert("arg="+location.href);
//alert("arg="+location.href.match(/\?[^#]+/));
    var arg;
    var num;
    var map;//下のマップ用

        arg=location.href;
        num=arg.split("?");
//        alert("arg="+num[1]);

    // ===== アイコン指定 =====
	var icon = Array();
	icon[0] = new GIcon();
	icon[0].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerA.png"; //★ Ａアイコン
	icon[0].iconSize = new GSize(20,34);
	icon[0].iconAnchor = new GLatLng(17,10);
	icon[0].infoWindowAnchor = new GLatLng(17,10);
	icon[1] = new GIcon();
	icon[1].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerB.png"; //★ Ｂアイコン
	icon[1].iconSize = new GSize(20,34);
	icon[1].iconAnchor = new GLatLng(17,10);
	icon[1].infoWindowAnchor = new GLatLng(17,10);
	icon[2] = new GIcon();
	icon[2].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerC.png"; //★ Ｃアイコン
	icon[2].iconSize = new GSize(20,34);
	icon[2].iconAnchor = new GLatLng(17,10);
	icon[2].infoWindowAnchor = new GLatLng(17,10);
	icon[3] = new GIcon();
	icon[3].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerD.png"; //★ Ｄアイコン
	icon[3].iconSize = new GSize(20,34);
	icon[3].iconAnchor = new GLatLng(17,10);
	icon[3].infoWindowAnchor = new GLatLng(17,10);
	icon[4] = new GIcon();
	icon[4].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerG.png"; //★ Ｇアイコン
	icon[4].iconSize = new GSize(20,34);
	icon[4].iconAnchor = new GLatLng(17,10);
	icon[4].infoWindowAnchor = new GLatLng(17,10);
	icon[5] = new GIcon();
	icon[5].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerI.png"; //★ Iアイコン
	icon[5].iconSize = new GSize(20,34);
	icon[5].iconAnchor = new GLatLng(17,10);
	icon[5].infoWindowAnchor = new GLatLng(17,10);
	icon[6] = new GIcon();
	icon[6].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerE.png"; //★ Eアイコン
	icon[6].iconSize = new GSize(20,34);
	icon[6].iconAnchor = new GLatLng(17,10);
	icon[6].infoWindowAnchor = new GLatLng(17,10);
	icon[7] = new GIcon();
	icon[7].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerF.png"; //★ Fアイコン
	icon[7].iconSize = new GSize(20,34);
	icon[7].iconAnchor = new GLatLng(17,10);
	icon[7].infoWindowAnchor = new GLatLng(17,10);
	icon[8] = new GIcon();
	icon[8].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerH.png"; //★ Hアイコン
	icon[8].iconSize = new GSize(20,34);
	icon[8].iconAnchor = new GLatLng(17,10);
	icon[8].infoWindowAnchor = new GLatLng(17,10);
	icon[9] = new GIcon();
	icon[9].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerJ.png"; //★ Jアイコン
	icon[9].iconSize = new GSize(20,34);
	icon[9].iconAnchor = new GLatLng(17,10);
	icon[9].infoWindowAnchor = new GLatLng(17,10);
	icon[10] = new GIcon();
	icon[10].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/balloon-gr.png"; //★ グリーンアイコン
	icon[10].iconSize = new GSize(20,34);
	icon[10].iconAnchor = new GLatLng(17,10);
	icon[10].infoWindowAnchor = new GLatLng(17,10);
	icon[11] = new GIcon();
	icon[11].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/balloon-rd.png"; //★ レッドアイコン
	icon[11].iconSize = new GSize(20,34);
	icon[11].iconAnchor = new GLatLng(17,10);
	icon[11].infoWindowAnchor = new GLatLng(17,10);
	icon[12] = new GIcon();
	icon[12].image = "http://www.netsu-h.com/kitazato/GoogleMaps/images/markerS.png"; //★ Sアイコン
	icon[12].iconSize = new GSize(20,34);
	icon[12].iconAnchor = new GLatLng(17,10);
	icon[12].infoWindowAnchor = new GLatLng(17,10);



function setCenterPosition(i) {
//alert("setCenterPosition");
	switch( i ){
	case 1://Bブロック
		map.setCenter(new GLatLng(35.538685,139.417368), 14); // ★ 東大沼付近
		break;
	case 2://Cブロック
		map.setCenter(new GLatLng(35.538191,139.405219), 14); // ★ 西大沼４丁目付近
		break;
	case 3://Dブロック
		map.setCenter(new GLatLng(35.532208,139.421932), 14); // ★ 御園付近
		break;
	case 4://Gブロック
		map.setCenter(new GLatLng(35.531414,139.434698), 14); // ★ 相模大野付近
		break;
	case 5://Iブロック
		map.setCenter(new GLatLng(35.552094,139.41081), 14); // ★ サニーハイツ付近
		break;
	default://初期表示位置
		map.setCenter(new GLatLng(35.541794, 139.409379), 14); // ★ 大野台中の西北、ズームレベルは14（最大は17）
		break;
	}
      } 


    // ===== 以　上 =====

//***詳細マップの定義
	function load()
	{
	  if (GBrowserIsCompatible())
	  { 

	// ===== 基礎部分、setCenterで中心座標とズームレベルを指定 =====
	// 次の行を var map = new GMap2(document.getElementById("map"),{mapTypes:[G_NORMAL_MAP, G_SATELLITE_MAP]});  とすればハイブリッドは表示されない
//	map = new GMap2(document.getElementById("map"));
//	map.addControl(new GLargeMapControl()); // ズームコントロール。Small で小型に
//	map.addControl(new GMapTypeControl()); // 地図タイプ切り替えボタン
//	map.addControl(new GOverviewMapControl());
//	map.addControl(new GScaleControl());
//	map.setCenter(new GLatLng(35.538582, 139.38818), 14); // ★ 北里大東病院、ズームレベルは13（最大は17）

	// ===== マーカーとフキダシ =====
	function createMarker(point,html)
	{
	  var marker = new GMarker(point);
	  GEvent.addListener(marker, "click", function()
	    {
	      marker.openInfoWindowHtml(html);
	    }
	  );
          return marker;
        }
	// ===== マーカーとフキダシ =====
	function createTabbedMarker(point,html1,html2,label1,label2,n) {
	  var marker = new GMarker(point,icon[n]);
	  GEvent.addListener(marker, "click", function() {
	    marker.openInfoWindowTabsHtml([new GInfoWindowTab(label1,html1), new GInfoWindowTab(label2,html2)]);
          });
          return marker;
        }





	map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl()); // ズームコントロール。Small で小型に
	map.addControl(new GMapTypeControl()); // 地図タイプ切り替えボタン
	map.addControl(new GOverviewMapControl());
	map.addControl(new GScaleControl());
//	map.enableScrollWheelZoom();

//	map.setCenter(new GLatLng(35.538582, 139.38818), 15); // ★ 北里大東病院、ズームレベルは15（最大は17）
//	map.setCenter(new GLatLng(35.538704, 139.399016), 15); // ★ 麻溝台高校、ズームレベルは15（最大は17）
	
	setCenterPosition(Number(num[1]));//初期位置


//	setCenterPosition(0);//初期位置
//	map.setCenter(new GLatLng(35.541794, 139.409379), 14); // ★ 大野台中の西北、ズームレベルは14（最大は17）


      var request = GXmlHttp.create();
      request.open("GET", "bukken.xml", true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          var xmlDoc = request.responseXML;
          var markers = xmlDoc.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var html = markers[i].getAttribute("html");
	    var about = markers[i].getAttribute("about");
	    var icon = markers[i].getAttribute("icon");
	    var marker = createTabbedMarker(point, html,about, "物件名", "概要", icon); //★
            map.addOverlay(marker);
          }
        }
      }
      request.send(null);

      }
      // ===== 北里大学 =====
      var point = new GLatLng(35.539752,139.394318); //★
      var marker = createMarker(point,'<a href="http://www.kitasato-u.ac.jp/"  target="_blank">北里大学</a><br /><img src="http://www.netsu-h.com/kitazato/GoogleMaps/images/kitasato_uni.jpg" width="150" height="149"/>') //★
      map.addOverlay(marker);
      // ===== 根津ハウジング =====
//      var point = new GLatLng(35.542865,139.417139); //★
//      var marker = createTabbedMarker(point, "<a href='http://www.netsu-h.com/' target='_blank'>根津ハウジング</a><br />〒229-0012<br />神奈川県相模原市西大沼２丁目５２番１３号<br />TEL　042-745-7701/FAX　042-745-7761","相模原市エリアの大沼を中心とした賃貸情報をご紹介しております。<br />北里大学の学生さん＆職員さん必見です。", "会社名", "概要", 10); //★
//      map.addOverlay(marker);

    }
//***詳細マップの定義終了
