/* =============================================================================
	トップページ用
============================================================================= */
$(document).ready(function() {
	// Lightbox読み込み
	$('a[rel=lightbox]').lightBox();

	// PICKUP CONTENTSランダム表示
	var max		= 10;
	var start	= Math.floor(Math.random() * (max - 1)) + 1;
	var end		= Math.round(Math.random() * (max - (start + 1))) + (start + 1);
	for(var i = 1;i <= max;i++) {
		if(i == start) {
			$(".pc_left").html($(".pc" + i).html());
			$(".pc_left .pc_image").addClass("pcimgs" + i);
		} else if(i == end) {
			$(".pc_right").html($(".pc" + i).html());
			$(".pc_right .pc_image").addClass("pcimgs" + i);
			break;
		}
	}
	if($(".pc_left").height() > $(".pc_right").height()) {
		$(".pc_right").height($(".pc_left").height());
	} else {
		$(".pc_left").height($(".pc_right").height());
	}

	// 受験生へのメッセージ
	var r = Math.floor(Math.random() * ($("#jmlist > div").length - 1)) + 1;
	$(".juken_message").html($(".jm" + r).html());

	// メインメニュー
	//$("#main_menu span").hide();
	$("#main_menu div").hover(function() {
		var index = ($("div").index(this)) - 6;
		$(this).addClass("hover" + index);

		var num = Math.floor(Math.random() * 3 + 1)
		if(num == 4) {
			num = 3
		}
		$(this).find("span").attr("id", "mm" + index + "-" + num);

	}, function() {
		var index = ($("div").index(this)) - 6;
		$(this).removeClass("hover" + index);
		$(this).find("span").attr("id", "mm" + index + "-0");
	}).find("p").click(function() {
		var cn = $(this).parent().attr("class").split(" ");
		if(cn[0] == "image_1") {
			location.href = "waseda/";
		} else if(cn[0] == "image_2") {
			location.href = "gakumon/";
		} else if(cn[0] == "image_3") {
			location.href = "campus/";
		} else if(cn[0] == "image_4") {
			location.href = "g_school/";
		}
	});
});

