/*　ロールオーバー　*/

var preLoadImg = new Object();
function initRollOvers(){
$("img.rollover").each(function(){
var imgSrc = this.src;
var sep = imgSrc.lastIndexOf('.');
var onSrc = imgSrc.substr(0, sep) + '_on' + imgSrc.substr(sep, 4);
preLoadImg[imgSrc] = new Image();
preLoadImg[imgSrc].src = onSrc;
$(this).hover(
function() { this.src = onSrc; },
function() { this.src = imgSrc; }
);
});
}
$(function(){
initRollOvers();
});


/*　地図ロールオーバー　*/
$(function(){
    $.fn.extend({
        mapRollOver: function(){
            var self = this;
            var map = $('map', this);
            var image = $('img[usemap="#' + map.attr('name') + '"]');
            $(this)
                .css('position', 'relative')
                .find('area').mouseover(function(){
                    $('.over').remove();
                    var coords = $(this).attr('coords').split(',');
                    var overSrc = image.attr('src').replace(/(\.gif|\.jpg|\.png)$/, "_over"+"$1");
                    var overHref = $(this).attr('href');
                    $('<a />')
                        .css({
                            display: 'block',
                            position: 'absolute',
                            left: coords[0] + 'px',
                            top:   coords[1] + 'px',
                            width: (coords[2] - 0 - coords[0]) + 'px',
                            height: (coords[3] - 0 - coords[1]) + 'px',
                            background: 'url(' + overSrc + ') no-repeat -' +  coords[0] + 'px -' +  coords[1] + 'px'
                        })
                        .attr('href', overHref)
                        .addClass('over')
                        .mouseout(function(){
                            $(this).remove();
                        })
                        .appendTo(self);
                });
        }
    });
 
    $('#RolloverMap').mapRollOver();
});

/*　アコーディオン　*/
$(function(){
     $(".open").click(function(){
      $("#slideBox").slideToggle("slow");
     });
});


/*　リンクボックス　
$(function(){
     $("#linkbox").click(function(){
         window.location=$(this).find("a").attr("href");
         return false;
    });
});
*/


/*　アイコン部分マウスオーバー　*/
$('ul#third a').imgPreview({
    containerID: 'imgPreviewWithStyles',
    imgCSS: {
        height: 200
    },
    onShow: function(link){
        $(link).stop().animate({opacity:0.4});
        $('img', this).css({opacity:0});
    },
    onLoad: function(){
        $(this).animate({opacity:1}, 300);
    },
    onHide: function(link){
        $(link).stop().animate({opacity:1});
    }
});
