function PostLocation(_pluginPath)
{
	this.pluginPath = _pluginPath+"/";
	this.initIcon();
	this.ajax_url = this.pluginPath+"postlocation-ajax.php?";
}

PostLocation.prototype = {

	pluginPath : null,
	iconPath : null, //アイコン格納パス openlayers_icons.js内で定義

	//icon情報
	icons : new Array(), //Icon キャッシュ
	iconInfo : new Array(), //Icon Create Info
	categoryIcons : {},

	//初期表示範囲
	loadExtent : null,

	//Map
	map : null,
	geocoder : null,
	projection: null,

	//MapData
	locations : [],
	geoXml : [],

	//Geometry Type
	MOVE : 0,
	POINT : 1,
	POLYLINE : 2,
	POLYGON : 3,

	//Callback Data & Functions
	postLinks : [], //Locationsの配列位置に関連するリンクオブジェクト
	mapMoveListener : null,
	markerClickListener : null,
	markerMouseOverListener : null,
	markerMouseOutListener : null,

	//WMS
	wmsLayer : new Array(),
	wmsOverlay : new Array(),
	shownWMSIdx : -1,
	useOpacity: false,

	//Popup
	tmpIdx : -1,
	tmpMarkers : null,
	//tmpMarkersBack : null,
	tmpConnections : null,

	//for Widget
	postID : -1, //単一記事表示時にその記事のPostIDが入る（一覧時は-1）
	maxBounds : null,

	//Ajax
	ajax_url : "",
	ajax : null
}
//Ajax
PostLocation.prototype.createHttpRequest = function ()
{
	if(window.XMLHttpRequest) {
		this.ajax = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			this.ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			this.ajax = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
}

////////////////////////////////////////////////////////////////
//	地図初期化
PostLocation.prototype.init = function(_id, _minZoomLevel, options)
{
	if (GBrowserIsCompatible()) {
		var self = this;

		if (options['cursor']) GDraggableObject.setDraggableCursor(options['cursor']);
		
		var mapDiv = document.getElementById(_id);
		var parentDiv = mapDiv.parentNode.parentNode;

		this.map = new GMap2(mapDiv, {size:new GSize(parentDiv.offsetWidth, parentDiv.offsetHeight)});
		this.geocoder = new GClientGeocoder();

		this.map.enableDoubleClickZoom();
		this.map.enableContinuousZoom();
	}
}



////////////////////////////////////////////////////////////////
//	Icons
PostLocation.prototype.setIcons = function(icons)
{
	for (var i=icons.length-1; i>=0; i-=2) {
		this.iconInfo[icons[i-1]] = this.iconInfo[icons[i]];
	}
}
//カテゴリ別表示用アイコンは、同じIDでも使えるように別配列にアイコンオブジェクトを格納
PostLocation.prototype.setCategoryIcons = function(icons)
{
	for (var i=icons.length-1; i>=0; i-=2) {
		this.categoryIcons[icons[i-1]] = this.getIcon(icons[i]);
	}
}

PostLocation.prototype.getIcon = function(iconid)
{
	if (iconid == undefined || iconid == null) {
		return this.icons['list'];
	}

	//カテゴリアイコンID優先
	if (this.categoryIcons[iconid]) return this.categoryIcons[iconid];
	//通常のアイコンから取得
	if (this.icons[iconid]) return this.icons[iconid];
	if (!isNaN(iconid)) return this.createIcon(iconid);

	//URLの場合
	if (iconid.match(/^http/) || iconid.match(/^\//)) {
		var icon_value = iconid.split(",");
		if (icon_value[0]) {
			//画像サイズ取得
			/*var image = new Image();
			image.src = icon_value[0];
			if (image.complate)
			var w = Math.min(64, image.width);
			var h = Math.min(64, image.height);
			delete image;*/
			var w = (icon_value.length > 1)?Math.min(64, icon_value[1]):32;
			var h = (icon_value.length > 2)?Math.min(64, icon_value[2]):32;
			icon = new OpenLayers.Icon(icon_value[0], new OpenLayers.Size(w, h), new OpenLayers.Pixel(-w/2, -h/2));
		}
		/*if (icon_value.length > 1) {
			icon.shadow = icon_value[1];
			var image = new Image();
			image.src = icon_value[1];
			var w = Math.min(84, image.width);
			var h = Math.min(84, image.height);
			icon.shadowSize = new OpenLayers.Size(w, h);
			delete image;
		}*/
		this.icons[iconid] = icon;
		return icon;
	}

	else return this.createIcon(iconid);

	return null;
}

//Create Icon & Cache
PostLocation.prototype.createIcon = function(id)
{
	if (!this.iconInfo[id]) id = 'list';
	var value = this.iconInfo[id];
	var icon = new GIcon();
	icon.image = this.iconPath+value[0];
	icon.iconSize = (value.length > 2)?new GSize(value[1],value[2]):new GSize(32,32);
	icon.iconAnchor = (value.length > 4)?new GPoint(value[3],value[4]):new GPoint(16,16);
	if (value.length > 7) {
		icon.shadow = this.iconPath+value[5];
		icon.shadowSize = new GSize(value[6],value[7]);
	}
	//icon.infoWindowAnchor = new GPoint(15, 10);
	this.icons[id] = icon;
	return this.icons[id];
}

////////////////////////////////////////////////////////////////
//	Geometries
PostLocation.prototype.textToGeometries = function(idx, _iconid, textGeometries)
{
	var geometries = new Array();
	for (var i=0; i<textGeometries.length; i++) {
		switch (textGeometries[i][0]) {
		case this.POINT:
			var iconid = _iconid;
			if (iconid == -1) {
				iconid = textGeometries[i][1];
			}
			geometries.push( this.createPoint(idx, iconid, new GLatLng(textGeometries[i][3], textGeometries[i][2])) );
			break;
		}
	}
	return geometries;
}

PostLocation.prototype.getGeometryObject = function(geometry)
{
	return geometry[2];
}

PostLocation.prototype.createPoint = function(_idx, iconid, point)
{
	var marker = this.createMarker(_idx, iconid, point);
	return this.createPointGeometry(iconid, marker);
}

PostLocation.prototype.createMarker = function(_idx, iconid, point)
{
	var marker;
	marker = new GMarker(point, { icon:this.getIcon(iconid)});
	var self = this;
	GEvent.addListener(marker, "click", function() {
		self.map.closeInfoWindow();
		self.showTmpMarker(_idx);
		self.openPopupWindow(marker.getPoint(), _idx);

	});
	return marker;
}
PostLocation.prototype.createTmpMarker = function(_idx, point)
{
	var marker;
	marker = new GMarker(point, { icon:this.getIcon('active'), zIndexProcess:this.orderOfCreation });
	//marker = new GMarker(point, { icon:this.icons['active'] });
	var self = this;
	GEvent.addListener(marker, "click", function() {
		if (self.map.getInfoWindow().isHidden()) self.openPopupWindow(marker.getPoint(), _idx);
	});
	GEvent.addListener(marker, "dblclick", function() {
		self.map.setZoom(self.getLocationZoom(_idx));
	});
	return marker;
}
PostLocation.prototype.orderOfCreation = function(marker, b) { return 1800000-Math.ceil(marker.getPoint().lng()*10000); }

PostLocation.prototype.createPointGeometry = function(iconid, marker)
{
	return new Array(this.POINT, iconid, marker);
}
PostLocation.prototype.isPoint = function(geometry)
{
	return geometry[0] == this.POINT;
}
PostLocation.prototype.getPointIconId = function(geometry)
{
	return geometry[1];
}
PostLocation.prototype.setPointIconId = function(geometry, iconid)
{
	geometry[1] = iconid;
}

PostLocation.prototype.createConnection = function(values, geometry)
{
	if (!values || !geometry) return;
	var connection = [];
	var idx = 0;
	for (var i=0; i<values.length; i+=2) {
		var m1 = geometry[values[i]];
		var m2 = geometry[values[i+1]];
		if (m1 && m2) {
			var line = new GPolyline([m1[2].getPoint(), m2[2].getPoint()], '#FF0000', 2, 0.5);
			this.map.addOverlay(line);
			connection[idx++] = line;
		}
	}
	return connection;
}

////////////////////////////////////////////////////////////////
//	Locations
/** 記事の位置とタイトルを追加 表示されている各記事と配列の順番が対応している */
PostLocation.prototype.addLocationByText = function(_postID, _x, _y, _z, _listiconid, _textGeometries, _connection)
{
	var geometries;
	if (!_textGeometries) {
		if (_listiconid == -1) _listiconid = 0;
		geometries = new Array( this.createPoint(this.locations.length, _listiconid, new GLatLng(_y, _x)) );
	} else {
		geometries = this.textToGeometries(this.locations.length, _listiconid, _textGeometries);
	}

	this.locations.push(new Array(_postID, _x, _y, _z, _listiconid, geometries, _connection));
}
PostLocation.prototype.clearLocations = function()
{
	for (var i=0; i<this.locations.length; i++) {
		var geometries = this.getLocationGeometries(i);
		for (var j=0; j<geometries.length; j++) {
			this.map.removeOverlay(this.getGeometryObject(geometries[j]));
		}
		delete this.locations[i];
	}
	this.locations.length = 0;
}
PostLocation.prototype.getLocationPostId = function(_idx)
{
	return this.locations[_idx][0];
}
PostLocation.prototype.getLocationPoint = function(_idx)
{
	return new GLatLng(this.locations[_idx][2], this.locations[_idx][1]);
}
PostLocation.prototype.getLocationZoom = function(_idx)
{
	return this.locations[_idx][3];
}
PostLocation.prototype.getLocationGeometries = function(_idx)
{
	return this.locations[_idx][5];
}
PostLocation.prototype.getLocationConnection = function(_idx)
{
	return this.locations[_idx][6];
}

PostLocation.prototype.createLocationOverlay = function()
{
	//Overlay Location Icons
	for (var i=this.locations.length-1; i>=0; i--) {
		var geometries = this.getLocationGeometries(i);
		for (var j=0; j<geometries.length; j++) {
			this.map.addOverlay(this.getGeometryObject(geometries[j]));
		}
	}
}
PostLocation.prototype.postIdToLocationIndex = function(_postId)
{
	for (var i=0; i<this.locations.length; i++) {
		if (this.locations[i][0] == _postId) return i;
	}
	return -1;
}
////////////////////////////////////////////////////////////////
// public Methods
PostLocation.prototype.setMarkCenter = function(strValue)
{
	if (document.getElementById("postlocation_markers").value.length == 0) {
		this.newPostMarker();
	}
	this.setCenter(strValue);
}

PostLocation.prototype.setCenter = function(strValue)
{
	var values = strValue.split(',');
	var zoom = this.map.getZoom();
	this.map.setZoom(Number(values[2]));
	this.map.panTo(new GLatLng(values[1],values[0]));
}

PostLocation.prototype.showGeoXml = function(_url)
{
	this.clearGeoXml();
	var urls = _url.split("\n");
	for (var i=0; i<urls.length; i++) {
		this.geoXml[i] = new GGeoXml(urls[i]);
		this.map.addOverlay(this.geoXml[i])
	}
}
PostLocation.prototype.clearGeoXml = function()
{
	for (var i=0; i<this.geoXml.length; i++) {
		this.geoXml[i].remove();
		delete this.geoXml[i];
	}
}

////////////////////////////////////////////////////////////////
//	Popup
//by Post ID
PostLocation.prototype.showPostIdTmpMarker = function(_postId)
{
	var _idx = this.postIdToLocationIndex(_postId);
	if (_idx >= 0) {
		this.map.closeInfoWindow();
		this.showTmpMarker(_idx, 0);
	}
}
PostLocation.prototype.showPostIdPopup = function(_postId)
{
	var _idx = this.postIdToLocationIndex(_postId);
	if (_idx >= 0) {
		this.map.closeInfoWindow();
		this.showTmpMarker(_idx, 0);
		var point = this.getLocationPoint(_idx);
		this.openPopupWindow(point, _idx);
	}
}

//by Locations Index
PostLocation.prototype.showPostPopup = function(_idx)
{
	this.map.closeInfoWindow();
	this.showTmpMarker(_idx, 0);
	var point = this.showPostCenter(_idx);
	this.openPopupWindow(point, _idx);
}
PostLocation.prototype.closePopup = function()
{
	this.map.closeInfoWindow();
	this.clearTmpMarker();

}
////////
/** @param zoomOffset 登録縮尺と表示縮尺を換える場合に設定 設定なしなら登録縮尺で表示 0の場合は中心位置のみ変更 */
PostLocation.prototype.showPostCenter = function(_idx, zoomOffset)
{
	var point = this.getLocationPoint(_idx);
	if (zoomOffset != undefined && zoomOffset == 0) {
	} else {
		if (!zoomOffset) zoomOffset = 0;
		var zoom = Math.min(this.map.getCurrentMapType().getMaximumResolution(), this.getLocationZoom(_idx)+zoomOffset);
		this.map.setZoom(zoom);
	}
	this.map.panTo(point);

	this.showTmpMarker(_idx, 0);
	return point;
}

PostLocation.prototype.showTmpMarker = function(_idx, _iconid)
{
	if (this.postID != -1) return;

	this.clearTmpMarker();
	this.tmpIdx = _idx;
	this.tmpMarkers = new Array();
	//this.tmpMarkersBack = new Array();
	var geometries = this.getLocationGeometries(_idx);
	for (var j=geometries.length-1; j>=0; j--) {//invert for zindex
		if (this.isPoint(geometries[j])) {
			var marker = this.getGeometryObject(geometries[j]);
			this.tmpMarkers[j] = this.createTmpMarker(_idx, marker.getPoint());
			this.map.addOverlay(this.tmpMarkers[j]);
			//this.tmpMarkers[j].setImage(this.icons['active'].image);//for zindex
			//this.tmpMarkersBack[j] = marker;
			//this.map.removeOverlay(marker);
		}
	}

	this.tmpConnections = this.createConnection(this.getLocationConnection(_idx), geometries);
}
PostLocation.prototype.clearTmpMarker = function()
{
	this.tmpIdx = -1;
	if (this.tmpMarkers) {
		for (var i=0; i<this.tmpMarkers.length; i++) {
			this.tmpMarkers[i].remove();
			delete this.tmpMarkers[i];
			//this.map.addOverlay(this.tmpMarkersBack[i]);
		}
		delete this.tmpMarkers;
	}

	if (this.tmpConnections) {
		for (var i=0; i<this.tmpConnections.length; i++) {
			this.map.removeOverlay(this.tmpConnections[i]);
			delete this.tmpConnections[i];
		}
		delete this.tmpConnections;
	}
}

PostLocation.prototype.openPopupWindow = function(_point, _idx)
{
	//return "<div style=\"width:200px;\">"+this.locations[i][4]+"</div>";
	if (!this.ajax) this.createHttpRequest();

	var url = this.ajax_url+"&thumbnail";
	url += "&id="+this.getLocationPostId(_idx);

	//Ajax
	this.ajax.open("GET", url);
	var self = this;
	this.ajax.onreadystatechange = function()
	{
		if (self.ajax.readyState == 4 && self.ajax.status == 200) {
			values = self.ajax.responseText.split("\t");
			var imageTag = "";
			if (values.length > 5 && values[5].length > 0)
				imageTag = '<img src=\"'+values[5]+'\" width=\"80\" style=\"float:left;padding-right:3px;\"/>';

			self.map.openInfoWindow(_point, '<div style="width:200px;overflow:hide;font-size:11px;line-height:120%;padding:12px 0px;"><a href="'+values[1]+'">'+values[2]+'</a>'+imageTag+'<div align="right" style="padding:2px;color:gray;">('+values[4]+')</div>'+values[3]+'</div>');
		}
	}
	this.ajax.send("");
}

////////////////////////////////////////////////////////////////
PostLocation.prototype.getCookie = function(name)
{
	name += "=";
	var arrCookie = document.cookie.split(';');
	for(var i=0; i<arrCookie.length; i++) {
		var c = arrCookie[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
	}
	return null;
}

////////////////////////////////////////////////////////////////

PostLocation.prototype.addMapTypeControl = function()
{
	this.map.addControl(new GMapTypeControl(1));
}

PostLocation.prototype.addSmallMapTypeControl = function()
{
	var self = this;

	var table = document.createElement("table");
	var tbody = document.createElement("tbody");
	var tr = document.createElement("tr");

	table.style.position = "absolute";
	table.style.left = "28px";
	table.style.top = "6px";
	table.style.border = "none";
	table.cellSpacing = 0;
	table.cellPadding = 0;

	var td = document.createElement("td");
	td.style.padding = "0px";
	var button = document.createElement("div");
	button.onclick = function (){ self.map.setMapType(G_NORMAL_MAP); };
	button.style.border = "1px solid black";
	button.style.backgroundColor = "white";
	button.style.marginRight = "1px";
	button.style.padding = "1px 3px 1px 3px";
	button.style.fontSize = "11px";
	button.style.cursor = "pointer";
	button.innerHTML = "地図";
	td.appendChild(button);
	tr.appendChild(td);
	var button1 = button;

	td = document.createElement("td");
	td.style.padding = "0px";
	button = document.createElement("div");
	button.onclick = function (){ self.map.setMapType(G_SATELLITE_MAP); };
	button.style.border = "1px solid black";
	button.style.backgroundColor = "white";
	button.style.marginRight = "1px";
	button.style.padding = "1px 3px 1px 3px";
	button.style.fontSize = "11px";
	button.style.cursor = "pointer";
	button.innerHTML = "写真";
	td.appendChild(button);
	tr.appendChild(td);
	var button2 = button;

	tbody.appendChild(tr);
	table.appendChild(tbody);
	this.map.getContainer().appendChild(table);

	var maptype = this.map.getCurrentMapType();
	if (maptype == G_SATELLITE_MAP) {
		button1.style.fontWeight =  "normal";
		button2.style.fontWeight =  "bold";
	} else if (maptype == G_NORMAL_MAP) {
		button1.style.fontWeight =  "bold";
		button2.style.fontWeight =  "normal";
	}
	GEvent.addListener(this.map, "maptypechanged", function(){
		var maptype = self.map.getCurrentMapType();
		if (maptype == G_SATELLITE_MAP) {
			button1.style.fontWeight =  "normal";
			button2.style.fontWeight =  "bold";
		} else if (maptype == G_NORMAL_MAP) {
			button1.style.fontWeight =  "bold";
			button2.style.fontWeight =  "normal";
		}
	} );
}

PostLocation.prototype.addMapTypeControl = function()
{
	this.map.addControl(new GMapTypeControl(1));
}
////////////////////////////////////////////////////////////////
// WMS
//http://www.geographynetwork.ne.jp/ogc/wms?SERVICENAME=basemap_wms&SERVICE=WMS&VERSION=1.1.1&REQUEST=getmap&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&reaspect=false&LAYERS=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16&WIDTH=256&HEIGHT=256
//http://www.geographynetwork.com/servlet/com.esri.wms.Esrimap?ServiceName=ESRI_World&&REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&STYLES=&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&SRS=EPSG:4326&reaspect=false&LAYERS=Coastline
//http://blog.senseware.mydns.jp/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.1.1&request=GetMap&format=gif&MAP=/home/asahi/usr/local/chubu_univ/mapf/univ.map&reaspect=false&transparent=true&layers=1%2C2%2C3%2C4%2C5%2C6
PostLocation.prototype.addWMSOverlay = function(wms_name, wms_url, opacity)
{
	return;
	var self = this;

	var wmsLayer = new GTileLayer(new GCopyrightCollection(),0,17);
	wmsLayer.opacity = opacity;
	wmsLayer.getTileUrl = function(tile, zoom) {
		return self.getWMSTileUrl(
			wms_url, tile, zoom);
	};
	wmsLayer.getOpacity = function() { return this.opacity; };
	var overlay = new GTileLayerOverlay(wmsLayer);
	this.wmsOverlay.push(new Array(wms_name, overlay, wmsLayer, opacity));
}

PostLocation.prototype.changeWMSOverlay = function(_idx)
{
	if (this.shownWMSIdx == _idx) return;
	document.cookie = "wmsidx="+_idx+"; path=/;";
	if (this.shownWMSIdx != -1) this.wmsOverlay[this.shownWMSIdx][1].remove();
	if (_idx >= 0) {
		this.shownWMSIdx = _idx;
		this.wmsOverlay[_idx][2].opacity = (this.useOpacity)?this.wmsOverlay[_idx][3]:1.0;
		this.map.addOverlay(this.wmsOverlay[_idx][1]);
	}
	else this.shownWMSIdx = -1;
}

PostLocation.prototype.setWMSOpacity = function(useOpacity)
{
	this.useOpacity = useOpacity;
	document.cookie = "wmsopacity="+(useOpacity?1:0)+"; path=/;";
	if (this.shownWMSIdx != -1) {
		this.wmsOverlay[this.shownWMSIdx][2].opacity = (this.useOpacity)?this.wmsOverlay[this.shownWMSIdx][3]:1.0;
		this.wmsOverlay[this.shownWMSIdx][1].remove();
		this.map.addOverlay(this.wmsOverlay[this.shownWMSIdx][1]);
	}
}

PostLocation.prototype.getWMSTileUrl = function(wms_url, tile, zoom)
{
	this.projection = this.map.getCurrentMapType().getProjection();

    // 自分の四隅の、GPoint座標系(85N,0E→85S,0Wの方向にピクセル単位)での位置を得る
    var p1 = new GPoint(tile.x*256,tile.y*256);
    var p2 = new GPoint(p1.x+255,p1.y+255);

    // 自分の四隅の、緯度経度座標系での位置を得る
    var latlng1 = this.projection.fromPixelToLatLng(p1, zoom);
    var latlng2 = this.projection.fromPixelToLatLng(p2, zoom);
    var lat1 = latlng1.lat();
    var lon1 = latlng1.lng();
    var lat2 = latlng2.lat();
    var lon2 = latlng2.lng();
    var minlat = Math.min(lat1,lat2);
    var minlon = Math.min(lon1,lon2);
    var maxlat = Math.max(lat1,lat2);
    var maxlon = Math.max(lon1,lon2);

    var layers = 'layers=unknown';

	return wms_url+'&WIDTH=256&HEIGHT=256&BBOX='+minlon+','+minlat+','+maxlon+','+maxlat;
}

PostLocation.prototype.addWMSControl = function(leftPos, topPos)
{
	return;

	var self = this;

	if (!leftPos) leftPos = 28;
	if (!topPos) topPos = 6;

	//Cookie
	var idx = this.getCookie("wmsidx");
	if (idx == undefined|| idx == null) idx = -1;
	var useOpacity = this.getCookie("wmsopacity");
	this.useOpacity = (useOpacity != undefined && useOpacity != null && useOpacity == 1);

	var div = document.createElement("div");

	div.style.position = "absolute";
	//div.style.textAlign = "right";

	div.style.left = leftPos+"px";
	div.style.top = topPos+"px";

	var select = document.createElement("select");
	select.onchange = function (){ self.changeWMSOverlay(this.options[this.selectedIndex].value); };
	select.onkeyup = function (){ self.changeWMSOverlay(this.options[this.selectedIndex].value); };
	var option = document.createElement("option");
	option.innerHTML = "- レイヤを選択 -";
	option.value = -1;
	select.appendChild(option);
	for (var i=0; i<this.wmsOverlay.length; i++) {
		option = document.createElement("option");
		option.innerHTML = this.wmsOverlay[i][0];
		option.value = i;
		if (i == idx) option.selected = true;
		select.appendChild(option);
	}
	div.appendChild(select);

	div.appendChild(document.createElement("br"));

	var label1 = document.createElement("label");
	var input = document.createElement("input");
	input.type = "checkbox";
	input.onclick = function (){ self.setWMSOpacity(this.checked); };
	label1.appendChild(input);
	if (this.useOpacity) input.checked = true;

	var img = document.createElement("img");
	img.src = this.pluginPath+"icons/opacity.png";
	img.title = "半透明";
	label1.appendChild(img);

	div.appendChild(label1);
	this.map.getContainer().appendChild(div);

	//var w = this.getDivWidth(this.map.getContainer());
	//var left = this.getDivWidth(div);
	//div.style.left = (w-left-5)+"px";

	//Cookieで設定されていたらWMS表示
	this.changeWMSOverlay(idx);
}

////////////////////////////////////////////////////////////////
// Address Search
PostLocation.prototype.showAddress = function(address)
{
	if (this.geocoder) {
		var self = this;
		this.geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
					alert(address + " \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002");
				} else {
					self.map.setCenter(point);
				}
			}
		);
	}
}

////////////////////////////////////////////////////////////////
//幅の取得
PostLocation.prototype.getDivWidth = function (div)
{
  return document.layers?
         div.clip.width:(div.offsetWidth||div.style.pixelWidth||0);
}

