var common_uri = "http://" + location.host + "/pcnavi/";

var driveClickFunc = function(){
   NTWindow.CarWindow.isOpen ? NTWindow.CarWindow.close() : NTWindow.CarWindow.open();
}

//  ---------------------------------------

;
var driveWindow = null;
var driveOpenFunc = function( param ){ //汽車導航
   if( param != null ){
      return function(){
         driveWindow =
         new NTWindow.List( {
            title : "汽車導航",
            width : 280,
            height : 480,
            x : 400 + NTWindow.Control.sizeList * 10,
            y : 60 + NTWindow.Control.sizeList * 30,
            onClose : ntmap.removeRoute.bind( ntmap ),
            data : {
               //uri : "/pcnavi/mjx/drive.jsp",
               uri : "/pcnavi/mjx/route_drive.php",
               param : param
            }
         }
         );
      }
      ;
   }
   else if( Drive.checkSet() ){
      if( driveWindow == null ){
         driveWindow =
         new NTWindow.List( {
            title : "汽車導航",
            width : 280,
            height : 480,
            x : 400 + NTWindow.Control.sizeList * 10,
            y : 60 + NTWindow.Control.sizeList * 30,
            onClose : ntmap.removeRoute.bind( ntmap ),
            data : {
               //uri : "/pcnavi/mjx/drive.jsp",
               uri : "/pcnavi/mjx/route_drive.php",
               form : document.md_navi
            }
         }
         );
      }
      else{
         driveWindow.get( {
          // uri : "/pcnavi/mjx/drive.jsp", form : document.md_navi
             uri : "/pcnavi/mjx/route_drive.php", form : document.md_navi
         }
         );
         driveWindow.open();
      }
   }
}

//  ---------------------------------------

;
var naviClickFunc = function(){
   NTWindow.NaviWindow.isOpen ? NTWindow.NaviWindow.close() : NTWindow.NaviWindow.open();
}
//  ---------------------------------------
;
var naviWindow = null;
var naviOpenFunc = function( param, rowid, myflg, crsname ){
   if( param != null ){
      if( naviWindow == null ){
         return function(){
            naviWindow =
            new NTWindow.List( {
               title : 'トータルナビ',
               width : 340,
               height : 450,
               x : 400 + NTWindow.Control.sizeList * 10,
               y : 60 + NTWindow.Control.sizeList * 30,
               onClose : ntmap.removeRoute.bind( ntmap ),
               data : {
                  uri : '/pcnavi/mjx/totalnavi1.jsp',
                  method : 'post',
                  param : param
               }
            }
            );
         }
         ;
      }
      else{
         naviWindow.get( {
            uri : "/pcnavi/mjx/totalnavi1.jsp",
            method : 'post',
            param : param
         }
         );
         naviWindow.open();
      }
   }
   else if( rowid != null || crsname != null ){
      if( naviWindow == null ){
         naviWindow =
         new NTWindow.List( {
            title : "トータルナビ",
            width : 340,
            height : 450,
            x : 400 + NTWindow.Control.sizeList * 10,
            y : 60 + NTWindow.Control.sizeList * 30,
            onClose : ntmap.removeRoute.bind( ntmap ),
            data : {
               param : {
                  rowid : rowid, myroute : myflg, crsname : crsname
               }
               , uri : "/pcnavi/mjx/totalnavi1.jsp"
            }
         }
         );
      }
      else{
         naviWindow.get( {
            param : {
               rowid : rowid, myroute : myflg, crsname : crsname
            }
            ,
            uri : "/pcnavi/mjx/totalnavi1.jsp"
         }
         );
         naviWindow.open();
      }
   }
   else if( TotalNavi.checkSet() ){
      TotalNavi.deleteNoneParam();
      if( naviWindow == null ){
         naviWindow =
         new NTWindow.List( {
            title : "トータルナビ",
            width : 340,
            Height : 450,
            x : 400 + NTWindow.Control.sizeList * 10,
            y : 60 + NTWindow.Control.sizeList * 30,
            onClose : ntmap.removeRoute.bind( ntmap ),
            data : {
               uri : "/pcnavi/mjx/totalnavi1.jsp",
               method : 'post',
               form : document.mn_navi
            }
         }
         );
      }
      else{
         naviWindow.get( {
            uri : "/pcnavi/mjx/totalnavi1.jsp",
            method : 'post',
            form : document.mn_navi
         }
         );
         naviWindow.open();
      }
      naviClickFunc();
   }
}

//  ---------------------------------------
//  ---------------------------------------
;
var naviFreeClickFunc = function( lon, lat, id, name, pId, sId, aId ){
 /* $( "mn_dnv" ).innerHTML = name;
  document.mn_navi.dnv.value = lon + '.' + lat + '.' + id + '.' + name;
  if( pId != null && sId != null && aId != null ){
     document.mn_navi.provId.value = pId;
     document.mn_navi.spotId.value = sId;
     document.mn_navi.advId.value = aId;
  }*/
   NTWindow.FreeNaviWindow.isOpen ? NTWindow.FreeNaviWindow.close() : NTWindow.FreeNaviWindow.open();
}
//  ---------------------------------------

;
var naviFreeClickFunc_AlwaysOpen = function( lon, lat, id, name, pId, sId, aId ){
   NTWindow.FreeNaviWindow.open();
}
//  ---------------------------------------

;
var naviIconDetail = function(){//圖示說明
 new NTWindow.List( {
      title : "圖示說明" ,
      width : 235,
      height : 450,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/icons_blank.html"
         
      }
      ,
   	 onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   
   }
   );
}

//  ---------------------------------------

;
var naviFreeOpenFunc = function( prm ){//行人導航
   if( prm != null ){
      if( naviWindow == null ){
         naviWindow =
         new NTWindow.List( {
            title : "行人導航",
            width : 340,
            height : 450,
            x : 400 + NTWindow.Control.sizeList * 10,
            y : 60 + NTWindow.Control.sizeList * 30,
            onClose : ntmap.removeRoute.bind( ntmap ),
            data : {
               uri : "/pcnavi/mjx/route_walk.php",
               //uri : "/pcnavi/mjx/drive.jsp", 
               method : 'post',
               param : prm
            }
         }
         );
      }
      else{
         naviWindow.get( {
            uri : "/pcnavi/mjx/route_walk.php",
            method : 'post',
            param : prm
         }
         );
         naviWindow.open();
      }
   }
   else if( TotalNavi.checkSet() ){
      TotalNavi.deleteNoneParamF();
      if( naviWindow == null ){
         naviWindow =
         new NTWindow.List( {
            title : "行人導航",
            width : 340,
            height : 450,
            x : 400 + NTWindow.Control.sizeList * 10,
            y : 60 + NTWindow.Control.sizeList * 30,
            onClose : ntmap.removeRoute.bind( ntmap ),
            data : {
               uri : "/pcnavi/mjx/route_walk.php",
              // method : 'post',
               //form : document.mn_navi
               param : {
               	f_date_s: document.mn_navi.f_date_s.value   ,EXPRS12_13:  document.mn_navi.EXPRS12_13.value ,EXPRS28: document.mn_navi.EXPRS28.value , EXPRS5_8:  document.mn_navi.EXPRS5_8.value ,AIRPLANE: document.mn_navi.AIRPLANE.value ,
               	orv:  document.mn_navi.orv.value ,dnv:document.mn_navi.dnv.value
               }
            }
         }
         );
      }
      else{
         naviWindow.get( {
            uri : "/pcnavi/mjx/route_walk.php",
            method : 'post',
            form : document.mn_navi
         }
         );
         naviWindow.open();
      }
      NTWindow.FreeNaviWindow.close();
   }
}

//  ---------------------------------------

;
var busClickFunc = function(){ //周邊車站
	if(NTPoiCurrent.name==null){
	 NTPoiCurrent.name='';
	}
   new NTWindow.List( {
   	
      title : "週邊車站：" + NTPoiCurrent.name,
      width : 250,
      height : 430,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/mjx/aroundsearch.html",
         param : {
            lon : ntmap.getPos().getLongitude(), lat : ntmap.getPos().getLatitude(), poi_type : 'POI_0701' ,lv_name2 :'大眾運輸', master:'yes_lv2'
         }
      }
      ,
     // onClose : function(){
     //   ntmap.clearIcon( "bus" );
     //}
      onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}

//  ---------------------------------------

;
var oilClickFunc = function(){//周邊加油站
	if(NTPoiCurrent.name==null){
	 NTPoiCurrent.name='';
	}
   new NTWindow.List( {
      title : "週邊加油站：" + NTPoiCurrent.name,
      width : 250,
      height : 430,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/mjx/aroundsearch.html",
         param : {
            lon : ntmap.getPos().getLongitude(), lat : ntmap.getPos().getLatitude(), poi_type : 'POI_0702' ,lv_name2 :'加油站' , master:'yes_lv2'
         }
      }
      ,
     onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}


//  ---------------------------------------

;
var parkingClickFunc = function(){//周邊停車場
	if(NTPoiCurrent.name==null){
	 NTPoiCurrent.name='';
	}
   new NTWindow.List( {
      title : "週邊停車場：" + NTPoiCurrent.name,
      width : 250,
      height : 430,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/mjx/aroundsearch.html",
         param : {
            lon : ntmap.getPos().getLongitude(), lat : ntmap.getPos().getLatitude(), poi_type : 'POI_0704' ,lv_name2 :'停車場' , master:'yes_lv2'
         }
      }
      ,
      onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}

//  ---------------------------------------

;
var storeClickFunc = function(){//周邊商店
	if(NTPoiCurrent.name==null){
	 NTPoiCurrent.name='';
	}
   new NTWindow.List( {
      title : "週邊便利商店：" + NTPoiCurrent.name,
      width : 250,
      height : 430,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/mjx/aroundsearch.html",
         param : {
            lon : ntmap.getPos().getLongitude(), lat : ntmap.getPos().getLatitude(), poi_type : 'POI_0804' ,lv_name2 :'便利商店' , master:'yes_lv2'
         }
      }
      ,
    onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}

//  ---------------------------------------

;
var spotClickFunc = function(){//周邊搜尋
	if(NTPoiCurrent.name==null){
	 NTPoiCurrent.name='';
	}
   new NTWindow.List( {
      title : "週邊搜尋：" + NTPoiCurrent.name,
      width : 300, //視窗大小
      height : 450,
      x : 400 + NTWindow.Control.sizeList * 10,//視窗跳出來的位置
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
        // uri : "/ETlive/event/mjx/around_2.jsp", param : {
         uri : "/ETlive/event/mjx/aroundsearch.html", param : {
            lon : ntmap.getPos().getLongitude(), lat : ntmap.getPos().getLatitude()
         }
      }
      ,
      onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}
//  ---------------------------------------

;
var playClickFunc = function(){//旅遊景點
	
   new NTWindow.List( {
      title : "旅遊景點",
      width : 250,
      height : 430,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/mjx/multiple_search.html",
         param : {
            towncode : NTPoiInitial.theme_id, poi_type : 'POI_1001' ,lv_name2 :'旅遊景點' , master:'yes_lv2' , link_bill : NTPoiInitial.link_bill
         }
      }
      ,
      onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}

//  ---------------------------------------

;
var liveClickFunc = function(){//飯店旅館
   new NTWindow.List( {
      title : "飯店旅館",
      width : 250,
      height : 430,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/mjx/multiple_search.html",
         param : {
            towncode : NTPoiInitial.theme_id, poi_type : 'POI_1003' ,lv_name2 :'飯店旅館' , master:'yes_lv2' , link_bill : NTPoiInitial.link_bill
         }
      }
      ,
      onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}

//  ---------------------------------------

;
var eatingClickFunc = function(){//餐飲美食
   new NTWindow.List( {
      title : "餐飲美食",
      width : 250,
      height : 430,
      x : 400 + NTWindow.Control.sizeList * 10,
      y : 60 + NTWindow.Control.sizeList * 30,
      data : {
         uri : "/ETlive/event/mjx/multiple_search.html",
         param : {
            towncode : NTPoiInitial.theme_id, poi_type : 'POI_05' ,lv_name1 :'餐飲美食' , master:'yes_lv1' ,link_bill : NTPoiInitial.link_bill
         }
      }
      ,
      onClose : function(){
         ntmap.clearIcon( "aroundList" );
      }
   }
   );
}
//  ---------------------------------------

;
var datahostingClickFunc = function( param ){//datahosting
  
  new NTWindow.List( {
     title : "特別介紹：" + NTPoiInitial.vendor_name,
     width : 300,
     height : 500,
     x : 400 + NTWindow.Control.sizeList * 10,
     y : 60 + NTWindow.Control.sizeList * 30,
     data : {
        uri : "/ETlive/event/mjx/vendor_search.html", 
        param : {
        	v_id : NTPoiInitial.vendor_id 
        }
     }
     ,
     onClose : function(){
        ntmap.clearIcon( "aroundList" );
     }
  }
  );
}


//  ---------------------------------------

;

var gourmetClickFunc = function(){
   NTWindow.GourmetWindow.isOpen ? NTWindow.GourmetWindow.close() : NTWindow.GourmetWindow.open();
}

//  ---------------------------------------

;

var setPos = function( a ){
   var b;
   eval( "b=" + a.responseText );
   $( 'centername' ).innerHTML = b.name;
   	
   NTPoiCurrent.name = b.name;  
   NTPoiCurrent.address = b.address;
}

//  ---------------------------------------

function onMapMove( k ){  
	
   var url = "http://" + location.host +"/ETlive/event"+ NTPoiInitial.link_bill + "/campaign.html?1=1&theme_id="+NTPoiInitial.theme_id+"&lat=%2b" + k.getDmsLatitude() + "&lon=%2b" + k.getDmsLongitude();  //取的及時的座標(度分秒格式)
   document.maplink.mapurl.value = url ;
   var param = "lon=" + k.getLongitude() + "&lat=" + k.getLatitude();
   NTPoiCurrent.reset();
   new Ajax.Request( "/pcnavi/mjx/xy.jsp" , {
     // method : "get", parameters : param, onComplete : setPos  //kiwi
   }
   );
   NTPoiCurrent.longitude = k.getLongitude();
   NTPoiCurrent.latitude = k.getLatitude();
}

//  ---------------------------------------

function onMapMove_getUrl( k ){  
	
   var url = "http://" + location.host +"/ETlive/event"+ NTPoiInitial.link_bill + "/campaign.html?1=1&theme_id="+NTPoiInitial.theme_id+"&lat=%2b" + k.getDmsLatitude() + "&lon=%2b" + k.getDmsLongitude();  //取的及時的座標(度分秒格式)
   document.maplink.mapurl.value = url ;
   var param = "lon=" + k.getLongitude() + "&lat=" + k.getLatitude();
   NTPoiCurrent.longitude = k.getLongitude();
   NTPoiCurrent.latitude = k.getLatitude();
}

//  ---------------------------------------

;
function createPoi( poistatus ){
   var image = new NTImage( "/ETlive/event/img/map/poiPoi.png", 25, 30 );
   var shadow = new NTImage( "/ETlive/event/img/map/poiShadow.png", 40, 30 );
   var icon = new NTIcon( ntmap.getPos(), image, "", shadow );
   if( poistatus.address || poistatus.tel || poistatus.note ){
      icon.addEvent( "click", function(){
         createMsg( poistatus, icon.getPos() );
      }
      );
      createMsg( poistatus, icon.getPos() );
   }
   ntmap.addIcon( icon );
}

//  ---------------------------------------

;
function createMsg( poistatus, pos ){
   if( poistatus.advId ){
      createAdvMsg( poistatus, pos ); return;
   }
   var div = document.createElement( "div" );
   var text = poistatus.name + '<br>';
   if( poistatus.address ) text += poistatus.address + '<br>';
   if( poistatus.tel )text += "TEL:" + poistatus.tel + '<br>';
   if( poistatus.note )text += poistatus.note + '<br>';
   if( poistatus.provId && poistatus.spotId && poistatus.groupId ){
      text += '<a href="javascript:;" onclick="new NTWindow.Modal(';
      text += '{x:700, y: 500, data:{';
      text += 'uri:\' / pcnavi / mjx / detail.jsp\',';
      text += 'param:\'provId = '+poistatus.provId + ' & spotId = '+ poistatus.spotId + ' & groupId = '+ poistatus.groupId + '\'';
      text += '}}); return false;">詳細情報</a><br>';
   }
   if( poistatus.navi ){
      text += '<a href="javascript:;" onclick="naviFreeClickFunc(\''+pos.getLongitude()+'\',\''+pos.getLatitude()+'\',\''+poistatus.id+'\',\''+poistatus.name+'\'); return false;">乗物徒歩+車ルート</a>';
   }
   div.innerHTML = text;
   ntmap.openMsg( pos, {
      max : {
         x : 300, y : 200
      }
      , content : div
   }
   );
}

//  ---------------------------------------

;
function createAdvMsg( poistatus, pos ){
   var div = document.createElement( "div" );
   var text = "";
   if( poistatus.catchCopy ) text += '<p style="border-bottom:1px dashed #CCCCCC;padding: 2px; font-size: 80%; margin-bottom: 2px; font-weight:bold; color: #666666;">' + poistatus.catchCopy + '</p>';
   text += '<div style="float: left; width: 200px; ">';
   text += poistatus.name + '<br>';
   if( poistatus.address ) text += poistatus.address + '<br>';
   if( poistatus.tel )text += "TEL:" + poistatus.tel + '<br>';
   if( poistatus.note )text += poistatus.note + '<br>';
   if( poistatus.provId && poistatus.spotId && poistatus.advId ){
      text += '<a href="javascript:;" onclick="new NTWindow.Modal(';
      text += '{x:800, y: 640, data:{';
      text += 'uri:\' / pcnavi / mjx / detail.jsp\',';
      text += 'param:\'provId = '+poistatus.provId + ' & spotId = '+ poistatus.spotId + ' & advId = '+ poistatus.advId +'\'';
      text += '}}); return false;">詳細情報</a><br>';
   }
   if( poistatus.navi ){
      text += '<a href="javascript:;" onclick="naviFreeClickFunc(\''+pos.getLongitude()+'\',\''+pos.getLatitude()+'\',\''+poistatus.id+'\',\''+poistatus.name+'\',\''+poistatus.provId+'\',\''+poistatus.spotId+'\',\''+poistatus.advId+'\'); return false;">乗物徒歩+車ルート</a>';
   }
   text += '</div>';
   if( poistatus.img ) text += '<div style="float: right;"><img src="' + poistatus.img + '" width="100" alt="' + poistatus.name + '"></div>';
   text += '<div class="clear"><div></div></div>';
   div.innerHTML = text;
   ntmap.openMsg( pos, {
      max : {
         x : 350, y : 300
      }
      , content : div
   }
   );
}

//  ---------------------------------------

;
function openMail(){
   location.href = 'mailto:?body=http://' + location.host + '/map/%3fdatum%3d1%26unit%3d0%26lat%3d%2b' + ntmap.getPos().getDmsLatitude() + '%26lon%3d%2b' + ntmap.getPos().getDmsLongitude();
}

//  ---------------------------------------

;
function openPrintWindow( palette, lon, lat ) {
   var scale, around, poi, vics, mlon, mlat;
   var param = "";
   param += "&lon=" + ntmap.getPos().getLongitude();
   param += "&lat=" + ntmap.getPos().getLatitude();
   param += "&spot=" + EscapeUTF8( NTPoiCurrent.name ) + "&scale=" + ntmap.getZoom().scale + "&zoom=" + ntmap.getZoom().zoom + "&palette=" + palette;
   param += ( NTPoiCurrent.address ) ? "&address=" + EscapeUTF8( NTPoiCurrent.address ) : "";
   param += ( NTPoiCurrent.tel ) ? "&tel=" + NTPoiCurrent.tel : "";
   if( ntmap.getRouteList() && ( ntmap.getRouteList()[0].method || 0 ) == 255 ){
      var route = ntmap.getRouteList()[0];
      param += "&slon=" + route.orv.getLongitude() + "&slat=" + route.orv.getLatitude();
      param += "&elon=" + route.dnv.getLongitude() + "&elat=" + route.dnv.getLatitude();
      if( route.tollroad != null && ( route.tollroad == 8 || route.tollroad == 16 || route.tollroad == 32 ) ){
         param += "&Tollroad=" + route.tollroad;
      }
      else{
         param += "&Tollroad=" + 0;
      }
   }
   param += ( NTPoiCurrent.provId ) ? "&provId=" + NTPoiCurrent.provId : "";
   param += ( NTPoiCurrent.spotId ) ? "&spotId=" + NTPoiCurrent.spotId : "";
   param += ( NTPoiCurrent.advId ) ? "&advId=" + NTPoiCurrent.advId : "";
   window.open( common_uri + "/?ctl=0192" + param, "", "width=700,height=900,scrollbars=yes" );
   return;
}

//  ---------------------------------------

;
function openAdvPrintWindow( pId, sId, aId ) {
   var org_p = NTPoiCurrent.provId;
   var org_s = NTPoiCurrent.spotId;
   var org_a = NTPoiCurrent.advId;
   var org_nm = NTPoiCurrent.name;
   var org_ad = NTPoiCurrent.address;
   var org_tl = NTPoiCurrent.tel;
   NTPoiCurrent.provId = pId;
   NTPoiCurrent.spotId = sId;
   NTPoiCurrent.advId = aId;
   NTPoiCurrent.name = '';
   NTPoiCurrent.address = '';
   NTPoiCurrent.tel = '';
   openPrintWindow( 'postal' );
   NTPoiCurrent.provId = org_p;
   NTPoiCurrent.spotId = org_s;
   NTPoiCurrent.advId = org_a;
   NTPoiCurrent.name = org_nm;
   NTPoiCurrent.address = org_ad;
   NTPoiCurrent.tel = org_tl;
}

//  ---------------------------------------

;
var m_maplink_form = null;
function gotoMapLink(){
   if( ! m_maplink_form ){
      m_maplink_form = document.createElement( "form" );
      m_maplink_form.action = "/pcnavi/index.jsp";
      m_maplink_form.method = "post";
      m_maplink_form.target = "_blank";
      $( "mainframe" ).appendChild( m_maplink_form );
   }
   var cha = function( b, c ){
      var param = document.createElement( "input" );
      param.type = "hidden";
      param.name = b;
      param.value = c;
      m_maplink_form.appendChild( param );
   }
   cha( "ctl", "0191" );
   cha( "lat", ntmap.getPos().getLatitude() );
   cha( "lon", ntmap.getPos().getLongitude() );
   cha( "name", NTPoiCurrent.name );
   m_maplink_form.submit();
}

//  ---------------------------------------

;
var m_atmap_form = null;
function gotoMyPoiAtMap(){
   if( ! m_atmap_form ){
      m_atmap_form = document.createElement( "form" );
      m_atmap_form.action = "/pcnavi/index.jsp";
      m_atmap_form.method = "post";
      $( "mainframe" ).appendChild( m_atmap_form );
   }
   var cha = function( b, c ){
      var param = document.createElement( "input" );
      param.type = "hidden";
      param.name = b;
      param.value = c;
      m_atmap_form.appendChild( param );
   }
   cha( "ctl", "0510" );
   cha( "lat", ntmap.getPos().getLatitude() );
   cha( "lon", ntmap.getPos().getLongitude() );
   cha( "name", NTPoiCurrent.name );
   cha( "address", NTPoiCurrent.address ? NTPoiCurrent.address : "" );
   cha( "phone", NTPoiCurrent.tel ? NTPoiCurrent.tel : "" );
   cha( "SCode", NTPoiCurrent.id ? NTPoiCurrent.id : "" );
   cha( "LCode", NTPoiCurrent.categoryId ? NTPoiCurrent.categoryId : "" );
   cha( "provId", NTPoiCurrent.provId ? NTPoiCurrent.provId : "" );
   cha( "spotId", NTPoiCurrent.spotId ? NTPoiCurrent.spotId : "" );
   cha( "groupId", NTPoiCurrent.groupId ? NTPoiCurrent.groupId : "" );
   cha( "sbm", "ins" );
   m_atmap_form.submit();
}

//  ---------------------------------------

;
function createPoiSample( poistatus ){
   var image = new NTImage( "/ETlive/event/img/map/poiPoi.png", 25, 30 );
   var shadow = new NTImage( "/ETlive/event/img/map/poiShadow.png", 40, 30 );
   var icon = new NTIcon( ntmap.getPos(), image, "", shadow );
   if( poistatus.address || poistatus.tel || poistatus.note ){
      icon.addEvent( "click", function(){
         createAdvMsgSample( poistatus, icon.getPos() );
      }
      );
      createAdvMsgSample( poistatus, icon.getPos() );
   }
   ntmap.addIcon( icon );
}

//  ---------------------------------------

;
function createAdvMsgSample( poistatus, pos ){
   var div = document.createElement( "div" );
   var text = "";
   if( poistatus.catchCopy ) text += '<p style="border-bottom:1px dashed #CCCCCC;padding: 2px; font-size: 80%; margin-bottom: 2px; font-weight:bold; color: #666666;">' + poistatus.catchCopy + '</p>';
   text += '<div style="float: left; width: 200px; ">';
   text += poistatus.name + '<br>';
   if( poistatus.address ) text += poistatus.address + '<br>';
   if( poistatus.tel )text += "TEL:" + poistatus.tel + '<br>';
   if( poistatus.note )text += poistatus.note + '<br>';
   if( poistatus.provId && poistatus.spotId && poistatus.advId ){
      text += '<a href="javascript:;" onclick="new NTWindow.Modal(';
      text += '{x:800, y: 640, data:{';
      text += 'uri:\'advdetail.jsp\',';
      text += 'param:\'provId = '+poistatus.provId + ' & spotId = '+ poistatus.spotId + ' & advId = '+ poistatus.advId +'\'';
      text += '}}); return false;">詳細情報</a><br>';
   }
   if( poistatus.navi ){
      text += '<a href="#">乗物徒歩+車ルート</a>';
   }
   text += '</div>';
   if( poistatus.img ) text += '<div style="float: right;"><img src="' + poistatus.img + '" width="100" alt="' + poistatus.name + '"></div>';
   text += '<div class="clear"><div></div></div>';
   div.innerHTML = text;
   ntmap.openMsg( pos, {
      max : {
         x : 350, y : 300
      }
      , content : div
   }
   );
}

//  ---------------------------------------

;
function changePage( obj, url, prm ){
   obj.get( {
      uri : url, param : prm
   }
   );
}

//  ---------------------------------------

Around = {
   N2A : ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"],
   CENTER : new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiPoi.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   ICONS : [
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiA.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiB.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiC.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiD.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiE.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiF.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiG.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiH.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiI.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiJ.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiK.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiL.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) ),
   new NTIcon( new NTLatLng( 0, 0 ), new NTImage( '/ETlive/event/img/map/poiM.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) )
   ],
   view : function( id, n, idx ){
      var b = "none";
      var c = "block";
      for( var i = 0; i <= n; i ++ ){
         var s = $( id + i + idx );
         if( s != null ){
            s.style.display = ( s.style.display == b || s.style.display == "" ) ? c : b;
         }
      }
   }
   ,
   searchFreeword : function( obj ){
      if( this.checkKeyword() ){
         obj.get( {
            uri : "/ETlive/event/mjx/aroundlist.php", form : document.mc_search
         }
         );
      }
   }
   ,
   checkKeyword : function(){
      var kwd = document.mc_search.aroundKwd.value;
      while( kwd.indexOf( "?" ) >= 0 ){
         kwd = kwd.replace( "?", "" );
      }
      while( kwd.indexOf( " " ) >= 0 ){
         kwd = kwd.replace( " ", "" );
      }
      if( kwd == '' ){
         alert( '請先輸入您要搜尋的關鍵字!' );
         return false;
      }
      return true;
   }
   ,
   move : function( prm ){
      if( prm.popid != null ){
         this.popUp( prm.popid, prm.lat, prm.lon );
      }
      ntmap.moveTo( new NTLatLng( prm.lat, prm.lon ) );
      $( 'centername' ).innerHTML = prm.name;
      //移動改變url
      var pos = ntmap.getPos();
      onMapMove(pos);
  		
      NTPoiCurrent.reset();
      NTPoiCurrent.name = prm.name;
      NTPoiCurrent.address = prm.add;
      NTPoiCurrent.tel = prm.tel;
      NTPoiCurrent.id = prm.id;
      NTPoiCurrent.categoryId = prm.cid;
      NTPoiCurrent.categoryName = prm.cname;
      NTPoiCurrent.provId = prm.pid;
      NTPoiCurrent.spotId = prm.sid;
      NTPoiCurrent.groupId = prm.gid;
   }
   ,
   popUp : function( id, lat, lon ){
      ntmap.openMsg( new NTLatLng( lat, lon ), {
         max : {
            x : 300, y : 200
         }
         , content : $( id )
      }
      );
   }
   ,
   popClose : function(){
      if( this.popobj != null && this.popobj.isAvalable() ){
         this.popobj.remove();
         this.popobj = null;
      }
   }
   ,
   walkRoute : function( orvlat, orvlon, dnvlat, dnvlon, r, g, b, method ){
      ntmap.setProperty( 'autoload', false );
      ntmap.removeRoute();
      var orv = new NTLatLng( orvlat, orvlon );
      var dnv = new NTLatLng( dnvlat, dnvlon );
      var color = new NTColor( r, g, b );
      var route = new NTRoute( orv, dnv, color, method )
      ntmap.addRoute( route );
      ntmap.reload();
      ntmap.setProperty( 'autoload', true );
   }
   ,
   detail : function( uri ){
      new NTWindow.Modal( {
         x : 700, y : 500, data : {
            uri : uri
         }
      }
      );
   }
   ,
   detailAdv : function( uri ){
      new NTWindow.Modal( {
         x : 800, y : 640, data : {
            uri : uri
         }
      }
      );
   }
   ,
   setIcons : function( center, icons ){
      var mp_pois = new Array();
      var mp_icons = new Array();
      var icon = new NTIcon( new NTLatLng( center.lat, center.lon ), new NTImage( '/ETlive/event/img/map/poiPoi.png', 25, 30 ), "", new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) );
      icon.setGroup( "aroundList" );
      ntmap.addIcon( icon );
      for( var i = 0; i < icons.length; i ++ ){
         mp_pois.push( new NTLatLng( icons[i].lat, icons[i].lon ) );
         icon = new NTIcon( new NTLatLng( icons[i].lat, icons[i].lon ), new NTImage( '/ETlive/event/img/map/poi' + this.N2A[i] + '.png', 25, 30 ), '', new NTImage( '/ETlive/event/img/map/poiShadow.png', 40, 30 ) );
         icon.setGroup( "aroundList" );
         ntmap.addIcon( icon );
      }
      tbar.setScaleByPoi( {
         poi : mp_pois, center : new NTLatLng( center.lat, center.lon )
      }
      );
   }
   ,
   advLog : function( pId, sId, aId, frm ){
      if( pId == null || pId == '' ){
         return;
      }
      if( sId == null || sId == '' ){
         return;
      }
      if( aId == null || aId == '' ){
         return;
      }
      if( frm == null || frm == '' ){
         return;
      }
      new Ajax.Request( "mjx/advLog.jsp", {
         method : "get", parameters : {
            provId : pId, spotId : sId, advId : aId, from : frm
         }
      }
      );
   }
}

//  ---------------------------------------

;
Drive = {
   set : function( target ){
   	
   	if( !NTPoiCurrent.name){
      	if(target=='orv'){
      		NTPoiCurrent.name = '地圖上的出發地';
      	}else{
      		NTPoiCurrent.name = '地圖上的目的地';	
      	}
      }
      $( 'md_' + target ).innerHTML = NTPoiCurrent.name;
      if( target.indexOf( 'ldmk' ) == - 1 ){
         document.md_navi[target].value = PoiCommon.getVertex();
         document.md_navi[target + 'Add'].value = PoiCommon.getAdditional();
      }else{
         document.md_navi['ldmk1'].value = PoiCommon.getVertex();
         document.md_navi['ldmkAdd1'].value = PoiCommon.getAdditional();
         var msg = '<a href="javascript:;" onclick="Drive.clear(\'' + target + '\'); return false;"><img src="/ETlive/event/img/map/navi/btn_crear.gif" witdh="50" height="20"></a>';
         $( 'md_' + target + 'setting' ).innerHTML = msg;
      }
   }
   ,
   popup_set : function( target , popup_name , popup_lon , popup_lat){
   	
   	$( 'md_' + target ).innerHTML = popup_name;
   	var getVertex = popup_lon + '.' + popup_lat + '..' + popup_name ;
      if( target.indexOf( 'ldmk' ) == - 1 ){
         document.md_navi[target].value = getVertex;
         document.md_navi[target + 'Add'].value = PoiCommon.getAdditional();
      }else{
         document.md_navi['ldmk1'].value = PoiCommon.getVertex();
         document.md_navi['ldmkAdd1'].value = PoiCommon.getAdditional();
         var msg = '<a href="javascript:;" onclick="Drive.clear(\'' + target + '\'); return false;"><img src="/ETlive/event/img/map/navi/btn_crear.gif" witdh="50" height="20"></a>';
         $( 'md_' + target + 'setting' ).innerHTML = msg;
      }
   }
   ,
   clear : function( target ){
      document.md_navi[target].value = "";
      var add = target;
      var img = target;
      var status = "";
      if( target.indexOf( 'ldmk' ) != - 1 ){
         var index = target.substr( 4 );
         add = 'ldmkAdd' + index;
         img = 'ldmk';
         status = "未設定(任意)"
      }
      else{
         add = target + 'Add';
         status = "未設定(必須)"
      }
      document.md_navi[add].value = "";
      $( 'md_' + target ).innerHTML = status;
      var msg = '<a href="javascript:;" onclick="Drive.set(\'' + target + '\'); return false;"><img src="/ETlive/event/img/map/navi/btn_' + img + '.gif" witdh="50" height="20"></a>';
      $( 'md_' + target + 'setting' ).innerHTML = msg;
   }
   ,
   /*
   callResult : function(){
   if( this.checkSet() ){
   if( this.myW == null ){
   this.myW = new NTWindow.List( {title : "車ルート検索", width : 400, height : 400, x : 100, y : 60, onClose : ntmap.removeRoute.bind( ntmap ), data : {uri : "/pcnavi/mjx/drive.jsp", form : document.md_navi}} );
   }else{
   this.myW.get( {uri : "/pcnavi/mjx/drive.jsp", form : document.md_navi} );
   this.myW.open();
   }
   }
   },
   */
   swichTollRoad : function( tr, orv, dnv, orvAdd, dnvAdd, ldmk, ldmkAdd ){
      if( ! orvAdd ) orvAdd = '.....-1';
      if( ! dnvAdd ) dnvAdd = '.....-1';
      var param = 'tollroad=' + tr + '&orv=' + orv + '&dnv=' + dnv + '&orvAdd=' + orvAdd + '&dnvAdd=' + dnvAdd;
      if( ldmk ){
         param += '&ldmk1=' + ldmk;
         if( ldmkAdd ){
            param += '&ldmkAdd1=' + ldmkAdd;
         }
         else{
            param += '&ldmkAdd1=' + '.....-1';
         }
      }
      driveWindow.get( {
         uri : "/pcnavi/mjx/drive.jsp", param : param
      }
      );
      driveWindow.open();
   }
   ,
   checkSet : function(){
      if( document.md_navi['orv'].value == '' ){
         alert( '請輸入出發地' );
         return false;
      }
      else if( document.md_navi['dnv'].value == '' ){
         alert( '請輸入目的地' );
         return false;
      }
      var arLon = new Array();
      var arLat = new Array();
      var idx = 0;
      arLon[0] = document.md_navi['orv'].value.split( '.' )[0];
      arLat[0] = document.md_navi['orv'].value.split( '.' )[1];
      idx ++ ;
      if( document.md_navi['ldmk1'].value != '' ){
         arLon[idx] = document.md_navi['ldmk1'].value.split( '.' )[0];
         arLat[idx] = document.md_navi['ldmk1'].value.split( '.' )[1];
         idx ++ ;
      }
      arLon[idx] = document.md_navi['dnv'].value.split( '.' )[0];
      arLat[idx] = document.md_navi['dnv'].value.split( '.' )[1];
      for( i = 0; i < idx; i ++ ){
         if( arLon[i] == arLon[i + 1] && arLat[i] == arLat[i + 1] ){
            if( idx == 1 ){
               alert( '出發地、目的地設定為同一點' );
            }
            else{
               alert( '出發地、經由地、目的地設定為同一點' );
            }
            return false;
         }
      }
      return true;
   }
   ,
   callMyRouteRg : function( sbm, name ){
      new NTWindow.Modal( {
         x : 500, y : 380, data : {
            uri : "/pcnavi/mjx/myroute2.jsp", param : {
               sbm : sbm, name : name
            }
         }
      }
      );
   }
   ,
   setCondition : function(){
      var aForm = document.md_navi;
      var rForm = document.md_retry;
      for( var i = 0 ; rForm != null && i < rForm.length ; i ++ ){
         var rElm = rForm.elements[i];
         if( aForm[rElm.name] != null ){
            var aElm = aForm[rElm.name];
            if( aElm.type == 'hidden' ){
               aElm.value = rElm.value;
            }
            else if( aElm.type == 'select-one' ){
               for( var el = 0; el < aElm.length ; el ++ ){
                  if( aElm[el].value == rElm.value ){
                     aElm.selectedIndex = el;
                     break;
                  }
               }
            }
            else if( aElm.type == 'checkbox' ){
               if( rElm.value == '1' ){
                  aElm.checked = true;
               }
               else{
                  aElm.checked = false;
               }
            }
            else{
               for( var el = 0; el < aElm.length ; el ++ ){
                  if( aElm[el].value == rElm.value ){
                     aElm[el].checked = true;
                  }
                  else{
                     aElm[el].checked = false;
                  }
               }
            }
            if( rElm.name == 'orv' || rElm.name == 'dnv' || rElm.name.match( /ldmk[1-8]/ ) ){
               $( 'md_' + rElm.name ).innerHTML = rElm.value.split( '.' )[3];
            }
         }
      }
   }
}

//  ---------------------------------------

;
FreeWord = {
   myW : null,
   openFreeword : function(){
      if( this.myW == null ){
         this.myW = new NTWindow.List( {
            title : "關鍵字搜尋", onLoad : function(){
               document.mf_freeword.keyword.focus();
            }
            , width : 280, height : 530, x : 100, y : 60, data : {
               uri : "/ETlive/event/mjx/simplesearch.html", form : document.mf_freeword
            }
         }
         );
      }
      else{
         this.myW.get( {
            uri : "/ETlive/event/mjx/simplesearch.html"
         }
         );
         this.myW.open();
      }
   }
   ,
   searchFreeword : function(){//關鍵字搜尋連結到的網頁
   	var select_type = document.mf_freeword.select_type.value;
      if( this.checkKeyword() ){
      	if(select_type=='poi'){
         	this.myW.get( {
         	   uri : "/ETlive/event/mjx/findpoi.php", form : document.mf_freeword
         	}
         	);
         }else if(select_type=='tel'){
         	this.myW.get( {
         	   uri : "/ETlive/event/mjx/findtel.php", form : document.mf_freeword
         	}
         	);
         }else if(select_type=='addr'){
         	this.myW.get( {
         	   uri : "/ETlive/event/mjx/findaddr.php", form : document.mf_freeword
         	}
         	);
         }
      }
   }
   ,
   checkKeyword : function(){
      var kwd = document.mf_freeword.keyword.value;
      while( kwd.indexOf( "　" ) >= 0 ){
         kwd = kwd.replace( "　", "" );
      }
      while( kwd.indexOf( " " ) >= 0 ){
         kwd = kwd.replace( " ", "" );
      }
      if( kwd == '' ){
         alert( '請輸入關鍵字。' );
         document.mf_freeword.keyword.focus();
         return false;
      }
      return true;
   }
   ,
   setPOI : function( lon, lat, cd, nm, ad, tl, ct, mp, sp, gr, tr ){
      PoiCommon.setPOI( lon, lat, cd, nm, ad, tl, ct, mp, sp, gr, tr );
   }
   ,
   movePage : function( keyword, pg, type, obj ){
      pg = pg == null || pg == "" ? 0 : pg;
      type = type == null || type == "" ? "" : type;
      param = 'keyword=' + keyword + '&p=' + pg + '&type=' + type;
      this.myW.get( {
         uri : "/pcnavi/mjx/freeword1.jsp", param : param
      }
      );
   }
   ,
   moveAddressList : function( keyword, pg, acode, blist, obj ){
      pg = pg == null || pg == "" ? 0 : pg;
      acode = acode == null || acode == "" ? "" : acode;
      blist = blist == null || blist == "" ? "" : blist;
      param = 'keyword=' + keyword + '&p=' + pg + '&ACode=' + acode + '&bList=' + blist;
      this.myW.get( {
         uri : "/pcnavi/mjx/freeword2.jsp", param : param
      }
      );
   }
}

//  ---------------------------------------

;
var GourmetImage = Class.create();
GourmetImage.prototype = {
   initialize : function( src, w, h ){
      this.src = src;
      this.width = w;
      this.height = h;
      NTEvent.add( this.src, "mouseover", this.mouseOverImage.bind( this ) );
      NTEvent.add( this.src, "mouseout", this.mouseOutImage.bind( this ) );
      this.mover = new NTAgis.Resizer( this.src, {
         interval : - 1
      }
      );
   }
   ,
   mouseOverImage : function( e ){
      this.mover.setOption( {
         endx : this.width, endy : this.height
      }
      );
      this.mover.run();
   }
   ,
   mouseOutImage : function( e ){
      this.mover.setOption( {
         endx : 40, endy : 40
      }
      );
      this.mover.run();
   }
}

//  ---------------------------------------

;
Gourmet = {
   view : function( id ){
      if( $( id ).style.display == "block" ){
         $( id ).style.display = "none";
      }
      else{
         $( id ).style.display = "block";
      }
   }
   ,
   child : function( index ){
      var parentElement = eval( 'document.mg_search.mg_cate' + index );
      var chileElement = eval( 'document.mg_search.mg_catec' + index );
      if( chileElement != null && chileElement.length > 0 ){
         if( parentElement.checked ){
            var c_num = chileElement.length;
            var i = 0;
            while ( i < c_num )
            {
               chileElement[i].checked = false;
               i ++ ;
            }
         }
      }
      else{
         if( parentElement.checked ){
            if( chileElement != null ){
               chileElement.checked = false;
            }
         }
      }
      $( "mg_catea" ).checked = false;
   }
   ,
   parent : function( index ){
      var parentElement = eval( 'document.mg_search.mg_cate' + index );
      parentElement.checked = false;
      $( "mg_catea" ).checked = false;
   }
   ,
   all : function( size ){
      if( $( "mg_catea" ).checked ){
         var i = 0;
         while ( i < size )
         {
            var parentElement = eval( 'document.mg_search.mg_cate' + i );
            var chileElement = eval( 'document.mg_search.mg_catec' + i );
            parentElement.checked = false;
            if( chileElement != null ){
               if( chileElement.length > 0 ){
                  var c_num = chileElement.length;
                  var j = 0;
                  while ( j < c_num )
                  {
                     chileElement[j].checked = false;
                     j ++ ;
                  }
               }
               else{
                  chileElement.checked = false;
               }
            }
            i ++ ;
         }
      }
   }
   ,
   none : function( cSize ){
      var i = 0;
      while ( i < cSize )
      {
         $( "mg_child" + i ).style.display = "none";
         i ++ ;
      }
   }
   ,
   reset : function( cSize, sSize ){
      $( "mg_catea" ).checked = true;
      this.all( cSize );
      this.none( cSize );
      var i = 0;
      while ( i < sSize )
      {
         $( "mg_s" + i ).checked = false;
         i ++ ;
      }
      var min = $( 'mg_min' ).getElementsByTagName( 'option' );
      var minArray = $A( min );
      minArray[0].selected = true;
      var max = $( 'mg_max' ).getElementsByTagName( 'option' );
      var maxArray = $A( max );
      maxArray[0].selected = true;
   }
   ,
   callResult : function(){
      document.mg_search.lon.value = ntmap.getPos().getLongitude();
      document.mg_search.lat.value = ntmap.getPos().getLatitude();
      new NTWindow.List( {
         title : "周邊", width : 300, height : 450, x : 100, y : 60, data : {
            uri : "/pcnavi/mjx/gourmetlist.jsp", form : document.mg_search
         }
         , onClose : function(){
            ntmap.clearIcon( "gourmet" );
         }
      }
      );
      NTWindow.GourmetWindow.close();
   }
   ,
   images : new Array(),
   setImage : function(){
      document.getElementsByClassName( "mgd_image" ).each( function( val, idx ){
         Gourmet.images.push( new GourmetImage( val, val.offsetWidth, val.offsetHeight ) );
         val.style.width = "40px";
         val.style.height = "40px";
      }
      );
   }
   ,
   research : function( obj ){
      obj.close();
      NTWindow.GourmetWindow.open();
   }
   ,
   changeView : function( open, close ){
      if( $( open ).style.display == 'none' ){
         $( open ).style.display = 'block';
      }
      if( $( close ).style.display = 'block' ){
         $( close ).style.display = 'none';
      }
   }
}

//  ---------------------------------------

;
TotalNavi = {
   myW : null,
   setRoute : new Array(),
   info : false,
   callMyRoute : function(){
      new Ajax.Request( "mjx/myroute1.jsp", {
         method : "get", parameters : "", onComplete : this.expandMyRoute.bind( this )
      }
      );
   }
   ,
   expandMyRoute : function( a ){
      $( 'mn_tab3form' ).innerHTML = NTWindow.Control.analyzeHTML( a.responseText );
   }
   ,
   checkSet : function(){
      if( document.mn_navi['orv'].value == '' ){
         alert( '請輸入出發地' );
         return false;
      }
      else if( document.mn_navi['dnv'].value == '' ){
         alert( '請輸入目的地' );
         return false;
      }
      var arLon = new Array();
      var arLat = new Array();
      var idx = 0;
      arLon[0] = document.mn_navi['orv'].value.split( '.' )[0];
      arLat[0] = document.mn_navi['orv'].value.split( '.' )[1];
      idx ++ ;
      for( i = 0; i < 8; i ++ ){
         if( document.mn_navi['ldmk' + ( i + 1 )] ){
            if( document.mn_navi['ldmk' + ( i + 1 )].value != '' ){
               arLon[idx] = document.mn_navi['ldmk' + ( i + 1 )].value.split( '.' )[0];
               arLat[idx] = document.mn_navi['ldmk' + ( i + 1 )].value.split( '.' )[1];
               idx ++ ;
            }
         }
      }
      arLon[idx] = document.mn_navi['dnv'].value.split( '.' )[0];
      arLat[idx] = document.mn_navi['dnv'].value.split( '.' )[1];
      for( i = 0; i < idx; i ++ ){
         if( arLon[i] == arLon[i + 1] && arLat[i] == arLat[i + 1] ){
            if( idx == 1 ){
               alert( '出發地與目的地同一個地方!!' );
            }
            else{
               alert( '出發地與目的地同一個地方!!' );
            }
            return false;
         }
      }
      return true;
   }
   ,
   set : function( target ){
   	 
      document.mn_navi[target].value = PoiCommon.getVertex();
      var add = target;
      var img = target;
      if( target.indexOf( 'ldmk' ) != - 1 ){
         var index = target.substr( 4 );
         add = 'ldmkAdd' + index;
         img = 'ldmk';
      }else{
         add = target + 'Add';
      }
      document.mn_navi[add].value = PoiCommon.getAdditional();
      if( !NTPoiCurrent.name ){
      	if(target=='orv'){
      		 NTPoiCurrent.name = '地圖上的出發地';
      	}else{
      		 NTPoiCurrent.name = '地圖上的目的地';	
      	}
      }
      $( 'mn_' + target ).innerHTML = NTPoiCurrent.name;
      
      if( target.indexOf( 'ldmk' ) != - 1 ){
         var msg = '<a href="javascript:;" onclick="TotalNavi.clear(\'' + target + '\'); return false;"><img src="/ETlive/event/img/map/navi/btn_crear.gif" witdh="50" height="20"></a>';
         $( 'mn_' + target + 'setting' ).innerHTML = msg;
      }
   }
   ,
   popup_set : function( target , popup_name , popup_lon , popup_lat ){
   	var getVertex = popup_lon + '.' + popup_lat + '..' + popup_name ; 
      document.mn_navi[target].value = getVertex;
      var add = target;
      var img = target;
      if( target.indexOf( 'ldmk' ) != - 1 ){
         var index = target.substr( 4 );
         add = 'ldmkAdd' + index;
         img = 'ldmk';
      }else{
         add = target + 'Add';
      }
      document.mn_navi[add].value = PoiCommon.getAdditional();
      
      $( 'mn_' + target ).innerHTML = popup_name;
      
      if( target.indexOf( 'ldmk' ) != - 1 ){
         var msg = '<a href="javascript:;" onclick="TotalNavi.clear(\'' + target + '\'); return false;"><img src="/ETlive/event/img/map/navi/btn_crear.gif" witdh="50" height="20"></a>';
         $( 'mn_' + target + 'setting' ).innerHTML = msg;
      }
   }
   ,
   clear : function( target ){
      document.mn_navi[target].value = "";
      var add = target;
      var img = target;
      var status = "";
      if( target.indexOf( 'ldmk' ) != - 1 ){
         var index = target.substr( 4 );
         add = 'ldmkAdd' + index;
         img = 'ldmk';
         status = "未設定(任意)"
      }
      else{
         add = target + 'Add';
         status = "未設定(必須)"
      }
      document.mn_navi[add].value = "";
      $( 'mn_' + target ).innerHTML = status;
      var msg = '<a href="javascript:;" onclick="TotalNavi.set(\'' + target + '\'); return false;"><img src="/ETlive/event/img/map/navi/btn_' + img + '.gif" witdh="50" height="20"></a>';
      $( 'mn_' + target + 'setting' ).innerHTML = msg;
   }
   ,
   checkTransCtl : function(){
      if( ! document.mn_navi.transwalk.checked ){
         document.mn_navi.taxi.checked = false;
      }
      return;
   }
   ,
   checkBoxCtl : function(){
      if( document.mn_navi.taxi.checked ){
         document.mn_navi.transwalk.checked = true;
      }
      if( document.mn_navi.vics.checked ){
         document.mn_navi.car.checked = true;
      }
      if( document.mn_navi.tollroad.checked ){
         document.mn_navi.car.checked = true;
      }
      return;
   }
   ,
   checkCarCtl : function() {
      if( ! document.mn_navi.car.checked ){
         document.mn_navi.vics.checked = false;
         document.mn_navi.tollroad.checked = false;
         return;
      }
   }
   ,
   removeToll : function() {
      document.mn_navi.tollroadLdmk.checked = false;
      document.mn_navi.vicsLdmk.checked = false;
      return;
   }
   ,
   checkCarLdmk : function() {
      if( document.mn_navi.tollroadLdmk.checked || document.mn_navi.vicsLdmk.checked ){
         document.mn_navi.way[1].checked = true;
         return;
      }
   }
   ,
   removeToll2 : function() {
      document.mn_navi.tollroad.checked = false;
      return;
   }
   ,
   checkCar : function() {
      document.mn_navi.way[1].checked = true;
      return;
   }
   ,
   availableWalkonly : function(){
      var distance = 0;
      var lonArray = new Array();
      var latArray = new Array();
      if( document.mn_navi['orv'].value.split( '.' ).length > 2 ){
         var lon = document.mn_navi['orv'].value.split( '.' )[0];
         var lat = document.mn_navi['orv'].value.split( '.' )[1];
         lonArray.push( lon );
         latArray.push( lat );
      }
      if( document.mn_navi['dnv'].value.split( '.' ).length > 2 ){
         var lon = document.mn_navi['dnv'].value.split( '.' )[0];
         var lat = document.mn_navi['dnv'].value.split( '.' )[1];
         lonArray.push( lon );
         latArray.push( lat );
      }
      var ldmkIdx = this.getLdmkIdx();
      if( lonArray.length + ldmkIdx.length < 2 ){
         return true;
      }
      for( i = 0; i < ldmkIdx.length; i ++ ){
         if( document.mn_navi['ldmk' + ldmkIdx[i]].value.split( '.' ).length > 2 ){
            var lon = document.mn_navi['ldmk' + ldmkIdx[i]].value.split( '.' )[0];
            var lat = document.mn_navi['ldmk' + ldmkIdx[i]].value.split( '.' )[1];
         }
         lonArray.push( lon );
         latArray.push( lat );
      }
      for( i = 0; i < lonArray.length; i ++ ){
         var distanceTmp = 0;
         for( j = 0; j < lonArray.length; j ++ ){
            if( i == j ){
               continue;
            }
            distanceTmp = this.getDistance( lonArray[i], latArray[i], lonArray[j], latArray[j] );
            if( distance < distanceTmp ){
               distance = distanceTmp;
            }
         }
      }
      if( distance > 10000 ){
         return false;
      }
      else{
         return true;
      }
   }
   ,
   getDistance : function( lon1, lat1, lon2, lat2 ){
      var ix = lon1 - lon2;
      var iy = lat1 - lat2;
      var distance = ( Math.sqrt( ix * ix + iy * iy ) * 5.0 / 2.0 ) / 100.0 + 0.5;
      return Math.round( distance );
   }
   ,
   tabExchange : function( nm ){
      $( "mn_tab1" ).src = "/ETlive/event/img/map/navi/tab1off.gif";
      $( "mn_tab2" ).src = "/ETlive/event/img/map/navi/tab2off.gif";
      $( "mn_tab3" ).src = "/ETlive/event/img/map/navi/tab3off.gif";
      $( "mn_" + nm ).src = "/ETlive/event/img/map/navi/" + nm + "on.gif";
      $( "mn_tab1form" ).style.display = "none";
      $( "mn_tab2form" ).style.display = "none";
      $( "mn_tab3form" ).style.display = "none";
      $( "mn_" + nm + "form" ).style.display = "block";
      if( nm == 'tab2' ){
         this.chengeMethodDisp();
      }
   }
   ,
   getLdmkIdx : function(){
      var ary = new Array();
      for( i = 1; i <= 8; i ++ ){
         if( document.mn_navi['ldmk' + i] ){
            if( document.mn_navi['ldmk' + i].value != '' ){
               ary.push( i );
            }
         }
      }
      return ary;
   }
   ,
   deleteNoneParam : function(){
      if( this.info ){
         if( this.getLdmkIdx().length == 0 ){
            document.mn_navi.way[0].value = null;
            document.mn_navi.way[1].value = null;
            document.mn_navi.way[2].value = null;
            document.mn_navi.tollroadLdmk.value = null;
            document.mn_navi.vicsLdmk.value = null;
            document.mn_navi.transwalk.value = 1;
            document.mn_navi.taxi.value = 1;
            document.mn_navi.car.value = 1;
            document.mn_navi.walk.value = 1;
            document.mn_navi.vics.value = 1;
            document.mn_navi.tollroad.value = 1;
         }
         else{
            document.mn_navi.transwalk.value = null;
            document.mn_navi.taxi.value = null;
            document.mn_navi.car.value = null;
            document.mn_navi.walk.value = null;
            document.mn_navi.way[0].value = 0;
            document.mn_navi.way[1].value = 1;
            document.mn_navi.way[2].value = 2;
            if( document.mn_navi.vicsLdmk.checked ){
               document.mn_navi.vics.value = '1';
            }
            else{
               document.mn_navi.vics.value = '0';
            }
            if( document.mn_navi.tollroadLdmk.checked ){
               document.mn_navi.tollroad.value = '1';
            }
            else{
               document.mn_navi.tollroad.value = '0';
            }
         }
      }
      if( ! this.availableWalkonly() ){
         if( this.info ){
            document.mn_navi.walk.value = '0';
         }
         document.mn_navi.way[2].value = '0';
      }
   }
   ,
   chengeMethodDisp : function(){
      var ldmkIdx = this.getLdmkIdx();
      if( ldmkIdx.length > 0 ){
         if( document.mn_navi.basis.options[3] ) document.mn_navi.basis.removeChild( document.mn_navi.basis.options[3] );
         if( document.mn_navi.basis.options[2] ) document.mn_navi.basis.removeChild( document.mn_navi.basis.options[2] );
         for( i = 0; i < ldmkIdx.length; i ++ ){
            $( 'ldmkstay' + ldmkIdx[i] ).style.display = 'block';
         }
         if( this.info ){
            $( 'mn_method-normal' ).style.display = 'none';
            $( 'inside10000' ).style.display = 'none';
            $( 'outside10000' ).style.display = 'none';
            $( 'mn_method-ldmk' ).style.display = 'block';
            $( 'inside10000-ldmk' ).style.display = 'block';
            $( 'outside10000-ldmk' ).style.display = 'block';
            if( this.availableWalkonly() ){
               $( 'outside10000-ldmk' ).style.display = 'none';
            }
            else{
               $( 'inside10000-ldmk' ).style.display = 'none';
               document.mn_navi.way[2].checked = false;
               if( ! document.mn_navi.way[0].checked && ! document.mn_navi.way[1].checked ){
                  document.mn_navi.way[0].checked = true;
               }
            }
         }
         else{
            if( this.availableWalkonly() ){
               $( 'inside10000' ).style.display = 'block';
               $( 'outside10000' ).style.display = 'none';
            }
            else{
               $( 'inside10000' ).style.display = 'none';
               $( 'outside10000' ).style.display = 'block';
               document.mn_navi.way[2].checked = false;
               if( ! document.mn_navi.way[0].checked && ! document.mn_navi.way[1].checked ){
                  document.mn_navi.way[0].checked = true;
               }
            }
         }
      }
      else{
         if( ! document.mn_navi.basis.options[2] ){
            var opt = document.createElement( "option" );
            opt.value = '4';
            opt.text = '起點';
            document.mn_navi.basis.appendChild( opt );
         }
         if( ! document.mn_navi.basis.options[3] ){
            var opt = document.createElement( "option" );
            opt.value = '3';
            opt.text = '終點';
            document.mn_navi.basis.appendChild( opt );
         }
         for( i = 1; i <= 8; i ++ ){
            $( 'ldmkstay' + i ).style.display = 'none';
         }
         if( this.info ){
            $( 'mn_method-normal' ).style.display = 'block';
            $( 'inside10000' ).style.display = 'block';
            $( 'outside10000' ).style.display = 'block';
            $( 'mn_method-ldmk' ).style.display = 'none';
            $( 'inside10000-ldmk' ).style.display = 'none';
            $( 'outside10000-ldmk' ).style.display = 'none';
            if( this.availableWalkonly() ){
               $( 'outside10000' ).style.display = 'none';
            }
            else{
               $( 'inside10000' ).style.display = 'none';
               document.mn_navi.walk.checked = false;
               if( ! document.mn_navi.transwalk.checked && ! document.mn_navi.car.checked ){
                  document.mn_navi.transwalk.checked = true;
                  document.mn_navi.car.checked = true;
                  document.mn_navi.vics.checked = true;
                  document.mn_navi.tollroad.checked = true;
               }
            }
         }
         else{
            if( this.availableWalkonly() ){
               $( 'inside10000' ).style.display = 'block';
               $( 'outside10000' ).style.display = 'none';
            }
            else{
               $( 'inside10000' ).style.display = 'none';
               $( 'outside10000' ).style.display = 'block';
               document.mn_navi.way[2].checked = false;
               if( ! document.mn_navi.way[0].checked && ! document.mn_navi.way[1].checked ){
                  document.mn_navi.way[0].checked = true;
               }
            }
         }
      }
   }
   ,
   tabExchangeF : function( nm ){
      $( "mn_tab1" ).src = "/ETlive/event/img/map/navi/tab1off.gif";
      $( "mn_tab2" ).src = "/ETlive/event/img/map/navi/tab2off.gif";
      $( "mn_" + nm ).src = "/ETlive/event/img/map/navi/" + nm + "on.gif";
      $( "mn_tab1form" ).style.display = "none";
      $( "mn_tab2form" ).style.display = "none";
      $( "mn_" + nm + "form" ).style.display = "block";
      
   }
   ,
   deleteNoneParamF : function(){
      if( ! this.availableWalkonly() ){
        /* if( document.mn_navi.way[2].checked ){
            document.mn_navi.way[0].checked = true;
            document.mn_navi.way[1].checked = false;
            document.mn_navi.way[2].checked = false;
         }*/
      }
   }
   ,
   routeidx : 1,
   tagClick : function( i ){
      if( this.routeidx == i ){
         return;
      }
      this.reset();
      document.getElementById( "mn_result_tab" + i ).src = '/ETlive/event/img/map/navi/tab_route' + i + "on.gif";
      this.setRoute[i]( false );
      this.routeidx = i;
      
   }
   ,
   reset : function(){
      var index = 1;
      while( document.getElementById( "route" + index ) != null ){
         document.getElementById( "mn_result_tab" + index ).src = '/ETlive/event/img/map/navi/tab_route' + index + "off.gif";
         document.getElementById( "route" + index ).style.display = 'none';
         index ++ ;
      }
   }
   ,
   callMyRouteRg : function( sbm, name ){
      new NTWindow.Modal( {
         x : 500, y : 380, data : {
            uri : "/pcnavi/mjx/myroute2.jsp", param : {
               sbm : sbm, name : name
            }
         }
      }
      );
   }
   ,
   setCondition : function(){
      var aForm = document.mn_navi;
      var rForm = document.retry;
      for( var i = 0 ; rForm != null && i < rForm.length ; i ++ ){
         var rElm = rForm.elements[i];
         if( aForm[rElm.name] != null ){
            var aElm = aForm[rElm.name];
            if( aElm.type == 'hidden' ){
               aElm.value = rElm.value;
            }
            else if( aElm.type == 'select-one' ){
               for( var el = 0; el < aElm.length ; el ++ ){
                  if( aElm[el].value == rElm.value ){
                     aElm.selectedIndex = el;
                     break;
                  }
               }
            }
            else if( aElm.type == 'checkbox' ){
               if( rElm.value == '1' ){
                  aElm.checked = true;
               }
               else{
                  aElm.checked = false;
               }
            }
            else{
               for( var el = 0; el < aElm.length ; el ++ ){
                  if( aElm[el].value == rElm.value ){
                     aElm[el].checked = true;
                  }
                  else{
                     aElm[el].checked = false;
                  }
               }
            }
            if( rElm.name == 'orv' || rElm.name == 'dnv' || rElm.name.match( /ldmk[1-8]/ ) ){
               $( 'mn_' + rElm.name ).innerHTML = rElm.value.split( '.' )[3];
            }
         }
      }
   }
}

//  ---------------------------------------

MyPoi = {
   myW : null,
   popup : null,
   setPOI : function( lon, lat, cd, nm, ad, tl, ct, mp, sp, gr, tf, id ){
      PoiCommon.setPOI( lon, lat, cd, nm, ad, tl, ct, mp, sp, gr, tf );
      ntmap.clearIcon( "my" );
      var icon = new NTIcon( new NTLatLng( lat, lon ), new NTImage( "/ETlive/event/img/map/poiMy.png", 25, 30 ), "", new NTImage( "/ETlive/event/img/map/poiMyShadow.png", 40, 30 ) );
      icon.setGroup( "my" );
      ntmap.addIcon( icon );
      ntmap.openMsg( new NTLatLng( lat, lon ), {
         max : {
            x : 300, y : 200
         }
         , content : document.getElementById( id )
      }
      );
   }
   ,
   openDetail : function( sp, pr, gr ){
      if( ! sp ) sp = "";
      if( ! pr ) pr = "";
      if( ! gr ) gr = "";
      var param = {
         spotId : sp, provId : pr, groupId : gr
      }
      ;
      new NTWindow.Modal( {
         x : 700, y : 500, data : {
            uri : "/pcnavi/mjx/detail.jsp", param : param
         }
      }
      );
   }
   ,
   openDetailAdv : function( pr, sp, ad ){
      if( ! sp ) sp = "";
      if( ! pr ) pr = "";
      if( ! ad ) ad = "";
      var param = {
         spotId : sp, provId : pr, advId : ad
      }
      ;
      new NTWindow.Modal( {
         x : 700, y : 500, data : {
            uri : "/pcnavi/mjx/detail.jsp", param : param
         }
      }
      );
   }
   ,
   openRegistWin : function(){
      var param = {
         sbm : "ins", name : NTPoiCurrent.name, address : NTPoiCurrent.address, phone : NTPoiCurrent.tel, lon : ntmap.getPos().getLongitude(), lat : ntmap.getPos().getLatitude(), advId : NTPoiCurrent.advId
      }
      ;
      this.myW = new NTWindow.Modal( {
         x : 500, y : 300, onClose : mylocationClickFunc, data : {
            uri : "/pcnavi/mjx/mypoi2.jsp", param : param
         }
      }
      );
   }
   ,
   callDelete : function( nm ){
      if( confirm( '刪掉選擇的 My 地點，可以嗎？ ' ) ){
         var param = new Object();
         param.sbm = "del";
         param.oldname = nm;
         param.name = NTPoiCurrent.name;
         param.address = NTPoiCurrent.address;
         param.phone = NTPoiCurrent.tel;
         param.lon = ntmap.getPos().getLongitude();
         param.lat = ntmap.getPos().getLatitude();
         param.SCode = NTPoiCurrent.id;
         param.LCode = NTPoiCurrent.categoryId;
         param.provId = NTPoiCurrent.provId;
         param.spotId = NTPoiCurrent.spotId;
         param.groupId = NTPoiCurrent.groupId;
         param.advId = NTPoiCurrent.advId;
         this.myW.get( {
            uri : "/pcnavi/mjx/mypoi3.jsp", param : param
         }
         );
      }
   }
   ,
   callRegist : function(){
      if( ! this.checkRegist() ){
         return false;
      }
      var param = new Object();
      param.sbm = "ins";
      param.name = document.mp_frmPoint.name.value;
      param.address = document.mp_frmPoint.address.value;
      param.phone = document.mp_frmPoint.phone.value;
      param.lon = ntmap.getPos().getLongitude();
      param.lat = ntmap.getPos().getLatitude();
      param.SCode = NTPoiCurrent.id;
      param.LCode = NTPoiCurrent.categoryId;
      param.provId = NTPoiCurrent.provId;
      param.spotId = NTPoiCurrent.spotId;
      param.groupId = NTPoiCurrent.groupId;
      param.advId = NTPoiCurrent.advId;
      this.myW.get( {
         uri : "/pcnavi/mjx/mypoi3.jsp", param : param
      }
      );
   }
   ,
   checkRegist : function(){
      var name = document.mp_frmPoint.name.value;
      while( name.indexOf( "　" ) >= 0 ){
         name = name.replace( "　", "" );
      }
      while( name.indexOf( " " ) >= 0 ){
         name = name.replace( " ", "" );
      }
      if( name == '' ){
         window.alert( '請輸入名字。' );
         return false;
      }
      if( isNaN( document.mp_frmPoint.phone.value ) ){
         window.alert( '半角数字で入力してください。' );
         return false;
      }
      return true;
   }
   ,
   closeWin : function(){
      this.myW.close();
   }
}

//  ---------------------------------------

;
MyRoute = {
   callResult : function( rowid, myflg, crsname ){
      new NTWindow.List( {
         title : "トータルナビ", width : 400, height : 400, x : 100, y : 60, data : {
            param : {
               rowid : rowid, myroute : myflg, crsname : crsname
            }
            , uri : "/pcnavi/mjx/totalnavi1.jsp"
         }
      }
      );
   }
   ,
   callRegist : function( obj ){
      if( this.checkRegist() ){
         var form = document.forms['mr_frmCourse'];
         var myW = NTWindow.Control.self( obj );
         myW.get( {
            uri : "/pcnavi/mjx/myroute3.jsp", form : form
         }
         );
      }
   }
   ,
   callDelete : function( obj, onm, oid, name ){
      if( confirm( '刪掉選擇的 My 地點，可以嗎？' ) ){
         var myW = NTWindow.Control.self( obj );
         var param = "oldname=" + onm + "&oldid=" + oid + "&sbm=del" + "&name=" + name;
         myW.get( {
            uri : "/pcnavi/mjx/myroute3.jsp", param : param
         }
         );
      }
   }
   ,
   closeWindow : function( obj ){
      var myW = NTWindow.Control.self( obj );
      myW.close();
   }
   ,
   checkRegist : function(){
      var name = document.mr_frmCourse.newname.value;
      while( name.indexOf( "　" ) >= 0 ){
         name = name.replace( "　", "" );
      }
      while( name.indexOf( " " ) >= 0 ){
         name = name.replace( " ", "" );
      }
      if( name == '' ){
         window.alert( '請輸入名稱。' );
         return false;
      }
      return true;
   }
}

//  ---------------------------------------

;
PoiCommon = {
   setPOI : function( lon, lat, cd, nm, ad, tl, ct, mp, sp, gr, tr ){
      ntmap.moveTo( new NTLatLng( lat, lon ) );
      NTPoiCurrent.reset();
      if( cd ) NTPoiCurrent.id = cd;
      if( nm ) NTPoiCurrent.name = nm;
      if( ad ) NTPoiCurrent.address = ad;
      if( tl ) NTPoiCurrent.tel = tl;
      if( ct ) NTPoiCurrent.categoryId = ct;
      if( mp ) NTPoiCurrent.provId = mp;
      if( sp ) NTPoiCurrent.spotId = sp;
      if( gr ) NTPoiCurrent.groupId = gr;
      if( tr ) {
         NTPoiCurrent.vics = tr
      }
      else{
         NTPoiCurrent.vics = "-1"
      }
      ;
      $( 'centername' ).innerHTML = nm;
   }
   ,
   setAdvInfo : function( ad, cc, im, nv ){
      if( ad ){
         NTPoiCurrent.advId = ad;
         if( nv )NTPoiCurrent.navi = nv;
         if( cc )NTPoiCurrent.catchCopy = cc;
         if( im )NTPoiCurrent.img = im;
      }
   }
   ,
   getVertex : function(){
      return ( ntmap.getPos().getLongitude() || "" ) + '.' + ( ntmap.getPos().getLatitude() || "" ) + '.' + ( NTPoiCurrent.id || "" ) + '.' + ( NTPoiCurrent.name || "" );
   }
   ,
   getAdditional : function(){
      return ( NTPoiCurrent.address || "" ) + '.' + ( NTPoiCurrent.tel || "" ) + '.' + ( NTPoiCurrent.categoryId || "" ) + '.' + ( NTPoiCurrent.provId || "" ) + '.' + ( NTPoiCurrent.spotId || "" ) + '.' + ( NTPoiCurrent.vics || "-1" );
   }
}

//  ---------------------------------------

;
Traffic = {
   lon : 0,
   lat : 0,
   move : function( lon, lat, poi ){
      this.lon = lon;
      this.lat = lat;
      NTPoiCurrent.reset();
      poi.name = ( poi.name || "" ).split( "→" )[0];
      NTPoiCurrent.name = poi.name;
      $( "centername" ).innerHTML = poi.name;
      new Ajax.Request( "http://" + location.host + "/pcnavi/mjx/scaleCheck.jsp" , {
         method : "get", parameters : "lon=" + lon + "&lat=" + lat, onComplete : this.complete.bind( this )
      }
      );
   }
   ,
   complete : function( originalRequest ){
      var res = eval( "(" + originalRequest.responseText + ")" );
      ntmap.setProperty( 'autoload', false );
      ntmap.setZoom( res.scale, 3 );
      ntmap.setProperty( 'autoload', true );
      ntmap.moveTo( new NTLatLng( this.lat, this.lon ) );
   }
   ,
   viewList : function( id ){
      $( 'mv_sub1i' ).src = "/ETlive/event/img/map/traffic/tab1off.gif";
      $( 'mv_sub2i' ).src = "/ETlive/event/img/map/traffic/tab2off.gif";
      $( 'mv_sub3i' ).src = "/ETlive/event/img/map/traffic/tab3off.gif";
      $( 'mv_sub' + id + 'i' ).src = "/ETlive/event/img/map/traffic/tab" + id + "on.gif";
      $( 'mv_sub1' ).style.display = "none";
      $( 'mv_sub2' ).style.display = "none";
      $( 'mv_sub3' ).style.display = "none";
      $( 'mv_sub' + id ).style.display = "block";
   }
   ,
   changeTitle : function( dom ){
      NTWindow.Control.self( dom ).setTitle( "道路交通情報：" + dom.innerHTML );
   }
}

//  ---------------------------------------

;
