if (typeof(His) == 'undefined') {
    His = {};
}

His.common = {
    init: function(){
        //ロールオーバー
        j$('img.btn, input.btn').each(function(){
            //srcセット
            rolloverSrc = j$(this).attr('src').replace(/(\.gif|\.jpg|\.png)j$/, "_on"+"j$1");
            
            //イメージセット
            j$(this).clone().insertAfter(this)
                .attr('src',rolloverSrc)
                .css('display','none');
            
            //ロールオーバー(マウスオン時)
            j$(this).mouseover(function(){
                j$(this).hide();
                j$(this).next().show();
            });
            //ロールオーバー(マウスアウト時)
            j$(this).next().mouseout(function(){
                j$(this).hide();
                j$(this).prev().show();
            });
        });
    
        //サーチエリア
        j$('#imgBtnSearch').hover(
            function(){
                j$('#imgBtnSearch').css('background-position','-643px -21px');
            },
            function(){
                j$('#imgBtnSearch').css('background-position','-643px 0px');
            }
        );
        j$('#searchArea').hover(
            function(){j$('#selectBox').show();},
            function(){j$('#selectBox').hide();}
        );
    
    
        //地域変更
        j$('#changeArea>img.btn, #changeArea .list').hover(
            function(){
                j$('#changeArea .list').show();
                j$('#changeArea>img.btn').attr('src','/kanri/img/navigation_area/global_navi/change_area_map/btn_change_area_on.png');
                if (typeof document.documentElement.style.maxHeight != "undefined") {
                    //IE7以上、Firefox, Opera, Chrome等
                    //何もしない
                } else {
                    //IE6
                    j$('#searchOverseas select').css('visibility','hidden');
                }
            },
            function(){
                j$('#changeArea .list').hide();
                j$('#changeArea>img.btn').attr('src','/kanri/img/navigation_area/global_navi/change_area_map/btn_change_area.png');
                if (typeof document.documentElement.style.maxHeight != "undefined") {
                    //IE7以上、Firefox, Opera, Chrome等
                    //何もしない
                } else {
                    //IE6
                    j$('#searchOverseas select').css('visibility','visible');
                }
            }
        );
    
        //海外ホテル・オプショナルツアー
        j$('#hotelOption #imgTab10, #hotelOption table').hover(
            function(){
                j$('#hotelOption table').show();
                j$('#hotelOption img#imgTab10').css('background-position','-596px -146px');
                if (typeof document.documentElement.style.maxHeight != "undefined") {
                    //IE7以上、Firefox, Opera, Chrome等
                    //何もしない
                } else {
                    //IE6
                    j$('#searchOverseas select').css('visibility','hidden');
                }
            },
            function(){
                j$('#hotelOption table').hide();
                j$('#hotelOption img#imgTab10').css('background-position','-596px -112px');
                if (typeof document.documentElement.style.maxHeight != "undefined") {
                    //IE7以上、Firefox, Opera, Chrome等
                    //何もしない
                } else {
                    //IE6
                    j$('#searchOverseas select').css('visibility','visible');
                }
            }
        );
        
        //旅の情報
        j$('#tourInfo #imgTab11, #tourInfo table').hover(
            function(){
                j$('#tourInfo table').show();
                j$('#tourInfo img#imgTab11').css('background-position','-596px -216px');
                if (typeof document.documentElement.style.maxHeight != "undefined") {
                    //IE7以上、Firefox, Opera, Chrome等
                    //何もしない
                } else {
                    //IE6
                    j$('#searchOverseas select').css('visibility','hidden');
                }
            },
            function(){
                j$('#tourInfo table').hide();
                j$('#tourInfo img#imgTab11').css('background-position','-596px -182px');
                if (typeof document.documentElement.style.maxHeight != "undefined") {
                    //IE7以上、Firefox, Opera, Chrome等
                    //何もしない
                } else {
                    //IE6
                    j$('#searchOverseas select').css('visibility','visible');
                }
            }
        );
    },
    
    //ニュースティッカー
    newsTicker: function(URL){
        j$.ajax({
            url : URL, //外部ファイルを指定
            success : function(data)
            {
                j$('div.tickerList').html(data);
                
                var dispNum = 0;
                j$('#headLine ul, #headLine ul li').hide();
                dispList();
                function dispList() {
                    j$('#headLine span').fadeOut(
                        700,
                        function(){
                            var liNum = j$("#headLine ul li").size();
                            if(dispNum > (liNum-1)) {
                                dispNum = 0;
                            }
                            j$(this).html(j$("#headLine ul li:eq("+dispNum+")").html()).fadeIn(700);
                            dispNum++;
                            if(1 <  liNum) {
                                setTimeout(dispList,7000);
                            }
                        }
                    );
                }
            }
        });
    }
};

j$(document).ready(function(){
    His.common.init();
});

