
//jQueryでロールオーバー！プリロード対応版
//
//用意：例）images.jpgとimages_on.jpgという2種の画像を用意
//方法：イメージタグにclass="rollover"を挿入する

$(function(){
    $("img.rollover").mouseover(function(){
        $(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"))
    }).mouseout(function(){
        $(this).attr("src",$(this).attr("src").replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"));
    }).each(function(){
        $("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"))
    })
})


/*--------------------------------------------------------------------------*
 *  Smooth Scroll
 *--------------------------------------------------------------------------*/

$(function(){ 
	$('a[href^=#]:not(a[href$=#]),area[href^=#]:not(area[href$=#])').click(function(){
		var href= this.hash;
		var $target = $(href == '#_top' ? 'body' : href);
		
		// アンカーリンクがあるページでだけ以下を実行
		if($target.size()){
			var top = $target.offset().top;
			$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 600, 'swing');
		}
		return false;
	});
});


/*--------------------------------------------------------------------------*
 *  Hover Light
 *--------------------------------------------------------------------------*/

$(function() {
 $('.hoverLight').hover(function(){
  $(this).animate({'opacity': '0.7'}, 200);
 }, function(){
  $(this).animate({'opacity': '1'}, 200);
 }).click(function(){
  $(this).animate({'opacity': '1'}, 200);
 });
});


/*--------------------------------------------------------------------------*
 *  Drop Down
 *--------------------------------------------------------------------------*/
 
$(function(){

	
	//該当ページでアクティブ状態
	//location_url = location.href;
	location_url = window.location.pathname.replace(/index\.html|index\.htm|index\.php/g, '');

	location_url_split = location_url.split("/");
	//alert(location_url);
	//alert(location_url_split[2]);
	//アクティブページ URL判別で画像を非表示に
	$('#gnavi > ul > li > a').each(function(){
	if($(this).attr('href') == '/' + location_url_split[1] + '/'){
		$(this).find('img').css('visibility', 'hidden');
	}else
	//トップページのみ以下のように書いてURL判別
	if(location_url_split[1] == '' && $(this).attr('href') == '/'){
		//$(this).find('img').css('visibility', 'hidden');
	}
	});
});

