// via jquery.easing.1.3.js
// http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.extend( jQuery.easing,
{
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	}
});

$(function(){
	$("#billboard").easySlider(); // 打ち出しのスライダ初期化

//	var bannerLen = $("div#bannerSetting > a").length; // さあ、お前のバナーを数えろ 
//	var selectedBannerID = Math.floor(Math.random()*bannerLen); // バナーをランダムに設定 
//	$("li#board1st").append(
//		$("<div>").html($("div#bannerSetting > a").get(selectedBannerID))
//	); // 決定したバナーを読み込み 
//	$("li#board1st > div").css({"marginLeft":"0","opacity":"0"}); // バナー初期化
//	$("li#board1st > div").animate({"marginLeft":"550px", "opacity":"1"},{duration:1800, easing:"easeOutBounce"}); // バナーをフェードインさせつつスライディング
	
	$("div#newsArea dt").append($("<a>",{"href":"news.html","text":"[詳細...]","class":"readmore"}));
	$("div#newsArea a.readmore").live("click",function(){
		$("div#newsArea dd").slideUp("normal");
		$("div#newsArea a.readmore").not($(this)).text("[詳細...]");
		if($(this).text()!="[閉じる]"){
			$(this).text("[閉じる]").parent().next("dd").slideDown("normal");
		} else {
			$(this).text("[詳細...]");
		}
		return false;
	});

	$("#deptProfiles a.readMore").click(function(){
		$(this).parent().next().slideToggle("slow");
		if ($(this).text() != "詳細を表示...") {
			$(this).text("詳細を表示...");
				} else {
			$(this).text("詳細を閉じる");
		}
		return false;
	});
	
	$("ul.bannerSpace li").each(function(){
		offset = $(this).offset();
		$(this).children("p").offset({"top":offset.top-20, "left":offset.left-540}).hide();
	});
	$("ul.bannerSpace li").hover(function(){
		$(this).children("p").fadeIn("normal");
		$("#leftColumn").css("opacity","0.3");
	},function(){
		$(this).children("p").fadeOut("normal");
		$("#leftColumn").css("opacity","1");
	});
	
});



