/*--------------------------------------
file Name:
URI: 
Description: project WT
Version: 1.0
Original: 2010.11.00
Modifier: 
Author: 
Author URI: 
--------------------------------------*/

$(function(){
	//ロールオーバー時の画像切り替え
	rollover('.rollover', '_ov','_ac');
	//ページ内リンクスクロール
	page_top_scroll();
});

/***************************************
	rollover
***************************************/
function rollover(target, hover, active, focus) {
	$(target).each(function() {
		var isActive = active && new RegExp(active + '(\.gif|\.jpg|\.png)([\?].*|$)').test(this.src);
		if (isActive && !focus) return;
		this.src.match('(\.gif|\.jpg|\.png)([\?].*|$)');
		var ext = RegExp.$1;
		var search = (isActive && focus) ? active + ext : ext;
		var replace = (isActive && focus) ? focus + ext : hover + ext;
		var out = this.src;
		var over = this.src.replace(search, replace);

		new Image().src = over;

		$(this).bind('mouseout', function() {
			this.src = out;
		}).bind('mouseover', function() {
			this.src = over;
		});
	});
}
/***************************************
	page_top_scroll
***************************************/
function page_top_scroll(){
    $('a[href^=#]').click(function() { 
      var href= this.hash; 
      var $target = $(href == '#_top' ? 'body' : href); 
      if($target.size()) { 
        //  jQuery のみの場合 
        //var top = $target.offset().top; 
        //$($.browser.safari ? 'body' : 'html') 
        //  .animate({scrollTop:top}, 300, 'swing'); 
        //  jQuery ScrollToプラグインを使う場合 
        $.scrollTo($target, 300, {easing:'swing'}); 
      } 
      return false; 
    }); 
}


