(function($){
    $.extend($.prototype, {gmap: function(address){
        var map = new GMap2(this[0]);
        var geocoder = new GClientGeocoder();
        geocoder.getLatLng(address, function(point){
            if (!point) return;
            map.setCenter(point, 15);
            var marker = new GMarker(point);
            map.addOverlay(marker);
        });
    }});
    $('#gmap-misato').gmap('東京都町田市小山ヶ丘1-2-9');
    $('#gmap-hanamisato').gmap('東京都町田市小山ヶ丘1-12-5');
    $('#gmap-morino').gmap('東京都町田市森野1-34-10');
    $('#navigation li').hover(function(){
        $(this).children('ul.sub-menu').slideDown();
    }, function(){
        $(this).children('ul.sub-menu').slideUp();
    });
    $('#nengou').change(function(){
        $('#year').val('(西暦 '+$(this).val()+'年)');
    });
    /*var a = function(self){
        self.anchor.attr($('div.pika-image>a'),'_blank');
    };
    $('ul.photo-gallery').PikaChoose({buildFinished:a,showCaption:false, transition:[-1]});*/
    $('ul.photo-gallery').PikaChoose({showCaption:false, transition:[-1], IESafe:true});
    $('ul.photo-gallery').jcarousel({scroll:4, initCallback: function(carousel){
        $(carousel.list).find('img').click(function() {
            carousel.scroll(parseInt($(this).parents('.jcarousel-item').attr('jcarouselindex')));
        });
    }});
    /*$('div.pika-image>a').click(function(){
        window.open($(this).attr('href'), '_blank');
        return false;
    });*/
})(jQuery);
