$(document).ready(function(){
	getIndex();
})
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 getIndex(){
	var url= pcs.common.path + '/json?action=QUERY_INDEX_ACTION';
	$.post(url,{
	},function(data){
		if(data.success){
			//图片
			var vobj=data.root.T_IMAGE.rs;
			if(vobj!=null && vobj!=undefined && vobj.length>0){
				var str = ""
				$.each(vobj,function(i,n){
				    if(this.VIDEO_URL.length>0){
				    str += '<li><a href="file.html?id='+this.PK_INFORMATION+'" target="_blank"><img alt="" src="'+this.IMG_URL+'" /><span></span><p>'+pcs.common.ellipsis(this.TITLE,14,'...')+'</p></a></li>';
				    }else{
					str += '<li><a href="file.html?id='+this.PK_INFORMATION+'" target="_blank"><img alt="" src="'+this.IMG_URL+'" /><p>'+pcs.common.ellipsis(this.TITLE,14,'...')+'</p></a></li>';
				    }
//				    str += '<li><a href="file.html?id='+this.PK_INFORMATION+'" target="_blank"><img alt="" src="'+this.IMG_URL+'" /><p>'+pcs.common.ellipsis(this.TITLE,14,'...')+'</p></a></li>';
				})
				$("#pub_slideplay").html(str);
				new dk_slideplayer("#pub_slideplay",{width:"290px",height:"216px",fontsize:"12px",time:"5000"});
			}
			//会员简讯
			vobj=data.root.T_HYJX.rs;
			if(vobj!=null && vobj!=undefined && vobj.length>0){
				var str = ""
				$.each(vobj,function(i,n){
					if(i==0){
						str += '<h5>'+pcs.common.replaceHtmlAndEllipsis(this.TITLE,16,'...')+'</h5>';
						str += '<p>'+pcs.common.replaceHtmlAndEllipsis(this.CONTENT,50,"...")+'<a href="file.html?id='+this.PK_INFORMATION+'" target="_blank" class="red">[详细]</a></p>';
					}else{
						str += '<li><span>['+pcs.common.toChar(this.PUBLISH_DATE,"YYYY/MM/DD")+']</span>';
						str += '<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>';
					}
				})
				$("#ul_hyjx").html(str);
			}
			//专委会
//			vobj=data.root.T_ZWH.rs;
//			if(vobj!=null && vobj!=undefined && vobj.length>0){
//				var str = ""
//				$.each(vobj,function(i,n){
//						str += '<li><span>['+pcs.common.toChar(this.PUBLISH_DATE,"YYYY/MM/DD")+']</span>';
//						str += '<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>';
//				})
//				$("#T_ZWH").html(str);
//			}
		
			//政策法规热点法规
			showList(data.root.T_ZCFG_RDFG.rs,"#T_ZCFG_RDFG");
			//业界瞭望
			showList(data.root.T_YJLW.rs,"#T_YJLW");
			//业务咨询
			showList(data.root.T_YWZX.rs,"#T_YWZX");
			//管理参考
			showList(data.root.T_GLCK.rs,"#T_GLCK");
			//党建工作协会党建
			showList(data.root.T_DJGZ_XHDJ.rs,"#T_DJGZ_XHDJ");
			//健康之友
//			showList(data.root.COMMON_JKZY.rs,"#COMMON_JKZY");
		}else{
		}
	},'json');
}
function showList(vobj,result){
	if (vobj != null && vobj != undefined && vobj.length > 0) {
		var str = ""
		$.each(vobj, function(i, n) {
			str += '<li><span>[' + pcs.common.toChar(this.PUBLISH_DATE,
					"YYYY/MM/DD") + ']</span>·';
			str += '<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 co(str){
	return str.replace(/<[^>].*?>/g,"").replace(/&nbsp;/g,"");  
}

var xhdtObj;
var zwhObj;
function getXhdt(){
	if(xhdtObj==null){
		getInfomationContent("#T_XHDT","2",'');
	}
}
function getZwh(){
	if(zwhObj==null){
		getInfomationContent("#T_ZWH","",'203');
	}
}
function getInfomationContent(result,ptype,ctype){
	var url= pcs.common.path + '/json?action=QUERY_INFORAMTION_CONTENT_ACTION';
	$.post(url,{
		P_TYPE:ptype,
		C_TYPE:ctype
	},function(data){
		if(data.success){
			if(ptype=='2'&& ctype==null){
				xhdtObj = data.root.T_INFORMATION.rs;
			}else if(ptype=''&& ctype=='203'){
			    zwhObj = data.root.T_INFORMATION.rs;
			}
			vobj = data.root.T_INFORMATION.rs;
			if(vobj!=null && vobj!=undefined && vobj.length>0){
				var str = ""
				$.each(vobj,function(i,n){
					if(i==0){
						str += '<h5>'+pcs.common.replaceHtmlAndEllipsis(this.TITLE,16,'...')+'</h5>';
						str += '<p>'+pcs.common.replaceHtmlAndEllipsis(this.CONTENT,50,"...")+'<a href="file.html?id='+this.PK_INFORMATION+'" target="_blank" class="red">[详细]</a></p>';
					}else{
						str += '<li><span>['+pcs.common.toChar(this.PUBLISH_DATE,"YYYY/MM/DD")+']</span>';
						if(ctype==203){
						    str += '<a href="xhdt.html?infotype='+this.INFO_TYPE+'" target="_blank" class="blue"></a>';
						}else{
						str += '<a href="xhdt.html?infotype='+this.INFO_TYPE+'" target="_blank" class="blue">['+this.INFO_TYPE_SHOW+']</a>';
						}
						str += '<a title="'+this.TITLE+'" href="file.html?id='+this.PK_INFORMATION+'" target="_blank" '+getNewStr(this.DAY_COUNT)+'>'+pcs.common.replaceHtmlAndEllipsis(this.TITLE,15,'...')+'</a></li>';
					}
				})
				$(result).html(str);
			}
		}else{
		}
	},'json');
}
var zcfg_jgzcObj;  //政策法规 监管政策402
var zcfg_qtzcObj;  //政策法规 其他政策403
var djgz_hydjObj; //党建工作 会员党建302
var djgz_tszsObj;  //党建工作 它山之石303
function getInfoL(ctype){
	var obj;
	var result;
	if(ctype=='402'){
		obj = zcfg_jgzcObj;
		result = "#T_ZCFG_JGZC";
	}else if(ctype=='403'){
		obj = zcfg_qtzcObj;
		result = "#T_ZCFG_QTZC";
	}else if(ctype=='302'){
		obj = djgz_hydjObj;
		result = "#T_DJGZ_HYDJ";
	}else if(ctype=='303'){
		obj = djgz_tszsObj;
		result = "#T_DJGZ_TSZS";
	}else{
		return;
	}
	
	if(obj!=null&&obj.length>0){
		return;
	}
	var url= pcs.common.path + '/json?action=QUERY_INFORAMTION_ACTION';
	$.post(url,{
		C_TYPE:ctype,
		QUERY_SIZE:5
	},function(data){
		if(data.success){
			if(ctype=='402'){
				zcfg_jgzcObj = data.root.T_INFORMATION.rs;
			}else if(ctype=='403'){
				zcfg_qtzcObj = data.root.T_INFORMATION.rs;
			}else if(ctype=='302'){
				djgz_hydjObj = data.root.T_INFORMATION.rs;
			}else if(ctype=='303'){
				djgz_tszsObj = data.root.T_INFORMATION.rs;
			}
			vobj = data.root.T_INFORMATION.rs;
			if(vobj!=null && vobj!=undefined && vobj.length>0){
				var str = ""
				$.each(vobj,function(i,n){
					str += '<li><span>['+pcs.common.toChar(this.PUBLISH_DATE,"YYYY/MM/DD")+']</span>·';
					str += '<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);
			}
		}else{
		}
	},'json');
}

