// JavaScript Document

var root = location.protocol + '//' + location.hostname;
var path = root + location.pathname;

function imgHover(){
		var conf = {
			selector: '.imgover',
			attachStr: '_on',
			fadeTime: 400
		};

		var targetImgs = $(conf.selector).not('[src*=' + conf.attachStr + '.]');
		targetImgs.each(function(){
			this.rollOverImg = new Image();
			this.rollOverImg.src = $(this).attr('src').replace(new RegExp('(\.gif|\.jpg|\.png)$'), conf.attachStr + '$1');
			$(this.rollOverImg).css({position: 'absolute', opacity: 0});
			$(this).before(this.rollOverImg);
			$(this.rollOverImg).hover(function(){
				$(this).animate({opacity: 1}, {duration: conf.fadeTime, queue: false});
			},
			function(){
				$(this).animate({opacity: 0}, {duration: conf.fadeTime, queue: false});
			});
		});
}

function fadeBtn(){
		$(".fadeBtn a img").hover(function () {
			 $(this).stop().fadeTo("slow", 0.7);
		  }, function () {
			 $(this).stop().fadeTo("slow", 1.0);
		});
}

function css3class(){
		//:first-child, :last-childをクラスとして追加
			$('li:first-child').addClass('firstChild');
			$('li:last-child').addClass('lastChild');
			$('p:first-child').addClass('firstChild');
			$('p:last-child').addClass('lastChild');
}

/*
// Page Loaded on [ jQuery ]
*/
$(document).ready(function(){
	$(imgHover);
	$(fadeBtn);
	$(css3class);
})


