// デバッグ
//window.onerror = function(mes,file,num){ alert([ "file : " + file, "line : " + num, "message : " + mes ].join("\n")); return true; }
//-------------------------------------------------------------
//JSAPIの動作確認
//-------------------------------------------------------------
if (ZDC._LOAD_ERR_MSG) {
location.href = '/map/mapclick.htm'+location.search;
};
if (typeof itsmo == 'undefined') {
var itsmo = {};
}
if (typeof itsmo.vars == 'undefined') {
itsmo.vars = {};
}
itsmo.lib = {};
itsmo.vars.pages = {
'range' : '周辺検索',
'suumo' : '不動産検索',
'baitoru' : 'アルバイト検索',
'tabikura' : 'ホテル検索',
'freeword' : 'フリーワード検索',
'addlist' : '住所一覧',
'panelroute' : 'ルート',
'mypage' : 'マイページ',
'myhome' : '自宅',
'myspot' : '登録地点',
'myspot_group' : '登録地点グループ',
'myroute' : '登録ルート',
'poihistory' : '履歴地点',
'routehistory' : '履歴ルート',
'history' : '履歴',
'mysnspost' : 'SNS投稿設定'
};
itsmo.vars.d_host_www = 'www.its-mo.com';
//-------------------------------------------------------------
// AJAX通信
//-------------------------------------------------------------
// 非同期通信
itsmo.lib.lastAjaxObj = null;
itsmo.lib.XMLHttpRequest2_send = function(url, callback, method, query, type, errorCallback) {
if (type == undefined) type = 'xml';
var param = {
url: url,
cache: false,
async: true,
data: query,
dataType: type,
type: method,
success: callback
};
if (null != errorCallback && undefined != errorCallback) {
param.error = errorCallback;
}
itsmo.lib.lastAjaxObj = $.ajax(param);
return itsmo.lib.lastAjaxObj;
};
// 中止
itsmo.lib.XMLHttpRequest2_abort = function( xmlobj ) {
if (xmlobj == null) return;
if (xmlobj.readyState != 0 && xmlobj.readyState != 4) {
xmlobj.abort();
}
};
itsmo.lib.XMLHttpRequest2_abortLast = function() {
var n = itsmo.lib.XMLHttpRequest2_abort(itsmo.lib.lastAjaxObj);
itsmo.lib.lastAjaxObj = null;
return n;
};
// htmlを読み込む
itsmo.lib.XMLHttpRequest2_html = function( url, divid, method, query ) {
return $.ajax({
url: url,
cache: false,
async: true,
data: query,
dataType: 'html',
type: method,
success: function(data, dataType) {
$('#' + divid).html(data);
}
});
};
// 同期通信
itsmo.vars.g_map_request_func = null; // 同期通信の戻り先格納用
itsmo.lib.XMLHttpRequest2_send_wait = function( url, callback, method, data, msg )
{
itsmo.lib.map_wait2open(msg);
itsmo.vars.g_map_request_func = callback;
itsmo.lib.XMLHttpRequest2_send( url, itsmo.lib.XMLHttpRequest2_send_wait_result, method, data );
};
itsmo.lib.XMLHttpRequest2_send_wait_result = function(result) {
itsmo.lib.map_wait2close();
itsmo.vars.g_map_request_func(result);
};
//-------------------------------------------------------------
// LocalStorage関連
//-------------------------------------------------------------
itsmo.lib.localstorage_set = function(data ,type){
let key = "itsmonaviweb:search:history";
let ls_history = JSON.parse(localStorage.getItem(key));
if(ls_history == null){
ls_history = [];
}
if(!data.nm){
return;
}
//履歴にあった場合は何もしない
for(let i in ls_history){
if(ls_history[i]['text'] == data.nm){
return;
}
}
//履歴は10件まで
let limit = 10;
//上限以上の場合全て削除
if(ls_history.length >= limit){
for(let i=limit-1; i< ls_history.length; i++){
ls_history.splice(i ,1);
}
}
//フリーワードを初期値
let val ={};
if(type == undefined){
val = {
'text':data.nm
};
}else{
val = {
'id' : data.id,
'text':data.nm,
'code': !(data.cd) ? data.id : data.cd,
'point' : !(data.lat) ? {} : {lat : data.lat , lon : data.lon},
'type': type,
'tag' :!(data.tag) ? {} : data.tag
}
}
//先頭に追加。リニューアルのLocalstorageに合わせている
let log = [val].concat(ls_history);
localStorage.setItem(key, JSON.stringify(log));
return;
};
//-------------------------------------------------------------
// クッキー関係
//-------------------------------------------------------------
// 書き込み
itsmo.lib.cookie_set = function(key,val,sec){
if(sec == undefined) sec = 1714395547;
var date = new Date();
date.setTime(date.getTime() + (sec * 1000));
var expires = 'expires=' + date.toGMTString();
document.cookie = encodeURIComponent(key)+'='+encodeURIComponent(val) + "; "+expires+'; path=/; domain=www.its-mo.com;';
};
// 読み込み
itsmo.lib.cookie_get_raw = function(key){
var i1 = document.cookie.indexOf(key+"=");
if(i1 < 0) return '';
i1 = i1+key.length+1;
var i2 = document.cookie.indexOf(";",i1);
if(i2 < 0) i2 = document.cookie.length;
return document.cookie.substring(i1,i2);
};
itsmo.lib.cookie_get = function(key){
return decodeURIComponent(itsmo.lib.cookie_get_raw(key));
};
// 書き込み(削除)
itsmo.lib.cookie_del = function(key){
var date = new Date();
date.setTime(date.getTime() - 1800);
var expires = 'expires=' + date.toGMTString();
document.cookie = encodeURIComponent(key)+'=; '+expires+'; path=/; domain=www.its-mo.com;';
};
//-------------------------------------------------------------
// htmlspecialchars
//-------------------------------------------------------------
itsmo.lib.htmlspecialchars = function(ch) {
ch = ch.replace(/&/g,"&") ;
ch = ch.replace(/"/g,""") ;
ch = ch.replace(/'/g,"'") ;//"
ch = ch.replace(//g,">") ;
return ch;
};
//------------------------------------------------
// オブジェクト操作
//------------------------------------------------
// オブジェクト出す消す
itsmo.lib.document_on = function(name, doc) {
if (doc) {
$('#' + name, doc).show();
} else {
$('#' + name).show();
}
};
itsmo.lib.document_off = function(name, doc) {
if (doc) {
$('#' + name, doc).hide();
} else {
$('#' + name).hide();
}
};
// オブジェクトクラス変える
itsmo.lib.document_class = function(name,cl) {
$('#' + name).attr('class', cl);
};
// オブジェクト値セット
itsmo.lib.document_setvalue = function(name,value) {
var obj = $('#' + name);
if(obj.length <= 0) {
return;
}
switch(obj.get(0).type) {
case 'select-one':
obj = obj.get(0);
for(var i=0;i < obj.options.length;i ++) {
if(obj.options[i].value == value) {
obj.selectedIndex = i;
break;
}
}
break;
case 'text':
case 'hidden':
case 'textarea':
case 'password':
obj.val(value);
break;
case 'radio':
obj.get(0).checked = (obj.val() == value);
$("[id^='" + name + "-']").each(function() {
$(this).get(0).checked = ($(this).val() == value);
return true;
});
break;
case 'checkbox':
obj.get(0).checked = (obj.val() == value);
break;
default:
obj = obj.get(0);
if(obj.src != null) {obj.src = value;return;}
if(obj.href != null) {obj.href = value;return;}
if(obj.innerHTML != null) obj.innerHTML = value;
break;
}
};
// value取る
itsmo.lib.document_getvalue = function(name) {
var obj = $('#' + name);
if(obj.length <= 0) {
return null;
}
switch(obj.get(0).type) {
case 'select-one':
obj = obj.get(0);
return obj.options[obj.selectedIndex].value
break;
case 'text':
case 'hidden':
case 'textarea':
case 'password':
case 'file':
return obj.val();
break;
case 'radio':
if(obj.get(0).checked) {
return obj.val();
}
var ret = null;
$("[id^='" + name + "-']").each(function() {
if ($(this).get(0).checked) {
ret = $(this).val();
return false;
}
return true;
});
return ret;
break;
case 'checkbox':
if(obj.get(0).checked) {
return obj.val();
}
return '';
break;
default:
obj = obj.get(0);
if(obj.src != null) return obj.src;
if(obj.href != null) return obj.href;
if(obj.innerHTML != null) return obj.innerHTML;
break;
}
return null;
};
// xmlの値を安全に取る
itsmo.lib.document_getxmlvalue = function(xml,name)
{
if(xml.getElementsByTagName(name) == null) return '';
if(xml.getElementsByTagName(name)[0] == null) return '';
if(xml.getElementsByTagName(name)[0].firstChild == null) return '';
return xml.getElementsByTagName(name)[0].firstChild.nodeValue;
}
// オブジェクトを取る
itsmo.lib.document_getobj = function(name)
{
var obj = g_document.getElementById(name);
return obj;
}
//------------------------------------------------
// 色々
//------------------------------------------------
// ウィンドウの高さを返す。
itsmo.lib.getWindowHeight = function()
{
return $(window).height();
};
//------------------------------------------------
// その他
//------------------------------------------------
// 座標変換 ミリ→度分秒
itsmo.lib.map_dms2deg = function(ms) {
var tmp = ms;
var d = Math.floor(tmp / 3600000);
tmp -= d * 3600000;
var m = Math.floor(tmp / 60000);
tmp -= m * 60000;
var p_dms = d + "°" + m + "′" + tmp / 1000;
//1000で割り切れた場合
tmp -= Math.floor(ms / 1000) * 1000;
if( tmp == 0 ){
p_dms = p_dms + "/0";
}
return p_dms;
};
//------------------------------------------------
// チェックボックス処理
//------------------------------------------------
// チェックボックス一括チェック,解除
itsmo.lib.allCheck = function(classnm,id)
{
var checkBoxs = $("."+classnm);
var checkval = $("#"+id).attr('checked');
if((id).indexOf("1") != -1){
id2 = id.replace("1","2");
$("#"+id2).attr("checked", checkval);
}else if((id).indexOf("2") != -1){
id2 = id.replace("2","1");
$("#"+id2).attr("checked", checkval);
}
checkBoxs.attr('checked', checkval);
};
itsmo.lib.getCheckNum = function(name)
{
var cnt = 0;
var chk = new Array();
for (i = 0; i < $("[name='" + name + "[]']").length; i++) {
if ($('#' + name + i).attr('checked')) {
chk[cnt] = $('#' + name + i).val();
cnt++;
}
}
if (cnt == 0) {
return false;
} else {
return chk;
}
};
// 全選択チェックボックスのchecked==falseにする
itsmo.lib.allCheckOut = function()
{
$(".add_flg").click(function(){
var checked = $(this).attr('checked');
if(checked == false){
$("#list-selectall1").attr('checked',false);
$("#list-selectall2").attr('checked',false);
}
});
};
/*------------------------------------------------------------------
ScreenClose
------------------------------------------------------------------*/
itsmo.lib.ScreenClose = function()
{
$("#screen-wrap").hide();
$("#sc").parent().css('overflow', 'auto');
}
/*------------------------------------------------------------------
ScreenOpen
------------------------------------------------------------------*/
itsmo.lib.ScreenOpen = function()
{
window.scroll(0,0);
$("#sc").parent().css('overflow', 'hidden');
$("#screen-wrap").height($('window').height()).show();
}
//-------------------------------------------------------------
// ウィンドウ開く
//-------------------------------------------------------------
itsmo.vars.g_map_window = null;
itsmo.vars.g_map_window_func = null;
// 窓開く
itsmo.lib.map_windowopen = function(name,func) {
if(itsmo.vars.g_map_window != null) return;
itsmo.vars.g_map_window_func = func;
if (!itsmo.vars.g_screen_non) itsmo.lib.ScreenOpen();
itsmo.vars.g_map_window = name;
itsmo.lib.document_on(itsmo.vars.g_map_window);
$('div.right-add300:has(iframe)').hide();
$('#add-468-in').hide();
// フォーカスを合わせる
// itsmo.lib.map_setfocus_top($('#' + itsmo.vars.g_map_window).children());
itsmo.lib.map_setfocus_top(document.getElementById(itsmo.vars.g_map_window).childNodes);
};
// 窓閉じる
itsmo.lib.map_windowclose = function(nofunc) {
if(itsmo.vars.g_map_window == null) return;
itsmo.lib.document_off(itsmo.vars.g_map_window);
$('div.right-add300:has(iframe)').show();
$('#add-468-in').show();
itsmo.vars.g_map_window = null;
if (!itsmo.vars.g_screen_non) itsmo.lib.ScreenClose();
if(nofunc != 1 && itsmo.vars.g_map_window_func != null){
itsmo.vars.g_map_window_func();
}
itsmo.vars.g_map_confirm_yes = 0;
};
// フォーカスを左上?に移動させる
itsmo.lib.map_setfocus_top = function(parent) {
for(var i = 0;i < parent.length;i ++) {
var node = parent.item(i);
var tag = node.tagName;
if(tag == "INPUT") {
var type = node.type;
if(type == "text" || type == "checkbox" || type == "radio" || type == "image") {
node.focus();
return false;
}
} else if (tag == "TEXTAREA") {
node.focus();
return false;
}
if(node.childNodes.length > 0) {
if(itsmo.lib.map_setfocus_top(node.childNodes) == false) return false;
}
}
return true;
};
// 問い合わせウィンドウ
itsmo.vars.g_map_confirm_yes = 0;
itsmo.lib.map_confirm = function(title,text,func) {
itsmo.lib.document_setvalue('ajax_map_window_confirm_title',title);
itsmo.lib.document_setvalue('ajax_map_window_confirm_text',text);
itsmo.lib.map_windowopen('ajax_map_window_confirm',func);
};
itsmo.lib.map_confirm_yes = function() {
itsmo.vars.g_map_confirm_yes = 1;
itsmo.lib.map_windowclose();
};
itsmo.lib.map_confirm_no = function() {
itsmo.vars.g_map_confirm_yes = 0;
itsmo.lib.map_windowclose();
};
// 確認ウィンドウ
itsmo.vars.g_map_alert_cookie = null;
itsmo.lib.map_alert = function(title,text,cookie,func) {
if(itsmo.lib.cookie_get('cktg_confirm').indexOf(cookie) != -1) {
if(func) func();
return;
}
itsmo.lib.document_setvalue('ajax_map_window_alert_title',title);
itsmo.lib.document_setvalue('ajax_map_window_alert_text',text);
itsmo.lib.document_setvalue('ajax_map_window_alert_chk',0);
itsmo.vars.g_map_alert_cookie = cookie;
itsmo.lib.map_windowopen('ajax_map_window_alert',func);
};
itsmo.lib.map_alert_close = function(title,text,cookie) {
// クッキーに保存
if(itsmo.lib.document_getvalue('ajax_map_window_alert_chk') == 1) {
itsmo.lib.cookie_set('cktg_confirm',itsmo.lib.cookie_get('cktg_confirm')+'\t'+itsmo.vars.g_map_alert_cookie);
}
itsmo.lib.map_windowclose();
};
//-------------------------------------------------------------
// Wait表示
//-------------------------------------------------------------
itsmo.vars.g_map_waitcnt = 0;
itsmo.vars.g_map_waittimer = null;
// 処理中ウィンド表示
itsmo.lib.map_waitopen = function() {
itsmo.lib.document_off('ajax_leftmenu');
itsmo.lib.document_on('ajax_leftmenu_wait');
itsmo.vars.g_map_waitcnt ++;
// 強制的に閉じるウェイト
if(itsmo.vars.g_map_waittimer != null) clearTimeout(itsmo.vars.g_map_waittimer);
itsmo.vars.g_map_waittimer = setTimeout("itsmo.vars.g_map_waittimer = null;itsmo.lib.map_waitclose();" , 20 * 1000);
};
// 処理中ウィンドクローズ
itsmo.lib.map_waitclose = function() {
itsmo.lib.document_on('ajax_leftmenu');
itsmo.lib.document_off('ajax_leftmenu_wait');
itsmo.vars.g_map_waitcnt --;
if(itsmo.vars.g_map_waitcnt < 1) {
itsmo.vars.g_map_waitcnt = 0;
if(itsmo.vars.g_map_waittimer != null) clearTimeout(itsmo.vars.g_map_waittimer);
}
};
// 処理中ウィンド2表示
itsmo.lib.map_wait2open = function(msg, flagCancelGPS) {
//itsmo.lib.document_setvalue('map_wait_text',msg);
if (flagCancelGPS == true) {
if ($('#map_wait_text').hasClass("exist-btn-cancel") == false) {
$('
').appendTo("#map_wait_text");
$('#map_wait_text').addClass("exist-btn-cancel");
}
} else {
if ($('#map_wait_text').hasClass("exist-btn-cancel") == true) {
$("#btn-cancel-gps").remove();
$('#map_wait_text').removeClass("exist-btn-cancel");
}
}
$('#map_wait_text span').text(msg);
itsmo.lib.map_windowopen('ajax_map_window_wait');
};
// 処理中ウィンド2クローズ
itsmo.lib.map_wait2close = function() {
if(itsmo.vars.g_map_window == 'ajax_map_window_wait') itsmo.lib.map_windowclose();
};
//------------------------------------------------
// エラー画面
//------------------------------------------------
itsmo.lib.map_error = function(title,text,func) {
itsmo.lib.document_setvalue('ajax_map_window_error_title',title);
itsmo.lib.document_setvalue('ajax_map_window_error_text',text);
itsmo.lib.map_windowopen('ajax_map_window_error',func);
$('#ajax_map_window_error a.btn-close').get(0).focus();
};
// 未使用
itsmo.lib.map_error_close = function(title,text,cookie) {
itsmo.lib.map_windowclose();
};
//------------------------------------------------
// エラーメッセージ小窓表示
// param kbn エラー区分(W,E,I)
// param errCd エラーコード
// param errPage エラーページ(itsmo.vars.pagesのキー)
// param setData 動的メッセージ内容
// param cookie cookieのキー
// param func callback関数
//------------------------------------------------
itsmo.lib.aplErrorWindow = function(kbn, errCd, errPage, setData, cookie, func)
{
// エラーメッセージ取得
$.getJSON(
'/files/errorlist.json',
null,
function(json) {
// エラーログ出力
// err = kbn + ":" + errCd + ":" + errPage;
// if (kbn != 'I') $.get('/apl_log.php', { d: err }, function() {});
$.each(json.errors, function(i, item){
code = kbn + errCd;
if (code == item.errcd) {
title = item.title.replace('{page}', itsmo.vars.pages[errPage]);
message = item.message.replace('{prm}', setData);
// 表示ウィンドウ判別
switch (kbn) {
case 'W':
case 'E':
itsmo.lib.map_error(title, message, func);
break;
case 'I':
itsmo.lib.map_alert(title, message, cookie, func);
break;
}
}
});
}
);
};
// 携帯リンクurl作成
itsmo.lib.getLinkMobileUrl = function(lat,lon,lvl) {
if (lat < 10000) {
lat = itsmo.lib.toMilliSec({
lat: lat,
lon: lon
});
lon = lat.lon;
lat = lat.lat;
}
var prm = lat + '-' + lon + '-' + itsmo.lib.map_changeLvl(lvl);
var txt = itsmo.vars.d_mobile_maptolink + 'p1?' + prm ;
return txt;
};
// ガイド用リンクurl作成
itsmo.lib.getLinkItsmoUrl = function(lat,lon,lvl) {
var prm = 'z-' + lat + '-' + lon + '-' + lvl;
// var txt = 'http://' + itsmo.vars.d_host_www + '/' + prm + '.htm';
var txt = 'https://www.its-mo.com/' + prm + '.htm';
return txt;
};
// 携帯へ
itsmo.lib.openLinkMobile = function(lat,lon,lvl) {
var txt = itsmo.lib.getLinkMobileUrl(lat,lon,lvl);
$('#ajax_map_jmap_mtext').val(txt);
$('#ajax_map_jmap_mmail').attr('href','mailto:?BODY=' + encodeURIComponent(txt));
$('#ajax_map_jmap_barcode').attr('src',itsmo.vars.d_qrimg_url+'?d=' + txt);
itsmo.lib.map_windowopen('mobile_send_window');
};
// 携帯用縮尺変換
itsmo.lib.map_changeLvl = function(lvl)
{
var mlvl = {};
mlvl['1'] = '1';
mlvl['2'] = '1';
mlvl['3'] = '1';
mlvl['4'] = '1';
mlvl['5'] = '1';
mlvl['6'] = '1';
mlvl['7'] = '1';
mlvl['8'] = '1';
mlvl['9'] = '2';
mlvl['10'] = '3';
mlvl['11'] = '4';
mlvl['12'] = '5';
mlvl['13'] = '6';
mlvl['14'] = '7';
mlvl['15'] = '7';
mlvl['16'] = '8';
mlvl['17'] = '8';
mlvl['18'] = '9';
return mlvl[lvl];
};
//フリーワード検索
itsmo.lib.freewdSubmit = function(form_id,cat) {
var freewd = $('#' + form_id +' input[name=w]').val();
if(freewd == itsmo.vars.g_freeWordComment[cat]){
freewd = "";
$('#' + form_id +' input[name=w]').val('');
}
let data ={};
data.nm = itsmo.lib.document_getvalue('freewd');
itsmo.lib.localstorage_set(data);
var path = location.pathname;
var paths = path.split('/');
if (paths[1] == 'c' || paths[1] == 'map') {
path = '/'+paths[1]+'/';
} else {
path = '/'+paths[1]+'/'+paths[2]+'/';
}
// Remove Google Analytics
// _gaq.push(['_trackEvent', 'フリーワード', path, freewd, , true]);
var flg = true;
if(freewd.length > 30){
flg = false;
alert('30文字以内で入力してください');
return false;
}
if (flg) {
$('#' + form_id).attr("action", '/search/freeword/');
}
};
/** ミリ秒から十進度形式へ */
itsmo.lib.toLatLon = function(lat, lon) {
if (lat instanceof Object && typeof lat.lat !== 'undefined' && typeof lat.lon !== 'undefined') {
lon = lat.lon;
lat = lat.lat;
}
lat /= 60 * 60 * 1000;
lon /= 60 * 60 * 1000;
return new ZDC.LatLon(lat, lon);
};
/** 十進度形式からミリ秒へ。ミリ秒形式のものはそのまま object 形式にして返す。 */
itsmo.lib.toMilliSec = function(lat, lon) {
if (typeof lon == 'undefined') {
lon = lat.lon;
lat = lat.lat;
}
lat = parseFloat(lat);
lon = parseFloat(lon);
if (lat < 100000000) {
lat = Math.floor(lat * 60 * 60 * 1000);
lon = Math.floor(lon * 60 * 60 * 1000);
}
return {
lat: lat,
lon: lon
};
};
// 距離算出
itsmo.lib.getDistance = function(flat, flon, tlat, tlon) {
var dist = parseInt(itsmo.lib.getDistance2(flat, flon, tlat, tlon) / 1000);
return dist;
};
// 距離算出
itsmo.lib.getDistance2 = function(flat, flon, tlat, tlon) {
var fpoint = new itsmo.lib.toLatLon(flat, flon); // from
var tpoint = new itsmo.lib.toLatLon(tlat, tlon); // to
var dist = ZDC.getLatLonToLatLonDistance(fpoint, tpoint);
return dist;
};
//------------------------------------------------
// 先頭文字50音チェック
//------------------------------------------------
// return 50音id
itsmo.lib.initCheck = function(nm)
{
var init = nm.substr(0,1);
if(('アイウエオ').indexOf(init) != -1 || ('あいうえお').indexOf(init) != -1){
return 1;
}else if(('カキクケコ').indexOf(init) != -1 || ('かきくけこ').indexOf(init) != -1 || ('ガギグゲゴ').indexOf(init) != -1 || ('ガギグゲゴ').indexOf(init) != -1){
return 2;
}else if(('サシスセソ').indexOf(init) != -1 || ('さしすせそ').indexOf(init) != -1 || ('ザジズゼゾ').indexOf(init) != -1 || ('ざじずぜぞ').indexOf(init) != -1){
return 3;
}else if(('タチツテト').indexOf(init) != -1 || ('たちつてと').indexOf(init) != -1 || ('ダヂヅデド').indexOf(init) != -1 || ('だぢづでど').indexOf(init) != -1){
return 4;
}else if(('ナニヌネノ').indexOf(init) != -1 || ('なにぬねの').indexOf(init) != -1){
return 5;
}else if(('ハヒフヘホ').indexOf(init) != -1 || ('はひふへほ').indexOf(init) != -1 || ('バビブベボ').indexOf(init) != -1 || ('ばびぶべぼ').indexOf(init) != -1 || ('パピプペポ').indexOf(init) != -1 || ('ぱぴぷぺぽ').indexOf(init) != -1){
return 6;
}else if(('マミムメモ').indexOf(init) != -1 || ('まみむめも').indexOf(init) != -1){
return 7;
}else if(('ヤユヨ').indexOf(init) != -1 || ('やゆよ').indexOf(init) != -1){
return 8;
}else if(('ラリルレロ').indexOf(init) != -1 || ('らりるれろ').indexOf(init) != -1){
return 9;
}else if(('ワヲン').indexOf(init) != -1 || ('わをん').indexOf(init) != -1){
return 10;
}else{
return 9999;
}
};
// カンマ区切り
itsmo.lib.setComma = function(str)
{
while (str != (str = str.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
return str;
};
// 画像がくずれるので高さ調整
itsmo.lib.chgWidth = function(e){
var tmpImg = new Image();
tmpImg.src = e.src;
if(tmpImg.width <= tmpImg.height){
//$(e).width(56);
e.width=56;
}else if(tmpImg.width > tmpImg.height){
//$(e).height(56);
e.height=56;
}else{
e.width=56;
//$(e).width(56);
}
};
/**
* はいろーぜ通信処理
*
* @param void
* @return void
* @access public
*/
itsmo.vars.g_mysnspost_con = 0;
itsmo.lib.dispHighrose = function(url)
{
var useSSL = 'https:' == document.location.protocol;
// 直前URL保持
if (itsmo.vars.g_mysnspost_con == 1) {
// SNS投稿設定画面から遷移時、マイページURL保存
if(useSSL){
itsmo.lib.cookie_set('cktg_lasturl', 'https://' + itsmo.vars.d_host_www + '/map/mypage/');
}else{
itsmo.lib.cookie_set('cktg_lasturl', 'http://' + itsmo.vars.d_host_www + '/map/mypage/');
}
itsmo.vars.g_mysnspost_con = 0;
} else if (document.URL.indexOf('logout.php') <= 0 && url.indexOf('signup') <= 0) {
// ログアウト・会員登録以外から遷移時、直前のURL保存
itsmo.lib.cookie_set('cktg_lasturl', document.URL);
} else {
itsmo.lib.cookie_del('cktg_lasturl');
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
location.href = url;
};
/**
* はいろーぜ通信処理(スマホ用)
*
* @param void
* @return void
* @access public
*/
itsmo.lib.dispHighroseSmart = function(url, elem, ref)
{
itsmo.lib.cookie_del('login_ref');
var useSSL = 'https:' == document.location.protocol;
// 直前URL保持
if (document.URL.indexOf('logout.php') <= 0 && url.indexOf('signup') <= 0) {
if (document.referrer=="" || document.referrer.indexOf('dcm') >= 0 || document.URL.indexOf('sync') >= 0 || document.referrer.indexOf('/login')) {
if(useSSL){
itsmo.lib.cookie_set("cktg_lasturl", 'https://'+itsmo.vars.d_host_www);
}else{
itsmo.lib.cookie_set("cktg_lasturl", 'http://'+itsmo.vars.d_host_www);
}
if(ref)
itsmo.lib.cookie_set('login_ref', ref);
}else{
itsmo.lib.cookie_set("cktg_lasturl", document.referrer);
}
} else {
itsmo.lib.cookie_del('cktg_lasturl');
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(elem).attr('href', url);
};
itsmo.lib.redirect = function(url, element, returnUrl){
itsmo.lib.cookie_del('login_ref');
if(typeof(returnUrl) == 'undefined')
returnUrl = itsmo.vars.d_host_www;
itsmo.lib.cookie_set('cktg_lasturl', returnUrl);
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(element).attr('href', url);
};
/**
* はいろーぜ通信処理(スマホ用)
*
* @param void
* @return void
* @access public
*/
itsmo.lib.dispHighroseSmartMypage = function(url, elem)
{
if (document.URL.indexOf('logout.php') <= 0 && url.indexOf('signup') <= 0) {
itsmo.lib.cookie_set("cktg_lasturl", document.URL);
} else {
itsmo.lib.cookie_del('cktg_lasturl');
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(elem).attr('href', url);
};
itsmo.lib.flagGotoMap = true;
itsmo.lib.set_caution_map=function(name){
if (itsmo.lib.flagGotoMap) {
if (itsmo.lib.cookie_get('map_caution').length !="") {
var check_caution=JSON.parse(itsmo.lib.cookie_get('map_caution'));
check_caution[name]=1;
itsmo.lib.cookie_set('map_caution',JSON.stringify(check_caution),31536000);
}else{
var map_caution = { map_nomal: 0, map_transit: 0 ,map_landmark:0,map_sightseeing:0,map_lasttrain:0 };
itsmo.lib.cookie_set('map_caution',JSON.stringify(map_caution),31536000);
var check_caution=JSON.parse(itsmo.lib.cookie_get('map_caution'));
check_caution[name]=1;
itsmo.lib.cookie_set('map_caution',JSON.stringify(check_caution),31536000);
}
}
};
itsmo.lib.redirect_map_caution=function(name){
if(name=='normal'|| name ==""){
itsmo.lib.set_caution_map('map_nomal');
}
if(name=='transit'){
itsmo.lib.set_caution_map('map_transit');
}
if(name=='lasttrain'){
itsmo.lib.set_caution_map('map_lasttrain');
}
if(name=='landmark'){
itsmo.lib.set_caution_map('map_landmark');
}
if(name=='tourist'){
itsmo.lib.set_caution_map('map_sightseeing');
}
};
itsmo.lib.url_redirect=function(goback){
if (itsmo.lib.cookie_get('url_redirect').length !="" || itsmo.lib.cookie_get('url_redirect')==undefined){
window.location.href=itsmo.lib.cookie_get('url_redirect');
itsmo.lib.cookie_del('url_redirect');
}else{
window.location.href=goback;
}
};
itsmo.lib.clear_url_redirect=function(goback){
itsmo.lib.cookie_del('url_redirect');
if(typeof(goback) != 'undefined' && goback == false){
} else {
window.location.href=goback;
}
};
itsmo.lib.strToTime = function (text, now){
function strtotime(text, now) {
// discuss at: http://phpjs.org/functions/strtotime/
// version: 1109.2016
// original by: Caio Ariede (http://caioariede.com)
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// improved by: Caio Ariede (http://caioariede.com)
// improved by: A. Matías Quezada (http://amatiasq.com)
// improved by: preuter
// improved by: Brett Zamir (http://brett-zamir.me)
// improved by: Mirko Faber
// input by: David
// bugfixed by: Wagner B. Soares
// bugfixed by: Artur Tchernychev
// note: Examples all have a fixed timestamp to prevent tests to fail because of variable time(zones)
// example 1: strtotime('+1 day', 1129633200);
// returns 1: 1129719600
// example 2: strtotime('+1 week 2 days 4 hours 2 seconds', 1129633200);
// returns 2: 1130425202
// example 3: strtotime('last month', 1129633200);
// returns 3: 1127041200
// example 4: strtotime('2009-05-04 08:30:00 GMT');
// returns 4: 1241425800
var parsed, match, today, year, date, days, ranges, len, times, regex, i, fail = false;
if (!text) {
return fail;
}
// Unecessary spaces
text = text.replace(/^\s+|\s+$/g, '')
.replace(/\s{2,}/g, ' ')
.replace(/[\t\r\n]/g, '')
.toLowerCase();
// in contrast to php, js Date.parse function interprets:
// dates given as yyyy-mm-dd as in timezone: UTC,
// dates with "." or "-" as MDY instead of DMY
// dates with two-digit years differently
// etc...etc...
// ...therefore we manually parse lots of common date formats
match = text.match(
/^(\d{1,4})([\-\.\/\:])(\d{1,2})([\-\.\/\:])(\d{1,4})(?:\s(\d{1,2}):(\d{2})?:?(\d{2})?)?(?:\s([A-Z]+)?)?$/);
if (match && match[2] === match[4]) {
if (match[1] > 1901) {
switch (match[2]) {
case '-':
{ // YYYY-M-D
if (match[3] > 12 || match[5] > 31) {
return fail;
}
return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '.':
{ // YYYY.M.D is not parsed by strtotime()
return fail;
}
case '/':
{ // YYYY/M/D
if (match[3] > 12 || match[5] > 31) {
return fail;
}
return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
}
} else if (match[5] > 1901) {
switch (match[2]) {
case '-':
{ // D-M-YYYY
if (match[3] > 12 || match[1] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '.':
{ // D.M.YYYY
if (match[3] > 12 || match[1] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '/':
{ // M/D/YYYY
if (match[1] > 12 || match[3] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[1], 10) - 1, match[3],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
}
} else {
switch (match[2]) {
case '-':
{ // YY-M-D
if (match[3] > 12 || match[5] > 31 || (match[1] < 70 && match[1] > 38)) {
return fail;
}
year = match[1] >= 0 && match[1] <= 38 ? +match[1] + 2000 : match[1];
return new Date(year, parseInt(match[3], 10) - 1, match[5],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case '.':
{ // D.M.YY or H.MM.SS
if (match[5] >= 70) { // D.M.YY
if (match[3] > 12 || match[1] > 31) {
return fail;
}
return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
if (match[5] < 60 && !match[6]) { // H.MM.SS
if (match[1] > 23 || match[3] > 59) {
return fail;
}
today = new Date();
return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
match[1] || 0, match[3] || 0, match[5] || 0, match[9] || 0) / 1000;
}
return fail; // invalid format, cannot be parsed
}
case '/':
{ // M/D/YY
if (match[1] > 12 || match[3] > 31 || (match[5] < 70 && match[5] > 38)) {
return fail;
}
year = match[5] >= 0 && match[5] <= 38 ? +match[5] + 2000 : match[5];
return new Date(year, parseInt(match[1], 10) - 1, match[3],
match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
}
case ':':
{ // HH:MM:SS
if (match[1] > 23 || match[3] > 59 || match[5] > 59) {
return fail;
}
today = new Date();
return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
match[1] || 0, match[3] || 0, match[5] || 0) / 1000;
}
}
}
}
// other formats and "now" should be parsed by Date.parse()
if (text === 'now') {
return now === null || isNaN(now) ? new Date()
.getTime() / 1000 | 0 : now | 0;
}
if (!isNaN(parsed = Date.parse(text))) {
return parsed / 1000 | 0;
}
date = now ? new Date(now * 1000) : new Date();
days = {
'sun': 0,
'mon': 1,
'tue': 2,
'wed': 3,
'thu': 4,
'fri': 5,
'sat': 6
};
ranges = {
'yea': 'FullYear',
'mon': 'Month',
'day': 'Date',
'hou': 'Hours',
'min': 'Minutes',
'sec': 'Seconds'
};
function lastNext(type, range, modifier) {
var diff, day = days[range];
if (typeof day !== 'undefined') {
diff = day - date.getDay();
if (diff === 0) {
diff = 7 * modifier;
} else if (diff > 0 && type === 'last') {
diff -= 7;
} else if (diff < 0 && type === 'next') {
diff += 7;
}
date.setDate(date.getDate() + diff);
}
}
function process(val) {
var splt = val.split(' '), // Todo: Reconcile this with regex using \s, taking into account browser issues with split and regexes
type = splt[0],
range = splt[1].substring(0, 3),
typeIsNumber = /\d+/.test(type),
ago = splt[2] === 'ago',
num = (type === 'last' ? -1 : 1) * (ago ? -1 : 1);
if (typeIsNumber) {
num *= parseInt(type, 10);
}
if (ranges.hasOwnProperty(range) && !splt[1].match(/^mon(day|\.)?$/i)) {
return date['set' + ranges[range]](date['get' + ranges[range]]() + num);
}
if (range === 'wee') {
return date.setDate(date.getDate() + (num * 7));
}
if (type === 'next' || type === 'last') {
lastNext(type, range, num);
} else if (!typeIsNumber) {
return false;
}
return true;
}
times = '(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec' +
'|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?' +
'|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)';
regex = '([+-]?\\d+\\s' + times + '|' + '(last|next)\\s' + times + ')(\\sago)?';
match = text.match(new RegExp(regex, 'gi'));
if (!match) {
return fail;
}
for (i = 0, len = match.length; i < len; i++) {
if (!process(match[i])) {
return fail;
}
}
// ECMAScript 5 only
// if (!match.every(process))
// return false;
return (date.getTime() / 1000);
}
return strtotime(text, now);
};
itsmo.lib.getMapImgLink = function (latLon, lvl, wh, center){
latLon = itsmo.lib.toMilliSec(latLon);
var mapImageLink = '/map.php?lvl=' + lvl;
mapImageLink += '&lat=' + latLon.lat + '&lon=' + latLon.lon;
mapImageLink += '&w=' + wh.width + '&h=' + wh.height;
if(center){
mapImageLink += '&icn=link02:' + latLon.lat + ':' + latLon.lon;
}
mapImageLink += '&nc=1';
return mapImageLink;
};
itsmo.lib.getBaseURL = function (){
// entire url including querystring - also: window.location.href;
var url = location.href;
var baseURL = url.substring(0, url.indexOf('/', 14));
if (baseURL.indexOf('https://localhost') != -1) {
// Base Url for localhost
var url = location.href; // window.location.href;
var pathname = location.pathname; // window.location.pathname;
var index1 = url.indexOf(pathname);
var index2 = url.indexOf("/", index1 + 1);
var baseLocalUrl = url.substr(0, index2);
return baseLocalUrl + "";
} else {
// Root Url for domain name
return baseURL + "";
}
};
itsmo.lib.getQRCodeLink = function (txt, size){
var qrCodeLink = itsmo.vars.d_qrimg_url + '?d=' + txt;
if(size){
qrCodeLink += '&s=' +size;
}
return qrCodeLink;
};
itsmo.lib.share = {};
itsmo.lib.share.facebookPC = function(title){
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
var app_id = 'app_id=' + '268920203204669' + '&';
var redirect_uri = 'redirect_uri=https://facebook.com&';
var display = 'display=page&';
var _link = 'link=' + url + '&';
var name = 'name=' + title + '&';
var description = 'description=' + url + '&';
var picture = '&picture=https://www.its-mo.com/design/img/smart/bookmark.png&';
var sdk = 'sdk=joey';
var https = 'https://facebook.com/dialog/feed?' + app_id + redirect_uri + picture + name + description + _link + display + sdk;
window.open(https, '_blank');
};
itsmo.lib.share.twitterPC = function(title){
var href = 'https://twitter.com/share?text=';
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
href += title + '%0a' +'&url=' + url;
window.open(href, '_blank');
};
itsmo.lib.share.facebookSP = function(title){
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
var baseURL = itsmo.lib.getBaseURL();
var app_id = 'app_id=' + '268920203204669' + '&';
var redirect_uri = 'redirect_uri=' + baseURL + '/c/close_popup.php&';
var display = 'display=touch&';
var _link = 'link=' + url + '&';
var name = 'name=' + title + '&';
var description = 'description=' + url + '&';
var picture = '&picture=https://www.its-mo.com/design/img/smart/bookmark.png&';
var sdk = 'sdk=joey';
var https = 'https://m.facebook.com/dialog/feed?' + app_id + redirect_uri + picture + name + description + _link + display + sdk;
wind = window.open(https, "_blank", "width=450, height=450");
wind.onBeforeUnload = function () {
window.close();
};
};
itsmo.lib.share.twitterSP = function(title){
var href = 'https://twitter.com/share?text=';
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
href += title + '%0a' +'&url=' +url;
var width = 400,
height = 400,
left = ($(window).width() - width) / 2,
top = ($(window).height() - height) / 2,
opts = 'status=1' +
',width=' + width +
',height=' + height +
',top=' + top +
',left=' + left;
window.open(href, 'twitter', opts);
};
itsmo.lib.share.line = function (title) {
var href = 'https://line.naver.jp/R/msg/text/?';
title = encodeURIComponent(title);
var url = window.location.href;
url = encodeURIComponent(url);
href += title + '%0a' + url;
window.open(href);
};
itsmo.lib.share.mail = function (title) {
var url = window.location.href;
var mailTo = 'mailto:?body= %0a %0a' + title + '%0a' + encodeURI(url);
window.location.href = mailTo;
};
itsmo.lib.addHistoryFWSearch = function (word, url, key, active, limit) {
if (typeof limit == 'undefined' || limit == null) {
limit = 10;
}
if (typeof(url) !='undefined'){
if(url.length > 0){
word = [word,url,key];
if(active == 'active'){
word.push(active);
}
}
}
var historyArray = null;
historyArray = itsmo.lib.cookie_get('historyFWSearch');
if (historyArray != "") {
historyArray = JSON.parse(historyArray);
}
var ret = [];
if (word.length >= 1) {
ret.push(word);
}
if (historyArray != null) {
$.each(historyArray, function (i, v) {
if(Array.isArray(word) && Array.isArray(v)){
if (v[0] == word[0]) {
return;
}
}
if(Array.isArray(word)){
if (v == word[0]) {
return;
}
}
if(Array.isArray(v)){
if (v[0] == word) {
return;
}
}
if (v == word) {
return;
}
if (v.length <= 0) {
return;
}
ret.push(v);
if (ret.length >= limit) {
return false;
}
});
}
if (ret != null) {
ret = JSON.stringify(ret);
itsmo.lib.cookie_set('historyFWSearch', ret);
}
};
itsmo.lib.highroseLoginRedirect = function(url, elem, callbackURL) {
itsmo.lib.cookie_del('login_ref');
if(typeof(callbackURL) == 'undefined'){
callbackURL = itsmo.vars.d_host_www;
}
var useSSL = 'https:' == document.location.protocol;
if(useSSL){
itsmo.lib.cookie_set("cktg_lasturl", 'https://'+itsmo.vars.d_host_www + callbackURL);
}else{
itsmo.lib.cookie_set("cktg_lasturl", 'http://'+itsmo.vars.d_host_www + callbackURL);
}
var retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
$(elem).attr('href', url);
};
itsmo.lib.getCurrentAddress = function (currentStarting) {
if (undefined === currentStarting) {
currentStarting = false;
}
window.currentStarting = currentStarting;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(itsmo.lib.getCurrentAddressCallback, itsmo.lib.redirectTaxiError);
} else {
window.location.href = '/taxi/error';
}
};
itsmo.lib.getCurrentAddressCallback = function(position) {
var latlon = new ZDC.LatLon(position.coords.latitude, position.coords.longitude);
latlon = ZDC.wgsTotky(latlon);
var lat = latlon.lat;
var lon = latlon.lon;
var f = latlon.f;
var h = latlon.h;
$.ajax({
type:"GET",
url: '/map/right_click.php',
dataType:"json",
cache: false,
crossDomain: true,
headers: {
'X-Suggest-Auth':'NINAVW'
},
data:{lat:lat, lon:lon , f:f, h:h},
success: function(data) {
if (!(data.err == 1 || data[0] == null)) {
var currentAddr = data[0].address.text;
var currentAddrLat = Math.round(data[0].address.point.lat * 3600 * 1000);
var currentAddrLon = Math.round(data[0].address.point.lon * 3600 * 1000);
itsmo.lib.linkToTaxiFare(currentAddr, currentAddrLat, currentAddrLon);
} else {
window.location.href = '/taxi/error';
}
}
});
};
itsmo.lib.linkToTaxiFare = function(currentAddr, currentAddrLat, currentAddrLon) {
var facilityInfo = $('#facility-info').val();
if(currentAddr != '' && currentAddrLat != '' && currentAddrLon != '') {
var strUrl = '/taxi/?getin=' + facilityInfo + '&getoff=' + currentAddr + '_' + currentAddrLat + '_' + currentAddrLon;
if (window.currentStarting) {
strUrl = '/taxi/?getin=' + currentAddr + '_' + currentAddrLat + '_' + currentAddrLon + '&getoff=' + facilityInfo;
}
window.location.href = strUrl;
}
};
itsmo.lib.redirectTaxiError = function(error) {
window.location.href = '/taxi/error';
}
itsmo.map = {};
itsmo.sub = {};
//------------------------------------------------
// クリッカブルレイヤー関係
//------------------------------------------------
itsmo.sub.getHtmlSize = function(html) {
var sz = $('#idCalcSize').html(html);
sz = new ZDC.WH(sz.outerWidth({margin: true}), sz.outerHeight({margin: true}));
return sz;
};
//小吹き出し作成
itsmo.vars.g_map_tipid_clickable_s = {};
itsmo.sub.set_tooltip_s = function(tipHtml, data)
{
var clat = data.lat;
var clon = data.lon;
var uid = data.uid;
var div_id = 'tip_c_' + uid;
tipHtml = '' + tipHtml + '
';
var i = itsmo.vars.g_map_search_location;
if ( clat == '') {
clat = i.lat;
}
if ( clon == '') {
clon = i.lon;
}
var offset= new ZDC.Pixel(-10, -10);
var sz = itsmo.sub.getHtmlSize(tipHtml);
if (typeof data.tooltipOffset !== 'undefined') {
offset = data.tooltipOffset;
}
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(clat, clon), {
html: tipHtml,
size: sz,
offset: offset
});
var id = itsmo.vars.g_map_layer_clickable.add( tip );
data['tip_id'] = id;
data.tipHtml = tipHtml;
itsmo.vars.g_map_tipid_clickable_s[uid] = data;
itsmo.vars.g_map_layer_clickable.showById( id );
itsmo.map.addEventTooltip(tip, itsmo.map.D_TIPZIDX_RANGE );
// config に合わせて再設定。
itsmo.sub.set_tooltip_s.setHtml(uid);
return div_id;
};
itsmo.sub.set_tooltip_s.setHtmlAll = function() {
$.each(itsmo.vars.g_map_tipid_clickable_s, function(i, v) {
itsmo.sub.set_tooltip_s.setHtml(i);
});
};
itsmo.sub.set_tooltip_s.setHtml = function(uid) {
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
if (typeof data.tipHtml === 'undefined') {
return;
}
var id = data.tip_id;
var tipHtml = data.tipHtml;
tipHtml = tipHtml.replace(/%%uid%%/g, '' + uid);
if (itsmo.vars.g_config.mapinfo_minimize != 0) {
tipHtml = tipHtml.replace('class="fukidasi0"', 'class="f-supper0"');
}
var sz = itsmo.sub.getHtmlSize(tipHtml);
var e = itsmo.vars.g_map_layer_clickable.get(id);
e.setHtml(tipHtml, sz);
};
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
itsmo.sub.map_clickable_tipopen = function(html,data) {
if (itsmo.vars.g_map_tipid_clickable_open_uid == data.uid) {
return;
}
itsmo.sub.map_clickable_tipclear();
var div_id = 'tip_o_' + data.uid;
html = '' + html + '
';
// ツールチップを作成
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(data.lat, data.lon), {
html: html,
//size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel(-10, -10)
});
tip.setZindex(itsmo.map.D_TIPZIDX_RANGE + 3);
itsmo.vars.g_map_tipid_clickable_open_uid = data.uid;
itsmo.vars.g_map_tipid_clickable_open = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_tipid_clickable_open);
$("#"+ div_id +" span[class^='List-pic-waku'] img").error(function(){
itsmo.changeNoImageSrc(this);
});
return div_id;
};
//ツールチップclose
itsmo.sub.map_clickable_tipclose = function() {
if(itsmo.vars.g_map_tipid_clickable_open == null) return;
//itsmo.vars.g_map_layer_clickable.hideById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
};
//ツールチップ(大)clear
itsmo.sub.map_clickable_tipclear = function() {
if(itsmo.vars.g_map_tipid_clickable_open == null) return;
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
};
//ツールチップ全部clear
itsmo.sub.map_clickable_TipAllClear = function(flg) {
if(itsmo.vars.g_map_tipid_clickable_open != null){
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
}
if(itsmo.vars.g_map_tipid_clickable_s){
jQuery.each(itsmo.vars.g_map_tipid_clickable_s, function(i,val) {
itsmo.vars.g_map_layer_clickable.removeById(val.tip_id);
});
}
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.vars.g_map_tipid_clickable_open_uid = null;
itsmo.vars.g_map_tipid_clickable_s = {};
// 登録地点チップクリア
itsmo.myspot.myspot_TipAllClear();
if (flg) {
// 自宅チップ最小化
itsmo.mypage.home_closeballoon();
// IPリンクチップ最小化
itsmo.sub.map_maplink_tipclear();
}
itsmo.map.bus.clearAllBalloons();
itsmo.map.roadStation.clearResult();
itsmo.facilityNight.clearAllBalloons();
};
//------------------------------------------------
// overture
//------------------------------------------------
itsmo.vars.g_map_overture_moved = 9999999;
itsmo.sub.map_overture = function() {
// 表示用のスペースがテンプレに無い場合は処理しない
if($('#ajax_map_overture_header').length <= 0) return;
if(itsmo.vars.g_map_search_location_old != null) {
itsmo.vars.g_map_overture_moved += itsmo.lib.getDistance2(
itsmo.vars.g_map_search_location_old.lat, itsmo.vars.g_map_search_location_old.lon,
itsmo.vars.g_map_search_location.lat, itsmo.vars.g_map_search_location.lon);
}
if(itsmo.vars.g_map_overture_moved < 999000) {
// 表示
if(zSr != null && (itsmo.vars.g_map_overture_type == 'mapDef' || itsmo.vars.g_map_overture_type == 'mapContents')) {
if(zSr.length > 6) {
var descr = zSr[ 6]; // 説明文
var unused1 = zSr[ 7]; //
var clickURL = zSr[ 8]; // クリックURL
var title = zSr[ 9]; // タイトル
var sitehost = zSr[10]; // 表示URL
var unused2 = zSr[11]; //
// 表示
var e = $('#ajax_map_overture_header div.map_header-over');
e.find('a:first').attr('href', clickURL);
e.find('span.over-title:first').html(title);
e.find('span.over-des:first').html(descr);
$('#ajax_map_overture_header div.map_header2').show();
/*
tmp = ''
itsmo.lib.document_setvalue('ajax_map_overture_header',tmp);
itsmo.lib.document_on('ajax_map_over_div');
*/
}
itsmo.vars.g_map_overture_type = null;
}
} else {
// 更新
itsmo.vars.g_map_overture_moved = 0;
itsmo.sub.map_getaddr(itsmo.vars.g_map_search_location, function(result) {
if(result.status == 0) {
itsmo.sub.map_overture_request(null,result.items[0].addrCode,1,'mapDef');
} else {
itsmo.sub.map_overture_request(null,'00',1,'mapDef');
}
setTimeout(itsmo.sub.map_overture, 1 * 1000);
},1);
}
};
// 通信メイン処理
itsmo.vars.g_map_overture_obj = null;
itsmo.vars.g_map_overture_type = null;
var zSr = null;
itsmo.sub.map_overture_request = function(word,id,cnt,type) {
itsmo.vars.g_map_overture_type = type;
// 通信先作成
js = '//im.ov.yahoo.co.jp/js_flat/?source=zenrin_jp_itsumo_im&outputCharEnc=utf8&keywordCharEnc=utf8';
js += "&ctxtUrl="+encodeURI(document.URL);
if(document.referrer) js += "&ref="+encodeURI(document.referrer);
if(word != null) js += "&ctxtKeywords="+encodeURI(word);
if(id != null) js += "&ctxtId=ad"+id;
js += "&maxCount="+cnt;
js += "&type="+itsmo.vars.g_map_overture_type;
// json
if(itsmo.vars.g_map_overture_obj != null) {
document.getElementsByTagName("head").item(0).removeChild(itsmo.vars.g_map_overture_obj);
delete itsmo.vars.g_map_overture_obj;
}
itsmo.vars.g_map_overture_obj = document.createElement('script');
itsmo.vars.g_map_overture_obj.setAttribute('type', 'text/javascript');
itsmo.vars.g_map_overture_obj.setAttribute('charset', 'utf-8');
itsmo.vars.g_map_overture_obj.setAttribute('src', js);
document.getElementsByTagName('head').item(0).appendChild(itsmo.vars.g_map_overture_obj);
};
// スクロール完了時に im を出す時に呼ぶ関数。
itsmo.sub.map_overture_by_scrollend = function() {
// 住所を取得。
ZDC.Search.getAddrByLatLon({
latlons: [itsmo.lib.toLatLon(itsmo.vars.g_map_search_location)]
}, itsmo.sub.map_overture_by_scrollend_callback);
};
itsmo.sub.map_overture_by_scrollend_callback = function(status, result) {
if (status.code == '000' && result.length >= 1) {
} else {
return;
}
// 取得成功
var pref = '0', addr = '';
pref = result[0].address.code;
addr = result[0].address.text;
s = '0000' + parseInt(pref.substring(0, 5), 10);
s = s.substring(s.length - 5);
var id = 'ad' + s;
var type = 'mapDef';
var freewd = '';
var num = 1;
var url = itsmo.ad.make_im_url(num, freewd, id, type);
$.ajax({
type: "GET",
url: url,
cache: false,
dataType: "jsonp",
async: false,
timeout: 60000,
error: function(xhr, textStatus, errorThrown) {
// TODO:エラーの場合のログは?
},
success: itsmo.sub.map_overture_set
});
};
itsmo.sub.map_overture_set = function(json) {
var e = $('#ajax_map_overture_header div.map_header-over');
json = json['Results']['ResultSet'];
e.find('a:first').attr('href', json['Listing'][0]['ClickUrl']);
e.find('span.over-title:first').text(json['Listing'][0]['title']);
e.find('span.over-des:first').text(json['Listing'][0]['description']);
e.find('a.over-right-link:first').attr('href', json['Label']['InquiryUrl']).text(json['Label']['LabelText']);
$('#ajax_map_overture_header div.map_header2').show();
};
//------------------------------------------------
// 選択カーソル設置
//------------------------------------------------
itsmo.vars.g_map_setcursor_id = null;
itsmo.vars.g_map_setcursor_lat = null;
itsmo.vars.g_map_setcursor_lon = null;
itsmo.vars.g_map_setcursor_icon = null;
itsmo.sub.map_setcursor = function(lat,lon,icon) {
if(icon == null) icon = 'link02';
if(itsmo.vars.g_map_setcursor_id != null) itsmo.vars.g_map_layer_vics.removeById(itsmo.vars.g_map_setcursor_id);
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
itsmo.vars.g_map_setcursor_icon = icon;
var html = '
';
$pixX = -11;
$pixY = -30;
// 「ここ」アイコン画像サイズ変更に伴い、オフセット値調整
// (link02のみの対応、他タイプは従来通り-11,-30のオフセット) 2013/08/30 konishi
if (icon == 'link02') {
$pixX = -13;
$pixY = -32;
}
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(lat, lon), {
html: html,
size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel($pixX, $pixY)
});
itsmo.vars.g_map_setcursor_id = itsmo.vars.g_map_layer_vics.add(tip);
itsmo.vars.g_map_layer_vics.showById(itsmo.vars.g_map_setcursor_id);
};
//------------------------------------------------
// エリアマッチ広告
//------------------------------------------------
itsmo.sub.map_ad_areamatch_cookie_key = 'no_areamatch';
itsmo.sub.map_ad_areamatch = function() {
var s = itsmo.lib.cookie_get(itsmo.sub.map_ad_areamatch_cookie_key);
var is_visible = $('#id_area_match').is(':visible');
if ('1' == s && is_visible) {
is_visible = false;
itsmo.sub.map_ad_areamatch_close(true);
}
if (!is_visible) {
return false;
}
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var prm = 'mode=ad_areamatch_wide&lat='+loc.lat+'&lon='+loc.lon;
itsmo.lib.XMLHttpRequest2_send('/map/ajax.php',itsmo.sub.map_ad_areamatch_result,'GET',prm);
};
itsmo.sub.map_ad_areamatch_result = function(result) {
var err = $('err', result).text();
if (!err) {
//return;
}
txt = $('name',result).text();
copy = $('copy',result).text();
img = $('imgfile',result).text();
url = $('url',result).text();
var e = $('#id_area_match');
var f = e.find('div');
e.find('a:first').attr('href', url);
e.find('img:first').attr('src', img);
if (copy.length <= 0) {
f.hide();
e.find('strong').text('');
e.find('span.font-gray2').text(txt);
} else {
f.show();
e.find('strong').text(txt);
e.find('span.font-gray2').text(copy);
}
};
itsmo.sub.map_ad_areamatch_close = function(no_cookie) {
if (true == no_cookie) {
} else {
itsmo.lib.cookie_set(itsmo.sub.map_ad_areamatch_cookie_key, '1', 24 * 60 * 60);
}
$('#id_area_match_closed').show();
$('#id_area_match').hide();
return false;
};
itsmo.sub.map_ad_areamatch_open = function() {
itsmo.lib.cookie_del(itsmo.sub.map_ad_areamatch_cookie_key);
$('#id_area_match_closed').hide();
$('#id_area_match').show();
itsmo.sub.map_ad_areamatch(); // 再取得
return false;
}
// ホットスポット広告
itsmo.sub.map_ad_hotspot = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var prm = 'lat='+loc.lat+'&lon='+loc.lon;
itsmo.lib.XMLHttpRequest2_send('/map/ajax_ad_hotspot.php', itsmo.sub.map_ad_hotspot_result, 'GET', prm);
};
itsmo.sub.map_ad_hotspot_result = function(result) {
result = $(result);
var err = parseInt(result.find('err').text());
if (0 != err) {
return;
}
result = result.find('ad');
if (result.length <= 0) {
return;
}
var f = $('#ajax_ad_hotspot_keyword').show().find('div.List-coL-link span:gt(0)').hide();
var cnt = 0;
result.each(function() {
var n = cnt++;
if (n < f.length) {
} else {
return;
}
var s = $(this).text();
f.eq(n).show().find('a').text(s);
});
};
//------------------------------------------------
// おススメ情報
//------------------------------------------------
itsmo.vars.osusume_word = '';
itsmo.sub.map_osusume_search = function(shoki_flg,word,cnt,page) {
if ('10.dev-2nd.local' == location.hostname) {
return;
}
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var prm = 'mode=osusume&lat='+loc.lat+'&lon='+loc.lon;
itsmo.sub.backBtnChangeHash(['osusume', shoki_flg ? 1 : 0, word, cnt, page]);
if(word){
prm = prm + '&word='+encodeURIComponent(word);
}
if(shoki_flg){
prm = prm + '&shoki_flg=1';
}else{
itsmo.lib.map_waitopen();
}
//if(cnt){ prm = prm + '&cnt=' + cnt; }
//if(page){ prm = prm + '&page=' + page; }
itsmo.lib.XMLHttpRequest2_send('/map/ajax.php',itsmo.sub.map_osusume_search_result,'GET',prm);
};
itsmo.sub.map_osusume_search_result = function(result) {
var err = $('err', result).text();
if (err != null) {
//return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear();
//html
if($(result).find('left_html').text()){
itsmo.sub.map_tab_change('range');
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml($('left_html', result).text());
itsmo.vars.g_range_genre = 'osusume';
// インタレストマッチ広告を挿入
itsmo.sub.map_getaddr(itsmo.vars.g_map_search_location, itsmo.range.im_getaddr, 1);
}
var set_tip = function (){
//param
var prm = {};
prm['uid'] = $(this).find('uid').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['gnr_nm'] = 'おすすめ情報';
prm['short_nm'] = $(this).find('short_nm').text()
prm['img'] = $(this).find('imgurl').text();
prm['url'] = $(this).find('url').text();
prm['iconL'] = $(this).find('iconL').text();
prm['iconM'] = $(this).find('iconM').text();
prm['iconS'] = $(this).find('iconS').text();
prm['tip_c'] = $(this).find('tip_c').text();
prm['tip_o'] = $(this).find('tip_o').text();
//ツールチップ作成
var div_id = itsmo.sub.set_tooltip_s(prm['tip_c'],prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.sub.map_osusume_tip_open(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.sub.map_osusume_tip_open(prm.uid);
});
};
//チップ作成
$(result).find('item').each(set_tip);
};
//おすすめ情報中吹き出し
itsmo.sub.map_osusume_tip_open = function(uid) {
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
if(!data){ return false; }
var div_id = itsmo.sub.map_clickable_tipopen(data.tip_o,data);
};
//おすすめ情報パカパカ
itsmo.sub.map_osusumeWindow = function(word){
if(word){
itsmo.vars.osusume_word = word;
$('#osusume_word').text(word);
}
$('#ajax_facet_gnr1_div').toggle();
};
//------------------------------------------------
// ナビ起動
//------------------------------------------------
itsmo.sub.map_linknavi = function() {
var url_prm = "/lib/itsmonavi/its-mo_ext_IF/its-mo_ext_IF.htm?cocd=00¶m1=2&datum=tokyo&unit=msec&point1=";
url_prm += itsmo.vars.g_map_search_box.minx + "/" + itsmo.vars.g_map_search_box.miny + "&point2=";
url_prm += itsmo.vars.g_map_search_box.maxx + "/" + itsmo.vars.g_map_search_box.maxy + "&icon=0&seach=0";
window.open(url_prm,"skin","width=586,height=623,toolbar=0,location=0,status=0,menubar=0,scrollbars=yes,resizable=yes");
return;
};
//------------------------------------------------
// メニュータブの制御
//------------------------------------------------
itsmo.sub.map_syuhen_change = function(mode) {
// 変更
switch(mode) {
case 'max':
itsmo.lib.document_on('ajax_map_syuhen_max');
itsmo.lib.document_off('ajax_map_syuhen_min');
break;
case 'min':
itsmo.lib.document_off('ajax_map_syuhen_max');
itsmo.lib.document_on('ajax_map_syuhen_min');
break;
}
};
//------------------------------------------------
// メニュータブの制御
//------------------------------------------------
itsmo.vars.g_map_tab_mode = 'top';
itsmo.vars.g_map_tab_backBtnFuncNoAdd = false;
itsmo.sub.map_genre = function() {
itsmo.range.range_tipclear();
itsmo.myspot.myspot_clearballoon();
itsmo.sub.genre_research_clear();
itsmo.sub.map_tab_change('top');
$("#ajax_scrollable_4").height((itsmo.vars.g_windowHeight - itsmo.vars.PAGE_HEADER_HEIGHT - itsmo.vars.MAP_HEADER_HEIGHT));
};
itsmo.sub.map_tab_change = function(mode, nostop, backBtnFunc) {
// nostop=1:ジャンルクリアしない
if (typeof nostop == 'function' || nostop instanceof Array) {
backBtnFunc = nostop;
nostop = false;
} // 地点変更のイベント初期化
if (typeof backBtnFunc == 'undefined') {
backBtnFunc = null;
}
//itsmo.myspot.chengeClickMap();
var isShowRouteSearch = false;
if (itsmo.vars.g_myroute_cnt == 0){
itsmo.vars.routeSearchResultKeep = 0;
}else{
itsmo.vars.routeSearchResultKeep = 1;
}
// 変更
switch(mode) {
case 'top':// TOP
// リスト
itsmo.lib.document_on('ajax_near');
itsmo.lib.document_off('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
$('.map-gunre-midle').hide();
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-df');
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_df');
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
backBtnFunc = ['top'];
break;
case 'range':// 周辺検索
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-'+mode);
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_'+mode);
//myspot_clear();
break;
case 'facnum':
case 'busDetail':
case 'michinoeki':
case 'bus':
case 'freeword'://フリーワード
case 'freewordaddr'://フリーワード
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-'+mode);
break;
case 'mypage':// マイページ
case 'myspot':// 登録地点
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','');
itsmo.lib.document_class('ajax_menu-my','act');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
if (mode == 'mypage') {
// マイページデータ設定
itsmo.mypage.mypage();
} else if (mode == 'myspot') {
// 登録地点データ設定
itsmo.myspot.myspot_listget();
}
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
break;
case 'addrlist':// 位置検索
// リスト
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_on('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','act');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-df');
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_df');
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
break;
case 'route':
itsmo.lib.document_off('ajax_near');
itsmo.lib.document_off('ajax_leftmenu_result');
itsmo.lib.document_on('ajax_leftmenu_route');
isShowRouteSearch = true;
// タブ
itsmo.lib.document_class('ajax_menu-tp','');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','act');
break;
default:
// リスト
itsmo.lib.document_on('ajax_near');
itsmo.lib.document_off('ajax_leftmenu_result');
itsmo.lib.document_off('ajax_leftmenu_route');
// タブ
itsmo.lib.document_class('ajax_menu-tp','act');
itsmo.lib.document_class('ajax_menu-my','');
itsmo.lib.document_class('ajax_menu-add','');
itsmo.lib.document_class('menu-route-search','');
// 他
itsmo.lib.document_class('m-left','m-left-df');
//itsmo.lib.document_class('ajax_map_overture_header','map_header map_over_df');
// その他
if (nostop) {
itsmo.range.range_tipclear();
} else {
itsmo.range.range_stop();
}
break;
}
if(!isShowRouteSearch){
if (itsmo.vars.routeSearchResultKeep == 0){
//Clear Route
itsmo.vars.g_myroute_panel_isvisible = 1;
itsmo.vars.g_route_tab_displayed = 0;
itsmo.myroute.showRoutePanel();
}
} else {
if(itsmo.vars.g_route_tab_displayed == 0){
if(itsmo.vars.routeKeep == 0){
itsmo.myroute.myroute_panel_change('close');
itsmo.vars.g_myroute_panel_isvisible = 0;
itsmo.myroute.showRoutePanel();
itsmo.vars.g_myroute_mode = '';
}
itsmo.vars.g_route_tab_displayed = 1;
itsmo.vars.routeKeep = 0;
if (backBtnFunc.length < 2 || backBtnFunc[1] == 'car'){
itsmo.myroute.myroute_car();
} else {
itsmo.myroute.myroute_all();
}
}
}
if (null == backBtnFunc && itsmo.vars.g_map_tab_mode != mode) {
backBtnFunc = function() {
itsmo.sub.map_tab_change(mode, nostop);
};
}
itsmo.vars.g_map_tab_mode = mode;
// 戻るボタン対応
do {
if (typeof backBtnFunc === 'undefined' || null == backBtnFunc) {
break;
}
if (typeof backBtnFunc.flgNoAdd !== 'undefined' && backBtnFunc.flgNoAdd) {
break;
}
if (itsmo.vars.g_map_tab_backBtnFuncNoAdd) {
break;
}
itsmo.sub.backBtnChangeHash(backBtnFunc);
} while(false);
};
itsmo.sub.map_tab_sethtml = function(html) {
itsmo.lib.document_setvalue('ajax_leftmenu_result', html);
$('#ajax_leftmenu_result .List-pic-waku img').error(function(){
itsmo.changeNoImageSrc(this);
});
itsmo.map.setLeftContentSize();
itsmo.ad.im_init();
};
itsmo.sub.map_tab_freewd_blur = function() {
itsmo.layout.freewordBlur('freewd','df');
};
itsmo.sub.map_tab_freewd_onfocus = function() {
itsmo.layout.freewordFocus('freewd','df');
};
/** 戻るボタン対応 */
itsmo.sub.backBtnChangeHash = function(args) {
if (null == args || args.length <= 0) {
return;
}
var s = '#' + args.shift();
$.each(args, function(i, v) {
if (typeof v == 'undefined') {
v = '';
} else {
if(itsmo.vars.g_map_tab_mode!="busDetail"){
v = encodeURIComponent('' + v);
}else{
v = decodeURIComponent('' + v);
}
}
s += ',' + v;
});
window.location.hash = s;
};
itsmo.sub.onHashChange = function(ev) {
itsmo.lib.XMLHttpRequest2_abortLast();
itsmo.lib.map_waitclose();
var cmd = 'top';
var s = window.location.hash;
if (s.length <= 0) {
} else {
s = s.substring(1);
s = s.split(',');
cmd = s.shift();
}
s = $.map(s, function(v, i) {
return decodeURIComponent(v);
});
itsmo.vars.g_map_tab_backBtnFuncNoAdd = true;
var ret = false;
switch (cmd) {
case 'top':
itsmo.sub.backBtnTop();
break;
case 'addrlist':
itsmo.sub.backBtnAddrlist(s);
break;
case 'hostspot':
itsmo.sub.backBtnHostspot(s);
break;
case 'freeword':
itsmo.sub.backBtnFreeword(s);
break;
case 'freewordaddr':
itsmo.sub.backBtnFreewordAddr(s);
break;
case 'mypage':
itsmo.sub.backBtnMypage(s);
break;
case 'myroute':
itsmo.sub.backBtnMyroute(s);
break;
case 'myspot':
itsmo.sub.backBtnMyspot(s);
break;
case 'baitoru':
itsmo.sub.backBtnBaitoru(s);
break;
case 'season':
itsmo.sub.backBtnSeason(s);
break;
case 'suumo':
itsmo.sub.backBtnSuumo(s);
break;
case 'tabikura':
itsmo.sub.backBtnTabikura(s);
break;
case 'spotDetail':
itsmo.sub.backBtnSpotDetail(s);
break;
case 'addrDetail':
itsmo.sub.backBtnAddrDetail(s);
break;
case 'osusume':
itsmo.sub.backBtnOsusume(s);
break;
case 'genre':
itsmo.sub.backBtnGenre(s);
break;
case 'new_building':
itsmo.sub.backBtnNewBuilding(s);
break;
case 'route':
itsmo.sub.backBtnRoute(s);
break;
case 'bus':
itsmo.sub.backBtnBusRoute(s);
break;
case 'michinoeki':
itsmo.sub.backBtnRoadStation(s);
break;
case 'busDetail':
itsmo.sub.backBtnBusDetail(s);
break;
case 'facnum':
itsmo.sub.backBtnFacnum(s);
default:
ret = true;
break;
}
itsmo.vars.g_map_tab_backBtnFuncNoAdd = false;
};
itsmo.sub.backBtnTop = function(args) {
itsmo.sub.map_genre();
};
//addrlist,pageType, adcd, rlat, rlon, radcd
itsmo.sub.backBtnAddrlist = function(args) {
if (args.length == 5) {
itsmo.addrlist.showPage(args[0], args[1], args[2], args[3], args[4]);
}
};
//hostspot,freeword
itsmo.sub.backBtnHostspot = function(args) {
if (args.length == 1) {
itsmo.ad.hotspot.search(args[0]);
}
};
//freeword,mode,word
itsmo.sub.backBtnFreeword = function(args) {
if (args.length == 2) {
itsmo.vars.g_range_spots_drawin = false;
itsmo.freeword.freeword(args[0], args[1]);
} else if(args.length == 3 && args[1] == BUS_SEARCH_KEYWORD){ //bus around from facility detail
itsmo.vars.g_range_spots_drawin = false;
itsmo.freeword.freeword(args[0], args[1], args[2]);
}
};
//freeword addr,word
itsmo.sub.backBtnFreewordAddr = function(args) {
if (args.length == 2) {
itsmo.vars.g_range_spots_drawin = false;
itsmo.freeword.freeword_other(args[1]);
}
};
//mypage,mode,word,page
itsmo.sub.backBtnMypage = function(args) {
itsmo.mypage.mypage(args[0]);
};
//myroute,id
itsmo.sub.backBtnMyroute = function(args) {
if (args.length == 1) {
itsmo.myroute.myroute_open(args[0]);
}
};
//myspot
itsmo.sub.backBtnMyspot = function(args) {
if (args.length == 1) {
//myspot,p
itsmo.myspot.myspot_disp(args[0]);
} else if (args.length == 3) {
//myspot,id,fid,gid
itsmo.myspot.myspot_open(args[0], args[1], args[2]);
}
};
//baitoru
itsmo.sub.backBtnBaitoru = function(args) {
itsmo.near_baitoru.start();
};
//season,mode
itsmo.sub.backBtnSeason = function(args) {
itsmo.near_season.start(args[0]);
};
//suumo
itsmo.sub.backBtnSuumo = function(args) {
itsmo.near_suumo.start(args);
};
//tabikura
itsmo.sub.backBtnTabikura = function(args) {
itsmo.tabikura.start();
};
//spotDetail,uid,nm,action
itsmo.sub.backBtnSpotDetail = function(args) {
if (args.length == 3) {
itsmo.spot_range.detail_spot(args[0], args[1], args[2]);
}
};
//addrDetail,path,adcd
itsmo.sub.backBtnAddrDetail = function(args) {
if (args.length == 2) {
itsmo.spot_range.detail_addr(args[0], args[1]);
}
};
// osusume,shoki_flg,word,cnt,page
itsmo.sub.backBtnOsusume = function(args) {
itsmo.sub.map_osusume_search(parseInt(args[0], 10), args[1], args[2], args[3]);
};
// genre, genre, topGenreName, genreName
itsmo.sub.backBtnGenre = function(args) {
itsmo.range.range(args[0], args[1], args[2]);
};
itsmo.sub.backBtnNewBuilding = function(args) {
itsmo.near_new_building.start();
};
itsmo.sub.backBtnRoute = function(args){
if (args.length < 1){
itsmo.myroute.routeTop('car');
} else {
itsmo.myroute.routeTop(args[0]);
}
};
itsmo.sub.backBtnBusRoute = function (args){
if (args.length == 2){
itsmo.map.bus.busRouteSearch(args[0], args[1]);
}
};
itsmo.sub.backBtnRoadStation = function (args){
if (args.length == 2){
itsmo.map.roadStation.initSearch(args[0], args[1]);
}
};
itsmo.sub.backBtnBusDetail = function (args){
if (args.length == 2){
itsmo.map.bus.makeDetailBus(args[0], args[1]);
}
};
itsmo.sub.backBtnFacnum = function (args){
if (itsmo.facilityNight.vars.noResearch == false){
itsmo.facilityNight.initFacility();
itsmo.facilityNight.getFacilities();
} else {
itsmo.facilityNight.vars.noResearch = false;
}
};
//------------------------------------------------
// 色々なイベント
//------------------------------------------------
// マウス位置保持 --------------------------------
itsmo.vars.g_map_mouse_x = 0;
itsmo.vars.g_map_mouse_y = 0;
document.onmousemove = function(e) {
if (document.all) {
if ( null != window && undefined != window
&& null != document.body && undefined != document.body
&& null != window.event && undefined != window.event
){
itsmo.vars.g_map_mouse_x = window.event.clientX + document.body.scrollLeft;
itsmo.vars.g_map_mouse_y = window.event.clientY + document.body.scrollTop;
}
} else {
itsmo.vars.g_map_mouse_x = e.clientX;
itsmo.vars.g_map_mouse_y = e.clientY;
}
};
// 貼り付けマップ
itsmo.sub.map_linklink = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/link.php?';
url += 'lat='+loc.lat+'&lon='+loc.lon+'&lvl='+itsmo.vars.g_map_obj.getZoom();
window.open(url,null);
};
// 住宅地図の購入
itsmo.sub.ajax_mapjmapopen = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/jmap.php?lat='+loc.lat+'&lon='+loc.lon;
$('#ajax_map_window_jmap_book').attr('href' , url + '&mode=book');
$('#ajax_map_window_jmap_download').attr('href' , url+'&mode=download');
var url = 'http://mobile.znet-town.net/jmap/jmap.html?scd=00002&an='+loc.lat+'&ae='+loc.lon+'&geo=tokyo';
$('#ajax_map_window_jmap_mqr').attr('src',itsmo.vars.d_qrimg_url+'?d='+encodeURIComponent(url));
$('#ajax_map_window_jmap_mtext').val(url);
$('#ajax_map_window_jmap_mmail').attr('href','mailto:?BODY='+encodeURIComponent(url));
url = 'http://zapl.znet-town.net/znettownm/sp/naviweb.php?cpid=0002&ref=53&lon='+loc.lon+'&lat='+loc.lat;
$('#ajax_map_window_jmap_smpqr').attr('src',itsmo.vars.d_qrimg_url+'?d='+encodeURIComponent(url));
$('#ajax_map_window_jmap_smptext').val(url);
$('#ajax_map_window_jmap_smpmail').attr('href','mailto:?BODY='+encodeURIComponent(url));
$('#ajax_map_window_jmap_addr').text('住所取得中...');
itsmo.sub.map_getaddr(loc,function(result) {
if(result.status == 0) {
$('#ajax_map_window_jmap_addr').text(result.items[0].address);
} else {
$('#ajax_map_window_jmap_addr').text('住所なし');
}
},6);
itsmo.lib.map_windowopen('ajax_map_window_jmap');
$('#ajax_map_window_jmap .komado-box-w').scrollTop(0);
};
// IPリンク吹き出し作成
itsmo.vars.g_map_link_html_o = null;
itsmo.vars.g_map_link_tipid_c = null;
itsmo.vars.g_map_link_tipid_o = null;
itsmo.sub.maplink_set = function(lat, lon, icon)
{
// ココアイコンのみ作成
itsmo.sub.maplink_tipicon(lat, lon, icon);
if (!itsmo.vars.g_map_link_html_o) {
itsmo.vars.g_map_link_html_o = $('#maplink_tipo_html').html();
}
// 吹き出し+ココアイコン作成
// itsmo.sub.maplink_tipopen(lat, lon, icon, flg);
};
// ココアイコンのみ作成(小吹き出し)
itsmo.sub.maplink_tipicon = function(lat, lon, icon) {
if (icon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
itsmo.vars.g_map_setcursor_icon = 'link02';
} else {
if (lat && lon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
} else {
lat = itsmo.vars.g_map_setcursor_lat;
lon = itsmo.vars.g_map_setcursor_lon;
}
itsmo.vars.g_map_setcursor_icon = 'link02';
}
var html = $('#maplink_tipc_html').html();
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(lat, lon), {
html: html,
size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel(-12, -34)
});
tip.setZindex(itsmo.map.D_TIPZIDX_MAPLINK);
itsmo.vars.g_map_link_tipid_c = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_link_tipid_c);
};
// 吹き出し+ココアイコン作成(中吹き出し)
itsmo.sub.maplink_tipopen = function(lat, lon, icon) {
itsmo.map.cancelMapClickEvent();
// itsmo.sub.map_maplink_tipclear();
// 吹き出しデータ設定
if (icon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
itsmo.vars.g_map_setcursor_icon = 'link02';
} else {
if (lat && lon) {
itsmo.vars.g_map_setcursor_lat = lat;
itsmo.vars.g_map_setcursor_lon = lon;
} else {
lat = itsmo.vars.g_map_setcursor_lat;
lon = itsmo.vars.g_map_setcursor_lon;
}
itsmo.vars.g_map_setcursor_icon = 'link02';
}
// ツールチップ作成
// var html = $('#maplink_tipo_html').html();
var html = itsmo.vars.g_map_link_html_o;
html = '' + html + '
';
var point = itsmo.lib.toLatLon(lat, lon);
var size = itsmo.sub.getHtmlSize(html);
var tip = new ZDC.UserWidget(point, {
html: html,
size: size,
offset: new ZDC.Pixel(-162, -(size.height) + 6)
});
tip.setZindex(itsmo.map.D_TIPZIDX_MAPLINK);
itsmo.vars.g_map_link_tipid_o = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_link_tipid_o);
// if (flg) itsmo.sub.maplink_tipclose();
};
// IPリンク吹き出しclose
itsmo.sub.maplink_tipclose = function()
{
itsmo.map.cancelMapClickEvent();
// itsmo.vars.g_map_layer_clickable.hideById(itsmo.vars.g_map_link_tipid_o);
itsmo.sub.map_maplink_tipclear();
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_link_tipid_c);
};
// IPリンク吹き出しclear
itsmo.sub.map_maplink_tipclear = function() {
if(itsmo.vars.g_map_link_tipid_o == null) return;
itsmo.map.cancelMapClickEvent();
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_link_tipid_o);
itsmo.vars.g_map_link_tipid_o = null;
};
// IPリンク アイコン+吹き出し Allclear
itsmo.sub.map_maplink_tipallclear = function() {
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_link_tipid_c);
itsmo.vars.g_map_link_tipid_c = null;
itsmo.vars.g_map_link_html_o = null;
itsmo.sub.map_maplink_tipclear();
};
// IPリンク吹き出し作成(住所系)
itsmo.sub.set_maplink_pre = function(name, addr, lat, lon, zipcode)
{
var sethtml_balo = $('#maplink_tipo_html');
sethtml_balo.find('#maplink-addr').html(addr);
sethtml_balo.find('#maplink-zipcode').html('〒' + zipcode);
//route
// 2017/04/12 Phuoc Le - #8434 Add dataLayer
var gaPre = "dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_";
var gaPost = "_ここアイコン']); return false;"
var jsStart = "itsmo.vars.g_myroute_eventFlg=true;itsmo.myroute.hereStart('" + addr + "', {lat:" + lat + ",lon:" + lon + "});itsmo.sub.map_maplink_tipclear();"
var jsGoal = "itsmo.vars.g_myroute_eventFlg=true;itsmo.myroute.hereGo('" + addr + "', {lat:" + lat + ",lon:" + lon + "});itsmo.sub.map_maplink_tipclear();"
var jsStopOver = "itsmo.vars.g_myroute_eventFlg=true;itsmo.myroute.hereByway('" + addr + "', {lat:" + lat + ",lon:" + lon + "});itsmo.sub.map_maplink_tipclear();"
sethtml_balo.find('#maplink-here-start').attr('onclick', jsStart + gaPre + 'Start' + gaPost);
sethtml_balo.find('#maplink-here-go').attr('onclick', jsGoal + gaPre + 'Goal' + gaPost);
sethtml_balo.find('#maplink-here-stopover').attr('onclick', jsStopOver + gaPre + 'StopOver' + gaPost);
//share
var jsShare = "itsmo.map.Sharing.getInstance().show(" + lat + "," + lon + ",'" + name + "','" + addr + "');"
sethtml_balo.find('#maplink-share').attr('onclick', jsShare);
// 登録
var click_js = sethtml_balo.find('#maplink-reg').attr('onclick');
var arr_click_js = click_js.split(';');
$.each(arr_click_js, function (key, val) {
if (val.indexOf('other_addmyspot') > 0) {
click_js = "itsmo.myspot.other_addmyspot(" + lat + ", " + lon + ", '" + addr + "', '', '', '', '', '0000000000','','','',true)";
arr_click_js[key] = click_js;
return false;
}
});
click_js = arr_click_js.join(';');
sethtml_balo.find('#maplink-reg').attr('onclick', click_js);
// reg home
var click_js = sethtml_balo.find('#maplink-home').attr('onclick');
var arr_click_js = click_js.split(';');
$.each(arr_click_js, function (key, val) {
if (val.indexOf('home_add') > 0) {
click_js = "itsmo.mypage.mypage('home_add', {lat: " + lat + ", lon: " + lon + "});";
arr_click_js[key] = click_js;
return false;
}
});
click_js = arr_click_js.join(';');
sethtml_balo.find('#maplink-home').attr('onclick', click_js);
itsmo.vars.g_map_link_html_o = sethtml_balo.html();
itsmo.sub.maplink_set(lat, lon);
};
// 地図最適化用アイコン作成(小吹き出し)
itsmo.sub.set_tooltip_opt_s = function(tipHtml, data) {
var uid = data.uid;
var div_id = 'tip_c_' + uid;
tipHtml = '' + tipHtml + '
';
var sz = new ZDC.WH(22, 34);
var offset = new ZDC.Pixel(-12, -34);
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(data.lat, data.lon), {
html: tipHtml,
size: sz,//itsmo.sub.getHtmlSize(tipHtml),
offset: offset
});
tip.setZindex(itsmo.map.D_TIPZIDX_RANGE);
data.noHideTip = true;
data.tip_id = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_tipid_clickable_s[uid] = data;
itsmo.vars.g_map_layer_clickable.showById(data.tip_id);
return div_id;
};
// 吹き出し+地図最適化用アイコン作成(中吹き出し)
itsmo.vars.g_map_tipid_clickable_open = null;
itsmo.sub.map_clickable_tipopen_opt = function(html, data) {
// 中吹き出し削除
var s = itsmo.vars.g_map_layer_clickable.get(itsmo.vars.g_map_tipid_clickable_open);
if (s && s.content) {
var close_tip_id = $(s.content.html).attr('id');
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
close_tip_id = close_tip_id.slice(6);
var close_data = itsmo.vars.g_map_tipid_clickable_s[close_tip_id];
// 小吹き出し表示
itsmo.vars.g_map_layer_clickable.showById(close_data.tip_id);
}
var div_id = 'tip_o_' + data.uid;
html = '' + html + '
';
// ツールチップ作成
var sz = itsmo.sub.getHtmlSize(html);
var offset = new ZDC.Pixel(-12, -34);
if (typeof data.tooltipOffset !== 'undefined') {
offset = data.tooltipOffset;
} else if (typeof data.tooltipOffsetBottomCenter !== 'undefined') {
offset = new ZDC.Pixel(-sz.width / 2 + data.tooltipOffsetBottomCenter[0], -sz.height + data.tooltipOffsetBottomCenter[1]);
} else {
offset.x = -sz.width / 2 + 18;
offset.y -= sz.height;
}
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(data.lat, data.lon), {
html: html,
size: sz,
offset: offset
});
tip.setZindex(itsmo.map.D_TIPZIDX_RANGE + 3);
itsmo.vars.g_map_tipid_clickable_open = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_tipid_clickable_open);
if (data.tip_id) {
if (data.noHideTip) {
} else {
itsmo.vars.g_map_layer_clickable.hideById(data.tip_id);
}
}
// bind
$('#' + div_id + ' a.icon-koko-pink').click(function() {
itsmo.sub.set_tooltip_aroundclose(data.tip_id);
});
// bind
$('#' + div_id + ' a.btn-close').click(function() {
itsmo.sub.set_tooltip_aroundclose(data.tip_id);
});
$("#"+ div_id +" span[class^='List-pic-waku'] img").error(function(){
itsmo.changeNoImageSrc(this);
});
};
// 地図最適化用周辺アイコン作成(小吹き出し)
itsmo.sub.set_tooltip_around = function(tipHtml, data) {
var clat = data.lat;
var clon = data.lon;
var uid = data.uid;
var div_id = 'tip_c_' + uid;
tipHtml = '' + tipHtml + '
';
var sz = new ZDC.WH(18, 26);
var offset = new ZDC.Pixel(-9, -23);
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(clat, clon), {
html: tipHtml,
size: sz,
offset: offset
});
var id = itsmo.vars.g_map_layer_clickable.add(tip);
data['tip_id'] = id;
itsmo.vars.g_map_tipid_clickable_s[uid] = data;
itsmo.vars.g_map_layer_clickable.showById( id );
return div_id;
};
// 地図最適化用周辺アイコン ツールチップclose
itsmo.sub.set_tooltip_aroundclose = function(tip_id) {
if(itsmo.vars.g_map_tipid_clickable_open == null) return;
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_layer_clickable.showById(tip_id);
itsmo.vars.g_map_tipid_clickable_open = null;
};
//------------------------------------------------
// クリック地図
//------------------------------------------------
itsmo.sub.map_clickopen = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/mapclick.htm?';
url += 'lat='+loc.lat+'&lon='+loc.lon+'&lvl='+itsmo.vars.g_map_obj.getZoom();
if(itsmo.vars.g_map_setcursor_lat) url += '&slat='+itsmo.vars.g_map_setcursor_lat
+'&slon='+itsmo.vars.g_map_setcursor_lon
+'&sicn='+itsmo.vars.g_map_setcursor_icon;
location.href = url;
};
//------------------------------------------------
// 英字地図
//------------------------------------------------
itsmo.sub.map_engopen = function() {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
var url = '/map/mapeng.htm?';
url += 'lat='+loc.lat+'&lon='+loc.lon+'&lvl='+itsmo.vars.g_map_obj.getZoom();
window.open(url,null);
};
//------------------------------------------------
// 印刷
//------------------------------------------------
itsmo.sub.map_printopen = function() {
var url = 'https://biz.its-mo.com' + '/biz/map/?';
var i = itsmo.vars.g_map_search_location;
url += 'lat='+i.lat+'&lon='+i.lon+'&lvl='+itsmo.vars.g_map_search_scale;
window.open(url, '_blank');
};
//------------------------------------------------
// 住宅地図印刷
//------------------------------------------------
itsmo.sub.residential_map_printopen = function(lat,lon) {
var i = itsmo.vars.g_map_search_location;
if(!lat) lat = i.lat;
if(!lon) lon = i.lon;
var url = 'https://biz.its-mo.com' + '/biz/map/fullscreen/?';
url += 'lat='+lat+'&lon='+lon+'&size=A3&color=CD&pageDirection=VT©able=DA&lvl=15';
window.open(url, '_blank');
};
//------------------------------------------------
// 天気
//------------------------------------------------
itsmo.sub.map_weatheropen = function() {
var url='/weather.html?';
var i = itsmo.vars.g_map_search_location;
url += 'lat='+i.lat+'&lon='+i.lon;
window.open(url,null);
};
//------------------------------------------------
// 住所逆引き表示
//------------------------------------------------
itsmo.sub.map_getaddr = function(loc,func,lvl) {
if(!lvl) lvl = 3;
var partsnum = lvl + 1;
loc = itsmo.lib.toLatLon(loc);
ZDC.Search.getAddrByLatLon({
latlons: [loc]
}, function(status, result) {
var items = [];
if ('000' == status.code && result.length >= 1) {
$.each(result, function(i, v) {
if (v.address.parts.length <= partsnum) {
s = v.address.text;
} else {
s = v.address.parts;
s.splice(partsnum);
s = s.join('');
}
items.push({
addrCode: v.address.code,
address: s
});
});
}
var res = {
status: '000' == status.code ? 0 : 2,
recCount: result.length,
hitCount: result.length,
rest: false,
items: items
};
func(res);
});
};
//------------------------------------------------
// 天気表示
//------------------------------------------------
itsmo.sub.map_getweather = function() {
var tenki = new ZdcNearTenki3Hour();
var opts = new ZdcNearTenki3HourOptions();
var i = itsmo.vars.g_map_search_location;
opts.lon = i.lon;
opts.lat = i.lat;
opts.pointFlg = '2';
ZdcEvent.addListener(tenki, 'end', itsmo.sub.map_getweather_result);
tenki.search(opts);
};
itsmo.sub.map_getweather_result = function(result) {
if(result.status != '0') return;
var now = new Date();
var i = Math.floor(now.getHours() / 3) - 2;
if(i < 0) i = 0;
document.getElementById("ajax_weatherimg").src = result.items[i].tenkiIconUrl;
};
//------------------------------------------------
// nextリンク
//------------------------------------------------
itsmo.sub.map_next_open = function() {
var i = itsmo.vars.g_map_search_location;
var url = 'http://zen-in.zenrin.co.jp/?';
url += 'lat='+i.lat+'&lon='+i.lon+'&lvl='+itsmo.vars.g_map_search_scale;
window.open(url,null);
};
//------------------------------------------------
// 再検索リンク設定
//------------------------------------------------
itsmo.sub.set_genre_research = function() {
if(itsmo.vars.g_freeword_beforeMode != 'range'){
return false;
}
if(itsmo.vars.g_freeword_beforeGenre == 'suumo'){
var href = 'itsmo.near_suumo.searchSubmit()';
var genre = 'マンション・不動産物件';
var icL= '09';
var icM= '001';
var icS= '0000';
//} else if(itsmo.vars.g_freeword_beforeGenre == 'osusume') {
// おすすめの再検索
// itsmo.sub.map_osusume_search(null,itsmo.vars.osusume_word);
} else if(itsmo.vars.g_freeword_beforeGenre == 'baitoru') {
// アルバイトの再検索
var href = 'itsmo.near_baitoru.search()';
var genre = 'バイト・お仕事検索';
var icL= '09';
var icM= '003';
var icS= '0002';
} else if(itsmo.vars.g_freeword_beforeGenre == 'tabikura') {
// 旅くらの再検索
var href = 'itsmo.tabikura.search()';
var genre = 'ホテル・旅館プラン検索';
var icL= '09';
var icM= '006';
var icS= '0000';
} else if(itsmo.vars.g_freeword_beforeGenre == itsmo.near_season.mode){
// 季節特集の再検索
var href = 'itsmo.near_season.cond_search()';
switch(itsmo.vars.g_freeword_beforeGenre){
case 'koyo':
var genre = '紅葉情報';
var icL= '09';
var icM= '007';
var icS= '0001';
break;
case 'hanabi':
var genre = '花火大会情報';
var icL= '09';
var icM= '007';
var icS= '0000';
break;
case 'spring':
var genre = '桜情報';
var icL= '09';
var icM= '007';
var icS= '0014';
break;
case 'illumi':
var genre = 'イルミ情報';
var icL= '09';
var icM= '007';
var icS= '0002';
break;
}
} else {
// それ以外の再検索
var href = 'itsmo.range.range_research()';
//var genre = itsmo.vars.g_range_topGenreName;
var prm = 'cd=' + encodeURIComponent(itsmo.vars.g_freeword_beforeGenre);
var func = function(result){
if(result != 'nodata'){
var cd = itsmo.vars.g_freeword_beforeGenre.split(':');
var icL= cd[0].substr(0, 2);
var icM= cd[0].substr(2, 3);
var icS= cd[0].substr(5, 4);
var searchHtml = '';
$('#ajax_leftmenu_result .map-ttl-h1-sect').after( searchHtml );
$('#ajax_leftmenu_result #main_spot').before( searchHtml );
}
};
itsmo.lib.XMLHttpRequest2_send('/map/ajax_getGenre.php',func,'GET',prm,'text');
return false;
}
var searchHtml = '';
$('#ajax_leftmenu_result .map-ttl-h1-sect').after( searchHtml );
$('#ajax_leftmenu_result #main_spot').before( searchHtml );
};
itsmo.sub.genre_research_clear = function() {
itsmo.vars.g_freeword_beforeMode = '';
itsmo.vars.g_freeword_beforeGenre = '';
};
if (typeof itsmo.map == 'undefined') {
itsmo.map = {};
}
itsmo.map.UserLayer = function() {
this.setZIndex(100);
this._data = [];
};
itsmo.map.UserLayer.prototype.setZIndex = function(n) {
this.zIndexNum = n;
};
itsmo.map.UserLayer.prototype.removeById = function(id) {
if (id >= 0 && id < this._data.length) {
} else {
return false;
}
var n = this._data[id];
if (null == n) {
return false;
}
this._data[id] = null;
itsmo.vars.g_map_obj.removeWidget(n);
return true;
};
itsmo.map.UserLayer.prototype.clear = function() {
$.each(this._data, function(i, v) {
if (null != v) {
itsmo.vars.g_map_obj.removeWidget(v);
}
});
this._data = [];
};
itsmo.map.UserLayer.prototype.clearMarker = function() {
for (var i = 0; i < this._data.length; ++i) {
var v = this._data[i];
if (null == v || !v.isMarker) {
continue;
}
this.setVisibleById(i, false);
itsmo.vars.g_map_obj.removeWidget(v);
this._data[i] = null;
}
};
itsmo.map.UserLayer.prototype.get = function(id) {
if (id >= 0 && id < this._data.length) {
} else {
return null;
}
return this._data[id];
};
itsmo.map.UserLayer.prototype.add = function(widget, isMarker) {
var n = $.inArray(null, this._data);
if (n < 0) {
n = this._data.length;
this._data.push(widget);
} else {
this._data[n] = widget;
}
widget.isMarker = !!isMarker;
itsmo.vars.g_map_obj.addWidget(widget);
return n;
};
itsmo.map.UserLayer.prototype.showById = function(id) {
return this.setVisibleById(id, true);
};
itsmo.map.UserLayer.prototype.showAll = function() {
for (var i = 0; i < this._data.length; ++i) {
this.setVisibleById(i, true);
}
};
itsmo.map.UserLayer.prototype.hideById = function(id) {
return this.setVisibleById(id, false);
};
itsmo.map.UserLayer.prototype.removeById = function(id) {
var v = this.get(id);
if (null == v) {
return;
}
itsmo.vars.g_map_obj.removeWidget(v);
this._data[id] = null;
};
itsmo.map.UserLayer.prototype.setVisibleById = function(id, isShow) {
if (id >= 0 && id < this._data.length) {
} else {
return false;
}
var n = this._data[id];
if (null == n) {
return false;
}
if (isShow) {
if (n instanceof ZDC.Marker || n instanceof ZDC.Polyline) {
n.visible();
} else {
n.open();
}
} else {
if (n instanceof ZDC.Marker || n instanceof ZDC.Polyline) {
n.hidden();
} else {
n.close();
}
}
return true;
};
itsmo.vars.g_range_request = null;
//条件
itsmo.vars.g_range_genre = null;
itsmo.vars.g_range_page = 1;
itsmo.vars.g_range_cnt = 10;
itsmo.vars.g_range_word = null;
itsmo.vars.g_range_cancel = null;
itsmo.vars.g_range_flags = '';
itsmo.vars.g_range_cond_reset = false; // reset 中は true。
itsmo.vars.g_range_flag_rowcnt = 10; // 簡易検索欄で使用する条件
itsmo.vars.g_range_flag_gsort = 'near'; // 簡易検索欄で使用する条件
itsmo.vars.g_range_flags_cond = {};
itsmo.vars.g_range_topGenreName = '';
itsmo.vars.g_range_genreName = '';
//表示
itsmo.vars.g_range_tipid = [];
itsmo.vars.g_range_myspot = [];
itsmo.vars.g_range_opentip = null;
itsmo.range = {};
itsmo.range.STR_PLEASE_SELECT = '選択してください';
// 初期化
itsmo.range.init = function() {
$('#flg_freewd').keypress(function(e) {
if (13 == e.which) {
itsmo.range.cond_submit();
}
});
};
//
itsmo.range.range = function(genre, topGenreName, genreName) {
itsmo.range.cond_reset();
itsmo.vars.g_range_genre = genre;
itsmo.vars.g_range_word = null;
itsmo.vars.g_range_page = 1;
if (topGenreName) itsmo.vars.g_range_topGenreName = topGenreName;
if (genreName) itsmo.vars.g_range_genreName = genreName;
itsmo.vars.g_range_flags = 'gsort=' + itsmo.vars.g_range_flag_gsort;
itsmo.vars.g_range_cnt = itsmo.vars.g_range_flag_rowcnt;
var e = $("#ajax_range_condition input[name='flags']");
e.val('0');
e.filter('#flg_gsort').val(itsmo.vars.g_range_flag_gsort);
e.filter('#flg_rowcnt').val('' + itsmo.vars.g_range_flag_rowcnt);
e.filter('#flg_g_min_yosan').val('');
e.filter('#flg_g_max_yosan').val('');
if (itsmo.vars.g_home_p) {
// 自宅~現在の地図中心との距離
var i = itsmo.lib.toLatLon(itsmo.vars.g_home_p);
itsmo.vars.g_dist = ZDC.getLatLonToLatLonDistance(i, itsmo.lib.toLatLon(itsmo.vars.g_map_search_location));
}
itsmo.range.range_search('genre', ['genre', genre, topGenreName, genreName]);
};
/*
itsmo.range.range_freeword = function(word, result) {
itsmo.vars.g_range_genre = 'freeword';
itsmo.vars.g_range_word = word;
itsmo.vars.g_range_page = 1;
itsmo.vars.g_range_topGenreName = '';
itsmo.vars.g_range_genreName = '';
if(result == null) {
itsmo.range.range_search();
} else {
// 主にフリーワードからの分岐用
itsmo.sub.map_tab_change('range');
itsmo.range.range_search_result(result);
}
};
*/
//
itsmo.range.range_search = function(act, fn) {
if(itsmo.vars.g_range_genre == null) return;
//alert('bandodebug:itsmo.range.range_search() itsmo.vars.g_range_genre = '+itsmo.vars.g_range_genre+' & itsmo.vars.g_range_word = '+itsmo.vars.g_range_word);
itsmo.sub.map_tab_change('range', fn);
// ajax通信
var i = itsmo.vars.g_map_search_location;
var prm = 'lat=' + i.lat
+ '&lon=' + i.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&page=' + itsmo.vars.g_range_page
+ '&cnt=' + itsmo.vars.g_range_cnt
+ '&act=' + act;
if(itsmo.vars.g_range_genre != null) prm += '&genre=' + encodeURIComponent(itsmo.vars.g_range_genre);
if(itsmo.vars.g_range_topGenreName != null) prm += '&topGenreName=' + encodeURIComponent(itsmo.vars.g_range_topGenreName);
if(itsmo.vars.g_range_genreName != null) prm += '&genreName=' + encodeURIComponent(itsmo.vars.g_range_genreName);
if(itsmo.vars.g_range_word != null) prm += '&word=' + encodeURIComponent(itsmo.vars.g_range_word);
prm += '&dist=' + encodeURIComponent(itsmo.vars.g_dist);
prm += '&byway=' + encodeURIComponent(itsmo.vars.g_byway); // 1:レコメンド経由
if ('' != itsmo.vars.g_range_flags) {
prm += '&' + itsmo.vars.g_range_flags;
}
itsmo.lib.map_waitopen();
if(itsmo.vars.g_range_request != null) itsmo.lib.XMLHttpRequest2_abort(itsmo.vars.g_range_request);
itsmo.vars.g_range_request = itsmo.lib.XMLHttpRequest2_send('/map/ajax_range.php',itsmo.range.range_search_result,'GET',prm);
};
itsmo.range.range_search_result = function(result) {
//if( typeof( result.responseXML.normalize ) != 'undefined') result.responseXML.normalize();// FFの4096byte制限対策
//itsmo.range.range_tipclear();
itsmo.vars.g_range_request = null;
// エラー処理
result = $(result);
var err = result.find('err').text();
if(err != 0) {
//alert('エラー '+err);
return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
$(result).find('items').each(function() {
var prm = {};
prm['uid'] = $(this).find('uid').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['short_nm'] = $(this).find('short_nm').text();
prm['gnr_nm'] = $(this).find('gnr_nm').text();
prm['gnr_cd'] = $(this).find('gnr_cd').text();
prm['tip_c'] = $(this).find('tip_c').text();
prm['tip_o'] = $(this).find('tip_o').text();
var html = prm['tip_c'];
var div_id = itsmo.sub.set_tooltip_s(html,prm);
});
// 配置
//itsmo.vars.g_range_tipid = [];
//itsmo.vars.g_range_myspot = [];
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml( result.find('left_html').text() );
$("#ajax_leftmenu_result input:text[name='keyword']").clearField().blur().keypress(function(e) {
if (13 == e.which) {
itsmo.range.openGenre_search();
}
});
// 簡易絞込を調整。
var i = itsmo.vars.g_range_flags.split('&');
var sortnum = null;
i = $.map(i, function(v, n) {
v = v.split('=');
if ('gsort' == v[0]) {
sortnum = v[1];
return null;
}
return v[0];
});
var e = $("#ajax_leftmenu_result div.sibo-rich span.select-joken span[class^='ic-tell-']");
$.each(i, function(n, v) {
if ('' == v) {
return;
}
v = "[name='" + v + "']";
v = e.filter(v);
if (v.length >= 1) {
v.parent().click();
}
});
if (null != sortnum) {
e = $("#ajax_leftmenu_result div.sibo-rich ul li a[rel='" + sortnum + "']");
if (e.length >= 1) {
e.click();
}
}
itsmo.range.show_simple_cond();
// 住所を取得。
ZDC.Search.getAddrByLatLon({
latlons: [itsmo.lib.toLatLon(itsmo.vars.g_map_search_location)]
}, itsmo.range.range_event_condition_address);
itsmo.vars.g_range_condhtml = result.find('condhtml').text();
//itsmo.map.map_resize();
// インタレストマッチ広告を挿入
itsmo.sub.map_getaddr(itsmo.vars.g_map_search_location, itsmo.range.im_getaddr, 1);
// ココ吹き出し再表示
// if (itsmo.vars.g_maplink_set) itsmo.sub.maplink_tipopen();
};
itsmo.range.im_getaddr = function(result) {
var pref = '', addr = '';
if(result.status == 0) {
pref = result.items[0].addrCode;
addr = result.items[0].address;
}
var gnrnm = $('#ajax_facet_genre_nm_b').text();
var s = $('#ajax_facet_genre_nm_b + span').text().split(',', 2);
if ('' != s[1]) {
gnrnm = s[1];
} else if ('' != s[0]) {
gnrnm = s[0];
}
s = '0000' + parseInt(pref.substring(0, 5), 10);
s = s.substring(s.length - 5);
var id = 'ad' + s;
var type = 'mapContents';
var freewd = gnrnm + ' ' + addr;
var num = 1;
var url = itsmo.ad.make_im_url(num, freewd, id, type);
$.ajax({
type: "GET",
url: url,
cache: false,
dataType: "jsonp",
async: false,
timeout: 60000,
error: function(xhr, textStatus, errorThrown) {
// TODO:エラーの場合のログは?
},
success: itsmo.range.im_getaddr_set
});
};
itsmo.range.im_getaddr_set = function(json) {
var e = $('#ajax_leftmenu_result div.scrollable div.List-kekka:first');
json = json['Results']['ResultSet'];
e.find('a:first').attr('href', json['Listing'][0]['ClickUrl']);
e.find('span > strong').text(json['Listing'][0]['title']);
e.find('span.List-pr-txt, span.tmp-List-pr-txt').text(json['Listing'][0]['description']);
e.find('span.List-pr-url').text(json['Listing'][0]['siteHost']);
e.find('a.kekka-pr').attr('href', json['Label']['InquiryUrl']).text(json['Label']['LabelText']);
e.show();
};
itsmo.range.range_page = function(page) {
itsmo.vars.g_range_page = page;
itsmo.range.range_search('page');
};
itsmo.range.range_research = function() {
itsmo.vars.g_range_page = 1;
if(itsmo.vars.g_range_genre == null) return;
itsmo.range.range_search('map', ['genre', itsmo.vars.g_range_genre, itsmo.vars.g_range_topGenreName, itsmo.vars.g_range_genreName]);
};
itsmo.range.range_event_condition_address = function(status, result) {
var add = '';
if ('000' == status.code && typeof result[0] !== 'undefined') {
add = result[0].address.parts.slice(0, 4);
add = add.join('') + ' 付近';
}
$('#ajax_range_condition span.c-search-tbl-area-add:first').text(add);
};
//--------------------------------------------------------------------------------------------------
// 移動
//--------------------------------------------------------------------------------------------------
itsmo.range.range_move = function(lon,lat) {
itsmo.vars.g_range_cancel = 1;
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
}
//------------------------------------------------
itsmo.range.range_tipopen = function(uid) {
if(uid == null || uid == ''){ return false;}
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
var div_id = itsmo.sub.map_clickable_tipopen(data.tip_o,data);
};
itsmo.range.range_tipclear = function() {
/*
cnt = itsmo.vars.g_range_tipid.length;
if(cnt == 0) return;
for(var i = 0;i < cnt;i ++) {
if(itsmo.vars.g_range_tipid[i] != null) {
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_range_tipid[i]);
}
}
itsmo.vars.g_range_tipid = [];
itsmo.vars.g_range_opentip = null;
*/
//チップクリア
itsmo.sub.map_clickable_TipAllClear();
itsmo.vars.g_range_myspot = [];
};
itsmo.range.range_stop = function() {
itsmo.range.range_tipclear();
itsmo.vars.g_range_genre = null;
};
//------------------------------------------------
itsmo.range.range_detail_disp = function(url) {
window.open(url,'_blank');
return;
};
itsmo.range.openGenre_last_type = false;
itsmo.range.openGenre = function(isMid) {
itsmo.range.openGenre_close();
if (itsmo.range.openGenre_last_type == isMid && $('#ajax_facet_genre_div').is(':visible')) {
return false;
}
var i = [$('#ajax_facet_genre_b').val()];
var j = [];
var xml = 'g2';
if (!isMid) {
if ($('#ajax_facet_genre_selbox_s').attr('class').indexOf('-off') >= 0) {
return false;
}
i.push($('#ajax_facet_genre_m').val());
j.push($('#ajax_facet_genre_div').parent().find('div.sibo-waku-pull span:first').text());
xml = 'g3';
}
i = i.join(':');
j = j.join(' ');
var url = '/c/' + encodeURIComponent(j) + '/' + i + '/';
i = itsmo.vars.g_map_search_location;
var prm = 'lat=' + i.lat
+ '&lon=' + i.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&xml=' + xml
+ '&openGenre=true'
;
$('#ajax_leftmenu_result div.sibo-waku div.sibo-loading').fadeIn('fast');
itsmo.range.openGenre_last_type = isMid;
itsmo.lib.XMLHttpRequest2_send(url, itsmo.range.openGenre_callback, 'GET', prm);
};
itsmo.range.openGenre_result = [];
itsmo.range.openGenre_result_page = 0;
itsmo.range.openGenre_result_company = [];
itsmo.range.openGenre_result_company_page = 0;
itsmo.range.openGenre_callback = function(result) {
itsmo.range.openGenre_close();
result = $(result);
// $('#ajax_facet_genre_seltitle').text(result.find('title').text());
$('#ajax_facet_genre_seltitle').text($('#ajax_facet_genre_nm_b').text());
result = result.find('data');
var e = $('#ajax_facet_genre_sel');
e.find('ul').hide();
e.find('div:eq[1]').hide();
do {
e.find('ul').hide();
if (result.length <= 0) {
$('#ajax_facet_genre_sel div:first').hide().next().show();
e.find('ul:eq(1)').show();
break;
}
// 企業を集める。
itsmo.range.openGenre_result = [];
itsmo.range.openGenre_result_page = 0;
itsmo.range.openGenre_result_company = [];
itsmo.range.openGenre_result_company_page = 0;
var bl_set_reset_anchor = false;
result.each(function(i, domEle) {
domEle = $(domEle);
var nm = domEle.find('nm').text();
var val = domEle.find('val').text();
var cnt = domEle.find('cnt').text();
var vals = val.split(':');
if (vals.length == 3 && vals[2].substring(5, 6) == '5') {
itsmo.range.openGenre_result_company.push([nm, val, cnt]);
} else {
itsmo.range.openGenre_result.push([nm, val, cnt]);
}
if (!bl_set_reset_anchor) {
bl_set_reset_anchor = true;
vals[vals.length - 1] = '';
val = vals.join(':');
$('#ajax_facet_genre_seltitle').parent().attr('name', val);
}
});
$('#ajax_facet_genre_sel div:first').show().next().hide();
itsmo.range.openGenre_show(false);
itsmo.range.openGenre_show(true);
break;
} while(false);
$('#ajax_facet_genre_div').fadeIn('fast');
};
itsmo.range.openGenre_show = function(isCompany) {
if (isCompany) {
var num = 5;
var start = num * itsmo.range.openGenre_result_company_page;
if (start >= itsmo.range.openGenre_result_company.length) {
start = 0;
itsmo.range.openGenre_result_company_page = 0;
}
var offset = 0;
var f = $('#ajax_facet_genre_sel ul:eq(1)');
f.hide().find('li').hide();
var div = $('#ajax_facet_genre_sel div:eq(1)').hide();
$.each(itsmo.range.openGenre_result_company, function(i, val) {
if (i < start || i >= (start + num)) {
return;
}
var nm = val[0];
var cnt = val[2];
var val = val[1];
var g = f.find('li:eq(' + (offset++) + ')').show().find('a');
g.html(nm).attr('name', val);
});
if (offset >= 1) {
f.show();
div.show();
if (itsmo.range.openGenre_result_company.length > num) {
i = f.find('li:last');
j = i.find('strong');
j.hide();
if ((num * itsmo.range.openGenre_result_company_page + num) >= itsmo.range.openGenre_result_company.length) {
j.eq(1).show();
} else {
j.eq(0).show();
}
i.show();
}
}
} else {
var num = itsmo.range.openGenre_result_company.length >= 1 ? 5 : 10;
var start = num * itsmo.range.openGenre_result_page;
if (start >= itsmo.range.openGenre_result.length) {
start = 0;
itsmo.range.openGenre_result_page = 0;
}
var offset = 0;
var f = $('#ajax_facet_genre_sel ul:first');
f.hide().find('li').hide();
$.each(itsmo.range.openGenre_result, function(i, val) {
if (i < start || i >= (start + num)) {
return;
}
var nm = val[0];
var cnt = val[2];
var val = val[1];
var g = f.find('li:eq(' + offset + ')').show().find('a');
offset++;
g.html(nm).attr('name', val);
});
if (offset >= 1) {
f.show();
if (itsmo.range.openGenre_result.length > num) {
i = f.find('li:last');
j = i.find('strong');
j.hide();
if ((num * itsmo.range.openGenre_result_page + num) >= itsmo.range.openGenre_result.length) {
j.eq(1).show();
} else {
j.eq(0).show();
}
i.show();
}
}
}
};
itsmo.range.openGenre_next = function(isCompany) {
if (isCompany) {
itsmo.range.openGenre_result_company_page++;
} else {
itsmo.range.openGenre_result_page++;
}
itsmo.range.openGenre_show(isCompany);
};
itsmo.range.openGenre_close = function() {
$('#ajax_facet_genre_div').fadeOut('fast');
$("#ajax_leftmenu_result div.sis-search-paka-genre[name^='gnr']").fadeOut('fast');
$('#ajax_leftmenu_result div.sibo-waku div.sibo-loading').fadeOut('fast');
};
itsmo.range.openGenre_select = function(e) {
itsmo.range.openGenre_close();
e = $(e);
var nm = e.text();
var i = nm.indexOf('(');
if (i >= 0) {
nm = nm.substring(0, i);
}
var id = itsmo.vars.g_range_genre = e.attr('name');
id = id.split(':');
var is_clear = (id[id.length - 1].length <= 0);
if (is_clear) {
// 末尾の : を取り除く。
itsmo.vars.g_range_genre = itsmo.vars.g_range_genre.substring(0, itsmo.vars.g_range_genre.length - 1);
}
$('#ajax_facet_genre_b').val(id.shift());
if (id.length == 1) {
e = $('#ajax_facet_genre_selbox span.box-s:first');
} else {
e = $('#ajax_facet_genre_selbox_s');
}
e.text(is_clear ? itsmo.range.STR_PLEASE_SELECT : itsmo.range.limitString(nm, 9));
if (id.length == 1) {
$('#ajax_facet_genre_m').val(id.shift());
$('#ajax_facet_genre_s').val('');
i = $('#ajax_facet_genre_selbox_s');
e = '-off';
if (is_clear) {
} else if (i.attr('class').indexOf(e)) {
e = '';
} else {
e = null;
}
if (null != e) {
i.attr('class', 'box-s' + e);
}
i.text(is_clear ? '' : itsmo.range.STR_PLEASE_SELECT);
} else {
$('#ajax_facet_genre_s').val(id[id.length - 1]);
}
itsmo.range.show_simple_cond();
};
itsmo.range.openGenre_search = function() {
var s = itsmo.vars.g_range_flags_cond;
itsmo.range.cond_reset();
itsmo.vars.g_range_flags_cond = s;
var gnrb = $('#ajax_facet_genre_b').val();
var gnrm = $('#ajax_facet_genre_m').val();
itsmo.vars.g_range_topGenreName = '' != gnrb ? $('#ajax_facet_genre_nm_b').text() : '';
itsmo.vars.g_range_genreName = '' != gnrm ? $('#ajax_facet_genre_m_nm').text() : '';
itsmo.vars.g_range_word = '';
gnrb = $("#ajax_leftmenu_result div.sibo-waku-waku div:visible[class^='sibo-'] input:text[name='keyword']");
if (gnrb.length >= 1) {
gnrb = gnrb.eq(0);
gnrm = gnrb.attr('rel');
gnrb = gnrb.val();
itsmo.vars.g_range_word = gnrm == gnrb ? '' : gnrb;
}
var d = [], usedgnr = [];
$("#ajax_leftmenu_result div.sibo-rich:visible span.select-joken:visible span[class^='ic-tell-']").each(function() {
var e = $(this);
var s = e.parent().attr('name');
if (undefined != s) {
usedgnr.push(s.substring(3));
}
s = e.attr('class');
var n = Math.max(0, s.length - 4);
var v = e.attr('name');
if ('-off' == s.substring(n).toLowerCase()) {
itsmo.vars.g_range_flags_cond[v] = '0';
return;
}
d.push(v + '=1');
itsmo.vars.g_range_flags_cond[v] = null;
});
for (j in itsmo.vars.g_range_flags_cond) {
if ('gsort' == j) {
continue;
}
var s = itsmo.vars.g_range_flags_cond[j];
if (null != s && '0' != s) {
d.push(j + '=' + encodeURIComponent(s));
}
}
$("#ajax_leftmenu_result div.sibo-rich:visible span.box-s[name^='sort']").each(function() {
usedgnr.push($(this).attr('name').substring(4));
});
usedgnr = $.unique(usedgnr);
// ソート条件があるか?
var usesort = itsmo.vars.g_range_flag_gsort;
$.each(usedgnr, function(i, v) {
if (null == v || undefined == v || '' == v) {
return;
}
v = "#ajax_leftmenu_result div.sibo-rich span.box-s[name='sort" + v + "']";
v = $(v).next('input:hidden');
if (v.length <= 0) {
return;
}
usesort = v.val();
itsmo.range.set_default_range_flag_sort(usesort);
return false;
});
d.push('gsort=' + usesort);
d.push('rowcnt=' + itsmo.vars.g_range_flag_rowcnt);
itsmo.vars.g_range_flags = d.length >= 1 ? d.join('&') : '';
itsmo.vars.g_range_page = 1;
itsmo.range.range_search();
};
itsmo.range.set_default_range_flag_sort = function(s) {
if ('near' == s || 'nm_asc' == s || 'nm_desc' == s) {
itsmo.vars.g_range_flag_gsort = s;
}
};
itsmo.range.cond_reset = function() {
itsmo.vars.g_range_cond_reset = true;
itsmo.vars.g_range_flags_cond = {};
$('#ajax_range_condition_td_cond a strong.joken-on').each(function() {
var e = $(this).removeClass('joken-on').parent();
e.find('input:hidden').val('0');
e = e.find('span');
var s = e.attr('class');
if (s.substring(s.length - 4) != '-off') {
e.attr('class', s + '-off');
}
});
$('#ajax_range_condition_td_cond div.List-coL-link ul').each(function() {
var e = $(this).find('li:first a');
if (e.is("[onclick*='rowcnt']")) {
return;
}
e.find('a').click();
});
itsmo.range.cond_validate_sort(true);
itsmo.vars.g_range_word = '';
itsmo.vars.g_range_cnt = itsmo.vars.g_range_flag_rowcnt;
itsmo.vars.g_range_flags = '';
itsmo.vars.g_range_page = 1;
itsmo.vars.g_range_cond_reset = false;
};
itsmo.range.cond_open = function() {
itsmo.range.cond_hide(true);
// サブウィンドウのタイトルを設定。
var f = $('#ajax_range_condition_td_genre span.box-s');
f.eq(0).text(itsmo.range.limitString($('#ajax_facet_genre_nm_b').text(), 9));
// 中ジャンル、小ジャンルの選択欄を調整。
var e = $("#ajax_facet_genre_selbox span.box-s");
f.eq(1).text(e.eq(0).text());
if (e.length >= 2) {
f.eq(2).text(e.eq(1).text());
} else {
if (f.length >= 2) {
f.eq(2).text('').attr('class', 'box-s-ff');
}
}
e = $('#ajax_range_condition_td_genre');
e.find("input[name='gnrb']").val($('#ajax_facet_genre_b').val());
e.find("input[name='gnrm']").val($('#ajax_facet_genre_m').val());
e.find("input[name='gnrs']").val($('#ajax_facet_genre_s').val());
itsmo.range.cond_set_genres();
itsmo.range.changeFlagsByGnr();
// 絞り込み条件をコピー。
$("#ajax_leftmenu_result div.sibo-rich:visible span.select-joken:visible span[class^='ic-tell-']").each(function() {
var e = $(this);
var s = e.attr('class');
var t = '#flg_' + e.attr('name');
t = $(t);
if (s != t.attr('class')) {
// on, off が一致しないならトグル。
t.parent().click();
}
});
$("#ajax_leftmenu_result div.sibo-rich:visible span.box-s[name^='sort']").each(function() {
var i = $(this).next('input:hidden').val();
$("#ajax_gsort_div ul li a[rel='" + i + "']").click();
return false;
});
e = $("#ajax_leftmenu_result div:visible").filter('.sibo-normal, .sibo-rich').find("input:text[name='keyword']");
f = (null != itsmo.vars.g_range_word && undefined != itsmo.vars.g_range_word) ? itsmo.vars.g_range_word : '';
$('#flg_freewd').val(e.length >= 1 && (e.val() != e.attr('rel')) ? e.val() : f);
itsmo.range.cond_validate_sort(true);
$("#flg_span_rowcnt").html(itsmo.vars.g_range_cnt + '件表示');
itsmo.lib.map_windowopen('ajax_range_condition');
};
itsmo.range.cond_close = function() {
itsmo.range.cond_hide();
itsmo.lib.map_windowclose();
};
itsmo.range.cond_set_genres = function() {
var e = $('#ajax_range_condition_td_genre');
f = e.find('span');
do {
if ('' == e.find("input[name='gnrm']").val()) {
f.eq(2).text(itsmo.range.STR_PLEASE_SELECT);
f.eq(4).removeClass('box-s').addClass('box-s-off').text('');
e.find("input[name='gnrs']").val('');
break;
}
f.eq(4).removeClass('box-s-off').addClass('box-s');
if ('' == e.find("input[name='gnrs']").val()) {
f.eq(4).text(itsmo.range.STR_PLEASE_SELECT);
}
break;
} while(false);
};
itsmo.range.cond_hide = function(isHide) {
var ids = [
'ajax_facet_gnr_div'
, 'ajax_gsort_div'
, 'ajax_rowcnt_div'
, 'ajax_g_max_yosan_div'
, 'ajax_g_min_yosan_div'
, 'ajax_rowcnt_div'
];
$.each(ids, function(i, val) {
var e = $('#' + val);
if (isHide) {
e.hide();
} else {
e.fadeOut('fast');
}
});
$('#ajax_range_condition div.sibo-loading2').fadeOut('fast');
};
itsmo.range.cond_checkbox_include_freewd = function(flg) {
var e = $('#ajax_range_condition a.tel-check span');
var bl = e.attr('class').indexOf('-on') >= 0;
if (flg == 1) {
if (bl) {
e.removeClass('tel-check-on').addClass('tel-check-off');
} else {
e.removeClass('tel-check-off').addClass('tel-check-on');
}
return;
}
return bl;
};
itsmo.range.cond_show_last_mode = '';
itsmo.range.cond_show = function(mode) {
itsmo.range.cond_hide();
itsmo.range.changeFlagsByGnr();
if (itsmo.range.cond_show_last_mode == mode && $('#ajax_facet_gnr_div').is(':visible')) {
return false;
}
var e = $('#ajax_range_condition_td_genre h3:first strong');
var f = $('#ajax_range_condition_td_genre span');
var type = '';
if ('b' == mode) {
e.text('ジャンル');
type = 'g1';
} else if ('m' == mode) {
e.text(f.eq(0).text());
type = 'g2';
} else if ('s' == mode) {
if ($('#ajax_range_condition_td_genre span.box-s').length < 3) {
return false;
}
e.text(f.eq(2).text());
type = 'g3';
} else {
return false;
}
var url = itsmo.range.cond_makeSubmitUrl(!itsmo.range.cond_checkbox_include_freewd()
, 'xml=' + type, mode);
url = url.split('?', 2);
$('#ajax_range_condition div.sibo-loading2').fadeIn('fast');
itsmo.range.cond_show_last_mode = mode;
itsmo.lib.XMLHttpRequest2_send(url[0], itsmo.range.cond_show_callback, 'GET', url[1]);
};
itsmo.range.cond_show_result = [];
itsmo.range.cond_show_result_page = 0;
itsmo.range.cond_show_result_company = [];
itsmo.range.cond_show_result_company_page = 0;
itsmo.range.cond_show_callback = function(result) {
itsmo.range.cond_hide();
result = $(result);
var nm = result.find('title').text();
if ('' != nm && null != nm) {
$('#ajax_facet_gnr_div strong:first').text(nm);
}
result = result.find('data');
// 企業を集める。
itsmo.range.cond_show_result = [];
itsmo.range.cond_show_result_company = [];
var bl_set_reset_anchor = false;
result.each(function(i, domEle) {
domEle = $(domEle);
var nm = domEle.find('nm').text();
var val = domEle.find('val').text();
var cnt = domEle.find('cnt').text();
if(val == "0200000000"){
nm = "レジャー・エンタメ・スポーツ";
}
if(val == "0300000000"){
nm ="宿泊施設";
}
if(val == "0400000000"){
nm = "交通・自動車関連・道の駅";
}
if(val == "0500000000"){
nm = "公共・教育・金融機関";
}
if(val == "0600000000"){
nm = "ショッピング";
}
if(val == "0700000000"){
nm = "生活・美容・冠婚葬祭";
}
if(val == "0800000000"){
nm = "ビジネス・企業間取引";
}
var vals = val.split(':');
var d = [nm, val, cnt];
if (vals.length == 3 && vals[2].substring(5, 6) == '5') {
itsmo.range.cond_show_result_company.push(d);
} else {
itsmo.range.cond_show_result.push(d);
}
if (!bl_set_reset_anchor) {
bl_set_reset_anchor = true;
vals[vals.length - 1] = '';
$('#ajax_facet_gnr_div strong:first').parent().attr('rel', vals.join(':'));
}
});
// ページ数計測。
var i = $('#ajax_facet_gnr_sel ul:first li').length;
itsmo.range.cond_show_result_page = Math.floor((itsmo.range.cond_show_result.length + i - 1) / i);
i = $('#ajax_facet_gnr_sel ul:eq(1) li').length;
itsmo.range.cond_show_result_company_page = Math.floor((itsmo.range.cond_show_result_company.length + i - 1) / i);
itsmo.range.cond_show_set_li(0);
$('#ajax_facet_gnr_div').fadeIn('fast');
};
itsmo.range.cond_show_set_li = function(page) {
var e = $('#ajax_facet_gnr_sel');
e.find('ul').hide();
e.find('div > h4').parent(0).hide();
var offset = 0;
var n = 0;
var cnt;
if (itsmo.range.cond_show_result_page == 1 || page < itsmo.range.cond_show_result_page) {
n = e.find('ul:first li').length;
offset = page * n;
if (itsmo.range.cond_show_result_page == 1) {
offset = 0;
}
cnt = 0;
e.find('ul:first').show().find('li').hide().each(function() {
var i = cnt + offset;
cnt++;
if (i >= itsmo.range.cond_show_result.length) {
return false;
}
var v = itsmo.range.cond_show_result[i];
$(this).show().find('a').attr('rel', v[1]).html(v[0]);
});
}
if (itsmo.range.cond_show_result_company_page == 1 || page < itsmo.range.cond_show_result_company_page) {
n = e.find('ul:eq(1) li').length;
offset = page * n;
if (itsmo.range.cond_show_result_company_page == 1) {
offset = 0;
}
cnt = 0;
e.find('div > h4').parent().show();
e.find('ul:eq(1)').show().find('li').hide().each(function() {
var i = cnt + offset;
cnt++;
if (i >= itsmo.range.cond_show_result_company.length) {
return false;
}
var v = itsmo.range.cond_show_result_company[i];
$(this).show().find('a').attr('rel', v[1]).html(v[0]);
});
}
// ページ操作ボタン群の表示非表示制御。まずは群を消しておく。
e.find('div.lst-pg').hide();
if (itsmo.range.cond_show_result_page >= 2 || itsmo.range.cond_show_result_company_page >= 2) {
n = Math.max(itsmo.range.cond_show_result_page, itsmo.range.cond_show_result_company_page);
var f = e.find('div.lst-pg');
// DOM 組み立てなおし。
var s = $('#ajax_facet_gnr_company span.ajax_facet_gnr_company_page');
var i, j = s.eq(1).html();
for (i = 1; i <= n; ++i) {
j += s.eq(0).html().replace(/000/g, '' + i);
}
j += s.eq(2).html();
f.html(j);
// 表示非表示制御
var f_a = f.find('a');
var f_span = f.find('span');
var l = f.find('span').length;
// まずは全て消しておく。
f.find('span, a').hide();
// 「前へ」を制御。
if (0 == page) {
f_span.eq(0).show();
} else {
f_a.eq(0).show();
}
// 「次へ」を制御。
if (page >= (n - 1)) {
f_span.eq(l - 1).show();
} else {
f_a.eq(l - 1).show();
}
// 各ページ操作ボタンを制御。
for (i = 1; i <= n; ++i) {
if (i == (page + 1)) {
f_span.eq(i).show();
} else {
f_a.eq(i).show();
}
}
// 全体を表示。
f.show();
}
};
itsmo.range.cond_show_set_page = function(page) {
if (page >= 999 || page < 0) {
} else {
itsmo.range.cond_show_set_li(page);
return;
}
var e = $('#ajax_facet_gnr_sel div.lst-pg span:not(:first, :last)');
var n = 0;
for (var i = 0; i < e.length; ++i) {
if (e.eq(i).is(':visible')) {
n = i;
break;
}
}
n += (page < 0) ? -1 : 1;
n = Math.max(0, n);
n = Math.min(n, Math.max(itsmo.range.cond_show_result_page, itsmo.range.cond_show_result_company_page));
itsmo.range.cond_show_set_li(n);
};
itsmo.range.cond_select = function(e) {
e = $(e);
var id = e.attr('rel').split(':');
var is_clear = (id[id.length - 1].length <= 0);
if (is_clear && id.length == 1) {
return false;
}
itsmo.range.cond_hide();
var f = $("#ajax_range_condition_td_genre input[name^='gnr']").val('');
var i;
var nm = e.text();
i = nm.indexOf('(');
if (i < 0) {
i = nm.length;
}
nm = nm.substring(0, i);
for (i = 0; i < 3 && id.length >= 1; ++i) {
f.eq(i).val(id.shift());
}
if (!e.is('strong')) {
$("#ajax_range_condition_td_genre span").eq(i * 2 - 2).text(itsmo.range.limitString(nm, 9));
}
itsmo.range.changeFlagsByGnr();
itsmo.range.cond_validate_sort();
itsmo.range.cond_set_genres();
};
itsmo.range.cond_selectflg_show = function(e, id) {
id = $('#ajax_' + id + '_div');
var bl = id.is(':visible');
itsmo.range.cond_hide();
if (!bl) {
id.fadeIn('fast');
}
};
itsmo.range.cond_select_flg = function(e, id) {
itsmo.range.cond_hide();
e = $(e);
var val = e.attr('rel');
var nm = e.text();
if (itsmo.vars.g_range_cond_reset && e.attr('name') != undefined) {
nm = e.attr('name');
}
if ('~' == nm.substring(nm.length - 1)) {
nm = nm.substring(0, nm.length - 1);
}
$("#ajax_range_condition input[name='flags'][id='flg_" + id + "']").val(val);
$("#ajax_range_condition span[id='flg_span_" + id + "']").text(nm);
itsmo.range.changeFlagsByGnr();
itsmo.range.cond_validate_sort();
if ('gsort' == id) {
itsmo.range.set_default_range_flag_sort(val);
}
if ('rowcnt' == id) {
itsmo.vars.g_range_flag_rowcnt = val;
}
//itsmo.range.show_use_flag();
};
itsmo.range.changeFlagsByGnr = function() {
var i = $("#ajax_range_condition_td_genre input[name='gnrs']").val();
if (undefined == i || '' == i) {
i = $("#ajax_range_condition_td_genre input[name='gnrm']").val();
}
if (undefined == i || '' == i) {
i = $("#ajax_range_condition_td_genre input[name='gnrb']").val();
}
if (undefined == i || '' == i) {
} else {
i = i.split(':');
i = i[i.length - 1];
}
$("[id^='gnrflags']").hide().css('visibility', 'hidden').each(function() {
var e = $(this);
var s = e.attr('id').substring(8);
if (0 == i.indexOf(s)) {
e.show().css('visibility', 'visible');
}
});
$("li[name^='gsortflg']").hide().each(function() {
var e = $(this);
var s = e.attr('name').substring(8);
if (0 == i.indexOf(s)) {
e.show();
}
});
return false;
};
// ソート条件の適正チェック
itsmo.range.cond_validate_sort = function(isReset) {
var v = $('#flg_gsort').val();
var first_elm = null;
var isFound = false;
$('#ajax_gsort_div li').each(function() {
var e = $(this);
if (e.css('display') == 'none') {
return;
}
if (null == first_elm) {
first_elm = e;
}
e = e.find('a');
var val = e.attr('rel');
if (val == v) {
isFound = true;
if (isReset) {
e.click();
}
return false;
}
});
if (!isFound) {
first_elm.find('a').click();
}
};
itsmo.range.cond_toggle_icon = function(e, forceoff) {
e = $(e);
if (null == forceoff || undefined == forceoff) {
forceoff = [];
} else if (typeof forceoff == 'string') {
forceoff = [ forceoff ];
}
var cl = e.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (isOn) {
e.find('span:first').attr('class', cl + '-off').find('input:hidden').val('0');
e.find('strong').removeClass('joken-on');
} else {
e.find('span:first').attr('class', cl.substring(0, cl.length - 4)).find('input:hidden').val('1');
e.find('strong').addClass('joken-on');
$.each(forceoff, function() {
e = $('#' + this);
if ('1' == e.find('input:hidden').val()) {
e.parent().click();
}
});
}
//itsmo.range.show_use_flag();
return false;
};
itsmo.range.cond_toggle_icon2 = function(e, forceoff) {
e = $(e);
if (null == forceoff || undefined == forceoff) {
forceoff = [];
} else if (typeof forceoff == 'string') {
forceoff = [ forceoff ];
}
var cl = e.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (isOn) {
e.find('span:first').attr('class', cl + '-off');
e.removeClass('joken-on');
} else {
e.find('span:first').attr('class', cl.substring(0, cl.length - 4));
e.addClass('joken-on');
$.each(forceoff, function() {
e = $("#ajax_leftmenu_result span[name='" + this + "']");
cl = e.attr('class');
if ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase()) {
e.parent().click();
}
});
}
//itsmo.range.show_use_flag();
return false;
};
itsmo.range.cond_isNoneDisplayElement = function(e) {
//while (!!e && e != g_document) {
if (null == e) {
return true;
}
e = e.parents(':hidden');
for (var i = 0; i < e.length; ++i) {
if ('none' == e.eq(i).css('display')) {
return true;
}
}
return false;
};
itsmo.range.cond_makeSubmitUrl = function(canFreewdOnly, addParam, useGenre) {
var facetMode = 'submit' != useGenre;
var i = $.trim($('#flg_freewd').val());
if (!facetMode && canFreewdOnly && i.length >= 1) {
if ('submit' == useGenre) {
return { freewd: i };
}
i = '/c///?freewd=' + encodeURIComponent(i);
if (null != addParam && addParam.length >= 1) {
i += '&' + addParam;
}
return i;
}
var params = {};
var urlname = [], urlparam = [];
if (!facetMode && i.length >= 1) {
params['freewd'] = i;
}
params['minx'] = itsmo.vars.g_map_search_box.minx;
params['miny'] = itsmo.vars.g_map_search_box.miny;
params['maxx'] = itsmo.vars.g_map_search_box.maxx;
params['maxy'] = itsmo.vars.g_map_search_box.maxy;
// 検索フラグなどを取得。
//var es = g_document.getElementsByName('flags');
$("#ajax_range_condition [name='flags']").each(function() {
if ('b' == useGenre || canFreewdOnly) {
return false; // 大ジャンルではフラグを無視する。
}
var e = $(this);
if (itsmo.range.cond_isNoneDisplayElement(e)) {
return;
}
var id = e.attr('id');
if (undefined == id || '' == id) {
id = e.parent().attr('id');
}
if (undefined == id || '' == id) {
return;
}
var idRaw = id, j;
id = id.substring(4); // 先頭の flg_ を除く。
if (e.is('input:hidden')) {
j = e.val();
if ('0' != j && '' != j) {
params[id] = j;
}
} else {
j = itsmo.lib.document_getvalue(idRaw);
if ('' != j) {
params[id] = j;
}
}
});
// ジャンル情報を取得。
var gnrcd = [];
var e = $('#ajax_range_condition_td_genre');
do {
if ('b' == useGenre || 'submit' == useGenre) {
break;
}
gnrcd.push(e.find("input[name='gnrb']").val());
if ('m' == useGenre) {
break;
}
gnrcd.push(e.find("input[name='gnrm']").val());
urlname.push(e.find('span:eq(2)').text());
if ('s' == useGenre) {
break;
}
gnrcd.push(e.find("input[name='gnrs']").val());
urlname.push(e.find('span:eq(4)').text());
} while(false);
gnrcd = gnrcd.join(':');
if ('' != gnrcd) {
urlparam.push(gnrcd);
}
// URL の名称部とパラメータ部を作成。
for (i = 0; i < urlparam.length; ++i) {
urlparam[i] = encodeURIComponent(urlparam[i]);
}
urlparam = urlparam.join('_');
for (i = 0; i < urlname.length; ++i) {
urlname[i] = encodeURIComponent(urlname[i]);
}
urlname = urlname.join('+');
var p = [];
if ('submit' == useGenre) {
return params;
}
if (undefined != addParam && '' != addParam && null != addParam) {
p.push(addParam);
}
for (i in params) {
p.push(i + '=' + encodeURIComponent(params[i]));
}
p = p.join('&');
var url = '/c/' + urlname + '/' + urlparam + '/';
if ('' != p) {
url += '?' + p;
}
return url;
};
itsmo.range.cond_submit = function() {
var i = [], j;
var e = $('#ajax_range_condition input');
i.push(e.filter("[name='gnrb']").val());
j = e.filter("[name='gnrm']").val();
if ('' != j) {
i.push(j);
}
j = e.filter("[name='gnrs']").val();
if ('' != j) {
i.push(j);
}
itsmo.vars.g_range_genre = i.join(':');
var includeFreewd = itsmo.range.cond_checkbox_include_freewd();
i = itsmo.range.cond_makeSubmitUrl(!includeFreewd, '', 'submit');
if (!includeFreewd) {
itsmo.freeword.freewordSelectArea('freewd_area');
$('#freewd').val(i.freewd);
itsmo.range.cond_close();
$('div.header:first form:first').submit();
return false;
}
itsmo.vars.g_range_word = undefined != i.freewd ? i.freewd : '';
itsmo.vars.g_range_cnt = undefined != i.rowcnt ? i.rowcnt : 10;
i.freewd = i.rowcnt = i.minx = i.miny = i.maxx = i.maxy = null;
var d = [];
itsmo.vars.g_range_flags_cond = {};
for (j in i) {
if (null != i[j]) {
d.push(j + '=' + encodeURIComponent(i[j]));
itsmo.vars.g_range_flags_cond[j] = i[j];
}
}
if (includeFreewd) {
itsmo.vars.g_range_flags = d.length >= 1 ? d.join('&') : '';
}
itsmo.vars.g_range_page = 1;
itsmo.range.cond_close();
itsmo.lib.map_waitopen();
if(itsmo.vars.g_range_request != null) {
itsmo.lib.XMLHttpRequest2_abort(itsmo.vars.g_range_request);
itsmo.vars.g_range_request = null;
}
/*
alert(itsmo.vars.g_range_flags + "\r\n"
+ itsmo.vars.g_range_word + "\r\n"
+ itsmo.vars.g_range_cnt + "\r\n"
);
*/
itsmo.range.range_search();
};
itsmo.range.limitString = function(s, n) {
if (s.length <= n) {
return s;
}
return s.substring(0, n) + '...';
};
// 簡易絞込欄表示
itsmo.range.show_simple_cond = function() {
var gnrcd = $('#ajax_facet_genre_s').val();
if ('' == gnrcd) {
gnrcd = $('#ajax_facet_genre_m').val();
}
if ('' == gnrcd) {
gnrcd = $('#ajax_facet_genre_b').val();
}
// 各ジャンル絞込欄と親divを非表示。
var e = $('#ajax_leftmenu_result');
e.find('div.sibo-rich').hide().find("span[name^='gnr']").hide();
do {
if ('' == gnrcd) {
break;
}
var f = null;
for (var i = gnrcd.length; i >= 2; --i) {
var s = "[name='gnr" + gnrcd.substring(0, i) + "']";
f = e.find('div span.select-joken' + s);
if (f.length <= 0) {
f = e.find('div.sibo-rich-waku' + s);
if (f.length <= 0) {
f = null;
continue;
}
// fall down.
}
// 通常欄を消して対象ジャンル欄と親divを表示。
$('#ajax_leftmenu_result div.sibo-normal').hide();
f.show().parents('div.sibo-rich').show();
return;
}
} while(false);
// 通常欄を表示
$('#ajax_leftmenu_result div.sibo-normal').show();
return;
};
// 簡易絞込複数選択覧表示
itsmo.range.show_simple_cond_list = function(s) {
itsmo.range.openGenre_close();
$("#ajax_leftmenu_result div.sis-search-paka-genre[name='" + s + "']").fadeIn('fast');
return false;
};
itsmo.range.click_simple_cond_list = function(e) {
itsmo.range.openGenre_close();
e = $(e);
var val = e.attr('rel');
var txt = e.text();
var f = e.parents().filter("div[name^='gnr']");
var i = 'sort' + f.attr('name').substring(3);
i = "#ajax_leftmenu_result div.sibo-rich span.box-s[name='" + i + "']";
$(i).text(itsmo.range.limitString(txt, 8)).next("input:hidden").val(val);
};
// 絞り込み中か
itsmo.range.is_use_flags = function() {
var includeFreewd = itsmo.range.cond_checkbox_include_freewd();
var i = itsmo.range.cond_makeSubmitUrl(!includeFreewd, '', 'submit');
for (var j in i) {
if (null == i[j]) {
continue;
}
if ('minx' == j || 'miny' == j || 'maxx' == j || 'maxy' == j
|| 'rowcnt' == j || 'gsort' == j
) {
continue;
}
return true;
}
return false;
};
itsmo.range.show_use_flag = function() {
var e = $('a.sibo-hoka span:first');
if (itsmo.range.is_use_flags()) {
e.addClass('act');
} else {
e.removeClass('act');
}
};
itsmo.vars.google_image_api_control = null;
itsmo.range.google_image_api_OnLoad = function(word) {
itsmo.vars.google_image_api_control = new GSearchControl();
itsmo.vars.google_image_api_control.setResultSetSize(GSearch.SMALL_RESULTSET);
itsmo.vars.google_image_api_control.setLinkTarget(GSearch.LINK_TARGET_BLANK);
itsmo.vars.google_image_api_control.setResultSetSize(GSearch.LARGE_RESULTSET);
var searcher = new GimageSearch();
searcher.setRestriction(GimageSearch.RESTRICT_IMAGESIZE,GimageSearch.IMAGESIZE_LARGE);
searcher.setRestriction(GSearch.RESTRICT_SAFESEARCH,GSearch.SAFESEARCH_STRICT);
var options = new GsearcherOptions();
options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
itsmo.vars.google_image_api_control.addSearcher(new GimageSearch(), options);
};
itsmo.range.google_image_api_execute = function(word,id) {
if(document.getElementById("searchcontrol") == null) return;
itsmo.vars.google_image_api_control.draw(document.getElementById(id));
itsmo.vars.google_image_api_control.execute(word);
};
// zIndex 調整
itsmo.vars.g_range_tipc_elem = null;
itsmo.vars.g_range_tipc_time = null;
itsmo.range.range_tipc_timeout = function() {
itsmo.vars.g_range_tipc_time = null;
itsmo.vars.g_range_tipc_elem.setZindex(itsmo.vars.g_range_tipc_elem.org_zIndex + 1);
itsmo.vars.g_range_tipc_elem = null;
};
itsmo.vars.g_freeword_page = 0;
itsmo.vars.g_freeword_mode = null;
itsmo.vars.g_freeword_flg = '1'; // 全国
itsmo.freeword = {};
itsmo.vars.g_freeword_beforeMode = '';
itsmo.vars.g_freeword_beforeGenre = '';
itsmo.vars.g_free_word = '';
itsmo.vars.g_freeword_addr = false;
itsmo.vars.g_free_word_bsFromDetail = '';
itsmo.vars.g_genre_bus_click = '';
/*
freeword
フリーワード検索
@param mode string 検索モード
@param word string 検索ワード
for public use
*/
itsmo.freeword.freeword = function( mode, word, other )
{
itsmo.vars.g_genre_bus_click = '';
if (word == BUS_SEARCH_KEYWORD) {
mode = 'bus';
//Bus around from detail
if (other == itsmo.map.bus.genreSearchFlag){
itsmo.vars.g_genre_bus_click = '1';
} else if (typeof (other) != 'undefined' && other != '') {
var parseLatLon = other.split('_');
if (parseLatLon.length == 2) {
itsmo.vars.g_free_word_bsFromDetail = '1';
var lat = ZDC.msTodeg(parseLatLon[0]);
var lon = ZDC.msTodeg(parseLatLon[1]);
var center = new ZDC.LatLon(lat, lon);
itsmo.vars.g_map_obj.moveLatLon(center);
itsmo.vars.g_map_search_location = itsmo.lib.toMilliSec(center);
}
}
itsmo.sub.map_tab_change('freeword', ['freeword', mode, word, other]);
} else {
itsmo.lib.document_setvalue('freewd', word);
itsmo.sub.map_tab_change('freeword', ['freeword', mode, word]);
}
if (itsmo.vars.g_freeword_page != 0) itsmo.vars.g_freeword_page = 1;
itsmo.vars.g_free_word = word;
itsmo.vars.g_freeword_mode = mode;
itsmo.vars.g_freeword_act = 'top';
itsmo.vars.g_freeword_addr = false;
itsmo.freeword.freeword_search();
};
/*
for public use
map_top.tpl からコールされているようです。
*/
itsmo.freeword.freeword_submit = function(url, key) {
if (typeof itsmo.vars.addon === 'undefined' || typeof itsmo.vars.addon.onClickFreeword === 'undefined') {
} else {
var cancel = false;
$.each(itsmo.vars.addon.onClickFreeword, function(i, v) {
if (v()) {
cancel = true;
}
});
if (cancel) {
return false;
}
}
itsmo.vars.g_freeword_page = 0;
itsmo.vars.g_freeword_addr = false;
if (itsmo.vars.g_freeword_beforeMode == '' || itsmo.vars.g_freeword_beforeMode != itsmo.vars.g_map_tab_mode) {
itsmo.vars.g_freeword_beforeMode = itsmo.vars.g_map_tab_mode;
}
if (itsmo.vars.g_freeword_beforeGenre == '' || itsmo.vars.g_freeword_beforeGenre != itsmo.vars.g_range_genre) {
itsmo.vars.g_freeword_beforeGenre = itsmo.vars.g_range_genre;
}
itsmo.freeword.freeword('', itsmo.lib.document_getvalue('freewd'));
let data ={};
data.nm = itsmo.lib.document_getvalue('freewd');
itsmo.lib.localstorage_set(data);
$('div form div.serch-box #freewd').blur();
itsmo.vars.g_range_spots_drawin = false;
return false;
};
/*
for public use
地図を動かしたとき
*/
itsmo.freeword.freeword_submit_move = function() {
itsmo.freeword.freeword('', itsmo.lib.document_getvalue('freewd'));
return false;
};
/*
for public use
別の候補を選択した場合
*/
itsmo.freeword.freeword_other = function(word) {
$('#freewd').attr('value', word);
itsmo.vars.g_free_word = word;
itsmo.vars.g_freeword_mode = 'addr';
itsmo.vars.g_freeword_act = 'top';
if (itsmo.vars.g_freeword_page != 0) itsmo.vars.g_freeword_page = 1;
itsmo.vars.g_freeword_addr = true;
itsmo.sub.map_tab_change('freewordaddr', ['freewordaddr', '', word]);
itsmo.freeword.freeword_search();
return false;
};
/*
for public use
*/
itsmo.freeword.freeword_move = function( lat, lon, cat, id, name )
{
//if ( cat != null ) { itsmo.myspot.myspot_history_add( cat, id, name, lat, lon ); }
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
itsmo.map.map_search_timer(false);
itsmo.sub.map_setcursor( lat, lon );
};
/*
for public use
*/
itsmo.freeword.freeword_page = function( page,mode )
{
itsmo.vars.g_freeword_page = page;
if(mode){
itsmo.vars.g_freeword_mode = mode;
}
itsmo.vars.g_freeword_addr = false;
itsmo.freeword.freeword_search();
};
/*
freeword_search
map/ajax_freeword.php にリクエストを投げ、
レスポンス時に、freeword_search_result 関数にコールバックさせます。
for private use
*/
itsmo.freeword.freeword_search = function()
{
var path = location.pathname;
var paths = path.split('/');
if (paths[1] == 'c' || paths[1] == 'map') {
path = '/'+paths[1]+'/';
} else {
path = '/'+paths[1]+'/'+paths[2]+'/';
}
// 2017/04/12 Phuoc Le - #8434 Add dataLayer
dataLayer.push(['_trackEvent', 'フリーワード', path, itsmo.vars.g_free_word, , true]);
if(itsmo.vars.g_free_word.length > 30){
alert('30文字以内で入力してください');
return false;
}
// ajax通信
var prm = itsmo.freeword.freeword_set_param();
itsmo.lib.map_waitopen();
if ( itsmo.vars.g_range_request != null ) {
itsmo.lib.XMLHttpRequest2_abort( itsmo.vars.g_range_request );
}
itsmo.vars.g_range_request = itsmo.lib.XMLHttpRequest2_send(
'/map/ajax_freeword.php',
itsmo.freeword.freeword_search_result,
'GET',
prm,
'xml'
);
};
/*
freeword_set_param
map/ajax_freeword.php にリクエストを投げる際のパラメータをセット
for private use
*/
itsmo.freeword.freeword_set_param = function()
{
if(!itsmo.vars.g_freeword_mode){
var cnt = 5;
}else{
var cnt = itsmo.vars.g_range_cnt;
}
if (itsmo.vars.g_home_p) {
// 自宅~現在の地図中心との距離
itsmo.vars.g_dist = itsmo.lib.getDistance(itsmo.vars.g_home_p.lat, itsmo.vars.g_home_p.lon, itsmo.vars.g_map_search_location.lat, itsmo.vars.g_map_search_location.lon);
}
if(itsmo.vars.g_free_word == itsmo.vars.g_freeWordComment["df"]){
itsmo.vars.g_free_word = '';
}
/*
if(itsmo.vars.g_freeword_flg == '1'){//全国検索
var prm = '&word=' + encodeURIComponent(itsmo.vars.g_free_word)
+ '&mode=' + itsmo.vars.g_freeword_mode
+ '&page=' + itsmo.vars.g_freeword_page
+ '&cnt=' + cnt;
}else{//周辺検索
itsmo.vars.g_freeword_mode = 'all';//施設検索のみ
*/
prm = itsmo.vars.g_map_search_location;
var prm = '&word=' + encodeURIComponent(itsmo.vars.g_free_word)
+ '&mode=' + itsmo.vars.g_freeword_mode
+ '&lat=' + prm.lat
+ '&lon=' + prm.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&page=' + itsmo.vars.g_freeword_page
+ '&cnt=' + itsmo.vars.g_range_cnt;
if(itsmo.vars.g_free_word_bsFromDetail != ''){
prm += '&frDetail=' + itsmo.vars.g_free_word_bsFromDetail;
}
if(itsmo.vars.g_genre_bus_click != ''){
prm += '&busGenre=' + itsmo.vars.g_genre_bus_click;
}
if (itsmo.vars.g_freeword_act) prm += '&act=' + itsmo.vars.g_freeword_act;
if (itsmo.vars.g_freeword_addr) prm += '&addron=1';
prm += '&dist=' + encodeURIComponent(itsmo.vars.g_dist);
prm += '&byway=' + encodeURIComponent(itsmo.vars.g_byway); // 1:レコメンド経由
// }
itsmo.vars.g_free_word_bsFromDetail = '';
return prm;
};
itsmo.freeword.freewordMoveFirst = function (result) {
var lat = null;
var lon = null;
if ($('status tpl', result) == 'ajax_freeword_list') {
if ($('all items', result).length > 0) {
lat = $($('all items', result)[0]).find('lat').text();
lon = $($('all items', result)[0]).find('lon').text();
if(lat != '' && lon != ''){
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
return;
}
}
if ($('phone items', result).length > 0) {
lat = $($('phone items', result)[0]).find('lat').text();
lon = $($('phone items', result)[0]).find('lon').text();
if(lat != '' && lon != ''){
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
return;
}
}
} else if($('addr_only', result).text() != 1){
if ($('post items', result).length > 0) {
lat = $($('post items', result)[0]).find('lat').text();
lon = $($('post items', result)[0]).find('lon').text();
if(lat != '' && lon != ''){
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
return;
}
}
if ($('station items', result).length > 0) {
lat = $($('station items', result)[0]).find('lat').text();
lon = $($('station items', result)[0]).find('lon').text();
if(lat != '' && lon != ''){
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
return;
}
}
if ($('addr items', result).length > 0) {
lat = $($('addr items', result)[0]).find('lat').text();
lon = $($('addr items', result)[0]).find('lon').text();
if(lat != '' && lon != ''){
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
return;
}
}
if ($('phone items', result).length > 0) {
lat = $($('phone items', result)[0]).find('lat').text();
lon = $($('phone items', result)[0]).find('lon').text();
if(lat != '' && lon != ''){
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
return;
}
}
if ($('all items', result).length > 0) {
lat = $($('all items', result)[0]).find('lat').text();
lon = $($('all items', result)[0]).find('lon').text();
if(lat != '' && lon != ''){
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
return;
}
}
}
}
/*
freeword_search_result
freeword_search 関数で投げられたリクエストが、
レスポンスされた時の処理です。
@param result object[xmldocument] レスポンスXML($.ajax の戻り)
for private use (system use)
*/
itsmo.freeword.freeword_search_result = function( result )
{
//if( typeof( result.responseXML.normalize ) != 'undefined') result.responseXML.normalize();// FFの4096byte制限対策
// result が XML などの場合
var err = $('err', result).text();
//var type = $('type', result).text();
if ( err != 0 ) {
//alert( 'itsmo.freeword.freeword_search_result エラー ' + err );
//return;
}
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml( $('left_html', result).text() );
itsmo.freeword.freewordMoveFirst(result);
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
var arrayExistID = [];
if($('all', result)){
itsmo.freeword.set_tip($('all', result), arrayExistID);
}
if($('station', result)){
itsmo.freeword.set_tip($('station', result), arrayExistID);
}
if($('post', result)){
itsmo.freeword.set_tip($('post', result), arrayExistID);
}
if($('phone', result)){
itsmo.freeword.set_tip($('phone', result), arrayExistID);
}
if($('bus', result)){
itsmo.freeword.set_tip($('bus', result), arrayExistID);
}
arrayExistID = [];
if($('addr', result)){
if ($('addr_only', result).text() == 1) {
itsmo.sub.map_tab_change('addrlist', 1);
// 最適化用変数初期化
itsmo.spot_range.spots_init();
itsmo.freeword.set_tip_range($('addr_data', result), true);
itsmo.freeword.set_tip_range($('addr_list items', result), false);
itsmo.vars.g_range_spots_uid = $(result).find('addr_data').find('uid').text();
// 住所周辺施設取得
itsmo.spot_range.detail_addr_range_top($('word', result).text());
// 中心に表示
prm = itsmo.vars.g_range_spots[itsmo.vars.g_range_spots_uid];
itsmo.spot_range.range_move(prm['lat'], prm['lon']);
itsmo.spot_range.range_tipopen(prm['uid']);
// フリーワード内容変更
$('#freewd').val(prm['nm']);
// 絞込から検索時、絞込情報取得
if (itsmo.vars.g_range_spots_drawin) itsmo.spot_range.addr_list($(result).find('addr_data').find('adcd').text(), 0);
} else {
// ココ吹き出し
itsmo.sub.map_maplink_tipallclear();
itsmo.freeword.set_maplink_data($('addr', result));
}
}
// ジャンル再検索リンク設定
itsmo.sub.set_genre_research();
//$('#ajax_leftmenu_result').html(result);
/*
// 動作分岐
switch ( type ) {
case 'range':
case 'wide':
case 'all':
itsmo.sub.map_tab_sethtml( $('html_list', result).text() );
itsmo.range.range_freeword( itsmo.vars.g_free_word, result );
break;
case 'addr':
case 'addrlist':
itsmo.sub.map_tab_sethtml( $('html_list', result).text() );
break;
}
*/
};
//全国?付近?
itsmo.freeword.freewordSelectArea = function(id){
if(id == 'freewd_area'){
itsmo.vars.g_freeword_flg = 0;
}else{
itsmo.vars.g_freeword_flg = 1;
}
var txt = $('#' + id + ' strong').html();
$('#freeword_flg span').html(txt);
itsmo.lib.document_off('freeword_chg_window');
};
//ツールチップ作成
itsmo.freeword.set_tip = function(data, arrayExistID){
var set_tip = function(){
//param
var prm = {};
prm['uid'] = $(this).find('uid').text();
//check id exist
if($.inArray(prm.uid, arrayExistID) == -1) {
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['short_nm'] = $(this).find('short_nm').text();
prm['gnr_nm'] = $(this).find('gnr_nm').text();
prm['gnr_id'] = $(this).find('gnr_id').text();
prm['iconL'] = $(this).find('iconL').text();
prm['iconM'] = $(this).find('iconM').text();
prm['iconS'] = $(this).find('iconS').text();
if(prm['uid'].indexOf("bus") != -1){
prm['groupId'] = $(this).find('groupId').text();
prm['company'] = $(this).find('company').text();
}
prm['tip_c'] = $(this).find('tip_c').text();
prm['tip_o'] = $(this).find('tip_o').text();
arrayExistID.push(prm.uid);
//ツールチップ作成
var div_id = itsmo.sub.set_tooltip_s(prm['tip_c'],prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.freeword.set_tip_open(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.freeword.set_tip_open(prm.uid);
});
}
}
$(data).find('items').each(set_tip);
};
//ツールチップOPEN
itsmo.freeword.set_tip_open = function(uid){
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
if(!data){ return false; }
var div_id = itsmo.sub.map_clickable_tipopen(data.tip_o,data);
};
//ココ吹き出しデータ作成
itsmo.freeword.set_maplink_data = function(data){
$(data).find('items').each(function(){
//param
var prm = {};
prm['uid'] = $(this).find('uid').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['short_nm'] = $(this).find('short_nm').text();
prm['maplink_o'] = $(this).find('maplink_o').text();
itsmo.sub.map_getaddr({ lat: prm['lat'], lon: prm['lon'] }, function(result) {
if(result.status == 0) {
var addr = result.items[0].address;
} else {
var addr = '';
}
prm['addr'] = addr;
}, 6);
itsmo.vars.g_map_tipid_clickable_s[prm['uid']] = prm;
});
};
// ココ吹き出しオープン
itsmo.freeword.set_maplink_open = function(uid)
{
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
if(!data){ return false; }
// IPリンク アイコン+吹き出し Allclear
itsmo.sub.map_maplink_tipallclear();
// IPリンク吹き出し作成
itsmo.vars.g_map_link_html_o = data.maplink_o;
itsmo.sub.maplink_set(data.lat, data.lon);
};
//ツールチップ作成(地図最適化)
itsmo.freeword.set_tip_range = function(data, flg){
var set_tip = function(){
//param
var prm = {};
prm['uid'] = $(this).find('uid').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['short_nm'] = $(this).find('short_nm').text();
prm['adcd'] = $(this).find('adcd').text();
prm['adcdupp'] = $(this).find('adcdupp').text();
prm['gnr_nm'] = $(this).find('gnr_nm').text();
prm['gnr_id'] = $(this).find('gnr_id').text();
prm['iconL'] = $(this).find('iconL').text();
prm['iconM'] = $(this).find('iconM').text();
prm['iconS'] = $(this).find('iconS').text();
prm['tip_c'] = $(this).find('tip_c').text();
prm['tip_o'] = $(this).find('tip_o').text();
prm.tooltipOffsetBottomCenter = [ 14, 0 ];
if (flg) itsmo.vars.g_range_spots[prm['uid']] = prm;
//ツールチップ作成
var div_id = itsmo.sub.set_tooltip_opt_s(prm['tip_c'],prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.spot_range.range_move(prm['lat'], prm['lon']);
itsmo.spot_range.range_tipopen(prm['uid']);
});
}
data.each(set_tip);
};
itsmo.addrlist = {};
itsmo.vars.g_addr_rowest_adcd = null;
itsmo.vars.g_addr_rowest_lat = null;
itsmo.vars.g_addr_rowest_lon = null;
itsmo.vars.g_addr_name = null;
/*
住所一覧ページ表示( AJAX による遷移 )
住所一覧ページ表示
パラメータの詳細は、map/ajax_addrlist.php を参照してください。
@param string pageType ページ種別
'top' 都道府県の一覧 ( 住所一覧トップ, デフォルト )
'detail' 市区町村以降 ( どのレベルかは adcd で決まります )
@param string adcd 住所コード( pageType が 'top' 以外の場合有効 )
@param boolean rlat 最下層の緯度
@param boolean rlon 最下層の経度
@param boolean radcd 最下層の住所コード
for public use
*/
itsmo.addrlist.showPage = function( pageType, adcd, rlat, rlon, radcd )
{
itsmo.sub.map_tab_change('addrlist', ['addrlist', pageType, adcd, rlat, rlon, radcd]);
itsmo.sub.genre_research_clear();
if ( pageType != 'detail' || adcd == '' )
{
adcd = '00';
}
if (rlat && rlon) {
itsmo.vars.g_addr_rowest_lat = rlat;
itsmo.vars.g_addr_rowest_lon = rlon;
itsmo.vars.g_addr_rowest_adcd = radcd;
} else {
itsmo.vars.g_addr_rowest_lat = null;
itsmo.vars.g_addr_rowest_lon = null;
itsmo.vars.g_addr_rowest_adcd = null;
}
itsmo.addrlist.search( adcd );
};
/*
住所一覧 最下層ページ表示( AJAX による遷移 )
地図中心を指定緯度経度に移動し、住所一覧 最下層ページを表示します。
@param int lat 緯度
@param int lon 経度
@param string adcd 住所コード
for public use
*/
itsmo.addrlist.showLowest = function( lat, lon, adcd, zipcode )
{
// ココ吹き出し
itsmo.sub.map_maplink_tipallclear();
var name = itsmo.vars.g_addr_name +'−'+ adcd;
itsmo.sub.set_maplink_pre(name, name, lat, lon, zipcode);
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
};
/*
リクエスト
map/ajax_addrlist.php にリクエストを投げ、
レスポンス時に、itsmo.addrlist.search_result 関数にコールバックさせます。
@param string adcd 住所コード
for private use
*/
itsmo.addrlist.search = function( adcd , page)
{
// AJAX 通信
itsmo.vars.g_addrlist_adcd = adcd;
var prm = '&adcd=' + adcd;
if(page){
prm += '&page=' + page;
}
itsmo.lib.map_waitopen();
if ( itsmo.vars.g_range_request != null ) {
itsmo.lib.XMLHttpRequest2_abort( itsmo.vars.g_range_request );
}
itsmo.vars.g_range_request = itsmo.lib.XMLHttpRequest2_send(
'/map/ajax_addrlist.php',
itsmo.addrlist.search_result,
'GET',
prm,
'xml'
);
};
/*
ページ指定
for private use
*/
itsmo.addrlist.addr_page = function( page )
{
itsmo.addrlist.search(itsmo.vars.g_addrlist_adcd , page);
};
/*
search_result
search 関数で投げられたリクエストが、
レスポンスされた時の処理です。
@param result object[xmldocument] レスポンスXML($.ajax の戻り)
for private use (system use)
*/
itsmo.addrlist.search_result = function( result )
{
itsmo.lib.map_waitclose();
// result が XML などの場合
var err = $('err', result).text();
var type = $('type', result).text();
if ( err != 0 ) {
alert( 'itsmo.addrlist.search_result エラー err is ' + err );
return;
}
itsmo.sub.map_tab_sethtml( $('left_html', result).text() );
var lat = $('lat', result).text();
var lon = $('lon', result).text();
var isMaplink = true;
if ( lat == '') {
lat = itsmo.vars.g_map_search_location.lat;
isMaplink = false;
}
if ( lon == '') {
lon = itsmo.vars.g_map_search_location.lon;
}
itsmo.vars.g_addr_name = $('nm', result).text();
// ココ吹き出し
itsmo.sub.map_maplink_tipallclear();
if (isMaplink) {
$("#maplink_tipo_html").remove();
var html_balo = $('maplink_balo', result).text();
$('#ajax_leftmenu_result .map-pan-list1').after(html_balo);
itsmo.sub.maplink_set(lat, lon);
}
if (itsmo.vars.g_addr_rowest_lat && itsmo.vars.g_addr_rowest_lon) {
// 最下層データ再取得
itsmo.addrlist.showLowest(itsmo.vars.g_addr_rowest_lat,itsmo.vars.g_addr_rowest_lon,itsmo.vars.g_addr_rowest_adcd);
} else {
//地図移動
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(lat, lon));
}
};
/*
住所一覧で、最下層表示時の吹き出し HTML の取得
for private use
*/
itsmo.addrlist.getTipHtml = function( adcd )
{
// AJAX 通信
var prm = '&act=gettip&adcd=' + adcd;
itsmo.vars.g_range_request = itsmo.lib.XMLHttpRequest2_send(
'/map/ajax_addrlist.php',
itsmo.addrlist.getTipHtml_result,
'GET',
prm,
'xml'
);
};
/*
住所一覧で、最下層表示時の吹き出し HTML の取得 (callback)
for private use (system use)
*/
itsmo.addrlist.getTipHtml_result = function( result )
{
itsmo.lib.map_waitclose();
var err = $('err', result).text();
var type = $('type', result).text();
if ( err != 0 ) {
alert( 'itsmo.addrlist.getTipHtml_result エラー err is ' + err );
return;
}
if($('addr_data', result).find('uid').text()){
itsmo.addrlist.set_tip($('addr_data', result));
}
};
/*
ツールチップ作成
*/
itsmo.addrlist.set_tip = function(data){
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
//param
var prm = {};
prm['uid'] = $(data).find('uid').text();
prm['lat'] = $(data).find('lat').text();
prm['lon'] = $(data).find('lon').text();
prm['nm'] = $(data).find('nm').text();
prm['short_nm'] = $(data).find('short_nm').text();
prm['adcd'] = $(data).find('adcd').text();
prm['addr'] = $(data).find('addr').text();
prm['iconL'] = $(data).find('iconL').text();
prm['iconM'] = $(data).find('iconM').text();
prm['iconS'] = $(data).find('iconS').text();
prm['tip_c'] = $(data).find('tip_c').text();
prm['tip_o'] = $(data).find('tip_o').text();
//ツールチップ作成
var div_id = itsmo.sub.set_tooltip_s(prm.tip_c ,prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.addrlist.set_tip_open(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.addrlist.set_tip_open(prm.uid);
});
};
/*
ツールチップOPEN
*/
itsmo.addrlist.set_tip_open = function(uid){
var data = itsmo.vars.g_map_tipid_clickable_s[uid];
if(!data){ return false; }
//ツールチップ作成
var div_id = itsmo.sub.map_clickable_tipopen(data.tip_o,data);
};
itsmo.vars.g_mypage_request = null;
itsmo.vars.g_home_tipid_c = null;
itsmo.vars.g_home_tipid_o = null;
itsmo.vars.g_home_html_o = '';
itsmo.vars.g_home_p = null;
itsmo.mypage = {};
itsmo.mypage.flgOpenBalloon = false;
//------------------------------------------------
// ホームポジション
//------------------------------------------------
itsmo.mypage.mypage = function(mode, point)
{
var addr = null;
// 地点変更のイベント初期化
itsmo.myspot.chengeClickMap();
if (mode == 'top') {
itsmo.sub.map_tab_change('mypage', ['mypage', mode]);
}
if (mode && mode != 'top') {
// 処理中ウィンドウオープン
itsmo.lib.map_wait2open('処理中');
} else if (mode == 'top') {
// 処理中画像表示
itsmo.lib.document_off('ajax_leftmenu');
itsmo.lib.document_on('ajax_leftmenu_wait');
}
itsmo.sub.genre_research_clear();
var i = itsmo.vars.g_map_search_location;
var prm = '';
if (point) {
prm = 'lat=' + point.lat
+ '&lon=' + point.lon
} else {
prm = 'lat=' + i.lat
+ '&lon=' + i.lon
}
prm += '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy;
if (mode != null) prm += '&mode=' + encodeURIComponent(mode);
// if (itsmo.vars.g_mypage_request != null) itsmo.lib.XMLHttpRequest2_abort(itsmo.vars.g_mypage_request);
itsmo.vars.g_mypage_request = itsmo.lib.XMLHttpRequest2_send('/map/ajax_mypage.php'
,itsmo.mypage.mypage_result, 'GET', prm);
itsmo.lib.lastAjaxObj = null;
};
itsmo.mypage.mypage_result = function(result)
{
result = $(result);
var err = result.find('err').text();
var text = '';
// 処理中ウィンドウクローズ
if (result.find('mode').text() && result.find('mode').text() != 'top') {
itsmo.lib.map_wait2close();
} else if (result.find('mode').text() == 'top') {
// 処理中画像非表示
itsmo.lib.document_on('ajax_leftmenu');
itsmo.lib.document_off('ajax_leftmenu_wait');
}
// エラー処理
if (err == 8) {
itsmo.lib.aplErrorWindow('W', '0005', 'myhistory');
return;
} else if (err == 13) {
itsmo.lib.aplErrorWindow('W', '0004', 'myhome', '自宅');
return;
} else if (err == 12) {
itsmo.lib.aplErrorWindow('W', '0005', 'myhome', '自宅');
return;
} else if (err == 11) {
itsmo.lib.aplErrorWindow('W', '0003', 'myhome', '自宅');
return;
} else if (err != 0) {
itsmo.lib.aplErrorWindow('W', '0002', 'mypage', 'マイページ');
return;
}
// 完了メッセージ
switch (result.find('mode').text()) {
case 'home_add':
itsmo.lib.aplErrorWindow('I', '0001', 'myhome', '自宅', 'home_add');
break;
case 'home_del':
itsmo.lib.aplErrorWindow('I', '0002', 'myhome', '自宅', 'home_del');
break;
}
// 自宅配置
if(itsmo.vars.g_home_tipid_c != null) {
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_home_tipid_c);
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_home_tipid_o);
}
if ((result.find('home lon').text() != '') && (result.find('home lat').text() != '')) {
itsmo.vars.g_home_p = {lat: parseInt(result.find('home lat').text(), 10)
, lon: parseInt(result.find('home lon').text(), 10)};
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(itsmo.vars.g_home_p), {
html: decodeURIComponent(result.find('home html_tipc').text()),
offset: new ZDC.Pixel(-12, -34),
size: new ZDC.WH(22, 34)
});
tip.setZindex(itsmo.map.D_TIPZIDX_HOME);
itsmo.vars.g_home_tipid_c = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_home_html_o = result.find('home html_tipo').text();
var html = decodeURIComponent(itsmo.vars.g_home_html_o);
var size = itsmo.sub.getHtmlSize(html);
tip = new ZDC.UserWidget(itsmo.lib.toLatLon(itsmo.vars.g_home_p), {
html: html,
size: size,
offset: new ZDC.Pixel(-159, -(size.height) -25)
});
tip.setZindex(itsmo.map.D_TIPZIDX_HOME);
itsmo.vars.g_home_tipid_o = itsmo.vars.g_map_layer_clickable.add(tip);
var noDisplay;
if(false == itsmo.mypage.flgOpenBalloon){
noDisplay = true;
}
itsmo.mypage.home_openballoon(noDisplay);
} else {
itsmo.vars.g_home_p = null;
}
if(itsmo.vars.g_map_tab_mode == 'mypage') {
// Myページタブ表示
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml(result.find('html_list').text());
}
// ログイン情報書き換え
itsmo.vars.d_name = $('#login_name').html();
if ($('a').hasClass('btn-logout') && itsmo.vars.d_name == '') {
$('div .login-head').html('');
}
};
// 地図移動
itsmo.mypage.home_move = function(point)
{
if (point) itsmo.vars.g_home_p = point;
if(itsmo.vars.g_home_p == null) {
itsmo.mypage.mypage('home_add');
} else {
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(itsmo.vars.g_home_p));
itsmo.mypage.home_openballoon();
}
}
//------------------------------------------------
// ホームポジション
//------------------------------------------------
// バルーン制御
itsmo.mypage.home_openballoon = function(noDisplay)
{
if(typeof noDisplay == "undefined" || noDisplay == null){
noDisplay = false;
}
if (itsmo.vars.g_home_tipid_o == null) {
var html = decodeURIComponent(itsmo.vars.g_home_html_o);
var tip = new ZDC.UserWidget(itsmo.vars.g_home_p, {
html: html,
size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel(-162, -155)
});
tip.setZindex(itsmo.map.D_TIPZIDX_HOME);
itsmo.vars.g_home_tipid_o = itsmo.vars.g_map_layer_clickable.add(tip);
}
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_home_tipid_c);
if(false == noDisplay){
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_home_tipid_o);
itsmo.mypage.flgOpenBalloon = true;
}
};
itsmo.mypage.home_closeballoon = function(idx)
{
itsmo.vars.g_map_layer_clickable.hideById(itsmo.vars.g_home_tipid_o);
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_home_tipid_c);
itsmo.mypage.flgOpenBalloon = false;
};
// SNS共有設定
itsmo.mypage.openSnsShare = function()
{
itsmo.lib.ScreenOpen();
var str = $('#wrap-map').html();
str += "";
str += "";
str += "";
$('#wrap-map').html(str);
};
itsmo.myspot = {};
itsmo.vars.g_myspot_request = null;
itsmo.vars.g_myspot_list = [];//リストの内容保持
itsmo.vars.g_myspot_folder_id = [];//フォルダID
itsmo.vars.g_myspot_folder_name = [];//フォルダ名
itsmo.vars.g_myspot_folder_cnt = [];//フォルダ件数
itsmo.vars.g_myspot_folder_up = [];//更新日
itsmo.vars.g_myspot_folder_selected = null;
itsmo.vars.g_myspot_group_selected = null;
itsmo.vars.g_myspot_tipcnt_c = 0;//TIP
itsmo.vars.g_myspot_tipid_c = [];
itsmo.vars.g_myspot_tiphtml_c = '';
itsmo.vars.g_myspot_tipcnt_o = 0;
itsmo.vars.g_myspot_tipid_o = [];
itsmo.vars.g_myspot_tiphtml_o = '';
itsmo.vars.g_myspot_opentip = null;
itsmo.vars.g_myspot_elem_listfolderselect = null;//フォルダ選択ボックス
itsmo.vars.g_myspot_elem_addfolderselect = null;
itsmo.vars.g_myspot_elem_addikkatufolderselect = null;
itsmo.vars.g_myspot_elem_myspotlistdiv = null;//myスポット一覧
itsmo.vars.g_myspot_listpage = 0;
itsmo.vars.g_myspot_allcnt = 0;
itsmo.vars.g_myspot_disp = '';
itsmo.vars.g_myspot_del = '';
itsmo.vars.g_myspot_edit_spot = false; // 地点変更時フラグ
itsmo.vars.g_myspot_group_list = []; // グループリスト保持用
itsmo.vars.opened_cond_window = null; // リストWindow
itsmo.vars.g_myspot_snspostset = {}; // SNS投稿設定保持用
itsmo.vars.g_myspot_adddata = {}; // 登録用データ
//------------------------------------------------
// 基本処理
//------------------------------------------------
// メニュートップ
itsmo.myspot.myspot_leftmenutop = function() {
itsmo.vars.g_myspot_folder_selected = null;
itsmo.vars.g_myspot_group_selected = null;
itsmo.range.range_tipclear();
itsmo.myspot.myspot_clear();
itsmo.myspot.myspot_listreflesh();
};
//------------------------------------------------
// レイヤー制御
//------------------------------------------------
itsmo.myspot.myspot_clear = function() {
if(itsmo.vars.g_myspot_tipcnt_c == 0 && itsmo.vars.g_myspot_tipcnt_o == 0) return;
for(var i = 0;i < itsmo.vars.g_myspot_tipcnt_c;i ++) {
itsmo.vars.g_map_layer_clickable.removeById( itsmo.vars.g_myspot_tipid_c[i] )
itsmo.vars.g_myspot_tipid_c[i] = null;
}
itsmo.vars.g_myspot_tipcnt_c = 0;
itsmo.vars.g_map_layer_clickable.removeById( itsmo.vars.g_myspot_opentip )
itsmo.vars.g_myspot_opentip = null;
itsmo.vars.g_myspot_opentip_uid = null;
if ($('#ajax_menu-my').hasClass('act')) itsmo.sub.map_tab_sethtml('');
};
//------------------------------------------------
// バルーン制御
//------------------------------------------------
itsmo.myspot.myspot_openballoon = function(idx)
{
var data = itsmo.vars.g_myspot_list[idx];
// 中吹き出し
var html = itsmo.vars.g_myspot_tiphtml_o;
html = html.replace(/__TITLE__/g, '' + data.title);
html = html.replace(/__COMMENT__/g, '' + data.comment);
html = html.replace(/__ID__/g, '' + idx);
html = html.replace(/__LAT__/g, '' + data.lat);
html = html.replace(/__LON__/g, '' + data.lon);
var view_js = '';
if (data.ckbn != '' && data.poicd != '') {
// 駅詳細
// 住所一覧
// 施設詳細
if (data.view_detail != '' && data.view_detail != undefined && data.view_detail != null) {
view_js = '詳細 ';
}
} else if (data.url != '') {
// CP_URLなど
view_js = '詳細 ';
} else {
// 施設以外
}
html = html.replace(/__VIEW_DETAIL__/g, '' + view_js);
//ツールチップ作成
var div_id = itsmo.myspot.myspot_tipopen(html, data, idx);
};
// ツールチップ削除
itsmo.myspot.myspot_clearballoon = function() {
if(itsmo.vars.g_myspot_opentip == null) return;
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_myspot_opentip);
itsmo.vars.g_myspot_opentip = null;
itsmo.vars.g_myspot_opentip_uid = null;
itsmo.vars.g_map_draged = 2;
};
// ツールチップ全部clear
itsmo.myspot.myspot_TipAllClear = function(flg) {
itsmo.myspot.myspot_clearballoon();
if(itsmo.vars.g_myspot_list){
$.each(itsmo.vars.g_myspot_list, function(i,val) {
itsmo.vars.g_map_layer_clickable.removeById(val.tip_id);
});
}
itsmo.vars.g_myspot_list = {};
};
// 小吹き出し作成
itsmo.myspot.set_tooltip_s = function(tipHtml, data, idx)
{
var clat = data.lat;
var clon = data.lon;
var uid = data.uid;
var div_id = 'tip_c_' + uid;
tipHtml = '' + tipHtml + '
';
var i = itsmo.vars.g_map_search_location;
if ( clat == '') {
clat = i.lat;
}
if ( clon == '') {
clon = i.lon;
}
var point = itsmo.lib.toLatLon(clat, clon);
var tip = new ZDC.UserWidget(point, {
html: tipHtml,
size: itsmo.sub.getHtmlSize(tipHtml),
offset: new ZDC.Pixel(-8, -10)
});
tip.setZindex(itsmo.map.d_map_zIdx_myspot);
id = itsmo.vars.g_map_layer_clickable.add( tip );
itsmo.vars.g_map_layer_clickable.showById( id );
itsmo.vars.g_myspot_tipid_c[idx] = id;
data['tip_id'] = id;
itsmo.vars.g_myspot_list[idx] = data;
itsmo.map.addEventTooltip(tip, itsmo.map.d_map_zIdx_myspot );
if(itsmo.vars.g_config.mapinfo_minimize != 0){
$('#'+ div_id +' .fukidasi0').attr('class','f-supper0');
}
return div_id;
};
// 中吹き出し表示
itsmo.vars.g_myspot_opentip_uid = null;
itsmo.myspot.myspot_tipopen = function(html, data, idx) {
if (itsmo.vars.g_myspot_opentip_uid == data.uid) {
return;
}
itsmo.myspot.myspot_clearballoon();
var div_id = 'tip_o_' + data.uid;
html = '' + html + '
';
// ツールチップを作成
var point = itsmo.lib.toLatLon(data.lat, data.lon);
var tip = new ZDC.UserWidget(point, {
html: html,
//size: itsmo.sub.getHtmlSize(html),
offset: new ZDC.Pixel(-8, -10)
});
tip.setZindex(itsmo.map.d_map_zIdx_myspot + 10);
itsmo.vars.g_myspot_opentip = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_myspot_opentip_uid = data.uidl
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_myspot_opentip);
// itsmo.vars.g_myspot_tipid_o[idx] = itsmo.vars.g_myspot_opentip;
return div_id;
};
//------------------------------------------------
// 登録
//------------------------------------------------
// 施設詳細(遷移)
itsmo.myspot.detail_addmyspot = function(lat, lon, title, kn, addr, tel, poicd, gnrcd, ckbn) {
itsmo.vars.g_myspot_disp = 'contDetail';
itsmo.myspot.other_addmyspot(lat, lon, title, kn, addr, tel, poicd, gnrcd, ckbn);
};
// 施設・住所・不動産・アルバイト・ホテル・おすすめ情報の中吹き出し
itsmo.myspot.other_addmyspot = function(lat, lon, title, kn, addr, tel, poicd, gnrcd, ckbn, comment, url, isAddress) {
if(itsmo.lib.cookie_get('oUserInfoNavi')==''){
itsmo.lib.map_windowopen('regist_place_login_window');
return false;
}
setData = function(){};
setData.title = decodeURIComponent(title);
setData.tel = tel;
setData.lat = lat;
setData.lon = lon;
if (comment) {
setData.comment = comment;
} else {
setData.comment = '';
}
var fldid = '9999';
if (kn) fldid = itsmo.lib.initCheck(kn);
setData.folder = fldid;
setData.group = '0';
setData.regist_date = '';
setData.update_date = '';
setData.regist_client = '';
setData.update_client = '';
setData.poicd = poicd;
setData.ckbn = ckbn;
setData.gnrcd = gnrcd;
if (url) {
setData.url = url;
} else {
setData.url = '';
}
if (addr || isAddress) {
if(addr){
setData.addr = addr;
} else {
setData.addr = '';
}
itsmo.vars.g_myspot_adddata = setData;
// groupセレクトボックス
if (itsmo.vars.g_myspot_group_list.length == 0 || typeof itsmo.vars.g_myspot_snspostset.con_fb === 'undefined') {
itsmo.myspot.group_listget();
} else {
itsmo.myspot.myspot_add();
}
} else {
var point = itsmo.lib.toLatLon(lat, lon);
itsmo.sub.map_getaddr({ lat: lat, lon: lon}, function(result) {
// itsmo.lib.map_wait2close();
if(result.status == 0) {
var addr = result.items[0].address;
} else {
var addr = '住所なし';
}
setData.addr = addr;
itsmo.vars.g_myspot_adddata = setData;
// groupセレクトボックス
if (itsmo.vars.g_myspot_group_list.length == 0 || typeof itsmo.vars.g_myspot_snspostset.con_fb === 'undefined') {
itsmo.myspot.group_listget();
} else {
itsmo.myspot.myspot_add();
}
});
}
};
//------------------------------------------------
// myspot一覧取得
//------------------------------------------------
itsmo.myspot.myspot_listget = function(id)
{
if(itsmo.vars.g_myspot_folder_selected == null) itsmo.vars.g_myspot_folder_selected = '';
if(itsmo.vars.g_myspot_group_selected == null) itsmo.vars.g_myspot_group_selected = '';
var prm = 'mode=myspot_list';
prm += '&folder='+itsmo.vars.g_myspot_folder_selected+'&page='+itsmo.vars.g_myspot_listpage;
prm += '&group='+itsmo.vars.g_myspot_group_selected;
if(id) prm += '&id=' + id;
if ($('#ajax_menu-my').hasClass('act')) {
// 処理中画像表示
itsmo.lib.document_off('ajax_leftmenu');
itsmo.lib.document_on('ajax_leftmenu_wait');
} else {
// 処理中ウィンドウオープン
// itsmo.lib.map_wait2open('しばらくお待ちください。');
}
if (itsmo.vars.g_myspot_request != null) itsmo.lib.XMLHttpRequest2_abort(itsmo.vars.g_myspot_request);
itsmo.vars.g_myspot_request = itsmo.lib.XMLHttpRequest2_send('/map/ajax_myspot.php',itsmo.myspot.myspot_listget_result,'GET',prm);
};
itsmo.myspot.myspot_listget_result = function(result)
{
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if (err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'myspot');
} else {
itsmo.lib.aplErrorWindow('W', '0003', 'myspot', '登録地点一覧');
if ($('#ajax_menu-my').hasClass('act')) {
// 処理中画像非表示
itsmo.lib.document_on('ajax_leftmenu');
itsmo.lib.document_off('ajax_leftmenu_wait');
}
return;
}
}
if ($('#ajax_menu-my').hasClass('act')) {
// 処理中画像非表示
itsmo.lib.document_on('ajax_leftmenu');
itsmo.lib.document_off('ajax_leftmenu_wait');
}
// クリア
itsmo.myspot.myspot_clear();
// IPリンクチップ最小化
itsmo.sub.map_maplink_tipclear();
// 小吹き出し
var html_c = decodeURIComponent($(result).find('tiphtmlc').text());
itsmo.vars.g_myspot_tiphtml_c = html_c;
// 中吹き出し
var html_o = decodeURIComponent($(result).find('tiphtmlo').text());
itsmo.vars.g_myspot_tiphtml_o = html_o;
// グループ一覧をリストに保持
var i = 0;
$(result).find('group_list').each(function()
{
itsmo.vars.g_myspot_group_list[$(this).find('fldid').text()] = $(this).find('fldnm').text();
i++;
});
// TIPS作成
i = 0;
$(result).find('list').each(function()
{
// リスト保持
listData = function(){};
listData.uid = $(this).find('id').text();
listData.title = $(this).find('title').text();
listData.addr = $(this).find('addr').text();
listData.comment = $(this).find('comment').text();
listData.tel = $(this).find('tel').text();
listData.lat = $(this).find('lat').text();
listData.lon = $(this).find('lon').text();
listData.folder = $(this).find('folder').text();
listData.group = $(this).find('group').text();
listData.disp_imgurl = $(this).find('disp_imgurl').text();
listData.regist_date = $(this).find('regist_date').text();
listData.update_date = $(this).find('update_date').text();
listData.regist_client = $(this).find('regist_client').text();
listData.update_client = $(this).find('update_client').text();
listData.poicd = $(this).find('poicd').text();
listData.ckbn = $(this).find('ckbn').text();
listData.gnrcd = $(this).find('gnrcd').text();
listData.url = $(this).find('detail_url').text();
listData.view_detail = $(this).find('view_detail').text();
itsmo.vars.g_myspot_list[i] = listData;
// 小吹き出し
var html = itsmo.vars.g_myspot_tiphtml_c;
html = html.replace(/__ID__/g, '' + i);
html = html.replace(/__TITLE_S__/g, '' + $(this).find('title_s').text());
//ツールチップ作成
var div_id = itsmo.myspot.set_tooltip_s(html, itsmo.vars.g_myspot_list[i], i);
itsmo.vars.g_myspot_tipcnt_c ++;
i++;
});
itsmo.vars.g_myspot_allcnt = $(result).find('allcnt').text();
if ($('#ajax_menu-my').hasClass('act')) {
itsmo.sub.map_tab_sethtml($(result).find('listhtml').text());
itsmo.myspot.setSelectbox($('#init_'+itsmo.vars.g_myspot_folder_selected));
itsmo.myspot.setSelectbox($('#group_'+itsmo.vars.g_myspot_group_selected));
} else {
// 左メニューリサイズ
itsmo.map.setLeftContentSize();
}
// 指定idを開く処理
var openid = $(result).find('openid').text();
if(openid != '') {
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(itsmo.vars.g_myspot_list[openid].lat, itsmo.vars.g_myspot_list[openid].lon));
itsmo.myspot.myspot_openballoon(openid);
}
// 処理中非表示
itsmo.lib.map_waitclose();
};
// 読み込みなおし
itsmo.myspot.myspot_listreflesh = function() {
itsmo.vars.g_myspot_listpage = 0;
// 地点変更のイベント初期化
itsmo.myspot.chengeClickMap();
itsmo.myspot.myspot_listget();
};
// ページ遷移
itsmo.myspot.myspot_listpage = function(p) {
itsmo.vars.g_myspot_listpage = p;
// 地点変更のイベント初期化
itsmo.myspot.chengeClickMap();
itsmo.myspot.myspot_listget();
};
// 地図以外から登録地点表示
itsmo.myspot.myspot_disp = function(p) {
itsmo.vars.g_myspot_listpage = 0;
// マイページタブ表示
itsmo.sub.map_tab_change('myspot', ['myspot', p]);
};
//------------------------------------------------
// myspot表示
//------------------------------------------------
itsmo.vars.g_myspot_view_idx = -1;
itsmo.myspot.myspot_view = function(idx) {
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(itsmo.vars.g_myspot_list[idx].lat, itsmo.vars.g_myspot_list[idx].lon));
itsmo.myspot.myspot_openballoon(idx);
// 地点変更のイベント初期化
itsmo.myspot.chengeClickMap();
// 文字整形
var comment = itsmo.vars.g_myspot_list[idx].comment.replace(/
/g,'\n');
var reg_cl = '';
if(itsmo.vars.g_myspot_list[idx].regist_client == 'P') reg_cl = '(PC)';
if(itsmo.vars.g_myspot_list[idx].regist_client == 'M') reg_cl = '(携帯)';
var upd_cl = '';
if(itsmo.vars.g_myspot_list[idx].update_client == 'P') upd_cl = '(PC)';
if(itsmo.vars.g_myspot_list[idx].update_client == 'M') upd_cl = '(携帯)';
// 値設定
itsmo.lib.document_setvalue('ajax_myspot_view_title',itsmo.vars.g_myspot_list[idx].title);
itsmo.lib.document_setvalue('ajax_myspot_view_title2',itsmo.vars.g_myspot_list[idx].title);
itsmo.lib.document_setvalue('ajax_myspot_view_imgurl',itsmo.vars.g_myspot_list[idx].disp_imgurl);
itsmo.lib.document_setvalue('ajax_myspot_view_group',itsmo.vars.g_myspot_group_list[itsmo.vars.g_myspot_list[idx].group]);
itsmo.lib.document_setvalue('ajax_myspot_view_folder',itsmo.myspot.myspot_foldername(itsmo.vars.g_myspot_list[idx].folder));
if (itsmo.vars.g_myspot_list[idx].group) {
itsmo.lib.document_setvalue('ajax_myspot_view_group',itsmo.vars.g_myspot_group_list[itsmo.vars.g_myspot_list[idx].group]);
} else {
$('#ajax_myspot_view_group').parent().parent().css('display', 'none');
}
itsmo.lib.document_setvalue('ajax_myspot_view_comment',itsmo.vars.g_myspot_list[idx].comment);
itsmo.lib.document_setvalue('ajax_myspot_view_tel',itsmo.vars.g_myspot_list[idx].tel);
itsmo.lib.document_setvalue('ajax_myspot_view_addr',itsmo.vars.g_myspot_list[idx].addr);
itsmo.lib.document_setvalue('ajax_myspot_view_latlon','E'+itsmo.lib.map_dms2deg(itsmo.vars.g_myspot_list[idx].lon)+' N'+itsmo.lib.map_dms2deg(itsmo.vars.g_myspot_list[idx].lat));
itsmo.lib.document_setvalue('ajax_myspot_view_newdate',itsmo.vars.g_myspot_list[idx].regist_date + ' ' + reg_cl);
itsmo.lib.document_setvalue('ajax_myspot_view_update',itsmo.vars.g_myspot_list[idx].update_date + ' ' + upd_cl);
itsmo.vars.g_myspot_view_idx = idx;
if (!$.support.opacity && !$.support.style && (typeof document.documentElement.style.maxHeight == "undefined")) {
// IE6
$('#screen-wrap .screen').bgiframe();
}
itsmo.lib.map_windowopen('ajax_myspot_view');
};
// 編集
itsmo.myspot.myspot_view_edit = function() {
itsmo.lib.map_windowclose();
itsmo.myspot.myspot_addedit(itsmo.vars.g_myspot_view_idx);
};
// ルート設定
itsmo.myspot.myspot_view_addstart = function() {
itsmo.myroute.hereStart(itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].title,
{lat:itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].lat,lon:itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].lon});
itsmo.lib.map_windowclose();
};
itsmo.myspot.myspot_view_addstop = function() {
itsmo.myroute.hereByway(itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].title,
{lat:itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].lat,lon:itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].lon});
itsmo.lib.map_windowclose();
};
itsmo.myspot.myspot_view_addgoal = function() {
itsmo.myroute.hereGo(itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].title,
{lat:itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].lat,lon:itsmo.vars.g_myspot_list[itsmo.vars.g_myspot_view_idx].lon});
itsmo.lib.map_windowclose();
};
//------------------------------------------------
// myspotいきなり表示
//------------------------------------------------
itsmo.myspot.myspot_open = function(id,fid,gid) {
itsmo.sub.map_tab_change('myspot', ['myspot', id, fid, gid]);
itsmo.lib.document_off('ajax_mypage_top');
itsmo.lib.document_on('ajax_mypage_myspot');
if(fid != null && fid != '') itsmo.vars.g_myspot_folder_selected = fid;
if(gid != null && gid != '') itsmo.vars.g_myspot_group_selected = gid;
itsmo.myspot.myspot_listget(id);
return;
}
//------------------------------------------------
// myspot編集
//------------------------------------------------
// 新規保存(地図の中心/地図の右クリック)
itsmo.myspot.myspot_addpoint = function(ckbn) {
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
// itsmo.lib.map_wait2open('しばらくお待ちください');
itsmo.vars.g_myspot_view_idx = -1;
itsmo.sub.map_getaddr(loc,function(result) {
// itsmo.lib.map_wait2close();
if(result.status == 0) {
var addr = result.items[0].address;
} else {
var addr = '住所なし';
}
itsmo.myspot.myspot_addpoint2(addr,loc.lat,loc.lon,ckbn);
});
};
itsmo.myspot.myspot_addpoint2 = function(title,lat,lon,ckbn) {
setData = function(){};
setData.title = title;
setData.addr = title;
setData.comment = '';
setData.tel = '';
setData.lat = lat;
setData.lon = lon;
setData.folder = '9999';
setData.group = '0';
setData.regist_date = '';
setData.update_date = '';
setData.regist_client = '';
setData.update_client = '';
setData.poicd = '';
setData.ckbn = (ckbn != '' && ckbn != undefined && ckbn != null)? ckbn : '' ;
setData.gnrcd = '';
setData.url = '';
itsmo.vars.g_myspot_adddata = setData;
// SNS投稿設定取得・設定
itsmo.myspot.grant_listget();
};
// 編集
itsmo.myspot.myspot_addedit = function(idx) {
itsmo.vars.g_myspot_view_idx = idx;
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(itsmo.vars.g_myspot_list[idx].lat, itsmo.vars.g_myspot_list[idx].lon));
itsmo.vars.g_myspot_adddata = itsmo.vars.g_myspot_list[idx];
itsmo.myspot.myspot_add();
};
// ウィンドウ開く
itsmo.myspot.myspot_add = function() {
// グループ一覧設定
var group_sb = $('#ajax_myspot_add_group');
if(group_sb.get(0).type == 'select-one') {
group_sb = group_sb.get(0);
i = 0;
for (var key in itsmo.vars.g_myspot_group_list) {
group_sb.length = i+1;
group_sb.options[i].value = key;
group_sb.options[i].text = itsmo.vars.g_myspot_group_list[key];
i++;
}
}
// 地点変更のイベント初期化
if (itsmo.vars.g_myspot_disp != 'contDetail') itsmo.myspot.chengeClickMap();
addData = itsmo.vars.g_myspot_adddata;
// 文字整形
comment = addData.comment.replace(/
/g,'\n');
var reg_cl = '';
if(addData.regist_client == 'P') reg_cl = '(PC)';
if(addData.regist_client == 'M') reg_cl = '(携帯)';
var upd_cl = '';
if(addData.update_client == 'P') upd_cl = '(PC)';
if(addData.update_client == 'M') upd_cl = '(携帯)';
// タイトルの変更
if(addData.uid) {
//-- 編集の場合
// タイトル設定
var head = addData.title;
// 地点変更欄非表示
$('#ajax_myspot_edit_spot').show();
$('#ajax_myspot_edit_spot').click(function() {
itsmo.myspot.myspotEditSpot(itsmo.vars.g_myspot_view_idx);
return false;
});
// SNS投稿欄非表示
$('#snspostchk').parent().hide();
} else {
//-- 新規の場合
// タイトル設定
var head = "新規登録";
// 地点変更欄表示
$('#ajax_myspot_edit_spot').hide();
// SNS投稿欄表示
$('#snspostchk').parent().show();
}
// 値セット
itsmo.lib.document_setvalue('ajax_myspot_add_head', head);
itsmo.lib.document_setvalue('ajax_myspot_add_title', addData.title);
itsmo.lib.document_setvalue('ajax_myspot_add_addr', addData.addr);
// コメントに住所を表示する - 新規登録時のみ 090515a-yanagawa
if(addData.uid) {
itsmo.lib.document_setvalue('ajax_myspot_add_comment', comment);
} else {
if (addData.comment) {
itsmo.lib.document_setvalue('ajax_myspot_add_comment', addData.addr + addData.comment);
} else {
itsmo.lib.document_setvalue('ajax_myspot_add_comment', addData.addr);
}
}
itsmo.lib.document_setvalue('ajax_myspot_add_tel', addData.tel);
itsmo.lib.document_setvalue('ajax_myspot_add_latlon', 'E'+itsmo.lib.map_dms2deg(addData.lon)+' N'+itsmo.lib.map_dms2deg(addData.lat));
if(addData.regist_client) {
itsmo.lib.document_setvalue('ajax_myspot_add_newdate', addData.regist_date + ' ' + reg_cl);
} else {
itsmo.lib.document_setvalue('ajax_myspot_add_newdate', '');
}
if(addData.update_client) {
itsmo.lib.document_setvalue('ajax_myspot_add_update', addData.update_date + ' ' + upd_cl);
} else {
itsmo.lib.document_setvalue('ajax_myspot_add_update', '');
}
itsmo.lib.document_setvalue('ajax_myspot_add_folder', addData.folder);
if (addData.group) {
itsmo.lib.document_setvalue('ajax_myspot_add_group', addData.group);
} else {
$('#ajax_myspot_add_group').parent().parent().css('display', 'none');
}
itsmo.lib.document_setvalue('ajax_myspot_add_imgurl', addData.disp_imgurl);
itsmo.lib.document_setvalue('ajax_myspot_add_id', addData.uid);
itsmo.lib.document_setvalue('ajax_myspot_add_lat', addData.lat);
itsmo.lib.document_setvalue('ajax_myspot_add_lon', addData.lon);
itsmo.lib.document_setvalue('ajax_myspot_add_poicd', addData.poicd);
itsmo.lib.document_setvalue('ajax_myspot_add_ckbn', addData.ckbn);
itsmo.lib.document_setvalue('ajax_myspot_add_gnrcd', addData.gnrcd);
itsmo.lib.document_setvalue('ajax_myspot_add_url', addData.url);
// SNS投稿設定
var sns_obj = $('#snspostchk');
var sns_set = itsmo.vars.g_myspot_snspostset;
if (sns_set.con_fb || sns_set.con_twt || sns_set.con_mixi) {
sns_obj.find('#snscon_on').show();
sns_obj.find('#snscon_off').hide();
if (sns_set.con_fb) {
if (sns_set.tar_fb) {
sns_obj.find('#sns_chk_fb').attr('checked','checked');
} else {
sns_obj.find('#sns_chk_fb').attr('checked', false);
}
sns_obj.find('#sns_chk_fb').parent().parent().show();
}
if (sns_set.con_twt) {
if (sns_set.tar_twt) {
sns_obj.find('#sns_chk_tw').attr('checked','checked');
} else {
sns_obj.find('#sns_chk_tw').attr('checked', false);
}
sns_obj.find('#sns_chk_tw').parent().parent().show();
}
if (sns_set.con_mixi) {
if (sns_set.tar_mixi) {
sns_obj.find('#sns_chk_mixi').attr('checked','checked');
} else {
sns_obj.find('#sns_chk_mixi').attr('checked', false);
}
sns_obj.find('#sns_chk_mixi').parent().parent().show();
}
} else {
sns_obj.find('#snscon_on').hide();
sns_obj.find('#snscon_off').show();
}
if (itsmo.vars.g_myspot_disp != 'contDetail') {
if (!$.support.opacity && !$.support.style && (typeof document.documentElement.style.maxHeight == "undefined")) {
// IE6
$('#screen-wrap .screen').bgiframe();
}
}
itsmo.lib.map_windowopen('ajax_myspot_add');
};
// 保存 ------------------------------------------
itsmo.myspot.myspot_add_submit = function() {
// 値を取得
var title = itsmo.lib.document_getvalue('ajax_myspot_add_title');
var addr = itsmo.lib.document_getvalue('ajax_myspot_add_addr');
var comment = itsmo.lib.document_getvalue('ajax_myspot_add_comment');
var tel = itsmo.lib.document_getvalue('ajax_myspot_add_tel');
var folder = itsmo.lib.document_getvalue('ajax_myspot_add_folder');
if ($('#ajax_myspot_add_group').parent().parent().css('display') == 'none') {
var group = 0;
} else {
var group = itsmo.lib.document_getvalue('ajax_myspot_add_group');
}
var id = itsmo.lib.document_getvalue('ajax_myspot_add_id');
var lat = itsmo.lib.document_getvalue('ajax_myspot_add_lat');
var lon = itsmo.lib.document_getvalue('ajax_myspot_add_lon');
var poicd = itsmo.lib.document_getvalue('ajax_myspot_add_poicd');
var ckbn = itsmo.lib.document_getvalue('ajax_myspot_add_ckbn');
var gnrcd = itsmo.lib.document_getvalue('ajax_myspot_add_gnrcd');
var url = itsmo.lib.document_getvalue('ajax_myspot_add_url');
var post_f = itsmo.lib.document_getvalue('sns_chk_fb');
var post_t = itsmo.lib.document_getvalue('sns_chk_tw');
var post_m = itsmo.lib.document_getvalue('sns_chk_mixi');
var posts = [];
if (post_f) posts.push(post_f);
if (post_t) posts.push(post_t);
if (post_m) posts.push(post_m);
// 入力チェック ------------------------------
// タイトル
title = title.replace(/^[\s ]+|[\s ]+$/g, "");
if(title.length < 2 || title.length > 24) {
alert("タイトルは2~24文字で入力して下さい");
return;
}
// コメント
tmp = comment;
tmp = tmp.replace(/^[\s ]+|[\s ]+$/g, "");
tmp = tmp.replace(/\n/g,'');
tmp = tmp.replace(/\r/g,'');
if(tmp.length > 60) {
alert("コメントは60文字以内で入力して下さい");
return;
}
// 電話番号
if(tel.length > 15) {
alert("電話番号は15文字以内で入力して下さい");
return;
}
if(tel.match(/[^0-9-]+/)) {
alert("電話番号は半角数字とハイフンで入力して下さい");
return;
}
// 実行
var prm = 'mode=myspot_edit';
prm += '&title='+encodeURIComponent(title)+'&addr='+encodeURIComponent(addr)+'&comment='+encodeURIComponent(comment)+'&tel='+encodeURIComponent(tel)+'&folder='+encodeURIComponent(folder);
prm += '&group='+encodeURIComponent(group)+'&id=' + id + '&lat=' + lat + '&lon=' + lon + '&poicd=' + poicd + '&ckbn=' + ckbn + '&gnrcd=' + gnrcd + '&url=' + encodeURIComponent(url);
if (posts.length > 0) prm += '&target='+encodeURIComponent(posts.join(','));
var path = '/map/ajax_myspot.php';
if (itsmo.vars.g_myspot_disp == 'contDetail') path = 'https://' + itsmo.vars.d_host_www + '/map/ajax_myspot.php';
itsmo.lib.map_windowclose();
itsmo.lib.XMLHttpRequest2_send_wait(path,itsmo.myspot.myspot_add_submit_result,'GET',prm,'保存中');
};
itsmo.myspot.myspot_add_submit_result = function(result) {
// エラーチェック
var err = $(result).find('err').text();
if(err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'myspot');
} else {
itsmo.lib.aplErrorWindow('W', '0004', 'myspot', '登録地点');
}
return;
}
// 確認ウィンドウ
itsmo.lib.aplErrorWindow('I', '0001', 'myspot', '登録地点', 'spotadd');
// 正常処理
if (itsmo.vars.g_myspot_disp != 'contDetail') itsmo.myspot.myspot_listreflesh();//一覧更新
};
// 削除 ------------------------------------------
itsmo.myspot.myspot_del = function(idx) {
// 地点変更のイベント初期化
itsmo.myspot.chengeClickMap();
if (typeof idx === 'undefined') {
// 一覧から削除
var cnt = itsmo.lib.getCheckNum('ajax_mayspot_list_del');
if (cnt == false) {
itsmo.lib.aplErrorWindow('E', '0006', 'myspot', '登録地点');
return;
}
} else {
// 登録地点中吹き出しから削除
itsmo.vars.g_myspot_del = itsmo.vars.g_myspot_list[idx].uid;
}
itsmo.lib.map_confirm('登録地点の削除','選択した登録地点を削除いたします。
よろしいですか?',itsmo.myspot.myspot_del_submit);
};
itsmo.myspot.myspot_del_submit = function() {
if(itsmo.vars.g_map_confirm_yes == 0) return;
if (itsmo.vars.g_myspot_del == '') {
var i = 0;
var del = '';
while(1) {
var flg = itsmo.lib.document_getvalue('ajax_mayspot_list_del'+i);
if (flg == null) break;
if (flg != '') {
if (del) del = del + ',';
del = del + itsmo.vars.g_myspot_list[i].uid;
}
i++;
}
itsmo.vars.g_myspot_del = del;
}
// 実行
var prm = 'mode=myspot_del';
prm += '&id=' + itsmo.vars.g_myspot_del;
itsmo.lib.XMLHttpRequest2_send_wait('/map/ajax_myspot.php',itsmo.myspot.myspot_del_result,'GET',prm,'削除中');
};
itsmo.myspot.myspot_del_result = function(result) {
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if(err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'myspot');
} else {
itsmo.lib.aplErrorWindow('W', '0005', 'myspot', '登録地点');
}
return;
}
itsmo.vars.g_myspot_del = '';
// 確認ウィンドウ
itsmo.lib.aplErrorWindow('I', '0002', 'myspot', '登録地点', 'spotdel');
// 正常処理
itsmo.myspot.myspot_clearballoon(); // ツールチップ削除
itsmo.myspot.myspot_listreflesh(); // 一覧更新
};
//--------------------------------------------------------------------------------------------------
// フォルダ一覧取得
//--------------------------------------------------------------------------------------------------
itsmo.myspot.myspot_folderlistget = function(func) {
// 特にする事なし
itsmo.vars.g_myspot_folder_selected = 0;
};
// フォルダidをフォルダ名に変更
itsmo.myspot.myspot_foldername = function(id) {
if(id == 1) return 'あ行';
if(id == 2) return 'か行';
if(id == 3) return 'さ行';
if(id == 4) return 'た行';
if(id == 5) return 'な行';
if(id == 6) return 'は行';
if(id == 7) return 'ま行';
if(id == 8) return 'や行';
if(id == 9) return 'ら行';
if(id == 10) return 'わ行';
return 'その他';
};
//--------------------------------------------------------------------------------------------------
// グループ一覧取得(SNS投稿設定も同時取得)
//--------------------------------------------------------------------------------------------------
// フォルダidをフォルダ名に変更
itsmo.myspot.group_listget = function() {
var prm = 'mode=group_list';
/*
if ($('#ajax_menu-my').hasClass('act')) {
// 処理中画像表示
itsmo.lib.document_off('ajax_myspot_add');
itsmo.lib.document_on('ajax_myspot_window_wait');
}
*/
itsmo.lib.XMLHttpRequest2_send('/map/ajax_myspot.php',itsmo.myspot.group_listget_result,'GET',prm);
return '';
};
itsmo.myspot.group_listget_result = function(result) {
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if (err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'myspot_group');
} else {
itsmo.lib.aplErrorWindow('W', '0003', 'myspot_group', '登録地点グループ');
}
return;
}
// グループ一覧をリストに保持
var i = 0;
var group_sb = $('#ajax_myspot_add_group');
if(group_sb.get(0).type == 'select-one') {
group_sb = group_sb.get(0);
$(result).find('group_list').each(function()
{
itsmo.vars.g_myspot_group_list[$(this).find('fldid').text()] = $(this).find('fldnm').text();
i++;
group_sb.length = i;
group_sb.options[$(this).find('fldid').text()].value = $(this).find('fldid').text();
group_sb.options[$(this).find('fldid').text()].text = $(this).find('fldnm').text();
});
}
// SNS投稿設定を保持
var setdata = {};
setdata.con_fb = $(result).find('con_fb').text()
setdata.con_twt = $(result).find('con_twt').text()
setdata.con_mixi = $(result).find('con_mixi').text()
setdata.tar_fb = $(result).find('tar_fb').text()
setdata.tar_twt = $(result).find('tar_twt').text()
setdata.tar_mixi = $(result).find('tar_mixi').text()
itsmo.vars.g_myspot_snspostset = setdata;
itsmo.myspot.myspot_add(); // other_addmyspot で登録用データ整形済み
}
//--------------------------------------------------------------------------------------------------
// SNS投稿設定取得
//--------------------------------------------------------------------------------------------------
itsmo.myspot.grant_listget = function() {
var prm = 'mode=grant_list';
itsmo.lib.XMLHttpRequest2_send('/map/ajax_myspot.php',itsmo.myspot.grant_listget_result,'GET',prm);
return '';
};
itsmo.myspot.grant_listget_result = function(result) {
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if (err != 0) {
return;
}
// SNS投稿設定を保持
var setdata = {};
setdata.con_fb = $(result).find('con_fb').text()
setdata.con_twt = $(result).find('con_twt').text()
setdata.con_mixi = $(result).find('con_mixi').text()
setdata.tar_fb = $(result).find('tar_fb').text()
setdata.tar_twt = $(result).find('tar_twt').text()
setdata.tar_mixi = $(result).find('tar_mixi').text()
itsmo.vars.g_myspot_snspostset = setdata;
itsmo.myspot.myspot_add();
}
//------------------------------------------------
// 地点変更
//------------------------------------------------
//地点変更イベント
itsmo.myspot.myspotEditSpot = function(idx)
{
itsmo.vars.g_myspot_edit_spot = true;
itsmo.myspot.myspot_clearballoon();
itsmo.lib.map_windowclose();
if(idx != null){
itsmo.myspot.chengeClickMap(1, idx);
}else{
alert("不正な操作がありました。");
}
};
//地点変更画面表示
itsmo.myspot.showEditLocation = function(idx){
itsmo.lib.map_windowopen('ajax_myspot_editspot');
itsmo.myspot.setEditLocaData(idx);
if (!$.support.opacity && !$.support.style && (typeof document.documentElement.style.maxHeight == "undefined")) {
// IE6
// $('#poi_work #screen-wrap .screen').bgiframe();
}
};
//地点変更画面にデータセット
itsmo.myspot.setEditLocaData = function(idx){
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
itsmo.vars.g_map_obj.moveLatLon(itsmo.vars.g_map_obj.getPointerPosition());
itsmo.lib.document_setvalue('ajax_myspot_editspot_title', itsmo.vars.g_myspot_list[idx].title);
itsmo.lib.document_setvalue('ajax_myspot_editspot_title_sub','「' + itsmo.vars.g_myspot_list[idx].title + '」の地点をこの場所に変更します。');
itsmo.lib.document_setvalue('ajax_myspot_editspot_idx',idx);
itsmo.sub.map_getaddr(loc, function(result) {
if(result.status == 0) {
addr = result.items[0].address;
} else {
addr = '住所なし';
}
itsmo.lib.document_setvalue('ajax_myspot_editspot_addr', addr);
});
};
//地点変更
itsmo.myspot.editLocation = function(idx, mode){
itsmo.vars.g_myspot_edit_spot = false;
switch (mode) {
case "cancel":
itsmo.lib.map_windowclose();
itsmo.lib.map_windowopen('ajax_myspot_add');
if (!$.support.opacity && !$.support.style && (typeof document.documentElement.style.maxHeight == "undefined")) {
// IE6
// $('#poi_work #screen-wrap .screen').bgiframe();
}
itsmo.myspot.chengeClickMap();
break;
default:
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
spot_lat = loc.lat;
spot_lon = loc.lon;
addr = itsmo.lib.document_getvalue('ajax_myspot_editspot_addr');
itsmo.lib.document_setvalue('ajax_myspot_add_addr',addr);
itsmo.lib.document_setvalue('ajax_myspot_add_lat',spot_lat);
itsmo.lib.document_setvalue('ajax_myspot_add_lon',spot_lon);
itsmo.lib.document_setvalue('ajax_myspot_add_latlon', 'E'+itsmo.lib.map_dms2deg(spot_lon)+' N'+itsmo.lib.map_dms2deg(spot_lat));
// $('#ajax_myspot_editspot').remove();
itsmo.lib.map_windowclose();
//元に戻す
itsmo.myspot.chengeClickMap();
itsmo.lib.map_windowopen('ajax_myspot_add');
/*
if (!$.support.opacity && !$.support.style && (typeof document.documentElement.style.maxHeight == "undefined")) {
// IE6
$('#poi_work #screen-wrap .screen').bgiframe();
}
*/
}
};
//地点変更時マウスカーソル処理
itsmo.myspot.chengeClickMap = function(flg, idx)
{
if(flg){
itsmo.map.setMouseCursor("users","/design/cur/pencil.cur","/design/cur/pencil.cur");
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CLICK, function() {
// マウスドラッグ時もクリックイベントが発生してしまうためドラッグ時は除外する
if (!itsmo.vars.g_mouseDrag && !itsmo.vars.g_map_click_cancel) {
itsmo.map.map_clickmap();
itsmo.myspot.showEditLocation(idx);
}
itsmo.map.setMouseCursor("users","/design/cur/pencil.cur","/design/cur/pencil.cur");
});
}else{
/*
dcmpcfunc.OnClickFlg.flg = false;
dcmpcfunc.OnClickFlg.method_name = null;
if(itsmo.vars.g_myspot_edit_spot == true){ // 地点変更時にhideになっているウィンドウを削除
itsmo.vars.g_myspot_edit_spot = false;
$('#poi_work #poi_detail').hide();
$('#poi_work #poi_detail_edit').hide();
}
*/
itsmo.map.setMouseCursor("hand");
ZDC.clearListeners(itsmo.vars.g_map_obj, ZDC.MAP_CLICK);
if(itsmo.vars.premiumMap != null && typeof(itsmo.vars.premiumMap.reAddListener) == 'function'){
itsmo.vars.premiumMap.reAddListener();
}
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CLICK, itsmo.map.map_clickmap);
//ルート設定中
if(itsmo.myroute.isSettingFlg){
itsmo.vars.g_myroute_eventx = -1;
itsmo.vars.g_myroute_event.push(ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CLICK, function() {
if(itsmo.vars.g_myroute_eventx < 5) {
itsmo.myroute.myroute_panel_addmap();
itsmo.vars.g_myroute_eventx = 99;
}
}));
}
}
};
// リストを開く
itsmo.myspot.showListSelect = function(e, divid){
var id = $(e).attr('id') + '_cond';
if(itsmo.vars.opened_cond_window == id){ var bl = id };
itsmo.myspot.hideCondSelect();
if (bl) {
return false;
}
itsmo.vars.opened_cond_window = id;
$('#' + id).fadeIn('fast');
};
//リスト閉じる
itsmo.myspot.hideCondSelect = function() {
itsmo.vars.opened_cond_window = null;
$("div[class^='sis-search-paka-waku-'] div.sis-search-paka-genre").hide();
};
// グループwindowオープン
itsmo.myspot.grouplist_view = function(idx) {
// selectbox閉じる
itsmo.myspot.hideCondSelect();
var group_title_obj = null;
var group_title_key_obj = null;
var i = 0;
for (var key in itsmo.vars.g_myspot_group_list) {
if (i == 0) { i++;continue; }
group_title_obj = $('#ajax_group_title'+i).get(0);
group_title_key_obj = $('#ajax_group_title_key'+i).get(0);
group_title_obj.value = itsmo.vars.g_myspot_group_list[key];
group_title_key_obj.value = key;
i++;
}
if (!$.support.opacity && !$.support.style && (typeof document.documentElement.style.maxHeight == "undefined")) {
// IE6
$('#screen-wrap .screen').bgiframe();
}
itsmo.lib.map_windowopen('ajax_group_add');
};
itsmo.myspot.group_add_submit = function() {
// 実行
var prm = 'mode=group_add';
var val_obj = null;
for(var i = 1;i < 11;i++) {
key_obj = $('#ajax_group_title_key'+i).get(0);
val_obj = $('#ajax_group_title'+i).get(0);
if (val_obj.value == '') {
alert("グループ名を入力してください");
return;
}
if (val_obj.value.length > 10) {
alert("グループ名は10桁以下で入力してください");
return;
}
prm += '&group_arr[' + key_obj.value + ']=' + val_obj.value;
}
itsmo.lib.map_windowclose();
itsmo.lib.XMLHttpRequest2_send_wait('/map/ajax_myspot.php',itsmo.myspot.group_add_submit_result,'GET',prm,'保存中');
};
itsmo.myspot.group_add_submit_result = function(result) {
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if(err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'myspot_group');
} else {
itsmo.lib.aplErrorWindow('W', '0004', 'myspot_group', '登録地点グループ');
}
return false;
}
// 確認ウィンドウ
itsmo.lib.aplErrorWindow('I', '0001', 'myspot_group', '登録地点グループ', 'spotgroupadd');
itsmo.myspot.myspot_listreflesh(); // 一覧更新
};
//リストから選択
itsmo.myspot.setSearchCond = function(obj, key) {
itsmo.myspot.hideCondSelect();
var obj_id = $(obj).attr("id");
if (obj_id.match(/^init/)) {
itsmo.vars.g_myspot_folder_selected = key;
} else if (obj_id.match(/^group/)) {
itsmo.vars.g_myspot_group_selected = key;
}
itsmo.myspot.myspot_listreflesh(); // 一覧更新
};
itsmo.myspot.setSelectbox = function (obj) {
e = $(obj);
if ($(e).attr("id") == 'undefined') return;
var txt = e.text();
var i, f = null;
for (i = 0; i < 10; ++i) {
e = e.parent();
f = e.find('span.box-s');
if (f.length >= 1) {
break;
}
}
if (null == f) {
return false;
}
f.text(txt);
};
itsmo.mysnspost = {};
itsmo.vars.g_mysnspost_request = null;
itsmo.vars.g_mysnspost_list = [];//リストの内容保持
itsmo.vars.g_mysnspost_del = '';
itsmo.vars.g_mysnspost_edit_spot = false; // 地点変更時フラグ
itsmo.vars.g_mysnspost_group_list = []; // グループリスト保持用
itsmo.vars.opened_cond_window = null; // リストWindow
//------------------------------------------------
// mysnspost表示
//------------------------------------------------
// SNS投稿設定ウィンドウ表示
itsmo.mysnspost.mysnspost_view = function()
{
// 処理中ウィンドウオープン
itsmo.lib.map_wait2open('読み込み中…');
// SNS投稿設定取得
var prm = 'mode=postget';
itsmo.lib.XMLHttpRequest2_send('/map/ajax_mysnspost.php', itsmo.mysnspost.mysnspost_get_result, 'GET', prm);
};
itsmo.mysnspost.mysnspost_get_result = function(result)
{
// 処理中非表示
itsmo.lib.map_wait2close();
// エラーチェック
var err = $(result).find('err').text();
if (err != 0) {
itsmo.lib.aplErrorWindow('W', '0003', 'mysnspost', 'SNS投稿設定');
return false;
}
var html = $(result).find('post_win').text();
$('#ajax_mysnspost_edit').html(html);
if (!$.support.opacity && !$.support.style && (typeof document.documentElement.style.maxHeight == "undefined")) {
// IE6
$('#screen-wrap .screen').bgiframe();
}
// SNS投稿設定表示
itsmo.lib.map_windowopen('ajax_mysnspost_edit');
};
//------------------------------------------------
// mysnspost編集
//------------------------------------------------
// 保存 ------------------------------------------
itsmo.mysnspost.mysnspost_edit = function() {
// 値を取得
var set_f = itsmo.lib.document_getvalue('sns_set_fb');
var set_t = itsmo.lib.document_getvalue('sns_set_tw');
var set_m = itsmo.lib.document_getvalue('sns_set_mixi');
var sets = new Array();
if (set_f) sets.push(set_f);
if (set_t) sets.push(set_t);
if (set_m) sets.push(set_m);
// 実行
var prm = 'mode=mysnspost_edit';
prm += '&target='+encodeURIComponent(sets.join(','));
var path = '/map/ajax_mysnspost.php';
itsmo.lib.map_windowclose();
itsmo.lib.XMLHttpRequest2_send_wait(path, itsmo.mysnspost.mysnspost_edit_result, 'GET', prm, '保存中');
};
itsmo.mysnspost.mysnspost_edit_result = function(result) {
// エラーチェック
var err = $(result).find('err').text();
if (err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'mysnspost');
} else {
itsmo.lib.aplErrorWindow('W', '0004', 'mysnspost', 'SNS投稿設定');
}
return;
}
// グローバル変数初期化
itsmo.vars.g_myspot_snspostset = {};
// 確認ウィンドウ
itsmo.lib.aplErrorWindow('I', '0001', 'mysnspost', 'SNS投稿設定', 'snspostedit');
};
itsmo.vars.g_myroute_stop_num = 0;// 地点の数(出発+経由+目的)
itsmo.vars.g_myroute_stops = [];// 位置選択リスト
itsmo.vars.g_myroute_list = [];// リストの地点
itsmo.vars.g_myroute_elem_myroutelistdiv = null;//myスポット一覧
itsmo.vars.g_myroute_list_page = 0;
itsmo.vars.g_myroute_routetitle = null;
itsmo.vars.g_myroute_cond = null;
itsmo.vars.g_myroute_rows = 10;
itsmo.vars.g_myroute_cnt = 0; //地点の数をカウント
itsmo.vars.g_route_tab_displayed = 0;
itsmo.vars.routeKeep = 0;
itsmo.vars.routeSearchResultKeep = 0;
itsmo.myroute = {};
//入力チェック dcmpcsite より移植
itsmo.validate = {};
itsmo.validate.msg = {"required": 'は必須項目です',
"tel" : 'は半角数字とハイフンで入力してください',
"range" : '文字以内で入力してください',
"num" : 'は半角数字で入力してください',
"eisu" : 'は半角英数字で入力してください',
"min" : '文字以上で入力してください',
"email" : 'の形式が正しくありません',
"url" : 'の形式が正しくありません',
"date" : 'が正しくありません'
};
itsmo.validate.msgEn = {"required": ['Your ', ' is mandatory.'],
"tel" : ['Please enter a hyphen numbers and ', '.'],
"range" : ['Please enter more than ', ' characters.'],
"num" : ['Please enter a number of ', '.'],
// "eisu" : 'は半角英数字で入力してください',
"min" : ['Please enter at least ', ' characters.'],
"email" : ['Is not in the correct format of ', '.'],
"url" : ['Is not in the correct format of ', '.'],
"date" : 'Invalid date.'
};
itsmo.validate.msgAlert = true;
itsmo.validate.messages = '';
itsmo.validate.isEn = false;
itsmo.validate.check = function(arry)
{
itsmo.validate.messages = '';
var flg = true
for (var i=0; i < arry['option'].length; i++) {
var op = arry['option'][i].split(",");
// 必須チェック
if (op[0] == 'required') {
if (!$('#'+ arry['id']).val()) {
itsmo.validate.setMsg('required',arry['name']);
flg = false;
}
} else if ($('#'+ arry['id']).val()) {
switch (op[0]) {
// スペースチェック
case 'space':
var req = $('#'+ arry['id']).val();
req = req.replace(/\s| /g,"");
//req = jQuery.trim(req);
if (!req) {
itsmo.validate.setMsg('required',arry['name']);
flg = false;
}
break;
// 文字数範囲チェック
case 'range':
if (!op[1]) {
op[1] = 0;
}
if (!op[2]) {
op[2] = 0;
}
if ($('#'+ arry['id']).val().length < op[1] || $('#'+ arry['id']).val().length > op[2]) {
itsmo.validate.setMsg('range',arry['name'] + "は" + op[1] + "~" + op[2]);
flg = false;
}
break;
// 電話番号チェック
case 'tel':
var num="0123456789-";
var tmp=new Array();
for (var i = 0; i < $('#'+ arry['id']).val().length; i++) {
tmp[i] = $('#'+ arry['id']).val().substring(i,i+1);
var f = num.indexOf(tmp[i]);
if (f == -1){
itsmo.validate.setMsg('tel',arry['name']);
flg = false;
break;
}
}
break;
// 数字チェック
case 'num':
var req = $('#'+ arry['id']).val();
if (!req.match(/(\d+)/)) {
itsmo.validate.setMsg('num',arry['name']);
flg = false;
}
break;
// 半角英数字チェック
case 'eisu':
var req = $('#'+ arry['id']).val();
if (req.match(/[^A-Za-z\s.-]+/)) {
itsmo.validate.setMsg('eisu',arry['name']);
flg = false;
}
break;
// 最大文字数チェック
case 'rangeMax':
if (!op[1]) {
op[1] = 0;
}
if ($('#'+ arry['id']).val().length > op[1]) {
itsmo.validate.setMsg('range',arry['name'] + "は" + op[1]);
flg = false;
}
break;
// 最小文字数チェック
case 'rangeMin':
if (!op[1]) {
op[1] = 0;
}
if ($('#'+ arry['id']).val().length < op[1]) {
itsmo.validate.setMsg('range',arry['name'] + "は" + op[1]);
flg = false;
}
break;
// メールアドレスチェック
case 'email':
var str = $('#'+ arry['id']).val();
if (!str.match(/^[A-Za-z0-9]+[\w\.-]+@[\w\.-]+\.\w{2,}$/)) {
itsmo.validate.setMsg('email',arry['name']);
flg = false;
}
break;
// URLチェック
case 'url':
var str = $('#'+ arry['id']).val();
if (!str.match(/^(http|https):\/\/.+/)) {
itsmo.validate.setMsg('url',arry['name']);
flg = false;
}
break;
default:
flg = true;
}
if (flg == false) {
break;
}
} else if (op[0] == 'date') {
// 日付妥当性チェック
var year = arry['val'].substr(0, 4) - 0;
var month = arry['val'].substr(4, 2) - 1;
var day = arry['val'].substr(6, 2) - 0;
var retDate = new Date(year, month, day);
if (isNaN(retDate)) {
itsmo.validate.setMsg('date',arry['name']);
flg = false;
} else if (
!(retDate.getFullYear() == year
&& retDate.getMonth() == month
&& retDate.getDate() == day)) {
itsmo.validate.setMsg('date',arry['name']);
flg = false;
}
}
}
if (itsmo.validate.msgAlert) {
return flg;
} else {
return itsmo.validate.messages;
}
};
itsmo.validate.setMsg = function(type, title)
{
var mess = '';
if (itsmo.validate.isEn) {
var msgs = itsmo.validate.msgEn[type];
mess = msgs[0] + title + msgs[1];
} else {
mess = title + itsmo.validate.msg[type];
}
if (itsmo.validate.msgAlert) {
alert(mess);
} else {
itsmo.validate.messages = mess;
}
};
itsmo.vars.g_myroute_flag2id = [];
itsmo.vars.g_myroute_poilyrtips = [];
//--------------------------------------------------------------------------------------------------
// ルート探索 分岐
//--------------------------------------------------------------------------------------------------
itsmo.myroute.myroute_panel_submit = function() {
itsmo.myroute.myroute_cond_submit();
// スタート・ゴールが無い場合に並び替える
if(itsmo.vars.g_myroute_stops[0] == null) {
for(var i = 1;i < itsmo.vars.g_myroute_stop_num-2;i ++) {
if(itsmo.vars.g_myroute_stops[i] != null) {
itsmo.vars.g_myroute_stops[i-1] = itsmo.vars.g_myroute_stops[i];
itsmo.vars.g_myroute_stops[i] = null;
}
}
}
if(itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num-1] == null) {
for(var i = itsmo.vars.g_myroute_stop_num-1;i >= 1;i --) {
if(itsmo.vars.g_myroute_stops[i] != null) {
itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num-1] = itsmo.vars.g_myroute_stops[i];
itsmo.vars.g_myroute_stops[i] = null;
break;
}
}
}
if (itsmo.vars.g_myroute_stops[0] == null || itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num-1] == null) {
return false;
}
itsmo.vars.g_route_vics.show_mode = 'nomal';
itsmo.myroute.myroute_panel_submit_all();
};
// 消去
itsmo.myroute.myroute_panel_lyrclear = function() {
// 自動車
if(itsmo.vars.g_myroute_routeobj != null) {
itsmo.map.closeUserMsgWindow();
//itsmo.vars.g_map_obj.removeRouteSearch();
}
// 電車
if(itsmo.vars.g_myroute_prouteobj != null) {
itsmo.map.closeUserMsgWindow();
//itsmo.vars.g_map_obj.removePRouteSearch();
}
// 徒歩
if(itsmo.vars.g_myroute_trainobj != null) {
itsmo.map.closeUserMsgWindow();
//itsmo.vars.g_myroute_trainobj.clearRoute();
}
itsmo.myroute.myroute_panel_lyrclear_tips();
};
itsmo.myroute.myroute_panel_lyrclear_tips = function() {
itsmo.myroute.myroute_flagclear();
if (itsmo.vars.g_myroute_poilyrtips.length >= 1) {
$.each(itsmo.vars.g_myroute_poilyrtips, function(i, v) {
if (null != v) {
itsmo.vars.g_map_layer_clickable.removeById(v);
}
});
itsmo.vars.g_myroute_poilyrtips = [];
itsmo.vars.g_map_layer_route.clear();
}
// ルートアイコンを消す
itsmo.vars.g_map_layer_route.clearMarker();
itsmo.vars.g_map_layer_clickable.clearMarker();
};
//--------------------------------------------------------------------------------------------------
// 自動車ルート
//--------------------------------------------------------------------------------------------------
itsmo.vars.g_myroute_routeobj = null;// ルート探索
// 検索処理
itsmo.myroute.myroute_panel_submit_car = function() {
// 初期化
// 検索条件
itsmo.myroute.myroute_panel_eventdel();
itsmo.map.setMouseCursor('hand');
// 地点設定
var query = {
from: itsmo.lib.toLatLon(itsmo.vars.g_myroute_stops[0]),//出発
to: itsmo.lib.toLatLon(itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num - 1]),//到着
mpoints: [],
smartic: !!itsmo.vars.g_myroute_configs.car['smart'] //スマートIC
};
for(var i = 1;i < itsmo.vars.g_myroute_stop_num-1; i++) {//経由
if(itsmo.vars.g_myroute_stops[i] == null) break;
query['mpoints'].push(itsmo.lib.toLatLon(itsmo.vars.g_myroute_stops[i]));
}
// 探索条件
switch(itsmo.vars.g_myroute_configs.car['opt1']) {
case '0':// 推奨ルート
query['toll'] = true;
query['straight'] = false;
break;
case '1':// 有料
query['toll'] = true;
query['straight'] = false;
break;
case '2':// 一般
query['toll'] = false;
query['straight'] = false;
break;
case '3':// 直線
query['straight'] = true;
break;
}
switch (itsmo.vars.g_myroute_configs.car['opt2']) {
case '0':
query['cartype'] = 'light';
break;
case '1':
default:
query['cartype'] = 'normal';
break;
case '2':
query['cartype'] = 'middle';
break;
case '3':
query['cartype'] = 'large';
break;
case '4':
query['cartype'] = 'big';
break;
}
//itsmo.vars.g_myroute_routeopts.sdate = itsmo.vars.g_myroute_configs.car['date'] + itsmo.vars.g_myroute_configs.car['time'];
// 探索実行
itsmo.lib.map_wait2open("ルート計算中");
ZDC.Search.getRouteByDrive(query, itsmo.myroute.myroute_panel_result_car);
};
// 結果の処理 ------------------------------------
itsmo.vars.g_myroute_icstart = null;
itsmo.vars.g_myroute_icend = null;
itsmo.myroute.myroute_panel_result_car = function() {
// ルートタイプ取得
var routeType = itsmo.myroute.route.getRouteType(0);
// ルート候補取得
var obj = itsmo.myroute.route.getRouteList();
if (false === obj || obj.length <= 0) {
// フロート非表示
itsmo.lib.map_wait2close();
itsmo.lib.aplErrorWindow('E','0011',null,'(type=3)');
itsmo.myroute.myroute_panel_list();
return false;
}
// ルートを非表示
itsmo.myroute.myroute_panel_lyrclear_tips();
var idx = 0;
itsmo.vars.g_myroute_icstart = null;
itsmo.vars.g_myroute_icend = null;
/*
if (flg) {
// ルート再検索
itsmo.myroute.route.research(idx);
}
*/
// ルートを表示
itsmo.myroute.route.drawRoute(idx);
// ルート候補取得(1件)
var obj = itsmo.myroute.route.getRouteList(idx);
// 距離
itsmo.lib.document_setvalue('ajax_myroute_panel3dis', parseInt(obj[0].TotalDistance / 100) / 10);
// 料金
var price = parseInt(obj[0].TotalFare, 10);
if (price >= 1000) {
price = '' + price;//文字列にする
price = itsmo.lib.setComma(price);
}
itsmo.lib.document_setvalue('ajax_myroute_panel3toll', '' + price);
if (price == 0) {
$('#ajax_etc_btn').hide();
} else {
$('#ajax_etc_btn').show();
}
// 時間
var hh = itsmo.myroute.getTotalTimeContent(obj[0].TotalTime);
itsmo.lib.document_setvalue('ajax_myroute_panel3time', hh);
// 条件
switch(itsmo.vars.g_myroute_configs.car['opt1']) {
case '0':itsmo.lib.document_setvalue('ajax_myroute_panel3opt1','推奨ルート');break;
case '1':itsmo.lib.document_setvalue('ajax_myroute_panel3opt1','有料道優先');break;
case '2':itsmo.lib.document_setvalue('ajax_myroute_panel3opt1','一般道優先');break;
case '3':itsmo.lib.document_setvalue('ajax_myroute_panel3opt1','直進優先');break;
}
switch(itsmo.vars.g_myroute_configs.car['opt2']) {
case '0':itsmo.lib.document_setvalue('ajax_myroute_panel3opt2','軽自動車');break;
case '1':itsmo.lib.document_setvalue('ajax_myroute_panel3opt2','普通車');break;
case '2':itsmo.lib.document_setvalue('ajax_myroute_panel3opt2','中型車');break;
case '3':itsmo.lib.document_setvalue('ajax_myroute_panel3opt2','大型車');break;
case '4':itsmo.lib.document_setvalue('ajax_myroute_panel3opt2','特大車');break;
}
// 地点
var routeInfo = null;
var nm;
var html = '';
html += '';
html += '';
html += '';
/*
routeInfo = itsmo.myroute.route.getQuickInfo(idx);
$.each(routeInfo, function(i, info) {
var tipimg = null;
var j = 0;
switch (info.type) {
case 'start':
//-- スタート
nm = itsmo.vars.g_myroute_stops[0].title;
if (nm.length > 7) nm = nm.substr(0,8) + "...";
html += itsmo.lib.htmlspecialchars(nm)+'';
tipimg = '';
j = 0;
break;
case 'goal':
//-- ゴール
html += '';
html += '';
html += '';
nm = itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num-1].title;
if(nm.length > 7) nm = nm.substr(0,8) + "...";
html += itsmo.lib.htmlspecialchars(nm)+'';
tipimg = '';
j = itsmo.vars.g_myroute_stops.length - 1;
break;
case 11:
case 12:
case 13:
// 経由地1~3
// タイトル短縮
j = info.type - 10;
html += '';
html += '';
html += '';
//nm = itsmo.vars.g_myroute_stops[j].title;
nm = info.name;
if(nm.length > 7) nm = nm.substr(0,8) + "...";
html += itsmo.lib.htmlspecialchars(nm)+'';
// 旗
if(itsmo.vars.g_myroute_flag2id[j] != null) itsmo.vars.g_map_layer_route.removeById(itsmo.vars.g_myroute_flag2id[j]);
tipimg = '';
break;
default:
//-- 経由
if (info.name) {
nm = info.name;
} else {
nm = '交差点';
}
// TODO
//html += '';
html += '';
html += '';
html += '' + nm + '';
html += '';
//html += '';
var ic = null, cn = nm;
if(cn != "") {
if(cn.indexOf("料金所") != -1) {
ic = cn.substr(0,cn.indexOf("料金所"));
} else if(cn.indexOf("首都高") == 0) {
ic = cn.substr(3,cn.length);
} else if(cn.indexOf("IC") != -1) {
ic = cn.substr(0,cn.indexOf("IC"));
} else if(cn.indexOf("I.C") == 0) {
ic = cn.substr(0,cn.indexOf("I.C"));
}
}
if(ic != null) {
// 余計な文字を消す
if(ic.indexOf("高速") == 0) ic = ic.substr(2,ic.length);
if(ic.indexOf("有料道路") == 0) ic = ic.substr(4,ic.length);
if(ic.indexOf("有料道路") != -1) ic = ic.substr(0,ic.indexOf("有料道路"));
if(ic.indexOf("第一") != -1) ic = ic.substr(0,ic.indexOf("第一"));
if(ic.indexOf("第二") != -1) ic = ic.substr(0,ic.indexOf("第二"));
if(ic.indexOf("第1") != -1) ic = ic.substr(0,ic.indexOf("第1"));
if(ic.indexOf("第2") != -1) ic = ic.substr(0,ic.indexOf("第2"));
if(ic.indexOf("JCT") != -1) ic = ic.substr(0,ic.indexOf("JCT"));
if(itsmo.vars.g_myroute_icstart != null) itsmo.vars.g_myroute_icend = ic;
if(itsmo.vars.g_myroute_icstart == null) itsmo.vars.g_myroute_icstart = ic;
//alert("_debug ICを発見 「"+cn+"」→「"+ic+"」");
}
break;
}
if (null != tipimg) {
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(itsmo.vars.g_myroute_stops[j]), {
html: tipimg,
size: itsmo.sub.getHtmlSize(tipimg),
offset: new ZDC.Pixel(-3, -32)
});
tip.setZindex(itsmo.map.d_map_zIdx_route);
var id = itsmo.vars.g_map_layer_route.add(tip);
tip.open();
itsmo.vars.g_myroute_flag2id[j] = id;
}
});
//*/
routeInfo = itsmo.myroute.route.getRouteData(idx).find('nodes node');
var poscnt = routeInfo.length;
routeInfo.each(function(i, v) {
v = $(v);
var nm = v.attr('start');
var lat = v.attr('start_lat');
var lon = v.attr('start_lon');
var tipimg = null;
var via = parseInt(v.attr('via'), 10);
if (0 == i) {
//-- スタート
nm = itsmo.vars.g_myroute_stops[0].title;
if (nm.length > 16) nm = nm.substr(0,17) + "...";
html += itsmo.lib.htmlspecialchars(nm)+'';
tipimg = '';
via = 0;
} else if (poscnt - 1 == i) {
//-- ゴール
html += '';
html += '';
html += '';
nm = itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num-1].title;
if(nm.length > 16) nm = nm.substr(0,17) + "...";
html += itsmo.lib.htmlspecialchars(nm)+'';
tipimg = '';
via = itsmo.vars.g_myroute_stops.length - 1;
} else if (via >= 1 && via <= 3) {
// 経由地1~3
// タイトル短縮
html += '';
html += '';
html += '';
//nm = itsmo.vars.g_myroute_stops[via].title;
if(nm.length > 16) nm = nm.substr(0,17) + "...";
html += itsmo.lib.htmlspecialchars(nm)+'';
// 旗
if(itsmo.vars.g_myroute_flag2id[via] != null) itsmo.vars.g_map_layer_route.removeById(itsmo.vars.g_myroute_flag2id[via]);
tipimg = '';
} else {
//-- 経由
html += ''
+ ''
+ '' + nm + ''
+ ''
;
var ic = null, cn = nm;
if(cn != "") {
if(cn.indexOf("料金所") != -1) {
ic = cn.substr(0,cn.indexOf("料金所"));
} else if(cn.indexOf("首都高") == 0) {
ic = cn.substr(3,cn.length);
} else if(cn.indexOf("IC") != -1) {
ic = cn.substr(0,cn.indexOf("IC"));
} else if(cn.indexOf("I.C") == 0) {
ic = cn.substr(0,cn.indexOf("I.C"));
}
}
if(ic != null) {
// 余計な文字を消す
if(ic.indexOf("高速") == 0) ic = ic.substr(2,ic.length);
if(ic.indexOf("有料道路") == 0) ic = ic.substr(4,ic.length);
if(ic.indexOf("有料道路") != -1) ic = ic.substr(0,ic.indexOf("有料道路"));
if(ic.indexOf("第一") != -1) ic = ic.substr(0,ic.indexOf("第一"));
if(ic.indexOf("第二") != -1) ic = ic.substr(0,ic.indexOf("第二"));
if(ic.indexOf("第1") != -1) ic = ic.substr(0,ic.indexOf("第1"));
if(ic.indexOf("第2") != -1) ic = ic.substr(0,ic.indexOf("第2"));
if(ic.indexOf("JCT") != -1) ic = ic.substr(0,ic.indexOf("JCT"));
if(itsmo.vars.g_myroute_icstart != null) itsmo.vars.g_myroute_icend = ic;
if(itsmo.vars.g_myroute_icstart == null) itsmo.vars.g_myroute_icstart = ic;
//alert("_debug ICを発見 「"+cn+"」→「"+ic+"」");
}
return;
}
if (null != tipimg) {
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(itsmo.vars.g_myroute_stops[via]), {
html: tipimg,
size: itsmo.sub.getHtmlSize(tipimg),
offset: new ZDC.Pixel(-3, -40)
});
tip.setZindex(itsmo.map.d_map_zIdx_route);
var id = itsmo.vars.g_map_layer_route.add(tip);
tip.open();
itsmo.vars.g_myroute_flag2id[via] = id;
}
});
itsmo.lib.document_setvalue('ajax_myroute_panel3list', html);
// タブ切り替え ------------------------------
itsmo.myroute.myroute_panel_change('result_car');
// VICS --------------------------------------
if(itsmo.vars.g_myroute_configs.car['ton'] == '1') {
// 渋滞考慮
itsmo.vars.g_route_vics.show_mode = 'car';
$('#map_vics_link').attr('class','map-btn3-jutai2-act');
itsmo.myroute.map_vics();
} else {
itsmo.vars.g_route_vics.show_mode = 'nomal';
itsmo.myroute.map_vics_clear();
}
//表示
itsmo.myroute.ContentPanelHide();
$('#route_result_car').show();
// 位置、縮尺設定
itsmo.myroute.setMapLocationForRouteResult();
itsmo.lib.map_wait2close();
};
//------------------------------------------------
// VICS表示
//------------------------------------------------
itsmo.vars.g_map_vics_tipid = null;
itsmo.myroute.map_vics = function() {
//itsmo.lib.document_off('ajax_myroute_panel3_vics_max');return;// 負荷対策に外すときはこれ
if(itsmo.vars.g_myroute_configs.car['date'] == null || itsmo.vars.g_myroute_configs.car['date'] == 0) { return; }
var today = itsmo.vars.g_myroute_configs.car['date'] + itsmo.vars.g_myroute_configs.car['time'];
//itsmo.vars.g_route_vics.setVisible(true);
itsmo.vars.g_route_vics.setVicsShowDate(today);
//itsmo.vars.g_route_vics.minimize();
return;
// パネル
t = parseInt(today.substr(4,2), 10)+'/'+parseInt(today.substr(6,2), 10)+' '+parseInt(today.substr(8,2), 10)+':'+today.substr(10,2);
itsmo.lib.document_setvalue('ajax_myroute_panel3_vics_dt',t);
//itsmo.lib.document_on('ajax_myroute_panel3_vics');
// レイヤー
if(itsmo.vars.g_map_traffic_h == 0 && itsmo.vars.g_map_traffic_l == 0) {
if(itsmo.vars.g_map_layer_traffic != null) itsmo.vars.g_map_layer_traffic.hidden();
return;
}
if(itsmo.vars.g_map_layer_traffic == null) {
itsmo.vars.g_map_layer_traffic = new ZDC.Traffic({
date: parseInt(today, 10)
});
itsmo.vars.g_map_obj.addWidget(g_map_layer_traffic);
} else {
itsmo.vars.g_map_layer_traffic.setDate(parseInt(today, 10));
}
itsmo.vars.g_map_layer_traffic.visible();
if(itsmo.vars.g_map_traffic_h == 1 && itsmo.vars.g_map_traffic_l == 1) itsmo.vars.g_map_layer_traffic.setLayer('LOCAL,HIGHWAY');
if(itsmo.vars.g_map_traffic_h == 1 && itsmo.vars.g_map_traffic_l == 0) itsmo.vars.g_map_layer_traffic.setLayer('HIGHWAY');
if(itsmo.vars.g_map_traffic_h == 0 && itsmo.vars.g_map_traffic_l == 1) itsmo.vars.g_map_layer_traffic.setLayer('LOCAL');
};
itsmo.myroute.map_vics_clear = function() {
itsmo.vars.g_route_vics.restoreMinimize();
itsmo.lib.document_off('ajax_myroute_panel3_vics');
if(itsmo.vars.g_map_layer_traffic == null) return;
};
//--------------------------------------------------------------------------------------------------
// 総合ルート
//--------------------------------------------------------------------------------------------------
itsmo.myroute.myroute_panel_submit_all = function() {
itsmo.lib.map_wait2open("ルート計算中");
// ルートクラス
itsmo.myroute.route = new itsmo.route();
itsmo.myroute.myroute_panel_eventdel();
itsmo.map.setMouseCursor('hand');
for (i = 0; i < itsmo.vars.g_myroute_stop_num; i++) {
if (!itsmo.vars.g_myroute_stops[i]) { continue; }
var point = itsmo.vars.g_myroute_stops[i];
if (i == 0) {
// start
itsmo.myroute.route.setStartPos(point.lat, point.lon, point.title);
} else if (i == itsmo.vars.g_myroute_stop_num - 1) {
// goal
itsmo.myroute.route.setGoalPos(point.lat, point.lon, point.title);
} else if ('car' == itsmo.vars.g_myroute_mode) {
// 経由(電車・徒歩は不要)
itsmo.myroute.route.addMidPos(point.lat, point.lon, point.title);
}
}
// ルート検索条件設定
var config = null, resultfunc = null;
switch (itsmo.vars.g_myroute_mode) {
case 'car':
//-- 車ルート
resultfunc = itsmo.myroute.myroute_panel_result_car;
config = itsmo.vars.g_myroute_configs.car;
itsmo.myroute.route.setSearchType(0);
itsmo.myroute.route.setUseOnlyWalk(false);
//itsmo.myroute.route.useVics(config['ton'] == '1');
itsmo.myroute.route.setRouteOrder(config['sort']);
itsmo.myroute.route.setWalkCond(0);
itsmo.myroute.route.useDriveStr('3' == config['opt1'] ? 1 : 0); // 直線
itsmo.myroute.route.setDriveRouteOrder(config['opt1']);
itsmo.myroute.route.useExpress(false);
itsmo.myroute.route.setUseSmartIC(!!parseInt(config['smart'], 10));
itsmo.myroute.route.setCarType(parseInt(config['opt2'], 10));
// config['opt1']
break;
case 'all':
//-- 電車・徒歩ルート
resultfunc = itsmo.myroute.myroute_panel_result_all;
config = itsmo.vars.g_myroute_configs.all;
itsmo.myroute.route.setSearchType(1);
// 徒歩ルート優先か?
if (itsmo.vars.g_myroute_isWalk === true) {
itsmo.myroute.route.setUseOnlyWalk(true);
}
// 特急利用
if (config['exp'] == '1') {
itsmo.myroute.route.useExpress(true);
} else {
itsmo.myroute.route.useExpress(false);
}
// 表示順(乗換検索条件)
itsmo.myroute.route.setRouteOrder(config['sort']);
// 徒歩条件
itsmo.myroute.route.setWalkCond(config['psc']);
break;
}
itsmo.myroute.route.setDateTime(config['top'], config['date'], config['time']);
// 検索開始
setTimeout (function() {
// 少し時間を開けて実行
var ret = itsmo.myroute.route.search();
if (ret) {
// 決定ルート線をクリア
itsmo.vars.g_myroute_shapeline1.hidden();
itsmo.vars.g_myroute_shapeline1.removeAllPoints();
// 透過ルート線をクリア
itsmo.vars.g_myroute_shapeline2.hidden();
itsmo.vars.g_myroute_shapeline2.removeAllPoints();
// if (itsmo.myroute.mouseMoveEvent) {
// ZDC.removeListener(itsmo.myroute.mouseMoveEvent);
// itsmo.myroute.mouseMoveEvent = null;
// }
// ルートを非表示
itsmo.myroute.route.clearRoute();
$(".config-buttons-wrap").hide();
// ルート地点情報をクリア
// itsmo.myroute.route.clearPos();
// 結果表示
var index = 0;
resultfunc(index);
itsmo.myroute.route.isDisplayRoute = true;
// 位置、縮尺設定
itsmo.myroute.setMapLocationForRouteResult();
} else {
// フロート非表示
itsmo.lib.map_wait2close();
// エラーメッセージ取得
var errs = itsmo.myroute.route.errJudgment();
}
}, 500);
};
// 結果表示
itsmo.myroute.myroute_panel_result_all = function(index) {
itsmo.myroute.myroute_panel_result_kouho_event('open');
// ルートタイプ取得
var routeType = itsmo.myroute.route.getRouteType(index);
// ルート候補取得
var listAll = itsmo.myroute.route.getRouteList();
// 候補一覧表示 ------------------------------
var html = '';
$.each(listAll, function(i, obj) {
if(i == index){
var class_name = 'r-k-list-act';
}else{
var class_name = 'r-k-list';
}
if (obj.type != 1) {
// 電車・徒歩ルート(車ルート以外)
html += '';
html += '候補' + (i+1) + '('+obj.StartTime+'~'+obj.EndTime+')';
html += '';
html += '時間 : ' + itsmo.myroute.getTotalTimeContent(obj.TotalTime);
if (obj.TotalFare && obj.TotalFare > 0){
html += '
料金 : ' + itsmo.lib.setComma(obj.TotalFare) + '円';
}
if( obj.transCnt && obj.transCnt > 0){
html += '
乗換 : ' + obj.transCnt + '回';
}
html += '';
html += '';
html += '';
if(obj.useWalk) html += '';
if(obj.useTrain) html += '';
if(obj.useAirline) html += '';
if(obj.useBass) html += '';
if(obj.useCar) html += '';
if(obj.useCycle) html += '';
if(obj.useShip) html += '';
html += '';
html += '';
if(obj.haya) html += '';
if(obj.raku) html += '';
if(obj.yasu) html += '';
html += '';
html += '';
html += '';
} else {
}
});
if (html == '') {
// フロート非表示
itsmo.lib.map_wait2close();
itsmo.lib.aplErrorWindow('E','0011',null,'(type=3)');
itsmo.myroute.myroute_panel_list();
return false;
}
itsmo.lib.document_setvalue('ajax_myroute_panelall_kouholist',html);
// ルート表示
itsmo.myroute.myroute_panel_result_all_detail(index);
itsmo.myroute.myroute_panel_change('result_all');
// itsmo.myroute.myroute_panel_result_kouho('alert');
itsmo.lib.document_off('ajax_myroute_panelall_kouho');
// フロート非表示
itsmo.lib.map_wait2close();
};
itsmo.myroute.myroute_panel_result_kouho_event = function(act) {
if( act == 'open'){
itsmo.lib.document_on('route_kouho_panel');
} else if( act == 'close'){
itsmo.lib.document_off('route_kouho_panel');
}
};
// 結果詳細表示 ----------------------------------
itsmo.myroute.myroute_panel_result_all_detail = function(idx, flg) {
// ルートを非表示
// itsmo.myroute.route.clearRoute();
itsmo.myroute.myroute_panel_lyrclear_tips();
if (flg) {
// ルート再検索
itsmo.myroute.route.research(idx);
var routeData = itsmo.myroute.route.getNaviData(idx);
var routeParams = '&naviid=' + routeData.attr('naviid') + '&useType=' + routeData.attr('useType');
$('#route_param').text(routeParams);
}
// ルートを表示
itsmo.myroute.route.drawRoute(idx);
// ルート候補取得(1件)
var obj = itsmo.myroute.route.getRouteList(idx);
// 時間,候補
var title = '候補' + (idx+1) + '(' + obj[0].StartTime + '~' + obj[0].EndTime +')';
itsmo.lib.document_setvalue('detail-title', title);
// ルート検索結果取得
var routeInfo = itsmo.myroute.route.getQuickInfo(idx);
var count = routeInfo.length;
// 基本情報 やむなくhtml組み立て
// リスト描画
var html = '';
$.each(routeInfo, function(i, info) {
html += '';
html += '';
switch (1) {
case info.useTrain:
html += '';
break;
case info.useAirline:
html += '';
break;
case info.useWalk:
html += '';
break;
case info.useBass:
html += '';
break;
case info.useCar:
html += '';
break;
case info.useCycle:
html += '';
break;
case info.useShip:
html += '';
break;
}
if (info.type == 3 && typeof info.useWalk == 'undefined') {
html += '';
}
html += '';
html += '';
html += '' + info.start + '~' + info.end;
if(info.linenm) html += '('+ info.linenm +')';
html += '
';
html += '' + info.start_time + '~' + info.end_time + ' ';
if (info.fare && info.fare > 0) html += itsmo.lib.setComma(info.fare.toString()) + '円';
html += '';
var pos = '';
if (i == 0) {
pos = 'start';
} else if (i == count - 1) {
pos = 'goal';
}
if (pos != '') {
// スタート・ゴールフラグ生成
itsmo.myroute.makeTooltip(info, pos);
if (count == 1) itsmo.myroute.makeTooltip(info, 'goal');
}
});
html += 'Powered by ジョルダン';
itsmo.lib.document_setvalue('ajax_myroute_panelall_kekka',html);
$('.r-k-list-act').attr('class','r-k-list');
$('#r-k-list_' + idx).attr('class','r-k-list-act');
//表示
itsmo.myroute.ContentPanelHide();
$('#route_result').show();
itsmo.lib.document_off('ajax_myroute_panelall_kouho');
};
// 所要時間コンテンツを返す
itsmo.myroute.getTotalTimeContent = function(totalTime)
{
var setTime = '';
var hour = Math.floor(totalTime / 60);
var min = totalTime % 60;
if (hour >= 1) {
setTime += hour + '時間' + min + '分';
} else {
setTime += min + '分';
}
return setTime;
};
// ルート表示用に地図の位置とズームを設定する
itsmo.myroute.setMapLocationForRouteResult = function()
{
var data = itsmo.myroute.route.getRouteShowRange();
// 位置、縮尺設定
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(data.clat, data.clon));
itsmo.vars.g_map_obj.setZoom(data.zoom);
};
// ツールチップ生成
itsmo.myroute.makeTooltip = function(info, pos)
{
// ユーザ指定 スタート/ゴール
for (i = 0; i < itsmo.vars.g_myroute_stop_num; i++) {
if (!itsmo.vars.g_myroute_stops[i]) { continue; }
var point = itsmo.vars.g_myroute_stops[i];
// ツールチップHTML
var tiphtml = '', offset = null;
var nh = '', nh_tbl = '';
var msg = 'itsmo.vars.g_map_layer_clickable.get(itsmo.vars.g_myroute_poilyrtips['+i+']).openmsg();return false;';
if (i == 0 && pos == 'start'){
//-- スタート
tiphtml =
''
+ '
'
+ '
'
+ ' ';
offset = new ZDC.Pixel(-4, -32);
if (info.start_time) nh_tbl += '出発 | ' + info.start_time + ' |
';
} else if (i == itsmo.vars.g_myroute_stop_num - 1 && pos == 'goal') {
//-- ゴール
tiphtml =
''
+ '
'
+ '
'
+ ' ';
offset = new ZDC.Pixel(-4, -32);
if (info.end_time) nh_tbl += '到着 | ' + info.end_time + ' |
';
}
if (nh_tbl != '') {
nh += ''+ decodeURIComponent(point.title) + '
';
if (info.fare) nh_tbl += '料金 | ' + info.fare + ' | ';
nh += '';
nh += '地図を拡大
';
/*
var e = $('#screen-wrap #div_eki_kousa');
e.find('#div_eki_content').html(nh);
nh = e.html();
*/
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(point.lat, point.lon), {
html: tiphtml,
size: itsmo.sub.getHtmlSize(tiphtml),
offset: offset
});
tip.point = point;
tip.nh = nh;
tip.openmsg = function() {
itsmo.map.closeUserMsgWindow();
itsmo.map.openUserMsgWindow(this.point, this.nh, new ZDC.Pixel(-103, -22));
};
tip.zoom = function() {
itsmo.map.closeUserMsgWindow();
itsmo.vars.g_map_obj.moveLatLon(this.getLatLon());
itsmo.vars.g_map_obj.setZoom(17);
};
var id = itsmo.vars.g_map_layer_clickable.add(tip);
itsmo.vars.g_map_layer_clickable.showById(id);
while (itsmo.vars.g_myroute_poilyrtips.length <= i) {
itsmo.vars.g_myroute_poilyrtips.push(null);
}
itsmo.vars.g_myroute_poilyrtips[i] = id;
/*
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(point.lat, point.lon), {
html: tiphtml,
size: itsmo.sub.getHtmlSize(tiphtml),
offset: offset
});
var id = itsmo.vars.g_map_layer_route.add(tip);
tip.open();
*/
}
}
};
//------------------------------------------------
// ETC
//------------------------------------------------
itsmo.myroute.myroute_etcopen = function() {
//alert('_debug NEXCOに渡す名称 出発「'+itsmo.vars.g_myroute_icstart+'」 到着「'+itsmo.vars.g_myroute_icend+'」');
var url = 'http://www.driveplaza.com/SearchQuickOutside/?';
if(itsmo.vars.g_myroute_icstart != null) url += '&startPlaceKana='+encodeURI(itsmo.vars.g_myroute_icstart);
if(itsmo.vars.g_myroute_icend != null) url += '&arrivePlaceKana='+encodeURI(itsmo.vars.g_myroute_icend);
url += '&carType='+itsmo.vars.g_myroute_configs.car['opt2'];//車種 0:軽 1:普通 2:中型 3:大型 4:特大
url += '&priority=1';//優先 2:時間 1:距離 3:料金
window.open(url,null);
};
// ルート検索&地図描画
itsmo.route = function() {
this.clearPos();
this.setSearchType(0);
this.setUseOnlyWalk(false);
this.setDateTime(0, '', '');
//this.useVics(false);
this.setDriveRouteOrder(0);
this.useDriveStr(0);
this.setDriveSpeed(25);
this.setHighwaySpeed(80);
this.setWalkSpeed(4);
this.setWalkCond(0);
this.useExpress(false);
this.setUseSmartIC(false);
this.setCarType(1);
this.setRouteOrder(0);
this.setCycleRouteOrder(0);
this.setCycleSpeed(15);
this.result = null;
this.TaxiInfoData = null;
this.result_naviid = new Array();
this.result_list = new Array();//車ルート退避用
this.shape_layer = null;
this.layer_traffic = null;
this.isHighway = this.isLocal = true;
this.poi_layer = null;
this.removePointMaxDeg = 4; // 間引き角度
this.isDisplayRoute = false;
};
itsmo.route.isIE6 = (typeof document.documentElement.style.maxHeight == "undefined");
itsmo.route.stations_tip = [];
itsmo.route.marker_id = {};
itsmo.route.poilayer = null;
//itsmo.route.msgWindow = null;
//itsmo.route.msgWindowSmall = null;
//itsmo.route.msgWindow_train = null;
itsmo.route.changedMapZoom_init = false;
itsmo.route.init = function() {
if (!itsmo.route.changedMapZoom_init) {
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CHG_ZOOM, itsmo.route.changedMapZoom);
itsmo.route.changedMapZoom_init = true;
}
};
/*
itsmo.route.prototype.test01 = function(useCar) {
this.clearPos();
this.setSearchType(useCar);
this.setStartPos(128439760,503167930,'tokyost');
this.setGoalPos(128359000,503094990,'tower');
this.addMidPos(128405958,503144763,'keiyu1');
this.addMidPos(128365537,503157740,'keiyu2');
this.setDateTime(0, '20100815', '1231');
//this.useVics(true);
this.setRouteOrder(0);
//this.setDriveRouteOrder(1);
this.useDriveStr(1);
this.setDriveSpeed(25);
this.setHighwaySpeed(80);
this.setWalkSpeed(4);
this.setWalkCond(0);
this.useExpress(false);
this.setUseSmartIC(false);
this.setCarType(1);
var i = this.search();
var j = "route search result=" + (i ? 1 : 0);
if (null != this.result) {
j += ", err=" + this.result.find('err').text();
}
if (!i) {
return false;
}
j = 'route num=' + this.getRouteNum();
if (this.getRouteNum() >= 1) {
j = this.getRouteShowRange(0);
itsmo.vars.g_map_obj.moveLatLon(itsmo.lib.toLatLon(j.clat, j.clon))
itsmo.vars.g_map_obj.setZoom(j.zoom);
this.drawRoute(0);
}
};
*/
/**
* ルートを検索する。検索成功で true が帰る。
*/
itsmo.route.prototype.search = function() {
if (null == this.startPos || null == this.goalPos) {
return false;
}
var params = {};
//params['useCar'] = this.useCar ? 1 : 0;
params['useType'] = this.useType;
params['useOnlyWalk'] = this.useOnlyWalk ? 1 : 0;
params['when'] = this.when;
params['datestr'] = this.datestr;
params['time'] = this.time;
//params['vics'] = this.vics ? 1 : 0;
params['driveRouteOrder'] = this.driveRouteOrder;
params['str'] = this.str;
params['int'] = $('#itsumo-navi').attr('data-int');
params['walkCond'] = this.walkCond;
params['useExpress'] = this.express ? 1 : 0;
params['carType'] = this.carType;
params['useSmartIC'] = this.smartIC ? 1 : 0;
params['routeOrder'] = this.routeOrder;
params['cycleRouteOrder'] = this.cycleRouteOrder;
params['cycleSpeed'] = this.cycleSpeed;
params['driveSpeed'] = this.driveSpeed;
params['highwaySpeed'] = this.highwaySpeed;
params['walkSpeed'] = this.walkSpeed;
params['removePointMaxDeg'] = this.removePointMaxDeg;
// 地点情報作成。
var i = [];
i.push(this.startPos.join("\t"));
i.push(this.goalPos.join("\t"));
if (this.midPos.length >= 1) {
// 配列の配列が midPos なので、中身の配列をそれぞれタブでつないだ配列、を
// map で作ってからその配列をさらに join する。
i.push($.map(this.midPos, function(n, i) {
return n.join("\t");
}).join("\t"));
}
params['p'] = i.join("\t");
var ret = false;
var this_obj = this;
$.ajax({
type: "POST",
url: '/map/ajax_route_navi.php',
cache: false,
dataType: "xml",
async: false,
timeout: 60000,
data: params,
error: function(xhr, textStatus, errorThrown) {
// TODO:エラーの場合のログは?
},
success: function(xml){
this_obj.result = $(xml);
this_obj.result_naviid = new Array();
this_obj.result_list = new Array();
var err = this_obj.result.find('err').text();
var rawVertexCnt = this_obj.result.find('rawVertexCnt').text();
var removedVertexCnt = this_obj.result.find('removedVertexCnt').text();
if (err == '0' && rawVertexCnt > 0 && removedVertexCnt > 0) {
this_obj.result.find('naviid').each(function(i, v1) {
v1 = $(v1);
this_obj.result_naviid[i] = v1;
});
//this_obj.result.find('naviid').empty();
this_obj.result_list[0] = this_obj.result;
ret = true;
} else {
var s = 'err[' + err + '],params=[' + params + ']';
var e = this_obj.result.find('errno');
if (e.length >= 1) {
s += ' [errno=' + e.text() + ']'
}
e = this_obj.result.find('err_cd');
if (e.length >= 1) {
s += ' [err_cd=' + e.text() + ']'
}
// TODO:エラーの場合のログは?
}
//印刷画面のルート表示用にパラメータを取得
var naviid = this_obj.result.find('naviid').attr('naviid');
var useType = this_obj.result.find('naviid').attr('useType');
var route_param = '&naviid=' + naviid + '&useType=' + useType;
//印刷画面のルート表示用にパラメータを保持
$('#route_param').text(route_param);
}
});
return ret;
};
/**
* ルートを検索する。naviidだけで検索
*/
itsmo.route.prototype.research = function(n, naviid, useType){
var this_obj = this;
if(naviid == undefined){
if(this_obj.result_list[n]){//もうある
this_obj.result = this_obj.result_list[n];
return true;
}
var naviinfo = this_obj.result_naviid[n];
if(naviinfo == undefined){
return false;
}
var naviid = naviinfo.attr('naviid');
var useType = naviinfo.attr('useType');
}
var params = {};
params['naviid'] = naviid;
params['useType'] = useType;
var ret = false;
$.ajax({
type: "POST",
url: '/map/ajax_route_navi.php',
cache: false,
dataType: "xml",
async: false,
timeout: 60000,
data: params,
error: function(xhr, textStatus, errorThrown) {
// TODO:エラーの場合のログは?
},
success: function(xml){
this_obj.result = $(xml);
var err = this_obj.result.find('err').text();
var rawVertexCnt = this_obj.result.find('rawVertexCnt').text();
var removedVertexCnt = this_obj.result.find('removedVertexCnt').text();
if (err == '0' && rawVertexCnt > 0 && removedVertexCnt > 0) {
this_obj.result_list[n] = this_obj.result;
ret = true;
} else {
var s = 'err[' + err + '],params=[' + params + ']';
var e = result.find('errno');
if (e.length >= 1) {
s += ' [errno=' + e.text() + ']'
}
e = result.find('err_cd');
if (e.length >= 1) {
s += ' [err_cd=' + e.text() + ']'
}
// TODO:エラーの場合のログは?
}
}
});
return ret;
};
/**
* 検索したルートを表示する。
* @param n 何番目のルートか。
*/
itsmo.route.prototype.drawRoute = function(n) {
if(!n){ n = 0; }
var nd = this.getNaviData(n);
var useid = nd.attr('useid');
n = this.getRouteData(0);
if (false == n) {
return false;
}
// 表示済みのルートを消す。
this.clearRoute();
if (null == this.shape_layer) {
// シェイプレイヤ作成。
this.shape_layer = new itsmo.map.UserLayer();
}
var l = this.shape_layer;
var addBlackline = function(v1){
var v1 = $(v1);
var latlons = [];
v1.find('v').each(function(j, v2) {
v2 = $(v2);
latlons.push(itsmo.lib.toLatLon(v2.attr('lat'), v2.attr('lon')));
});
// 黒で縁取り用ラインを描く。
var pl = new ZDC.Polyline(latlons, {
strokeColor: '#333333',
lineOpacity: 1.0, // 透明度
strokeWeight: parseInt(v1.attr('sz'), 10) + 2
});
l.add(pl);
};
var addline = function(v1){
var v1 = $(v1);
var latlons = [];
v1.find('v').each(function(j, v2) {
v2 = $(v2);
latlons.push(itsmo.lib.toLatLon(v2.attr('lat'), v2.attr('lon')));
});
var pl = {};
pl.strokeColor = v1.attr('cl');
// pl.strokeWeight = parseInt(v1.attr('sz'), 10);
pl.strokeWeight = 5;
var road_type = parseInt(v1.attr('road_type'), 10);
var line_color = v1.attr('cl');
var indoor = v1.attr('indoor');
switch (Math.floor(road_type / 1000)) {
case 1: // 道路
pl.lineOpacity = 0.8; // 透明度
if (1000 == road_type || 1001 == road_type || 1010 == road_type || '#00d0c8' == line_color) {
// 高速道路
pl.strokeColor = '#19afe7';
} else {
// その他の道路。
pl.strokeColor = '#2361ed';
}
break;
case 2: // 徒歩
if (indoor == 1) {
// 屋内
pl.lineOpacity = 0.8; // 透明度
pl.strokeColor = '#c000ff';
} else {
pl.lineOpacity = 1.0; // 透明度
pl.strokeColor = '#ea5330';
}
break;
case 3: // 電車
pl.lineOpacity = 0.8; // 透明度
pl.strokeColor = '#e6b900';
break;
default: // その他
pl.lineOpacity = 1.0; // 透明度
pl.strokeColor = '#04af00';
break;
}
pl = new ZDC.Polyline(latlons, pl);
l.add(pl);
};
// 線の本体を描く。
if(!$.support.opacity){//IE6,7,8は処理能力が実行キューへの登録に追いつかないためsettimeoutで登録を遅らせる
var id;
//clearTimeout(id);
n.find('lines line').each(function(i, v1) {
id = setTimeout(function(){
//clearTimeout(id);
// addBlackline(v1);
addline(v1);
},5);
});
//clearTimeout(id);
} else {
n.find('lines line').each(function(i, v1) {
// addBlackline(v1);
addline(v1);
});
}
this.shape_layer.showAll();
//if (this.useCar && this.vics) {
// if (this.useType == 0 && this.vics) {
//this.showTrafficLayer();
// }
if (null == this.poi_layer) {
this.poi_layer = new itsmo.map.UserLayer();
this.poi_layer.setZIndex(itsmo.map.D_ZINDEX_LAYER);
}
var poilayer = itsmo.route.poilayer = itsmo.route.stations_tip_layer = this.poi_layer;
//初期化
$.each(itsmo.route.stations_tip, function(i, v1) {
poilayer.removeById(v1);
});
itsmo.route.stations_tip = [];
itsmo.route.marker_id = {};
var func = function() {
itsmo.map.closeUserMsgWindow();
if ('' != this.htmlForInner) {
itsmo.map.openUserMsgWindow(this.latlon, this.htmlForInner);
}
};
var funcOpenSmall = function() {
itsmo.map.closeUserMsgWindow();
if ('' != this.htmlForInner) {
itsmo.map.openUserMsgWindow(this.latlon, this.htmlForInner);
}
};
var saCnt = 0;
var paCnt = 0;
var funcSetIcon = function(i, v1) {
//電車?
var type = $(v1).attr('road_type');
type = type.substr(0,1);
if('3' == type || $(v1).attr('ttstcd') != ''){
train_funcSetIcon(i, v1);//電車
}else{
car_funcSetIcon(i, v1);//車,それ以外
}
};
var car_funcSetIcon = function(i, v1) {
v1 = $(v1);
var terminal = v1.attr('terminal');
var iconimage = '';
var iconsize = null;
var iconoffset = null;
var divprop = ' style="width:200px;height:160px;overflow:auto;"';
if (terminal == 'JCT') {
iconimage = '/design/img/route/icn_route_jct.png';
iconsize = new ZDC.WH(24, 24);
iconoffset = new ZDC.Pixel(-12, -12);
} else if (terminal == 'IC') {
iconimage = '/design/img/route/icn_route_ic.png';
iconsize = new ZDC.WH(24, 24);
iconoffset = new ZDC.Pixel(-12, -12);
} else if (terminal == 'PA') {
iconimage = '/design/img/route/icn_route_pa.png';
iconsize = new ZDC.WH(21, 16);
iconoffset = new ZDC.Pixel(-10, -8);
} else if (terminal == 'SA') {
iconimage = '/design/img/route/icn_route_sa.png';
iconsize = new ZDC.WH(21, 16);
iconoffset = new ZDC.Pixel(-10, -8);
} else {
iconimage = '/design/img/route/icn_route_highway.png';
iconsize = new ZDC.WH(16, 16);
iconoffset = new ZDC.Pixel(-8, -8);
//return;
}
var latlon = { lat: v1.attr('start_lat'), lon: v1.attr('start_lon') };
var mrk = new ZDC.Marker(itsmo.lib.toLatLon(latlon), {
offset: iconoffset,
custom: {
base: {
imgSize: iconsize,
src: iconimage
}
}
});
mrk.latlon = latlon;
mrk.terminal = terminal;
mrk.start_nm = v1.attr('start');
if (terminal == 'PA') {
mrk.cnt = paCnt++;
} else if (terminal == 'SA') {
mrk.cnt = saCnt++;
}
var h = '';
h += '
';
if ('' != v1.attr('start')) {
h += ''
+ v1.attr('start') + ' |
';
} else {
h += '(名称なし)
|
';
}
mrk.func = func;
if ('PA' == terminal || 'SA' == terminal) {
if (v1.attr('terminal_text') != undefined) {
h += ' ' + v1.attr('terminal_text') + ' | ';
}
if (v1.attr('pa_service') != undefined) {
h += '' + v1.attr('pa_service') + ' |
|
';
}
} else if ('' == v1.attr('image_url')) {
mrk.func = funcOpenSmall;
} else {
h += '![](' + v1.attr('image_url') + ') |
';
}
h += '
';
//mrk.node.innerHTML = h;
mrk.htmlForInner = h;
ZDC.addListener(mrk, ZDC.MARKER_MOUSEUP, mrk.func);
var id = itsmo.route.poilayer.add(mrk, true);
itsmo.route.marker_id[id] = true;
};
// 電車用
var trainCnt = 0;
var train_func = function() {
itsmo.map.closeUserMsgWindow();
if ('' != this.htmlForInner) {
this.useHTML = '' + this.htmlForInner + '
';
this.htmlForInner = '';
}
itsmo.map.openUserMsgWindow(itsmo.lib.toMilliSec(this.getLatLon()), this.useHTML);
};
var train_zoomfunc = function() {
itsmo.map.closeUserMsgWindow();
itsmo.vars.g_map_obj.moveLatLon(this.getLatLon());
itsmo.vars.g_map_obj.setZoom(17);
};
var train_funcSetIcon = function(i, v1) {
v1 = $(v1);
var text = v1.attr('text');
if(!text){
return;
}
var texts = [];
texts = text.split("\\n");
var ekiname = texts[0];
var start = ''
var end = ''
if(texts[1] != undefined){
var j = texts[1];
if(j.substr(0 , 1) == '着'){
end = j.replace('着' , '');
}else{
start = j.replace('発' , '');
}
}
if(texts[2] != undefined){
j = texts[2];
if(j.substr(0 , 1) == '着'){
end = j.replace('着' , '');
}else{
start = j.replace('発' , '');
}
}
if(start == '' && end == ''){
return false;
}
if (v1.attr('linenm') != undefined && v1.attr('linenm') != '') {
ekiname += '(' + v1.attr('linenm') + ')';
}
if (ekiname.length > 11) ekiname = ekiname.substr(0, 12) + "...";
var onclickhtml = 'itsmo.route.stations_tip_layer.get(itsmo.route.stations_tip[' + trainCnt + ']).openmsg();return false;';
var tiphtml =
''
;
var offset = new ZDC.Pixel(-8, -8);
var nh = '';
nh += ''+ ekiname + '
';
var nh_tbl = '';
if (end != '') {
nh_tbl += '到着 | ' + end + ' |
';
}
if (start != '') {
nh_tbl += '出発 | ' + start + ' |
';
}
if (v1.attr('fare') != undefined) {
nh_tbl += '料金 | ' + v1.attr('fare') + '円 | ';
}
if(nh_tbl != '') { nh += ''; }
nh += '地図を拡大
';
var e = $('#screen-wrap #div_eki_kousa');
e.find('#div_eki_content').html(nh);
nh = e.find('#div_eki_content').html();
var tip = new ZDC.UserWidget(itsmo.lib.toLatLon(v1.attr('start_lat'), v1.attr('start_lon')), {
html: tiphtml,
size: itsmo.sub.getHtmlSize(tiphtml),
offset: offset
});
tip.htmlForInner = nh;
tip.openmsg = train_func;
tip.zoom = train_zoomfunc;
var id = poilayer.add(tip, true);
poilayer.showById(id);
itsmo.route.stations_tip.push(id);
trainCnt++;
};
//チップ作成
n.find('nodes node').each(funcSetIcon);
n.find('nodes_noname node').each(funcSetIcon);
itsmo.route.changedMapZoom();
// 徒歩ルートにアイコンを載せる。
if (n.find('walkIcons').length >= 1) {
var poilayer = this.poi_layer;
n.find('walkIcons').each(function(i, v1) {
v1 = $(v1);
var mrk = new ZDC.UserWidget (itsmo.lib.toLatLon(v1.attr('lat'), v1.attr('lon')), {
offset: new ZDC.Pixel(-12, -36 + 3),
size: new ZDC.WH(24, 36),
html: '![](/design/img/route/walk/' + v1.attr('id') + '.png)
'
});
i = poilayer.add(mrk, false);
mrk.setZindex(itsmo.map.D_TIPZIDX_MAPLINK);
poilayer.showById(i);
});
}
};
/** マーカーを表示する地図レベルを返却 */
itsmo.route.changedMapZoom_getShowLevel = function(m) {
if ('SA' == m.terminal) {
return [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
}
if ('PA' == m.terminal) {
return [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
}
if (m.start_nm != '' && 'IC' != m.terminal && 'JCT' != m.terminal) {
// IC, JCT でない交差点等
return [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
}
if (m.start_nm != '' && 'JCT' != m.terminal) {
// IC 等
return [11, 12, 13, 14, 15, 16, 17, 18];
}
if (m.start_nm != '' && 'JCT' == m.terminal) {
// JCT
return [10, 11, 12, 13, 14, 15, 16, 17, 18];
}
return [16, 17, 18];
};
/**
* マップズーム変更時
*/
itsmo.route.changedMapZoom = function() {
var lv = itsmo.vars.g_map_obj.getZoom();
lv = parseInt(lv) + 1;
$.each(itsmo.route.marker_id, function(id, isVisible) {
var m = itsmo.route.poilayer.get(id);
if (null == m || undefined == m) {
return;
}
// 現在の地図レベルでそのマーカーを表示すべきかどうかのフラグ。
var isShow = itsmo.route.changedMapZoom_getShowLevel(m);
isShow = $.inArray(lv, isShow) >= 0;
if (isVisible) {
if (!isShow) {
// 表示されているが、非表示にすべきレベルだった。
itsmo.route.poilayer.setVisibleById(id, false);
itsmo.route.marker_id[id] = false;
}
} else {
if (isShow) {
// 表示すべきレベルなのに非表示だった。
itsmo.route.poilayer.setVisibleById(id, true);
itsmo.route.marker_id[id] = true;
}
}
});
};
/**
* マップズーム変更時
*/
/*
itsmo.route.changedMapZoom = function() {
var lv = itsmo.vars.g_map_obj.getZoom();
if (lv >= 1 && lv <= 5) {
// 特定のマーカーのみ表示。
itsmo.route.marker_id = $.map(itsmo.route.marker_id, function(v1, i) {
var m = itsmo.route.poilayer.get(v1);
if (null == m) {
return null;
}
if ( 'SA' == m.terminal
|| 'PA' == m.terminal
// || 'IC' == m.terminal
// || 'JCT' == m.terminal
) {
if ((m.cnt % 3) == 0) {
return v1;
}
}
ZDC.clearListeners(m, ZDC.MARKER_CLICK);
itsmo.route.poilayer.removeById(v1)
itsmo.route.marker_hidden.push(m);
return null;
});
} else {
// 非表示になったマーカを再表示。
$.each(itsmo.route.marker_hidden, function(i, v1) {
ZDC.addListener(v1, ZDC.MARKER_CLICK, v1.func);
var mrk = itsmo.route.poilayer.add(v1);
itsmo.route.marker_id.push(mrk);
});
itsmo.route.marker_hidden = [];
}
};
*/
/**
* 表示済みルートを非表示かつ表示情報削除を行う。
*/
itsmo.route.prototype.clearRoute = function() {
this.isDisplayRoute = false;
if (null != this.shape_layer) {
this.shape_layer.clear();
}
if(this.layer_traffic != null) {
this.layer_traffic.hidden();
}
if (null != this.poi_layer) {
this.poi_layer.clear();
}
itsmo.route.marker_id = {};
itsmo.map.closeUserMsgWindow();
};
/**
* 渋滞統計情報表示レイヤーを表示する。
*/
itsmo.route.prototype.showTrafficLayer = function() {
var i = '20' + this.datestr + this.time;
if (i.length != 12) {
return false;
}
if(this.layer_traffic == null) {
this.layer_traffic = new ZdcTrafficImageLayer(i);
itsmo.vars.g_map_obj.addUserImageLayer(this.layer_traffic);
} else {
this.layer_traffic.setSdate(i);
}
if(!this.isHighway && !this.isLocal) {
this.layer_traffic.hidden();
} else {
this.layer_traffic.visible();
}
if( this.isHighway && this.isLocal) this.layer_traffic.setRoadType('ALL');
if( this.isHighway && !this.isLocal) this.layer_traffic.setRoadType('HIGHWAY');
if(!this.isHighway && this.isLocal) this.layer_traffic.setRoadType('LOCAL');
return true;
};
/**
* ルート情報の個数を返す。主に車ルートは通常1、徒歩+電車ルートは2以上が帰る。
*/
itsmo.route.prototype.getRouteNum = function() {
return this.result_naviid.length;
/*
if (this.result == null) {
return 0;
}
return this.result.find('route').length;
*/
};
/**
* ルートのリストを配列で返す。
*/
itsmo.route.prototype.getRouteList = function(num) {
var leng = this.getRouteNum();
if (leng <= 0) {
return false;
}
var ret = [];
var cnt = 0;
for(var i=0; i= this.getRouteNum()) {
n = 0;
}
//return this.result.find('naviid:eq(' + n + ')');
return this.result_naviid[n];
};
/**
* ルート情報を返す。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getRouteData = function(n) {
if (this.result == null) {
return false;
}
if (undefined == n || null == n) {
n = 0;
}
if (n < 0 || n >= this.getRouteNum()) {
n = 0;
}
return this.result.find('route:eq(' + n + ')');
};
/**
* ノード情報(アイコンの設置用やルートパネル内に表示する情報)を返す。
* @param n integer 何番目のルート情報を返すか。0~。
* @return array
*/
itsmo.route.prototype.getNodeInfo = function(n) {
var ret = [];
var names = [
'start_lat'
,'start_lon'
,'end_lat'
,'end_lon'
,'start'
,'end'
,'fare'
,'isWalk'
,'isTrain'
,'isCar'
,'linenm'
,'start_time'
,'end_time'
,'via'
,'road_type'
,'terminal'
,'image_url'
,'pa_service'
,'terminal_text'
];
var regex = new RegExp("^-?[0-9]+$");
this.getRouteData(n).find('nodes node').each(function(i, v1) {
v1 = $(v1);
var d = {};
$.each(names, function(j, v2) {
if ('' == v2 || undefined == v2) {
return;
}
j = v1.attr(v2);
if (j == undefined) {
return;
}
if (regex.test(j)) {
j = parseInt(j, 10);
}
d[v2] = j;
});
ret.push(d);
});
return ret;
};
/**
* ルートタイプを判定
* @param n integer
* @return array
*/
itsmo.route.prototype.getRouteType = function(n) {
return this.getNaviData(n).find('quick').attr('use');//電車:4、徒歩:2、車:1、自転車:8
};
/**
* 簡易情報(左リストの情報)を返す。
* @param n integer 何番目のルート情報を返すか。0~。
* @return array
*/
itsmo.route.prototype.getQuickInfo = function(n) {
if(!n){ n = 0; }
var type = this.getRouteType(n);
switch(type){
case '1':
var ret = this.getQuickCar(n);
break;
case '2':
var ret = this.getQuickWalk(n);
break;
case '4':
var ret = this.getQuickTrain(n);
break;
case '8':
var ret = this.getQuickCycle(n);
break;
}
return ret;
};
itsmo.route.prototype.getQuickList = function(n,names) {
var ret = [];
var regex = new RegExp("^-?[0-9]+$");
this.getNaviData(n).find('quick info').each(function(i, v1) {
v1 = $(v1);
var d = {};
$.each(names, function(j, v2) {
if ('' == v2 || undefined == v2) {
return;
}
j = v1.attr(v2);
if (j == undefined) {
return;
}
if (v2 != 'name' && regex.test(j)) {
j = parseInt(j, 10);
}
d[v2] = j;
});
ret.push(d);
});
return ret;
};
//簡易情報(車)を返す。
itsmo.route.prototype.getQuickCar = function(n) {
var names = [
'name' //名称
,'time' //出発及び到着時刻
,'road_name'//道路名
,'gate_name'//料金所名
,'fare' //料金
,'type' //種別(start:出発地,goal:到着地,1:IC入口,2:IC出口,5:通過料金所,11:経由地点1,12:経由地点2,13:経由地点3)
];
var ret = this.getQuickList(n,names);
return ret;
};
//簡易情報(徒歩)を返す。
itsmo.route.prototype.getQuickWalk = function(n) {
var names = [
'start' //出発地
,'end' //到着地
,'start_time' //出発時刻
,'end_time' //到着時刻
,'time_ride' //
,'type' //3:徒歩
,'taxi_info_no'
];
var ret = this.getQuickList(n,names);
return ret;
};
//簡易情報(電車)を返す。
itsmo.route.prototype.getQuickTrain = function(n) {
var names = [
'start' //出発地
,'end' //到着地
,'start_time' //出発時刻
,'end_time' //到着時刻
,'linenm' //路線名
,'trainkind' //列車区分
,'time_ride' //乗車時間
,'time_wait' //待ち時間
,'dir_name' //方面名
,'fare' //料金
,'type' //2:電車,3:徒歩,4:車,5:飛行機,6:バス,7:フェリー,8:自転車
,'taxi_fare' //4:車の時のタクシー料金
,'datestr' //タクシー利用時時間帯
,'road_name' //タクシー利用時通行道路
,'taxi_info_no'
,'useTrain'
,'useWalk'
,'useCar'
,'useAirline'
,'useBass'
,'useShip'
,'useCycle'
];
var ret = this.getQuickList(n,names);
return ret;
};
//簡易情報(自転車)を返す。
itsmo.route.prototype.getQuickCycle = function(n) {
var names = [
'name' //名称
,'time' //出発,到着,通過時刻
,'road_name'//道路名
,'type' //種別(start:出発地,goal:到着地,11:経由地点1,12:経由地点2,13:経由地点3)
,'time_ride'//経過時間
];
var ret = this.getQuickList(n,names);
return ret;
};
/**
* 出発時間を返す。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getStartTime = function(n) {
return this.getNaviData(n).attr('start_time');
};
/**
* 到着時間を返す。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getEndTime = function(n) {
return this.getNaviData(n).attr('end_time');
};
/**
* 総旅費を返す。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getTotalFare = function(n) {
return this.getNaviData(n).attr('totalFare');
};
/**
* 総時間を返す。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getTotalTime = function(n) {
n = this.getNaviData(n).attr('totalTime');
if(n){
return parseInt(n, 10);
}
return false;
};
/**
* 総距離を返す。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getTotalDistance = function(n) {
n = this.getNaviData(n).attr('distance');
if(!n){ return false; }
return parseInt(n, 10);
};
/**
* タクシーの利用時間帯(日中等)を返す。
* 存在しない場合は false が帰る。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getTaxiDateStr = function(n) {
n = this.getNaviData(n).find('taxi_datestr');
if (n.length <= 0) {
return false;
}
return n.text();
};
/**
* タクシーの利用料金を返す。
* 存在しない場合は false が帰る。
* @param n integer 何番目のルート情報を返すか。0~。
*/
itsmo.route.prototype.getTaxiFare = function(n) {
n = this.getNaviData(n).find('taxi_fare');
if (n.length <= 0) {
return false;
}
return n.text();
};
/**
* 開始点におけるタクシーの一般利用料金情報を返す。
* 存在しない場合は false が帰る。
*/
itsmo.route.prototype.TaxiFareInfoCache = null;
itsmo.route.prototype.TaxiFareInfoParamCache = null;
itsmo.route.prototype.getTaxiFareInfo = function(n1,n2) {
var ret = this.getTaxiPrameter(n1,n2);
if(ret){
var params = 'hour=' + ret.taxi_time +'&lat=' + ret.taxi_lat +'&lon=' + ret.taxi_lon +'&distance=' + ret.taxi_distance;
if(this.TaxiFareInfoParamCache == params && this.TaxiFareInfoCache){//キャッシュあり。
return this.TaxiFareInfoCache;
}
ret = this.getTaxiInfo(params);
if(ret != null && ret != ''){
this.TaxiFareInfoCache = this.TaxiInfoData;
this.TaxiFareInfoParamCache = params;
return this.TaxiInfoData;
}
}
return false;
};
/**
* 開始点におけるタクシー各社の情報を返す。
* 存在しない場合は false が帰る。
*/
itsmo.route.prototype.TaxiCorpInfoCache = null;
itsmo.route.prototype.TaxiCorpInfoParamCache = null;
itsmo.route.prototype.getTaxiCorpInfo = function(n1,n2) {
var ret = this.getTaxiPrameter(n1,n2);
if(ret){
var params = 'lat=' + ret.taxi_lat +'&lon=' + ret.taxi_lon;
if(this.TaxiCorpInfoParamCache == params && this.TaxiCorpInfoCache){//キャッシュあり。
return this.TaxiCorpInfoCache;
}
ret = this.getTaxiInfo(params);
if(ret != null && ret != ''){
this.TaxiCorpInfoCache = this.TaxiInfoData;
this.TaxiCorpInfoParamCache = params;
return this.TaxiInfoData;
}
}
return false;
};
/*タクシー情報取得に必要なパラメータを取得*/
itsmo.route.prototype.getTaxiPrameter = function(n1,n2) {
var e = this.getNaviData(n1).find('taxi_infos').find('taxi_info');
var ret = [];
e = $(e);
e.each(function(i, v1) {
var v1 = $(v1);
var no = v1.attr('taxi_info_no');
if(n2 == no){
var names = [
'taxi_time',
'taxi_lat',
'taxi_lon',
'taxi_distance'
];
$.each(names, function(j, v2) {
if ('' == v2 || undefined == v2) {
return;
}
j = v1.attr(v2);
if (j == undefined) {
return;
}
ret[v2] = j;
});
}
});
if(!ret){
return false;
}
return ret;
};
/*タクシー情報取得*/
/*
itsmo.route.prototype.getTaxiInfo = function(params) {
this.TaxiInfoData = null;
var ret = false;
$.ajax({
type: "GET",
url: '/route_taxi_json.php',
cache: true,
dataType: "json",
async: false,
data: params,
error: function(xhr, textStatus, errorThrown) {
itsmo.log("itsmo.route.prototype.getTaxiInfo ajax error. " + textStatus);
},
success: function(json){
ret = json;
}
});
if(ret != null && ret != '' && ret != false){
this.TaxiInfoData = ret;
ret = true;
}
return ret;
};
*/
/**
* 開始点におけるタクシーの一般利用料金情報を返す。
* 存在しない場合は false が帰る。
itsmo.route.prototype.getTaxiFareInfo = function(n1,n2) {
e = this.getNaviData(n).find('taxi_fare_info');
if (e.length <= 0) {
return false;
}
e = $.parseJSON(e.text());
if(e == null ){
return false;
}
return e;
};
*/
/**
* 開始点におけるタクシー各社の情報を返す。
* 存在しない場合は false が帰る。
itsmo.route.prototype.getTaxiCorpInfo = function(n1,n2) {
e = this.getNaviData(n).find('taxi_corp_info');
if (e.length <= 0) {
return false;
}
e = $.parseJSON(e.text());
if(e == null ){
return false;
}
return e;
};
*/
/**
* 徒歩+電車ルートの「安早楽」フラグと電車利用フラグ、徒歩利用フラグを返す。
* フラグが存在しない場合は false が帰る。
* @param n integer 何番目のルートのフラグ情報を返すか。0~。
*/
itsmo.route.prototype.getWalkRouteFlags = function(n) {
n = this.getNaviData(n);
if (n.attr('raku') == undefined) {
return false;
}
return {
haya: ('0' != n.attr('haya')),
raku: ('0' != n.attr('raku')),
yasu: ('0' != n.attr('yasu')),
osusume: ('0' != n.attr('osusume')),
useTrain: ('0' != n.attr('useTrain')),
useWalk: ('0' != n.attr('useWalk')),
useCar: ('0' != n.attr('useCar')),
useAirline: ('0' != n.attr('useAirline')),
useBass: ('0' != n.attr('useBass')),
useShip: ('0' != n.attr('useShip')),
useCycle: ('0' != n.attr('useCycle')),
transCnt: n.attr('transcnt')
};
};
/**
* 電車・徒歩の時の遅延情報を返す。
* 情報がない場合は false が帰る。
* @param n integer 何番目のルートのフラグ情報を返すか。0~。
*/
itsmo.route.prototype.getTrafficData = function(n) {
n = this.getNaviData(n);
var e = n.find('traffics traffic');
if (e.length <= 0) {
return false;
}
var ret = [];
n.find('traffics traffic').each(function(i, v1) {
var data = {};
v1 = $(v1);
data['line_nm'] = v1.attr('line_nm');
data['date'] = v1.attr('date');
data['time'] = v1.attr('time');
data['text'] = v1.attr('text');
ret[i] = data;
});
return ret;
};
/**
* ルート情報の中心位置と表示領域の緯度経度を返す。
* @param n integer 何番目のルート情報を返すか。0~。
* @return object 以下のプロパティを含む object
* box_min_lat
* box_min_lon
* box_max_lat
* box_max_lon
* clat
* clon
* zoom 最適ズームレベル
*/
itsmo.route.prototype.getRouteShowRange = function(n) {
var n = this.getRouteData(n);
// 最適ズームレベルを計測。
var ret = function(){};
var names = [
'box_min_lat'
, 'box_min_lon'
, 'box_max_lat'
, 'box_max_lon'
, 'clat'
, 'clon'
];
$.each(names, function(i, v1) {
if ('' == v1 || undefined == v1) {
return;
}
i = n.attr(v1);
if (i == undefined) {
return;
}
ret[v1] = i;
});
var i = itsmo.vars.g_map_obj.getAdjustZoom(
[itsmo.lib.toLatLon(ret.box_min_lat, ret.box_min_lon)
, itsmo.lib.toLatLon(ret.box_max_lat, ret.box_max_lon)
]);
ret['zoom'] = i.zoom;
return ret;
};
/**
* エラー判定
* エラー
*/
itsmo.route.prototype.errJudgment = function(n) {
if(!n){ n = 0; }
var e = this.result.find('err_cd').text();
if (e.indexOf('8101',4) != -1) {//遠い
return 'far';
}else if(e.indexOf('8001',4) != -1){//近い
return 'near';
}else if(e.indexOf('0112',4) != -1){//失敗
return 'failure';
}else if(e.indexOf('9000',4) != -1){//パラメータ不正
return 'param';
}
if(!this.result_list[n]){
return 'nodata';
}
return true;
};
/**
* 自転車ルートで130kmを超えたかの判定。
* return 超えている場合:false、超えていない:true
*/
itsmo.route.prototype.cycleDistanceJudgment = function() {
e = this.result.find('err_cd');
if (e.length >= 1) {
if(e.text() == '03218101'){
return false;
}
}
return true;
};
/**
* 車ルート検索なら true、電車・徒歩ルートなら false を渡す。
*/
/*
itsmo.route.prototype.setSearchType = function(useCar) {
this.useCar = useCar;
};
*/
/**
* 車ルート検索なら 0、電車・徒歩ルートなら 1、自転車ルートなら 2を渡す。
*/
itsmo.route.prototype.setSearchType = function(use) {
this.useType = use;
};
/**
* 直進優先(自転車)
*/
itsmo.route.prototype.setCycleRouteOrder = function(cycleRouteOrder) {
this.cycleRouteOrder = cycleRouteOrder;
};
/**
* 自転車移動速度
* 引数:km単位
*/
itsmo.route.prototype.setCycleSpeed = function(cycleSpeed) {
this.cycleSpeed = cycleSpeed;
};
/**
* 車移動速度
* 引数:km単位
*/
itsmo.route.prototype.setDriveSpeed = function(driveSpeed) {
this.driveSpeed = driveSpeed;
};
/**
* 車移動速度(高速道路)
* 引数:km単位
*/
itsmo.route.prototype.setHighwaySpeed = function(highwaySpeed) {
this.highwaySpeed = highwaySpeed;
};
/**
* 歩行移動速度
* 引数:km単位
*/
itsmo.route.prototype.setWalkSpeed = function(walkSpeed) {
this.walkSpeed = walkSpeed;
};
/**
* 徒歩ルート検索で徒歩のみ(電車を使用しない)なら true。
*/
itsmo.route.prototype.setUseOnlyWalk = function(useOnlyWalk) {
this.useOnlyWalk = useOnlyWalk;
};
/**
* 日時設定。
* @param when 0=現在時刻 1=出発時刻指定 2=到着時刻指定
* @param datestr YYYYMMDD
* @param time HHMM
*/
itsmo.route.prototype.setDateTime = function(when, datestr, time) {
this.when = when;
this.datestr = datestr;
this.time = time;
};
/**
* 渋滞予測を使用するかどうか。
*/
//itsmo.route.prototype.useVics = function(vics) {
// this.vics = vics;
//};
/**
* ドライブルートの優先順位を設定。
* @param driveRouteOrder integer
* 0=時間優先
* 1=有料道路優先
* 2=一般道路優先
* 3=直進優先
*/
itsmo.route.prototype.setDriveRouteOrder = function(driveRouteOrder) {
this.driveRouteOrder = driveRouteOrder;
};
/**
* 直進優先(車)
*/
itsmo.route.prototype.useDriveStr = function(str) {
this.str = str;
};
/**
* 徒歩+電車ルートの表示順
* @param order
* 0=早い順
* 1=安い順
* 2=楽な順
*/
itsmo.route.prototype.setRouteOrder = function(order) {
this.routeOrder = order;
};
/**
* 徒歩条件。
* @param cond 0=おまかせ 1=屋根あり 2=階段少ない 3=大通り優先
*/
itsmo.route.prototype.setWalkCond = function(cond) {
this.walkCond = cond;
};
/**
* 特急利用。
* @param use boolean
*/
itsmo.route.prototype.useExpress = function(use) {
this.express = use;
};
/**
* 車種。
* @param cond
* 0 軽自動車・二輪車
* 1 普通車(default)
* 2 中型自動車
* 3 大型自動車
* 4 超大型自動車
*/
itsmo.route.prototype.setCarType = function(cond) {
this.carType = cond;
};
/**
* スマートIC利用。
* @param use boolean
*/
itsmo.route.prototype.setUseSmartIC = function(use) {
this.smartIC = use;
};
/**
* スタート地点設定
*/
itsmo.route.prototype.setStartPos = function(lat, lon, name) {
this.startPos = [lat, lon, name];
};
/**
* ゴール地点設定
*/
itsmo.route.prototype.setGoalPos = function(lat, lon, name) {
this.goalPos = [lat, lon, name];
};
/**
* 経由地点設定
*/
itsmo.route.prototype.addMidPos = function(lat, lon, name) {
this.midPos.push([lat, lon, name]);
};
/**
* 地点設定のクリア
*/
itsmo.route.prototype.clearPos = function() {
this.startPos = null;
this.goalPos = null;
this.midPos = [];
};
//------------------------------------------------
// myrouteいきなり表示
//------------------------------------------------
itsmo.myroute.routeTop = function(mode, forceChange) {
if(forceChange){
if(mode == 'car' && (itsmo.vars.g_myroute_mode == 'car' || itsmo.vars.g_myroute_mode == 'result_car')){
return false;
}
if(mode == 'all' && (itsmo.vars.g_myroute_mode == 'all' || itsmo.vars.g_myroute_mode == 'result_all')){
return false;
}
itsmo.vars.g_route_tab_displayed = 0;
itsmo.vars.routeKeep = 1;
}
itsmo.sub.map_tab_change('route',['route',mode]);
return;
};
itsmo.myroute.myroute_open = function(id) {
itsmo.sub.map_tab_change('mypage', ['myroute', id]);
itsmo.lib.document_off('ajax_mypage_top');
itsmo.lib.document_on('ajax_mypage_myspot');
itsmo.myroute.myroute_listget(id);
return;
};
//------------------------------------------------
// 基本処理
//------------------------------------------------
// メニュートップ
itsmo.myroute.myroute_leftmenutop = function() {
itsmo.vars.g_myroute_cond = null;
itsmo.range.range_tipclear();
itsmo.myspot.myspot_clear();
itsmo.myroute.myroute_listreflesh();
};
//------------------------------------------------
// 表示
//------------------------------------------------
itsmo.vars.g_myroute_view_idx = 0;
itsmo.myroute.myroute_view = function(idx) {
itsmo.vars.g_myroute_view_idx = idx;
//ルートパネルリセット
// itsmo.myroute.onClickOpenBtn();
itsmo.myroute.myroute_panel_change('close');
itsmo.vars.g_myroute_panel_isvisible = 0
itsmo.myroute.routeTop(itsmo.vars.g_myroute_list[idx].mode);
// 検索パターン
switch(itsmo.vars.g_myroute_list[idx].mode) {
default:// モードが無い場合は車
case 'car':
itsmo.myroute.myroute_car();
itsmo.vars.g_myroute_configs.car['opt1'] = itsmo.vars.g_myroute_list[idx].cond_opt1;
itsmo.vars.g_myroute_configs.car['opt2'] = itsmo.vars.g_myroute_list[idx].cond_opt2;
itsmo.vars.g_myroute_configs.car['ton'] = itsmo.vars.g_myroute_list[idx].cond_ton;
itsmo.vars.g_myroute_configs.car['date'] = itsmo.vars.g_myroute_list[idx].cond_date;
itsmo.vars.g_myroute_configs.car['time'] = itsmo.vars.g_myroute_list[idx].cond_time;
itsmo.vars.g_myroute_configs.car['top'] = itsmo.vars.g_myroute_list[idx].cond_top;
itsmo.vars.g_myroute_configs.car['smart'] = itsmo.vars.g_myroute_list[idx].cond_smart;
if(itsmo.vars.g_myroute_configs.car['date'] == '' || itsmo.vars.g_myroute_configs.car['date'] == 0) {
var now = new Date();
now.setMinutes( now.getMinutes()+30 );
var today = now.getFullYear()*100000000 + (now.getMonth() + 1)*1000000 + now.getDate()*10000 + now.getHours()*100 + now.getMinutes();
itsmo.vars.g_myroute_configs.car['date'] = today.toString(10).substr(0, 8);
itsmo.vars.g_myroute_configs.car['time'] = today.toString(10).substr(8);
} else {
var cond_date = itsmo.vars.g_myroute_list[idx].cond_date;
var cond_time = itsmo.vars.g_myroute_list[idx].cond_time;
var mm = cond_date.substr(4, 2);
var dd = cond_date.substr(6, 2);
var hh = cond_time.substr(2, 2);
// 入力された時間が過去の場合は未来にする
var now = new Date();
var yy = now.getFullYear();
var now_mm = now.getMonth() + 1;
if (now_mm > mm) {
yy = now.getFullYear() + 1;
} else if (now_mm == mm) {
if (now.getDate() > dd) {
yy = now.getFullYear() + 1;
} else if (now.getDate() == dd) {
if (now.getHours() > hh) {
yy = now.getFullYear() + 1;
}
}
}
itsmo.vars.g_myroute_configs.car['date'] = yy + mm + dd; // 日付
itsmo.vars.g_myroute_configs.car['time'] = cond_time; // 時刻
}
break;
case 'all':
itsmo.myroute.myroute_all();
itsmo.vars.g_myroute_configs.all['date'] = itsmo.vars.g_myroute_list[idx].cond2_date;
itsmo.vars.g_myroute_configs.all['time'] = itsmo.vars.g_myroute_list[idx].cond2_time;
itsmo.vars.g_myroute_configs.all['top'] = itsmo.vars.g_myroute_list[idx].cond2_top;
itsmo.vars.g_myroute_configs.all['sort'] = itsmo.vars.g_myroute_list[idx].cond2_pri;
itsmo.vars.g_myroute_configs.all['exp'] = itsmo.vars.g_myroute_list[idx].cond2_exp;
itsmo.vars.g_myroute_configs.all['psc'] = itsmo.vars.g_myroute_list[idx].cond2_psc;
if(itsmo.vars.g_myroute_configs.all['date'] == '' || itsmo.vars.g_myroute_configs.all['date'] == 0) {
var now = new Date();
var today = now.getFullYear()*100000000 + (now.getMonth() + 1)*1000000 + now.getDate()*10000 + now.getHours()*100 + now.getMinutes();
itsmo.vars.g_myroute_configs.all['date'] = today.toString(10).substr(0, 8);
itsmo.vars.g_myroute_configs.all['time'] = today.toString(10).substr(8);
} else {
var cond2_date = itsmo.vars.g_myroute_list[idx].cond2_date;
var cond2_time = itsmo.vars.g_myroute_list[idx].cond2_time;
var mm = cond2_date.substr(4, 2);
var dd = cond2_date.substr(6, 2);
var hh = cond2_time.substr(2, 2);
// 入力された時間が過去の場合は未来にする
var now = new Date();
var yy = now.getFullYear();
var now_mm = now.getMonth() + 1;
if (now_mm > mm) {
yy = now.getFullYear() + 1;
} else if (now_mm == mm) {
if (now.getDate() > dd) {
yy = now.getFullYear() + 1;
} else if (now.getDate() == dd) {
if (now.getHours() > hh) {
yy = now.getFullYear() + 1;
}
}
}
itsmo.vars.g_myroute_configs.all['date'] = yy + mm + dd; // 日付
itsmo.vars.g_myroute_configs.all['time'] = cond2_time; // 時刻
}
break;
}
itsmo.myroute.myroute_view_setpoints();
itsmo.myroute.myroute_move();
};
itsmo.myroute.myroute_move = function() {
// 地図の移動
var latlons = [];
for(var i = 0;i < itsmo.vars.g_myroute_stops.length;i ++) {
if(!itsmo.vars.g_myroute_stops[i]) {
continue;
}
latlons.push(itsmo.lib.toLatLon(itsmo.vars.g_myroute_stops[i].lat, itsmo.vars.g_myroute_stops[i].lon));
}
var sc = itsmo.vars.g_map_obj.getAdjustZoom(latlons);
itsmo.vars.g_map_obj.moveLatLon(sc.latlon);
itsmo.vars.g_map_obj.setZoom(sc.zoom);
};
itsmo.myroute.myroute_view_setpoints = function() {
// 地点を設定
//itsmo.myroute.myroute_panel_change('point');
itsmo.vars.g_myroute_stops = [];
var obj = itsmo.vars.g_myroute_list[itsmo.vars.g_myroute_view_idx];
var cnt = obj.stops.length - 1;
for(var i = 0;i < cnt;i ++) {
itsmo.vars.g_myroute_stops[i] = { lat: obj.stops[i].point.lat, lon: obj.stops[i].point.lon};
itsmo.vars.g_myroute_stops[i].title = obj.stops[i].title;
itsmo.myroute.RoutePointRemainder('add');
}
if (cnt < 0) cnt = 0;
itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num-1] = { lat: obj.stops[ cnt ].point.lat, lon: obj.stops[ cnt ].point.lon };
itsmo.vars.g_myroute_stops[itsmo.vars.g_myroute_stop_num-1].title = obj.stops[ cnt ].title;
itsmo.myroute.RoutePointRemainder('add');
// ルートを引く
itsmo.myroute.myroute_panel_setmode(2);
itsmo.vars.g_myroute_first = 0;
if((obj.mode == 'car' && itsmo.vars.g_myroute_car_stops == obj.stops.length) || obj.mode == 'all'){//すでに地点を追加できないならイベント追加しない
itsmo.myroute.myroute_panel_list();
}else{
itsmo.myroute.myroute_panel_list(1);
}
//itsmo.myroute.myroute_panel_submit();
};
//------------------------------------------------
// 一覧取得
//------------------------------------------------
itsmo.myroute.myroute_listget = function(id, rows) {
var prm = 'mode=myroute_list&page='+itsmo.vars.g_myroute_list_page;
if(id) prm += '&id=' + id;
if(rows) prm += '&rows=' + rows;
if(itsmo.vars.g_myroute_cond != null) prm += '&cond=' + itsmo.vars.g_myroute_cond;
// 処理中画像表示
itsmo.lib.document_off('ajax_leftmenu');
itsmo.lib.document_on('ajax_leftmenu_wait');
// itsmo.lib.map_waitopen();
itsmo.lib.XMLHttpRequest2_send('/map/ajax_myroute.php',itsmo.myroute.myroute_listget_result,'GET',prm);
};
itsmo.myroute.myroute_listget_result = function(result) {
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if (err == 99) {
top.location.href = 'https://' + itsmo.vars.d_host_www + '/map/mypage/';
return;
} else if (err != 0) {
// 処理中画像非表示
itsmo.lib.document_on('ajax_leftmenu');
itsmo.lib.document_off('ajax_leftmenu_wait');
// itsmo.lib.map_waitclose();
// エラー表示
itsmo.lib.aplErrorWindow('W', '0003', 'myroute', '登録ルート');
return;
}
// ルート情報作成
itsmo.vars.g_myroute_list = [];
var i = 0;
$(result).find('list').each(function()
{
// 基本情報
itsmo.vars.g_myroute_list[i] = function(){};
itsmo.vars.g_myroute_list[i].id = $(this).find('id').text();
itsmo.vars.g_myroute_list[i].rtitle = $(this).find('title').text();
itsmo.vars.g_myroute_list[i].mode = $(this).find('mode').text();
itsmo.vars.g_myroute_list[i].cond_opt1 = $(this).find('cond_opt1').text();
itsmo.vars.g_myroute_list[i].cond_opt2 = $(this).find('cond_opt2').text();
itsmo.vars.g_myroute_list[i].cond_smart = $(this).find('cond_smart').text();
itsmo.vars.g_myroute_list[i].cond_ton = $(this).find('cond_ton').text();
itsmo.vars.g_myroute_list[i].cond_date = $(this).find('cond_date').text();
itsmo.vars.g_myroute_list[i].cond_time = $(this).find('cond_time').text();
itsmo.vars.g_myroute_list[i].cond_top = $(this).find('cond_top').text();
itsmo.vars.g_myroute_list[i].cond2_date = $(this).find('cond2_date').text();
itsmo.vars.g_myroute_list[i].cond2_time = $(this).find('cond2_time').text();
itsmo.vars.g_myroute_list[i].cond2_top = $(this).find('cond2_top').text();
itsmo.vars.g_myroute_list[i].cond2_pri = $(this).find('cond2_pri').text();
itsmo.vars.g_myroute_list[i].cond2_exp = $(this).find('cond2_exp').text();
itsmo.vars.g_myroute_list[i].cond2_psc = $(this).find('cond2_psc').text();
itsmo.vars.g_myroute_list[i].comment = $(this).find('comment').text();
// 地点
itsmo.vars.g_myroute_list[i].stops = [];
j = 0;
$(this).find('point').each(function()
{
if($(this).find('title').length >= 1) {
itsmo.vars.g_myroute_list[i].stops[j] = function(){};
itsmo.vars.g_myroute_list[i].stops[j].title = $(this).find('title').text();
itsmo.vars.g_myroute_list[i].stops[j].point = { lat: $(this).find('lat').text(), lon: $(this).find('lon').text() };
}
j++;
});
// リスト作成
i++;
});
itsmo.sub.map_tab_sethtml($(result).find('listhtml').text());
// 指定idを開く処理
var openid = $(result).find('openid').text();
if(openid != '') {
itsmo.myroute.myroute_view(openid);
}
// 処理中画像非表示
itsmo.lib.document_on('ajax_leftmenu');
itsmo.lib.document_off('ajax_leftmenu_wait');
// itsmo.lib.map_waitclose();
};
// 読み込みなおし
itsmo.myroute.myroute_listreflesh = function() {
itsmo.vars.g_myroute_list_page = 0;
itsmo.myroute.myroute_listget();
};
// ページ遷移
itsmo.myroute.myroute_listpage = function(page, rows) {
itsmo.vars.g_myroute_list_page = page;
if (null == rows) {
rows = itsmo.vars.g_myroute_rows;
} else {
itsmo.vars.g_myroute_rows = rows;
}
itsmo.myroute.myroute_listget(null, rows);
};
//--------------------------------------------------------------------------------------------------
// 保存
//--------------------------------------------------------------------------------------------------
itsmo.myroute.myroute_panel_add = function() {
//var title = "";
//if(itsmo.vars.g_myroute_routetitle != null) title = itsmo.vars.g_myroute_routetitle;
//itsmo.vars.g_document.getElementById('ajax_myroute_add_title').value = title;
itsmo.lib.document_setvalue('ajax_myroute_add_title','');
itsmo.lib.map_windowopen('ajax_myroute_add');
};
// 保存
itsmo.myroute.myroute_add_submit = function() {
if(itsmo.myroute.myroute_add_submit_check()) return;
itsmo.vars.g_myroute_routetitle = itsmo.lib.document_getvalue('ajax_myroute_add_title');
// 基本情報
var prm = 'mode=myroute_add';
prm += '&title='+encodeURIComponent(itsmo.vars.g_myroute_routetitle);
prm += '&other='+itsmo.vars.g_myroute_mode+":";
switch(itsmo.vars.g_myroute_mode) {
case 'car':
if (itsmo.vars.g_myroute_configs.car['date'] == '0') {
var now = new Date();
var today = now.getFullYear()*100000000 + (now.getMonth() + 1)*1000000 + now.getDate()*10000 + now.getHours()*100 + now.getMinutes();
itsmo.vars.g_myroute_configs.car['date'] = today.toString(10).substr(0, 8);
itsmo.vars.g_myroute_configs.car['time'] = today.toString(10).substr(8);
}
prm += itsmo.vars.g_myroute_configs.car['opt1'] +":"+ itsmo.vars.g_myroute_configs.car['opt2'] +":"+ itsmo.vars.g_myroute_configs.car['ton'];
prm += ":"+ itsmo.vars.g_myroute_configs.car['date'] + itsmo.vars.g_myroute_configs.car['time'];
prm += ":"+ itsmo.vars.g_myroute_configs.car['smart'] +":"+itsmo.vars.g_myroute_configs.car['top'];
break;
case 'all':
prm += itsmo.vars.g_myroute_configs.all['date'] + itsmo.vars.g_myroute_configs.all['time'];
prm += ":"+ itsmo.vars.g_myroute_configs.all['top'] +":"+ itsmo.vars.g_myroute_configs.all['sort'];
prm += ":0:" + itsmo.vars.g_myroute_configs.all['exp'] +":0"; // chg,exf 未使用のためデフォ:0
prm += ":"+ itsmo.vars.g_myroute_configs.all['psc'];
break;
}
// 地点
var prm2 = ""
for(var i = 0;i < itsmo.vars.g_myroute_stop_num;i ++) {
if(prm2) prm2 += ":";
if(itsmo.vars.g_myroute_stops[i] != null) {
prm2 += encodeURIComponent(itsmo.vars.g_myroute_stops[i].title)+','+itsmo.vars.g_myroute_stops[i].lat+','+itsmo.vars.g_myroute_stops[i].lon+','+itsmo.vars.g_myroute_stops[i].id;
} else {
prm2 += ',,,';
}
}
prm += '&prms='+prm2;
// 処理中
itsmo.lib.map_windowclose();
itsmo.lib.XMLHttpRequest2_send_wait('/map/ajax_myroute.php',itsmo.myroute.myroute_add_submit_result,'GET',prm,'ルート保存中');
};
// 入力チェック
itsmo.myroute.myroute_add_submit_check = function() {
var title = itsmo.lib.document_getvalue('ajax_myroute_add_title');
title = title.replace(/^[\s ]+|[\s ]+$/g, "");
if(title.length < 2 || title.length > 12) {
alert("タイトルは2~12文字で入力して下さい");
return true;
}
return false;
};
// 結果処理
itsmo.myroute.myroute_add_submit_result = function(result) {
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if (err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'myroute');
} else {
itsmo.lib.aplErrorWindow('W', '0004', 'myroute', '登録ルート');
}
return;
}
// 確認ウィンドウ
itsmo.lib.aplErrorWindow('I', '0001', 'myroute', '登録ルート', 'routeadd');
// 正常処理
itsmo.myroute.myroute_leftmenutop();
};
//--------------------------------------------------------------------------------------------------
// 削除
//--------------------------------------------------------------------------------------------------
itsmo.vars.g_myroute_del = null;
itsmo.myroute.myroute_del = function() {
// 削除対象チェック
var cnt = itsmo.lib.getCheckNum('ajax_myroute_list_chk');
if (cnt == false) {
itsmo.lib.aplErrorWindow('E', '0006', 'myroute', '登録ルート');
return;
}
itsmo.vars.g_myroute_del = cnt.join(',');
itsmo.lib.map_confirm('登録ルートの削除','選択した登録ルートを削除いたします。
よろしいですか?'
,itsmo.myroute.myroute_del_submit);
};
itsmo.myroute.myroute_del_submit = function() {
if(itsmo.vars.g_map_confirm_yes == 0) return;
// 実行
var prm = 'mode=myroute_del';
prm += '&id=' + itsmo.vars.g_myroute_del;
itsmo.lib.XMLHttpRequest2_send_wait('/map/ajax_myroute.php',itsmo.myroute.myroute_del_result,'GET',prm,'削除中');
};
itsmo.myroute.myroute_del_result = function(result) {
// エラーチェック
var err = parseInt($(result).find('err').text(), 10);
if(err != 0) {
if (err == 99) {
itsmo.lib.aplErrorWindow('W', '0008', 'myroute');
} else {
itsmo.lib.aplErrorWindow('W', '0004', 'myroute', '登録ルート');
}
return;
}
// 確認ウィンドウ
itsmo.lib.aplErrorWindow('I', '0002', 'myroute', '登録ルート', 'routedel');
// 正常処理
itsmo.myroute.myroute_listreflesh(); // 一覧更新
};
//--------------------------------------------------------------------------------------------------
// 地図設定関数
//
// 開発履歴
// 2009/09/28 tsano 新規開発
// 2009/12/16 tsano 2nd 用に改修
//--------------------------------------------------------------------------------------------------
itsmo.config = {};
itsmo.config.MapEasyConfig = function() {
this.loadConfig();
// ドラッグ時動作用のイベント登録。
/*
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_MOUSEDOWN, itsmo.config.configDragStart);
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_MOUSEUP, itsmo.config.configDragEnd);
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_MOUSEMOVE, itsmo.config.configDragMove);
*/
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_RIGHTCLICK, itsmo.vars.g_config_dblclick_right);
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_SCROLL_END, itsmo.vars.dblclickZoomInScrollMapEnd);
// jQueryUI でウィンドウのドラッグ移動を実験。
//$('#ajax_config_window').draggable();
};
itsmo.config.MapEasyConfig.prototype.getCookie = function(key, defaultVal) {
var s = itsmo.lib.cookie_get(key);
if ('' == s) {
return defaultVal;
}
return s;
};
//初期処理
itsmo.config.MapEasyConfig.prototype.init = function () {
/*
//オーバーライド(itsmo.vars.g_config.mapinfoを見るようにした)
itsmo.vars.g_map_layer_clickable.visibleZdcTooltipById=function(id){
if(this.tooltips[id]){
this.tooltips[id].doc.style.width=this.tooltips[id].firstwidth;
this.tooltips[id].doc.style.height=this.tooltips[id].firstheight;
this.tooltips[id].doc.style.display="block";
}
};
*/
this.loadConfig();
this.setToMap();
this.setToWindow();
};
// Cookie から設定値を取得。
itsmo.config.MapEasyConfig.prototype.loadConfig = function() {
var s = this.getCookie('config_wheeltype', '1');
this.wheeltype = parseInt(s);
s = this.getCookie('config_dblclick', '0');
this.dblclick = parseInt(s);
//s = this.getCookie('config_mappanel', '1');
s = '1';
this.mappanel = parseInt(s);
// s = this.getCookie('config_recommend', '1');
// this.maprecommend = parseInt(s);
s = this.getCookie('config_centerfirst', '1');
this.centerfirst = parseInt(s);
s = this.getCookie('config_mapinfo_minimize', '0');
this.mapinfo_minimize = parseInt(s);
if(0 != this.mapinfo_minimize){
$('#config_mapinfo_minimize').val(1);
$(".map_header1 #balloon-size #small-icon").removeClass('off');
$(".map_header1 #balloon-size #large-icon").addClass('off');
} else {
$('#config_mapinfo_minimize').val(0);
$(".map_header1 #balloon-size #small-icon").addClass('off');
$(".map_header1 #balloon-size #large-icon").removeClass('off');
}
s = this.getCookie('config_speedmode', '1');
this.speedmode = parseInt(s);
};
// Cookie へ設定値をセット。
itsmo.config.MapEasyConfig.prototype.saveConfig = function() {
itsmo.lib.cookie_set('config_wheeltype', '' + this.wheeltype);
//itsmo.lib.cookie_set('config_drag', '' + this.drag);
itsmo.lib.cookie_set('config_centerfirst', '' + this.centerfirst);
itsmo.lib.cookie_set('config_dblclick', '' + this.dblclick);
itsmo.lib.cookie_set('config_mappanel', '' + this.mappanel);
// itsmo.lib.cookie_set('config_recommend', '' + this.maprecommend);
itsmo.lib.cookie_set('config_mapinfo_minimize', '' + this.mapinfo_minimize);
//itsmo.lib.cookie_set('config_rightclickmenu', this.rightclickmenu);
itsmo.lib.cookie_set('config_speedmode', '' + this.speedmode);
};
// ホイール時の拡大縮小を逆転させる。
itsmo.config.MapEasyConfig.prototype.setWheelType = function(n) {
n = parseInt(n);
if (0 != n) {
n = 1;
}
this.wheeltype = n;
};
// ホイール動作の設定。
itsmo.config.MapEasyConfig.prototype.setWheelTypeToMap = function() {
// 画面変更。
$('#userzoomcontrol').unwrap();
itsmo.vars.g_map_obj.setWheelType(this.wheeltype == 0 ? 1 : 2);
itsmo.vars.g_map_obj.removeUserZoomControl();
if (0 == this.wheeltype) {
$('#userzoomcontrol').wrap('');
} else {
$('#userzoomcontrol').wrap('');
}
};
// ホイール時の拡大中心部の動作変更。
itsmo.config.MapEasyConfig.prototype.setCenterFirst = function(n) {
n = parseInt(n);
if (0 != n) {
n = 1;
}
this.centerfirst = n;
};
itsmo.vars.g_config_dblclick_zoomin = function() {
// ダブルクリックで拡大。
itsmo.vars.g_map_obj.moveLatLon(itsmo.vars.g_map_obj.getClickLatLon());
itsmo.vars.g_map_obj.zoomIn();
};
itsmo.vars.g_config_dblclick_right_count = 0; // 右クリック回数
itsmo.vars.g_config_dblclick_right_timer = null; // 右ダブルクリック判定用タイムアウト。
itsmo.vars.g_config_dblclick_right_data = {};
itsmo.vars.g_config_dblclick_right = function() {
// 右クリックされた。
++itsmo.vars.g_config_dblclick_right_count;
if (null == itsmo.vars.g_config_dblclick_right_timer) {
itsmo.vars.g_config_dblclick_right_timer = setTimeout(itsmo.vars.g_config_dblclick_right_timerfunc, 300);
}
};
// 右ダブルクリック判定用のタイムアウト関数。
itsmo.vars.g_config_dblclick_right_timerfunc = function() {
itsmo.vars.g_config_dblclick_right_timer = null;
var n = itsmo.vars.g_config_dblclick_right_count;
itsmo.vars.g_config_dblclick_right_count = 0;
if (n <= 1 || !itsmo.vars.g_config.isDblClickNoMove()) {
// 右シングルクリック。メニュー表示。
itsmo.vars.g_config.configShowRightClickMenu();
} else {
// 右ダブルクリックで縮小。
if (itsmo.vars.g_config.dblclick != 0) {
itsmo.vars.g_map_obj.moveLatLon(itsmo.vars.g_map_obj.getPointerPosition());
itsmo.vars.g_map_obj.zoomOut();
}
}
};
// ダブルクリック時の動作変更。
itsmo.config.MapEasyConfig.prototype.setDblClick = function(n) {
n = parseInt(n);
if (0 != n) {
n = 1;
}
this.dblclick = n;
};
// ダブルクリック時の動作をセットする。
itsmo.config.MapEasyConfig.prototype.setDblClickToMap = function() {
ZDC.clearListeners(itsmo.vars.g_map_obj, ZDC.MAP_DBLCLICK);
ZDC.clearListeners(itsmo.vars.g_map_obj, ZDC.MAP_CLICK);
if (0 == this.dblclick) {
// シングルクリックで移動。
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CLICK, itsmo.map.map_clickmap);
} else {
// ダブルクリックの左で拡大、右で縮小。
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_DBLCLICK, itsmo.vars.g_config_dblclick_zoomin);
//ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CLICK, itsmo.map.map_clickmap);
}
if(itsmo.vars.premiumMap != null && typeof (itsmo.vars.premiumMap.reAddListener) == 'function'){
itsmo.vars.premiumMap.reAddListener();
}
};
// ダブルクリック時拡大縮小モードか?
itsmo.config.MapEasyConfig.prototype.isDblClickNoMove = function(n) {
return 0 != this.dblclick;
};
//地図の施設情報(ツールチップ)表示の動作設定
itsmo.config.MapEasyConfig.prototype.setMapInfoToMap = function () {
itsmo.map.showMapTooltip();
};
// 地図の施設情報(ツールチップ)小さくする動作変更
itsmo.config.MapEasyConfig.prototype.setMapInfoMinimize = function(n) {
n = parseInt(n);
if (0 != n) {
n = 1;
}
this.mapinfo_minimize = n;
};
//地図の施設情報(ツールチップ)の大小を変更
itsmo.config.MapEasyConfig.prototype.setMapInfoMinimizeToMap = function () {
var flg = this.mapinfo_minimize;
/*
if(flg == 0){
$('.f-supper0').attr('class','fukidasi0');
}else{
$('.fukidasi0').attr('class','f-supper0');
}
*/
itsmo.sub.set_tooltip_s.setHtmlAll();
};
//地図のお勧め情報表示の動作設定
//itsmo.config.MapEasyConfig.prototype.setMapRecommendToMap = function () {
//
// var flg = this.maprecommend;
// if(flg == 0){
// $("div[id^='tip_c_osusume_']").hide();
// $("div[id^='tip_o_osusume_']").hide();
// //itsmo.map.hideMapTooltip();
// //}else{
// //itsmo.map.showMapTooltip();
// }
//};
// 地図のお勧め情報表示の動作変更。(初回読込時吹き出し有無)
//itsmo.config.MapEasyConfig.prototype.setMapRecommend = function(n) {
// n = parseInt(n);
// if (0 != n) {
// n = 1;
// }
// this.maprecommend = n;
//
//};
// 地図のパネル表示の動作変更。
itsmo.config.MapEasyConfig.prototype.setMapPanel = function(n) {
n = parseInt(n);
if (0 != n) {
n = 1;
}
this.mappanel = n;
};
itsmo.config.MapEasyConfig.prototype.configShowRightClickMenu = function() {
//var html = $('#right_click_div).html();
itsmo.map.closeUserMsgWindow();
//住所取得
prm = itsmo.vars.g_map_obj.getPointerPosition();
if(itsmo.config._request != null) {
itsmo.lib.XMLHttpRequest2_abort(itsmo.config._request);
}
itsmo.config._request = itsmo.lib.XMLHttpRequest2_send('/map/right_click.php',
function (result) {
if(result.err){return false;}
var addr = result[0].address.text;
var zip = result[0].zipcode;
var point = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getPointerPosition());
var lat = itsmo.vars.g_config_dblclick_right_data['lat'] = point.lat;
var lon = itsmo.vars.g_config_dblclick_right_data['lon'] = point.lon;
itsmo.vars.g_config_dblclick_right_data['addr'] = addr;
$('#right_click_zipcode').text('〒' + zip);
$('#right_click_addrnm').text(addr);
var domEl = $('#right_click_div').html();
itsmo.map.openUserMsgWindow(point, domEl);
itsmo.config._request = null;
}, 'GET', prm, 'json');
};
itsmo.config.getHM = function(n) {
var lat = itsmo.vars.g_config_dblclick_right_data['lat'];
var lon = itsmo.vars.g_config_dblclick_right_data['lon'];
open("https://biz.its-mo.com/biz/map/fullscreen/?lat="+lat+"&lon="+lon, "_blank" ) ;
};
itsmo.config.configShowRightClickMenuDecide = function(id){
itsmo.map.closeUserMsgWindow();
if(!itsmo.vars.g_config_dblclick_right_data){return false;}
var lat = itsmo.vars.g_config_dblclick_right_data['lat'];
var lon = itsmo.vars.g_config_dblclick_right_data['lon'];
var addr = itsmo.vars.g_config_dblclick_right_data['addr'];
var latlon = {lat: lat, lon: lon};
switch(id){
case 0:
itsmo.myroute.hereStart(addr, latlon);
break;
case 1://ココから出発
itsmo.myroute.hereGo(addr, latlon);
break;
case 2://ココへ行く
itsmo.myroute.hereByway(addr, latlon);
break;
case 3://携帯へ
itsmo.map.Sharing.getInstance().show(lat,lon,'',addr);
break;
case 4://登録
itsmo.myspot.other_addmyspot(lat,lon,addr,'','','','','','ADDR','','',true);
break;
case 5://自宅設定
itsmo.mypage.mypage('home_add', {lat: lat, lon: lon});
break;
case 6://住宅地図へ遷移
//itsmo.sub.residential_map_printopen();
var url = 'https://biz.its-mo.com/biz/map/fullscreen/?';
url += 'lat='+lat+'&lon='+lon+'&size=A3&color=CD&pageDirection=VT©able=DA&lvl=15';
window.open(url, '_blank');
break;
}
itsmo.vars.g_config_dblclick_right_data = {};
};
// 動作の速度モード変更。
itsmo.config.MapEasyConfig.prototype.setSpeedMode = function(n) {
n = parseInt(n);
switch (n) {
case 0:
case 1:
case 2:
break;
default:
n = 0;
break;
}
this.speedmode = n;
};
// ドラッグ時の動作変更。
itsmo.config.MapEasyConfig.prototype.setDrag = function(n) {
n = parseInt(n);
if (0 != n) {
n = 1;
}
var chg = this.drag != n;
this.drag = n;
if (!chg) {
return;
}
};
itsmo.config.MapEasyConfig.prototype.getChecked = function(id) {
var e = $(id);
return this.isElementChecked(e);
};
itsmo.config.MapEasyConfig.prototype.isElementChecked = function(e) {
if (null == e) {
return false;
}
return (e.className == 'check-on');
};
itsmo.config.MapEasyConfig.prototype.getCheckBoxes = function(nameStr, prefix) {
var es = $("[name="+ nameStr +"]");
var cnt = 0, n = [];
for (var i = 0; i < es.length; ++i) {
var es2 = es[i].childNodes;
for (var j = 0; j < es2.length; ++j) {
var e = es2[j];
if (!('id' in e)) {
continue;
}
if (null == e.id || e.id.indexOf(prefix) != 0) {
continue;
}
n.push(e);
}
}
return n;
};
itsmo.config.MapEasyConfig.prototype.getRightClickMenuValue = function() {
var prefix = 'config_rightclickmenu_';
var es = this.getCheckBoxes('config_rightclickmenu', prefix);
var cnt = 0, n = [];
for (var i = 0; i < es.length; ++i) {
var e = es[i];
if (this.isElementChecked(e)) {
++cnt;
n.push(e.id.substring(prefix.length));
}
}
n = n.join(',');
this.setRightClickMenu(n);
};
itsmo.config.MapEasyConfig.prototype.getCenterFirstValue = function() {
var prefix = 'config_centerfirst_';
var es = this.getCheckBoxes('config_centerfirst', prefix);
var n = -1;
for (var i = 0; i < es.length; ++i) {
var e = es[i];
if (this.isElementChecked(e)) {
n = parseInt(e.id.substring(prefix.length));
break;
}
}
if (n >= 0) {
this.setCenterFirst(n);
}
};
itsmo.config.MapEasyConfig.prototype.getDblClickValue = function() {
var es = $("input[name=config_dblclick]");
var n = -1;
for (var i = 0; i < es.length; ++i) {
e = es[i];
if (e.checked) {
n = parseInt(e.id.substring(e.name.length + 1));
break;
}
}
if (n >= 0) {
this.setDblClick(n);
}
};
itsmo.config.MapEasyConfig.prototype.getSpeedModeValue = function() {
var es = $("input[name=config_speedmode]");
var n = -1;
for (var i = 0; i < es.length; ++i) {
e = es[i];
if (e.checked) {
n = parseInt(e.id.substr(e.name.length + 1));
break;
}
}
if (n >= 0) {
this.setSpeedMode(n);
}
};
itsmo.config.MapEasyConfig.prototype.getDragValue = function() {
var es = $("input[name=config_drag]");
var n = -1;
for (var i = 0; i < es.length; ++i) {
e = es[i];
if (e.checked) {
n = parseInt(e.id.substr(e.name.length + 1));
break;
}
}
if (n >= 0) {
this.setDrag(n);
}
};
itsmo.config.MapEasyConfig.prototype.getFromWindow = function() {
this.getDblClickValue();
this.getSpeedModeValue();
var checked = $('#config_wheeltype').is(':checked');
this.setWheelType(checked ? 0 : 1);
var checked = $('#config_mappanel').is(':checked');
this.setMapPanel(checked ? 1 : 0);
// var checked = $('#config_recommend').is(':checked');
// this.setMapRecommend(checked ? 1 : 0);
var checked = $('#config_centerfirst').is(':checked');
this.setCenterFirst(checked ? 0 : 1);
this.setMapInfoMinimize($('#config_mapinfo_minimize').val());
};
itsmo.config.MapEasyConfig.prototype.setToWindow = function() {
/*
var prefix = 'config_rightclickmenu_';
var es = this.getCheckBoxes('config_rightclickmenu', prefix);
if(this.rightclickmenu != ""){
var n = this.rightclickmenu.split(',');
for (var i = 0; i < es.length; ++i) {
e = es[i];
var j = e.id.substring(prefix.length);
itsmo.config.configSetCheckBox(e, n.indexOf(j) >= 0);
}
}
e = $('#config_drag_' + this.drag)[0];
if (null == e) {
e = $('#config_drag_0')[0];
}
e.checked = true;
e = itsmo.vars.g_document.getElementById('config_centerfirst_' + this.centerfirst);
if (null == e) {
e = itsmo.vars.g_document.getElementById('config_centerfirst_0');
}
e.checked = true;
*/
e = $('#config_dblclick_' + this.dblclick)[0];
if (null == e) {
e = $('#config_dblclick_0')[0];
}
e.checked = true;
if(itsmo.vars.g_range_cnt == 30){
this.speedmode = 1;
}else if(itsmo.vars.g_range_cnt == 50){
this.speedmode = 2;
}else{
this.speedmode = 0;
}
e = $('#config_speedmode_' + this.speedmode)[0];
if (null == e) {
e = $('#config_speedmode_1')[0];
}
e.checked = true;
if(this.wheeltype == 0){
$('#config_wheeltype').attr('checked', 'checked');
}else{
$('#config_wheeltype').attr('checked', false);
}
/*
if(this.mappanel != 0){
$('#config_mappanel').attr('checked', 'checked');
}else{
$('#config_mappanel').attr('checked', false);
}
*/
// if(this.maprecommend != 0){
// $('#config_recommend').attr('checked', 'checked');
// }else{
// $('#config_recommend').attr('checked', false);
// }
if(this.centerfirst != 1){
$('#config_centerfirst').attr('checked', 'checked');
}else{
$('#config_centerfirst').attr('checked', false);
}
// if(this.mapinfo_minimize != 0){
// $('#config_mapinfo_minimize').attr('checked', 'checked');
// }else{
// $('#config_mapinfo_minimize').attr('checked', false);
// }
};
itsmo.config.MapEasyConfig.prototype.setToMap = function() {
// TODO //////////////////////////////
/*
if (0 == this.drag) {
itsmo.vars.g_map_obj.dragOn();
} else {
itsmo.vars.g_map_obj.dragOff();
}
*/
//this.setWheelTypeToMap();
//itsmo.vars.g_map_obj.CenterFirst = this.centerfirst;
this.setDblClickToMap();
if (0 == this.mapcenter) {
// 非表示
itsmo.vars.g_map_center_icon.hidden();
} else {
// 表示
itsmo.vars.g_map_center_icon.visible();
}
this.setMapInfoToMap();
this.setMapInfoMinimizeToMap();
// this.setMapRecommendToMap();
switch (this.speedmode){
case 0:
itsmo.vars.g_range_cnt = 10;
itsmo.vars.g_range_flag_rowcnt = 10;
break;
case 2:
itsmo.vars.g_range_cnt = 50;
itsmo.vars.g_range_flag_rowcnt = 50;
break;
case 1:
default :
itsmo.vars.g_range_cnt = 30;
itsmo.vars.g_range_flag_rowcnt = 30;
break;
}
// if (0 == this.mappanel) {
// $('#map-btn').hide();
// } else {
$('#map-btn').show();
// }
};
//地図の表示情報パネル設定(中心点)
itsmo.config.MapEasyConfig.prototype.configSetPanelMapCenter = function () {
var e = $('#ajax_config_mapcenter span')[0];
if(e.className == "check-on"){//非表示
itsmo.vars.g_map_center_icon.visible();
this.mapcenter = 1;
if (null != itsmo.vars.g_map_setcursor_id) {
itsmo.vars.g_map_obj.visibleZdcTooltipById(itsmo.vars.g_map_setcursor_id);
}
}else if(e.className == "check-off"){//表示
itsmo.vars.g_map_center_icon.hidden();
this.mapcenter = 0;
if (null != itsmo.vars.g_map_setcursor_id) {
itsmo.vars.g_map_obj.hiddenZdcTooltipById(itsmo.vars.g_map_setcursor_id);
}
}
itsmo.lib.cookie_set('config_mapcenter','' + this.mapcenter);
};
itsmo.vars.g_config_drag_start_xy = null; // ドラッグ開始位置(座標)
itsmo.vars.g_config_drag_add = [0, 0]; // マウス追従時の加算値
itsmo.vars.g_config_drag_timer = null; // マウス追従時のタイマー
// ドラッグ動作:追従時のドラッグ開始。
itsmo.config.configDragStart = function() {
itsmo.vars.g_config_drag_start_xy = new ZDC.Pixel(itsmo.vars.g_map_obj.MouseMoveX, itsmo.vars.g_map_obj.MouseMoveY);
};
// ドラッグ動作:追従時のドラッグ移動。
itsmo.config.configDragMove = function() {
if (null == itsmo.vars.g_config_drag_start_xy) {
return;
}
// マウスの移動量を計算。
var x = itsmo.vars.g_map_obj.MouseMoveX - itsmo.vars.g_config_drag_start_xy.x;
var y = itsmo.vars.g_map_obj.MouseMoveY - itsmo.vars.g_config_drag_start_xy.y;
var nomove = 5;
if (Math.abs(x) < nomove && Math.abs(y) < nomove) {
// 少し動かした位では移動させない。
itsmo.vars.g_config_drag_add[0] = itsmo.vars.g_config_drag_add[1] = 0;
return;
}
// 以下のピクセルまでの移動速度に制限する。
var maxmove = 64;
if (x < 0) {
x = Math.max(x, -maxmove);
} else {
x = Math.min(x, maxmove);
}
if (y < 0) {
y = Math.max(y, -maxmove);
} else {
y = Math.min(y, maxmove);
}
itsmo.vars.g_config_drag_add[0] = x;
itsmo.vars.g_config_drag_add[1] = y;
if (null == itsmo.vars.g_config_drag_timer) {
// タイマの呼び出し間隔。
var config_drag_timeout = 10;
itsmo.vars.g_config_drag_timer = setInterval(itsmo.config.configDragTimer, config_drag_timeout);
}
};
// ドラッグ動作:追従時のタイマ関数
itsmo.config.configDragTimer = function() {
if (null == itsmo.vars.g_config_drag_timer) {
return;
}
if (0 == itsmo.vars.g_config_drag_add[0] && 0 == itsmo.vars.g_config_drag_add[1]) {
return;
}
itsmo.vars.g_map_obj.movePx(itsmo.vars.g_config_drag_add[0], itsmo.vars.g_config_drag_add[1]);
};
// ドラッグ動作:追従時のドラッグ終了。
itsmo.config.configDragEnd = function() {
if (null != itsmo.vars.g_config_drag_timer) {
clearInterval(itsmo.vars.g_config_drag_timer);
}
itsmo.vars.g_config_drag_start_xy = itsmo.vars.g_config_drag_timer = null;
};
// 簡易設定値。
itsmo.vars.g_config = null;
itsmo.config.configSetCheckBox = function(chkBox, isOn) {
if(isOn){chkBox.attr('class','check-on');}else{chkBox.attr('class','check-off');}
};
itsmo.config.configCheckBox = function(id) {
var chkBox = $('#'+ id + ' span');
var clsName = chkBox.attr('class');
if(clsName == 'check-off'){
itsmo.config.configSetCheckBox(chkBox, true);
}else{
itsmo.config.configSetCheckBox(chkBox, false);
}
};
// コンフィグ画面を表示。
itsmo.config.configShowWindow = function() {
itsmo.vars.g_screen_non = 0;
itsmo.vars.g_config.setToWindow();
itsmo.lib.map_windowopen('ajax_config_window');
};
itsmo.config.configSubmit = function() {
itsmo.vars.g_config.getFromWindow();
itsmo.vars.g_config.saveConfig();
itsmo.vars.g_config.setToMap();
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowclose('ajax_config_window');
return false;
};
itsmo.config.configCancel = function() {
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowclose('ajax_config_window');
return false;
};
///////
// 渋滞統計表示。
itsmo.vars.g_route_vics = null;
var RouteVics = function() {
// init.
this.init();
}
RouteVics.prototype.init = function() {
// カレンダー表示用の日付。
this.showday = new Date();
// VICS を表示する日時。
this.vicsday = new Date();
// VICS は 15 分単位。
this.vicsday.setMinutes(this.vicsday.getMinutes() - (this.vicsday.getMinutes() % 15));
this.setCalendar();
// VICS ウィンドウ表示状態。
this.isVisible = false;
this.show_mode = 'nomal';
// 道路選択状況。
this.isHighway = true;
this.isLocal = true;
// スライダ。
$('#ajax_normalroute_panel_vics div.traffic-time-tumami').draggable({
stop: function(ev, ui) { itsmo.vars.g_route_vics.showLayer(); },
drag: function(ev, ui) { itsmo.vars.g_route_vics.dragTimeTsumami(ev, ui); },
containment: $('#ajax_normalroute_panel_vics div.traffic-time-tumami-bg'),
axis: 'x'
});
// スライダの増減ボタン。
this.timeAddBtnTimeout = null;
this.timeAdd = 0;
var timeAddBtnEndFunc = function() {
if (null != itsmo.vars.g_route_vics.timeAddBtnTimeout) {
window.clearTimeout(itsmo.vars.g_route_vics.timeAddBtnTimeout);
itsmo.vars.g_route_vics.timeAddBtnTimeout = null;
}
itsmo.vars.g_route_vics.showLayer();
return false;
};
$("#ajax_normalroute_panel_vics div.traffic-time a[class^='arrow-']").mousedown(function(e) {
e = $(e.target);
var s = e.attr('class').substring(6);
if (s.indexOf('left') == 0) {
itsmo.vars.g_route_vics.timeAdd = -1;
} else {
itsmo.vars.g_route_vics.timeAdd = 1;
}
itsmo.vars.g_route_vics.onClickAddTime(itsmo.vars.g_route_vics.timeAdd);
if (null != itsmo.vars.g_route_vics.timeAddBtnTimeout) {
window.clearTimeout(itsmo.vars.g_route_vics.timeAddBtnTimeout);
}
itsmo.vars.g_route_vics.timeAddBtnTimeout = window.setTimeout(RouteVics.repeatAddTime, 500);
return false;
}).mouseup(timeAddBtnEndFunc).mouseout(timeAddBtnEndFunc);
// スライダ上をクリックしたときの対応。
$("#ajax_normalroute_panel_vics div.traffic-time div.traffic-time-tumami-bg2").click(RouteVics.onClickTsumamiBar);
// スケールレベルの変化に対応。
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CHG_ZOOM, RouteVics.onChangeZoomEnd);
$("#ajax_normalroute_panel_vics div[class^='traffic_btn_off-'] span.traffic-search").click(RouteVics.onClickCancelTraficBtnOff);
RouteVics.onChangeZoomEnd(); // 一応呼んでおく。
this.showTimeTsumamiFuki();
}
// VICS 表示時刻をセット。n => 0~95
RouteVics.prototype.setVicsTimeByCount = function(n, isShowLayer) {
if (undefined == isShowLayer || null == isShowLayer) {
isShowLayer = true;
}
n = Math.max(0, n);
n = Math.min(95, n);
this.vicsday.setHours(Math.floor(n / 4));
this.vicsday.setMinutes((n % 4) * 15);
this.showTimeTsumamiFuki();
if (isShowLayer) {
this.showLayer();
}
}
// つまみ移動ボタンのリピート。
RouteVics.repeatAddTime = function() {
itsmo.vars.g_route_vics.onClickAddTime(itsmo.vars.g_route_vics.timeAdd);
itsmo.vars.g_route_vics.timeAddBtnTimeout = window.setTimeout(RouteVics.repeatAddTime, 100);
}
// つまみ下のバーをクリックした処理。
RouteVics.onClickTsumamiBar = function(ev) {
var pos = $(ev.currentTarget).offset();
var n = ev.pageX - pos.left - 4;
itsmo.vars.g_route_vics.setVicsTimeByCount(n);
}
// ツマミの移動。
RouteVics.prototype.dragTimeTsumami = function(ev, ui) {
var s = $('#ajax_normalroute_panel_vics div.traffic-time-tumami').css('left');
var n = parseInt(s.substring(0, s.length - 2), 10);
this.setVicsTimeByCount(n - 4, false);
}
// つまみとフキダシの表示、調整。
RouteVics.prototype.showTimeTsumamiFuki = function() {
var m = this.vicsday.getMinutes();
m -= m % 15;
this.vicsday.setMinutes(m);
// 分は2桁にする。
m = this.get02d(m);
m = this.vicsday.getHours() + ':' + m;
// フキダシの移動、表示文字列の変更。
var px = this.vicsday.getHours() * 4 + Math.floor(this.vicsday.getMinutes() / 15) + 4;
//px += 'px';
$('#ajax_normalroute_panel_vics div.traffic-time-tumami').css('left', px + 'px');
px += 21;
$('#ajax_normalroute_panel_vics div.traffic-time-num').hide().css('left', px + 'px').show().find('div.traffic-time-num2').html(m);
}
// 時間の前後ボタン押下。
RouteVics.prototype.onClickAddTime = function(n) {
var d = new Date(this.vicsday.getTime() + n * 15 * 60 * 1000);
if (this.vicsday.getDate() != d.getDate()) {
return false;
}
this.vicsday = d;
this.showTimeTsumamiFuki();
return false;
}
// %02d を返す。
RouteVics.prototype.get02d = function(n) {
n = '0' + n;
n = n.substring(n.length - 2);
return n;
}
// 渋滞統計を表示する日時を返す。
RouteVics.prototype.getShowDate = function() {
var s = '' + this.vicsday.getFullYear();
s += this.get02d(this.vicsday.getMonth() + 1);
s += this.get02d(this.vicsday.getDate());
s += this.get02d(this.vicsday.getHours());
s += this.get02d(this.vicsday.getMinutes());
return s;
}
// 渋滞統計を表示する日時を設定する。datestr=>'201007051230'みたいな。
RouteVics.prototype.setVicsShowDate = function(datestr) {
var i = parseInt(datestr.substring(0, 4), 10);
this.vicsday.setFullYear(i);
i = parseInt(datestr.substring(4, 6), 10);
this.vicsday.setMonth(i - 1);
i = parseInt(datestr.substring(6, 8), 10);
this.vicsday.setDate(i);
i = parseInt(datestr.substring(8, 10), 10);
this.vicsday.setHours(i);
i = parseInt(datestr.substring(10, 12), 10);
this.vicsday.setMinutes(i);
this.showday.setTime(this.vicsday.getTime());
this.setCalendar();
this.showTimeTsumamiFuki();
this.showLayer();
}
// レイヤー作成。
RouteVics.prototype.showLayer = function() {
if(itsmo.vars.g_map_layer_traffic == null) {
itsmo.vars.g_map_layer_traffic = new ZDC.Traffic({
date: parseInt(this.getShowDate(), 10)
});
itsmo.vars.g_map_obj.addWidget(itsmo.vars.g_map_layer_traffic);
} else {
itsmo.vars.g_map_layer_traffic.setDate(parseInt(this.getShowDate(), 10));
}
if(!this.isHighway && !this.isLocal) {
itsmo.vars.g_map_layer_traffic.hidden();
} else {
itsmo.vars.g_map_layer_traffic.visible();
}
if( this.isHighway && this.isLocal) itsmo.vars.g_map_layer_traffic.setLayer('LOCAL,HIGHWAY');
if( this.isHighway && !this.isLocal) itsmo.vars.g_map_layer_traffic.setLayer('HIGHWAY');
if(!this.isHighway && this.isLocal) itsmo.vars.g_map_layer_traffic.setLayer('LOCAL');
}
// 表示 On/Off ボタンの押下。
RouteVics.prototype.onClickOpenBtn = function() {
//this.setVisible(!this.isVisible);
this.showVicsWindow();
}
// VICS ウィンドウを表示する。
/*
RouteVics.prototype.showVicsWindow = function() {
var cl;
//$('#ajax_normalroute_panel_vics_min').hide();
if (this.isVisible) {
cl = 'traffic-check-act';
this.isHighway = this.isLocal = true;
this.showHighwayLocal();
$('#ajax_normalroute_panel_vics_max').show();
this.showLayer();
} else {
cl = 'traffic-check';
$('#ajax_normalroute_panel_vics_max').hide();
if (itsmo.vars.g_map_layer_traffic != null) {
itsmo.vars.g_map_layer_traffic.hidden();
}
}
$('#ajax_normalroute_panel_vics_btn').attr('class', cl);
return false;
}
// VICS ウィンドウの表示非表示を設定。
RouteVics.prototype.setVisible = function(bl) {
this.isVisible = bl;
this.showVicsWindow();
}
*/
//暫定対応。やりたくはない.
RouteVics.prototype.showVicsWindow = function()
{
if(itsmo.vars.g_myroute_panel_isvisible == 1){
itsmo.vars.g_myroute_panel_isvisible = 2;
itsmo.myroute.showRoutePanel();
}
if(this.isVisible == 0 || this.isVisible == false ){
$('#map_vics_link').attr('class','map-btn3-jutai2-act');
this.isVisible = 1;
cl = 'traffic-check-act';
this.isHighway = this.isLocal = true;
this.showHighwayLocal();
$('#ajax_normalroute_panel_vics_max').show();
this.ChangeShowMode();
this.showLayer();
if ($('#vics_menu_resize').attr('class') == 'maxsize'){
$('#vics_traffic_time').hide();
}
return false;
}
if(this.isVisible == 2){
$('#map_vics_link').attr('class','map-btn3-jutai2-keep');
this.isVisible = 0;
$('#ajax_normalroute_panel_vics_max').hide();
}
if(this.isVisible == 1){
this.isVisible = 0;
cl = 'traffic-check';
$('#ajax_normalroute_panel_vics_max').hide();
$('#map_vics_link').attr('class','map-btn3-jutai2');
if (itsmo.vars.g_map_layer_traffic != null) {
itsmo.vars.g_map_layer_traffic.hidden();
}
return false;
}
if(this.isVisible == 3){
$('#ajax_normalroute_panel_vics_max').show().css('z-index','999');
$('#map_vics_link').attr('class','map-btn3-jutai2-act');
this.isVisible = 1;
}
$('#ajax_normalroute_panel_vics_btn').attr('class', cl);
};
// 道路選択チェックボックスを反映。
RouteVics.prototype.showHighwayLocal = function() {
var h = this.isHighway ? '-act' : '';
var l = this.isLocal ? '-act' : '';
$('#ajax_normalroute_panel_vics_highway1').attr('class', 'traffic-highway' + h);
$('#ajax_normalroute_panel_vics_local1').attr('class', 'traffic-local' + l);
$('#ajax_normalroute_panel_vics_highway2').attr('class', 'traffic-check' + h);
$('#ajax_normalroute_panel_vics_local2').attr('class', 'traffic-check' + l);
}
RouteVics.prototype.onClickHighway = function() {
this.isHighway = !this.isHighway;
this.showHighwayLocal();
this.showLayer();
return false;
}
RouteVics.prototype.onClickLocal = function() {
this.isLocal = !this.isLocal;
this.showHighwayLocal();
this.showLayer();
return false;
}
// カレンダーの前月次月ボタン押下。
RouteVics.prototype.onClickAddCalendar = function(n) {
var day = new Date(this.showday.getTime());
day.setDate(1);
if (n < 0) {
day.setTime(day.getTime() - 2 * 24 * 60 * 60 * 1000);
} else {
day.setTime(day.getTime() + 32 * 24 * 60 * 60 * 1000);
}
day.setDate(1);
var y = day.getFullYear();
var m = day.getMonth();
var today = new Date();
if (y < today.getFullYear()) {
y = today.getFullYear();
}
if (y == today.getFullYear() && m < today.getMonth()) {
m = today.getMonth();
}
if (y > (today.getFullYear() + 1)) {
y = today.getFullYear() + 1;
m = 11;
}
this.showday.setFullYear(y);
this.showday.setMonth(m);
$('#ajax_normalroute_panel_vics div.traffic-time-num').hide();
this.setCalendar();
// IE6,7でカレンダーが6週あった場合にフキダシ位置がズレることへの対応。
$('#ajax_normalroute_panel_vics div.traffic-time-num').show();
return false;
}
// カレンダーを表示。
RouteVics.prototype.setCalendar = function() {
var today = new Date();
// 表示月の1日目を作成。
this.showday.setDate(1);
// カレンダーの前月次月ボタンの制御。
var i = $('#ajax_normalroute_panel_vics .traffic-month a.arrow-left');
if (this.showday.getFullYear() < today.getFullYear()
|| (this.showday.getFullYear() == today.getFullYear() && this.showday.getMonth() <= today.getMonth())) {
i.hide();
} else {
i.show();
}
i = $('#ajax_normalroute_panel_vics .traffic-month a.arrow-right');
if (this.showday.getFullYear() > (today.getFullYear() + 1)
|| (this.showday.getFullYear() == (today.getFullYear() + 1) && 11 == this.showday.getMonth())) {
i.hide();
} else {
i.show();
}
// 末日を作成。
var lastday = new Date(this.showday.getTime());
lastday.setDate(1);
var start = lastday.getDay();
var end = lastday.getDay(); // 1日の曜日
lastday.setTime(lastday.getTime() + 32 * 24 * 60 * 60 * 1000);
lastday.setDate(1);
lastday.setHours(0);
lastday.setMinutes(0);
lastday.setSeconds(0);
lastday.setTime(lastday.getTime() - 12 * 60 * 60);
this.setCalendarDateText(false);
// カレンダー作成。
end = Math.floor((lastday.getDate() + end + 6) / 7 - 1) * 10 + lastday.getDay();
i = $("#ajax_normalroute_panel_vics table.traffic-calender tr[name='tracal5']");
if (end >= 50) {
i.show();
} else {
i.hide();
}
var week = 0;
var tbl = $('#ajax_normalroute_panel_vics table.traffic-calender');
var showDate = this.showday;
today = this.vicsday;
var isTodayMonth = this.showday.getMonth() == today.getMonth() && this.showday.getFullYear() == today.getFullYear();
$("#ajax_normalroute_panel_vics table.traffic-calender td[name^=tracal]").each(function() {
var s = $(this).parent().attr('name');
var w = parseInt(s.substring(6), 10);
var d = parseInt($(this).attr('name').substring(6), 10);
s = w * 10 + d;
var e = $(this);
if (s < start || s > end) {
e.html('');
if (0 == d) {
e.removeClass('cellSat');
} else if (6 == d) {
e.removeClass('cellSun');
} else {
e.removeClass('cellSun cellSat');
}
return null;
}
if (w >= 1) {
s = 7 - start + 1 + (w - 1) * 7 + d;
} else {
s = d - start + 1;
}
RouteVics.clickCal(e, showDate.getFullYear(), showDate.getMonth() + 1, s
, (s == today.getDate() && isTodayMonth));
});
}
// カレンダーの日付セット。
RouteVics.clickCal = function(e, y, m, d, isToday) {
var s;
var isSun = new Date(y, m - 1, d);
var isSat = isSun.getDay() == 6;
isSun = (isSun.getDay() == 0) || isSun.isJpHoliday();
if (isToday) {
s = '' + d + '
';
} else {
s = '' + d + '';
}
if (isSun || isSat) {
if (isSun) {
e.removeClass('cellSat');
e.addClass('cellSun');
} else {
e.removeClass('cellSun');
e.addClass('cellSat');
}
} else {
e.removeClass('cellSun cellSat');
}
e.html(s);
}
// カレンダーの日付クリック。
RouteVics.prototype.clickCal = function(y, m, d, e) {
// vics 制御。
this.vicsday.setFullYear(y);
this.vicsday.setMonth(m - 1);
this.vicsday.setDate(d);
this.showLayer();
// カレンダーの調整。
var i = $("#ajax_normalroute_panel_vics table.traffic-calender td div.today");
var n = i.html();
i = i.parent();
RouteVics.clickCal(i, y, m, n, false);
e = $(e);
e = e.parent();
RouteVics.clickCal(e, y, m, d, true);
}
// カレンダー上部の年月日表示。
RouteVics.prototype.setCalendarDateText = function(isFull) {
var s = '';
if (isFull) {
s = this.vicsday.getFullYear() + '年' + (this.vicsday.getMonth() + 1) + '月'
+ this.vicsday.getDate() + '日'
+ this.vicsday.getHours() + ':'
+ this.get02d(this.vicsday.getMinutes());
} else {
s = this.showday.getFullYear() + '年' + (this.showday.getMonth() + 1) + '月';
}
$('#ajax_normalroute_panel_vics_cal_ym').html(s);
}
/*
// ルート表示時用に小さくする。
RouteVics.prototype.minimize = function() {
$('#ajax_normalroute_panel_vics').addClass('route-traffic');
$("#ajax_normalroute_panel_vics .traffic-month a[class^='arrow-']").hide();
this.setCalendarDateText(true);
}
*/
// ルート表示用?通常?
RouteVics.prototype.ChangeShowMode = function() {
if(this.show_mode == 'car'){
$("#ajax_normalroute_panel_vics .traffic-month0").hide();
$("#ajax_normalroute_panel_vics .traffic-time").hide();
$("#vics_traffic_time").hide();
this.setCalendarDateText(true);
}else{
$("#ajax_normalroute_panel_vics .traffic-month0").show();
$("#ajax_normalroute_panel_vics .traffic-time").show();
$("#vics_traffic_time").show();
}
}
// ルート表示時用に小さくしたウィンドウを戻す。
RouteVics.prototype.restoreMinimize = function() {
$('#ajax_normalroute_panel_vics').removeClass('route-traffic');
this.setCalendar();
}
// ルート表示時用に VICS 表示日時を返す。
RouteVics.prototype.makeVicsShowDateStr = function() {
// VICS 表示日時が現在時刻+15分より過去なら後者を使う。
var t = new Date(this.vicsday.getTime());
var now = (new Date()).getTime() + 15 * 60 * 1000 + 14 * 60 * 1000;
now -= now % (15 * 60 * 1000);
if (t.getTime() < now) {
t.setTime(now);
}
return '' + t.getFullYear() + this.get02d(t.getMonth() + 1) + this.get02d(t.getDate())
+ this.get02d(t.getHours()) + this.get02d(t.getMinutes());
}
// 地図ズームレベル変更時。
RouteVics.onChangeZoomEnd = function() {
var id = '#ajax_normalroute_panel_vics div.traffic_btn_off-highway0';
var n = itsmo.vars.g_map_obj.getZoom();
if (n <= 3) {
$(id).show();
} else {
$(id).hide();
}
id = '#ajax_normalroute_panel_vics div.traffic_btn_off-lowway0';
if (n <= 8) {
$(id).show();
} else {
$(id).hide();
}
}
// 地図ズームレベル変更時。
RouteVics.onClickCancelTraficBtnOff = function(ev) {
var e = $(ev.currentTarget);
var s = e.parent().attr('class');
if (s.indexOf('highway') >= 0) {
itsmo.vars.g_map_obj.setZoom(4);
} else {
itsmo.vars.g_map_obj.setZoom(9);
}
RouteVics.onChangeZoomEnd();
}
// ========================================================
// http://labs.d4k.net/index.php?%BD%CB%C6%FC%A1%CA%BA%D7%C6%FC%A1%CB%BC%AB%C6%B0%BB%BB%BD%D0%A5%C4%A1%BC%A5%EB%20JavaScript%20%C8%C7
// jp-holidays.js ---- 祝日取得のための Date 拡張
// Copyright 2008 Kiyoshi Sakai
// 2008/06/23 - JSでの最初のバージョン
// 2008/09/25 - 昭和23(1948)年からの過去を意識しました
// 参考にしたサイト
// http://www.asahi-net.or.jp/~ci5m-nmr/misc/holiday.html
// 2008/10/07 - バグ修正
// version: 0.0.2
// ========================================================
Date.prototype.one_day_epoch = 1000 * 60 * 60 * 24;
Date.prototype.jp_hol_vernal_equinox_days = {
1925 : '3/21',
1926 : '3/21',
1927 : '3/21',
1928 : '3/21',
1929 : '3/21',
1930 : '3/21',
1931 : '3/21',
1932 : '3/21',
1933 : '3/21',
1934 : '3/21',
1935 : '3/21',
1936 : '3/21',
1937 : '3/21',
1938 : '3/21',
1939 : '3/21',
1940 : '3/21',
1941 : '3/21',
1942 : '3/21',
1943 : '3/21',
1944 : '3/21',
1945 : '3/21',
1946 : '3/21',
1947 : '3/21',
1948 : '3/21',
1949 : '3/21',
1950 : '3/21',
1951 : '3/21',
1952 : '3/21',
1953 : '3/21',
1954 : '3/21',
1955 : '3/21',
1956 : '3/21',
1957 : '3/21',
1958 : '3/21',
1959 : '3/21',
1960 : '3/20',
1961 : '3/21',
1962 : '3/21',
1963 : '3/21',
1964 : '3/20',
1965 : '3/21',
1966 : '3/21',
1967 : '3/21',
1968 : '3/20',
1969 : '3/21',
1970 : '3/21',
1971 : '3/21',
1972 : '3/20',
1973 : '3/21',
1974 : '3/21',
1975 : '3/21',
1976 : '3/20',
1977 : '3/21',
1978 : '3/21',
1979 : '3/21',
1980 : '3/20',
1981 : '3/21',
1982 : '3/21',
1983 : '3/21',
1984 : '3/20',
1985 : '3/21',
1986 : '3/21',
1987 : '3/21',
1988 : '3/20',
1989 : '3/21',
1990 : '3/21',
1991 : '3/21',
1992 : '3/20',
1993 : '3/20',
1994 : '3/21',
1995 : '3/21',
1996 : '3/20',
1997 : '3/20',
1998 : '3/21',
1999 : '3/21',
2000 : '3/20',
2001 : '3/20',
2002 : '3/21',
2003 : '3/21',
2004 : '3/20',
2005 : '3/20',
2006 : '3/21',
2007 : '3/21',
2008 : '3/20',
2009 : '3/20',
2010 : '3/21',
2011 : '3/21',
2012 : '3/20',
2013 : '3/20',
2014 : '3/21',
2015 : '3/21'
};
Date.prototype.jp_hol_autumnal_equinox_days = {
1925 : '9/23',
1926 : '9/24',
1927 : '9/24',
1928 : '9/23',
1929 : '9/23',
1930 : '9/24',
1931 : '9/24',
1932 : '9/23',
1933 : '9/23',
1934 : '9/24',
1935 : '9/24',
1936 : '9/23',
1937 : '9/23',
1938 : '9/24',
1939 : '9/24',
1940 : '9/23',
1941 : '9/23',
1942 : '9/24',
1943 : '9/24',
1944 : '9/23',
1945 : '9/23',
1946 : '9/24',
1947 : '9/24',
1948 : '9/23',
1949 : '9/23',
1950 : '9/23',
1951 : '9/24',
1952 : '9/23',
1953 : '9/23',
1954 : '9/23',
1955 : '9/24',
1956 : '9/23',
1957 : '9/23',
1958 : '9/23',
1959 : '9/24',
1960 : '9/23',
1961 : '9/23',
1962 : '9/23',
1963 : '9/24',
1964 : '9/23',
1965 : '9/23',
1966 : '9/23',
1967 : '9/24',
1968 : '9/23',
1969 : '9/23',
1970 : '9/23',
1971 : '9/24',
1972 : '9/23',
1973 : '9/23',
1974 : '9/23',
1975 : '9/24',
1976 : '9/23',
1977 : '9/23',
1978 : '9/23',
1979 : '9/24',
1980 : '9/23',
1981 : '9/23',
1982 : '9/23',
1983 : '9/23',
1984 : '9/23',
1985 : '9/23',
1986 : '9/23',
1987 : '9/23',
1988 : '9/23',
1989 : '9/23',
1990 : '9/23',
1991 : '9/23',
1992 : '9/23',
1993 : '9/23',
1994 : '9/23',
1995 : '9/23',
1996 : '9/23',
1997 : '9/23',
1998 : '9/23',
1999 : '9/23',
2000 : '9/23',
2001 : '9/23',
2002 : '9/23',
2003 : '9/23',
2004 : '9/23',
2005 : '9/23',
2006 : '9/23',
2007 : '9/23',
2008 : '9/23',
2009 : '9/23',
2010 : '9/23',
2011 : '9/23',
2012 : '9/22',
2013 : '9/23',
2014 : '9/23',
2015 : '9/23'
};
Date.prototype.getJpHolNationalFoundationDay = function (y) {
return 1967 <= y ? '2/11' : null;
}
Date.prototype.getJpHolEquinoxDateCalc = function (y, va) {
// 1太陽年は(西暦2000年において)365.24219日(365.24219040日)となっており、100年間で約0.53秒ずつ短くなっている。
// 2000年の太陽の春分点通過日
// 3月20.69115日
// 2000年の太陽の秋分点通過日
// 9月23.09日
var equinox;
switch(va) {
case 'vernal':
// date('2000/03/20').getTime() + (60 * 60 * 24 * 0.69115)
equinox = 953537715.36;
break;
case 'autumnal':
// date('2000-09-23').getTime() + (60 * 60 * 24 * 0.09)
equinox = 969642576.00;
break;
}
// 2000年の春(秋)分点 + 2000年から太陽年の計算 + 太陽年の誤差修正(100年間で約0.53短くなりつつある)
var i;
var y_sum = 0;
for(i = 0; i > y - 2000; i--) {
y_sum += i;
}
for(i = 0; i < y - 2000; i++) {
y_sum += i;
}
// var target_date_equinox = new Date(equinox + (3155692525056 * (y - 2000) / 100000) + (53 * (array_sum(range(0, y - 2000))) / 10000));
var target_date_equinox = new Date((equinox + (3155692525056 * (y - 2000) / 100000) + (53 * y_sum / 10000)) * 1000);
return (target_date_equinox.getMonth() + 1) + '/' + target_date_equinox.getDate();
}
Date.prototype.isJpHolVernalEquinoxDay = function (y, m_d) {
var ve_m_d;
if(this.jp_hol_vernal_equinox_days[y]) {
ve_m_d = this.jp_hol_vernal_equinox_days[y];
} else {
ve_m_d = this.getJpHolEquinoxDateCalc(y, 'vernal');
this.jp_hol_vernal_equinox_days[y] = ve_m_d;
}
return m_d == ve_m_d ? true : false;
}
Date.prototype.isJpHolAutumnalEquinoxDay = function (y, m_d) {
// return m_d == (this.jp_hol_autumnal_equinox_days[y] ? this.jp_hol_autumnal_equinox_days[y] : this.getJpHolEquinoxDateCalc(y, 'autumnal'));
var va_m_d;
if(this.jp_hol_autumnal_equinox_days[y]) {
va_m_d = this.jp_hol_autumnal_equinox_days[y];
} else {
va_m_d = this.getJpHolEquinoxDateCalc(y, 'autumnal');
this.jp_hol_autumnal_equinox_days[y] = va_m_d;
}
return m_d == va_m_d ? true : false;
}
Date.prototype.isJpHoliday = function(by_date_itself) {
var y = this.getFullYear();
var m_d = (this.getMonth() + 1) + '/' + this.getDate();
var y_m_d = y + '/' + m_d; // 2008-10-07 追加 バグ修正ごめん
var national_foundation_m_d = this.getJpHolNationalFoundationDay(y);
if(this.is_jp_holiday && typeof(this.is_jp_holiday) == 'boolean' && this.y_m_d && this.y_m_d == y_m_d) {
return this.is_jp_holiday;
}
this.y_m_d = y_m_d;
switch(m_d) {
case '1/1':
if(1949 <= y) {
this.jp_hol_name = '元日';
this.jp_hol_engl = 'New Year\'s Day';
this.jp_hol_desc = '年のはじめを祝う。';
this.is_jp_holiday = true;
return true;
}
break;
case '1/15':
if(1949 <= y && y <= 1999) {
this.jp_hol_name = '成人の日';
this.jp_hol_engl = 'Coming of Age Day';
this.jp_hol_desc = 'おとなになったことを自覚し、みずから生き抜こうとする青年を祝いはげます。';
this.is_jp_holiday = true;
return true; // 2008-10-07 追加 バグ修正ごめん
}
break;
case '4/29':
if(1927 <= y && y <= 1988) {
this.jp_hol_name = '天皇誕生日';
this.jp_hol_engl = 'Emperor\'s Birthday';
this.jp_hol_desc = '天皇の誕生日を祝う。';
this.is_jp_holiday = true;
return true;
} else if(1989 <= y && y <= 2006) {
this.jp_hol_name = 'みどりの日';
this.jp_hol_engl = 'Greenery Day';
this.jp_hol_desc = '自然に親しむとともにその恩恵に感謝し、豊かな心をはぐくむ。';
this.is_jp_holiday = true;
return true;
} else if(2007 <= y) {
this.jp_hol_name = '昭和の日';
this.jp_hol_engl = 'Showa Day'; // 正式な発表ではありません…
this.jp_hol_desc = '激動の日々を経て、復興を遂げた昭和の時代を顧み、国の将来に思いをいたす。';
this.is_jp_holiday = true;
return true;
}
break;
case '5/3':
if(1949 <= y) {
this.jp_hol_name = '憲法記念日';
this.jp_hol_engl = 'Constitution Memorial Day';
this.jp_hol_desc = '日本国憲法の施行を記念し、国の成長を期する。';
this.is_jp_holiday = true;
return true;
}
break;
case '5/4':
if(2007 <= y) {
this.jp_hol_name = 'みどりの日';
this.jp_hol_engl = 'Greenery Day';
this.jp_hol_desc = '自然に親しむとともにその恩恵に感謝し、豊かな心をはぐくむ。';
this.is_jp_holiday = true;
return true;
}
break;
case '5/5':
if(1949 <= y) {
this.jp_hol_name = 'こどもの日';
this.jp_hol_engl = 'Children\'s Day';
this.jp_hol_desc = 'こどもの人格を重んじ、こどもの幸福をはかるとともに、母に感謝する。';
this.is_jp_holiday = true;
return true;
}
break;
case '7/20':
if(1996 <= y && y <= 2002) {
this.jp_hol_name = '海の日';
this.jp_hol_engl = 'Marine Day';
this.jp_hol_desc = '海の恩恵に感謝するとともに、海洋国日本の繁栄を願う。';
this.is_jp_holiday = true;
return true;
}
break;
case '9/15':
if(1967 <= y && y <= 2002) {
this.jp_hol_name = '敬老の日';
this.jp_hol_engl = 'Respect for the Aged Day';
this.jp_hol_desc = '多年にわたり社会につくしてきた老人を敬愛し、長寿を祝う。';
this.is_jp_holiday = true;
return true;
}
break;
case '10/10':
if(1966 <= y && y <= 1999) {
this.jp_hol_name = '体育の日';
this.jp_hol_engl = 'Health and Sports Day';
this.jp_hol_desc = 'スポーツにしたしみ、健康な心身をつちかう。';
this.is_jp_holiday = true;
return true;
}
break;
case '11/3':
if(1948 <= y) {
this.jp_hol_name = '文化の日';
this.jp_hol_engl = 'National Culture Day';
this.jp_hol_desc = '自由と平和を愛し、文化をすすめる。';
this.is_jp_holiday = true;
return true;
}
break;
case '11/23':
if(1948 <= y) {
this.jp_hol_name = '勤労感謝の日';
this.jp_hol_engl = 'Labor Thanksgiving Day';
this.jp_hol_desc = '勤労をたっとび、生産を祝い、国民たがいに感謝しあう。';
this.is_jp_holiday = true;
return true;
}
break;
case '12/23':
if(1989 <= y) {
this.jp_hol_name = '天皇誕生日';
this.jp_hol_engl = 'Emperor\'s Birthday';
this.jp_hol_desc = '天皇の誕生日を祝う。';
this.is_jp_holiday = true;
return true;
}
break;
case national_foundation_m_d: // 政令で定める日
if(1967 <= y) {
this.jp_hol_name = '建国記念の日';
this.jp_hol_engl = 'National Foundation Day';
this.jp_hol_desc = '建国をしのび、国を愛する心を養う。';
this.is_jp_holiday = true;
return true;
}
break;
}
switch((this.getMonth() + 1) + '-' + Math.ceil(this.getDate() / 7) + '-' + this.getDay()) {
case '1-2-1': // 1月の第2月曜日
if(2000 <= y) {
this.jp_hol_name = '成人の日';
this.jp_hol_engl = 'Coming of Age Day';
this.jp_hol_desc = 'おとなになったことを自覚し、みずから生き抜こうとする青年を祝いはげます。';
this.is_jp_holiday = true;
return true;
}
break;
case '7-3-1': // 7月の第3月曜日
if(2003 <= y) {
this.jp_hol_name = '海の日';
this.jp_hol_engl = 'Marine Day';
this.jp_hol_desc = '海の恩恵に感謝するとともに、海洋国日本の繁栄を願う。';
this.is_jp_holiday = true;
return true;
}
break;
case '9-3-1': // 9月の第3月曜日
if(2003 <= y) {
this.jp_hol_name = '敬老の日';
this.jp_hol_engl = 'Respect for the Aged Day';
this.jp_hol_desc = '多年にわたり社会につくしてきた老人を敬愛し、長寿を祝う。';
this.is_jp_holiday = true;
return true;
}
break;
case '10-2-1': // 10月の第2月曜日
if(2000 <= y) {
this.jp_hol_name = '体育の日';
this.jp_hol_engl = 'Health and Sports Day';
this.jp_hol_desc = 'スポーツにしたしみ、健康な心身をつちかう。';
this.is_jp_holiday = true;
return true;
}
break;
}
if(this.isJpHolVernalEquinoxDay(y, m_d)) {
if(1949 <= y) {
this.jp_hol_name = '春分の日';
this.jp_hol_engl = 'Vernal Equinox';
this.jp_hol_desc = '自然をたたえ、生物をいつくしむ。';
this.is_jp_holiday = true;
return true;
}
}
if(this.isJpHolAutumnalEquinoxDay(y, m_d)) {
if(1948 <= y) {
this.jp_hol_name = '秋分の日';
this.jp_hol_engl = 'Autumnal Equinox';
this.jp_hol_desc = '祖先をうやまい、なくなった人々をしのぶ。';
this.is_jp_holiday = true;
return true;
}
}
if(by_date_itself) {
this.jp_hol_name = null;
this.jp_hol_engl = null;
this.jp_hol_desc = null;
this.is_jp_holiday = false;
return false;
}
var date_before = new Date(this.getTime() - this.one_day_epoch);
if(date_before.isJpHoliday(true)) { // 前日が祝日
if(date_before.getDay() == 0) { // 前日が祝日かつ日曜ならば
this.jp_hol_name = '振替休日';
this.jp_hol_engl = 'Substitute Holiday';
this.jp_hol_desc = null;
this.is_jp_holiday = true;
return true;
}
if(1986 <= y) {
var date_after = new Date(this.getTime() + this.one_day_epoch);
if(date_after.isJpHoliday(true)) { // 前日も翌日も祝日ならば
this.jp_hol_name = '国民の休日';
this.jp_hol_engl = 'Holiday for a Nation';
this.jp_hol_desc = null;
this.is_jp_holiday = true;
return true;
}
}
if(2007 <= y) {
date_before.setTime(date_before.getTime() - this.one_day_epoch);
while(date_before.isJpHoliday(true)) { // 前日以前が祝日の連続になっている場合
if(date_before.getDay() == 0) { // 前日以前が祝日の連続で、日曜が重なる場合
this.jp_hol_name = '振替休日';
this.jp_hol_engl = 'Substitute Holiday';
this.jp_hol_desc = null;
this.is_jp_holiday = true;
return true;
}
date_before.setTime(date_before.getTime() - this.one_day_epoch);
}
}
}
this.jp_hol_name = null;
this.jp_hol_engl = null;
this.jp_hol_desc = null;
this.is_jp_holiday = false;
return false;
}
if (!itsmo.ad) {
itsmo.ad = {};
}
itsmo.ad.hotspot = {};
itsmo.ad.hotspot._request = null;
// 初期化
itsmo.ad.hotspot.init = function() {
};
itsmo.ad.hotspot.onClickSearch = function(e) {
var s;
if (null != e) {
s = $(e).text();
} else {
s = $('#ajax_facet_range_freewd').val();
}
itsmo.ad.hotspot.search(s);
};
//
itsmo.ad.hotspot.search = function(freewd) {
itsmo.sub.map_tab_change('range', ['hostspot', freewd]);
// ajax通信
var prm = itsmo.vars.g_map_search_location;
prm = 'lat=' + prm.lat
+ '&lon=' + prm.lon
+ '&freewd=' + encodeURIComponent(freewd)
;
itsmo.lib.map_waitopen();
if(itsmo.ad.hotspot._request != null) {
itsmo.lib.XMLHttpRequest2_abort(itsmo.ad.hotspot._request);
}
itsmo.ad.hotspot._request = itsmo.lib.XMLHttpRequest2_send('/map/ajax_ad_hotspot.php'
, itsmo.ad.hotspot.search_result, 'GET', prm);
};
itsmo.ad.hotspot.search_result = function(result) {
itsmo.ad.hotspot._request = null;
// エラー処理
result = $(result);
var err = result.find('err').text();
if(err != 0) {
//alert('エラー '+err);
return;
}
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml(result.find('left_html').text());
$('#ajax_facet_range_freewd').clearField().blur().keypress(function(e) {
if (13 == e.which) {
itsmo.ad.hotspot.onClickSearch(null);
}
});
};
//--------------------------------------------------------------------------------------------------
// メニュー選択
//--------------------------------------------------------------------------------------------------
itsmo.near_baitoru = function() {};
itsmo.near_baitoru.classification = [];
itsmo.near_baitoru.classification_cat = [];
itsmo.near_baitoru.is_init = false;
itsmo.near_baitoru.cond = {};
itsmo.near_baitoru.opened_cond_window = null;
itsmo.near_baitoru.start = function() {
itsmo.near_baitoru.classification = [];
itsmo.near_baitoru.classification_cat = [];
itsmo.near_baitoru.cond = {};
itsmo.near_baitoru.cond['sort'] = 'location';
itsmo.vars.g_range_genre = 'baitoru';
itsmo.near_baitoru.search();
};
itsmo.near_baitoru.setSearchCond = function(e, key, val) {
itsmo.near_baitoru.hideCondSelect();
if (null != key && undefined != key) {
itsmo.near_baitoru.cond[key] = val;
}
e = $(e);
var txt = e.text();
var i, f = null;
for (i = 0; i < 10; ++i) {
e = e.parent();
f = e.find('span.box-s');
if (f.length >= 1) {
break;
}
}
if (null == f) {
return false;
}
f.text(txt);
e.find('input:hidden').val(val);
if ('salary' == key) {
itsmo.near_baitoru.onchange_salary();
}
};
itsmo.near_baitoru.setCond = function() {
$("#ajax_leftmenu_result span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
var id = box.attr('id');
var key = (null == id || undefined == id) ? '' : id.substring(8);
var f = e.find('input:hidden');
if (f.length == 1) {
key = f.attr('name');
}
var n = itsmo.near_baitoru.cond[key];
if (n == null || n == undefined) {
return;
}
e.find('ul li').each(function() {
var f = $(this).find("a");
var s = f.attr('onclick');
if (null == s || undefined == s) {
return;
}
if (typeof s != 'string') {
s = s.toString();
}
if ('' == n || s.indexOf(n) >= 0) {
box.text(f.text());
return false;
}
});
});
itsmo.near_baitoru.onchange_salary();
itsmo.near_baitoru.setClassificationCondLink();
};
itsmo.near_baitoru.showCondSelect = function(e) {
var id = $(e).attr('id') + '_cond';
var bl = itsmo.near_baitoru.opened_cond_window == id;
itsmo.near_baitoru.hideCondSelect();
if (bl) {
return false;
}
itsmo.near_baitoru.opened_cond_window = id;
$('#' + id).fadeIn('fast');
};
itsmo.near_baitoru.hideCondSelect = function() {
itsmo.near_baitoru.opened_cond_window = null;
$("#ajax_leftmenu_result span[class^='sis-search-paka-waku0'] div.sis-search-paka-genre").fadeOut('fast');
};
//--------------------------------------------------------------------------------------------------
// 検索
//--------------------------------------------------------------------------------------------------
itsmo.near_baitoru.search = function(act) {
itsmo.near_baitoru.hideCondSelect();
itsmo.sub.map_tab_change('range', ['baitoru']);
if (act != 'page') {
itsmo.vars.g_range_page = 1;
}
var cond = [], i;
for (i in itsmo.near_baitoru.cond) {
cond.push(i + '=' + encodeURIComponent(itsmo.near_baitoru.cond[i]));
}
cond.push('classify=' + encodeURIComponent(itsmo.near_baitoru.classification.join(',')));
cond.push('classifycat=' + encodeURIComponent(itsmo.near_baitoru.classification_cat.join(',')));
i = itsmo.vars.g_map_search_location;
var prm = 'lat=' + i.lat
+ '&lon=' + i.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&page=' + itsmo.vars.g_range_page
+ '&cnt=' + itsmo.vars.g_range_cnt
+ '&' + cond.join('&')
;
//alert(prm);
itsmo.lib.map_waitopen();
itsmo.lib.XMLHttpRequest2_send('/map/ajax_near_baitoru.php', itsmo.near_baitoru.result, 'GET', prm);
};
itsmo.near_baitoru.result = function (result) {
// エラー処理
result = $(result);
var err = result.find('err').text();
if(err != 0) {
itsmo.lib.aplErrorWindow('W', '0003', 'baitoru', 'アルバイト検索');
return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
$(result).find('list').each(function(){
var prm = {};
prm['uid'] = $(this).find('id').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('title').text();
prm['short_nm'] = $(this).find('title').text();
prm['tip_c'] = $(this).find('tiphtmlc').text();
prm['tip_o'] = $(this).find('tiphtmlo').text();
var html = prm['tip_c'];
var div_id = itsmo.sub.set_tooltip_s(html,prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
});
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml( result.find('listhtml').text() );
itsmo.near_baitoru.setCond();
};
itsmo.near_baitoru.set_pange_and_search = function(page) {
itsmo.vars.g_range_page = page + 1;
itsmo.near_baitoru.search('page');
};
itsmo.near_baitoru.onchange_salary = function() {
$("#ajax_leftmenu_result span.sis-search-paka-waku0d[id^='baitoru_salary_']").hide();
var i = itsmo.near_baitoru.cond['salary'];
if (i == null || i == undefined || '' == i) {
i = '9';
}
i = $('#baitoru_salary_' + i).show().find('input:hidden');
if (i.length >= 1) {
itsmo.near_baitoru.cond[i.attr('name')] = i.val();
}
};
itsmo.near_baitoru.showCond = function() {
if (!itsmo.near_baitoru.is_init) {
itsmo.near_baitoru.is_init = true;
$("#ajax_baitoru_cond input:checkbox[name='job_cat']").click(itsmo.near_baitoru.onClickCategory);
$("#ajax_baitoru_cond input:checkbox[name!='job_cat']").click(itsmo.near_baitoru.onClickJob);
}
itsmo.near_baitoru.setClassificationCond();
itsmo.lib.map_windowopen('ajax_baitoru_cond');
};
itsmo.near_baitoru.setClassificationCondLink = function() {
var e = $('#ajax_baitoru_jobcat').find('span');
if (itsmo.near_baitoru.classification.length >= 1 || itsmo.near_baitoru.classification_cat.length >= 1) {
e.eq(0).hide();
e.eq(1).show();
} else {
e.eq(0).show();
e.eq(1).hide();
}
};
itsmo.near_baitoru.setClassificationCond = function() {
$("#ajax_baitoru_cond input:checkbox").attr("checked", false);
var f = $("#ajax_baitoru_cond input:checkbox");
$.each(itsmo.near_baitoru.classification, function(i, v) {
var e = f.filter("#baitoru" + v);
e.attr('checked', true);
});
f.filter("[name='job_cat']").each(function() {
var e = $(this);
var v = e.attr('id').substring(7);
var i = "[name='job_" + v + "']";
var g = f.filter(i);
if (g.length == g.filter(':checked').length) {
e.attr('checked', true);
}
});
};
itsmo.near_baitoru.submit = function() {
itsmo.near_baitoru.classification = [];
itsmo.near_baitoru.classification_cat = [];
var f = $("#ajax_baitoru_cond input:checkbox");
f.filter(":checked[name^='job_']").each(function() {
var e = $(this);
var n = e.attr('name');
var v = e.attr('id').substring(7);
if ('job_cat' == n) {
} else {
itsmo.near_baitoru.classification.push(v);
}
});
f.filter("[name='job_cat']").each(function() {
var e = $(this);
var v = e.attr('id').substring(7);
if (f.filter(":checked[name='job_" + v + "']").length >= 1) {
itsmo.near_baitoru.classification_cat.push(v);
}
});
itsmo.lib.map_windowclose();
itsmo.near_baitoru.setClassificationCondLink();
itsmo.near_baitoru.search();
};
itsmo.near_baitoru.cancel = function() {
map_windowclose();
};
itsmo.near_baitoru.onClickCategory = function(e) {
e = $(e.target);
$("#ajax_baitoru_cond input:checkbox[name='job_" + e.attr('id').substring(7) + "']").attr('checked', e.is(':checked'));
};
itsmo.near_baitoru.onClickJob = function(e) {
e = $(e.target);
var n = e.attr('name');
var f = $("#ajax_baitoru_cond input:checkbox[name='" + n + "']");
var bl = f.filter(':checked').length == f.length;
$("#ajax_baitoru_cond input:checkbox[name='job_cat'][id='baitoru" + n.substring(4) + "']").attr('checked', bl);
};
itsmo.near_suumo = function() {};
itsmo.near_suumo.mode = 'buy';
itsmo.near_suumo.mode_panel = 'buy';
itsmo.near_suumo.condition = { 'rent':{} , 'buy':{} };
itsmo.near_suumo.condition_panel = { 'rent':{} , 'buy':{} };
itsmo.near_suumo.cnt = 10;
itsmo.near_suumo.opened_cond_window = null;
itsmo.near_suumo.nameToSE = {};
itsmo.near_suumo.nameToSE['land'] = '030';
itsmo.near_suumo.nameToSE['house'] = '020';
itsmo.near_suumo.nameToSE['mansion'] = '010';
itsmo.near_suumo.nameToSE['usedhouse'] = '021';
itsmo.near_suumo.nameToSE['usedmansion'] = '011';
itsmo.near_suumo.lastStartParam = null;
itsmo.near_suumo.isLastSubmitPanel = false;
itsmo.near_suumo.start = function(param) {
itsmo.near_suumo.isLastSubmitPanel = false;
itsmo.vars.g_range_genre = 'suumo';
itsmo.vars.g_range_page = 1;
itsmo.near_suumo.CondReset();
if (typeof param == 'string') {
itsmo.near_suumo.lastStartParam = param;
} else if (null != itsmo.near_suumo.lastStartParam) {
param = itsmo.near_suumo.lastStartParam;
itsmo.near_suumo.lastStartParam = null;
}
if (typeof param !== 'undefined' && null != param) {
if (param instanceof Array && param.length >= 1) {
param = param[0];
}
// モード設定
if (param.indexOf('mode=') == 0) {
var i = param.substring(5);
itsmo.near_suumo.mode = itsmo.near_suumo.mode_panel = 'rent' == i ? 'rent' : 'buy';
$('input[name="suumo_cond_SE"]').val(['buy' == itsmo.near_suumo.mode ? '1' : '0']);
if (typeof itsmo.near_suumo.nameToSE[i] !== 'undefined') {
itsmo.near_suumo.condition['buy']['SE' + itsmo.near_suumo.nameToSE[i]] = '1';
}
}
}
itsmo.near_suumo.searchSubmit(param);
};
/*
検索
*/
itsmo.near_suumo.search = function(cond, param){
var i = ['suumo'];
itsmo.sub.map_tab_change('range', i);
if(!cond){ cond = 'mode=' + itsmo.near_suumo.mode; }
i = itsmo.vars.g_map_search_location;
var prm = cond + '&'
+ 'lat=' + i.lat
+ '&lon=' + i.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&CNT=' + itsmo.vars.g_range_cnt
+ '&P=' + itsmo.vars.g_range_page;
itsmo.lib.map_waitopen();
itsmo.lib.XMLHttpRequest2_send('/map/ajax_near_suumo.php', itsmo.near_suumo.result, 'GET', prm ,'xml');
};
//左リストから検索
itsmo.near_suumo.searchSubmit = function(param){
itsmo.near_suumo.isLastSubmitPanel = false;
var prm = itsmo.near_suumo.condition[itsmo.near_suumo.mode];
var cond = itsmo.near_suumo.getCond(prm);
cond = cond + '&mode=' + itsmo.near_suumo.mode;
itsmo.vars.g_range_page = 1;
itsmo.near_suumo.search(cond, param);
};
//検索パネルから検索
itsmo.near_suumo.searchSubmitPanel = function(page){
itsmo.near_suumo.isLastSubmitPanel = true;
var prm = itsmo.near_suumo.condition_panel[itsmo.near_suumo.mode_panel];
itsmo.vars.g_range_cnt = itsmo.near_suumo.cnt;
itsmo.vars.g_range_flag_rowcnt = itsmo.near_suumo.cnt;
var cond = itsmo.near_suumo.getCond(prm);
cond = cond + '&mode=' + itsmo.near_suumo.mode_panel;
var keyword = $('#ajax_suumo_cond #suumo_keyword').val();
if($('#suumo_condition_flg').find('span:first').attr('class') == 'tel-check-off'){
cond = '';
}else{
itsmo.near_suumo.mode = itsmo.near_suumo.mode_panel;
itsmo.near_suumo.condition[itsmo.near_suumo.mode] = prm;
if(keyword){ cond += '&QUERY=' + encodeURIComponent(keyword);}
}
itsmo.vars.g_range_page = undefined != page && null != page ? page : 1;
itsmo.near_suumo.search(cond);
itsmo.lib.map_windowclose();
};
//ページング
itsmo.near_suumo.set_pange_and_search = function(page) {
if (itsmo.near_suumo.isLastSubmitPanel) {
itsmo.near_suumo.searchSubmitPanel(page);
return;
}
itsmo.vars.g_range_page = page;
var prm = itsmo.near_suumo.condition[itsmo.near_suumo.mode];
var cond = itsmo.near_suumo.getCond(prm);
cond = cond + '&mode=' + itsmo.near_suumo.mode;
itsmo.near_suumo.search(cond);
};
//検索パラメータ生成
itsmo.near_suumo.getCond = function(prm){
var tmp = new Array();
var tmp_SE = '';
var num = 0
$.each(prm,function(i,val){
if(val != ''){
if(i.match(/^SE[0-9][0-9][0-9]/)){//表示種別
if (tmp_SE.length >= 1){
tmp_SE += ',';
}
tmp_SE += i.substring(2,5);
}else{
tmp[num] = i + '=' + encodeURIComponent(val); num++;
}
}
});
if(tmp_SE != ''){ tmp_SE = '&SE=' + tmp_SE; }
var cond = tmp.join('&') + tmp_SE;
return cond;
};
itsmo.near_suumo.result = function(result){
// エラー処理
result = $(result);
var err = result.find('err').text();
if(err != 0) {
itsmo.lib.aplErrorWindow('W', '0003', 'suumo', '不動産検索');
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml( result.find('listhtml').text() );
return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
$(result).find('list').each(function(){
var prm = {};
prm['uid'] = $(this).find('uid').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['short_nm'] = $(this).find('nm').text();
prm['tip_c'] = $(this).find('tip_c').text();
prm['tip_o'] = $(this).find('tip_o').text();
var html = prm['tip_c'];
var div_id = itsmo.sub.set_tooltip_s(html,prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
});
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml( result.find('listhtml').text() );
itsmo.near_suumo.setCond();
};
//左リスト絞込みパネル
itsmo.near_suumo.changeWindow = function(){
var mode = $('input[name=suumo_SE]:checked').val();
switch(mode){
case '0':
itsmo.near_suumo.mode = 'rent';
$('#buy_sibo_win').hide();
$('#rent_sibo_win').show();
break;
case '1':
itsmo.near_suumo.mode = 'buy';
$('#rent_sibo_win').hide();
$('#buy_sibo_win').show();
break;
}
};
//リスト開く
itsmo.near_suumo.showCondSelect = function(e, divid){
var id = $(e).attr('id') + '_cond';
if(itsmo.near_suumo.opened_cond_window == id){ var bl = id };
itsmo.near_suumo.hideCondSelect(divid);
if (bl) {
return false;
}
itsmo.near_suumo.opened_cond_window = id;
$('#' + id).fadeIn('fast');
};
//リスト閉じる
itsmo.near_suumo.hideCondSelect = function(divid) {
if(!divid){ var divid = 'ajax_leftmenu_result'; }
itsmo.near_suumo.opened_cond_window = null;
$("#" + divid + " span[class^='sis-search-paka-waku0'] div.sis-search-paka-genre").fadeOut('fast');
};
//リストから選択
itsmo.near_suumo.setSearchCond = function(e, key, val) {
itsmo.near_suumo.hideCondSelect();
if (null != key && undefined != key) {
itsmo.near_suumo.condition[itsmo.near_suumo.mode][key] = val;
}
e = $(e);
var txt = e.text();
var i, f = null;
for (i = 0; i < 10; ++i) {
e = e.parent();
f = e.find('span.box-s');
if (f.length >= 1) {
break;
}
}
if (null == f) {
return false;
}
f.text(txt);
};
//アイコンオンオフ
itsmo.near_suumo.cond_toggle_icon = function(e,key,val) {
e = $(e);
var cl = e.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (isOn) {
e.find('span:first').attr('class', cl + '-off');
itsmo.near_suumo.condition['buy'][key] = '';
} else {
e.find('span:first').attr('class', cl.substring(0, cl.length - 4));
itsmo.near_suumo.condition['buy'][key] = val;
}
return false;
};
/*---------------------------------------------------------------
検索パネルからの検索
---------------------------------------------------------------*/
//絞込み検索パネル開く
itsmo.near_suumo.showCondWindow = function(mode) {
if(!mode){
mode = itsmo.near_suumo.mode;
itsmo.near_suumo.mode_panel = mode;
}
itsmo.near_suumo.setCondPanel();
switch (mode) {
case 'rent':
$('input[name=suumo_cond_SE]').val(['0']);
$('#ajax_suumo_cond_rent').show();
$('#ajax_suumo_cond_rent_k').show();
$('#ajax_suumo_cond_buy').hide();
$('#ajax_suumo_cond_buy_k').hide();
if (itsmo.map.isOldIE()) {//ie6,7はhide()だけでは消えないので
$('#ajax_suumo_cond_buy').css("visibility" , "hidden");
$('#ajax_suumo_cond_buy_k').css("visibility" , "hidden");
$('#ajax_suumo_cond_rent').css("visibility" , "visible");
$('#ajax_suumo_cond_rent_k').css("visibility" , "visible");
}
break;
case 'buy':
$('input[name=suumo_cond_SE]').val(['1']);
$('#ajax_suumo_cond_buy').show();
$('#ajax_suumo_cond_buy_k').show();
$('#ajax_suumo_cond_rent').hide();
$('#ajax_suumo_cond_rent_k').hide();
if (itsmo.map.isOldIE()) {//ie6,7はhide()だけでは消えないので
$('#ajax_suumo_cond_rent').css("visibility" , "hidden");
$('#ajax_suumo_cond_rent_k').css("visibility" , "hidden");
$('#ajax_suumo_cond_buy').css("visibility" , "visible");
$('#ajax_suumo_cond_buy_k').css("visibility" , "visible");
}
break;
}
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
itsmo.sub.map_getaddr(loc,function(result){ $("#ajax_suumo_cond span[class^='c-search-tbl-area-add']").text(result.items[0].address + ' 付近'); },4);
itsmo.lib.map_windowopen('ajax_suumo_cond');
};
//絞込み検索パネル切替
itsmo.near_suumo.changeCondWindow = function(){
var mode = $('input[name="suumo_cond_SE"]:checked').val();
switch(mode){
case '0':
mode = 'rent';
break;
case '1':
mode = 'buy';
break;
}
itsmo.near_suumo.mode_panel = mode;
itsmo.near_suumo.showCondWindow(mode);
};
//itsmo.near_suumo.conditionを左検索パネルに反映
itsmo.near_suumo.setCond = function() {
switch(itsmo.near_suumo.mode){
case 'rent':
$("#ajax_leftmenu_result #rent_sibo_win span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
var id = box.attr('id');
var key = (null == id || undefined == id) ? '' : id.replace('suumo_rent_','');
var n = itsmo.near_suumo.condition[itsmo.near_suumo.mode][key];
if (n == null || n == undefined) {
return;
}
e.find('ul li').each(function() {
var f = $(this).find('a');
if ('' == n || f.attr('onclick').indexOf(n) >= 0) {
box.text(f.text());
return false;
}
});
});
break;
case 'buy':
$("#ajax_leftmenu_result #buy_sibo_win span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
var id = box.attr('id');
var key = (null == id || undefined == id) ? '' : id.replace('suumo_buy_','');
var n = itsmo.near_suumo.condition[itsmo.near_suumo.mode][key];
if (n == null || n == undefined) {
return;
}
e.find('ul li').each(function() {
var f = $(this).find('a');
if ('' == n || f.attr('onclick').indexOf(n) >= 0) {
box.text(f.text());
return false;
}
});
});
var box = $("#ajax_leftmenu_result #buy_sibo_win div[class^='select-joken']");
box.find('a').each(function() {
var id = $(this).attr('id');
var key = id.replace('suumo_buy_','');
var cl = $(this).find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if(itsmo.near_suumo.condition['buy'][key] == ''){
if(isOn){$(this).find('span:first').attr('class', cl + '-off');}
}else if(itsmo.near_suumo.condition['buy'][key] == '1'){
if(!isOn){$(this).find('span:first').attr('class', cl.substring(0, cl.length - 4));}
}
});
break;
}
};
//itsmo.near_suumo.conditionを絞込パネルに反映
itsmo.near_suumo.setCondPanel = function() {
switch(itsmo.near_suumo.mode){
case 'rent':
$("#ajax_suumo_cond #ajax_suumo_cond_rent span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
var id = box.attr('id');
var key = (null == id || undefined == id) ? '' : id.replace('suumo_rent_panel_','');
var n = itsmo.near_suumo.condition[itsmo.near_suumo.mode][key];
if (n == null || n == undefined) {
n = '';
}
itsmo.near_suumo.condition_panel[itsmo.near_suumo.mode][key] = n;
e.find('ul li').each(function() {
var f = $(this).find('a');
if ('' == n || f.attr('onclick').indexOf(n) >= 0) {
box.text(f.text());
return false;
}
});
});
break;
case 'buy':
$("#ajax_suumo_cond #ajax_suumo_cond_buy span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
var id = box.attr('id');
var key = (null == id || undefined == id) ? '' : id.replace('suumo_buy_panel_','');
var n = itsmo.near_suumo.condition[itsmo.near_suumo.mode][key];
if (n == null || n == undefined) {
n = '';
}
itsmo.near_suumo.condition_panel[itsmo.near_suumo.mode][key] = n;
e.find('ul li').each(function() {
var f = $(this).find('a');
if ('' == n || f.attr('onclick').indexOf(n) >= 0) {
box.text(f.text());
return false;
}
});
});
var box = $("#ajax_suumo_cond #ajax_suumo_cond_buy div[class^='select-joken']");
box.find('a').each(function() {
var id = $(this).attr('id');
var key = id.replace('suumo_buy_panel_','');
var cl = $(this).find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if(itsmo.near_suumo.condition['buy'][key] == ''){
if(isOn){
$(this).find('span:first').attr('class', cl + '-off');
$(this).find('strong').removeClass('joken-on');
}
itsmo.near_suumo.condition_panel['buy'][key] = '';
}else if(itsmo.near_suumo.condition['buy'][key] == '1'){
itsmo.near_suumo.condition_panel['buy'][key] = '1';
if(!isOn){
$(this).find('span:first').attr('class', cl.substring(0, cl.length - 4));
$(this).find('strong').addClass('joken-on');
}
}
});
break;
}
$('#suumo_rent_panel_CNT').html(itsmo.vars.g_range_cnt + '件表示');
$('#suumo_buy_panel_CNT').html(itsmo.vars.g_range_cnt + '件表示');
itsmo.near_suumo.cnt = itsmo.vars.g_range_cnt;
};
//検索条件リセット
itsmo.near_suumo.CondReset = function() {
//itsmo.near_suumo.mode = 'rent';
//itsmo.near_suumo.mode_panel = 'rent';
itsmo.near_suumo.condition = { 'rent':{} , 'buy':{} };
itsmo.near_suumo.condition_panel = { 'rent':{} , 'buy':{} };
$("#ajax_suumo_cond #ajax_suumo_cond_rent_k span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
e.find('ul li').each(function() {
var f = $(this).find('a');
box.text(f.text());
return false;
});
});
$("#ajax_suumo_cond #ajax_suumo_cond_buy_k span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
e.find('ul li').each(function() {
var f = $(this).find('a');
box.text(f.text());
return false;
});
});
$('#ajax_suumo_cond #ajax_suumo_cond_rent_k #suumo_rent_panel_HOUI').find('span:first').attr('class', 'ic-tell-fudosan10-off').find('strong:first').attr('class', '');
$('#ajax_suumo_cond #ajax_suumo_cond_rent_k #suumo_rent_panel_PET').find('span:first').attr('class', 'ic-tell-camp15-off').find('strong:first').attr('class', '');
$('#ajax_suumo_cond #ajax_suumo_cond_buy_k #suumo_buy_panel_HOUI').find('span:first').attr('class', 'ic-tell-fudosan10-off').find('strong:first').attr('class', '');
$('#ajax_suumo_cond #ajax_suumo_cond_buy_k #suumo_buy_panel_PET').find('span:first').attr('class', 'ic-tell-camp15-off').find('strong:first').attr('class', '');
$('#ajax_suumo_cond #suumo_keyword').val('');
};
//リストから選択
itsmo.near_suumo.setSearchCondPanel = function(e, key, val) {
itsmo.near_suumo.hideCondSelect('ajax_suumo_cond');
if (null != key && undefined != key && key != 'CNT') {
itsmo.near_suumo.condition_panel[itsmo.near_suumo.mode_panel][key] = val;
}else if(key == 'CNT'){
itsmo.near_suumo.cnt = val;
}
e = $(e);
var txt = e.text();
var i, f = null;
for (i = 0; i < 10; ++i) {
e = e.parent();
f = e.find('span.box-s');
if (f.length >= 1) {
break;
}
}
if (null == f) {
return false;
}
f.text(txt);
};
//アイコンオンオフ
itsmo.near_suumo.cond_toggle_icon_panel = function(e,key,val) {
e = $(e);
var cl = e.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (isOn) {
e.find('span:first').attr('class', cl + '-off');
e.find('strong').removeClass('joken-on');
itsmo.near_suumo.condition_panel[itsmo.near_suumo.mode_panel][key] = '';
} else {
e.find('span:first').attr('class', cl.substring(0, cl.length - 4));
e.find('strong').addClass('joken-on');
itsmo.near_suumo.condition_panel[itsmo.near_suumo.mode_panel][key] = val;
}
return false;
};
//条件を含めるか??
itsmo.near_suumo.cond_toggle_keyword = function(e){
e = $(e);
var cl = e.find('span:first').attr('class');
if (cl == 'tel-check-on') {
e.find('span:first').attr('class', 'tel-check-off');
} else {
e.find('span:first').attr('class', 'tel-check-on');
}
return false;
};//--------------------------------------------------------------------------------------------------
// メニュー選択
//--------------------------------------------------------------------------------------------------
itsmo.tabikura = function() {};
itsmo.tabikura.docName = '';
itsmo.tabikura.docNameLeft = 'ajax_leftmenu_result';
itsmo.tabikura.docNameWin = 'ajax_tabikura_cond';
itsmo.tabikura.is_init = false;
itsmo.tabikura.cond = {};
itsmo.tabikura.opened_cond_window = null;
itsmo.tabikura.flagsHotel = {};
itsmo.tabikura.flagsPlan = {};
itsmo.tabikura.start = function() {
itsmo.tabikura.docName = itsmo.tabikura.docNameLeft;
itsmo.tabikura.cond = {};
itsmo.tabikura.cond['date'] = '';
itsmo.tabikura.cond['stay'] = '1';
itsmo.tabikura.cond['num'] = '2';
itsmo.tabikura.cond['room'] = '1';
itsmo.tabikura.cond['sort'] = 'location';
itsmo.vars.g_range_genre = 'tabikura';
itsmo.tabikura.cond_toggle_init();
itsmo.tabikura.search();
};
itsmo.tabikura.setSearchCond = function(e, key, val) {
itsmo.tabikura.hideCondSelect();
var sels = itsmo.tabikura.cond[key];
if (null != key && undefined != key) {
itsmo.tabikura.cond[key] = val;
}
elm = $(e);
var txt = elm.text();
var i, f = null;
for (i = 0; i < 10; ++i) {
elm = elm.parent();
fm = elm.find('span.box-s');
if (fm.length >= 1) {
break;
}
}
if (null == fm) {
return false;
}
elm.find('li').each(function() {
var opt = $(this);
if (opt.css('display') == 'none') {
opt.css('display', 'block');
}
});
fm.text(txt);
$(e).parent().css('display', 'none');
};
itsmo.tabikura.setSearchCondInit = function(key, val) {
itsmo.tabikura.hideCondSelect();
var sel = key + val;
var elem_p = $('#' + itsmo.tabikura.docNameWin + ' #tabikura_' + key + '_cond');
var setText = '';
var opt, elem, line = null;
$.each(elem_p.find('ul li'), function(i, val) {
opt = $(this);
if (opt.css('display') == 'none') {
opt.css('display', 'block');
}
elem = $(this).find('a');
id = elem.attr('id');
if (sel == id) {
setText = elem.text();
line = opt;
}
});
if (!setText) return false;
var cond_p = elem_p.parent().parent().find('span.box-s');
cond_p.text(setText);
line.css('display', 'none');
};
itsmo.tabikura.setCond = function() {
var opt, f, line = null;
$("#" + itsmo.tabikura.docNameLeft + " span[class^='sis-search-paka-waku0']").each(function() {
var e = $(this);
var box = e.find('span.box-s');
var id = box.attr('id');
var key = (null == id || undefined == id) ? '' : id.substring(9);
var val = itsmo.tabikura.cond[key];
if (val == null || val == undefined) {
return;
}
var sel = key + val;
e.find('ul li').each(function() {
opt = $(this);
if (opt.css('display') == 'none') {
opt.css('display', 'block');
}
var f = $(this).find('a');
var aid = f.attr('id');
if (sel == aid) {
box.text(f.text());
line = opt;
}
});
line.css('display', 'none');
});
$("#" + itsmo.tabikura.docNameLeft + " input[name='flags_hotel']").each(function() {
var elem_p = $(this).parent().parent();
var id = elem_p.attr('id');
id = id.substring(5); // h[p]_数値
if (itsmo.tabikura.flagsHotel[id]) {
var cl = elem_p.find('span:first').attr('class');
elem_p.find('span:first').attr('class', cl.substring(0, cl.length - 4)).find('input:hidden').val('1');
}
});
};
itsmo.tabikura.showCondSelect = function(e) {
var id = $(e).attr('id') + '_cond';
var pe = $(e).parent();
var bl = itsmo.tabikura.opened_cond_window == id;
itsmo.tabikura.hideCondSelect();
if (bl) {
return false;
}
itsmo.tabikura.opened_cond_window = id;
pe.find("div[id='" + id + "']").fadeIn('fast');
};
itsmo.tabikura.hideCondSelect = function() {
itsmo.tabikura.opened_cond_window = null;
$("#" + itsmo.tabikura.docName + " span[class^='sis-search-paka-waku0'] div.sis-search-paka-genre").fadeOut('fast');
};
itsmo.tabikura.cond_toggle_init = function() {
$("#" + itsmo.tabikura.docNameWin + " a[id^='flag_']").each(function() {
var bn = $(this);
var cl = bn.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (isOn) {
bn.find('span:first').attr('class', cl + '-off').find('input:hidden').val('0');
bn.find('strong').removeClass('joken-on');
}
});
return false;
};
itsmo.tabikura.cond_toggle_icon = function(e) {
e = $(e);
id = e.attr('id');
id = id.substring(5); // h[p]_数値
ids = id.substring(2); // 数値
var cl = e.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (isOn) {
e.find('span:first').attr('class', cl + '-off').find('input:hidden').val('0');
e.find('strong').removeClass('joken-on');
if (e.find('input').attr('name') == 'flags_hotel') {
if (itsmo.tabikura.flagsHotel[id]) delete itsmo.tabikura.flagsHotel[id];
} else if (e.find('input').attr('name') == 'flags_plan') {
if (itsmo.tabikura.flagsPlan[id]) delete itsmo.tabikura.flagsPlan[id];
}
} else {
e.find('span:first').attr('class', cl.substring(0, cl.length - 4)).find('input:hidden').val('1');
e.find('strong').addClass('joken-on');
if (e.find('input').attr('name') == 'flags_hotel') {
if (!itsmo.tabikura.flagsHotel[id]) itsmo.tabikura.flagsHotel[id] = ids;
} else if (e.find('input').attr('name') == 'flags_plan') {
if (!itsmo.tabikura.flagsPlan[id]) itsmo.tabikura.flagsPlan[id] = ids;
}
}
return false;
};
itsmo.tabikura.cond_toggle_icon_to_win = function(elem, name) {
var id = elem.attr("id");
id = id.substring(5); // h[p]_数値
var cl = elem.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (itsmo.tabikura.flagsHotel[id] || itsmo.tabikura.flagsPlan[id]) {
if (isOn) {
elem.find('span:first').attr('class', cl).find('input:hidden').val('1');
} else {
elem.find('span:first').attr('class', cl.substring(0, cl.length - 4)).find('input:hidden').val('1');
}
elem.find('strong').addClass('joken-on');
} else {
if (isOn) {
elem.find('span:first').attr('class', cl + '-off').find('input:hidden').val('0');
} else {
elem.find('span:first').attr('class', cl).find('input:hidden').val('0');
}
elem.find('strong').removeClass('joken-on');
}
};
itsmo.tabikura.setStayList = function(el) {
weeks = new Array("日","月","火","水","木","金","土");
var today = new Date();
var date = new Date();
var month, day, week, mday = 0;
var lists = {};
for (i = 0; i < 180; i++) {
date.setTime(today.getTime() + (i * 24 * 3600 * 1000));
month = date.getMonth() + 1;
day = date.getDate();
week = date.getDay();
if ( month < 10 ) month = '0' + month;
if ( day < 10 ) day = '0' + day;
mday = month + '月' + day + '日(' + weeks[week] + ')~';
lists[i] = "" + mday + "";
}
var listStr = "日付指定なし\n";
for (n in lists) {
listStr += lists[n] + "\n";
}
if (el) {
el.find("#tabikura_date_cond").find("ul").html(listStr);
} else {
$("#" + itsmo.tabikura.docName + " #tabikura_date_cond").find("ul").html(listStr);
}
};
//--------------------------------------------------------------------------------------------------
// 検索
//--------------------------------------------------------------------------------------------------
// 左メニューの検索ボタン
itsmo.tabikura.search = function(act, freewdFlg) {
itsmo.tabikura.hideCondSelect();
itsmo.sub.map_tab_change('range', ['tabikura']);
if (act != 'page') {
itsmo.vars.g_range_page = 1;
}
// フリーワード検索のみ
var freewdOnly = false;
var word = $.trim($('#tabikura_freewd').val());
itsmo.tabikura.cond['freewd'] = word;
if (freewdFlg && word.length >= 1 && $('#tabikura_freewd_above span').attr('class').indexOf('check-off') >= 0) {
freewdOnly = true;
}
var cond = [];
var i;
for (i in itsmo.tabikura.cond) {
if(i == 'cnt'){ itsmo.vars.g_range_cnt = itsmo.vars.g_range_flag_rowcnt = itsmo.tabikura.cond['cnt']; }
cond.push(i + '=' + encodeURIComponent(itsmo.tabikura.cond[i]));
}
// 日本測地→世界測地
var dtm = ZDC.tkyTowgs(itsmo.lib.toLatLon(itsmo.vars.g_map_search_location));
//dtm = itsmo.lib.toMilliSec(dtm);
i = itsmo.vars.g_map_search_location;
var prm = 'lat=' + i.lat
+ '&lon=' + i.lon
+ '&dlat=' + dtm.lat
+ '&dlon=' + dtm.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&page=' + itsmo.vars.g_range_page
+ '&cnt=' + itsmo.vars.g_range_cnt
;
if (freewdOnly) {
prm += '&freewd=' + word;
} else {
var hs = [], ps = [];
for (j in itsmo.tabikura.flagsHotel) {
hs.push(itsmo.tabikura.flagsHotel[j]);
}
prm += '&opt_h=' + hs.join('-');
for (k in itsmo.tabikura.flagsPlan) {
ps.push(itsmo.tabikura.flagsPlan[k]);
}
prm += '&opt_p=' + ps.join('-');
prm += '&' + cond.join('&'); // freewd含有
}
itsmo.lib.map_waitopen();
itsmo.lib.XMLHttpRequest2_send('/map/ajax_near_tabikura.php', itsmo.tabikura.result, 'GET', prm);
};
itsmo.tabikura.result = function (result) {
itsmo.lib.map_waitclose();
// エラー処理
result = $(result);
var err = result.find('err').text();
if(err != 0) {
itsmo.lib.aplErrorWindow('W', '0003', 'tabikura', 'ホテル検索');
return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
$(result).find('list').each(function(){
var prm = {};
prm['uid'] = $(this).find('id').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['imgurl'] = $(this).find('imgurl').text();
prm['title'] = $(this).find('title').text();
prm['short_title'] = $(this).find('short_title').text();
prm['icon'] = $(this).find('icon').text();
prm['detail'] = $(this).find('detail').text();
prm['url_detail'] = $(this).find('url_detail').text();
prm['max_price'] = $(this).find('max_price').text();
prm['min_price'] = $(this).find('min_price').text();
prm['tip_c'] = $(this).find('tiphtmlc').text();
prm['tip_o'] = $(this).find('tiphtmlo').text();
$(this).find('plan').each(function(){
var prm_p = {};
prm_p['pcnt'] = $(this).find('j').text();
prm_p['plan_title'] = $(this).find('plan_title').text();
prm_p['plan_price'] = $(this).find('plan_price').text();
prm_p['plan_price_sum'] = $(this).find('plan_price_sum').text();
prm_p['url_detail'] = $(this).find('url_detail').text();
prm_p['url_travel'] = $(this).find('url_travel').text();
prm_p['site_code'] = $(this).find('site_code').text();
prm_p['site_name'] = $(this).find('site_name').text();
prm_p['site_image_url'] = $(this).find('site_image_url').text();
prm_p['siteHotelCode'] = $(this).find('siteHotelCode').text();
prm_p['sitePlanCode'] = $(this).find('sitePlanCode').text();
prm['plan'] = prm_p;
});
var html = prm['tip_c'];
var div_id = itsmo.sub.set_tooltip_s(html,prm);
// bind
$('#' + div_id + ' a').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
});
itsmo.tabikura.docName = itsmo.tabikura.docNameLeft;
itsmo.sub.map_tab_sethtml( result.find('listhtml').text() );
itsmo.tabikura.setStayList();
itsmo.tabikura.setCond();
};
itsmo.tabikura.set_page_and_search = function(page) {
itsmo.vars.g_range_page = page;
itsmo.tabikura.search('page');
};
// 検索条件小窓表示
itsmo.tabikura.showCond = function() {
itsmo.tabikura.docName = itsmo.tabikura.docNameWin;
if (!itsmo.tabikura.is_init) {
itsmo.tabikura.is_init = true;
}
itsmo.tabikura.setClassificationCond();
itsmo.lib.map_windowopen(itsmo.tabikura.docNameWin);
};
// 検索条件小窓初期設定
itsmo.tabikura.setClassificationCond = function() {
itsmo.tabikura.cond['cnt'] = itsmo.vars.g_range_cnt;
itsmo.sub.map_getaddr(itsmo.vars.g_map_search_location, function(result) {
if(result.status == 0) {
var addr = result.items[0].address + ' 付近';
} else {
var addr = '住所なし';
}
$("#" + itsmo.tabikura.docNameWin + " .c-search-tbl-area-add").text(addr);
});
var elem = $("#" + itsmo.tabikura.docNameWin);
itsmo.tabikura.setStayList(elem);
$.each(itsmo.tabikura.cond, function(key, val) {
itsmo.tabikura.setSearchCondInit(key, val);
});
elem.find("a[id^='flag_']").each(function() {
elem = $(this);
itsmo.tabikura.cond_toggle_icon_to_win(elem);
});
if (itsmo.tabikura.cond['freewd']) elem.find("#tabikura_freewd").val(itsmo.tabikura.cond['freewd']);
};
itsmo.tabikura.onClickIncludeFreewd = function(e) {
$(e).find('span').toggleClass('tel-check-on').toggleClass('tel-check-off');
};
// 検索条件小窓の検索ボタン
itsmo.tabikura.submit = function() {
itsmo.lib.map_windowclose();
itsmo.tabikura.search(null, true);
};
itsmo.tabikura.cancel = function() {
itsmo.tabikura.docName = itsmo.tabikura.docNameLeft;
itsmo.lib.map_windowclose();
};
itsmo.near_season = function() {};
itsmo.near_season.mode = 'hanabi';
itsmo.near_season.opened_cond_window = null;
itsmo.near_season.clickCalCnt = 0;//カレンダー日付クリック回数
itsmo.near_season.panelCalOpenFlg = false;//絞込みパネルのカレンダーを開いているかのフラグ
itsmo.near_season.tmp_calday = {};//カレンダーの選択した日付を一時的格納しておくフォルダ
itsmo.near_season.cond = {};//検索条件
itsmo.near_season.start = function(mode) {
if(mode){
itsmo.near_season.mode = mode;
}
itsmo.near_season.cond = {};
itsmo.vars.g_range_page = 1;
itsmo.vars.g_range_genre = itsmo.near_season.mode;
itsmo.near_season.clear();
itsmo.near_season.search();
};
itsmo.near_season.clear = function() {
e = $('#season_select_joken a');
var cl = '';
var isOn = '';
for(var i = 0 ; i < e.length ; i++){
cl = e.find('span:first').attr('class');
isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (!isOn) {
e.find('span:first').attr('class', cl + '-off');
e.find('strong').removeClass('joken-on');
if(e.find('input:hidden').length){
e.find('input:hidden').val('');
}
}
}
s_condition = $('#season_condition_flg');
s_condition.find('span:first').attr('class', 'tel-check-on');
};
itsmo.near_season.search = function(mode) {
if(!mode){
mode = itsmo.near_season.mode;
}
itsmo.sub.map_tab_change('range', ['season', mode]);
var cond = [], i;
for (i in itsmo.near_season.cond) {
cond.push(i + '=' + encodeURIComponent(itsmo.near_season.cond[i]));
}
cond = cond.join('&');
if (cond.length >= 1) {
cond = '&' + cond;
}
i = itsmo.vars.g_map_search_location;
var prm = 'lat=' + i.lat
+ '&lon=' + i.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&page=' + itsmo.vars.g_range_page
+ '&cnt=' + itsmo.vars.g_range_cnt
+ '&mode=' + mode
+ cond
;
itsmo.lib.map_waitopen();
itsmo.lib.XMLHttpRequest2_send('/map/ajax_near_season.php', itsmo.near_season.result, 'GET', prm);
};
itsmo.near_season.result = function (result) {
// エラー処理
result = $(result);
var err = result.find('err').text();
if(err != 0) {
itsmo.lib.aplErrorWindow('W', '0003', 'season', '季節特集');
return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
$(result).find('item').each(function(){
var prm = {};
prm['uid'] = $(this).find('uid').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('nm').text();
prm['short_nm'] = $(this).find('short_nm').text();
prm['tip_c'] = $(this).find('tip_c').text();
prm['tip_o'] = $(this).find('tip_o').text();
var html = prm['tip_c'];
var div_id = itsmo.sub.set_tooltip_s(html,prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
});
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml( result.find('listhtml').text() );
itsmo.near_season.setCalendarInit();
itsmo.near_season.setCond();
$("#ajax_leftmenu_result input:text[name='keyword']").clearField().blur().keypress(function(e) {
if (13 == e.which) {
itsmo.near_season.cond_search();
}
});;
};
//検索ボタン
itsmo.near_season.cond_search = function() {
itsmo.vars.g_range_page = 1;
var key_e = $('#ajax_leftmenu_result').find("input:[name='keyword']");
var keyword = '';
if(key_e != undefined){
if(key_e.val() != key_e.attr('rel')){
keyword = key_e.val();
}
}
if(keyword){
itsmo.near_season.cond['keyword'] = keyword;
}else{
delete(itsmo.near_season.cond['keyword']);
}
itsmo.near_season.search();
};
//ページング
itsmo.near_season.set_pange_and_search = function(page) {
itsmo.vars.g_range_page = page;
itsmo.near_season.search();
};
//絞り込み検索ボタン
itsmo.near_season.cond_search_panel = function() {
itsmo.vars.g_range_page = 1;
itsmo.near_season.cond = {};
if($('#ajax_season_cond #season_condition_flg').find('span:first').attr('class') == 'tel-check-on'){
itsmo.near_season.setHiddenVal();
}else{
$('#ajax_season_cond').find('input:hidden').each(function(){
var val = $(this).val();
var name = $(this).attr('name');
if(name == 'cnt'){
$(this).val(10);
}else{
$(this).val('');
}
});
}
var keyword = $('#ajax_season_cond #near_season_keyword').val();
if(keyword){
itsmo.near_season.cond['keyword'] = keyword;
}else{
delete(itsmo.near_season.cond['keyword']);
}
itsmo.near_season.search();
itsmo.near_season.hideCond();
};
//絞り込み検索パネルから条件設定
itsmo.near_season.setHiddenVal = function(){
$('#ajax_season_cond').find('input:hidden').each(function(){
var val = $(this).val();
var name = $(this).attr('name');
if(name == 'cnt'){
if(val){itsmo.vars.g_range_cnt = val;itsmo.vars.g_range_flag_rowcnt = val;}
}else{
itsmo.near_season.cond[name] = val;
}
});
};
//検索条件引継ぎ
itsmo.near_season.setCond = function(){
if(itsmo.near_season.cond['date_s'] && itsmo.near_season.cond['date_e']){
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_s']").html(itsmo.near_season.cond['date_s']);
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html(itsmo.near_season.cond['date_e']);
}else{
$('#ajax_leftmenu_result #season_hanabi_cal_s').html('日付指定なし');
$('#ajax_leftmenu_result #season_hanabi_cal_e').html('日付指定なし');
}
if(itsmo.near_season.cond['parking']){ $('#ajax_leftmenu_result #season_parking').click(); }
if(itsmo.near_season.cond['charge']){ $('#ajax_leftmenu_result #season_charge').click(); }
if(itsmo.near_season.cond['festival']){ $('#season_festival').click(); }
if(itsmo.near_season.cond['event']){ $('#season_event').click(); }
if(itsmo.near_season.cond['hotel']){ $('#season_hotel').click(); }
if(itsmo.near_season.cond['yakei']){ $('#season_yakei').click(); }
if(itsmo.near_season.cond['kyoshou']){ $('#season_kyoshou').click(); }
if(itsmo.near_season.cond['kakurega']){ $('#season_kakurega').click(); }
if(itsmo.near_season.cond['plan']){ $('#season_plan').click(); }
if(itsmo.near_season.cond['sakurafes']){ $('#season_sakurafes').click(); }
if(itsmo.near_season.cond['night']){ $('#season_night').click(); }
if(itsmo.near_season.cond['shop']){ $('#season_shop').click(); }
if(itsmo.near_season.cond['party']){ $('#season_party').click(); }
if(itsmo.near_season.cond['sort']){ $('#ajax_leftmenu_result #season_sort_' + itsmo.near_season.cond['sort']).click(); }
};
//絞込みパネルを開く
itsmo.near_season.showCond = function(){
itsmo.near_season.setCondPanel();
var loc = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
itsmo.sub.map_getaddr(loc,function(result){ $("#ajax_season_cond span[class^='c-search-tbl-area-add']").text(result.items[0].address + ' 付近'); },4);
// 表示条件調整。
$('#season_calendar_tr').show();
$('#season_sort_div a').hide().eq(0).show();
$('#season_select_joken a').hide().eq(0).show();
$('tr#tr_condle_joken').show();
if ('hanabi' == itsmo.near_season.mode) {
var e = $('#season_sort_div a');
e.eq(1).show();
e.eq(3).show();
var tmp = $('#season_select_joken');
for (i = 0; i < 10; ++i) {
tmp = tmp.parent();
if (tmp.get(0).tagName.toUpperCase() == 'TR') {
tmp.hide();
break;
}
}
} else if ('koyo' == itsmo.near_season.mode) {
$('#season_sort_div a').eq(2).show();
//$('#season_select_joken a').eq(2).show();
$('#tr_condle_joken').hide();
} else if ('spring' == itsmo.near_season.mode) {
var e = $('#season_sort_div a');
e.eq(2).show();
$('tr#tr_condle_joken').hide();
} else if ('illumi' == itsmo.near_season.mode) {
var e = $('#season_sort_div a');
e.eq(2).show();
e.eq(3).show();
//$('#season_select_joken a').eq(3).show();
//$('#season_select_joken a').eq(4).show();
} else if('hotel' == itsmo.near_season.mode) {
$('#season_calendar_tr').hide();
$('#season_sort_div a').eq(2).show();
$('#season_select_joken a').eq(0).hide();
$('#season_select_joken a').eq(9).show();
} else if('dinner' == itsmo.near_season.mode){
$('#season_calendar_tr').hide();
$('#season_sort_div a').eq(2).show();
var e = $('#season_select_joken');
e.find('a').eq(0).hide();
e.find('a').eq(5).show();
e.find('a').eq(6).show();
e.find('a').eq(7).show();
e.find('a').eq(8).show();
e.find('a').eq(9).show();
}
itsmo.lib.map_windowopen('ajax_season_cond');
};
//絞込みパネルを閉じる
itsmo.near_season.hideCond = function(){
itsmo.lib.map_windowclose('ajax_season_cond');
};
//絞込みパネルに条件引継ぎ
itsmo.near_season.setCondPanel = function(){
if(itsmo.near_season.cond['date_s'] && itsmo.near_season.cond['date_e']){
$("#ajax_season_cond span[id^='season_hanabi_cal_s_panel']").html(itsmo.near_season.cond['date_s']);
$("#ajax_season_cond span[id^='season_hanabi_cal_e_panel']").html(itsmo.near_season.cond['date_e']);
}else{
$('#ajax_season_cond #season_hanabi_cal_s_panel').html('日付指定なし');
$('#ajax_season_cond #season_hanabi_cal_e_panel').html('日付指定なし');
}
if(itsmo.near_season.cond['parking']){
$('#ajax_season_cond #season_parking_panel').find('span:first').attr('class', 'ic-tell-p');
$('#ajax_season_cond #season_parking_panel').find('strong').addClass('joken-on');
}else{
$('#ajax_season_cond #season_parking_panel').find('span:first').attr('class', 'ic-tell-p-off');
$('#ajax_season_cond #season_parking_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['charge']){
$('#ajax_season_cond #season_charge_panel').find('span:first').attr('class', 'ic-tell-charge');
$('#ajax_season_cond #season_charge_panel').find('strong').addClass('joken-on');
}else{
$('#ajax_season_cond #season_charge_panel').find('span:first').attr('class', 'ic-tell-charge-off');
$('#ajax_season_cond #season_charge_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['festival']){
$('#season_festival_panel').find('span:first').attr('class', 'ic-tell-koyo');
$('#season_festival_panel').find('strong').addClass('joken-on');
}else{
$('#season_festival_panel').find('span:first').attr('class', 'ic-tell-koyo-off');
$('#season_festival_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['event']){
$('#season_event_panel').find('span:first').attr('class', 'ic-tell-illumi02');
$('#season_eventl_panel').find('strong').addClass('joken-on');
}else{
$('#season_event_panel').find('span:first').attr('class', 'ic-tell-illumi02-off');
$('#season_event_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['hanabi']){
$('#season_hanabi_panel').find('span:first').attr('class', 'ic-tell-illumi01');
$('#season_hanabi_panel').find('strong').addClass('joken-on');
}else{
$('#season_hanabi_panel').find('span:first').attr('class', 'ic-tell-illumi01-off');
$('#season_hanabi_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['hotel']){
$('#season_hotel_panel').find('span:first').attr('class', 'ic-tell-oz01');
$('#season_hotel_panel').find('strong').addClass('joken-on');
$('#season_hotel_panel').find('input:hidden').val(1);
}else{
$('#season_hotel_panel').find('span:first').attr('class', 'ic-tell-oz01-off');
$('#season_hotel_panel').find('strong').removeClass('joken-on');
$('#season_hotel_panel').find('input:hidden').val('');
}
if(itsmo.near_season.cond['yakei']){
$('#season_yakei_panel').find('span:first').attr('class', 'ic-tell-oz02');
$('#season_yakei_panel').find('strong').addClass('joken-on');
$('#season_yakei_panel').find('input:hidden').val(1);
}else{
$('#season_yakei_panel').find('span:first').attr('class', 'ic-tell-oz02-off');
$('#season_yakei_panel').find('strong').removeClass('joken-on');
$('#season_yakei_panel').find('input:hidden').val('');
}
if(itsmo.near_season.cond['kyoshou']){
$('#season_kyoshou_panel').find('span:first').attr('class', 'ic-tell-oz03');
$('#season_kyoshou_panel').find('strong').addClass('joken-on');
$('#season_kyoshou_panel').find('input:hidden').val(1);
}else{
$('#season_kyoshou_panel').find('span:first').attr('class', 'ic-tell-oz03-off');
$('#season_kyoshou_panel').find('strong').removeClass('joken-on');
$('#season_kyoshou_panel').find('input:hidden').val('');
}
if(itsmo.near_season.cond['kakurega']){
$('#season_kakurega_panel').find('span:first').attr('class', 'ic-tell-oz04');
$('#season_kakurega_panel').find('strong').addClass('joken-on');
$('#season_kakurega_panel').find('input:hidden').val(1);
}else{
$('#season_kakurega_panel').find('span:first').attr('class', 'ic-tell-oz04-off');
$('#season_kakurega_panel').find('strong').removeClass('joken-on');
$('#season_kakurega_panel').find('input:hidden').val('');
}
if(itsmo.near_season.cond['plan']){
$('#season_plan_panel').find('span:first').attr('class', 'ic-tell-oz05');
$('#season_plan_panel').find('strong').addClass('joken-on');
$('#season_plan_panel').find('input:hidden').val(1);
}else{
$('#season_plan_panel').find('span:first').attr('class', 'ic-tell-oz05-off');
$('#season_plan_panel').find('strong').removeClass('joken-on');
$('#season_plan_panel').find('input:hidden').val('');
}
if(itsmo.near_season.cond['sakurafes']){
$('#season_sakurafes_panel').find('span:first').attr('class', 'ic-tell-sp01');
$('#season_sakurafes_panel').find('strong').addClass('joken-on');
}else{
$('#season_sakurafes_panel').find('span:first').attr('class', 'ic-tell-sp01-off');
$('#season_sakurafes_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['night']){
$('#season_night_panel').find('span:first').attr('class', 'ic-tell-sp02');
$('#season_night_panel').find('strong').addClass('joken-on');
}else{
$('#season_night_panel').find('span:first').attr('class', 'ic-tell-sp02-off');
$('#season_night_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['shop']){
$('#season_shop_panel').find('span:first').attr('class', 'ic-tell-sp03');
$('#season_shop_panel').find('strong').addClass('joken-on');
}else{
$('#season_shop_panel').find('span:first').attr('class', 'ic-tell-sp03-off');
$('#season_shop_panel').find('strong').removeClass('joken-on');
}
if(itsmo.near_season.cond['party']){
$('#season_party_panel').find('span:first').attr('class', 'ic-tell-party');
$('#season_party_panel').find('strong').addClass('joken-on');
}else{
$('#season_party_panel').find('span:first').attr('class', 'ic-tell-party-off');
$('#season_party_panel').find('strong').removeClass('joken-on');
}
e = $("#ajax_leftmenu_result div:visible").filter('.sibo-normal, .sibo-rich').find("input:text[name='keyword']");
f = (null != itsmo.near_season.cond['keyword'] != itsmo.near_season.cond['keyword']) ? itsmo.near_season.cond['keyword'] : '';
$('#near_season_keyword').val(e.length >= 1 && (e.val() != e.attr('rel')) ? e.val() : f);
$('#ajax_season_cond #season_cnt_panel').html(itsmo.vars.g_range_cnt + '件表示');
if(itsmo.near_season.cond['sort']){
itsmo.near_season.cond_sort_reset();
var sort = itsmo.near_season.cond['sort'];
if(sort.indexOf('_desc') != -1){
sort = sort.replace('_desc','');
$('#ajax_season_cond #season_sort_panel_'+ sort).click();
}else if(sort.indexOf('_asc') != -1){
sort = sort.replace('_asc','');
$('#ajax_season_cond #season_sort_panel_'+ sort).click().click();
}else if(sort == 'famous'){
$('#ajax_season_cond #season_sort_panel_famous').click();
}else {
$('#ajax_season_cond #season_sort_panel_dist').click();
}
}else{
$('#ajax_season_cond #season_sort_panel_dist').click();
}
$('#ajax_season_cond').find('input:hidden').each(function(){
var val = '';
if(itsmo.near_season.cond[$(this).attr('name')]){
val = itsmo.near_season.cond[$(this).attr('name')];
$(this).val(val);
}
});
};
//カレンダーを開く
itsmo.near_season.showCondSelectCal = function(mode){
itsmo.near_season.hideCondSelect();
if(mode == 'panel'){
itsmo.near_season.panelCalOpenFlg = true;
$('#ajax_season_cond #hanabi_cal_content_panel').html($('#season_map_calendar_html').html());
$('#ajax_season_cond #hanabi_calender_panel_div').show();
if(itsmo.near_season.clickCalCnt == 0){
var tmpHtml = $("#ajax_season_cond span[id^='season_hanabi_cal_s']").html();
$("#ajax_season_cond span[id^='season_hanabi_cal_s']").html('' + tmpHtml + '');
}else{
var tmpHtml = $("#ajax_season_cond span[id^='season_hanabi_cal_e']").html();
$("#ajax_season_cond span[id^='season_hanabi_cal_e']").html('' + tmpHtml + '');
}
}else{
$('#m-left').addClass('hanabi-index');
$('#ajax_leftmenu_result #hanabi_cal_content').html($('#season_map_calendar_html').html());
$('#ajax_leftmenu_result #hanabi_calender_div').show();
if(itsmo.near_season.clickCalCnt == 0){
var tmpHtml = $("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_s']").html();
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_s']").html('' + tmpHtml + '');
}else{
var tmpHtml = $("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html();
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html('' + tmpHtml + '');
}
}
};
//カレンダーを開く(終了日から)
itsmo.near_season.showCondSelectCalEnd = function(mode){
if((itsmo.near_season.cond['date_e'] && itsmo.near_season.cond['date_s']) && (itsmo.near_season.cond['date_e'] != itsmo.near_season.cond['date_s'])){
itsmo.near_season.clickCalCnt = 1;
if(mode == 'panel'){
$("#ajax_season_cond span[id^='season_hanabi_cal_e']").html('日付指定なし');
}else{
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html('日付指定なし');
}
itsmo.near_season.tmp_calday['s'] = itsmo.near_season.cond['date_s'];
itsmo.near_season.tmp_calday['e'] = itsmo.near_season.cond['date_s'];
$('#season_map_calendar_html .elected').removeClass('elected');
$("#season_map_calendar_html table td div[id^='cal_day_"+ itsmo.near_season.cond['date_s'] +"']").addClass('elected');
}
itsmo.near_season.showCondSelectCal(mode);
};
//カレンダーを閉める
itsmo.near_season.showCondCloseCal = function(mode){
if(mode == 'panel'){
itsmo.near_season.panelCalOpenFlg = false;
$('#ajax_season_cond #hanabi_calender_panel_div').hide();
var date_s = $("#ajax_season_cond input[name='date_s']").val();
var date_e = $("#ajax_season_cond input[name='date_e']").val();
if(!date_s){
date_s = '日付指定なし';
}
if(!date_e){
date_e = '日付指定なし';
}
$("#ajax_season_cond span[id='season_hanabi_cal_s_panel']").html(date_s);
$("#ajax_season_cond span[id='season_hanabi_cal_e_panel']").html(date_e);
}else{
$('#m-left').removeClass('hanabi-index');
$('#ajax_leftmenu_result #hanabi_calender_div').hide();
if(itsmo.near_season.cond['date_s']){
var sHtml = itsmo.near_season.cond['date_s'];
}else{
var sHtml = '日付指定なし';
}
if(itsmo.near_season.cond['date_e']){
var eHtml = itsmo.near_season.cond['date_e'];
}else{
var eHtml = '日付指定なし';
}
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_s']").html(sHtml);
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html(eHtml);
}
delete(itsmo.near_season.tmp_calday['e']);
delete(itsmo.near_season.tmp_calday['s']);
};
//カレンダーリセット
itsmo.near_season.calReset = function(mode){
delete(itsmo.near_season.cond['date_e']);
delete(itsmo.near_season.cond['date_s']);
if(mode == 'panel'){
//$("#ajax_season_cond span[id^='season_hanabi_cal_']").html('日付指定なし');
$("#ajax_season_cond div[id^='hanabi_cal_content'] .elected").removeClass('elected');
$("#ajax_season_cond input[name='date_s']").val('');
$("#ajax_season_cond input[name='date_e']").val('');
$('#season_map_calendar_html').html($('#ajax_season_cond #hanabi_cal_content_panel').html());
}else{
//$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_']").html('日付指定なし');
$('#hanabi_cal_content .elected').removeClass('elected');
$('#season_map_calendar_html').html($('#ajax_leftmenu_result #hanabi_cal_content').html());
}
itsmo.near_season.showCondCloseCal(mode);
};
//カレンダー決定
itsmo.near_season.calDecision = function(){
if(itsmo.near_season.tmp_calday['s']){
itsmo.near_season.cond['date_s'] = itsmo.near_season.tmp_calday['s'];
}else{
itsmo.near_season.showCondCloseCal();
return false;
}
if(itsmo.near_season.tmp_calday['e']){
itsmo.near_season.cond['date_e'] = itsmo.near_season.tmp_calday['e'];
}else{
itsmo.near_season.cond['date_e'] = itsmo.near_season.tmp_calday['s'];
}
/*
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_s']").html(itsmo.near_season.cond['date_s']);
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html(itsmo.near_season.cond['date_e']);
*/
$('#season_map_calendar_html').html($('#ajax_leftmenu_result #hanabi_cal_content').html());
itsmo.near_season.showCondCloseCal();
};
//カレンダー決定絞込みパネル
itsmo.near_season.calDecisionPanel = function(){
if(itsmo.near_season.tmp_calday['s']){
$("#ajax_season_cond input[name='date_s']").val(itsmo.near_season.tmp_calday['s']);
}else{
itsmo.near_season.showCondCloseCal('panel');
return false;
}
if(itsmo.near_season.tmp_calday['e']){
$("#ajax_season_cond input[name='date_e']").val(itsmo.near_season.tmp_calday['e']);
}else{
$("#ajax_season_cond input[name='date_e']").val(itsmo.near_season.tmp_calday['s']);
}
//var date_s = $("#ajax_season_cond input[name='date_s']").val();
//var date_e = $("#ajax_season_cond input[name='date_e']").val();
//$("#ajax_season_cond span[id='season_hanabi_cal_s_panel']").html(date_s);
//$("#ajax_season_cond span[id='season_hanabi_cal_e_panel']").html(date_e);
$('#season_map_calendar_html').html($('#ajax_season_cond #hanabi_cal_content_panel').html());
itsmo.near_season.showCondCloseCal('panel');
};
//リスト閉じる
itsmo.near_season.hideCondSelect = function() {
itsmo.near_season.opened_cond_window = null;
$("div[class^='sis-search-paka-waku-'] div.sis-search-paka-genre").hide();
};
//リスト開く
itsmo.near_season.showCondSelect = function(e, divid){
var id = $(e).attr('id') + '_cond';
if(itsmo.near_season.opened_cond_window == id){ var bl = id };
itsmo.near_season.hideCondSelect();
if (bl) {
return false;
}
itsmo.near_season.opened_cond_window = id;
$('#' + id).fadeIn('fast');
};
//リストから選択
itsmo.near_season.setSearchCond = function(e, key, val) {
itsmo.near_season.hideCondSelect();
e = $(e);
var txt = e.text();
var i, f = null;
for (i = 0; i < 10; ++i) {
e = e.parent();
f = e.find('span.box-s');
if (f.length >= 1) {
break;
}
}
if (null == f) {
return false;
}
if(txt.length >= 9){
txt = txt.slice(0, 8) + '...';
}
f.text(txt);
var h = e.parent().parent().find('input:hidden');
if(h.length){//絞込みパネル
h.val(val);
}else{
if (null != key && undefined != key) {
itsmo.near_season.cond[key] = val;
}
}
};
//アイコンオンオフ
itsmo.near_season.cond_toggle_icon_panel = function(e,key,val) {
e = $(e);
var cl = e.find('span:first').attr('class');
var isOn = ('-off' != cl.substring(Math.max(0, cl.length - 4)).toLowerCase());
if (isOn) {
e.find('span:first').attr('class', cl + '-off');
e.find('strong').removeClass('joken-on');
if(e.find('input:hidden').length){//絞込みパネル
e.find('input:hidden').val('');
}else{
itsmo.near_season.cond[key] = '';
}
} else {
e.find('span:first').attr('class', cl.substring(0, cl.length - 4));
e.find('strong').addClass('joken-on');
if(e.find('input:hidden').length){//絞込みパネル
e.find('input:hidden').val(val);
}else{
itsmo.near_season.cond[key] = val;
}
}
return false;
};
//絞込みパネルの表示順
itsmo.near_season.cond_toggle_sort_clickCnt = 0;
itsmo.near_season.cond_toggle_sort = function(e,key){
var hidval = $(e).parent().find('input:hidden').val();
var flg = hidval.indexOf(key);
if(flg == -1){
itsmo.near_season.cond_sort_reset();
}
var sort = '';
if(itsmo.near_season.cond_toggle_sort_clickCnt == 2 && key != 'dist'){
itsmo.near_season.cond_toggle_sort_clickCnt = 0;
itsmo.near_season.cond_sort_change(e);
var val = $(e).find('span:odd').html();
val = val.replace('▼','');
val = val.replace('▲','');
val = $(e).find('span:odd').html(val);
$(e).parent().find('input:hidden').val('');
}else if(itsmo.near_season.cond_toggle_sort_clickCnt == 1 ){
if(key == 'dist'){
itsmo.near_season.cond_toggle_sort_clickCnt = 0;
itsmo.near_season.cond_sort_change(e);
$(e).parent().find('input:hidden').val('');
}else{
sort = '_asc';
var val = $(e).find('span:odd').html();
val = val.replace('▼','');
val = $(e).find('span:odd').html(val + '▲');
itsmo.near_season.cond_toggle_sort_clickCnt = 0;
$(e).parent().find('input:hidden').val(key + sort);
}
}else if(itsmo.near_season.cond_toggle_sort_clickCnt == 0 ){
itsmo.near_season.cond_sort_change(e);
itsmo.near_season.cond_toggle_sort_clickCnt++;
if(key != 'dist'){
sort = '_desc';
var val = $(e).find('span:odd').html();
val = val.replace('▲','');
val = $(e).find('span:odd').html(val + '▼');
}
$(e).parent().find('input:hidden').val(key + sort);
}
if ('dist' == key) {
$('#season_sort_dist').click();
} else if ('nm' == key) {
$('#season_sort_nm_asc').click();
}
};
itsmo.near_season.cond_sort_change = function(e){
var e = $(e);
var cls = e.find('span:first').attr('class');
var clm = e.find('span:odd').attr('class');
var cle = e.find('span:last').attr('class');
var isOn = ('-on' == cls.substring(Math.max(0, cls.length - 3)).toLowerCase());
if(isOn){
//e.find('span:first').attr('class', cls.substring(0, cls.length - 3));
//e.find('span:odd').attr('class', clm.substring(0, clm.length - 3));
//e.find('span:last').attr('class', cle.substring(0, cle.length - 3));
}else{
e.find('span:first').attr('class', cls + '-on');
e.find('span:odd').attr('class', clm + '-on');
e.find('span:last').attr('class', cle + '-on');
}
};
itsmo.near_season.cond_sort_reset = function(){
itsmo.near_season.cond_toggle_sort_clickCnt = 0;
$('#ajax_season_cond #season_sort_div').find('a').each(function(){
var f = $(this);
var cls = f.find('span:first').attr('class');
var clm = f.find('span:odd').attr('class');
var cle = f.find('span:last').attr('class');
var isOn = ('-on' == cls.substring(Math.max(0, cls.length - 3)).toLowerCase());
if(isOn){
f.find('span:first').attr('class', cls.substring(0, cls.length - 3));
f.find('span:odd').attr('class', clm.substring(0, clm.length - 3));
f.find('span:last').attr('class', cle.substring(0, cle.length - 3));
}
var val = f.find('span:odd').html();
val = val.replace('▼','');
val = val.replace('▲','');
f.find('span:odd').html(val);
});
};
itsmo.near_season.setCalendarInit = function(){//指定された月分のカレンダーを作成
itsmo.calendar.init();
//$('#ajax_leftmenu_result #hanabi_cal_content').html(html);
};
itsmo.near_season.clickCalDate = function(y,m,d,e){
itsmo.near_season.clickCalCnt++;
var date = y + '/' + m + '/' + d;
if(itsmo.near_season.clickCalCnt <= 1 || itsmo.near_season.tmp_calday['s'] == date){
itsmo.near_season.tmp_calday['s'] = date;
itsmo.near_season.tmp_calday['e'] = '';
$("div[id^='hanabi_cal_content'] .elected").removeClass('elected');
if(itsmo.near_season.panelCalOpenFlg == true){
$("#ajax_season_cond span[id^='season_hanabi_cal_s']").html(date);
var tmpHtml = $("#ajax_season_cond span[id^='season_hanabi_cal_e']").html();
$("#ajax_season_cond span[id^='season_hanabi_cal_e']").html('' + tmpHtml + '');
}else{
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_s']").html(date);
var tmpHtml = $("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html();
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html('' + tmpHtml + '');
}
itsmo.near_season.clickCalCnt = 1;
$(e).addClass('elected');
}else if(itsmo.near_season.clickCalCnt <= 2){
if(!itsmo.near_season.tmp_calday['s']){
itsmo.near_season.tmp_calday['s'] = itsmo.near_season.cond['date_s'];
}
var date_s = itsmo.near_season.tmp_calday['s'];
if(date_s > date){
itsmo.near_season.tmp_calday['e'] = itsmo.near_season.tmp_calday['s'];
itsmo.near_season.tmp_calday['s'] = date;
}else{
itsmo.near_season.tmp_calday['e'] = date;
}
if(!itsmo.near_season.tmp_calday['s']){
itsmo.near_season.clickCalCnt = 0;
itsmo.near_season.clickCalDate(y,m,d,e);
return false;
}
$(e).addClass('elected');
if(itsmo.near_season.panelCalOpenFlg == true){
$("#ajax_season_cond span[id^='season_hanabi_cal_s']").html('' + itsmo.near_season.tmp_calday['s'] + '');
$("#ajax_season_cond span[id^='season_hanabi_cal_e']").html(itsmo.near_season.tmp_calday['e']);
}else{
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_s']").html('' + itsmo.near_season.tmp_calday['s'] + '');
$("#ajax_leftmenu_result .hanabi-waku span[id^='season_hanabi_cal_e']").html(itsmo.near_season.tmp_calday['e']);
}
var cnt = 0
//$("#hanabi_cal_content table td div[id^='cal_day_']").each(function(){
$("div[id^='hanabi_cal_content']").each(function(){
cnt = 0;
$(this).find("table td div[id^='cal_day_']").each(function(){
var cal_day = $(this).attr('id');
cal_day = cal_day.replace('cal_day_','');
if($(this).attr('class') == 'elected'){cnt++;}
if(cnt == 1){$(this).addClass('elected');}
});
});
itsmo.near_season.clickCalCnt = 0;
}
if(itsmo.near_season.panelCalOpenFlg == true){
$('#season_map_calendar_html').html($('#ajax_season_cond #hanabi_cal_content_panel').html());
}else{
$('#season_map_calendar_html').html($('#ajax_leftmenu_result #hanabi_cal_content').html());
}
};
//画像がくずれるので高さ調整
itsmo.near_season.chgWidth = function(e){
var tmpImg = new Image();
tmpImg.src = e.src;
if(tmpImg.width <= tmpImg.height){
$(e).width(56);
}else if(tmpImg.width > tmpImg.height){
$(e).height(56);
}else{
$(e).width(56);
}
};
itsmo.calendar = function() {};
itsmo.calendar.nowday = new Date();//現在
itsmo.calendar.months = 4;//何か月分
itsmo.calendar.showday = new Date(itsmo.calendar.nowday.getTime() - itsmo.calendar.months / 2 * 30 * 24 * 60 * 60 * 1000);
itsmo.calendar.showday = new Date(itsmo.calendar.showday.getFullYear(), itsmo.calendar.showday.getMonth());//はじめのカレンダー
itsmo.calendar.show_months = 2 ;//表示月数
itsmo.calendar.months_divs = new Array();//array(201107,201108...)年月日を配列で格納
itsmo.calendar.dateFunc = 'itsmo.near_season.clickCalDate';//日付クリック時の関数
//指定された月から指定された分のカレンダーを作成
itsmo.calendar.init = function(){
if(!$('#season_map_calendar_html').html()){
var html = '';
$('body').append('');//作成したカレンダーを格納しておくところ
var num = itsmo.calendar.months;
for(var i = 1; i <= num ; i++){
html += itsmo.calendar.add(1);
}
$('#season_map_calendar_html').html(html);
for(var i = 1; i <= itsmo.calendar.show_months ; i++){
var set_y = itsmo.calendar.nowday.getFullYear();
var set_m = itsmo.calendar.nowday.getMonth() + i;
if (set_m > 12) {
set_y = itsmo.calendar.nowday.getFullYear() + 1;
set_m = 1;
}
var div_id = 'map_calnum_' + set_y + set_m;//初期表示は今月と来月
$('#season_map_calendar_html #'+div_id).show();
}
}
itsmo.calendar.setCalBtn();
return $('#season_map_calendar_html').html();
};
itsmo.calendar.add = function(n){
var day = new Date(itsmo.calendar.showday.getTime());
day.setDate(1);
if (n < 0) {
day.setTime(day.getTime() - 2 * 24 * 60 * 60 * 1000);
} else {
day.setTime(day.getTime() + 32 * 24 * 60 * 60 * 1000);
}
day.setDate(1);
var y = day.getFullYear();
var m = day.getMonth();
var today = new Date();
if (y < today.getFullYear()) {
y = today.getFullYear();
}
if (y == today.getFullYear() && m < today.getMonth()) {
m = today.getMonth();
}
if (y > (today.getFullYear() + 1)) {
y = today.getFullYear() + 1;
m = 11;
}
itsmo.calendar.showday.setFullYear(y);
itsmo.calendar.showday.setMonth(m);
return itsmo.calendar.make();
};
// カレンダーを表示。
itsmo.calendar.make = function() {
// 表示月の1日目を作成。
itsmo.calendar.showday.setDate(1);
// 末日を作成。
var lastday = new Date(itsmo.calendar.showday.getTime());
lastday.setDate(1);
var start = lastday.getDay();
var end = lastday.getDay(); // 1日の曜日
lastday.setTime(lastday.getTime() + 32 * 24 * 60 * 60 * 1000);
lastday.setDate(1);
lastday.setHours(0);
lastday.setMinutes(0);
lastday.setSeconds(0);
lastday.setTime(lastday.getTime() - 12 * 60 * 60);
itsmo.calendar.setCalendarDateText();
// カレンダー作成。
end = Math.floor((lastday.getDate() + end + 6) / 7 - 1) * 10 + lastday.getDay();
i = $("#season_map_calendar table.traffic-calender tr[name='tracal5']");
if (end >= 50) {
i.show();
} else {
i.hide();
}
var week = 0;
var tbl = $('#season_map_calendar table.paka-calender');
var showDate = itsmo.calendar.showday;
today = itsmo.calendar.nowday;
var isTodayMonth = itsmo.calendar.showday.getMonth() == today.getMonth() && itsmo.calendar.showday.getFullYear() == today.getFullYear();
$("#season_map_calendar table.paka-calender td[name^=tracal]'").each(function() {
var s = $(this).parent().attr('name');
var w = parseInt(s.substring(6), 10);
var d = parseInt($(this).attr('name').substring(6), 10);
s = w * 10 + d;
var e = $(this);
if (s < start || s > end) {
e.html('');
if (0 == d) {
e.removeClass('cellSat');
} else if (6 == d) {
e.removeClass('cellSun');
} else {
e.removeClass('cellSun cellSat');
}
return null;
}
if (w >= 1) {
s = 7 - start + 1 + (w - 1) * 7 + d;
} else {
s = d - start + 1;
}
itsmo.calendar.clickCal(e, showDate.getFullYear(), showDate.getMonth() + 1, s , (s == today.getDate() && isTodayMonth));
});
var div_id = String(itsmo.calendar.showday.getFullYear())+ (itsmo.calendar.showday.getMonth() + 1);
$('#season_map_calendar .this_calDate_hidden').val(div_id);
itsmo.calendar.months_divs.push(div_id);
return '' + $("#season_map_calendar").html() + '
';
};
// カレンダー上部の年月日表示。
itsmo.calendar.setCalendarDateText = function() {
var s = '';
s = itsmo.calendar.showday.getFullYear() + '年' + (itsmo.calendar.showday.getMonth() + 1) + '月';
$('#season_map_calendar #cal_month_div').html(s);
};
// カレンダーの日付セット。
itsmo.calendar.clickCal = function(e, y, m, d, isToday) {
var s;
var isSun = new Date(y, m - 1, d);
var isSat = isSun.getDay() == 6;
isSun = (isSun.getDay() == 0) || isSun.isJpHoliday();
if(m < 10){ var m2 = '0' + m;}else{var m2 = m;}
if(d < 10){ var d2 = '0' + d;}else{var d2 = d;}
s = '';
if (isSun || isSat) {
if (isSun) {
e.removeClass('cellSat');
e.addClass('cellSun');
} else {
e.removeClass('cellSun');
e.addClass('cellSat');
}
} else {
e.removeClass('cellSun cellSat');
}
e.html(s);
}
itsmo.calendar.setCalBtn = function(){
// カレンダーの前月次月ボタンの制御。
var setLeftArrow = function(e,flg){
if(flg) {e.find('.traffic-month a.arrow-left').show();}else{e.find('.traffic-month a.arrow-left').hide();}
e.find('.traffic-month0').addClass('leftcal');
};
var setRightArrow = function(e,flg){
if(flg) {e.find('.traffic-month a.arrow-right').show();}else{e.find('.traffic-month a.arrow-right').hide();}
e.find('.traffic-month0').removeClass('leftcal');
};
var num = 1;
for(var i=0 ; i num && num == 1){
setRightArrow(e,false);setLeftArrow(e,true);
}else if(itsmo.calendar.show_months == num){
setLeftArrow(e,false);setRightArrow(e,true);
}else if(itsmo.calendar.show_months > num){
setRightArrow(e,false);setLeftArrow(e,false);
}
if(month == itsmo.calendar.months_divs[0]){setLeftArrow(e,false);}
if(month == itsmo.calendar.months_divs[itsmo.calendar.months_divs.length-1]){setRightArrow(e,false);}
num++;
}
}
};
itsmo.calendar.onClickAddCalendar = function(e,flg){
var date = $(e).parent();
var id = date.find('.this_calDate_hidden').val();
for(var i=0 ; i0){
var prev = itsmo.calendar.months_divs[i-1];
var next = itsmo.calendar.months_divs[i+1];
}
}
}
switch(flg){
case 1://next
$('#season_map_calendar_html').find('#map_calnum_' + next).show();
$('#season_map_calendar_html').find('#map_calnum_' + prev).hide();
break;
case -1://prev
$('#season_map_calendar_html').find('#map_calnum_' + next).hide();
$('#season_map_calendar_html').find('#map_calnum_' + prev).show();
break
}
itsmo.calendar.setCalBtn();
var html = $('#season_map_calendar_html').html();
$('#ajax_leftmenu_result #hanabi_cal_content').html(html);
$('#ajax_season_cond #hanabi_cal_content_panel').html(html);
};
//キーワード初期化
itsmo.near_season.keyword_check = function(e){
e = $(e);
if(e.attr('rel') == e.val()){
e.val('');
}else if (e.val() == ''){
e.val(e.attr('rel'));
}
};
//条件を含めるか??
itsmo.near_season.cond_toggle_keyword = function(e){
e = $(e);
var cl = e.find('span:first').attr('class');
if (cl == 'tel-check-on') {
e.find('span:first').attr('class', 'tel-check-off');
} else {
e.find('span:first').attr('class', 'tel-check-on');
}
return false;
};//--------------------------------------------------------------------------------------------------
// メニュー選択
//--------------------------------------------------------------------------------------------------
itsmo.near_new_building = function() {};
itsmo.near_new_building.classification = [];
itsmo.near_new_building.classification_cat = [];
itsmo.near_new_building.is_init = false;
itsmo.near_new_building.cond = {};
/**
* スタート
*/
itsmo.near_new_building.start = function() {
itsmo.near_new_building.classification = [];
itsmo.near_new_building.classification_cat = [];
itsmo.near_new_building.cond = {};
itsmo.near_new_building.cond['sort'] = 'location';
itsmo.vars.g_range_genre = 'new_building';
itsmo.near_new_building.search();
};
//--------------------------------------------------------------------------------------------------
// 検索
//--------------------------------------------------------------------------------------------------
/**
* 検索
*/
itsmo.near_new_building.search = function(act) {
itsmo.sub.map_tab_change('range', ['new_building']);
if (act != 'page') {
itsmo.vars.g_range_page = 1;
}
var cond = [], i;
for (i in itsmo.near_new_building.cond) {
cond.push(i + '=' + encodeURIComponent(itsmo.near_new_building.cond[i]));
}
cond.push('classify=' + encodeURIComponent(itsmo.near_new_building.classification.join(',')));
cond.push('classifycat=' + encodeURIComponent(itsmo.near_new_building.classification_cat.join(',')));
i = itsmo.vars.g_map_search_location;
var prm = 'lat=' + i.lat
+ '&lon=' + i.lon
+ '&minx=' + itsmo.vars.g_map_search_box.minx
+ '&miny=' + itsmo.vars.g_map_search_box.miny
+ '&maxx=' + itsmo.vars.g_map_search_box.maxx
+ '&maxy=' + itsmo.vars.g_map_search_box.maxy
+ '&page=' + itsmo.vars.g_range_page
+ '&cnt=' + itsmo.vars.g_range_cnt
+ '&' + cond.join('&')
;
itsmo.lib.map_waitopen();
//検索し、検索結果を記述
itsmo.lib.XMLHttpRequest2_send('/map/ajax_near_new_building.php', itsmo.near_new_building.result, 'GET', prm);
};
/**
* 検索結果一覧を表示
*/
itsmo.near_new_building.result = function (result) {
//エラー処理
result = $(result);
var err = result.find('err').text();
if(err != 0) {
itsmo.lib.aplErrorWindow('W', '0003', 'new_building', '新規施設検索');
return;
}
//チップクリア
itsmo.sub.map_clickable_TipAllClear(1);
$(result).find('list').each(function(){
var prm = {};
prm['uid'] = $(this).find('id').text();
prm['lat'] = $(this).find('lat').text();
prm['lon'] = $(this).find('lon').text();
prm['nm'] = $(this).find('title').text();
prm['short_nm'] = $(this).find('title').text();
prm['tip_c'] = $(this).find('tiphtmlc').text();
prm['tip_o'] = $(this).find('tiphtmlo').text();
var html = prm['tip_c'];
var div_id = itsmo.sub.set_tooltip_s(html,prm);
//bind
$('#' + div_id + ' a').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
$('#' + div_id + ' .tipc_range_open1').click(function() {
itsmo.range.range_tipopen(prm.uid);
});
});
itsmo.lib.map_waitclose();
itsmo.sub.map_tab_sethtml( result.find('listhtml').text() );
};
/**
* ページ数をセット
* 検索実行
*/
itsmo.near_new_building.set_pange_and_search = function(page) {
//ページ数
itsmo.vars.g_range_page = page + 1;
//検索
itsmo.near_new_building.search('page');
};
itsmo.map.Sharing = function () {
var _class = this;
_class.mapImgHeight = 140;
_class.mapImgWidth = 530;
_class.map = itsmo.vars.g_map_obj;
_class.popupElId = 'sharing-popup';
_class.introText = '☆ゼンリンいつもNAVI[マルチ]が提供する新たな地図・ナビの世界を体験!☆';
_class.shareLatLon = null;
_class.shareFacilityName = '';
_class.shareAddress = '';
_class.shareLink = '';
_class.getAddressRequest = null;
};
itsmo.map.Sharing._instance = null;
itsmo.map.Sharing.getInstance = function () {
if (itsmo.map.Sharing._instance == null) {
itsmo.map.Sharing._instance = new itsmo.map.Sharing();
}
return itsmo.map.Sharing._instance;
};
itsmo.map.Sharing.closeBalloon = function () {
if (itsmo.map.LandTourist.getInstance() != null) {
itsmo.map.LandTourist._instance.closeBalloon();
}
};
itsmo.map.Sharing.prototype.getCenterAddress = function () {
var _class = this;
if (_class.getAddressRequest != null) {
itsmo.lib.XMLHttpRequest2_abort(_class.getAddressRequest);
}
_class.getAddressRequest = itsmo.lib.XMLHttpRequest2_send('/map/right_click.php',
function (result) {
if (result.err) {
return false;
}
_class.shareAddress = result[0].address.text;
_class.display();
}, 'GET', _class.shareLatLon, 'json');
};
itsmo.map.Sharing.prototype.setShareLink = function () {
var _class = this;
var loc = itsmo.lib.toMilliSec(_class.shareLatLon);
var proto = location.protocol;
_class.shareLink = proto + '//' + itsmo.vars.d_host_www + '/z-' + loc.lat + '-' + loc.lon + '-' + (_class.map.getZoom() + 1) + '.htm';
};
itsmo.map.Sharing.prototype.setMapImage = function () {
var _class = this;
var lvl = _class.map.getZoom() + 1;//scale lv = zoom + 1 (zoom range 1 -> 18)
var wh = {width: _class.mapImgWidth, height: _class.mapImgHeight};
var mapImageLink = itsmo.lib.getMapImgLink(_class.shareLatLon, lvl, wh, true);
$('#' + _class.popupElId + ' #map-img').attr('src', mapImageLink);
};
itsmo.map.Sharing.prototype.setTextArea = function () {
var _class = this;
var text = '';
if (_class.shareFacilityName) {
text += "[" + _class.shareFacilityName + "]";
}
if(_class.shareAddress){
if (_class.shareFacilityName){
text+= '-';
}
text += '[' + _class.shareAddress + ']';
}
text += '\n地図:' + _class.shareLink;
$('#' + _class.popupElId + ' #share-text').val(text);
_class.setQRCode(encodeURIComponent(text));
};
itsmo.map.Sharing.prototype.setQRCode = function (text) {
var _class = this;
$('#' + _class.popupElId + ' #qr-code').attr('src', itsmo.lib.getQRCodeLink(text, "3"));
};
itsmo.map.Sharing.prototype.setShareButtons = function () {
var _class = this;
$('#' + _class.popupElId + ' #email').attr('href', _class.makeMailLink());
$('#' + _class.popupElId + ' #line-share').attr('href', _class.makeLineLink());
$('#' + _class.popupElId + ' #twitter-share').attr('href', _class.makeTwitterLink());
$('#' + _class.popupElId + ' #fb-share').attr('href', _class.makeFbLink());
};
itsmo.map.Sharing.prototype.resetData = function () {
var _class = this;
_class.shareLatLon = null;
_class.shareFacilityName = '';
_class.shareAddress = '';
_class.shareLink = '';
};
itsmo.map.Sharing.prototype.show = function (lat, lon, facilityName, addr) {
var _class = this;
_class.resetData();
if (lat && lon) {
_class.shareLatLon = new ZDC.LatLon(lat, lon);
if (facilityName) {
_class.shareFacilityName = facilityName;
}
if (addr) {
_class.shareAddress = addr;
}
_class.display();
} else {
_class.shareLatLon = _class.map.getLatLon();
_class.getCenterAddress();
}
};
itsmo.map.Sharing.prototype.display = function () {
var _class = this;
_class.setShareLink();
_class.setMapImage();
_class.setTextArea();
_class.setShareButtons();
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowopen(_class.popupElId);
};
itsmo.map.Sharing.prototype.hide = function () {
var _class = this;
_class.resetData();
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowclose(_class.popupElId);
};
itsmo.map.Sharing.prototype.encodeShareData = function () {
var _class = this;
var introText = encodeURIComponent(_class.introText);
var name = encodeURIComponent(_class.shareFacilityName);
var addr = encodeURIComponent(_class.shareAddress);
var link = encodeURI(_class.shareLink);
var baseURL = encodeURI(itsmo.lib.getBaseURL());
return {introText: introText, name: name, addr: addr, link: link, baseURL: baseURL};
};
itsmo.map.Sharing.prototype.makeMailLink = function () {
var _class = this;
var href = 'mailto:?body= %0a %0a';
var prm = _class.encodeShareData();
if (prm.name) {
href += prm.name;
}
if(prm.addr){
if(prm.name){
href += '%0a';
}
href += prm.addr;
}
href += '%0a' + encodeURIComponent('地図:') + prm.link + '%0a%0a' + prm.introText + '%0a' + prm.baseURL;
return href;
};
itsmo.map.Sharing.prototype.makeLineLink = function () {
var _class = this;
var href = 'line://msg/text/';
var prm = _class.encodeShareData();
if (prm.name != '') {
href += prm.name;
}
if (prm.addr) {
if (prm.name) {
href += '%0a';
}
href += prm.addr;
}
href += '%0a地図:' + prm.link;// + '%0a%0a' + prm.introText + '%0a' + prm.baseURL;
return href;
};
itsmo.map.Sharing.prototype.makeTwitterLink = function () {
var _class = this;
var href = 'http://twitter.com/share?text=';
var prm = _class.encodeShareData();
if (prm.name) {
href += '[' + prm.name + ']';
}
if(prm.addr){
if(prm.name){
href += '-';
}
href += '[' + prm.addr + ']';
}
href += '%0a' + encodeURIComponent('地図:') +'&url=' + prm.link;
return href;
};
itsmo.map.Sharing.prototype.makeFbLink = function () {
var _class = this;
var app_face = '268920203204669';
if (itsmo.lib.getBaseURL() == "https://dev-itm-multi.its-mo.com") {
app_face = '268920203204669';
} else if (itsmo.lib.getBaseURL() == "https://test-itm-multi.its-mo.com") {
app_face = '268920203204669';
} else if (itsmo.lib.getBaseURL() == "https://www.its-mo.com") {
app_face = '268920203204669';
}
var title = '';
var shareContent = '';
var prm = _class.encodeShareData();
if (prm.name) {
title += '[' + prm.name + ']';
}
if (prm.addr) {
if (prm.name) {
title += '-';
}
title += '[' + prm.addr + ']';
}
shareContent += '[地図: ' + prm.link + ']' + '%0a %0a ' + prm.introText;
var app_id = 'app_id=' + app_face + '&';
var redirect_uri = 'redirect_uri=' + 'https://facebook.com&';
var display = 'display=page&';
var _link = 'link=' + prm.link + '&';
var name = 'name=' + title + '&';
var description = 'description=' + shareContent + '&';
var picture = '&picture=https://www.its-mo.com/design/img/smart/bookmark.png&';
var sdk = 'sdk=joey';
var href = 'https://www.facebook.com/dialog/feed?' + app_id + redirect_uri + picture + name + description + _link + display + sdk;
return href;
};
/* global itsmo, ZDC, BUS_SPECIAL_BRACKET_OPEN, BUS_SPECIAL_BRACKET_CLOSE, BUS_SEARCH_KEYWORD */
itsmo.map.bus = {};
itsmo.map.bus.genreSearchFlag = '1';
itsmo.map.bus.showGroupBSAround = function (groupId) {
$("#bus-group-popup #bus-stops-list").html('');
for (var key in itsmo.vars.g_map_tipid_clickable_s) {
var item = itsmo.vars.g_map_tipid_clickable_s[key];
if (item.groupId == groupId) {
var html = ''
+ '' + item['nm'] + ''
+ '' + item['company'] + ''
+ '';
$("#bus-group-popup #bus-stops-list").append(html);
}
}
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowopen('bus-group-popup');
};
itsmo.map.bus.closeBSGroupPopup = function () {
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowclose('bus-group-popup');
};
itsmo.map.bus.goToBSDetail = function (bsName, comName) {
window.open('/bus/detail/' + bsName + BUS_SPECIAL_BRACKET_OPEN + comName + BUS_SPECIAL_BRACKET_CLOSE, '_blank');
};
/**Route**/
itsmo.map.bus.routeParams = null;
itsmo.map.bus.routeSearchData = null;
itsmo.map.bus.routeBalloons = null;
itsmo.map.bus.routePolyline = null;
itsmo.map.bus.routeLargeBalloon = null;
itsmo.map.bus.templateList =
"\
[route-name]([com-name])\
[via-string]\
クリア\
\
";
itsmo.map.bus.templateItem =
"";
itsmo.map.bus.smallBLTempalte =
"";
itsmo.map.bus.mediumBLTempalte =
"\
\
\
\
\
\
\
\
| \
\
[name]\
\
| \
\
\
";
itsmo.map.bus.largeBLTemplate =
"";
itsmo.map.bus.busRouteSearch = function (names, codes) {
itsmo.sub.map_clickable_TipAllClear();
itsmo.map.bus.parseRouteParams(names, codes);
var params = itsmo.map.bus.routeParams;
itsmo.sub.map_tab_change('bus', [names, codes]);
itsmo.map.bus.callSearchRoute(params['routeCode'], params['bsCode'], params['ptCode'], params['bsName']
, params['comName']);
};
itsmo.map.bus.parseRouteParams = function (names, codes) {
itsmo.map.bus.routeParams = {};
var codes = codes.split('-');
var bracketOpenIndex = names.indexOf(BUS_SPECIAL_BRACKET_OPEN);
var bracketCloseIndex = names.indexOf(BUS_SPECIAL_BRACKET_CLOSE);
itsmo.map.bus.routeParams['bsName'] = names.substring(0, bracketOpenIndex);
itsmo.map.bus.routeParams['comName'] = names.substring(bracketOpenIndex + 1, bracketCloseIndex);
itsmo.map.bus.routeParams['routeCode'] = codes[0];
itsmo.map.bus.routeParams['bsCode'] = codes[1];
itsmo.map.bus.routeParams['ptCode'] = codes[2];
};
itsmo.map.bus.callSearchRoute = function (routeCode, bsCode, pt, bsName, comName) {
itsmo.lib.map_waitopen();
var url = '/bus/ajaxRouteSearchPC.php?routeCode=' + routeCode + '&pt=' + pt + '&bsName='
+ encodeURIComponent(bsName) + '&comName=' + encodeURIComponent(comName) + '&bsCode=' + bsCode;
itsmo.lib.XMLHttpRequest2_send(url, function (result) {
if (result) {
itsmo.map.bus.searchRouteSuccess(result);
} else {
itsmo.map.bus.searchRouteError();
}
}, 'GET', '', 'json', itsmo.map.bus.searchRouteError);
};
itsmo.map.bus.searchRouteSuccess = function (result) {
itsmo.map.bus.routeSearchData = result;
if (itsmo.vars.g_config.mapinfo_minimize == 0) {
itsmo.map.bus.createRouteBalloons(result, true);
} else {
itsmo.map.bus.createRouteBalloons(result);
}
itsmo.map.bus.createRouteList(result);
itsmo.lib.map_waitclose();
};
itsmo.map.bus.searchRouteError = function () {
itsmo.lib.map_waitclose();
};
itsmo.map.bus.createRouteList = function (result) {
var info = result.Info;
var busStops = result.BusStops;
var templateList = itsmo.map.bus.templateList;
var listHtml = '';
for (var i = 0; i < busStops.length; i++) {
var templateItem = itsmo.map.bus.templateItem;
var className = itsmo.map.bus.getClassIcon(i, busStops.length, busStops[i]['BsCode']);
var html = templateItem.replace(/\[icon-class\]/g, className);
html = html.replace(/\[onclick\]/g, "itsmo.map.bus.goToBSDetail('" + busStops[i]['Name'] + "','"
+ itsmo.map.bus.routeParams['comName'] + "')");
html = html.replace(/\[name\]/g, busStops[i]['Name']);
var moveOver = "onmouseover=\"itsmo.map.bus.openRouteLargeBalloon('" + i + "');return false;\"";
html = html.replace(/\[mouseover\]/g, moveOver);
var onclickMove = "onclick=\"itsmo.vars.g_map_obj.moveLatLon(new ZDC.LatLon( " + busStops[i]['Lat'] + ", " + busStops[i]['Lon'] + "));return false;\"";
html = html.replace(/\[onclickmove\]/g, onclickMove);
listHtml += html;
}
listHtml = templateList.replace(/\[list-bs\]/g, listHtml);
listHtml = listHtml.replace(/\[route-name\]/g, itsmo.map.bus.routeParams['bsName']);
listHtml = listHtml.replace(/\[com-name\]/g, itsmo.map.bus.routeParams['comName']);
listHtml = listHtml.replace(/\[via-string\]/g, (info['ViaString']) ? info['ViaString'] : '');
itsmo.sub.map_tab_sethtml(listHtml);
};
itsmo.map.bus.getClassIcon = function (index, length, bsCode, isBalloon) {
var prefix = 'icon-bs-';
if (typeof (isBalloon) != 'undefined' && isBalloon == true) {
prefix = 'icon-bs2-';
}
var className = prefix + (index + 1);
if (index == 0) {
className = prefix + 'start';
} else if (index == length - 1) {
className = prefix + 'end';
} else if (bsCode == itsmo.map.bus.routeParams['bsCode']) {
className = prefix + 'focus-' + (index + 1);
}
return className;
};
itsmo.map.bus.createRouteBalloons = function (result, isMedium, noMoveMap) {
if (typeof (result) == 'undefined' || result == null) {
return;
}
if (typeof (noMoveMap) == 'undefined') {
noMoveMap = false;
}
var dataSearch = result.BusStops;
itsmo.map.bus.clearRoute();
itsmo.map.bus.routeBalloons = [];
var template = itsmo.map.bus.smallBLTempalte;
if (true == isMedium) {
template = itsmo.map.bus.mediumBLTempalte;
}
var latLons = [];
for (var i = 0; i < dataSearch.length; i++) {
var className = itsmo.map.bus.getClassIcon(i, dataSearch.length, dataSearch[i]['BsCode'], true);
itsmo.map.bus.routeSearchData.BusStops[i]['className'] = className;
var html = template.replace(/\[ico-class\]/g, className);
html = html.replace(/\[onclick\]/g, "itsmo.map.bus.openRouteLargeBalloon('" + i + "')");
html = html.replace(/\[name\]/g, dataSearch[i]['Name']);
var latLon = new ZDC.LatLon(parseFloat(dataSearch[i]['Lat']), parseFloat(dataSearch[i]['Lon']));
latLons.push(latLon);
var data = {
html: html,
latLon: latLon
};
itsmo.map.bus.routeBalloons.push(itsmo.map.bus.createBalloon(data));
}
itsmo.map.bus.routePolyline = new ZDC.Polyline(latLons, {
strokeWeight: 4,
strokeColor: '#FF0000'
});
itsmo.vars.g_map_obj.addWidget(itsmo.map.bus.routePolyline);
if (false == noMoveMap) {
var adjustZoom = itsmo.vars.g_map_obj.getAdjustZoom(latLons);
itsmo.vars.g_map_obj.moveLatLon(adjustZoom.latlon);
itsmo.vars.g_map_obj.setZoom(adjustZoom.zoom);
}
};
itsmo.map.bus.openRouteLargeBalloon = function (indexData) {
itsmo.map.bus.clearRouteLargeBalloon(true);
var data = itsmo.map.bus.routeSearchData.BusStops[indexData];
var html = itsmo.map.bus.largeBLTemplate.replace(/\[ico-class\]/g, data.className);
html = html.replace(/\[name\]/g, data['Name']);
html = html.replace(/\[lat\]/g, ZDC.degToms(data['Lat']));
html = html.replace(/\[lon\]/g, ZDC.degToms(data['Lon']));
html = html.replace(/BUS_KEYWORD/g, BUS_SEARCH_KEYWORD);
html = html.replace(/\[company\]/g, itsmo.map.bus.routeParams['comName']);
html = html.replace(/\[onclick\]/g, "itsmo.map.bus.goToBSDetail('" + data['Name'] + "','" + itsmo.map.bus.routeParams['comName'] + "')");
var dataBalloon = {
html: html,
latLon: {lat: data['Lat'], lon: data['Lon']},
index: indexData
};
itsmo.map.bus.routeLargeBalloon = itsmo.map.bus.createBalloon(dataBalloon, false);
itsmo.map.bus.routeBalloons[indexData].close();
};
itsmo.map.bus.createBalloon = function (data) {
var el = $('#id_div_calc_size');
el.html(data.html);
var offset = new ZDC.Pixel(-13, -26);
var widget = new ZDC.UserWidget(data.latLon, {
html: data.html,
size: itsmo.sub.getHtmlSize(data.html),
offset: offset
});
itsmo.vars.g_map_obj.addWidget(widget);
if (typeof (data.index) != 'undefined') {
widget._indexBalloon = data.index;
}
widget.open();
return widget;
};
itsmo.map.bus.clearRoute = function () {
if (itsmo.map.bus.routeBalloons != null) {
for (var i = 0; i < itsmo.map.bus.routeBalloons.length; i++) {
itsmo.map.bus.routeBalloons[i].close();
itsmo.vars.g_map_obj.removeWidget(itsmo.map.bus.routeBalloons[i]);
}
}
if (itsmo.map.bus.routePolyline != null) {
itsmo.vars.g_map_obj.removeWidget(itsmo.map.bus.routePolyline);
}
itsmo.map.bus.routePolyline = null;
itsmo.map.bus.routeBalloons = null;
};
itsmo.map.bus.clearRouteLargeBalloon = function (reOpen) {
if (itsmo.map.bus.routeLargeBalloon != null) {
if (reOpen && itsmo.map.bus.routeBalloons != null
&& itsmo.map.bus.routeBalloons[itsmo.map.bus.routeLargeBalloon._indexBalloon]) {
itsmo.map.bus.routeBalloons[itsmo.map.bus.routeLargeBalloon._indexBalloon].open();
}
itsmo.map.bus.routeLargeBalloon.close();
itsmo.vars.g_map_obj.removeWidget(itsmo.map.bus.routeLargeBalloon);
}
itsmo.map.bus.routeLargeBalloon = null;
};
itsmo.map.bus.isExistPoint = function () {
if (itsmo.map.bus.routeBalloons != null && itsmo.map.bus.routeBalloons.length > 0) {
return true;
}
};
itsmo.map.bus.clearRouteResult = function () {
itsmo.map.bus.clearRoute();
itsmo.map.bus.clearRouteLargeBalloon();
itsmo.map.bus.routeSearchData = null;
};
itsmo.map.bus.minimizeBalloons = function () {
itsmo.map.bus.clearRouteLargeBalloon(true);
itsmo.map.bus.createRouteBalloons(itsmo.map.bus.routeSearchData, false, true);
};
itsmo.map.bus.maximizeBalloons = function () {
itsmo.map.bus.clearRouteLargeBalloon(true);
itsmo.map.bus.createRouteBalloons(itsmo.map.bus.routeSearchData, true, true);
};
itsmo.map.bus.genreSearch = function () {
itsmo.freeword.freeword('bus', BUS_SEARCH_KEYWORD, itsmo.map.bus.genreSearchFlag);
};
// Bus detail map
itsmo.map.bus.detailBallons = [];
itsmo.map.bus.detailParams = [];
itsmo.map.bus.makeDetailBus = function (names, latLon) {
itsmo.map.bus.clearDetailBalloons();
itsmo.lib.map_waitopen();
latLon = latLon.split('_');
var convertedLatLon = new ZDC.LatLon(ZDC.msTodeg(latLon[0]), ZDC.msTodeg(latLon[1]));
itsmo.vars.g_map_obj.moveLatLon(convertedLatLon);
var bracketOpenIndex = names.indexOf(BUS_SPECIAL_BRACKET_OPEN);
var bracketCloseIndex = names.indexOf(BUS_SPECIAL_BRACKET_CLOSE);
var bsName = names.substring(0, bracketOpenIndex);
var comName = names.substring(bracketOpenIndex + 1, bracketCloseIndex);
itsmo.map.bus.detailParams['latLon'] = latLon;
itsmo.map.bus.detailParams['bsName'] = bsName;
itsmo.map.bus.detailParams['comName'] = comName;
itsmo.lib.XMLHttpRequest2_send('/map/right_click.php', itsmo.map.bus.displayBusDetail, 'GET', convertedLatLon, 'json');
};
itsmo.map.bus.displayBusDetail = function (result) {
itsmo.lib.map_waitclose();
if (result.err) {
return false;
}
var address = result[0].address.text;
var zipCode = result[0].zipcode;
var data = {zipCode: zipCode, address: address};
itsmo.map.bus.fillDataLargeBallon(data);
itsmo.map.bus.fillDataSmallBallon();
var listHtml = '';
var templateList = $("#bus-detail-list-wrapper").html();
var listHtml = templateList.replace(/__name__/g, itsmo.map.bus.detailParams['bsName']);
listHtml = listHtml.replace(/__name__/g, itsmo.map.bus.detailParams['bsName']);
listHtml = listHtml.replace(/__zipCode__/g, zipCode);
listHtml = listHtml.replace(/__addr__/g, address);
listHtml = listHtml.replace(/__comName__/g, itsmo.map.bus.detailParams['comName']);
var moveOver = "itsmo.map.bus.openDetailBalloon('largeBalloon');";
listHtml = listHtml.replace(/__mouseover__/g, moveOver);
var onclickMove = "itsmo.range.range_move(" + itsmo.map.bus.detailParams['latLon'][1] + "," + itsmo.map.bus.detailParams['latLon'][0] + ");"+moveOver;
listHtml = listHtml.replace(/__onclickmove__/g, onclickMove);
itsmo.sub.map_tab_sethtml(listHtml);
var bsName = decodeURIComponent(itsmo.map.bus.detailParams['bsName']);
var bsCom = decodeURIComponent(itsmo.map.bus.detailParams['comName']);
itsmo.sub.map_tab_change('busDetail', ['busDetail', bsName + BUS_SPECIAL_BRACKET_OPEN + bsCom + BUS_SPECIAL_BRACKET_CLOSE, itsmo.map.bus.detailParams['latLon'][0] + '_' + itsmo.map.bus.detailParams['latLon'][1]]);
};
itsmo.map.bus.createBalloonDetail = function (data) {
var size = itsmo.sub.getHtmlSize(data.html);
var offset = new ZDC.Pixel(-(size.width / 2 - 14), -(size.height));
if (typeof (data.offset) != 'undefined') {
offset = data.offset;
}
var widget = new ZDC.UserWidget(data.latLon, {
html: data.html,
size: itsmo.sub.getHtmlSize(data.html),
offset: offset
});
itsmo.vars.g_map_obj.addWidget(widget);
if (typeof (data.index) != 'undefined') {
widget._indexBalloon = data.index;
}
if (typeof (data.zIndex) != 'undefined') {
widget.setZindex(data.zIndex);
}
widget.open();
return widget;
};
itsmo.map.bus.closeDetailBalloon = function (data) {
if(typeof(typeof (itsmo.map.bus.detailBallons[data]) != 'undefined')){
itsmo.map.bus.detailBallons[data].close();
}
};
itsmo.map.bus.openDetailBalloon = function (data) {
if(typeof(typeof (itsmo.map.bus.detailBallons[data]) != 'undefined')){
itsmo.map.bus.detailBallons[data].open();
}
};
itsmo.map.bus.closeDetailBalloons = function () {
if (typeof (itsmo.map.bus.detailBallons['smallBalloon']) != 'undefined') {
itsmo.map.bus.detailBallons['smallBalloon'].close();
}
if (typeof (itsmo.map.bus.detailBallons['largeBalloon']) != 'undefined') {
itsmo.map.bus.detailBallons['largeBalloon'].close();
}
};
itsmo.map.bus.clearDetailBalloons = function () {
if (typeof (itsmo.map.bus.detailBallons['smallBalloon']) != 'undefined') {
itsmo.map.bus.detailBallons['smallBalloon'].close();
itsmo.vars.g_map_obj.removeWidget(itsmo.map.bus.detailBallons['smallBalloon']);
}
if (typeof (itsmo.map.bus.detailBallons['largeBalloon']) != 'undefined') {
itsmo.map.bus.detailBallons['largeBalloon'].close();
itsmo.vars.g_map_obj.removeWidget(itsmo.map.bus.detailBallons['largeBalloon']);
}
itsmo.map.bus.detailBallons = [];
};
itsmo.map.bus.fillDataLargeBallon = function (data) {
var detailParams = itsmo.map.bus.detailParams;
var detailLink = '/bus/detail/' + detailParams['bsName'] + BUS_SPECIAL_BRACKET_OPEN + detailParams['comName'] + BUS_SPECIAL_BRACKET_CLOSE;
var largeBalloon = $("#bus-detail-large-balloon-template").html();
largeBalloon = largeBalloon.replace(/__closeLarge__/g, "itsmo.map.bus.closeDetailBalloon('largeBalloon');itsmo.map.bus.openDetailBalloon('smallBalloon');");
largeBalloon = largeBalloon.replace(/__name__/g, detailParams['bsName']);
largeBalloon = largeBalloon.replace(/__zipCode__/g, data.zipCode);
largeBalloon = largeBalloon.replace(/__comName__/g, detailParams['comName']);
largeBalloon = largeBalloon.replace(/__addr__/g, data.address);
largeBalloon = largeBalloon.replace(/__jsShare__/g, itsmo.map.bus.shareBalloonString(data));
// 2017/04/12 Phuoc Le - #8434 Add dataLayer
var jsRouteStart = "itsmo.myroute.hereStart('" + detailParams['bsName'] + "', {lat:" + detailParams['latLon'][0] + ", lon:" + detailParams['latLon'][1]
+ "} ); dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_Start_吹き出し']);itsmo.map.bus.closeDetailBalloon('largeBalloon'); ";
largeBalloon = largeBalloon.replace(/__jsRouteStart__/g, jsRouteStart);
var jsRouteEnd = "itsmo.map.bus.closeDetailBalloon('largeBalloon'); itsmo.myroute.hereGo('" + detailParams['bsName'] + "', {lat:" + detailParams['latLon'][0] + ", lon:" + detailParams['latLon'][1]
+ "} ); dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_Goal_吹き出し']);";
largeBalloon = largeBalloon.replace(/__jsRouteEnd__/g, jsRouteEnd);
var jsRouteStep = "itsmo.map.bus.closeDetailBalloon('largeBalloon'); itsmo.myroute.hereByway('" + detailParams['bsName'] + "', {lat:" + detailParams['latLon'][0] + ", lon:" + detailParams['latLon'][1]
+ "} ); dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_StopOver_吹き出し']);";
largeBalloon = largeBalloon.replace(/__jsRouteStep__/g, jsRouteStep);
var jsMySpot = "itsmo.myspot.other_addmyspot(" + detailParams['latLon'][0] + "," + detailParams['latLon'][1] + ",'" + detailParams['bsName']
+ "','','" + data.address + "','','','','" + BUS_SEARCH_KEYWORD + "','','" + detailLink + "');";
largeBalloon = largeBalloon.replace(/__jsAddMySpot__/g, jsMySpot);
var jsHome = "itsmo.mypage.mypage('home_add', { lat: " + detailParams['latLon'][0] + ", lon: " + detailParams['latLon'][1] + " } )\
;itsmo.map.bus.closeDetailBalloon('largeBalloon');";
largeBalloon = largeBalloon.replace(/__jsHome__/g, jsHome);
var dataLarge = {
html: largeBalloon,
latLon: new ZDC.LatLon(ZDC.msTodeg(detailParams['latLon'][0]), ZDC.msTodeg(detailParams['latLon'][1])),
zIndex: itsmo.map.D_TIPZIDX_RANGE + 3
};
itsmo.map.bus.detailBallons['largeBalloon'] = itsmo.map.bus.createBalloonDetail(dataLarge);
};
itsmo.map.bus.fillDataSmallBallon = function () {
var detailParams = itsmo.map.bus.detailParams;
var smallBalloon = $("#bus-detail-small-balloon-template").html();
smallBalloon = smallBalloon.replace(/__openLarge__/g, "itsmo.map.bus.openDetailBalloon('largeBalloon');");
var dataSmall = {
html: smallBalloon,
latLon: new ZDC.LatLon(ZDC.msTodeg(detailParams['latLon'][0]), ZDC.msTodeg(detailParams['latLon'][1])),
offset: new ZDC.Pixel(-12, -34)
};
itsmo.map.bus.detailBallons['smallBalloon'] = itsmo.map.bus.createBalloonDetail(dataSmall);
};
itsmo.map.bus.shareBalloonString = function (data) {
var jsShare = "itsmo.map.Sharing.getInstance().show(" + ZDC.msTodeg(itsmo.map.bus.detailParams['latLon'][0]) + ", "
+ ZDC.msTodeg(itsmo.map.bus.detailParams['latLon'][1]) + ", '" + itsmo.map.bus.detailParams['bsName'] + "', '" + data.address + "');";
return jsShare;
};
itsmo.map.bus.clearAllBalloons = function () {
itsmo.map.bus.clearRouteResult();
itsmo.map.bus.clearDetailBalloons();
};
itsmo.map.roadStation = {};
itsmo.map.roadStation.searchData = null;
itsmo.map.roadStation.balloons = null;
itsmo.map.roadStation.largeBalloon = null;
itsmo.map.roadStation.initSearch = function (latLon, lvl) {
if (typeof (latLon) != 'undefined') {
var parseLatLon = latLon.split('-');
if (parseLatLon.length == 2) {
latLon = new ZDC.LatLon(ZDC.msTodeg(parseLatLon[0]), ZDC.msTodeg(parseLatLon[1]));
itsmo.vars.g_map_obj.moveLatLon(latLon);
} else {
latLon = itsmo.vars.g_map_obj.getLatLon();
}
}
if (typeof (lvl) != 'undefined') {
itsmo.vars.g_map_obj.setZoom(lvl);
}
lvl = itsmo.vars.g_map_obj.getZoom();
itsmo.sub.map_tab_change('michinoeki', ['michinoeki', ZDC.degToms(latLon.lat) + '-' + ZDC.degToms(latLon.lon), lvl]);
itsmo.map.roadStation.searchRS(ZDC.degToms(latLon.lat), ZDC.degToms(latLon.lon));
};
itsmo.map.roadStation.reSearchMapEvent = function (){
var latLon = itsmo.vars.g_map_obj.getLatLon();
var lvl = itsmo.vars.g_map_obj.getZoom();
itsmo.sub.map_tab_change('michinoeki', ['michinoeki', ZDC.degToms(latLon.lat) + '-' + ZDC.degToms(latLon.lon), lvl]);
}
itsmo.map.roadStation.searchRS = function (lat, lon) {
itsmo.lib.map_waitopen();
var url = '/special/michinoeki/ajaxAroundRadius.php?lat=' + lat + '&lon=' + lon;
itsmo.lib.XMLHttpRequest2_send(url, function (result) {
if (result) {
itsmo.map.roadStation.searchSuccess(result);
} else {
itsmo.map.roadStation.searchError();
}
}, 'GET', '', 'json', itsmo.map.roadStation.searchError);
};
itsmo.map.roadStation.searchSuccess = function (result) {
itsmo.sub.map_clickable_TipAllClear(1);
itsmo.map.roadStation.searchData = result;
itsmo.map.roadStation.createBalloons(result);
itsmo.map.roadStation.createRSList(result);
itsmo.lib.map_waitclose();
};
itsmo.map.roadStation.searchError = function () {
itsmo.sub.map_clickable_TipAllClear(1);
itsmo.lib.map_waitclose();
};
itsmo.map.roadStation.createRSList = function (result) {
var listHtml = $("#road-station-list-no-result").html();
do{
if (typeof (result) == 'undefined' || result == null || typeof result.list == 'undefined') {
break;
}
listHtml = '';
var list = result.list;
var templateList = $("#road-station-list-wrapper").html();
for (var i = 0; i < list.length; i++) {
var data = list[i];
var templateItem = $("#road-station-list-item").html();
var html = templateItem.replace(/__detail__/g, data['detail_url']);
html = html.replace(/__name__/g, data['nm']);
var moveOver = "itsmo.map.roadStation.openLargeBalloon('" + i + "');";
html = html.replace(/__mouseover__/g, moveOver);
var onclickMove = "itsmo.range.range_move('"+ data['lon'] +"','"+ data['lat'] +"');";
html = html.replace(/__onclickmove__/g, onclickMove);
listHtml += html;
}
listHtml = templateList.replace(/__listRoadStation__/g, listHtml);
} while(false)
itsmo.sub.map_tab_sethtml(listHtml);
};
itsmo.map.roadStation.createBalloons = function (result) {
if (typeof (result) == 'undefined' || result == null || typeof result.list == 'undefined') {
return;
}
var dataSearch = result.list;
itsmo.map.roadStation.balloons = [];
var template = $("#road-station-small-balloon-template").html();
for (var i = 0; i < dataSearch.length; i++) {
var html = template.replace(/__openLarge__/g, "itsmo.map.roadStation.openLargeBalloon('" + i + "');");
var latLon = new ZDC.LatLon(ZDC.msTodeg(dataSearch[i]['lat']), ZDC.msTodeg(dataSearch[i]['lon']));
var data = {
html: html,
latLon: latLon,
zIndex: itsmo.map.D_TIPZIDX_RANGE,
offset: new ZDC.Pixel(-12, -34)
};
itsmo.map.roadStation.balloons.push(itsmo.map.roadStation.createBalloon(data));
}
};
itsmo.map.roadStation.openLargeBalloon = function (indexData) {
itsmo.map.roadStation.clearLargeBalloon(true);
var data = itsmo.map.roadStation.searchData.list[indexData];
var html = $("#road-station-large-balloon-template").html();
html = html.replace(/__name__/g, data['nm']);
html = html.replace(/__detail__/g, data['detail_url']);
html = html.replace(/__zipCode__/g, data['zipCode']);
html = html.replace(/__addr__/g, data['addr']);
// 2017/04/12 Phuoc Le - #8434 Add dataLayer
var jsRouteStart = "itsmo.map.roadStation.clearLargeBalloon(true); itsmo.myroute.hereStart('" + data['nm'] + "', {lat:" + data['lat'] + ", lon:" + data['lon']
+ "} ); dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_Start_吹き出し']);";
html = html.replace(/__jsRouteStart__/g, jsRouteStart);
var jsRouteEnd = "itsmo.map.roadStation.clearLargeBalloon(true); itsmo.myroute.hereGo('" + data['nm'] + "', {lat:" + data['lat'] + ", lon:" + data['lon']
+ "} ); dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_Goal_吹き出し']);";
html = html.replace(/__jsRouteEnd__/g, jsRouteEnd);
var jsRouteStep = "itsmo.map.roadStation.clearLargeBalloon(true); itsmo.myroute.hereByway('" + data['nm'] + "', {lat:" + data['lat'] + ", lon:" + data['lon']
+ "} ); dataLayer.push(['_trackEvent', 'Maps', 'RouteSearch', 'RouteSearch_StopOver_吹き出し']);";
html = html.replace(/__jsRouteStep__/g, jsRouteStep);
var jsShare = "itsmo.map.Sharing.getInstance().show(" + data['lat'] + ", "
+ data['lon'] + ", '" + data['nm'] + "', '" + data['addr'] + "');";
html = html.replace(/__jsShare__/g, jsShare);
var jsMySpot = "itsmo.myspot.other_addmyspot(" + data['lat'] + "," + data['lon'] + ",'" + data['nm']
+ "','" + data['kn'] + "','" + data['addr'] + "','" + data['telno1'] + "','" + data['id'] + "','"
+ data['gnr_cd'] + "','" + data['ckbn'] + "','','" + data['detail_url'] + "');";
html = html.replace(/__jsAddMySpot__/g, jsMySpot);
html = html.replace(/__jsHome__/g, "itsmo.mypage.mypage('home_add', { lat: " + data['lat'] + ", lon: " + data['lon'] + " } )\
;itsmo.map.roadStation.closeBalloon(" + indexData + ");itsmo.map.roadStation.clearLargeBalloon();");
html = html.replace(/__closeLarge__/g, 'itsmo.map.roadStation.clearLargeBalloon(true);');
var dataBalloon = {
html: html,
latLon: {lat: ZDC.msTodeg(data['lat']), lon: ZDC.msTodeg(data['lon'])},
zIndex: itsmo.map.D_TIPZIDX_RANGE + 3,
index: indexData
};
itsmo.map.roadStation.largeBalloon = itsmo.map.roadStation.createBalloon(dataBalloon, false);
itsmo.map.roadStation.balloons[indexData].close();
};
itsmo.map.roadStation.closeBalloon = function (index) {
itsmo.map.roadStation.balloons[index].close();
}
itsmo.map.roadStation.createBalloon = function (data) {
var size = itsmo.sub.getHtmlSize(data.html);
var offset = new ZDC.Pixel(-(size.width / 2 - 14), -(size.height));
if (typeof (data.offset) != 'undefined') {
offset = data.offset;
}
var widget = new ZDC.UserWidget(data.latLon, {
html: data.html,
size: itsmo.sub.getHtmlSize(data.html),
offset: offset
});
itsmo.vars.g_map_obj.addWidget(widget);
if (typeof (data.index) != 'undefined') {
widget._indexBalloon = data.index;
}
if (typeof (data.zIndex) != 'undefined') {
widget.setZindex(data.zIndex);
}
widget.open();
return widget;
};
itsmo.map.roadStation.clearBalloons = function () {
if (itsmo.map.roadStation.balloons != null) {
for (var i = 0; i < itsmo.map.roadStation.balloons.length; i++) {
itsmo.map.roadStation.balloons[i].close();
itsmo.vars.g_map_obj.removeWidget(itsmo.map.roadStation.balloons[i]);
}
}
itsmo.map.roadStation.balloons = null;
};
itsmo.map.roadStation.clearLargeBalloon = function (reOpen) {
if (itsmo.map.roadStation.largeBalloon != null) {
if (reOpen && itsmo.map.roadStation.balloons != null
&& itsmo.map.roadStation.balloons[itsmo.map.roadStation.largeBalloon._indexBalloon]) {
itsmo.map.roadStation.balloons[itsmo.map.roadStation.largeBalloon._indexBalloon].open();
}
itsmo.map.roadStation.largeBalloon.close();
itsmo.vars.g_map_obj.removeWidget(itsmo.map.roadStation.largeBalloon);
}
itsmo.map.roadStation.largeBalloon = null;
};
itsmo.map.roadStation.isExistPoint = function () {
if (itsmo.map.roadStation.balloons != null && itsmo.map.roadStation.balloons.length > 0) {
return true;
}
};
itsmo.map.roadStation.clearResult = function () {
itsmo.map.roadStation.clearLargeBalloon();
itsmo.map.roadStation.clearBalloons();
itsmo.map.roadStation.searchData = null;
};
/***Facillity***/
itsmo.facilityNight = {};
itsmo.facilityNight.vars = {};
itsmo.facilityNight.vars.urlSearchFac = " /lasup/ajaxSearchAround.php?lat=[lat]&lon=[lon]&facnum=[facnums]&isMap=1&limit=[limit]&pos=[pos]";
itsmo.facilityNight.vars.facnumTypeList = {};
itsmo.facilityNight.vars.facilityBalloons = [];
itsmo.facilityNight.iconPrefix = 'lasup-ico-facnum-';
itsmo.facilityNight.vars.currentFacLatLon = null;
itsmo.facilityNight.vars.currentPos = 1;
itsmo.facilityNight.vars.topHash = '#facnum,1,2,3,4,5';
itsmo.facilityNight.vars.noResearch = false;
window.onload = function () {
if (typeof (itsmo.facilityNight.vars.karaoke) != "undefined" && typeof (itsmo.facilityNight.vars.manga) != "undefined"
&& typeof (itsmo.facilityNight.vars.sauna) != "undefined" && typeof (itsmo.facilityNight.vars.drink) != "undefined"
&& typeof (itsmo.facilityNight.vars.restaurant) != "undefined") {
if (!itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.karaoke]) {
itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.karaoke] = false;
}
if (!itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.manga]) {
itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.manga] = false;
}
if (!itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.sauna]) {
itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.sauna] = false;
}
if (!itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.drink]) {
itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.drink] = false;
}
if (!itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.restaurant]) {
itsmo.facilityNight.vars.facnumTypeList[itsmo.facilityNight.vars.restaurant] = false;
}
}
};
itsmo.facilityNight.initFacility = function () {
var hash = window.location.hash;
var facnum = hash.split(',');
if((facnum[0] == '#facnum')){
facnum.shift();
} else {
facnum = facilityNumber;
}
if (!facnum) {
return;
}
//reset facnumTypeList
itsmo.facilityNight.vars.facnumTypeList = {};
for (var i = 0; i < facnum.length; i++) {
itsmo.facilityNight.vars.facnumTypeList[facnum[i]] = true;
}
};
itsmo.facilityNight.changeTypes = function(el){
var id = $(el).attr('id');
id = (id.split('-'))[1];
if(el.checked == true){
itsmo.facilityNight.vars.facnumTypeList[id] = true;
itsmo.facilityNight.vars.noResearch = true;
} else {
itsmo.facilityNight.vars.facnumTypeList[id] = false;
itsmo.facilityNight.vars.noResearch = false;
//Not initFacility when any option genre is selecting
for (var i in itsmo.facilityNight.vars.facnumTypeList) {
if (itsmo.facilityNight.vars.facnumTypeList[i] == true) {
itsmo.facilityNight.vars.noResearch = true;
break;
}
}
}
itsmo.facilityNight.getFacilities(itsmo.facilityNight.vars.currentFacLatLon, itsmo.facilityNight.vars.currentPos);
};
itsmo.facilityNight.getFacilities = function (latlon, pos) {
itsmo.facilityNight.vars.facData = [];
itsmo.lasup.closeDetailBalloon();
itsmo.sub.map_clickable_TipAllClear();
if (typeof pos == 'undefined' || pos == null) {
pos = '1';
}
itsmo.facilityNight.vars.currentPos = pos;
var isMedium = false;
if (itsmo.vars.g_config.mapinfo_minimize == 0) {
var isMedium = true;
}
var facnums = '';
for (var i in itsmo.facilityNight.vars.facnumTypeList) {
if (itsmo.facilityNight.vars.facnumTypeList[i] == true) {
facnums += i + ',';
}
}
if (facnums.length > 0) {
itsmo.lib.map_waitopen();
facnums = facnums.substr(0, facnums.length - 1);
if (!latlon) {
latlon = itsmo.vars.g_map_obj.getLatLon();
}
itsmo.facilityNight.vars.currentFacLatLon = latlon;
var url = itsmo.facilityNight.vars.urlSearchFac;
url = url.replace(/\[lat\]/g, ZDC.degToms(latlon.lat));
url = url.replace(/\[lon\]/g, ZDC.degToms(latlon.lon));
url = url.replace(/\[facnums\]/g, facnums);
url = url.replace(/\[limit\]/g, itsmo.vars.g_range_cnt);
url = url.replace(/\[pos\]/g, pos);
itsmo.lib.XMLHttpRequest2_send(url, function (data) {
itsmo.lib.map_waitclose();
if (data['list'] != null && data['list'].length > 0) {
itsmo.facilityNight.vars.facData = data['list'];
itsmo.facilityNight.createFacilityBalloons(itsmo.facilityNight.vars.facData, isMedium);
itsmo.facilityNight.createListFacility(data, pos);
} else {
itsmo.facilityNight.showFacilityMessage();
}
}, 'GET', '', 'json', function(){itsmo.lib.map_waitclose();});
} else {
var hash = window.location.hash;
if (hash.indexOf("#facnum") == 0) {
itsmo.sub.map_tab_change('top');
}
}
};
itsmo.facilityNight.createListFacility = function (data, pos) {
var wrapperTpl = $("#lasup-fac-list-wrapper").html();
var itemTpl = $("#lasup-fac-list-item").html();
var htmlList = '';
var list = data['list'];
for (var i = 0; i < list.length; i++) {
var itemHtml = '';
itemHtml = itemTpl.replace(/__iconClass__/g, itsmo.facilityNight.iconPrefix + list[i].typeIcon);
itemHtml = itemHtml.replace(/__index__/g, i);
itemHtml = itemHtml.replace(/__lat__/g, list[i]['lat']);
itemHtml = itemHtml.replace(/__lon__/g, list[i]['lon']);
itemHtml = itemHtml.replace(/__name__/g, list[i]['name']);
itemHtml = itemHtml.replace(/__typeName__/g, list[i]['typeName']);
itemHtml = itemHtml.replace(/__detailLink__/g, list[i]['detailUrl']);
htmlList += itemHtml;
}
htmlList = wrapperTpl.replace(/__listFacility__/g, htmlList);
htmlList = htmlList.replace(/__activeClass__/g, 'check-list-ac');
htmlList = htmlList.replace(/__hitCount__/g, data['hitCount']);
htmlList = htmlList.replace(/__start__/g, pos);
htmlList = htmlList.replace(/__end__/g, parseInt(pos) - 1 + list.length);
var pagging = itsmo.map.setPaging(data['hitCount'], (pos - 1) / itsmo.vars.g_range_cnt + 1, 'itsmo.facilityNight.otherFacPage', itsmo.vars.g_range_cnt);
htmlList = htmlList.replace(/__pagging__/g, pagging);
itsmo.sub.map_tab_sethtml(htmlList);
var facnumHash = ['facnum'];
for (var i in itsmo.facilityNight.vars.facnumTypeList) {
if(itsmo.facilityNight.vars.facnumTypeList[i] == true){
$('#lasup-checkbox-area.check-list-ac #checkbox-' + i).attr('checked', 'checked');
facnumHash.push(i);
} else {
$('#lasup-checkbox-area.check-list-ac #checkbox-' + i).removeAttr('checked');
}
}
itsmo.sub.map_tab_change('facnum',facnumHash);
};
itsmo.facilityNight.showFacilityMessage = function(){
var wrapperTpl = $("#lasup-fac-list-wrapper").html();
var htmlList = wrapperTpl.replace(/__listFacility__/g, '');
htmlList = htmlList.replace(/__activeClass__/g, 'check-list-ac');
htmlList = htmlList.replace(/__hitCount__/g, 0);
htmlList = htmlList.replace(/__start__/g, 0);
htmlList = htmlList.replace(/__end__/g, 0);
htmlList = htmlList.replace(/__pagging__/g, '');
itsmo.sub.map_tab_sethtml(htmlList);
var facnumHash = ['facnum'];
for (var i in itsmo.facilityNight.vars.facnumTypeList) {
if (itsmo.facilityNight.vars.facnumTypeList[i] == true) {
$('#lasup-checkbox-area.check-list-ac #checkbox-' + i).attr('checked', 'checked');
facnumHash.push(i);
} else {
$('#lasup-checkbox-area.check-list-ac #checkbox-' + i).removeAttr('checked');
}
}
itsmo.sub.map_tab_change('facnum', facnumHash);
itsmo.facilityNight.showFacilityPopup();
};
itsmo.facilityNight.otherFacPage = function(page){
var pos = (page - 1) * itsmo.vars.g_range_cnt + 1;
itsmo.facilityNight.getFacilities(itsmo.facilityNight.vars.currentFacLatLon, pos);
};
itsmo.facilityNight.createFacilityBalloons = function (data, isMedium) {
if (data == null) {
return;
}
var template = $('#lasup-small-fac-tpl').html();
if (true == isMedium) {
template = $('#lasup-medium-fac-tpl').html();
}
for (var i = 0; i < data.length; i++) {
var html = template.replace(/__iconClass__/g, itsmo.facilityNight.iconPrefix + data[i].typeIcon);
html = html.replace(/__name__/g, data[i].name);
html = html.replace(/__onclick__/g, "itsmo.facilityNight.openFacilityLargeBalloon('" + i + "')");
if (true == isMedium) {
if (data[i].womenFlag == 1) {
html = html.replace(/__womenIcon__/g, '');
} else {
html = html.replace(/__womenIcon__/g, "");
}
}
var latlon = itsmo.lib.toLatLon(data[i].lat, data[i].lon);
var dataBalloon = {
html: html,
latLon: {lat: latlon.lat, lon: latlon.lon},
zIndex: itsmo.map.D_TIPZIDX_RANGE
};
itsmo.facilityNight.vars.facilityBalloons.push(itsmo.facilityNight.drawFacilityBalloon(dataBalloon));
}
};
itsmo.facilityNight.drawFacilityBalloon = function (data) {
var size = itsmo.sub.getHtmlSize(data.html);
var widget = new ZDC.UserWidget(data.latLon, {
html: data.html,
size: size,
offset: new ZDC.Pixel(0, 0)
});
itsmo.vars.g_map_obj.addWidget(widget);
if (typeof (data.index) != 'undefined') {
widget._indexBalloon = data.index;
}
if (typeof (data.zIndex) != 'undefined') {
widget.setZindex(data.zIndex);
}
widget.open();
itsmo.facilityNight.addMouseEventWidget(widget, data.zIndex)
return widget;
};
itsmo.facilityNight.clearFacilityBalloons = function () {
if (itsmo.facilityNight.vars.facilityBalloons != null) {
for (var i = 0; i < itsmo.facilityNight.vars.facilityBalloons.length; i++) {
itsmo.facilityNight.vars.facilityBalloons[i].close();
itsmo.vars.g_map_obj.removeWidget(itsmo.facilityNight.vars.facilityBalloons[i]);
}
}
itsmo.facilityNight.vars.facilityBalloons = [];
};
itsmo.facilityNight.minimizeBalloons = function () {
itsmo.facilityNight.clearFacilityLargeBalloon();
itsmo.facilityNight.clearFacilityBalloons();
if (itsmo.facilityNight.vars.facData != null && itsmo.facilityNight.vars.facData.length > 0) {
itsmo.facilityNight.createFacilityBalloons(itsmo.facilityNight.vars.facData, false);
}
};
itsmo.facilityNight.maximizeBalloons = function () {
itsmo.facilityNight.clearFacilityLargeBalloon();
itsmo.facilityNight.clearFacilityBalloons();
if (itsmo.facilityNight.vars.facData != null && itsmo.facilityNight.vars.facData.length > 0) {
itsmo.facilityNight.createFacilityBalloons(itsmo.facilityNight.vars.facData, true);
}
};
itsmo.facilityNight.openFacilityLargeBalloon = function (indexData) {
itsmo.facilityNight.clearFacilityLargeBalloon(true);
var data = itsmo.facilityNight.vars.facData[indexData];
var latlon = itsmo.lib.toLatLon(data.lat, data.lon);
var html = $('#lasup-large-fac-tpl').html();
;
html = html.replace(/__iconClass__/g, itsmo.facilityNight.iconPrefix + data.typeIcon);
html = html.replace(/__name__/g, data['name']);
html = html.replace(/__detailLink__/g, data['detailUrl']);
html = html.replace(/__distance__/g, data['distance']);
html = html.replace(/__lat__/g, data['lat']);
html = html.replace(/__lon__/g, data['lon']);
html = html.replace(/__addr__/g, data['addr']);
if (parseInt(data['womenFlag']) == 1) {
html = html.replace(/__womenIcon__/g, '');
if (parseInt(data.typeIcon) == 2 || parseInt(data.typeIcon) == 3) {
if (parseInt(data.typeIcon) == 2) {
html = html.replace(/__womenText__/g, '
女性専用エリア/シートあり');
} else {
html = html.replace(/__womenText__/g, '
女性専用エリアあり');
}
} else {
html = html.replace(/__womenText__/g, "");
}
} else {
html = html.replace(/__womenText__/g, "");
html = html.replace(/__womenIcon__/g, "");
}
var dataBalloon = {
html: html,
latLon: {lat: latlon.lat, lon: latlon.lon},
index: indexData,
zIndex: itsmo.map.D_TIPZIDX_RANGE + 3
};
itsmo.facilityNight.vars.facLargeBalloon = itsmo.facilityNight.drawFacilityBalloon(dataBalloon);
itsmo.facilityNight.vars.facilityBalloons[indexData].close();
};
itsmo.facilityNight.clearFacilityLargeBalloon = function (reOpen) {
if (itsmo.facilityNight.vars.facLargeBalloon != null) {
if (reOpen && itsmo.facilityNight.vars.facilityBalloons != null
&& itsmo.facilityNight.vars.facilityBalloons[itsmo.facilityNight.vars.facLargeBalloon._indexBalloon]) {
itsmo.facilityNight.vars.facilityBalloons[itsmo.facilityNight.vars.facLargeBalloon._indexBalloon].open();
}
itsmo.facilityNight.vars.facLargeBalloon.close();
itsmo.vars.g_map_obj.removeWidget(itsmo.facilityNight.vars.facLargeBalloon);
itsmo.facilityNight.vars.facLargeBalloon = null;
}
};
itsmo.facilityNight.timmerMouseEventWidget = null;
itsmo.facilityNight.addMouseEventWidget = function (userWidget, zIndex) {
ZDC.addListener(userWidget, ZDC.USERWIDGET_MOUSEOVER, function () {
clearTimeout(itsmo.facilityNight.timmerMouseEventWidget);
itsmo.facilityNight.timmerMouseEventWidget = setTimeout(function () {
userWidget.setZindex(itsmo.map.D_TIPZIDX_MAX);
}, 200);
});
if (typeof zIndex == 'undefined') {
zIndex = itsmo.map.D_TIPZIDX_RANGE;
}
ZDC.addListener(userWidget, ZDC.USERWIDGET_MOUSEOUT, function () {
clearTimeout(itsmo.facilityNight.timmerMouseEventWidget);
userWidget.setZindex(zIndex);
});
};
itsmo.facilityNight.searchFacilities = function(){
var hash = '';
var facnums = '';
for (var i in itsmo.facilityNight.vars.facnumTypeList) {
if (itsmo.facilityNight.vars.facnumTypeList[i] == true) {
facnums += i + ',';
}
}
if (facnums.length > 0){
facnums = facnums.substr(0, facnums.length - 1);
hash = '#facnum,' + facnums;
} else {
hash = itsmo.facilityNight.vars.topHash;
}
window.location.hash = hash;
itsmo.facilityNight.initFacility();
itsmo.facilityNight.getFacilities();
};
itsmo.facilityNight.showFacilityPopup = function(){
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowopen('no-facility-popup');
};
itsmo.facilityNight.hideFacilityPopup = function(){
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowclose('no-facility-popup');
};
itsmo.facilityNight.clearAllBalloons = function(){
itsmo.facilityNight.vars.facData = [];
itsmo.facilityNight.clearFacilityBalloons();
itsmo.facilityNight.clearFacilityLargeBalloon();
};
var d_corp = '';
// グローバル変数 --------------------------------
itsmo.vars.g_map_obj = null;//地図オブジェクト
itsmo.vars.g_map_aid = 0;//ログイン情報
itsmo.vars.g_map_sid = 0;
itsmo.vars.g_map_cid = 0;
itsmo.vars.g_map_corp = null;
// 検索系。緯度経度はすべてミリ秒。
itsmo.vars.g_map_search_location = null;//検索時の位置(getLatLon)
itsmo.vars.g_map_search_scale = null;//検索時の縮尺(getZoom)
itsmo.vars.g_map_search_box = null;//検索時の範囲(getMapBoundBox)
itsmo.vars.g_map_search_location_old = null;//前回検索時の位置(getMapLocation)
itsmo.vars.g_map_search_scale_old = null;//前回検索時の縮尺(getMapScale)
itsmo.vars.g_map_search_box_old = null;//前回検索時の範囲(getMapBoundBox)
itsmo.vars.g_map_address = "";//現在地の住所
itsmo.vars.g_map_is_town = false;
itsmo.vars.isFullScreen = false; // check FullScreen;
// レイヤー
itsmo.vars.g_map_layer_clickable = null;
itsmo.vars.g_map_layer_route = null;
itsmo.vars.g_map_layer_vics = null;
itsmo.vars.g_map_layer_vicsid = null;
// 上下関係
itsmo.map.d_map_zIdx_route = 10002;//ルート
itsmo.map.d_map_zIdx_routetip = 10003;//ルートチップ
itsmo.map.d_map_zIdx_myspot = 10002;//登録地点
itsmo.map.D_LYRZIDX_NEAR = 10003;//通常小吹き出し
itsmo.map.D_TIPZIDX_RANGE = 10003;//料金系の小吹き出し
itsmo.map.D_TIPZIDX_MAPLINK = 10004;//ここアイコン
itsmo.map.D_TIPZIDX_HOME = 10005;//自宅アイコン
itsmo.map.D_TIPZIDX_MAX = 10006;//マウスオーバー吹き出し
itsmo.map.D_ZINDEX_LAYER = 10003;
// サイズ
itsmo.vars.g_windowHeight = 0;
itsmo.vars.g_windowWidth = 0;
itsmo.vars.PAGE_WIDTH_MIN = 950;
itsmo.vars.PAGE_HEIGHT_MIN = 540;
itsmo.vars.PAGE_HEADER_HEIGHT = 76;
itsmo.vars.PAGE_NARROW_HEIGHT = 0;
itsmo.vars.MAP_HEADER_HEIGHT = 40;
itsmo.vars.MAP_FOOTER_HEIGHT = 60;
// その他
itsmo.vars.g_map_draged = 0;
itsmo.vars.g_map_ctlcur = null;
itsmo.vars.g_map_ctlzoom = null;
itsmo.vars.g_map_click_cancel = null;
itsmo.vars.g_mouseDownEvent = null;
itsmo.vars.g_mouseDragb = null;
itsmo.vars.g_dist = 0;
itsmo.vars.g_byway = 0;
itsmo.vars.g_ad_init_func = []; // 広告初期化関数群
itsmo.vars.addon = {};
itsmo.vars.addon.onClickFreeword = [];
itsmo.vars.addon.onload_end = [];
itsmo.vars.g_userMsgInfo = null;
itsmo.vars.g_cursor_normal = 'auto';
itsmo.vars.g_cursor_drag = 'move';
itsmo.vars.g_msginfo = null;
itsmo.vars.premiumMap = null;
itsmo.vars.mapUserControl = null;
itsmo.vars.mapUserControlConfig = null;
itsmo.vars.isCancelGPS = false;
//------------------------------------------------
// ログイン
//------------------------------------------------
itsmo.map.map_login = function(corp,aid,cid,sid) {
itsmo.vars.g_map_corp = corp;
itsmo.vars.g_map_aid = aid;
itsmo.vars.g_map_cid = cid;
itsmo.vars.g_map_sid = sid;
};
itsmo.map.MAP_TYPE = {
'NORMAL' : '',
'TOWN' : '?town=1',
'TOURIST': 'tourist',
'TRANSIT': 'transit',
'LANDMARK': 'landmark',
'LASTTRAIN': 'lasttrain',
'LASUP': 'lasup',
'SPRING': 'spring'
}
//------------------------------------------------
// 画面初期化
//------------------------------------------------
itsmo.map.map_onload = function(lat,lon,lvl) {
var flgFullScreen = itsmo.lib.cookie_get('full_screen');
if(flgFullScreen){
itsmo.lib.map_windowopen('map_confirm_fullscreen_popup');
}
// 画面要素取得 ------------------------------
if (lvl >= 18) {
lvl = 18;
}
var latlon = itsmo.lib.toLatLon(lat, lon);
var i = location.search;
var isTownMap = false;
if (i.length >= 1) {
i = i.substring(1).split('&');
$.each(i, function(n, v) {
if (v.indexOf('town') == 0) {
isTownMap = true;
return null;
}
});
}
// jQuery ajax設定
jQuery.ajaxSetup({
timeout: 30000,
cache: false
});
$.getScript('/js/jquery.ba-bbq.min.js', function() {
$(window).bind('hashchange', itsmo.sub.onHashChange);
});
ZDC._TILE_SERVERS = TILE_MAP;
// メイン画面
ZDC._TILE_PATHS["4"] = ZDC._TILE_PATHS["24"];
var mapType = isTownMap ? ZDC.MAPTYPE_TOWNWALK : ZDC.MAPTYPE_COLOR
/* Remove tourist layer from spring map
if(mapAction == 'spring'){
ZDC._TILE_PATHS["4"] = ZDC._TILE_PATHS["ond/42"];
}
*/
if(mapAction == 'koyo' || mapAction == itsmo.map.MAP_TYPE.SPRING){
ZDC._TILE_PATHS["4"] = ZDC._TILE_PATHS["ond/42"];
}
if(typeof(itsmo.map.PremiumMap) != 'undefined'){
itsmo.map.PremiumMap.initTilePath(mapAction);
}
// remove map lasup
// if(mapAction == itsmo.map.MAP_TYPE.LASUP){
// ZDC._TILE_PATHS["4"] = ZDC._TILE_PATHS["ond/40"];
// if (!(document.referrer.match('/map/'))){
// lvl = 9;
// if (facilityNumber != null){
// lvl = 16;
// }
// }
// }
// 地図初期化 --------------------------------
itsmo.vars.g_map_obj = new ZDC.Map(
$('#ajax_map').get(0),
{
mapType: mapType,
latlon: latlon,
zoomCenter: true,
zoomRange: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
zoom: lvl - 1
}
);
itsmo.vars.g_map_is_town = isTownMap;
itsmo.vars.g_map_obj.dragOn();
itsmo.vars.g_map_obj.zoomOn();
//itsmo.vars.g_map_obj.setMapType(10); // 街歩き地図
itsmo.map.setMouseCursor('hand');
//itsmo.vars.g_map_obj.CenterFirst = true;
itsmo.vars.g_map_center_icon = new ZDC.MapCenter();
// 中心のクロスを描画しないよう変更
// changed by konishi 2013/08/29
//itsmo.vars.g_map_obj.addWidget(itsmo.vars.g_map_center_icon); //中心アイコン
itsmo.vars.g_map_obj.addWidget(new ZDC.ScaleBar());
// ズームコントロール ------------------------
var mapControlImage = '/design/cssimg/map-ctr.png';
itsmo.vars.mapUserControlConfig = {
bar: {
src: mapControlImage,
pos:{top : 172,left: 32},
imgTL:{top: 480,left: 71},
imgSize:{width:10,height:106}
},
plus: {
src: mapControlImage,
pos:{top : 152,left: 28},
imgTL:{top: 513,left: 1},
imgSize:{width:18,height:18}
},
minus: {
src: mapControlImage,
pos:{top : 280,left: 28},
imgTL:{top: 535,left: 1},
imgSize:{width:18,height:18}
},
btn: {
src: mapControlImage,
pos:{top : 0,left: -4},
imgTL:{top: 557,left: 1},
imgSize:{width:18,height:10}
},
bar_hvr: {
src: mapControlImage,
pos:{top : 172,left: 32},
imgTL:{top: 480,left: 71},
imgSize:{width:10,height:106}
},
plus_hvr: {
src: mapControlImage,
pos:{top : 152,left: 28},
imgTL:{top: 513,left: 21},
imgSize:{width:18,height:18}
},
minus_hvr: {
src: mapControlImage,
pos:{top : 280,left: 28},
imgTL:{top: 535,left: 21},
imgSize:{width:18,height:18}
},
btn_hvr: {
src: mapControlImage,
pos:{top : 0,left: -4},
imgTL:{top: 557,left: 21},
imgSize:{width:18,height:10}
}
}
itsmo.vars.mapUserControl = new ZDC.UserControl(itsmo.vars.mapUserControlConfig,{start:-3,interval:6,close:false});
itsmo.vars.g_map_obj.addWidget(itsmo.vars.mapUserControl);
$('#ajax_mapbor #maptype-btn').click(function (event) {
var isOn = ($(this).attr('class').indexOf('maptype-open') != -1);
if (isOn) {
$(this).removeClass('maptype-open');
$(this).addClass('maptype-close');
} else {
$(this).removeClass('maptype-close');
$(this).addClass('maptype-open');
}
$("#maptype-panel").toggle({duration:400});
});
// レイヤー作成 ------------------------------
// ルート用
itsmo.vars.g_map_layer_route = new itsmo.map.UserLayer();
itsmo.vars.g_map_layer_route.setZIndex(itsmo.map.D_LYRZIDX_NEAR - 1);
// 周辺用
itsmo.vars.g_map_layer_clickable = new itsmo.map.UserLayer();
itsmo.vars.g_map_layer_clickable.setZIndex(itsmo.map.D_LYRZIDX_NEAR);
// VICS用
itsmo.vars.g_map_layer_vics = new itsmo.map.UserLayer();
itsmo.vars.g_map_layer_vics.setZIndex(itsmo.map.d_map_zIdx_route - 1);
// 渋滞統計表示
itsmo.vars.g_route_vics = new RouteVics();
// マウスダウン・アップイベント処理
$(document).bind('mousedown', itsmo.map.onMouseDown).bind('mouseup', itsmo.map.onMouseUp);
// シングルクリックで移動させる処理 ----------
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_DRAG_START, itsmo.map.map_dragmap);
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CLICK, itsmo.map.map_clickmap);
// -------------------------------------------
itsmo.vars.d_url_login = $('#login_url').html();
itsmo.map.map_menu_open();
itsmo.map.map_search();
//itsmo.map.map_search_nozoom();
itsmo.sub.map_ad_areamatch();
itsmo.sub.map_ad_hotspot();
itsmo.mypage.mypage();
// 詳細設定 ----------------------------------
itsmo.vars.g_config = new itsmo.config.MapEasyConfig();
itsmo.vars.g_config.init();
// 画面初期化 --------------------------------
itsmo.map.eventCallbackSet();
itsmo.myroute.myroute_panel_change('close');
itsmo.map.map_onload_corp();
itsmo.range.init();
// ルート検索作業領域
$('body').append(itsmo.vars.g_myroute_work);
// パネルのマウス移動対応。
$("#sc").bind('keyup', function(e) {
if (27 == e.keyCode) {
itsmo.lib.map_windowclose();
}
});
// 広告初期化
$.each(itsmo.vars.g_ad_init_func, function() {
this();
});
if(typeof(itsmo.map.PremiumMap) != 'undefined' && typeof(itsmo.map.PremiumMapBuilder) != 'undefined'){
var premiumMapBuilder = new itsmo.map.PremiumMapBuilder(mapAction);
itsmo.vars.premiumMap = premiumMapBuilder.build();
if(itsmo.vars.premiumMap != null){
itsmo.vars.premiumMap.run();
}
}
itsmo.map.addFullScreenListener();
itsmo.map.createMarkerCenter();
};
itsmo.map.map_onload_end = function() {
$.each(itsmo.vars.addon.onload_end, function(i, v) {
v();
});
var isHashChange = true;
if(mapAction == itsmo.map.MAP_TYPE.LASUP){
isHashChange = false;
itsmo.lasup.initStationAreas();
if (startStation == 'false') {
if (document.referrer.match('/map/')) {
var latlon = itsmo.vars.g_map_obj.getLatLon();
itsmo.lasup.getStartStation(latlon);
} else {
itsmo.lasup.getStartStation();
}
} else {
itsmo.lasup.init();
var latlon = itsmo.lib.toLatLon(startStation.station_lat, startStation.station_lon);
itsmo.vars.g_map_obj.moveLatLon(latlon);
itsmo.lasup.initEndStations();
}
itsmo.vars.g_map_tab_mode = 'facnum';
}
var hasHash = window.location.hash.indexOf('#') >= 0;
if (hasHash) {
} else if(itsmo.vars.g_map_tab_mode == 'top') {
if(mapAction != 'smp'){
itsmo.sub.map_tab_change('top');
}else{
itsmo.sub.map_tab_change('');
}
// if(itsmo.vars.g_config.maprecommend != 0){
// itsmo.sub.map_osusume_search(1);//オススメ情報ツールチップ
// }
}
//itsmo.sub.map_overture();
itsmo.sub.map_overture_by_scrollend();
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_DRAG_END, itsmo.map.map_dragmapend);
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_SCROLL_END, itsmo.map.map_scrollmapend);
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CHG_LATLON, itsmo.map.map_scrollmapend);
ZDC.addListener(itsmo.vars.g_map_obj, ZDC.MAP_CHG_ZOOM, itsmo.map.map_changezoomend);
//地図上メニューバー
// var flg = itsmo.lib.cookie_get('menu_bar_flg');
// if(flg == 'close'){ $('#map_other_close_link').click(); }
// flg = $("#ajax_mapbor img[src*='blank.gif']").parent();
// if (flg.is('div')) {
// flg.attr('title', '右クリックでピンポイント住所を表示');
// }
if (window.location.hash.indexOf('#') >= 0) {
if (isHashChange) {
itsmo.sub.onHashChange();
}
}
$(".route-config-component").on("change", function(){
if(itsmo.myroute.route && itsmo.myroute.route.isDisplayRoute){
$(".config-buttons-wrap").show();
}
});
};
itsmo.map.map_onload_corp = function() {
//
};
// 各イベント
itsmo.map.map_dragmap = function() {
itsmo.vars.g_map_draged++;
itsmo.map.setCursorToMap(true);
};
itsmo.map.map_clickmap = function() {
// ドラッグ中、ルート設定中、クリックキャンセル中以外
if(itsmo.vars.g_map_draged < 2 && itsmo.vars.g_myroute_event.length <= 0
&& !itsmo.vars.g_mouseDrag && !itsmo.vars.g_map_click_cancel) {
if (null != itsmo.vars.g_config && itsmo.vars.g_config.isDblClickNoMove()) {
//itsmo.vars.g_map_obj.moveLatLon(itsmo.vars.g_map_obj.getClickLatLon());
} else {
// 中心へ移動
itsmo.vars.g_map_obj.moveLatLon(itsmo.vars.g_map_obj.getClickLatLon());
}
}
itsmo.vars.g_map_draged = 0;
};
itsmo.map.map_dragmapend = function() {
itsmo.map.setCursorToMap(false);
itsmo.map.map_search_timer(false);
if(mapAction == 'lasup'){
itsmo.lasup.initEndStations();
}
};
itsmo.map.map_scrollmapend = function() {
itsmo.map.map_search_timer(false);
if(mapAction == 'lasup'){
itsmo.lasup.initEndStations();
}
};
itsmo.map.map_changezoomend = function() {
itsmo.vars.g_map_draged = 0;
itsmo.myroute.map_vics_clear();
itsmo.map.map_search_timer(true);
if(mapAction == 'lasup'){
itsmo.lasup.mapChangeZoom();
itsmo.lasup.initEndStations();
}
};
// マウスダウン時の処理
itsmo.map.onMouseDown = function(event)
{
itsmo.vars.g_mouseDownEvent = event;
/*
// 右クリックパネルにマウスオーバーしていなければ非表示
if (!dcmpc.vars.rightClickPanelMouseOver) {
dcmpc.hideRightClickPanel();
}
// ルートタイプパネルにマウスオーバーしていなければ非表示
if (!dcmpc.vars.routeTypePanelMouseOver) {
dcmpc.routepanel.hideRouteTypePanel();
}
*/
if (!itsmo.vars.g_myspot_edit_spot){
itsmo.map.setMouseCursor("hand");
}
};
// マウスアップ時の処理
itsmo.map.onMouseUp = function(event)
{
if (itsmo.vars.g_mouseDownEvent) {
itsmo.vars.dx = event.pageX - itsmo.vars.g_mouseDownEvent.pageX;
itsmo.vars.dy = event.pageY - itsmo.vars.g_mouseDownEvent.pageY;
if (itsmo.vars.dx > 5 ||
itsmo.vars.dx < -5 ||
itsmo.vars.dy > 5 ||
itsmo.vars.dy < -5) {
itsmo.vars.g_mouseDrag = true;
} else {
itsmo.vars.g_mouseDrag = false;
}
}
};
// 一定時間地図クリックイベントをキャンセルする
itsmo.map.cancelMapClickEvent = function()
{
itsmo.vars.g_map_click_cancel = true;
setTimeout(function() {
itsmo.vars.g_map_click_cancel = null;
}, 200);
};
//------------------------------------------------
// リサイズ処理
//------------------------------------------------
itsmo.map.map_resize = function() {
// スクロールバーが出たり消えたりするので一旦地図を消す
$('#ajax_map').width(1).height(1);
if (itsmo.vars.g_map_obj) {
itsmo.vars.g_map_obj.refresh();
}
if (itsmo.map.isOldIE()) {
$('body').attr('scroll', 'auto');
} else {
$('body').css('overflow', 'visible');
}
// ウィンドウサイズ取得
var win_w = $(window).width();
var win_h = $(window).height();
if(win_w < 950) win_w = 950;
if(win_h < 540) win_h = 540;
var map_h = parseInt(win_h) - itsmo.vars.PAGE_HEADER_HEIGHT;
if(itsmo.vars.isFullScreen === true){
map_h = parseInt(win_h);
$('#wrap-map').css({'position':'fixed', zIndex: 80});
} else {
$('#wrap-map').css({'position': 'static', zIndex: 'auto'});
}
itsmo.vars.g_windowHeight = win_h;
itsmo.vars.g_windowWidth = win_w;
// デザイン変更
//$("#screen-wrap").height(win_h);下に余白がいっぱいできるのでとりあえずコメアウ2011/1/20
$("#wrap-map").height(map_h);
if (itsmo.map.isOldIE()) {
$('#wrap-map').attr('scroll', 'auto');
} else {
$('#wrap-map').css('overflow', 'visible');
}
// 地図サイズ変更
var map_w = $("#ajax_mapbor").width();
$('#ajax_map').width(map_w - 2).height(map_h - 2);
itsmo.vars.g_map_obj.refresh();
if (itsmo.vars.premiumMap != null) {
itsmo.vars.premiumMap.centerTimerBox();
}
//overtureサイズ変更
var userAgent = window.navigator.userAgent.toLowerCase();
if (userAgent.indexOf("chrome") > -1) {
$('#ajax_map_overture_header').css('width','100%');
$('#ajax_map_overture_header').fadeOut(1).fadeIn(1);
}else{
var overture_w = $('#ajax_map_overture_header').width('100%');
}
//var overture_h = $('#ajax_map_overture_header').height();
// 左側コンテンツのサイズ調整
itsmo.map.setLeftContentSize();
itsmo.map.createMarkerCenter();
};
// 左メニュー開閉
itsmo.map.map_menu_open = function() {
itsmo.lib.document_on('m-left');
itsmo.lib.document_on('ajax_m-close');
itsmo.lib.document_off('ajax_m-open');
$('#content').css('padding', '');
itsmo.vars.g_map_bor_w = -1;
itsmo.map.map_resize();
};
itsmo.map.map_menu_close = function() {
itsmo.lib.document_off('m-left');
itsmo.lib.document_off('ajax_m-close');
itsmo.lib.document_on('ajax_m-open');
$('#content').css('padding', '0px 0px 0px 5px');
itsmo.vars.g_map_bor_w = -1;
itsmo.map.map_resize();
};
/*
* 左メニューのサイズ設定
*/
itsmo.map.setLeftContentSize = function()
{
var win_h = itsmo.vars.g_windowHeight;
var header_h = itsmo.vars.PAGE_HEADER_HEIGHT;
// 絞込み枠サイズ取得
var narrow_h = 22;
var left_footer_h = 22;
if ($('#ajax_leftmenu_result div').hasClass('sibo-waku-2')) {
// 不動産
//narrow_h = $('#ajax_leftmenu_result .sibo-waku-2').height();
narrow_h = 200;
} else if($('#ajax_leftmenu_result div').hasClass('sibo-waku-4')) {
// アルバイト
//narrow_h = $('#ajax_leftmenu_result .sibo-waku-4').height();
narrow_h = 190;
} else if($('#ajax_leftmenu_result div').hasClass('sibo-waku-3')) {
// おすすめ
//narrow_h = $('#ajax_leftmenu_result .sibo-waku-3').height();
narrow_h = 83;
} else if($('#ajax_leftmenu_result div').hasClass('sibo-waku')) {
// 施設検索
//narrow_h = $('#ajax_leftmenu_result .sibo-waku').height();
narrow_h = 135;
} else if($('#ajax_leftmenu_result div').hasClass('hanabi-waku')) {
// 花火
//narrow_h = $('#ajax_leftmenu_result .sibo-waku').height();
narrow_h = 135;
} else if($('#ajax_leftmenu_result p').hasClass('sibo-waku-pan')) {
// 地図最適化
narrow_h = $('#ajax_leftmenu_result .sibo-waku-pan').height();
if (narrow_h == 0) narrow_h = 44;
if ($('#ajax_leftmenu_result .bNavArea').css('height')) {
// 絞込一覧
narrow_h = parseInt(narrow_h) + parseInt($('#ajax_leftmenu_result #select_addrlist').css('height'));
}
} else if($("#ajax_leftmenu_result div").hasClass('bus-left-header')){
narrow_h = (itsmo.sub.getHtmlSize($('.bus-left-header').html())).height + 12;
}
if($("#ajax_leftmenu_result div#lasup-checkbox-area").length > 0){
narrow_h += 164;
}
// fotterサイズ取得
if ($('#ajax_leftmenu_result div').hasClass('map-left-kaipage')) {
// fotter改ページ
//left_footer_h += $('#ajax_leftmenu_result .map-left-kaipage').height();
left_footer_h += 45;
}//else{
// left_footer_h = 22;
// }
// リサイズ設定
//var map_pan_h = 22;//.map-pan-list1
var ht = win_h - header_h - narrow_h - left_footer_h - itsmo.vars.MAP_HEADER_HEIGHT; // - map_pan_h ;
$('#ajax_leftmenu_result .scrollable').height(ht).scrollTop(0);
//$("#ajax_scrollable_4").height($("#wrap-map").height() - 102);
//$("#ajax_scrollable_4").height((itsmo.vars.g_windowHeight - itsmo.vars.PAGE_HEADER_HEIGHT - 102));
$("#ajax_scrollable_4").height((itsmo.vars.g_windowHeight - itsmo.vars.PAGE_HEADER_HEIGHT - itsmo.vars.MAP_HEADER_HEIGHT));
$("#route_menu").height((itsmo.vars.g_windowHeight - itsmo.vars.PAGE_HEADER_HEIGHT - itsmo.vars.MAP_HEADER_HEIGHT));
};
//------------------------------------------------
// 自動検索の処理
//------------------------------------------------
// 検索メイン処理
itsmo.map.map_search = function() {
if(itsmo.vars.g_range_cancel == 1){//左リストをクリックして中心点を変えた場合
itsmo.vars.g_range_cancel = 0;
return false;
}
itsmo.vars.g_map_search_location = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
itsmo.vars.g_map_search_scale = itsmo.vars.g_map_obj.getZoom() + 1;
itsmo.map.setSearchBox();
flg = 0;
if(itsmo.vars.g_map_search_location_old != null) {
//移動無しなら検索しない
if(itsmo.vars.g_map_search_location.lat == itsmo.vars.g_map_search_location_old.lat
&& itsmo.vars.g_map_search_location.lon == itsmo.vars.g_map_search_location_old.lon
&& itsmo.vars.g_map_search_scale == itsmo.vars.g_map_search_scale_old) {
flg = 1;
}
}
// 検索条件設定
itsmo.vars.g_map_search_location_old = itsmo.vars.g_map_search_location;
itsmo.vars.g_map_search_scale_old = itsmo.vars.g_map_search_scale;
itsmo.vars.g_map_search_box_old = itsmo.vars.g_map_search_box;
// 各検索処理呼び出し
if(flg) return false;
itsmo.map.map_search_corp();
// 周辺検索
if(itsmo.vars.g_map_tab_mode == 'range') {
if(itsmo.vars.g_range_genre == 'suumo'){
itsmo.near_suumo.set_pange_and_search(1);
} else if(itsmo.vars.g_range_genre == 'osusume') {
// おすすめの再検索
itsmo.sub.map_osusume_search(null,itsmo.vars.osusume_word);
} else if(itsmo.vars.g_range_genre == 'baitoru') {
// アルバイトの再検索
itsmo.near_baitoru.search();
} else if(itsmo.vars.g_range_genre == 'tabikura') {
// 旅くらの再検索
itsmo.tabikura.search();
} else if(itsmo.vars.g_range_genre == itsmo.near_season.mode){
// 季節特集の再検索
itsmo.near_season.cond_search();
} else if(itsmo.vars.g_range_genre == 'new_building'){
// 新規施設の再検索
itsmo.near_new_building.search();
} else {
// それ以外の再検索
itsmo.range.range_research();
}
}
//フリーワード
if(itsmo.vars.g_map_tab_mode == 'freeword') {
if(itsmo.vars.g_freeword_mode == 'all' && itsmo.vars.g_freeword_flg != '1'){itsmo.freeword.freeword_submit_move();}
}
if(itsmo.vars.g_map_tab_mode == 'michinoeki'){
itsmo.map.roadStation.reSearchMapEvent();
}
if(itsmo.vars.g_map_tab_mode == 'facnum'){
itsmo.facilityNight.getFacilities();
};
return true;
};
itsmo.map.setSearchBox = function() {
itsmo.vars.g_map_search_box = itsmo.vars.g_map_obj.getLatLonBox();
var flg = itsmo.lib.toMilliSec(itsmo.vars.g_map_search_box.getMin());
itsmo.vars.g_map_search_box.minx = flg.lon;
itsmo.vars.g_map_search_box.miny = flg.lat;
flg = itsmo.lib.toMilliSec(itsmo.vars.g_map_search_box.getMax());
itsmo.vars.g_map_search_box.maxx = flg.lon;
itsmo.vars.g_map_search_box.maxy = flg.lat;
};
// ズーム以外の場合にだけ呼ばれる。
itsmo.map.map_search_nozoom = function() {
// 広告(エリアマッチ、hotspot)
if(itsmo.vars.g_map_tab_mode == 'top') {
//itsmo.sub.map_ad_areamatch();
itsmo.sub.map_ad_hotspot();
// if(itsmo.vars.g_config.maprecommend != 0){
// itsmo.sub.map_osusume_search(1);//オススメ情報ツールチップ
// }
}
itsmo.sub.map_overture_by_scrollend();
};
// 検索サブ処理
itsmo.map.map_search_corp = function() {
//
};
// 検索ウェイト
itsmo.vars.g_searchetimer = null;
itsmo.vars.g_searchetimer_is_zoom = false;
itsmo.map.map_search_timer = function(isZoom) {
itsmo.vars.g_map_search_location = itsmo.lib.toMilliSec(itsmo.vars.g_map_obj.getLatLon());
itsmo.vars.g_map_search_scale = itsmo.vars.g_map_obj.getZoom() + 1;
itsmo.map.setSearchBox();
// 現在地を保存
var i = itsmo.vars.g_map_search_location;
itsmo.lib.cookie_set('cktg_pos', i.lat + "\t" + i.lon + "\t" + itsmo.vars.g_map_search_scale);
itsmo.vars.g_searchetimer_is_zoom = isZoom;
// 検索処理
if(itsmo.vars.g_searchetimer != null) {
itsmo.lib.map_waitclose();
clearTimeout(itsmo.vars.g_searchetimer);
}
itsmo.vars.g_searchetimer = setTimeout(itsmo.map.map_search_timer_func, 2 * 1000);
//
//itsmo.sub.map_overture();
itsmo.map.map_search_timer_corp();
};
// 検索サブ処理
itsmo.map.map_search_timer_corp = function() {
};
itsmo.map.map_search_timer_func = function() {
itsmo.vars.g_searchetimer = null;
itsmo.lib.map_waitclose();
if (itsmo.map.map_search()) {
if (!itsmo.vars.g_searchetimer_is_zoom) {
itsmo.map.map_search_nozoom();
}
if(itsmo.vars.g_map_tab_mode == 'top') {
itsmo.sub.map_ad_areamatch();
}
}
};
// 地図表示関連。
itsmo.vars.g_map_hyouji_hover_timer = null;
itsmo.map.map_hyouji_hover = function(isShow) {
var s = 'ajax-map-hyouji-hover';
if (isShow) {
if (null != itsmo.vars.g_map_hyouji_hover_timer) {
clearTimeout(itsmo.vars.g_map_hyouji_hover_timer);
itsmo.vars.g_map_hyouji_hover_timer = null;
}
itsmo.lib.document_on(s);
} else {
if (null == itsmo.vars.g_map_hyouji_hover_timer) {
itsmo.vars.g_map_hyouji_hover_timer = setTimeout(function() {
itsmo.lib.document_off(s);
itsmo.vars.g_map_hyouji_hover_timer = null;
}, 0);
}
}
};
//ツールチップの表示
itsmo.map.showMapTooltip = function () {
//施設ツールチップ
if(itsmo.vars.g_map_tipid_clickable_s){
jQuery.each(itsmo.vars.g_map_tipid_clickable_s, function(i,val) {
itsmo.vars.g_map_layer_clickable.showById(val.tip_id);
});
}
//自宅ツールチップ
if (itsmo.vars.g_home_tipid_c != null) {
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_home_tipid_c);
}
//ココツールチップ
if (itsmo.vars.g_map_link_tipid_c != null) {
itsmo.vars.g_map_layer_clickable.showById(itsmo.vars.g_map_link_tipid_c);
}
}
//ツールチップの非表示
itsmo.map.hideMapTooltip = function () {
//施設ツールチップ
if(itsmo.vars.g_map_tipid_clickable_open != null){
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_tipid_clickable_open);
itsmo.vars.g_map_tipid_clickable_open = null;
}
if(itsmo.vars.g_map_tipid_clickable_s){
jQuery.each(itsmo.vars.g_map_tipid_clickable_s, function(i,val) {
itsmo.vars.g_map_layer_clickable.hideById(val.tip_id);
});
}
//自宅ツールチップ
if(itsmo.vars.g_home_tipid_o != null){
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_home_tipid_o);
itsmo.vars.g_home_tipid_o = null;
}
if(itsmo.vars.g_home_tipid_c != null){
itsmo.vars.g_map_layer_clickable.hideById(itsmo.vars.g_home_tipid_c);
}
//ココツールチップ
if(itsmo.vars.g_map_link_tipid_o != null){
itsmo.vars.g_map_layer_clickable.removeById(itsmo.vars.g_map_link_tipid_o);
itsmo.vars.g_map_link_tipid_o = null;
}
if(itsmo.vars.g_map_link_tipid_c != null){
itsmo.vars.g_map_layer_clickable.hideById(itsmo.vars.g_map_link_tipid_c);
}
}
//ツールチップのマウスオーバー、マウスアウト時の処理
itsmo.map.addEventTooltip = function(tip, z_index) {
ZDC.addListener(tip, ZDC.USERWIDGET_MOUSEOVER, function() {
clearTimeout(itsmo.vars.pickupTooltipTimeout);
itsmo.vars.currentTooltip = tip;
itsmo.vars.pickupTooltipTimeout = setTimeout(function() {
itsmo.vars.currentTooltip.setZindex(itsmo.map.D_TIPZIDX_MAX);
}, 200);
});
if(typeof z_index != 'undefined'){
ZDC.addListener(tip, ZDC.USERWIDGET_MOUSEOUT, function() {
clearTimeout(itsmo.vars.pickupTooltipTimeout);
tip.setZindex(z_index);
});
}
};
// ブラウザが旧IEかどうかを返す
itsmo.map.isOldIE = function() {
return $.support.msie && !$.support.style;
};
//地図上その他ボタンの開け閉め
//itsmo.map.clickOnMapBtn = function (event)
//{
// itsmo.lib.cookie_set('menu_bar_flg','' + event.data.css);
// $('#' + event.data.closeId).hide();
// $('#' + event.data.openId).show();
// $('#map-btn').attr('class','map-rt0-' + event.data.css);
//};
//地図上パネルの開け閉め
itsmo.map.onMapMenuEvent = function (event)
{
var id= event.data.id;
if(event.data.act == 'open'){
$('#' + id).show().css('z-index','999');
}else{
$('#' + id).hide();
}
};
// 地図タイプ変更
itsmo.map.setMapType = function(type) {
if(itsmo.vars.isFullScreen){
itsmo.lib.cookie_set('full_screen','full');
}
var url = location.protocol + '//' + location.host + '/map/';
var hash = window.location.hash;
location.href = url + type + hash;
};
/*
初期化時にまとめてバインド
for public use
*/
itsmo.map.eventCallbackSet = function() {
$(window).resize(itsmo.map.map_resize);
//ヘッダータブ
$('#ajax_menu-tp a').bind('click',itsmo.sub.map_genre);
$('#ajax_menu-add a').bind('click',function(){itsmo.addrlist.showPage('top');});
$('#ajax_menu-my a').bind('click',function(){itsmo.mypage.mypage('top');});
$('#menu-route-search a').bind('click',function(){itsmo.myroute.routeTop('car');});
//その他ボタン
// $('#map-other a').bind('click', {openId:'map-other-open',closeId:'map-other',css:'open'},itsmo.map.clickOnMapBtn);
// $('#map_other_close_link').bind('click', {openId:'map-other',closeId:'map-other-open',css:'close'},itsmo.map.clickOnMapBtn);
//送信ボタン
//設定ボタン
$('#map_config_link').bind('click',itsmo.config.configShowWindow);
//渋滞統計
// $('#vics_menu_resize').bind('click',{id: 'vics_content,vics_traffic_time'},itsmo.myroute.onMapRoutePanelResize);
};
itsmo.map.closeUserMsgWindow = function() {
if (null == itsmo.vars.g_userMsgInfo) {
return;
}
itsmo.vars.g_userMsgInfo.close();
itsmo.vars.g_userMsgInfo = null;
};
itsmo.map.openUserMsgWindow = function(latlon, html, offset) {
latlon = itsmo.lib.toLatLon(latlon);
itsmo.map.closeUserMsgWindow();
var sz = itsmo.sub.getHtmlSize(html);
if (null == itsmo.vars.g_userMsgInfo) {
var param = {
size: sz,
html: html
};
if (typeof offset === 'undefined') {
param['offset'] = offset;
}
itsmo.vars.g_userMsgInfo = new ZDC.MsgInfo(latlon, param);
itsmo.vars.g_map_obj.addWidget(itsmo.vars.g_userMsgInfo);
} else {
itsmo.vars.g_userMsgInfo.moveLatLon(latlon);
itsmo.vars.g_userMsgInfo.setHtml(html, sz);
}
itsmo.vars.g_userMsgInfo.open();
};
itsmo.map.setMouseCursor = function(type, urlNormal, urlDrag) {
switch (type) {
case 'users':
itsmo.vars.g_cursor_drag = itsmo.vars.g_cursor_normal = "url(" + urlNormal + "),pointer";
if (null != urlDrag && undefined != urlDrag) {
itsmo.vars.g_cursor_drag = "url(" + urlDrag + "),pointer";
}
break;
case 'css':
if (itsmo.vars.g_cursor_normal == urlNormal) {
return;
}
itsmo.vars.g_cursor_drag = itsmo.vars.g_cursor_normal = urlNormal;
if (null != urlDrag && undefined != urlDrag) {
itsmo.vars.g_cursor_drag = urlDrag;
}
break;
default:
itsmo.vars.g_cursor_drag = 'move';
itsmo.vars.g_cursor_normal = 'auto';
break;
};
itsmo.map.setCursorToMap(false);
};
itsmo.map.setCursorToMap = function(isDrag) {
var c = isDrag ? itsmo.vars.g_cursor_drag : itsmo.vars.g_cursor_normal;
$('#ajax_map').css('cursor', c).find('div:first').css('cursor', c);
};
itsmo.map.addFullScreenListener = function () {
document.addEventListener("fullscreenchange", function () {
if (document.fullscreen) {
itsmo.map.fixMapFullScreen();
} else {
itsmo.map.fixMapExitFullScreen();
}
}, false);
document.addEventListener("mozfullscreenchange", function () {
if (document.mozFullScreen) {
itsmo.map.fixMapFullScreen();
} else {
itsmo.map.fixMapExitFullScreen();
}
}, false);
document.addEventListener("webkitfullscreenchange", function () {
if (document.webkitIsFullScreen) {
itsmo.map.fixMapFullScreen();
} else {
itsmo.map.fixMapExitFullScreen();
}
}, false);
document.addEventListener("MSFullscreenChange", function () {
if (document.msFullscreenElement) {
itsmo.map.fixMapFullScreen();
} else {
itsmo.map.fixMapExitFullScreen();
}
}, false);
}
itsmo.map.fullScreen = function(){
var el = document.documentElement;
if(el.requestFullscreen) {
el.requestFullscreen();
} else if(el.mozRequestFullScreen) {
el.mozRequestFullScreen();
} else if(el.webkitRequestFullScreen) {
el.webkitRequestFullScreen();
} else if(el.msRequestFullscreen) {
el.msRequestFullscreen();
} else {
alert('ご利用のブラウザはフルスクリーン操作に対応していません');
return;
}
}
itsmo.map.exitFullScreen = function (){
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
itsmo.map.fixMapFullScreen = function(){
itsmo.vars.isFullScreen = true;
itsmo.map.fullScreenCancelPopup();
$(".map_header1").css('background-color','rgba(0,0,0,0)');
$("#full-screen-map-btn").attr('onClick','itsmo.map.exitFullScreen();');
$("#full-screen-map-btn").attr('title','全画面表示解除');
$(".map-header-right").css('zIndex','79');
$("#full-screen-map-btn").addClass('exit');
$("#ajax_mapbor").css({position:'fixed',width:'100%',height:'100%',zIndex:'80',top:0,left:0, bottom:0, right:0});
itsmo.map.map_resize();
};
itsmo.map.fixMapExitFullScreen = function () { //exitFullScreen
itsmo.vars.isFullScreen = false;
itsmo.map.fullScreenCancelPopup();
itsmo.lib.cookie_del('full_screen');
$(".map_header1").css('background-color', 'rgba(0,0,0,0.5)');
$("#full-screen-map-btn").attr('onClick', 'itsmo.map.fullScreen();');
$("#full-screen-map-btn").attr('title', '全画面表示');
$(".map-header-right").css('zIndex', '2000');
$("#full-screen-map-btn").removeClass('exit');
$("#ajax_mapbor").removeAttr('style');
itsmo.map.map_resize();
};
$(document).keyup(function(e) {
// key code 27 = ESC | key code 122 = F11
if ((e.keyCode == 27 || e.keyCode == 122) && itsmo.vars.isFullScreen == true) {
itsmo.map.exitFullScreen();
}
});
itsmo.map.changeBalloonSize = function(){
if (0 != itsmo.vars.g_config.mapinfo_minimize) {
itsmo.map.bus.maximizeBalloons();
itsmo.facilityNight.maximizeBalloons();
$('#config_mapinfo_minimize').val(0);
$(".map_header1 #balloon-size #small-icon").addClass('off');
$(".map_header1 #balloon-size #large-icon").removeClass('off');
} else {
itsmo.map.bus.minimizeBalloons();
itsmo.facilityNight.minimizeBalloons();
$('#config_mapinfo_minimize').val(1);
$(".map_header1 #balloon-size #small-icon").removeClass('off');
$(".map_header1 #balloon-size #large-icon").addClass('off');
}
itsmo.config.configSubmit();
};
itsmo.map.closeMapUserControl = function(){
itsmo.vars.g_map_obj.removeWidget(itsmo.vars.mapUserControl);
itsmo.vars.mapUserControlConfig.minus.pos.top = 175;
itsmo.vars.mapUserControlConfig.minus_hvr.pos.top = 175;
itsmo.vars.mapUserControl = new ZDC.UserControl(itsmo.vars.mapUserControlConfig,{start:-3,interval:6,close:true});
itsmo.vars.g_map_obj.addWidget(itsmo.vars.mapUserControl);
$("#ajax_mapbor #map-control-close-btn").attr('href', 'javascript:itsmo.map.openMapUserControl();');
$("#ajax_mapbor #map-control-close-btn").attr('title', '閉じる');
$("#ajax_mapbor #map-control-close-btn").addClass('open');
};
itsmo.map.openMapUserControl = function(){
itsmo.vars.g_map_obj.removeWidget(itsmo.vars.mapUserControl);
itsmo.vars.mapUserControlConfig.minus.pos.top = 280;
itsmo.vars.mapUserControlConfig.minus_hvr.pos.top = 280;
itsmo.vars.mapUserControl = new ZDC.UserControl(itsmo.vars.mapUserControlConfig,{start:-3,interval:6,close:false});
itsmo.vars.g_map_obj.addWidget(itsmo.vars.mapUserControl);
$("#ajax_mapbor #map-control-close-btn").attr('href', 'javascript:itsmo.map.closeMapUserControl();');
$("#ajax_mapbor #map-control-close-btn").attr('title', '開く');
$("#ajax_mapbor #map-control-close-btn").removeClass('open');
};
itsmo.map.displayNoPremiumPopup = function (type){
itsmo.vars.g_screen_non = 0;
var popupTitle = '';
var heading = '';
var title = '';
var description = '';
var classCss = '';
var actionMapType = '';
switch(type){
case 'rain-map':
popupTitle = '雨雲表示機能のご案内';
heading = '雨雲表示機能をご利用頂くには 「プレミアコース登録」 が必要です。';
title = '雨雲表示機能とは?';
description = '地図に雨雲を重ねて表示できるから、
お天気が心配な日でもピンポイントで天気を予測可能!';
classCss= 'rain';
actionMapType = itsmo.map.MAP_TYPE.NORMAL;
break;
case itsmo.map.MAP_TYPE.TRANSIT:
popupTitle = '';
heading = '';
title = '';
description ='';
classCss = '';
break;
case itsmo.map.MAP_TYPE.LASTTRAIN:
popupTitle = '';
heading = '';
title = '';
description ='';
classCss = '';
break;
case itsmo.map.MAP_TYPE.LANDMARK:
popupTitle = '目印地図のご案内';
heading = '目印地図をご利用頂くには 「プレミアコース登録」 が必要です。';
title = '目印地図とは?';
description ='目印が多くて分かりやすい!
普段よく使うコンビニ情報やチェーン
店情報を常に最新情報でご提供!';
classCss = 'landmark';
actionMapType = itsmo.map.MAP_TYPE.LANDMARK;
break;
case itsmo.map.MAP_TYPE.TOURIST:
popupTitle = '観光地図のご案内';
heading = '観光地図をご利用頂くには 「プレミアコース登録」 が必要です。';
title = '観光地図とは?';
description ='観光スポットをアイコン化した楽しい地図!
スポット情報も分かるからお出掛けが楽しくなります。';
classCss = 'tourist';
actionMapType = itsmo.map.MAP_TYPE.TOURIST;
break;
}
$("#no-premium-popup div.komado-type02 > h3 > strong").text(popupTitle);
$("#no-premium-popup div.content-box-popup .heading").text(heading);
$("#no-premium-popup div.content-box-popup .map-overview .title-content").text(title);
$("#no-premium-popup div.content-box-popup .map-overview .map-icon").attr('class','map-icon ' + classCss);
$("#no-premium-popup div.content-box-popup .map-overview .title-content").attr('class','title-content ' + classCss);
$("#no-premium-popup div.content-box-popup .map-overview .img-wrap").attr('class','img-wrap ' + classCss);
$("#no-premium-popup div.content-box-popup .map-overview .description").html(description);
$("#no-premium-popup #action-map-type").attr('value',actionMapType);
itsmo.lib.map_windowopen('no-premium-popup');
};
itsmo.map.hideNoPremiumPopup = function (){
itsmo.vars.g_screen_non = 0;
itsmo.lib.map_windowclose('no-premium-popup');
};
itsmo.map.moveToGPS = function () {
itsmo.lib.map_wait2open('位置情報取得中...', true);
navigator.geolocation.getCurrentPosition(
function (position) {
var latlon = new ZDC.LatLon(position.coords.latitude, position.coords.longitude);
latlon = ZDC.wgsTotky(latlon);
itsmo.lib.map_wait2close();
if(itsmo.vars.isCancelGPS == true) {
itsmo.vars.isCancelGPS = false;
return;
}
itsmo.vars.g_map_obj.moveLatLon(latlon);
}
, function (err) {
if(itsmo.vars.isCancelGPS == true) {
itsmo.vars.isCancelGPS = false;
return;
}
itsmo.lib.map_wait2open('位置情報を取得できませんでした。しばらくしてからもう一度お試しください。');
setTimeout(function () {
itsmo.lib.map_wait2close();
}, 1500);
}
, {enableHighAccuracy: true, timeout: 10 * 1000, maximumAge: 20 * 1000}
);
};
itsmo.map.cancelGPS = function(){
itsmo.vars.isCancelGPS = true;
itsmo.lib.map_wait2close();
}
itsmo.map.fullScreenCancelPopup = function(){
itsmo.lib.cookie_del('full_screen');
itsmo.lib.map_windowclose('map_confirm_fullscreen_popup');
return false;
};
itsmo.map.setUrlLastBeforePayment = function(){
var url = location.protocol + '//' + location.host + '/map/';
var hash = window.location.hash;
var typeMap = $("#no-premium-popup #action-map-type").val();
var urlLastBFPayment = url + typeMap + hash;
itsmo.lib.cookie_set("back_url",urlLastBFPayment);
};
itsmo.map.redirectSignupHighrose = function(url){
var useSSL = 'https:' == document.location.protocol;
var hash = window.location.hash;
var typeMap = $("#no-premium-popup #action-map-type").val();
itsmo.lib.cookie_set('cktg_lasturl', '//' + itsmo.vars.d_host_www + '/map/' + typeMap + hash);
var retPath = 'http://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
if (useSSL) {
retPath = 'https://' + itsmo.vars.d_host_www + '/highrose_redirect.php';
}
url += '?ret=' + encodeURIComponent(retPath);
url += '?expire=0';
location.href = url;
};
itsmo.map.markerCenter = null;
itsmo.map.createMarkerCenter = function () {
if (null != itsmo.vars.g_map_obj) {
var latlon = itsmo.vars.g_map_obj.getLatLon();
var pos = itsmo.vars.g_map_obj.getMapSize();
var html = '';
var widgetlabel =
{
html: html,
size: new ZDC.WH(10, 10),
propagation: true
};
if(itsmo.map.markerCenter != null){
itsmo.vars.g_map_obj.removeWidget(itsmo.map.markerCenter);
}
itsmo.map.markerCenter = new ZDC.StaticUserWidget({
left: (pos.width - 10) / 2,
top: (pos.height - 10) / 2
}, widgetlabel);
itsmo.vars.g_map_obj.addWidget(itsmo.map.markerCenter);
itsmo.map.markerCenter.open();
}
};
itsmo.map.setPaging = function (total,currentPage, callBackfunc, limit, pageCount) {
if (typeof pageCount == 'undefined' || !pageCount){
pageCount = 6;
}
if(typeof limit == 'undefined' || !limit){
limit = itsmo.vars.g_range_cnt;
}
if(typeof callBackfunc == 'undefined' || typeof total == 'undefined'){
return null;
}
if(typeof currentPage == 'undefined' || !currentPage){
currentPage = 1;
}
var totalPage = Math.ceil(total/limit);
var indexStart = currentPage - Math.floor(pageCount / 2);
var indexEnd ='';
var nextPage ='';
var prevPage ='';
if (indexStart < 1 ){
indexStart = 1;
}
if (totalPage < pageCount) {
indexEnd = totalPage + 1;
}else{
indexEnd = indexStart + pageCount;
if(indexEnd > totalPage){
indexEnd = totalPage + 1;
}
}
if ((indexEnd - indexStart) < pageCount) {
while ((indexEnd - indexStart) < pageCount) {
indexStart -= 1;
}
if (indexStart < 1) {
indexStart = 1;
}
}
if (totalPage > currentPage){
nextPage = currentPage + 1;
}
if (currentPage != 1){
prevPage = currentPage - 1;
}
var html = '';
if (prevPage == ''){
html += '
前へ';
}else{
html += '
前へ';
}
for (var i=indexStart; i < indexEnd; i++){
if(i == currentPage){
html += '
' + currentPage +'';
}else{
html += '
' + i + '';
}
}
if (nextPage == ''){
html += '
次へ';
}else{
html += '
次へ';
}
html += '
';
return html;
};