/*
==========================================================================================

	FOUR-SITE&ism, GoogleMap Install Script

	                                       http://www.4site.co.jp/
	-------------------------------------------------------------*/

//Keyの設定
var MapKey = "ABQIAAAA5ClNArGlLC99QmhL8PLi1RTCYsGOJNFbq884rqpmycRjJG5FzRTSPiCv_D9y-Hp_LW3TdRxgtZiZxw";


/*
	</body>の上に設定、生成javascriptを書く事、下にサンプルがあります。

	使用方法-----------------------------------------------------

	1.オブジェクトの作成
	  var GMap = new GoogleMapClass();


	2.設置ID、座標の設定、高さの設定、マップ作成
	  GMap.ElementID = "id";                            //GoogleMap表示ID名
	  GMap.centerPos = new GLatLng(37.4419, -122.1419); //座標
	  GMap.gHight    = 13;                              //高さ（数字が低い程高い）
	  GMap.createMap();　                               //マップ生成命令
	  
	  ※中央座標取得javascript
	    下記スクリプトをGoogleMapを開いている時にペーストすると開いているGoogleMapの座標（中央位置）取得
	  javascript:(function(){gApplication.getPageUrl().match(/&ll=([^&]+)&spn/);x=prompt('現在の座標',RegExp.$1)})();


	3.マーカーの設置
	  GMap.MarkerP = new GLatLng(37.4419, -122.1419);   //マーカー設置座標
	  GMap.MarkerH = "あいうえお";                      //マーカーをクリックした時のふきだしの中身（html可）
	  GMap.createMarker(GMap.MarkerP,GMap.MarkerH);   //マーカー生成命令 最初に命令したふきだしが、初期ふきだし設定になる。
	  
	  ※マーカーを複数設置する場合、設定、生成命令をもう一度行えば生成されます。




<script type="text/javascript"> 
//<![CDATA[ 
var GMap = new GoogleMapClass(); 
GMap.ElementID = "id";
GMap.centerPos = new GLatLng(37.4419, -122.1419);
GMap.gHight = 13;
GMap.createMap(); 
 
GMap.Marker1Pos = new GLatLng(37.4419, -122.1419); 
GMap.Marker1Html = "あいうえお"; 
GMap.createMarker(GMap.Marker1Pos,GMap.Marker1Html,1);
//]]> 
</script> 



==========================================================================================
(c)2007 FOUR-SITE&ism Co.,Ltd ALL Rights Reserved. 
*/

var Gheader = '<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=';
var Gfooter = '" type="text/javascript"></script>';

document.write(Gheader+MapKey+Gfooter);

function GoogleMapClass(){

	var mapInitPoint = true;

	this.createMap = function(){ 
	if(GBrowserIsCompatible()){ 
		this.mapVar = new GMap2(document.getElementById(this.ElementID)); 
		this.mapVar.addControl(new GLargeMapControl()); 
		this.mapVar.addControl(new GMapTypeControl()); 
		this.mapVar.setCenter(this.centerPos, this.gHight); 
		}
	}
	this.createMarker = function(markerPos,HTML){ 
	var markerVar = new GMarker(markerPos); 
	this.mapVar.addOverlay(markerVar); 
	GEvent.addListener(markerVar, 'click', function(){markerVar.openInfoWindowHtml(HTML);});
	this.initOpen = function(){markerVar.openInfoWindowHtml(HTML); mapInitPoint=false;}
	if(mapInitPoint){addEvent(window,'load',this.initOpen,false);}
	}
}

/*---------- addEvent ----------*/
function addEvent(elm, evType, fn, useCapture) {
 if (elm.addEventListener) {elm.addEventListener(evType, fn, useCapture);return true;}
 else if (elm.attachEvent) {var r = elm.attachEvent('on' + evType, fn);return r;}
 else {elm['on' + evType] = fn;}
}