$(document).ready(function(){
	$.getJSON('importantNews.action?timestamp='+(new Date()).getTime(), function(result){
		if(result != null){
			var type = result["type"];
			var summary = result["summary"];
			var picPath = result["picPath"];
			var img = null;
			var href = null;
			if(type == "trend"){
				href = "viewCompTrend.action?id="+result["id"];
			}else if(type == "info"){
				href = "viewNews.action?id="+result["id"];
			}
			if(picPath != null){
				img = "<img src=\""+picPath+"\" width=\"159\" height=\"113\" align=\"right\"/>";
			}else{
				img = "<img src=\"images/no_pic.gif\" width=\"159\" height=\"113\" align=\"right\"/>";
			}
			
			/*
			//old 
			if(summary != null && summary!=""){
				$('#content').html(img +"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ "<font style='font-size:13px;'>"+summary+"</font>");
				$('#detail').html("<a class=a target='_blank' href='"+href+"' style='font-size:13px;'>详细...</a>");
			}else{
				$('#content').html("暂无内容");
			}
			*/
			$('#content').html(img +"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+ "<font style='font-size:13px;'>磐石资本成立之初专注于为中国最成功企业家和最富有家族管理私募股权投资，目前也管理着地方政府,大学和其他基金会的资本。公司目前管理的资本规模达几十亿人民币。</font>");
			$('#detail').html("<a class=a target='_blank' href='about.jsp' style='font-size:13px;'>详细...</a>");
			
		}else{
			$('#content').html("暂无内容");
			$('#detail').html("");
		}
	});

	$.getJSON('topCompTrend.action?timestamp='+(new Date()).getTime(), function(result){
		if(result != null && result.length > 0){
			var trend = [], length = result.length;
			for(var i = 0; i < length; i++){
				trend.push("<tr><td><span class=txt1>·&nbsp</span>");
				trend.push("<a class=a target='_blank' href='viewCompTrend.action?id="+result[i]["trendId"]+"' title='"+result[i].title+"' style='font-size:13px;'>"+result[i].subTitle+"</a></td>");
				trend.push("<td class=txt2>["+result[i].strDate+"]</td></tr>")
			}
			$('#compTrend').html(trend.join(""));
			$('#moreTrend').html("<a class=a target='_blank' href='compTrend.action' style='font-size:13px;'>更多...</a>");
		}else{
			$('#compTrend').html("<tr><td>暂无内容</td></tr>");
			$('#moreTrend').html("");
		}
	});
	
	$.getJSON('topNews.action?timestamp='+(new Date()).getTime(), function(result){
		if(result != null && result.length > 0){
			var news = [], length = result.length;
			for(var i = 0; i < length; i++){
				news.push("<tr><td><span class=txt1 style='font-size:14px;'>·&nbsp</span>");
				news.push("<a class=a target='_blank' href='viewNews.action?id="+result[i]["infoId"]+"' title='"+result[i].title+"' style='font-size:13px;'>"+result[i].subTitle+"</a></td>");
				news.push("<td class=txt2>["+result[i].strDate+"]</td></tr>")
			}
			$('#newsList').html(news.join(""));
			$('#moreNews').html("<a class=a target='_blank' href='news.action' style='font-size:13px;'>更多...</a>");
		}else{
			$('#newsList').html("<tr><td>暂无内容</td></tr>");
			$('#moreNews').html("");
		}
	});
});
