var Jalan = {
    title: "宿泊施設",
    APIName: "じゃらん",
    icon: null,
    credit: "<img src='/js/mashmap/images/jalan_s.gif' />",
    url: "http://jws.jalan.net/",
    marker: { image: "/js/mashmap/icons/stay.png", width: 30, height: 25 },
    key: "",
    LV: 15,
    Keywords: ["温泉", "旅館", "ホテル", "ビジネスホテル", "モーテル", "宿泊施設", "泊まる", "宿泊"],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var p = m.getCenter();
        p = world2jp(p.lng(), p.lat())
        crossdomain.request("http://jws.jalan.net/APIAdvance/HotelSearch/V1/?key=" + Jalan.key + '&x=' + Angle2Msec(p.lng) + '&y=' + Angle2Msec(p.lat) + '&range=1', Jalan.CallbackArea);
    },
    Search: function(a, p) {
        var u = "http://jws.jalan.net/APIAdvance/HotelSearch/V1/?key=" + Jalan.key;
        if (p) {
            p = world2jp(p.lng(), p.lat())
            if (Jalan.Keywords.contains(a)) {
                u += '&x=' + Angle2Msec(p.lng) + '&y=' + Angle2Msec(p.lat) + '&range=3&count=100';
            } else {
                u += '&x=' + Angle2Msec(p.lng) + '&y=' + Angle2Msec(p.lat) + "&range=3&count=100&h_name=" + encodeURIComponent(a);
            }
        } else {
            u += "&count=5&h_name=" + encodeURIComponent(a);
        }
        crossdomain.request(u, Jalan.Callback)
    },
    CallbackArea: function(f, r) {
        Jalan.FechData(r, MashMaps);
    },
    Callback: function(f, r) {
        Jalan.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        //try{
        var w = r.xml.Hotel;
        if (w.length && w.length > 0) {
            for (var i = 0; i < w.length; i++) f(w[i]);
        } else if (w) f(w);
        function f(a) {
            var p = jp2world(Msec2Angle(a.X), Msec2Angle(a.Y));
            o.AddItem({
                id: a.HotelID,
                name: strip_tags(a.HotelName),
                adr: strip_tags(a.HotelAddress),
                url: strip_tags(a.HotelDetailURL),
                img: strip_tags(a.PictureURL),
                desc: strip_tags(a.HotelCaption),
                pos: new GLatLng(p.lat, p.lng)
            },
		                Jalan);
        }
        //}catch(e){}  
    }
}

var HotPepper = {
    title: "飲食店",
    APIName: "ホットペッパー",
    icon: null,
    credit: "<img src='/js/mashmap/images/hotpepper_s.gif' />",
    url: "http://webservice.recruit.co.jp/",
    marker: { image: "/js/mashmap/icons/eat.png", width: 24, height: 25 },
    key: "",
    LV: 15,
    Keywords: ["食べる", "お食事処", "飲食店"],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getCenter();
        jsonp("http://webservice.recruit.co.jp/hotpepper/gourmet/v1/?key=" + HotPepper.key + '&lat=' + c.lat() + '&lng=' + c.lng() + '&range=3&type=lite&format=jsonp&callback=HotPepper.CallbackArea', 'HotPepperSearchAreaid');
    },
    Search: function(a, p) {
        var u = "http://webservice.recruit.co.jp/hotpepper/gourmet/v1/?key=" + HotPepper.key + "&type=lite&format=jsonp&callback=HotPepper.Callback";
        if (p) {
            if (HotPepper.Keywords.contains(a)) {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + '&range=5&count=100';
            } else {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + "&range=5&count=100&keyword=" + encodeURIComponent(a);
            }
        } else {
            u += "&count=5&keyword=" + encodeURIComponent(a);
        }
        jsonp(u, 'HotPepperSearchid')
    },
    CallbackArea: function(r) {
        HotPepper.FechData(r, MashMaps);
    },
    Callback: function(r) {
        HotPepper.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        //try{
        var w = r.results.shop;
        if (w.length > 0) {
            for (var i = 0; i < w.length; i++) {
                var a = w[i];
                o.AddItem({
                    id: a.id,
                    name: strip_tags(a.name),
                    adr: strip_tags(a.address),
                    url: strip_tags(a.urls.pc),
                    img: strip_tags(a.photo.pc.m),
                    desc: strip_tags(a['catch']) + "<br />" + strip_tags(a.access),
                    pos: new GLatLng(a.lat, a.lng)
                },
			                HotPepper);

            }
        }
        //}catch(e){}  
    }
}


var HotPepperBeauty = {
    title: "サロン",
    APIName: "ホットペッパーBeauty",
    icon: null,
    credit: "<img src='/js/mashmap/images/beauty_s.gif' />",
    url: "http://webservice.recruit.co.jp/",
    marker: { image: "/js/mashmap/icons/beauty.png", width: 25, height: 26 },
    key: "",
    LV: 15,
    Keywords: ["サロン", "ヘアサロン", "美容院", "美容室", "床屋"],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getCenter();
        jsonp("http://webservice.recruit.co.jp/beauty/salon/v1/?key=" + HotPepperBeauty.key + '&lat=' + c.lat() + '&lng=' + c.lng() + '&range=3&format=jsonp&callback=HotPepperBeauty.CallbackArea', 'HotPepperBeautySearchAreaid');
    },
    Search: function(a, p) {
        var u = "http://webservice.recruit.co.jp/beauty/salon/v1/?key=" + HotPepperBeauty.key + "&format=jsonp&callback=HotPepperBeauty.Callback";
        if (p) {
            if (HotPepperBeauty.Keywords.contains(a)) {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + '&range=5&count=100';
            } else {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + "&range=5&count=100&keyword=" + encodeURIComponent(a);
            }
        } else {
            u += "&count=5&keyword=" + encodeURIComponent(a);
        }
        jsonp(u, 'HotPepperBeautySearchid');
    },
    CallbackArea: function(r) {
        HotPepperBeauty.FechData(r, MashMaps);
    },
    Callback: function(r) {
        HotPepperBeauty.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        //try{
        var w = r.results.salon;
        if (w.length > 0) {
            for (var i = 0; i < w.length; i++) {
                var a = w[i];
                o.AddItem({
                    id: a.id,
                    name: strip_tags(a.name),
                    adr: strip_tags(a.address),
                    url: strip_tags(a.urls.pc),
                    img: strip_tags(a.main.photo.m),
                    desc: strip_tags(a.catch_copy) + "<br />" + strip_tags(a.kodawari),
                    pos: new GLatLng(a.lat, a.lng)
                },
			                HotPepperBeauty);

            }
        }
        //}catch(e){}  
    }
}




var SchoolSearch = {
    title: "学校",
    APIName: "リクルート進学ネット",
    icon: null,
    credit: "<img src='/js/mashmap/images/shingaku_s.gif' />",
    url: "http://webservice.recruit.co.jp/",
    marker: { image: "/js/mashmap/icons/school.png", width: 25, height: 25 },
    key: "",
    LV: 15,
    Keywords: ["学校", "スクール", "学ぶ"],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getCenter();
        jsonp("http://webservice.recruit.co.jp/shingaku/school/v1/?key=" + SchoolSearch.key + '&lat=' + c.lat() + '&lng=' + c.lng() + '&range=3&format=jsonp&callback=SchoolSearch.CallbackArea', 'SchoolSearchAreaid');
    },
    Search: function(a, p) {
        var u = "http://webservice.recruit.co.jp/shingaku/school/v1/?key=" + SchoolSearch.key + "&format=jsonp&callback=SchoolSearch.Callback";
        if (p) {
            if (SchoolSearch.Keywords.contains(a)) {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + '&range=5&count=100';
            } else {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + "&range=5&count=100&keyword=" + encodeURIComponent(a);
            }
        } else {
            u += "&count=5&keyword=" + encodeURIComponent(a);
        }
        jsonp(u, 'SchoolSearchid');
    },
    CallbackArea: function(r) {
        SchoolSearch.FechData(r, MashMaps);
    },
    Callback: function(r) {
        SchoolSearch.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        //try{
        var w = r.results.school;
        var t, i, s;
        if (w.length > 0) {
            for (i = 0; i < w.length; i++) {
                var a = w[i];
                s = "";
                if (a.faculty.length > 0) for (t = 0; t < a.faculty.length; t++) s += a.faculty[t].name + "/";
                if (a.campus.length > 0) {
                    for (t = 0; t < a.campus.length; t++) {
                        var c = a.campus[t];
                        o.AddItem({
                            id: a.code + t,
                            name: strip_tags(a.name + (c.name ? " - " + c.name : "")),
                            adr: strip_tags(c.address),
                            url: strip_tags(a.urls.pc),
                            img: "",
                            desc: "<b>" + strip_tags(a.category.name) + "</b><br />" + strip_tags(s) + "<br />" + strip_tags(c.address),
                            pos: new GLatLng(c.latitude, c.longitude)
                        },
			                        SchoolSearch);
                    }
                }
            }
        }
        //}catch(e){}  
    }
}


var GoGoGs = {
    title: "ガソリンスタンド",
    APIName: "gogo.gs",
    icon: null,
    credit: "<img src='/js/mashmap/images/gogogs_s.gif' />",
    url: "http://api.gogo.gs/",
    marker: { image: "/js/mashmap/icons/gogogs.png", width: 27, height: 28 },
    key: "",
    LV: 15,
    Keywords: ["ガソリンスタンド"],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getBounds();
        var s = c.getSouthWest();
        var n = c.getNorthEast();
        crossdomain.request("http://api.gogo.gs/v1.1/?apid=" + GoGoGs.key + '&miny=' + mround(s.lat()) + '&maxy=' + mround(n.lat()) + '&minx=' + mround(s.lng()) + '&maxx=' + mround(n.lng()) + '&num=10', GoGoGs.CallbackArea);
    },
    Search: function(a, p) {

    },
    CallbackArea: function(f, r) {
        GoGoGs.FechData(r, MashMaps);
    },
    Callback: function(f, r) {
        GoGoGs.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        //        try{
        var w = r.xml.Item;
        if (w.length > 0) {
            for (var i = 0; i < w.length; i++) f(w[i]);
        } else if (w) f(w);
        function f(a) {
            o.AddItem({
                id: strip_tags(a.ShopCode),
                name: strip_tags(a.Brand + " - " + a.ShopName),
                adr: strip_tags(a.Address),
                url: "http://gogo.gs/shop/" + strip_tags(a.ShopCode) + ".html",
                img: a.Photo > 0 ? "http://gogo.gs/images/rally/" + strip_tags(a.ShopCode) + "-" + strip_tags(a.Photo) + ".jpg " : "",
                desc: "レギュラー価格： " + strip_tags(a.Price) + " 円" + (a.Rtc == "24H" ? "<br />24時間営業" : "") + (a.Self == "SELF" ? "<br />セルフ給油" : "") + "<br />" + strip_tags(a.Address),
                pos: new GLatLng(a.Latitude, a.Longitude)
            },
			                GoGoGs);
        }
        //        }catch(e){}  
    }
}

var GGeocoder = {
    title: "グーグルジオコーダー",
    APIName: "Google",
    icon: null,
    credit: "<img src='/js/mashmap/images/googlemap_s.gif' />",
    url: "http://code.google.com/apis/maps/",
    marker: { image: "/js/mashmap/icons/web.png", width: 25, height: 25 },
    key: "",
    LV: 15,
    Keywords: false,
    Query: "",
    Geocoder: null,
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
        this.Geocoder = new GClientGeocoder();
    },
    SearchArea: function(m) {

    },
    Search: function(a) {
        GGeocoder.Query = a;
        GGeocoder.Geocoder.getLocations(a, GGeocoder.Callback);
    },
    CallbackArea: function(r) {
        GGeocoder.FechData(r, MashMaps);
    },
    Callback: function(r) {
        GGeocoder.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        // try{
        if (!r || r.Status.code != 200) return;
        var w = r.Placemark;
        var l = w.length > 5 ? 5 : w.length;
        for (var i = 0; i < l; i++) {
            var a = w[i];
            o.AddItem({
                id: "",
                name: strip_tags(GGeocoder.Query),
                adr: strip_tags(a.address),
                url: "",
                img: "",
                desc: strip_tags(a.address),
                pos: new GLatLng(a.Point.coordinates[1], a.Point.coordinates[0])
            },
		                GGeocoder);
        }
        // }catch(e){}  
    }
}



var LocoSticker = {
    title: "コンテンツ検索",
    APIName: "LocoSticker",
    icon: null,
    credit: "<img src='/js/mashmap/images/locosticker_s.gif' />",
    url: "http://okilab.jp/project/location/",
    marker: { image: "/js/mashmap/icons/web.png", width: 25, height: 25 },
    key: "",
    LV: 15,
    Keywords: false,
    Query: "",
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getBounds();
        var s = c.getSouthWest();
        var n = c.getNorthEast();

        jsonp("http://api.locosticker.jp/v1/search_contents/?box=" + mround(s.lng()) + ',' + mround(s.lat()) + ',' + mround(n.lng()) + ',' + mround(n.lat()) + '&type=a&limit=10&callback=LocoStickerArea_callback', 'LocoStickerAreaid');
    },
    Search: function(a) {
        LocoSticker.Query = a;
        jsonp("http://api.locosticker.jp/v1/geocode/?text=" + encodeURIComponent(a) + "&limit=5&callback=LocoSticker_callback", "LocoStickerid");
    },
    CallbackArea: function(r) {
        LocoSticker.FechDataArea(r, MashMaps);
    },
    Callback: function(r) {
        LocoSticker.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        //try{
        var w = r.results;
        if (w.length > 0) {
            for (var i = 0; i < w.length; i++) {
                var a = w[i];
                o.AddItem({
                    id: "",
                    name: strip_tags(LocoSticker.Query),
                    adr: strip_tags(a.info),
                    url: "",
                    img: "",
                    desc: strip_tags(a.info),
                    pos: new GLatLng(a.lat, a.lng)
                },
	                        LocoSticker);
            }
        }
        //}catch(e){}  
    },
    FechDataArea: function(r, o) {
        //try{
        var w = r.results;
        if (w.length > 0) {
            for (var i = 0; i < w.length; i++) {
                var a = w[i];
                if (a) {
                    o.AddItem({
                        id: a.id,
                        name: strip_tags(a.expression),
                        adr: "",
                        url: a.uri,
                        img: "",
                        desc: (a.title ? strip_tags(a.title) : "") + (isURL(a.uri) ? "<br /><a href='" + a.uri + "' target='_blank'>このホームページへ</a>" : "") + "<br />登録：" + a.timestamp,
                        pos: new GLatLng(a.lat, a.lng)
                    },
	                            LocoSticker);
                }
            }
        }
        //}catch(e){}  
    }
}
function LocoStickerArea_callback(r) { LocoSticker.CallbackArea(r); }
function LocoSticker_callback(r) { LocoSticker.Callback(r); }



var BarNavi = {
    title: "バー",
    APIName: "Bar-Navi",
    icon: null,
    credit: "<img src='/js/mashmap/images/barnavi.gif' />",
    url: "http://webapi.suntory.co.jp/barnavidocs/",
    marker: { image: "/js/mashmap/icons/drink.png", width: 24, height: 25 },
    key: "",
    LV: 15,
    Keywords: ["バー", "居酒屋", "飲む", "お酒"],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getCenter();
        jsonp("http://webapi.suntory.co.jp/barnavi/v2/shops?key=" + BarNavi.key + '&pattern=1&datum=world&lat=' + c.lat() + '&lng=' + c.lng() + '&range=1000&count=10&format=jsonp&callback=BarNavi.CallbackArea&url=' + location.href, 'BarNaviSearchAreaid');
    },
    Search: function(a, p) {
        var u = "http://webapi.suntory.co.jp/barnavi/v2/shops?key=" + BarNavi.key + "&pattern=1&format=jsonp&callback=BarNavi.Callback&url=" + location.href;
        if (p) {
            if (BarNavi.Keywords.contains(a)) {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + '&range=1000&count=100&datum=world';
            } else {
                u += '&lat=' + p.lat() + '&lng=' + p.lng() + "&range=1000&count=100&datum=world&name=" + encodeURIComponent(a);
            }
            jsonp(u, 'BarNaviSearchid');
        }

    },
    CallbackArea: function(r) {
        BarNavi.FechData(r, MashMaps);
    },
    Callback: function(r) {
        BarNavi.FechData(r, MashSearch);
    },
    FechData: function(r, o) {
        //try{
        var w = r.shops.shop;
        if (w.length > 0) {
            for (var i = 0; i < w.length; i++) {
                var a = w[i];
                o.AddItem({
                    id: a.id,
                    name: strip_tags(a.name),
                    adr: strip_tags(a.address),
                    url: strip_tags(a.url_pc),
                    img: strip_tags(a.url_photo_s1),
                    desc: strip_tags(a.address) + " / " + strip_tags(a.access) + " / 予算：" + strip_tags(a.budget) + " / 定休日：" + strip_tags(a.close) + " / 営業時間：" + strip_tags(a.open),
                    pos: new GLatLng(a.lat_world, a.lng_world)
                },
			                BarNavi);

            }
        }
        //}catch(e){}  
    }
}




var RakutenTravel = {
    title: "宿泊施設",
    APIName: "楽天ウェブサービス",
    icon: null,
    credit: "<img src='/js/mashmap/images/rakuten.gif' />",
    url: "http://webservice.rakuten.co.jp/",
    marker: { image: "/js/mashmap/icons/stay.png", width: 30, height: 25 },
    key: "",
    LV: 15,
    Keywords: ["温泉", "旅館", "ホテル", "ビジネスホテル", "モーテル", "宿泊施設", "泊まる", "宿泊"],
    affid: '089edc74.ea0edc5d.089edc75.d2dce90d',
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getCenter();
        jsonp("http://api.rakuten.co.jp/rws/1.11/json?operation=SimpleHotelSearch&developerId=" + RakutenTravel.key + '&affiliateId=' + RakutenTravel.affid + '&version=2007-11-21&datumType=1' + '&latitude=' + c.lat() + '&longitude=' + c.lng() + '&searchRadius=1&hits=10&callBack=RakutenTravel.CallbackArea', 'RakutenTravelAreaid');
    },
    CallbackArea: function(r) {
        RakutenTravel.FechData(r, MashMaps);
    },
    FechData: function(r, o) {
        //try{
        if (!r.Body.SimpleHotelSearch) return;
        var w = r.Body.SimpleHotelSearch.hotel;
        var t, i, s;
        if (w.length > 0) {
            if (w.length > 0) {
                for ( i = 0; i < w.length; i++) {
                    var a = w[i];
                    o.AddItem({
                        id: a.hotelNo,
                        name: strip_tags(a.hotelName),
                        adr: strip_tags(a.address),
                        url: strip_tags(a.hotelAffiliateUrl),
                        img: strip_tags(a.hotelImageUrl),
                        desc: strip_tags(a.hotelSpecial) + "<br />" + strip_tags(a.access),
                        pos: new GLatLng(a.latitude, a.longitude)
                    },
			                RakutenTravel);

                }
            }
        }
        //}catch(e){}  
    }
}



var TabeLog = {
    title: "飲食店",
    APIName: "食べログ.com",
    icon: null,
    credit: "<img src='/js/mashmap/images/tabelog_s.gif' />",
    url: "http://apiblog.kakaku.com/",
    marker: { image: "/js/mashmap/icons/eat.png", width: 24, height: 25 },
    key: "",
    LV: 15,
    Keywords: ["食べる", "お食事処", "飲食店"],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getCenter();
        crossdomain.request("http://api.tabelog.com/Ver1/RestaurantSearch/?Latitude=" + c.lat() + '&Longitude=' + c.lng() + '&Datum=world&SearchRange=small&ResultSet=large&SortOrder=totalscore&PageNum=1', TabeLog.CallbackArea);
    },
    CallbackArea: function(f, r) {
        TabeLog.FechData(r, MashMaps);
    },
    FechData: function(r, o) {
        //try{
        var w = r.xml.Item;
        if (w.length > 0) {
            for (var i = 0; i < w.length; i++) f(w[i]);
        } else if (w) f(w);
        function f(a) {
            o.AddItem({
                id: a.Tel,
                name: strip_tags(a.RestaurantName),
                adr: strip_tags(a.Address),
                url: strip_tags(a.TabelogUrl),
                img: "",
                desc: strip_tags(a.Category) + "<br />" + strip_tags(a.Situation) + "<br />ディナー価格：" + strip_tags(a.DinnerPrice) + " / ランチ価格：" + strip_tags(a.LunchPrice) + " / 営業時間：" + strip_tags(a.BusinessHours + " / 定休日：" + strip_tags(a.Holiday)),
                pos: new GLatLng(a.Latitude, a.Longitude)
            },
		                    TabeLog);
        }
        //}catch(e){}  
    }
}

var Flickr = {
    title: "Photo",
    APIName: "Flickr",
    icon: null,
    credit: "<img src='/js/mashmap/images/flickr.gif' />",
    url: "http://www.flickr.com/services/api/",
    marker: { image: "/js/mashmap/icons/camera.png", width: 27, height: 21 },
    key: "",
    LV: 15,
    Keywords: [],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getBounds();
        var s = c.getSouthWest();
        var n = c.getNorthEast();
        jsonp("http://api.flickr.com/services/rest/?api_key=" + Flickr.key + '&method=flickr.photos.search&bbox=' + (parseFloat(s.lng())).toFixed(2) + ',' + (parseFloat(s.lat())).toFixed(2) + ',' + (parseFloat(n.lng())).toFixed(2) + ',' + (parseFloat(n.lat())).toFixed(2) + '&extras=geo,owner_name,date_taken&format=json&jsoncallback=Flickr.CallbackArea&per_page=10&max_taken_date=' + DateToStr(new Date), 'FlickrAreaid');
    },
    CallbackArea: function(r) {
        Flickr.FechData(r, MashMaps);
    },
    FechData: function(r, o) {
        //try{
        if (!r.photos) return;
        var w = r.photos.photo;
        var t, i, s;
        if (w.length > 0) {
            if (w.length > 0) {
                for (i = 0; i < w.length; i++) {
                    var a = w[i];
                    o.AddItem({
                        id: a.id,
                        name: strip_tags(a.title),
                        adr: "",
                        url: strip_tags("http://www.flickr.com/photos/" + a.owner + "/" + a.id),
                        img: strip_tags("http://farm" + a.farm + ".static.flickr.com/" + a.server + "/" + a.id + "_" + a.secret + "_m.jpg"),
                        desc: Lang.T.Date + ":" + strip_tags(a.datetaken) + "<br / >" + Lang.T.Owner + ":" + strip_tags(a.ownername) + "<br / >" + strip_tags(a.title),
                        pos: new GLatLng(a.latitude, a.longitude)
                    },
                    Flickr);
                }
            }
        }
        //}catch(e){}  
    }
}


var Panoramio = {
    title: "Photo",
    APIName: "Panoramio",
    icon: null,
    credit: "<img src='/js/mashmap/images/panoramio.gif' />",
    url: "http://www.panoramio.com/api/",
    marker: { image: "/js/mashmap/icons/camera.png", width: 27, height: 21 },
    key: "",
    LV: 15,
    Keywords: [],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getBounds();
        var s = c.getSouthWest();
        var n = c.getNorthEast();
        jsonp("http://www.panoramio.com/map/get_panoramas.php?from=0&to=10&size=small&minx=" + (parseFloat(s.lng())).toFixed(6) + '&miny=' + (parseFloat(s.lat())).toFixed(6) + '&maxx=' + (parseFloat(n.lng())).toFixed(6) + '&maxy=' + (parseFloat(n.lat())).toFixed(6) + '&callback=Panoramio.CallbackArea', 'PanoramioAreaid');
    },
    CallbackArea: function(r) {
        Panoramio.FechData(r, MashMaps);
    },
    FechData: function(r, o) {
        //try{
        if (!r.photos) return;
        var w = r.photos;
        var t, i, s;
        if (w.length > 0) {
            if (w.length > 0) {
                for (i = 0; i < w.length; i++) {
                    var a = w[i];
                    o.AddItem({
                        id: a.photo_id,
                        name: strip_tags(a.photo_title),
                        adr: "",
                        url: strip_tags(a.photo_url),
                        img: strip_tags(a.photo_file_url),
                        desc: Lang.T.Date + ":" + strip_tags(a.upload_date) + "<br / >" + Lang.T.Owner + ":" + strip_tags(a.owner_name) + "<br / >" + strip_tags(a.photo_title),
                        pos: new GLatLng(a.latitude, a.longitude)
                    },
                    Panoramio);

                }
            }
        }
        //}catch(e){}  
    }
}


var Zooomr = {
    title: "Photo",
    APIName: "Zooomr",
    icon: null,
    credit: "<img src='/js/mashmap/images/zooomr.gif' />",
    url: "http://trac.zooomr.com/trac/wiki/ja/ZooomrAPI",
    marker: { image: "/js/mashmap/icons/camera.png", width: 27, height: 21 },
    key: "",
    LV: 15,
    Keywords: [],
    load: function(k) {
        if (this.icon == null && this.marker) this.icon = MashMaps.MakeIcon(this.marker);
        this.LV = k.LV;
        this.key = k.key;
    },
    SearchArea: function(m) {
        var c = m.getBounds();
        var s = c.getSouthWest();
        var n = c.getNorthEast();
        jsonp("http://api.zooomr.com/services/rest/?api_key=" + Zooomr.key + '&method=zooomr.photos.search&bbox=' + (parseFloat(s.lng())).toFixed(2) + ',' + (parseFloat(s.lat())).toFixed(2) + ',' + (parseFloat(n.lng())).toFixed(2) + ',' + (parseFloat(n.lat())).toFixed(2) + '&extras=geo,owner_name,date_taken&format=json&jsoncallback=Zooomr.CallbackArea&per_page=10&query=all&max_taken_date=' + DateToStr(new Date), 'ZooomrAreaid');
    },
    CallbackArea: function(r) {
        Zooomr.FechData(r, MashMaps);
    },
    FechData: function(r, o) {
        //try{
        if (!r.photos) return;
        var w = r.photos.photo;
        var t, i, s;
        if (w.length > 0) {
            if (w.length > 0) {
                for ( i = 0; i < w.length; i++) {
                    var a = w[i];
                    o.AddItem({
                        id: a.id,
                        name: strip_tags(a.title),
                        adr: "",
                        url: strip_tags("http://www.zooomr.com/photos/" + a.owner + "/" + a.id),
                        img: strip_tags("http://static.zooomr.com/images/" + a.id + "_" + a.secret + "_m.jpg"),
                        desc: Lang.T.Date + ":" + strip_tags(a.datetaken) + "<br / >" + Lang.T.Owner + ":" + strip_tags(a.ownername) + "<br / >" + strip_tags(a.title),
                        pos: new GLatLng(a.latitude, a.longitude)
                    },
                    Zooomr);
                }
            }
        }
        //}catch(e){}  
    }
}
