﻿// JScript ファイル
/*--------------------------------------------------------------------------*
 *  2010.03 SP Hirofumi Yanagisawa 
 *  gmap.aspxで使用する地図表示スクリプト
 *--------------------------------------------------------------------------*/

//満空アイコン
var icon_mansya = null;
var icon_kuusya = null;
var icon_konzatu = null;
var icon_teishi = null;
var loadFlag = null;

//地図表示タイマー
var timerTimeout = 500;
var timerId = null;
//地図表示
var ymap = null;
var geocoder = null;
var eventlistener = null;
var get_kbn = null;

var eventlistener_P;
var eventlistener_A;

function mapLoad( base, ParamIdo, ParamKeido, genre ) {

//    alert("This is map! :" + genre);

    ymap = null;

       try {
           ymap = new Y.Map(base.id, { configure: { doubleClickZoom: true, scrollWheelZoom: false, singleClickPan: false, dragging: true} })
        } catch (ex) {
            alert("map!"+ex.message);
        }
        
        ymap.addControl(new Y.LayerSetControl());
        ymap.addControl(new Y.SliderZoomControlVertical(), new Y.ControlPosition(Y.ControlPosition.TOP_LEFT, new Y.Size(5, 280)));
        var search = new Y.SearchControl();
        ymap.addControl(search, new Y.ControlPosition(Y.ControlPosition.TOP_LEFT, new Y.Size(2, 2)));
        ymap.drawMap(new Y.LatLng(ParamIdo, ParamKeido), 16, Y.LayerSetId.NORMAL);

   try {
        var geoBox = ymap.getBounds();
        var SouthWest = geoBox.getSouthWest();
        var NorthEast = geoBox.getNorthEast();
        var SouthWest_ido = SouthWest.Lat;
        var NorthEast_ido = NorthEast.Lat;
        var SouthWest_keido = SouthWest.Lon;
        var NorthEast_keido = NorthEast.Lon;
        var latlng = ymap.getCenter();
        var c_ido = latlng.lat();
        var c_keido = latlng.lng();

        ymap.bind("moveend", function() {
            onMoved();
        });
        ymap.bind("zoomend", function() {
            onMoved();
        });
		ymap.bind( "click" , function( latlng ) {
			location.href='http://www.ipos-map.jp/mapjump.asp?lat='+latlng.lat()+'&lng='+latlng.lng()+'&prf='+document.getElementById("prf").value+'&genre='+document.getElementById("genre").value;
		});
        if (genre == 1) {
            onMovedPark(1)
        }
        if (genre == 16) {
            onMovedAed(2)
        }
        
    } catch (ex) {
        alert("map2!" + ex.message);
    }

}

function clearMapMarker() {

    try {
    ymap.clearFeatures();

    } catch (ex) {
    alert("clearMapMarker! " + ex.message);
    }
}

function onMovedPark(ParamKbn) {

    //イベントを設定
    try {
        get_kbn = ParamKbn;

        clearMapMarker();
        onMoved();

    } catch (ex) {
        alert("onMovedPark!" + ex.message);
    }
}

function onMovedAed(ParamKbn) {

    //イベントを設定
    try {
        get_kbn = ParamKbn;
        clearMapMarker();
        onMoved();
    
    } catch (ex) {
        alert("onMovedAed!" + ex.message);
    }

}
//マウス移動終了イベントの定義
function onMoved() {
    var move_ = null;
    move_ = get_kbn;
//    alert("onMoved! move_: " + move_);

    if (move_ == "1") {
        if (timerId != null) {
            clearTimeout(timerId);
        }
        timerId = setTimeout(onMovedP, timerTimeout);
    }
    if (move_ == "2") {
        if (timerId != null) {
            clearTimeout(timerId);
        }
        timerId = setTimeout(onMovedA, timerTimeout);
    }
}

//マウス移動終了イベントの定義
function onMovedP() {

    latlng = ymap.getCenter();
    var geoBox = ymap.getBounds();
    var SouthWest = geoBox.getSouthWest();
    var NorthEast = geoBox.getNorthEast();
    var SouthWest_ido = SouthWest.Lat;
    var NorthEast_ido = NorthEast.Lat;
    var SouthWest_keido = SouthWest.Lon;
    var NorthEast_keido = NorthEast.Lon;
    var c_ido = latlng.lat();
    var c_keido = latlng.lng();
    var iconsize;
    var titel;

    document.getElementById("genre").value = "001";
//    alert("onMovedP! ParamKbn: ");

    FunctionList.GetParkList(c_ido, c_keido, NorthEast_ido, NorthEast_keido, SouthWest_ido, SouthWest_keido,
            function(DbParkList) {
                //駐車場リストを表示
                //alert('駐車場数' + DbParkList.length);
                //alert(document.getElementById('GMapParkList'));
                var parkList = $get('pList');
                //var parkList = document.getElementById("pList");
                //alert(parkList.tagName);
                //alert(parkList.rows.length);
                //リストデータクリア
                while (0 < parkList.rows.length) {
                    parkList.deleteRow(0);
                }
                //データなしの場合
                if ((DbParkList.length == 0) || (DbParkList[0] == null)) {
                    var row1 = parkList.insertRow(0);   // 行を追加
                    var cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                    row1.style.backgroundColor = '#F5FFFA';
                    row1.style.cursor = 'default';
                    cell1.style.width = '180px';
                    cell1.style.borderWidth = '0px';
                    cell1.align = 'center';
                    cell1.style.cursor = 'default';
                    cell1.innerHTML = '駐車場がありません';
                    try {
                        var pTag = $get('pTag');
                        //alert("onMovedP pTag:" + pTag.id );
                        pTag.deleteRow(0);
                         row1 = pTag.insertRow(0);   // 行を追加
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                         cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                        //row1.style.backgroundColor = '#F5FFFA';
                        row1.style.cursor = 'default';
                        cell1.align = 'left';
                        cell1.style.cursor = 'default';
                        var iconSrc = 'img/icon/p00.gif';
                        cell1.innerHTML = '<A HREF="JavaScript:;" onclick="onMovedPark(1)"><img border="0" src="' + iconSrc + '" width="16px" height="16px" /></A>';
                        cell2.align = 'left';
                        //cell2.style.cursor = 'default';
                        cell2.innerHTML = '<A CLASS="Genrename" HREF="JavaScript:;" onclick="onMovedPark(1)">時間貸駐車場:0</A>';
                    } catch (ex) {
                        alert("onMovedP err:" + ex.message);
                    }
 
                    return;
                } else {
                    try {
                         pTag = $get('pTag');
                        //alert("onMovedP pTag:" + pTag.id );
                        pTag.deleteRow(0);
                         row1 = pTag.insertRow(0);   // 行を追加
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                         cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                        //row1.style.backgroundColor = '#F5FFFA';
                        row1.style.cursor = 'default';
                        cell1.align = 'left';
                        cell1.style.cursor = 'default';
                         iconSrc = 'img/icon/p00.gif';
                        cell1.innerHTML = '<A HREF="JavaScript:;" onclick="onMovedPark(1)"><img border="0" src="' + iconSrc + '" width="16px" height="16px" /></A>';
                        cell2.align = 'left';
                        //cell2.style.cursor = 'default';
                        cell2.innerHTML = '<A CLASS="Genrename" HREF="JavaScript:;" onclick="onMovedPark(1)">時間貸駐車場:' + DbParkList[0].strCount + '</A>';
                    } catch (ex) {
                        alert("onMovedP err:" + ex.message);
                    }
                    try {
                        var kenmei = $get('kenmei');
                        //alert("onMovedP pTag:" + pTag.id );
                        kenmei.deleteRow(0);
                         row1 = kenmei.insertRow(0);   // 行を追加
                        row1.style.backgroundColor = '#f0f0ff';
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                        cell1.align = 'center';
                        cell1.innerHTML = '<tr><td align="center" valign="bottom" bgcolor="#f0f0ff"><font style="font-size:13pt;font-weight:900;color:#4040a0;">' + DbParkList[0].strKen + '</font></td></tr>';
                    } catch (ex) {
                        alert("onMovedP err:" + ex.message);
                    }
                }

                //データありの場合
                for (i = 0; i < DbParkList.length; i++) {
                     iconSrc = null;
                    var iconMK = null;
                    var iconAlt = null;
                    var iconAlt2 = null;
                    var iconHensu = null;
                    var markerUrl = null;
                    var markerText = null;

                    //最大件数表示。それ以上は表示しない。（App_Code/FunctionList.vb内にもあり）
                    if (i >= 100) {
                         row1 = parkList.insertRow(i);   // 行を追加
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                         cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                        var cell3 = row1.insertCell(2);     // 三つ目のセルを追加
                        row1.style.backgroundColor = '#F5FFFA';
                        row1.style.cursor = 'default';
                        //                        row1.style.overflow = 'auto';
                        cell1.style.borderWidth = '0px';
                        cell2.style.borderWidth = '0px';
                        cell3.style.borderWidth = '0px';
                        cell1.align = 'center';
                        cell2.align = 'center';
                        cell3.align = 'center';
                        cell1.style.cursor = 'default';
                        cell2.style.cursor = 'default';
                        cell3.style.cursor = 'default';
                        cell2.width = 160;
                        var iCount = i - 1;
                        cell2.innerHTML = '最大表示 ' + i + ' 駐車場に達しました';

                        break;
                    }
                     row1 = parkList.insertRow(i);   // 行を追加
                     cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                     cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                     cell3 = row1.insertCell(2);     // 三つ目のセルを追加
                    row1.id = 'parkList_r' + i;         // 行を追加
                    cell1.id = 'parklist_cMK_' + i;
                    cell2.id = 'parklist_cName_' + i;
                    cell3.id = 'parklist_cMap_' + i;
                    cell1.align = 'left';
                    cell2.align = 'left';
                    cell3.align = 'center';
                    cell1.width = 16;
                    cell2.width = 120;
                    cell3.width = 10;
                    row1.style.backgroundColor = '#F5FFFA';
                    row1.style.cursor = 'default';
                    cell1.style.cursor = 'pointer';
                    cell2.style.cursor = 'default';
                    cell3.style.cursor = 'pointer';
                    cell1.style.borderWidth = '0px';
                    cell2.style.borderWidth = '0px';
                    cell3.style.borderWidth = '0px';

                    iconsize = '16px'
                    //満空アイコン決定
                    if (DbParkList[i].strManku == '空車') { //.strManku == '0'
                        iconSrc = 'img/icon/p00.gif';
                        iconMK = icon_kuusya;
                        iconAlt = '空車';
                        iconAlt2 = '空';
                        iconColor = 'Green';
                        iconHensu = 'icon_kuusya';
                    }
                    else if (DbParkList[i].strManku == '混雑') { //.strManku == '1'
                        iconSrc = 'img/icon/p01.gif';
                        iconMK = icon_konzatu;
                        iconAlt = '混雑';
                        iconAlt2 = '混';
                        iconColor = 'Olive';
                        iconHensu = 'icon_konzatu';
                    }
                    else if (DbParkList[i].strManku == '満車') { //.strManku == '2'
                        iconSrc = 'img/icon/p02.gif';
                        iconMK = icon_mansya;
                        iconAlt = '満車';
                        iconAlt2 = '満';
                        iconColor = 'Red';
                        iconHensu = 'icon_mansya';
                    }
                    //                    else if(DbParkList[i].strManku == '4')
                    //                    {
                    //                        iconSrc = 'img/gmap/p03.png';
                    //                        iconMK = icon_teishi;
                    //                        iconAlt = '閉鎖';
                    //                        iconColor = 'Black';
                    //                        iconHensu = 'icon_teishi';
                    //                    }
                    else {
                        iconSrc = 'img/icon/point.gif';
                        //                        iconSrc = 'img/icon/p04.gif';
                        iconMK = icon_teishi;
                        iconAlt = '';
                        iconAlt2 = '';
                        iconColor = 'Black';
                        iconHensu = 'icon_teishi';
                        iconsize = '12px'
                    }

                    cell1.style.color = iconColor;
                    cell1.innerHTML = '<img border="0" src="' + iconSrc + '" width="' + iconsize + '" height="' + iconsize + '" />';
                    //                    cell1.innerHTML = iconAlt;
                    //                    //                    markerUrl = 'detailpop.aspx?id=' + DbParkList[i].strParingId;
                    markerUrl = 'Detail.aspx?id=' + DbParkList[i].strParingId + '&ido=' + DbParkList[i].strLatWGS84 + '&keido=' + DbParkList[i].strLonWGS84 + '&iposid=' + DbParkList[i].strIposId;
                    //IEはwindow.openの第二引数に記号があるとウインドウが開かないため、DbParkList[i].strNameから「駐車場詳細」に修正した

                    cell2.innerHTML = '<font style="font-size:8pt;	font-weight:300; color:' + iconColor + ';">' +
                                     '<a  class="LinkList" id="link2" href="' + markerUrl + '" onclick="window.open(\'' + markerUrl + '\', \'駐車場詳細\', \'width=700,height=520,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=no,toolbar=no,location=no\'); return false;">' + DbParkList[i].strName + '</a>' +
                                     '　</font>';
                    //cell2.innerHTML = '<a id="link2" href="' + markerUrl + '" onclick="window.open(\'' + markerUrl + '\', \'' + DbParkList[i].strName + '\', \'width=700,height=520,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=no,toolbar=no,location=no\'); return false;">' + DbParkList[i].strName + '</a>';
                    //cell3.innerHTML = '<a src="img/gmap/map_icon3.png" href=""></a>';
                    //cell3.innerHTML = '<img border="0" src="' + iconSrc + '" width="16" height="16" />';

                    markerText = '<font color="' + iconColor + '">' + iconAlt + '　</font>' + DbParkList[i].strName + '<br />' +
                                '<a  class="LinkList" id="link2" href="' + markerUrl + '" onclick="window.open(\'' + markerUrl + '\', \'駐車場詳細\', \'width=700,height=600,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=yes,toolbar=no,location=no\'); return false;">駐車場詳細</a>';
                    //markerText = '<font color="' + iconColor + '">' + iconAlt + '　</font>' + DbParkList[i].strName + '<br />' + 
                    //            '<a id="link2" href="' + markerUrl + '" onclick="window.open(\'' + markerUrl + '\', \'' + DbParkList[i].strName + '\', \'width=700,height=520,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=no,toolbar=no,location=no\'); return false;">駐車場詳細</a>';
                    titel = '駐車場詳細';

                    cell3.innerHTML = '<font style="font-size:8pt; font-weight:bold; color:' + iconColor + ';">' + iconAlt2 + '</font>';

                    //     alert(markerText);
                    try {
                        AddMarker(DbParkList[i].strLatWGS84, DbParkList[i].strLonWGS84, DbParkList[i].strName, DbParkList[i].strParingId, iconSrc, markerText, markerUrl, titel);
                    } catch (ex) {
                        alert("AddMarker:" + ex.message);
                    }
                    //地図に表示

                }


            }
        );
}

//マウス移動終了イベントの定義
function onMovedA() {

    latlng = ymap.getCenter();
    var geoBox = ymap.getBounds();
    var SouthWest = geoBox.getSouthWest();
    var NorthEast = geoBox.getNorthEast();
    var SouthWest_ido = SouthWest.Lat;
    var NorthEast_ido = NorthEast.Lat;
    var SouthWest_keido = SouthWest.Lon;
    var NorthEast_keido = NorthEast.Lon;
    var c_ido = latlng.lat();
    var c_keido = latlng.lng();
    var titel;

//    alert("onMovedA! ParamKbn: " );

//　AED
    document.getElementById("genre").value = "016";

        FunctionList.GetAedList(c_ido, c_keido, NorthEast_ido, NorthEast_keido, SouthWest_ido, SouthWest_keido,
            function(DbParkList) {
                //駐車場リストを表示
                //alert('AED数' + DbParkList.length);
                //alert(document.getElementById('GMapParkList'));
                var parkList = $get('pList');
                try {
                } catch (ex) {
                    alert("AED数:" + ex.message);
                }
                //alert(parkList.rows.length);
                //リストデータクリア
                while (0 < parkList.rows.length) {
                    parkList.deleteRow(0);
                }

                //データなしの場合
                if ((DbParkList.length == 0) || (DbParkList[0] == null)) {
                    var row1 = parkList.insertRow(0);   // 行を追加
                    var cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                    row1.style.backgroundColor = '#F5FFFA';
                    row1.style.cursor = 'default';
                    cell1.style.width = '180px';
                    cell1.style.borderWidth = '0px';
                    cell1.align = 'center';
                    cell1.style.cursor = 'default';
                    cell1.innerHTML = 'AEDがありません';

                    try {
                        //alert("onMovedA aTag:");
                        var aTag = $get('aTag');
                        aTag.deleteRow(0);
                         row1 = aTag.insertRow(0);   // 行を追加
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                        var cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                        //row1.style.backgroundColor = '#F5FFFA';
                        row1.style.cursor = 'default';
                        cell1.align = 'left';
                        cell1.style.cursor = 'default';
                        var iconSrc = 'img/icon/b990.gif';
                        cell1.innerHTML = '<tr><td><A HREF="JavaScript:;" onclick="onMovedAed(2)"><img border="0" src="' + iconSrc + '" width="16px" height="16px" /></A></td>';
                        cell2.align = 'left';
                        //cell2.style.cursor = 'default';
                        cell2.innerHTML = '<td align="left" valign="bottom"><A CLASS="Genrename" HREF="JavaScript:;" onclick="onMovedAed(2)" >ＡＥＤ:0</A></td></tr>';
                    } catch (ex) {
                        alert("onMovedA err:" + ex.message);
                    }
                    return;
                } else {
                    try {
                        //alert("onMovedA aTag:");
                         aTag = $get('aTag');
                        aTag.deleteRow(0);
                         row1 = aTag.insertRow(0);   // 行を追加
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                         cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                        //row1.style.backgroundColor = '#F5FFFA';
                        row1.style.cursor = 'default';
                        cell1.align = 'left';
                        cell1.style.cursor = 'default';
                         iconSrc = 'img/icon/b990.gif';
                        cell1.innerHTML = '<tr><td><A HREF="JavaScript:;" onclick="onMovedAed(2)"><img border="0" src="' + iconSrc + '" width="16px" height="16px" /></A></td>';
                        cell2.align = 'left';
                        //cell2.style.cursor = 'default';
                        cell2.innerHTML = '<td align="left" valign="bottom"><A CLASS="Genrename" HREF="JavaScript:;" onclick="onMovedAed(2)" >ＡＥＤ:' + DbParkList[0].strCount + '</A></td></tr>';
                    } catch (ex) {
                        alert("onMovedA err:" + ex.message);
                    }
                    try {
                        var kenmei = $get('kenmei');
                        kenmei.deleteRow(0);
                         row1 = kenmei.insertRow(0);   // 行を追加
                        row1.style.backgroundColor = '#f0f0ff';
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                        cell1.align = 'center';
                        cell1.innerHTML = '<tr><td align="center" valign="bottom" bgcolor="#f0f0ff"><font style="font-size:13pt;font-weight:900;color:#4040a0;">' + DbParkList[0].strKen + '</font></td></tr>';
                    } catch (ex) {
                        alert("onMovedA err:" + ex.message);
                    }
                }

                //データありの場合
                for (i = 0; i < DbParkList.length; i++) {
                     iconSrc = null;
                    var iconMK = null;
                    var iconAlt = null;
                    var iconHensu = null;
                    var markerUrl = null;
                    var markerText = null;

                    //最大件数表示。それ以上は表示しない。（App_Code/FunctionList.vb内にもあり）
                    if (i >= 100) {
                         row1 = parkList.insertRow(i);   // 行を追加
                         cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                         cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                        var cell3 = row1.insertCell(2);     // 三つ目のセルを追加
                        row1.style.backgroundColor = '#F5FFFA';
                        row1.style.cursor = 'default';
                        cell1.style.borderWidth = '0px';
                        cell2.style.borderWidth = '0px';
                        cell3.style.borderWidth = '0px';
                        cell1.align = 'center';
                        cell2.align = 'center';
                        cell3.align = 'center';
                        cell1.style.cursor = 'default';
                        cell2.style.cursor = 'default';
                        cell3.style.cursor = 'default';
                        cell2.width = 120;
                        var iCount = i - 1;
                        cell2.innerHTML = '最大表示 ' + i + ' AEDに達しました';

                        break;
                    }
                     row1 = parkList.insertRow(i);   // 行を追加
                     cell1 = row1.insertCell(0);     // 一つ目のセルを追加
                     cell2 = row1.insertCell(1);     // 二つ目のセルを追加
                     cell3 = row1.insertCell(2);     // 三つ目のセルを追加
                    row1.id = 'parkList_r' + i;         // 行を追加
                    cell1.id = 'parklist_cMK_' + i;
                    cell2.id = 'parklist_cName_' + i;
                    cell3.id = 'parklist_cMap_' + i;
                    cell1.align = 'left';
                    cell2.align = 'left';
                    cell3.align = 'center';
                    cell1.width = 16;
                    cell2.width = 120;
                    cell3.width = 10;
                    row1.style.backgroundColor = '#F5FFFA';
                    row1.style.cursor = 'default';
                    cell1.style.cursor = 'pointer';
                    cell2.style.cursor = 'default';
                    cell3.style.cursor = 'pointer';
                    cell1.style.borderWidth = '0px';
                    cell2.style.borderWidth = '0px';
                    cell3.style.borderWidth = '0px';


                    //アイコン決定
                    iconSrc = 'img/icon/b990.gif';
                    iconMK = icon_kuusya;
                    iconAlt = 'AED';
                    iconColor = 'Green';
                    iconHensu = 'icon_kuusya';

                    cell1.style.color = iconColor;
                    cell1.innerHTML = '<img border="0" src="' + iconSrc + '" width="16px" height="16px" />';
                    //                    cell1.innerHTML = iconAlt;
                    //                    //                    markerUrl = 'detailpop.aspx?id=' + DbParkList[i].strParingId;
                    markerUrl = 'AedInfo.aspx?id=' + DbParkList[i].strParingId + '&ido=' + DbParkList[i].strLatWGS84 + '&keido=' + DbParkList[i].strLonWGS84;
                    //IEはwindow.openの第二引数に記号があるとウインドウが開かないため、DbParkList[i].strNameから「駐車場詳細」に修正した

                    cell2.innerHTML = '<font style="font-size:8pt;	font-weight:300; color="' + iconColor + '">' +
                                     '<a  class="LinkList" id="link2" href="' + markerUrl + '" onclick="window.open(\'' + markerUrl + '\', \'AED詳細\', \'width=700,height=520,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=no,toolbar=no,location=no\'); return false;">' + DbParkList[i].strName + '</a>' +
                                     '　</font>';
                    //cell2.innerHTML = '<a id="link2" href="' + markerUrl + '" onclick="window.open(\'' + markerUrl + '\', \'' + DbParkList[i].strName + '\', \'width=700,height=520,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=no,toolbar=no,location=no\'); return false;">' + DbParkList[i].strName + '</a>';
                    //cell3.innerHTML = '<a src="img/gmap/map_icon3.png" href=""></a>';
                    //cell3.innerHTML = '<img border="0" src="' + iconSrc + '" width="16" height="16" />';

                    markerText = '<font color="' + iconColor + '">' + iconAlt + '　</font>' + DbParkList[i].strName + '<br />' +
                                '<a class="LinkList" id="link2" href="' + markerUrl + '" onclick="window.open(\'' + markerUrl + '\', \'AED詳細\', \'width=700,height=600,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=yes,toolbar=no,location=no\'); return false;">AED詳細</a>';
                    titel = 'AED詳細';
                    //     alert(markerText);
                    try {
                        AddMarker(DbParkList[i].strLatWGS84, DbParkList[i].strLonWGS84, DbParkList[i].strName, DbParkList[i].strParingId, iconSrc, markerText, markerUrl, titel);
                    } catch (ex) {
                        alert("AddMarker:" + ex.message);
                    }
                    //地図に表示

                }

            }
        );
}

//	
//マーカー追加処理を定義
function AddMarker(strLatWGS84, strLonWGS84, strName, strParingId, iconMK, markerText, markerUrl, titel) {

    //alert("icon:" + iconMK);

    var picon = new Y.Icon(iconMK);
    var marker = new Y.Marker(new Y.LatLng(strLatWGS84, strLonWGS84), { icon: picon });
    var label = new Y.Label(new Y.LatLng(strLatWGS84, strLonWGS84), strName);

    try{
	    //マーカーにクリックイベントを設定
        //marker.bind("click", function(e) { window.open( + markerUrl + '\', \'AED詳細\', \'width=700,height=520,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=no,toolbar=no,location=no\');); });
        //marker.bind("click", function(e) { ymap.openInfoWindow(this.getLatLng(), markerText); });
        marker.bind("click", function(e) { window.open(markerUrl, titel, 'width=700,height=640,status=yes,scrollbars=yes,directories=no,menubar=no,resizable=no,toolbar=no,location=no'); });
        marker.bind("mouseout",  function(e) { ymap.removeFeature(label); });
        marker.bind("mouseover", function(e) { ymap.addFeature(label);    });

    } catch (ex) {
    alert("AddMarker:" + ex.message);
    }
    ymap.addFeature(marker);
}
//--------------------------------------------------------------------

