
$(document).ready(function(){
	// テロップの設定
	$("#top_ticker_news").newsTicker(4500, "612px");

	// 商談情報と更新情報の高さを合わせる
	
	// 更新情報の件数
	var newsnum = 10;
	
	var newst_h;
	var newsl_h = $("div.top_news_l ul").height();
	var newsr_h = $("div.top_news_r .rent_info").height();
	
	var newst_u, newst_l;
	
	if (newsl_h < newsr_h)
	{
		newst_h = newsr_h;
		newst_u = $("div.top_news_l ul");
		newst_l = $("div.top_news_l ul li");
	
		// ulの高さを揃える
		newst_u.css('height', newst_h+'px')
		
		var newst_u_h = newst_u.height();
		var newst_l_h = 0;
		newst_l.each(function(i){
			newst_l_h += $(this).outerHeight();
		});
		
		// ulの高さとli全部の高さから余白の高さを算出
		var news_l_sp_s = newst_u_h - newst_l_h;
		// 余白の高さから各liの上下に加算するべき余白の高さを算出
		var news_l_sp_p = Math.floor(news_l_sp_s / newsnum / 2);
		
		newst_l.each(function(i){
			var now_h = $(this).height();
			var new_h = now_h + news_l_sp_p * 2;
			$(this).height(new_h);
			$(this).children().css('padding-top', news_l_sp_p+'px');
		});
	}
	else
	{
		newst_h = newsl_h;
		newst_u = $("div.top_news_r .rent_info");
	
		// ulの高さを揃える
		newst_u.css('height', newst_h+'px')
	}

	//
	var infonum = 5;
	
	var infot_h;
	var infol_h = $("div.top_info_l ul").height();
	var infor_h = $("div.top_info_r ul").height();
	
	var infot_u, infot_l;
	
	if (infol_h < infor_h)
	{
		infot_h = infor_h;
		infot_u = $("div.top_info_l ul");
		infot_l = $("div.top_info_l ul li");
	}
	else
	{
		infot_h = infol_h;
		infot_u = $("div.top_info_r ul");
		infot_l = $("div.top_info_r ul li");
	}

	// ulの高さを揃える
	infot_u.css('height', infot_h+'px')

	var infot_u_h = infot_u.height();
	var infot_l_h = 0;
	infot_l.each(function(i){
		infot_l_h += $(this).outerHeight();
	});
	
	// ulの高さとli全部の高さから余白の高さを算出
	var infos_l_sp_s = infot_u_h - infot_l_h;
	// 余白の高さから各liの上下に加算するべき余白の高さを算出
	var infos_l_sp_p = Math.floor(infos_l_sp_s / infonum / 2);
	
	infot_l.each(function(i){
		var now_h = $(this).height();
		var new_h = now_h + infos_l_sp_p * 2;
		$(this).height(new_h);
		$(this).children().css('padding-top', infos_l_sp_p+'px');
	});

});

