// GoogleMap移動JavaScript（for AJAX）
// エリアIDからサーバの移動位置を取得しマップの表示位置を変更する。
function actionAreaMove(mapObj, area_id) {

	// 引数が空白の場合、何もしない
    if (area_id == "") {
    	return;
    }
    
	var data = "";
	data += "area_id=" + area_id;
	url = "findArea.php";
	var myAjax = new Ajax.Request(
							    url,
								{
								    method: 'post',
								    parameters: data,
								    onComplete: function(xmlhttp) {
								        var result = eval("(" + xmlhttp.responseText + ")");
								        if (result.sts != "0") {
								            // location.href = "/error.php";
								        } else {
								        	setMapCenter(mapObj, result.latitude, result.longitude, result.zoom);
								        }
								    }
								});
}
// ステーションIDからサーバの移動位置を取得しマップの表示位置を変更する。
function actionStationMove(mapObj, station_id) {

	// 引数が空白の場合、何もしない
    if (station_id == "") {
    	return;
    }
	var data = "";
	data += "station_id=" + station_id;
	url = "findStation.php";
	var myAjax = new Ajax.Request(
							    url,
								{
								    method: 'post',
								    parameters: data,
								    onComplete: function(xmlhttp) {
								        var result = eval("(" + xmlhttp.responseText + ")");
								        if (result.sts != "0") {
								            // location.href = "/error.php";
								        } else {
								        	setMapCenter(mapObj, result.latitude, result.longitude, result.zoom);
								        }
								    }
								});
}
// 指定されたMAPオブジェクトを指定された条件で再表示する。
function setMapCenter(mapObj, pointX, pointY, zoomLevel) {
	mapObj.setCenter(new GLatLng(pointX, pointY), parseInt(zoomLevel));
}

