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

	FOUR-SITE&ism, GoogleMap Install Script

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

//Keyの設定
var MapKey = "ABQIAAAA5ClNArGlLC99QmhL8PLi1RRBUz80qtgRCIfKvujfSFj1AzDa7hSFqHdo91GW7kS-6rXqM0rwZa1cGw";

//4siteAPIkey：ABQIAAAA5ClNArGlLC99QmhL8PLi1RRAFjL0yq10u9lg1_bZ_AYf9jXAjhT6FLewdDyUuSDDZqZHcLAJr0U3ig

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

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

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


	2.設置ID、座標の設定、高さの設定、マップ作成
	  GMap.ElementID = "id";							//GoogleMap表示ID名
	  GMap.centerPos = new GLatLng(37.4419, -122.1419);	//座標
	  GMap.gHeight   = 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,true);//マーカー生成命令
	  
	  ※マーカーを複数設置する場合、設定、生成命令をもう一度行えば生成されます。


	4.ラインの作成
	  GMap.gLine.push(new GLatLng(37.4400, -122.1400));	//ラインを引く座標を追加していく。
	  GMap.gLine.push(new GLatLng(37.4444, -122.1422));	//		〃
	  GMap.gLine.push(new GLatLng(37.4488, -122.1466));	//		〃
	  GMap.Color	= "#999999";						//色の設定　16進数
	  GMap.Thin		= 8;								//線の太さ（ピクセル数）
	  GMap.Opacity	= 0.7;								//不透明度　1が100%　0.5が50%　0.1が10%
	  GMap.createLine();

	  
	  ※マーカーを複数設置する場合、設定、生成命令をもう一度行えば生成されます。




<script type="text/javascript"> 
//<![CDATA[ 
var GMap		= new GoogleMapClass(); 
GMap.ElementID	= "GoogleMapBox";
GMap.centerPos	= new GLatLng(37.4419, -122.1419);
GMap.gHeight	= 13;
GMap.control	= true;
GMap.createMap();
 
GMap.Pos		= new GLatLng(37.4419, -122.1419); 
GMap.Html		= "あいうえお"; 
GMap.createMarker(GMap.Pos,GMap.Html,true);

GMap.gLine.push(new GLatLng(37.4400, -122.1400));
GMap.gLine.push(new GLatLng(37.4444, -122.1422));
GMap.gLine.push(new GLatLng(37.4488, -122.1466));
GMap.Color		= "#999999";
GMap.Thin		= 8;
GMap.Opacity	= 0.9;
GMap.createLine();
//]]> 
</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	= false;
	this.control		= true;
	this.gLine			= [];
	this.Color			= "#999999";
	this.Thin			= 6;
	this.Opacity		= 0.8;
	
	this.Icon			= new Object();
	this.Icon.image;
	this.Icon.imageSize;
	this.Icon.shadow;
	this.Icon.shadowSize;
	this.Icon.imageAnchor;
	this.Icon.WindowAnchor;

	this.createMap = function(){ 
	if(GBrowserIsCompatible()){ 
		this.mapVar = new GMap2(document.getElementById(this.ElementID));
		if(this.control){
			this.mapVar.addControl(new GLargeMapControl()); 
			this.mapVar.addControl(new GMapTypeControl()); 
		}
		this.mapVar.setCenter(this.centerPos, this.gHeight);
		new GKeyboardHandler(this.mapVar);
		}
	}

	this.createMarker = function(markerPos,HTML,InitPoint){ 
		var markerVar = new GMarker(markerPos);
		if(InitPoint){mapInitPoint = true;}
		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);}
	}

	this.createIconMarker = function(markerPos,HTML,InitIconPoint){
		var gIcon			= new GIcon();
		gIcon.image			= this.Icon.image;
		gIcon.iconSize		= this.Icon.imageSize;
		gIcon.shadow		= this.Icon.shadow;
		gIcon.shadowSize	= this.Icon.shadowSize;
		gIcon.iconAnchor	= this.Icon.imageAnchor;
		gIcon.infoWindowAnchor	= this.Icon.WindowAnchor;
		var markerVar = new GMarker(markerPos,gIcon);
		if(InitIconPoint){mapInitPoint = true;}
		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);}
	}

	this.createLine = function(){
		this.mapVar.addOverlay(new GPolyline(this.gLine,this.Color,this.Thin,this.Opacity));
		this.gLine	=[];
	}

}

/*---------- 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;}
}
