/**---------------------------------
 * common.js
 ---------------------------------*/

//
//スムーズスクロール
//

$(document).ready(function(){
$('a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
	var $target = $(this.hash);
	$target = $target.length && $target
	|| $('[name=' + this.hash.slice(1) +']');
	if ($target.length) {
			var targetOffset = $target.offset().top;
			$('html,body')
			.animate({scrollTop: targetOffset}, 1000, 'easeOutExpo');
		return false;
	}
}
});
});


//
//ロールオーバー
//
;(function($){
	$(document).ready(function(){
		$("a img[src*='_ov']").addClass("current");
		
		$("a img[class!='current'],:image").mouseover(function(){
			if ($(this).attr("src").match(/_ot./)){
				$(this).attr("src",$(this).attr("src").replace("_ot.", "_ov."));
				return;
			}
		}).mouseout(function(){
			if ($(this).attr("src").match(/_ov./)){
				$(this).attr("src",$(this).attr("src").replace("_ov.", "_ot."));
				return;
			}
		}).click(function(){
			if ($(this).attr("src").match(/_ov./)){
				$(this).attr("src",$(this).attr("src").replace("_ov.", "_ot."));
				return;
			}
		});

		
		//preload images
		var images = [];
		$("a img,:image").each(function(index){
				if($(this).attr("src").match(/_ot./)){
					 images[index]= new Image();
					 images[index].src = $(this).attr("src").replace("_ov.", "_ot.");
				}
		});
		
	});
})(jQuery);


