
(function($) {

	$(function() {
		$.story.Pagetop();
		$.story.rollover();
		$.story.LinkBlock();
	});

	//---------------------------------------------------------------------
	$.story = {
		
		//リンクブロック
		LinkBlock: function() {
			$('div.topright li a').each(function(){
			  var Href = $(this).attr('href');
			  $(this).parents("li").click(function() {
				window.open(Href,'_self');
				return false;
			  });
			});
			$('div.topright li').append('<div class="ovlay"></div>')
								.hover(function(){
									$(this).find('div.ovlay').stop().animate({width: "100%"}, 200);
								  },function(){
									$(this).find('div.ovlay').stop().animate({width: "0px"}, 200);
								  });			
		},
		
		//ページ内リンク
		Pagetop: function(){ 
			$('a[href^=#]').click(function () {
				$(this).blur();
				var href = $(this).attr("href");
				var topPx = $(href).offset().top;
				$('html,body').animate({ scrollTop: topPx }, 500, "swing");
				return false;
        	});
		},
				
		//ロールオーバー
		rollover: function() {
				var preLoad = new Object();
				$('img.rollover,input.rollover').not("[src*='_o.']").each(function(){
					var imgSrc = this.src;
					var fType = imgSrc.substring(imgSrc.lastIndexOf('.'));
					var imgName = imgSrc.substr(0, imgSrc.lastIndexOf('.'));
					var imgOver = imgName + '_o' + fType;
					preLoad[imgSrc] = new Image();
					preLoad[imgSrc].src = imgOver;
					$(this).hover(
						function (){ this.src = imgOver; },
						function (){ this.src = imgSrc; }
					);
				});
		}
		
	};
})(jQuery);