//ページトップ
$(function(){
     $(".pagetop a,.head_l a,.pagelink a,#footer_pagetop a").click(function(){
     $('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top }, 'slow','swing');
     return false;
     })
});




$(function(){
	$(".lecture #contents tr:nth-child(odd)").addClass("odd");
	$(".lecture #contents tr:nth-child(even)").addClass("even");
	$(".companyprofile #contents tr:nth-child(odd)").addClass("odd");
	$(".companyprofile #contents tr:nth-child(even)").addClass("even");
	$(".twin_L tr:nth-child(odd)").addClass("odd");
	$(".twin_L tr:nth-child(even)").addClass("even");
	$(".twin_R tr:nth-child(odd)").addClass("odd");
	$(".twin_R tr:nth-child(even)").addClass("even");
	$(".single tr:nth-child(odd)").addClass("odd");
	$(".single tr:nth-child(even)").addClass("even");
	$(".youkou tr:nth-child(odd)").addClass("odd");
	$(".youkou tr:nth-child(even)").addClass("even");
	$(".history tr:nth-child(odd)").addClass("odd");
	$(".history tr:nth-child(even)").addClass("even");
	$(".history tr:nth-child(odd)").addClass("odd");
	$(".businessreport div.year:nth-child(odd)").addClass("odd");
	$(".businessreport div.year:nth-child(even)").addClass("even");
	$(".irevent tr:nth-child(odd)").addClass("odd");
	$(".irevent tr:nth-child(even)").addClass("even");
});


//tab

$(function(){
	
	var tabs = $('.tab a[href^=#]');
	tabs.click(function(){
		//内容をすべて隠して対応コンテンツだけ表示
		$('.tabcontent').hide();
		$($(this).attr('href')).show();
		//タブをすべてオフにして自分だけactiveに
		tabs.removeClass('active');
		$(this).addClass('active');
		return false;
	});
	tabs.eq(0).trigger('click');

});


//input focus

$(document).ready(function() {
	$('input[title]').each(function() {
		if($(this).val() === '') {
			$(this).val($(this).attr('title'));	
		}
		
		$(this).focus(function() {
			if($(this).val() == $(this).attr('title')) {
				$(this).val('').addClass('focused');	
			}
		});
		$(this).blur(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused');	
			}
		});
	});
});


