/**
 * @author natu_n
 */
var map;
var aid = "aomori03-22";

var amrUrl = "http://natu-n.com/Aomori_map.htm?isbn=";
var iwtUrl = "http://natu-n.com/Iwate_map.htm?isbn=";
var mygUrl = "http://natu-n.com/Miyagi_map.htm?isbn=";
var aktUrl = "http://natu-n.com/Akita_map.htm?isbn=";
var ymaUrl = "http://natu-n.com/Yamagata_map.htm?isbn=";
var fksUrl = "http://natu-n.com/Fukushima_map.htm?isbn=";
var BrF = 0;

var icon1 = new GIcon();
    icon1.image = "img/070.png";
    icon1.shadow = "img/shadow50.png";
    icon1.iconSize = new GSize(20,34);
    icon1.shadowSize = new GSize(37,34);
    icon1.iconAnchor = new GPoint(9,33);
var icon1P = new GIcon();
    icon1P.image = "img/070P.png";
    icon1P.shadow = "img/shadow50.png";
    icon1P.iconSize = new GSize(20,34);
    icon1P.shadowSize = new GSize(37,34);
    icon1P.iconAnchor = new GPoint(9,33);
var icon2 = new GIcon();
    icon2.image = "img/010.png";
    icon2.shadow = "img/shadow50.png";
    icon2.iconSize = new GSize(20,34);
    icon2.shadowSize = new GSize(37,34);
    icon2.iconAnchor = new GPoint(9,33);
var icon2P = new GIcon();
    icon2P.image = "img/010P.png";
    icon2P.shadow = "img/shadow50.png";
    icon2P.iconSize = new GSize(20,34);
    icon2P.shadowSize = new GSize(37,34);
    icon2P.iconAnchor = new GPoint(9,33);
var icon3 = new GIcon();
    icon3.image = "img/ajax-loader.gif";
    icon3.iconSize = new GSize(16,16);
    icon3.iconAnchor = new GPoint(7,15);
var iconX = new GIcon();
    iconX.image = "img/036.png";
    iconX.shadow = "img/shadow50.png";
    iconX.iconSize = new GSize(20,34);
    iconX.shadowSize = new GSize(37,34);
    iconX.iconAnchor = new GPoint(9,33);

//青森県立図書館
var _02000 = {
    "00" : new GLatLng(40.795074,140.738533)
};
var marker_02000 = new GMarker(new GLatLng(40.795074,140.738533),{icon: icon3});
//青森市民図書館
var _02201 = {
    "00" : new GLatLng(40.82697,140.735708)
};
var marker_02201 = new GMarker(new GLatLng(40.82697,140.735708),{icon: icon3});
//弘前市立弘前図書館
var _02202 = {
    "00" : new GLatLng(40.602411,140.465398)
};
var marker_02202 = new GMarker(new GLatLng(40.602411,140.465398),{icon: icon3});
//五所川原市立図書館
var _02205 = {
    "01" : new GLatLng(40.797573362540284,140.4424488544464),
    "02" : new GLatLng(40.90951127003555,140.4511821269989),
    "03" : new GLatLng(41.05562652708531,140.34588932991028)
};
var marker_02205 = new GMarker(new GLatLng(40.797573362540284,140.4424488544464),{icon: icon3});
//三沢市立図書館
var _02207 = {
    "00" : new GLatLng(40.68283884796505,141.3716036081314)
};
var marker_02207 = new GMarker(new GLatLng(40.68283884796505,141.3716036081314),{icon: icon3});
//平川市立平賀図書館
var _02365 = {
    "00" : new GLatLng(40.590342,140.562915)
};
var marker_02365 = new GMarker(new GLatLng(40.590342,140.562915),{icon: icon3});
//平川市立尾上図書館
var _02363 = {
    "00" : new GLatLng(40.615038,140.572525)
};
var marker_02363 = new GMarker(new GLatLng(40.615038,140.572525),{icon: icon3});
//中泊町図書館
//日本海漁火センター
var _02387 = {
    "00" : new GLatLng(40.961023,140.433254),
    "01" : new GLatLng(40.961023,140.433254),
    "02" : new GLatLng(41.130429,140.300219)
};
var marker_02387 = new GMarker(new GLatLng(40.961023,140.433254),{icon: icon3});

//むつ市立図書館
//川内分館
//大畑分館
//脇野沢分館
var _02208 = {
    "00" : new GLatLng(41.289569,141.185678),
    "01" : new GLatLng(41.405463,141.170025),
    "02" : new GLatLng(41.289569,141.185678),
    "03" : new GLatLng(41.201261,141.002226),
    "04" : new GLatLng(41.146879,140.814396)
};
var marker_02208 = new GMarker(new GLatLng(41.289569,141.185678),{icon: icon3});

//八戸市立図書館
//八戸市図書情報センター
//八戸市南郷図書館
var _02203 = {
    "00" : new GLatLng(40.505079,141.486566),
    "01" : new GLatLng(40.505079,141.486566),
    "02" : new GLatLng(40.509306,141.43218),
    "03" : new GLatLng(40.404463,141.431983)
};
var marker_02203 = new GMarker(new GLatLng(40.505079,141.486566),{icon: icon3});

//七戸町立中央図書館
//七戸中央公民館図書室
var _02402 = {
//  "00" : new GLatLng(40.698739,141.155605),
    "01" : new GLatLng(40.698739,141.155605),
    "02" : new GLatLng(40.7459,141.156198)
};
var marker_02402 = new GMarker(new GLatLng(40.698739,141.155605),{icon: icon3});

//十和田市民図書館
var _02206 = {
    "00" : new GLatLng(40.611491,141.20551)
};
var marker_02206 = new GMarker(new GLatLng(40.611491,141.20551),{icon: icon3});

//五戸町図書館
var _02442 = {
    "00" : new GLatLng(40.522901,141.298661)
};
var marker_02442 = new GMarker(new GLatLng(40.522901,141.298661),{icon: icon3});

//六ヶ所村民図書館
var _02411 = {
    "00" : new GLatLng(40.964908,141.363946)
};
var marker_02411 = new GMarker(new GLatLng(40.964908,141.363946),{icon: icon3});

//  板柳町民図書館
var _02381 = {
    "00" : new GLatLng(40.696939,140.464993),
    "url1" : "http://www.town.itayanagi.aomori.jp/library/Book_Kensaku.asp?Bunrui=All&KeyWord=",
    "url2" : ""
};

//          GreyBox configuration
//                                              Use animation?
var GB_ANIMATION = true;
var GB_IMG_DIR = "greybox/";
    GreyBox.preloadGreyBoxImages();
//                                              Clicking on the transparent overlay closes the GreyBox window?
var GB_overlay_click_close = true;

function load() {
    if (!GBrowserIsCompatible()) {
        alert("このブラウザはGoogle Mapsに対応していません");
        return;
    }
    if(navigator.userAgent.indexOf("MSIE 7") != -1) {
        BrF = 1;
    }
//  window.external.AddSearchProvider("http://natu-n.com/Fukushima_map.xml");
//  関連情報の非表示
    $("series").hide();
/*
 *  入力フォームでのキーイベント(Enter)の取得
 *      Enterキー押下でのsubmitを抑制し(リロードを防ぐ)、検索ボタン押下のイベントを発生させる
*/
    Event.observe($('ISBN'), 'keypress',
        function(event){
            if (event.keyCode == Event.KEY_RETURN) {
                Event.stop(event);
                document.iform.BTN.focus();
                AddDashSub();
            }
        }
        , false);

//  マップの読み込み、マウスでの拡大縮小イベントの追加
    map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(40.952807,140.915794), 9);
    map.addControl(new GLargeMapControl());
    map.addControl(new GScaleControl());
    map.addControl(new GOverviewMapControl());
    map.enableDoubleClickZoom();
    Event.observe($('map'),'mousewheel',
        function (element, wheel_count){
                wheel_count == 1 ? map.zoomIn() : map.zoomOut();
        }
    , false);

//  クエリ文字列をサニタイズしてからパラメータへセット
    document.iform.ISBN.value = "";
    document.iform.ISBN.focus();
    para = document.location.search.substr(1).toQueryParams();
    if (para['isbn']){
        para['isbn'] = para['isbn'].replace(/[^0-9X]/g,'');
        if ((para['isbn'].length == 10) || (para['isbn'].length == 13)){
            document.iform.ISBN.value = para['isbn'];
            document.iform.ISBN.blur();
            $("BTN").onclick();
        }
    } else if (para['ISBN']){
        para['ISBN'] = para['ISBN'].replace(/[^0-9X]/g, '');
        if ((para['ISBN'].length == 10) || (para['ISBN'].length == 13)){
            document.iform.ISBN.value = para['ISBN'];
            document.iform.ISBN.blur();
            $("BTN").onclick();
        }
    }

}

/*
 *  マーカ定義１(Greybox表示あり)
 *  引数    point   :表示位置
 *          name    :onMouseでの表示名、Greyboxのタイトル
 *          url     :Greyboxで表示するurl
 *          icon    :追加するアイコン
*/
function createMarker1(point,name,url,icon) {
    var marker = new GMarker(point, {icon:icon,title:name});
    if (BrF == 0) {
        GEvent.addListener(marker, "click", function() {
            GB_showFullScreen(name, url);
            });
    } else {
        GEvent.addListener(marker, "click", function() {
            window.open(url);
            });
    }
    return marker;
}
/*
 *  マーカ定義２(Greybox表示なし)
 *  引数    point   :表示位置
 *          name    :onMouseでの表示名
 *          icon    :追加するアイコン
*/
function createMarker2(point,name,icon) {
    var marker = new GMarker(point, {icon:icon,title:name});
    return marker;
}

function AddDashSub (){
    str = document.iform.ISBN.value;
    switch(str.length){
        case 9:
            if (str.match(/(\d{9})/)){
                ISBN13   = "978" + str;
                ISBN10   = cvISBN10(ISBN13);
                ISBN10e  = edISBN10(ISBN10);
                ISBN10m  = ISBN10.substr(0,9);
                ISBN10em = ISBN10e.substr(0,11);
                ISBN13   = cvISBN13(ISBN10);
                ISBN13e  = edISBN13(ISBN13);
                document.iform.ISBN.value = ISBN10;
                break;
            } else {
                document.iform.ISBN.value = "";
                document.iform.ISBN.focus();
                return;
            }
        case 10:
            if (str.match(/(\d{9}[\d|X])/)){
                if (ckISBN10(str)) {
                    ISBN10   = str;
                    ISBN10e  = edISBN10(ISBN10);
                    ISBN10m  = ISBN10.substr(0,9);
                    ISBN10em = ISBN10e.substr(0,11);
                    ISBN13   = cvISBN13(ISBN10);
                    ISBN13e  = edISBN13(ISBN13);
                    break;
                }
                str = "978" + str;
                if (ckISBN13(str)) {
                    ISBN13   = str;
                    ISBN13e  = edISBN13(ISBN13);
                    ISBN10   = cvISBN10(ISBN13);
                    ISBN10e  = edISBN10(ISBN10);
                    ISBN10m  = ISBN10.substr(0,9);
                    ISBN10em = ISBN10e.substr(0,11);
                    document.iform.ISBN.value = ISBN13;
                    break;
                } else {
                    document.iform.ISBN.value = "";
                    document.iform.ISBN.focus();
                    return;
                }
            } else {
                document.iform.ISBN.value = "";
                document.iform.ISBN.focus();
                return;
            }
        case 12:
            if (str.match(/(\d{12})/)){
                ISBN10   = str.substr(3,9) + "X";
                ISBN13   = cvISBN13(ISBN10);
                ISBN13e  = edISBN13(ISBN13);
                ISBN10   = cvISBN10(ISBN13);
                ISBN10e  = edISBN10(ISBN10);
                ISBN10m  = ISBN10.substr(0,9);
                ISBN10em = ISBN10e.substr(0,11);
                document.iform.ISBN.value = ISBN13;
                break;
            } else {
                document.iform.ISBN.value = "";
                document.iform.ISBN.focus();
                return;
            }
        case 13:
            if (str.match(/(\d{13})/)){
                if (ckISBN13(str)) {
                    ISBN13   = str;
                    ISBN13e  = edISBN13(ISBN13);
                    ISBN10   = cvISBN10(ISBN13);
                    ISBN10e  = edISBN10(ISBN10);
                    ISBN10m  = ISBN10.substr(0,9);
                    ISBN10em = ISBN10e.substr(0,11);
                    document.iform.ISBN.value = ISBN13;
                    break;
                } else {
                    document.iform.ISBN.value = "";
                    document.iform.ISBN.focus();
                    return;
                }
            } else {
                document.iform.ISBN.value = "";
                document.iform.ISBN.focus();
                return;
            }
        default:
            document.iform.ISBN.value = "";
            document.iform.ISBN.focus();
            return;
    }

    mgr = new GMarkerManager(map);
    map.clearOverlays();
    mgr.refresh();
    var elementTarget = $("ttl");
    while ( elementTarget.hasChildNodes() ) {
        elementTarget.removeChild(elementTarget.firstChild);
    }
    elementTarget = $("img");
    while ( elementTarget.hasChildNodes() ) {
        elementTarget.removeChild(elementTarget.firstChild);
    }
//  elementTarget = $("links");
//  elementTarget.getElementsByTagName("a")[0].setAttribute('href' ,lnksUrl);
    $("iwt").setAttribute('href' ,iwtUrl + ISBN10);
    $("myg").setAttribute('href' ,mygUrl + ISBN10);
    $("akt").setAttribute('href' ,aktUrl + ISBN10);
    $("yma").setAttribute('href' ,ymaUrl + ISBN10);
    $("fks").setAttribute('href' ,fksUrl + ISBN10);
    $("thisLink").setAttribute('href' ,amrUrl + ISBN10);

//  Amazonより書籍情報を取得、表示
    Amazon_get(ISBN10);

//Webcat Plusで情報取得
    var elementTarget = $("btn2");
    while ( elementTarget.hasChildNodes() ) {
        elementTarget.removeChild(elementTarget.firstChild);
    }
    var elementTarget = $("series");
    while ( elementTarget.hasChildNodes() ) {
        elementTarget.removeChild(elementTarget.firstChild);
    }
    elementTarget.hide();
//  var wc_url = "http://natu-n.com/cgi/webcat_get3.cgi?isbn=" + ISBN10;
    var wc_url = "http://natu-n.com/cgi/webcat_get6.cgi?isbn=" + ISBN10;
    var wc_http = new JKL.ParseXML.JSON( wc_url );
    var wc_func = function (data) {
        var elementTarget = $("series");
        var hash1 = $H( data.series );
        if (data.flg == true) {
            var ul1 = document.createElement('ul');
            elementTarget.appendChild(ul1);
            var j = 0;
            hash1.each( function( pair ) {
                var li1 = document.createElement('li');
                elementTarget.getElementsByTagName("ul")[0].appendChild(li1);
                var lk1 = document.createElement('a');
                    lk1.setAttribute('href' ,'#');
                    lk1.setAttribute('title' ,hash1[pair.key]);
                var li1 = document.createTextNode(hash1[pair.key]);
                elementTarget.getElementsByTagName("li")[j].appendChild(lk1);
                elementTarget.getElementsByTagName("a")[j].appendChild(li1);
                Event.observe(elementTarget.getElementsByTagName("a")[j], 'click',
                    function(event){
                        $("series").hide();
                        $("map").show();
                        $("btn2").show();
                        document.iform.ISBN.value = pair.key;
                        document.iform.ISBN.blur();
                        $("BTN").onclick();
                    }
                , false);
                j++;
            } );
            var li1 = document.createElement('li');
            elementTarget.getElementsByTagName("ul")[0].appendChild(li1);
            var lk1 = document.createElement('a');
                lk1.setAttribute('href' ,'#');
                lk1.setAttribute('title' ,'マップ表示');
            var li1 = document.createTextNode('マップ表示≫');
            elementTarget.getElementsByTagName("li")[j].appendChild(lk1);
            elementTarget.getElementsByTagName("a")[j].appendChild(li1);
            Event.observe(elementTarget.getElementsByTagName("a")[j], 'click',
                function(event){
                    $("series").hide();
                    $("map").show();
                    $("btn2").show();
                }
            , false);
            
//      他巻情報表示ボタン作成
            var elementTarget = $("btn2");
            var lk1 = document.createElement('a');
                lk1.setAttribute('href' ,'#');
                lk1.setAttribute('title' ,'関連情報表示');
            var li1 = document.createTextNode('≪関連情報表示');
            elementTarget.appendChild(lk1);
            Event.observe(elementTarget.getElementsByTagName("a")[0], 'click',
                function(event){
                    $("btn2").hide();
                    $("map").hide();
                    $("series").show();
                }
            , false);
            elementTarget.getElementsByTagName("a")[0].appendChild(li1);
        }
    };
    wc_http.async(wc_func);
    wc_http.parse();

//  青森県立図書館
    var url_02000 = "http://natu-n.com/cgi/02000.cgi?isbn=" + ISBN10;
    var http_02000 = new JKL.ParseXML.JSON( url_02000 );
    var func_02000 = function (data) {
        var hash1 = $H( data.lib_02000 );
        var hash2 = $H( _02000 );
        var hash3 = $H( data.name_02000 );
        if (data.stock_02000 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02000[0],icon1P);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2P);
        }
        map.removeOverlay(marker_02000);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02000);
    http_02000.async(func_02000);
    http_02000.parse();

//青森市民図書館
    var url_02201 = "http://natu-n.com/cgi/02201.cgi?isbn=" + ISBN10;
    var http_02201 = new JKL.ParseXML.JSON( url_02201 );
    var func_02201 = function (data) {
        var hash1 = $H( data.lib_02201 );
        var hash2 = $H( _02201 );
        var hash3 = $H( data.name_02201 );
        if (data.stock_02201 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02201[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02201);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02201);
    http_02201.async(func_02201);
    http_02201.parse();

//  弘前市立弘前図書館
    var url_02202 = "http://natu-n.com/cgi/02202.cgi?isbn=" + ISBN10;
    var http_02202 = new JKL.ParseXML.JSON( url_02202 );
    var func_02202 = function (data) {
        var hash1 = $H( data.lib_02202 );
        var hash2 = $H( _02202 );
        var hash3 = $H( data.name_02202 );
        if (data.stock_02202 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02202[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02202);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02202);
    http_02202.async(func_02202);
    http_02202.parse();

//五所川原市立図書館
    var url_02205 = "http://natu-n.com/cgi/02205.cgi?isbn=" + ISBN10;
    var http_02205 = new JKL.ParseXML.JSON( url_02205 );
    var func_02205 = function (data) {
        var hash1 = $H( data.lib_02205 );
        var hash2 = $H( _02205 );
        var hash3 = $H( data.name_02205 );
        if (data.stock_02205 == true) {
            hash1.each( function( pair ) {
                if (pair.key != "00") {
                    if (pair.value == true) {
                        var marker = createMarker1(hash2[pair.key],hash3[pair.key],data.uri_02205[0],icon1);
                    } else {
                        var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                    }
                    mgr.addMarker(marker,0);
                }
            } );
        } else {
            hash2.each( function( pair ) {
                var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                mgr.addMarker(marker,0);
            } );
        }
        map.removeOverlay(marker_02205);
        mgr.refresh();
        };
    map.addOverlay(marker_02205);
    http_02205.async(func_02205);
    http_02205.parse();

//  三沢市立図書館
    var url_02207 = "http://natu-n.com/cgi/02207.cgi?isbn=" + ISBN10;
    var http_02207 = new JKL.ParseXML.JSON( url_02207 );
    var func_02207 = function (data) {
        var hash1 = $H( data.lib_02207 );
        var hash2 = $H( _02207 );
        var hash3 = $H( data.name_02207 );
        if (data.stock_02207 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02207[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02207);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02207);
    http_02207.async(func_02207);
    http_02207.parse();

//平川市立平賀図書館
    var url_02365 = "http://natu-n.com/cgi/02365.cgi?isbn=" + ISBN10;
    var http_02365 = new JKL.ParseXML.JSON( url_02365 );
    var func_02365 = function (data) {
        var hash1 = $H( data.lib_02365 );
        var hash2 = $H( _02365 );
        var hash3 = $H( data.name_02365 );
        if (data.stock_02365 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02365[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02365);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02365);
    http_02365.async(func_02365);
    http_02365.parse();

//平川市立尾上図書館
    var url_02363 = "http://natu-n.com/cgi/02363.cgi?isbn=" + ISBN10;
    var http_02363 = new JKL.ParseXML.JSON( url_02363 );
    var func_02363 = function (data) {
        var hash1 = $H( data.lib_02363 );
        var hash2 = $H( _02363 );
        var hash3 = $H( data.name_02363 );
        if (data.stock_02363 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02363[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02363);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02363);
    http_02363.async(func_02363);
    http_02363.parse();

//中泊町図書館
    var url_02387 = "http://natu-n.com/cgi/02387.cgi?isbn=" + ISBN10;
    var http_02387 = new JKL.ParseXML.JSON( url_02387 );
    var func_02387 = function (data) {
        var hash1 = $H( data.lib_02387 );
        var hash2 = $H( _02387 );
        var hash3 = $H( data.name_02387 );
        if (data.stock_02387 == true) {
            hash1.each( function( pair ) {
                if (pair.key != "00") {
                    if (pair.value == true) {
                        var marker = createMarker1(hash2[pair.key],hash3[pair.key],data.uri_02387[0],icon1);
                    } else {
                        var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                    }
                    mgr.addMarker(marker,0);
                }
            } );
        } else {
            hash2.each( function( pair ) {
                var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                mgr.addMarker(marker,0);
            } );
        }
        map.removeOverlay(marker_02387);
        mgr.refresh();
        };
    map.addOverlay(marker_02387);
    http_02387.async(func_02387);
    http_02387.parse();

//むつ市立図書館
    var url_02208 = "http://natu-n.com/cgi/02208.cgi?isbn=" + ISBN10;
    var http_02208 = new JKL.ParseXML.JSON( url_02208 );
    var func_02208 = function (data) {
        var hash1 = $H( data.lib_02208 );
        var hash2 = $H( _02208 );
        var hash3 = $H( data.name_02208 );
        if (data.stock_02208 == true) {
            hash1.each( function( pair ) {
                if (pair.key != "00") {
                    if (pair.value == true) {
                        var marker = createMarker1(hash2[pair.key],hash3[pair.key],data.uri_02208[0],icon1);
                    } else {
                        var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                    }
                    mgr.addMarker(marker,0);
                }
            } );
        } else {
            hash2.each( function( pair ) {
                var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                mgr.addMarker(marker,0);
            } );
        }
        map.removeOverlay(marker_02208);
        mgr.refresh();
        };
    map.addOverlay(marker_02208);
    http_02208.async(func_02208);
    http_02208.parse();

//八戸市立図書館
    var url_02203 = "http://natu-n.com/cgi/02203.cgi?isbn=" + ISBN10;
    var http_02203 = new JKL.ParseXML.JSON( url_02203 );
    var func_02203 = function (data) {
        var hash1 = $H( data.lib_02203 );
        var hash2 = $H( _02203 );
        var hash3 = $H( data.name_02203 );
        if (data.stock_02203 == true) {
            hash1.each( function( pair ) {
                if (pair.key != "00" && pair.key != "99") {
                    if (pair.value == true) {
                        var marker = createMarker1(hash2[pair.key],hash3[pair.key],data.uri_02203[0],icon1);
                    } else {
                        var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                    }
                    mgr.addMarker(marker,0);
                }
            } );
        } else {
            hash2.each( function( pair ) {
                var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                mgr.addMarker(marker,0);
            } );
        }
        map.removeOverlay(marker_02203);
        mgr.refresh();
        };
    map.addOverlay(marker_02203);
    http_02203.async(func_02203);
    http_02203.parse();

//七戸町立中央図書館
    var url_02402 = "http://natu-n.com/cgi/02402.cgi?isbn=" + ISBN10;
    var http_02402 = new JKL.ParseXML.JSON( url_02402 );
    var func_02402 = function (data) {
        var hash1 = $H( data.lib_02402 );
        var hash2 = $H( _02402 );
        var hash3 = $H( data.name_02402 );
        if (data.stock_02402 == true) {
            hash1.each( function( pair ) {
                if (pair.value == true) {
                    var marker = createMarker1(hash2[pair.key],hash3[pair.key],data.uri_02402[0],icon1);
                } else {
                    var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                }
                mgr.addMarker(marker,0);
            } );
        } else {
            hash2.each( function( pair ) {
                var marker = createMarker2(hash2[pair.key],hash3[pair.key],icon2);
                mgr.addMarker(marker,0);
            } );
        }
        map.removeOverlay(marker_02402);
        mgr.refresh();
        };
    map.addOverlay(marker_02402);
    http_02402.async(func_02402);
    http_02402.parse();

//十和田市民図書館
    var url_02206 = "http://natu-n.com/cgi/02206.cgi?isbn=" + ISBN10;
    var http_02206 = new JKL.ParseXML.JSON( url_02206 );
    var func_02206 = function (data) {
        var hash1 = $H( data.lib_02206 );
        var hash2 = $H( _02206 );
        var hash3 = $H( data.name_02206 );
        if (data.stock_02206 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02206[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02206);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02206);
    http_02206.async(func_02206);
    http_02206.parse();

//五戸町図書館
    var url_02442 = "http://natu-n.com/cgi/02442.cgi?isbn=" + ISBN10;
    var http_02442 = new JKL.ParseXML.JSON( url_02442 );
    var func_02442 = function (data) {
        var hash1 = $H( data.lib_02442 );
        var hash2 = $H( _02442 );
        var hash3 = $H( data.name_02442 );
        if (data.stock_02442 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02442[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02442);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02442);
    http_02442.async(func_02442);
    http_02442.parse();

//六ヶ所村民図書館
    var url_02411 = "http://natu-n.com/cgi/02411.cgi?isbn=" + ISBN10;
    var http_02411 = new JKL.ParseXML.JSON( url_02411 );
    var func_02411 = function (data) {
        var hash1 = $H( data.lib_02411 );
        var hash2 = $H( _02411 );
        var hash3 = $H( data.name_02411 );
        if (data.stock_02411 == true) {
            var marker = createMarker1(hash2["00"],hash3["00"],data.uri_02411[0],icon1);
        } else {
            var marker = createMarker2(hash2["00"],hash3["00"],icon2);
        }
        map.removeOverlay(marker_02411);
        mgr.addMarker(marker,0);
        mgr.refresh();
        };
    map.addOverlay(marker_02411);
    http_02411.async(func_02411);
    http_02411.parse();

//  書名検索館
    var url_bk1 = "http://natu-n.com/cgi/bk1.cgi?isbn=" + ISBN10;
    var http_bk1 = new JKL.ParseXML.JSON( url_bk1 );
    var func_bk1 = function (data) {
        if (data.bk1 == true) {
            var marker = createMarker1(_02381["00"], "板柳町民図書館", _02381["url1"] + data.sname + _02381["url2"], iconX);
                mgr.addMarker(marker,0);
                mgr.refresh();
        } else {
            var marker = createMarker2(_02381["00"], "板柳町民図書館", icon2);
                mgr.addMarker(marker,0);
                mgr.refresh();
        }
    };
    http_bk1.async(func_bk1);
    http_bk1.parse();

    var rss = "http://myrmecoleon.sytes.net/map/libgeo.php?area=2&isbn=" + ISBN10;
    var geoXml = new GGeoXml(rss);
    map.addOverlay(geoXml);

}

function clkTab(obj){
    $("current").removeAttribute('id');
    if (obj == "01") {
        document.getElementsByTagName("li")[0].setAttribute('id' ,'current');
        map.setCenter(new GLatLng(40.952807,140.915794), 9);
    }
}
