$(document).ready(function(){
	getCommonRight();
});
function getNewStr(obj){
	if(obj<3){
//		return 'class="new"';
		return 'style="background:url(images/new.gif) no-repeat right; padding-right:30px;"';
	}else{
		return '';
	}
}
function getCommonRight(){
	var url= pcs.common.path + '/json?action=QUERY_RIGHT_ACTION';
	$.post(url,{
	},function(data){
		if(data.success){
			//通知通告
			var vobj=data.root.T_XHDT_TZTG.rs;
			if(vobj!=null && vobj!=undefined && vobj.length>0){
				var str = ""
				$.each(vobj,function(i,n){
					if(i<2){
						str += '<li><a title="'+this.TITLE+'" href="file.html?id=' + this.PK_INFORMATION
					+ '" target="_blank" class="red">'+pcs.common.replaceHtmlAndEllipsis(this.TITLE,16,'...')+'</a></li>';
					}else{
						str += '<li><a title="'+this.TITLE+'" href="file.html?id=' + this.PK_INFORMATION
					+ '" target="_blank">'+pcs.common.replaceHtmlAndEllipsis(this.TITLE,16,'...')+'</a></li>';
					}
				})
				$("#COMMON_XHDT_TZTG").html(str);
			}
			//协会简报
			showCommonRightList(data.root.T_XHDT_XHJB.rs,"#COMMON_XHDT_XHJB");
			//下载专区
			var vvobj=data.root.T_XZZQ.rs;
			showCommonRightDownloadList(vvobj,"#COMMON_XZZQ");
			//健康之友
			showCommonRightList(data.root.T_JKZY.rs,"#COMMON_JKZY");
		}else{
		}
	},'json');
}
function showCommonRightList(vobj,result){
	if (vobj != null && vobj != undefined && vobj.length > 0) {
		var str = ""
		$.each(vobj, function(i, n) {
			str += '<li><a title="'+this.TITLE+'" href="file.html?id=' + this.PK_INFORMATION
					+ '" target="_blank" '+getNewStr(this.DAY_COUNT)+'>'
					+ pcs.common.replaceHtmlAndEllipsis(this.TITLE, 16, '...') + '</a></li>';
		})
		$(result).html(str);
	}
}
//function showCommonRightDownloadList(vvobj,result){
//	if (vvobj != null && vvobj != undefined && vvobj.length > 0) {
//		var str = ""
//		$.each(vvobj, function(i, n) {
//			str += '<li><a title="'+this.AFFIX_NAME+'" href="'+this.AFFIX_URL+'">'
//					+ pcs.common.replaceHtmlAndEllipsis(this.AFFIX_NAME, 16, '...') + '</a></li>';
//		})
//		$(result).html(str);
//	}
//}

function showCommonRightDownloadList(vvobj,result){
	if (vvobj != null && vvobj != undefined && vvobj.length > 0) {
		var str = ""
		$.each(vvobj, function(i, n) {
			str += '<li><a title="'+this.AFFIX_NAME+'" href="picDown.jsp?picid='+this.PK_DOWNLOAD+'" target="_blank">'
					+ pcs.common.replaceHtmlAndEllipsis(this.AFFIX_NAME, 16, '...') + '</a></li>';
		})
		$(result).html(str);
	}
}
