// JavaScript Document

$(function() { 
	$(".fade a").css("opacity","1");
	$(".fade a").hover(
	function (){
		$(this).stop().animate({opacity: 0}, 'normal');},
	function (){
		$(this).stop().animate({opacity: 1}, 'slow');}
	);
	
	$('a[href^=#tp]').click(function(){
	var target = $( $(this).attr('href') );
	if (target.length == 0) {
	return;
	}
	$('html, body').animate({scrollTop: target.offset().top});
	return false;
	});
	
	$('a[href^=#kuzyou]').click(function(){
	var target = $( $(this).attr('href') );
	if (target.length == 0) {
	return;
	}
	$('html, body').animate({scrollTop: target.offset().top});
	return false;
	});

	$("div.panel div.tabbody:not("+$("ul.tab li a.selected").attr("href")+")").hide();
	$("ul.tab li a").click(function(){
		$("ul.tab li a").removeClass("selected");
		$(this).addClass("selected");
		$("div.panel div.tabbody").hide();
		$($(this).attr("href")).fadeIn(1000);
		return false;  
	});
	
	
	
	
	$(".imgfade").css("display","none");
	$(".imgfade").fadeTo(1000,1);
	
	$("#carouselInner").css("width",790*$("#carouselInner ul.column").size()+"px");
	$("#carouselInenr ul.column:last").prependTo("#carouselInner");
	$("#carouselInner").css("margin-left","-790px");	
	$("#carouselPrev").click(function(){
		$("#carouselNext, #carouselPrev").hide();
		$("#carouselInner").animate({
		  marginLeft: parseInt($("#carouselInner").css("margin-left"))+790+"px"
		},"slow","swing",
		function(){
			$("#carouselInner").css("margin-left","-790px");
			$("#carouselInner ul.column:last").prependTo("#carouselInner");
			$("#carouselNext,#carouselPrev").show();
		});
	});
	$("#carouselNext").click(function(){
		$("#carouselNext, #carouselPrev").hide();
		$("#carouselInner").animate({
		  marginLeft: parseInt($("#carouselInner").css("margin-left"))-790+"px"
		},"slow","swing",
		function(){
			$("#carouselInner").css("margin-left","-790px");
			$("#carouselInner ul.column:first").appendTo("#carouselInner");
			$("#carouselNext,#carouselPrev").show();
		});
	});
	var timerID = setInterval(function(){
		$("#carouselNext").click();
	},6000);
	
	$("#carouselPrev img, #carouselNext img").click(function(){
		clearInterval(timerID);
	});	

    $("table#comtb th, table.recrutb th").addClass("main-th");
	$("table#comtb td, table.recrutb td").addClass("main-td");
	$("table#comtb th:first, table.recrutb th:first").removeClass("main-th").addClass("first-th");
	$("table#comtb th:last, table.recrutb th:last").removeClass("main-th").addClass("last-th");
	$("table#comtb td:first, table.recrutb td:first").removeClass("main-td").addClass("first-td");
	$("table#comtb td:last, table.recrutb td:last").removeClass("main-td").addClass("last-td");

    
	$("ul.tab li a:first").css("border-left","1px solid #ccc").addClass("first-topleft");
	$("ul.tab li a:last").addClass("first-topright");
	

    
	$("table.insurance_company th").addClass("main-th");
	$("table.insurance_company td").addClass("main-td");
    $("table.insurance_company th:first").removeClass("main-th").addClass("first-th");
	$("table.insurance_company th:last").removeClass("main-th").addClass("last-th");
	$("table.insurance_company td:first").removeClass("main-td").addClass("first-td");
	$("table.insurance_company td:last").removeClass("main-td").addClass("last-td");


	
	$("#topics dl dt:gt(2)").css("display","none");	
	$("#topics dl dd:gt(2)").css("display","none");	


    $("button#gmapbutton01").click(function(){
		$("div#gmapload01").load("map/gmap01.txt");
		return false;
	});
	
    $("button#gmapbutton02").click(function(){
          $("div#gmapload02").load("map/gmap02.txt");
		  return false;
    });

    $("button#gmapbutton03").click(function(){
          $("div#gmapload03").load("map/gmap03.txt");
		  return false;
    });
	
	//$("div.inner3 p").prepend("\"").append("\"");
});













