var READOPTIONS_IMG = encodeURIComponent("HKEY;IDXID;URLBODY");
var result = "";
var nav = "";
var ChannelList = Class.create();
ChannelList.prototype = {
	//初始化参数
	initialize : function(tableid,oDiv,url,parameters){
		this.tableid = tableid;//不同内容检索
		this.oDiv = oDiv;//页面写入的节点
		this.url = url ;//检索的页面
		this.parameters = parameters;//传入的参数
		this.requestSearch();//初始化请求
	},
	
	url : "",
	channelid : "",
	oDiv : "",
	parameters : "",
	
	requestSearch : function(){
		parameter = this.parameters;//searchword1=" + this.searchword;//检索条件
		myAjAX = new Ajax.Request(
			this.url,
			{method: 'get', parameters : parameter ,onComplete: this.getJSON.bind(this)}
		);
	},

	test : function(){
		alert("onSuccess");
	},
	getJSON : function(originalRequest){
		//设置反显
		//this.showpoint();
		result = eval(originalRequest.responseText);
		//alert(originalRequest.responseText);
		if (result[0].id == 1)
		{
			this.createNode_body(result);
			this.createNode_nav(result);
		}
		else if(result[0].id == 2)
		{
			this.createNode_body_pub(result);
			this.createNode_nav(result);

		}
		else if(result[0].id ==3)
		{
			this.createNode_body_gov(result);
			this.createNode_nav(result);
		}
	},
/***************普通列表样式开始****************/
	createNode_body : function(content){
		//加载频道文档列表
		html = "";
		titleSize = content.length;
		//alert(titleSize);
		var html = "<table width=\"723\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tablelb\">"+
							 "<tr align=\"center\" background=\"images/search_bg01.jpg\" class=\"lbzw\">"+
							 "<td width=\"30\" height=\"20\" background=\"images/search_bg01.jpg\">序号</td>"+
							 "<td width=\"443\" background=\"images/search_bg01.jpg\">名称</td>"+
							 "<td width=\"100\" background=\"images/search_bg01.jpg\">发布日期</td>"+
							 "<td width=\"150\" background=\"images/search_bg01.jpg\">文号</td>";
		
		if(content[1] == undefined){
				html += "<div>没有查找到任何信息！</div>";
		}
		else
		{
			for(var i=1;i<titleSize-1;i++){
				html +=" <tr valign=\"bottom\" bgcolor=\"#FFFFFF\" class=\"lbzw\"> "+
							   "<td height=\"20\" align=\"center\">"+content[i].tag+"</td>"+
							   "<td align=\"left\"> <a "+content[i].href+" class=\"link2\"  target=\"_blank\" onmouseover=\"Tip(TipInfo('"+content[i].wh+"','"+content[i].zyname_n+"','"+content[i].date+"','"+content[i].fbjg+"','"+content[i].keywords+"'),SHADOW, true,WIDTH,500,BGCOLOR, '#faf6e1',BORDERCOLOR ,'#e1d2ad')\" onmouseout=\"UnTip()\">"+content[i].zyname_y+"</a></td>"+
							   "<td align=\"left\">"+content[i].date+"</td>"+
							   "<td align=\"left\">"+content[i].wh+"</td></tr>";
			}			
		}
		html += "</tr></table>";
		//alert(html);
		var obj = $("channelList"+content[0].ot+"");
		obj.innerHTML = html;
	},
/***************普通列表样式结束****************/	
/***************公报列表样式开始****************/
	createNode_body_pub : function(content){
		//加载频道文档列表
		html = "";
		titleSize = content.length;
		//alert(titleSize);
		var html = "<table width=\"723\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tablelb\">"+
							 "<tr align=\"center\" background=\"images/search_bg01.jpg\" class=\"lbzw\">"+
							 "<td width=\"30\" height=\"20\" background=\"images/search_bg01.jpg\">序号</td>"+
							 "<td width=\"543\" background=\"images/search_bg01.jpg\">机构名称</td>"+
							 "<td width=\"150\" background=\"images/search_bg01.jpg\">查看详细</td>";
		
		if(content[1] == undefined){
				html += "<div>没有查找到任何信息！</div>";
		}
		else
		{
			for(var i=1;i<titleSize-1;i++){
				html +=" <tr valign=\"bottom\" bgcolor=\"#FFFFFF\" class=\"lbzw\"> "+
							   "<td height=\"20\" align=\"center\">"+content[i].tag+"</td>"+
							   "<td align=\"left\"> "+content[i].pubname+"公报"+"</td>"+
							   "<td align=\"center\"><a href=\"gb.jsp?searchword="+encodeURIComponent(content[0].searchword+" * 发布机构="+content[i].pubname)+"&gb="+encodeURIComponent(content[i].pubname)+"\" target=\"_blank\"><img src=\"images/docbak.gif\" border=\"\"></a></td></tr>";
			}			
		}
		html += "</tr></table>";
		//alert(html);
		var obj = $("channelList"+content[0].ot+"");
		obj.innerHTML = html;
	},
/***************公报列表样式结束****************/	
/***************机构列表样式开始****************/
	createNode_body_gov : function(content){
		//加载频道文档列表
		html = "";
		titleSize = content.length;
		//alert(titleSize);
		var html = "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"tablelb\">"+
							 "<tr align=\"center\" background=\"images/search_bg01.jpg\" class=\"lbzw\">"+
							 "<td width=\"30\" align=\"center\" height=\"20\" background=\"images/search_bg01.jpg\">序号</td>"+
							 "<td width=\"250\" background=\"images/search_bg01.jpg\">机构名称</td>"+
							 "<td width=\"643\" background=\"images/search_bg01.jpg\">链接地址</td>"+
							 "<td width=\"50\" background=\"images/search_bg01.jpg\">区域</td></tr>";
		
		if(content[1] == undefined){
				html += "<div>没有查找到任何信息！</div>";
		}
		else
		{
			for(var i=1;i<titleSize-1;i++){
				if(content[i].href=='')
					html +=" <tr valign=\"bottom\" bgcolor=\"#FFFFFF\" class=\"lbzw\"> "+
							   "<td height=\"20\" align=\"center\">"+content[i].tag+"</td>"+
							   "<td width=\"250\" align=\"left\">"+content[i].groupname+"</td>"+
							   "<td width=\"643\" align=\"left\"></td>"+
							   "<td width=\"50\" align=\"center\">"+content[i].region+"</td></tr>";
				else
					html +=" <tr valign=\"bottom\" bgcolor=\"#FFFFFF\" class=\"lbzw\"> "+
							   "<td height=\"20\" align=\"center\">"+content[i].tag+"</td>"+
							   "<td width=\"250\" align=\"left\">"+content[i].groupname+"</td>"+
							   "<td width=\"643\" align=\"left\"> <a href=\""+content[i].href+"\" target=\"_blank\">"+content[i].href+"</a></td>"+
							   "<td width=\"50\" align=\"center\">"+content[i].region+"</td></tr>";
			}			
		}
		html += "</table>";
		//alert(html);
		var obj = $("channelList"+content[0].ot+"");
		obj.innerHTML = html;
	},
/***************机构列表样式结束****************/	
/***************导航翻页样式开始****************/
	createNode_nav : function(content){
		//加载频道文档列表
		html = "";
		titleSize = content.length;
		//准备参数，开始构造翻页
		var id = content[0].id;
		var ot=content[0].ot;
		var currpage=content[0].currpage;
		var prepage=content[0].prepage;
		var pagecount=content[0].pagecount;
		var count=content[0].count;
		var searchword=content[0].searchword;
		var sortfield = content[0].sortfield;
		//alert(sortfield);
		var option = content[0].option;
		var up;
		var down;
		var bar="";
		var goto;
		if(currpage==1)
			up = "上一页&nbsp;";
		else
			up = "<a  href=\"#\" onclick=\"goTo('"+id+"','"+(parseInt(currpage)-1)+"','"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')\">上一页</a>&nbsp;&nbsp;";
		if(currpage==pagecount)
			down = "下一页";
		else
			down = "<a  href=\"#\" onclick=\"goTo('"+id+"','"+(parseInt(currpage)+1)+"','"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')\">下一页</a>&nbsp;&nbsp;";
		var i,j;
		var pagesPreBar = 10;
		var bigPageIn = Math.ceil(currpage/pagesPreBar);
		
		if(bigPageIn*pagesPreBar>pagecount)
		{
			var page_tmp=pagecount-(pagesPreBar-1); /*获得最后一个大页导航条的第一页*/
	        if(page_tmp<=0)         /*可能不够pagesPrePage页*/
	        {
	             j=1;
	        }
	        else
	        {
	              j=page_tmp;
	        }
	        for(i=0;(i<pagesPreBar)&&(i<page_tmp+(pagesPreBar-1));i++)
	        {
		        if(currpage == j+i)     /*当前页，不显示连接*/
		        {
		            bar += "<font color=\"#ff0000\">"+(i+j)+"</font>&nbsp";
		        }
		        else                    /*产生连接*/
		        {
		             bar += "<a  href=\"#\" onclick=\"goTo('"+id+"','"+(i+j)+"','"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')\">"+(i+j)+"</a>&nbsp;";
		        }
	        }
		}
		else
		{
			j=(bigPageIn-1)*pagesPreBar;
			
			for(i=1;i<pagesPreBar+1;i++)
			{
				if(currpage == j+i)     /*当前页，不显示连接*/
				{
					bar += "<font color=\"#ff0000\">"+(i+j)+"</font>&nbsp";
				}
				else                    /*产生连接*/
				{
					bar += "<a  href=\"#\" onclick=\"goTo('"+id+"','"+(i+j)+"','"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')\">"+(i+j)+"</a>&nbsp;";
				}
			}
		}
		goto_head = "<a  href=\"#\" onclick=\"goTo('"+id+"',$F('goto_head'),'"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')\">&gt;&gt;</a>&nbsp;&nbsp;";
		goto_tail = "<a  href=\"#\" onclick=\"goTo('"+id+"',$F('goto_tail'),'"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')\">&gt;&gt;</a>&nbsp;&nbsp;";

		var html_head = "<table width=\"723\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:5px 0 0 0\">"+
	                   "<tr> <td align=\"left\">共<font color=\"#FF0000\">"+pagecount+"</font>页<font color=\"#FF0000\">"+count+"</font>条记录,每页<font color=\"#FF0000\">"+prepage+"</font>条记录</td>"+
	                   "<td align=\"right\">" + up + down + bar +" 跳转至第&nbsp;<input onkeypress=\"if(event.keyCode==13){if($F('goto_head')<=0||$F('goto_head')>"+pagecount+"){alert('请输入正确的页码！');return;}goTo('"+id+"',$F('goto_head'),'"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')}\" name=\"goto_head\" type=\"text\" class=\"goto\" value=\"\"/>&nbsp;页 "+goto_head+
					   "</td></tr></table>";
		var html_tail = "<table width=\"723\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:5px 0 0 0\">"+
	                   "<tr> <td align=\"left\">&nbsp;&nbsp;共<font color=\"#FF0000\">"+pagecount+"</font>页<font color=\"#FF0000\">"+count+"</font>条记录,每页<font color=\"#FF0000\">"+prepage+"</font>条记录</td>"+
	                   "<td align=\"right\">" + up + down + bar +" 跳转至第&nbsp;<input onkeypress=\"if(event.keyCode==13){if($F('goto_tail')<=0||$F('goto_tail')>"+pagecount+"){alert('请输入正确的页码！');return;}goTo('"+id+"',$F('goto_tail'),'"+ot+"','"+encodeURIComponent(searchword)+"','"+encodeURIComponent(sortfield)+"','"+option+"','"+pagecount+"')}\"  name=\"goto_tail\" type=\"text\" class=\"goto\" value=\"\"/>&nbsp;页 "+goto_tail+
					   "</td></tr></table>";
		$("pageList_head").innerHTML = html_head;
		$("pageList_tail").innerHTML = html_tail;
	}
}
/***************导航翻页样式结束****************/	
//创建翻页区域
function creatNavBarRoom(strsearch){
	if($("pagehead").innerHTML.length > 1)
		$("pagehead").innerHTML = "";
	if($("pagetail").innerHTML.length > 1)
		$("pagetail").innerHTML = "";
	if(strsearch!=null && strsearch!=""){
		if($("pageList_head") == null){
				$("pagehead").innerHTML += "<div id=\"pageList_head\" style=\"width:100%\" align=\"left\"><img src=\"images/loading.gif\">&nbsp;&nbsp;正在加载导航…………</div>";
			}
		if($("pageList_tail") == null){
				$("pagetail").innerHTML += "<div id=\"pageList_tail\" style=\"width:100%\" align=\"left\"><img src=\"images/loading.gif\">&nbsp;&nbsp;正在加载导航…………</div>";
			}
	}
};
//创建加载区域
function creatListRoom(tagid,strsearch){
	if(tagid.innerHTML.length > 1)
		tagid.innerHTML = "";
	if(strsearch!=null && strsearch!=""){
		for(var i=0;i<strsearch.length;i++){
			if($("channelList"+strsearch[i].tableid) == null){
				tagid.innerHTML += "<div id=\"channelList"+strsearch[i].tableid+"\" style=\"width:100%\" align=\"left\"><img src=\"images/loading.gif\">&nbsp;&nbsp;正在加载文章列表…………</div>";
			}
		}
	}
};
//创建列表对象
function creatTableLists(strsearch,tagid,url){
	//alert(strsearch[0].searchword);
	creatNavBarRoom(strsearch);
	creatListRoom(tagid,strsearch);
	var listTable = new Array();
	if(strsearch == null)
		strsearch = [];
	//数组中存在内容
	if(strsearch.length > 0){
		listTable[0] = new ChannelList(strsearch[0].tableid,tagid,strsearch[0].searchurl,"&page="+strsearch[0].page+"&ot="+strsearch[0].tableid+"&searchword="+encodeURIComponent(strsearch[0].searchword));
	}
};
//****************构建下拉列表开始********************/
//创建下拉列表对象
var select;
function createSelectLists(strsearch,tagid){
	var listTable = new Array();
	select = tagid;
	if(strsearch == null)
		strsearch = [];
	if(strsearch.length > 0){
		new Ajax.Request(
				strsearch[0].searchurl,
				{method: 'get', parameters : "&page="+strsearch[0].page+"&ot="+strsearch[0].tableid+"&searchword="+encodeURIComponent(strsearch[0].searchword) ,onComplete: showSelectListsCallBack}
		);
	}
};

function showSelectListsCallBack(originalRequest)
{
	result = eval(originalRequest.responseText);
	var option=new Array(); 
	$(select).length=0;
	option[0]=document.createElement("option");
	option[0].value = "0";
	option[0].text = "请选择";
	$(select).add(option[0]);
	for(var i=1;i<result.length;i++)
	{
	  option[i]=document.createElement("option");
	  option[i].value = result[i].groupid;
	  option[i].text = result[i].groupname;
　	  $(select).add(option[i]);
	}
};
//****************构建下拉列表结束********************/
//处理细览中雷达抓取图片问题
function createImages(hkey){
	return;
	for(i=0;i<$("content").getElementsByTagName("IMG").length;i++){
		$("content").getElementsByTagName("IMG")[i].src = "/img4radar?readoptions="+READOPTIONS_IMG+"&ot=2&searchword="+encodeURIComponent("hkey="+hkey.innerHTML+" and idxid="+(i+1));
		//初始化设置有图片大小
		//$("content").getElementsByTagName("IMG")[i].width = "100";
	}
	//formatImage(hkey);
};
//lxh@20090513,处理图片的大小
function formatImage(hkey){
	var oImages = $("content").getElementsByTagName("IMG");
	var arrayWidth = new Array(oImages.length);
	var myThis = this;
	for(i=0;i<oImages.length;i++){
		var url = "/imgInfo4radar?readoptions="+READOPTIONS_IMG+"&ot=2&searchword="+encodeURIComponent("hkey="+hkey.innerHTML+" and idxid="+(i+1));
		var oIamge = oImages[i];
		myAjAX = new Ajax.Request(
			url,
			{
				method: 'get', 
				parameters : "" ,
				onComplete: function(originalRequest){
					result = eval("("+originalRequest.responseText+")");
					//alert(oImages[i]);
					var temp_width = "";
					if(parseInt(result["width"])>700){
						temp_width = "700";
					}else{
						temp_width = result["width"];
					}
					arrayWidth[i] = temp_width;
				}
			}
		);
		//alert(arrayWidth);
		//$("content").getElementsByTagName("IMG")[i].width = "700";
	}
}
function getImageInfo(originalRequest,obj){
	result = eval("("+originalRequest.responseText+")");
	if(parseInt(result["width"])>700){
		//alert(obj)
		obj.width = "700";
	}
}
//****************构建菜单分类开始********************/
function showWaiting(menuTabId,menuTabNum,num,arr)
{
	if($("menuTab_"+menuTabNum+"_"+num) == null)
	switch(menuTabNum)
	{
		case 1:
		case 2:
			menuTabId.innerHTML += "	<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">"+
						  				"<tr><td id=\""+"menuTab_"+menuTabNum+"_"+num+"\">"+arr+"(<img src=\"images/loading.gif\">)</td></tr>"+
						  				"</table>";
			break;
		case 6:
			menuTabId.innerHTML += "	<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">"+
						  				"<tr><td id=\""+"menuTab_"+menuTabNum+"_"+num+"\" height=\"30\"><img src=\"images/dian07.gif\" width=\"9\" height=\"9\" />"+arr+"</td></tr>"+
						  				"</table>";
			break;
		default:
	}
	//alert(menuTabId.innerHTML);
};
function showMenuCount(menuTabId,searchword,menuTabNum,num,strsearch,arr,focus)
{
	//menuTabId = $("menu_TC"),menuTabNum 为前面的1,num为后面的1,arrTiCai数组值
	//alert(focus);
	switch(menuTabNum)
	{
		case 1:
			showWaiting(menuTabId,menuTabNum,num,arr);
			//alert(strsearch[0].searchword);
			if(strsearch[0].searchword ==' '||strsearch[0].searchword =='')
				s_searchword = "主题分类="+searchword;
			else
				s_searchword = "主题分类="+searchword+"*" +strsearch[0].searchword;
			
			break;
		case 2:
			//需要把arr用“/”分开
			//arr = arr.substring(arr.indexOf("/")+1);
			showWaiting(menuTabId,menuTabNum,num,arr);
			if(strsearch[0].searchword ==' '||strsearch[0].searchword =='')
				s_searchword = "题材分类="+searchword+"";
			else
				s_searchword = "题材分类="+searchword+"*" +strsearch[0].searchword;
			
			break;
		case 6:
			showWaiting(menuTabId,menuTabNum,num,arr);
			(num==1)?s_searchword = "库类别=1":s_searchword = "库类别=3";
			break;
		default:
	}
	
	new Ajax.Request(
			"menujson.jsp?searchword="+encodeURIComponent(s_searchword)+"&m="+menuTabNum+"&n="+num+"&t="+encodeURIComponent(arr)+"&s="+encodeURIComponent(searchword)+"&sw="+encodeURIComponent(strsearch[0].searchword)+"&focus="+encodeURIComponent(focus),
			{method: 'get', onComplete: showMenuCountCallBack}
	);
};
function showMenuCountCallBack(originalRequest)
{
	result = eval(originalRequest.responseText);
	var menuTabNum = result[0].m;
	var num = result[0].n;	
	var arr =  result[0].t;
	//alert(arrTiCat);
	var count =result[0].count;
	var searchword = result[0].s;
	var sw = result[0].sw;
	var focus = result[0].f;
	//alert(num);
	if(menuTabNum==1||menuTabNum==2)
	{
		if(focus==arr)
			$("menuTab_"+menuTabNum+"_"+num).innerHTML = "<a href=\"#\" onclick=\"menuGoTo("+menuTabNum+",'"+decodeURIComponent(searchword)+"','"+decodeURIComponent(sw)+"',"+num+") \" style=\"color:red\" id=\"menufocus_"+menuTabNum+"_"+num+"\">"+arr+"</a>("+count+")";
		else
			$("menuTab_"+menuTabNum+"_"+num).innerHTML = "<a href=\"#\" onclick=\"menuGoTo("+menuTabNum+",'"+decodeURIComponent(searchword)+"','"+decodeURIComponent(sw)+"',"+num+")\" id=\"menufocus_"+menuTabNum+"_"+num+"\">"+arr+"</a>("+count+")";
	}
		
	if(menuTabNum==6)
		$("menuTab_"+menuTabNum+"_"+num).innerHTML = "<img src=\"images/dian07.gif\" width=\"9\" height=\"9\" /><a href=\"#\" onclick=\"menuGoTo("+menuTabNum+",'"+decodeURIComponent(searchword)+"','"+decodeURIComponent(sw)+"',"+num+")\" id=\"menufocus_"+menuTabNum+"_"+num+"\">"+arr+"</a>";
	//alert($("menuTab_"+menuTabNum+"_"+num).innerHTML);
};
//****************构建菜单分类结束********************/
//****************构建公报列表开始********************/
var GbView = Class.create();
GbView.prototype = {
	initialize : function(tableid,oDiv,url,parameters){
		this.tableid = tableid;//不同内容检索
		this.oDiv = oDiv;//页面写入的节点
		this.url = url ;//检索的页面
		this.parameters = parameters;//传入的参数
		this.requestSearch();//初始化请求
	},
	
	url : "",
	channelid : "",
	oDiv : "",
	parameters : "",
	
	requestSearch : function(){
		parameter = this.parameters;//searchword1=" + this.searchword;//检索条件
		myAjAX = new Ajax.Request(
			this.url,
			{method: 'get', parameters : parameter ,onComplete: this.getJSON.bind(this)}
		);
	},
	getJSON : function(originalRequest){
		//设置反显
		//this.showpoint();
		result = eval(originalRequest.responseText);
		//alert(originalRequest.responseText);
		this.createDocumentViewlist(result);
	},
	/***************公报浏览页列表样式开始****************/
	createDocumentViewlist : function(content){
		//加载频道文档列表
		html = "";
		titleSize = content.length;
		//alert(titleSize);
		var html = "<table width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:15px 0 20px 0\">";		
		if(content[1] == undefined){
				html += "<div>没有查找到任何信息！</div>";
		}
		else
		{
			for(var i=1;i<titleSize-1;i++){
				html +="<tr> <td align=\"left\" valign=\"top\" style=\"padding:8px\">&nbsp;&nbsp;&nbsp;&nbsp;<a "+content[i].href+" target=\"_blank\" class=\"dbt_gb\">"+content[i].zyname_y+"</a></td></tr>";
			}			
		}
		html += "</table>";
		//alert(html);
		var obj = $("gbList"+content[0].ot+"");
		obj.innerHTML = html;
		
		$("title").innerHTML = content[0].gbname+"公报";
		$("qk").innerHTML =$("qkleft").innerHTML= content[0].qk;
		/****lxh20090518，修改构造公报的图的组成方式****/
		//获取图片名称
		var s_pic = result[1].gbimg.replace (/\s/ig,'').replace('gif','jpg');
		//因为大部分都有2008年的图片，因此将去到的图片换为2008年的图片
		var s_pic_name = s_pic.replace(/\d/g,"").replace(/\_/,"_2008");
		//从图片名称中提取年限
		var s_pic_num = s_pic.replace(/\D/g,"");
		//构造HTML
		var s_pic_html = "<div style='background:beige url(images/gb/"+s_pic_name+") no-repeat top center;width:137;height:196'><div style='height:11;width:36;background-color:#FFFFFF;margin-left:51px;margin-top:158px;'>"+num2html(s_pic_num)+"</div></div>";
		
		$("gbimg").innerHTML = s_pic_html;
		//$("gbimg").innerHTML = "<img src=\"images/gb/"+result[1].gbimg.replace (/\s/ig,'').replace('gif','jpg')+"\" width=\"137\" height=\"196\"/>";
		if(content[0].gclj!=undefined&&content[0].gclj!="")
			$("gclj").innerHTML = "<a href=\""+content[0].gclj+"\" class=\"boid\" target=\"_blank\">馆藏链接</a>";
		else
			$("gclj").innerHTML = "";
		//alert($("gbimg").src);
	}
	/***************公报浏览页列表样式结束****************/	
}
//公报，将数字转换为图片
function num2html(num){
    var html = "<img src='images/num/num_{X}.jpg' />";
	var result = "";

	if(isNaN(parseInt(num)))
		return;
	
	for(var i=0;i<num.length;i++){
		var s = num.charAt(i);
		result += html.replace(/{X}/g,s)
	}
	
	return (result);
	
 }
//创建公报浏览页加载区域
function creatGbListRoom(tagid,strsearch){
	if(tagid.innerHTML.length > 1)
		tagid.innerHTML = "";
	if(strsearch!=null && strsearch!=""){
		for(var i=0;i<strsearch.length;i++){
			if($("gbList"+strsearch[i].tableid) == null){
				tagid.innerHTML += "<div id=\"gbList"+strsearch[i].tableid+"\" style=\"width:723px\" align=\"center\"><img src=\"images/loading.gif\">&nbsp;&nbsp;正在加载文章列表…………</div>";
			}
		}
	}
};
//创建公报浏览页列表对象
function creatDocumentViewLists(strsearch,tagid,url){
	creatGbListRoom(tagid,strsearch);
	var listTable = new Array();
	if(strsearch == null)
		strsearch = [];
	//数组中存在内容
	if(strsearch.length > 0){
		listTable[0] = new GbView(strsearch[0].tableid,tagid,strsearch[0].searchurl,"&page="+strsearch[0].page+"&ot="+strsearch[0].tableid+"&searchword="+encodeURIComponent(strsearch[0].searchword));
	}
};
//****************构建公报列表结束********************/
//****************构建首页最新内容列表开始********************/
var NewList = Class.create();
NewList.prototype = {
	initialize : function(tableid,oDiv,url,parameters){
		this.tableid = tableid;//不同内容检索
		this.oDiv = oDiv;//页面写入的节点
		this.url = url ;//检索的页面
		this.parameters = parameters;//传入的参数
		this.requestSearch();//初始化请求
	},
	
	url : "",
	channelid : "",
	oDiv : "",
	parameters : "",
	
	requestSearch : function(){
		parameter = this.parameters;//searchword1=" + this.searchword;//检索条件
		myAjAX = new Ajax.Request(
			this.url,
			{method: 'get', parameters : parameter ,onComplete: this.getJSON.bind(this)}
		);
	},
	getJSON : function(originalRequest){
		//设置反显
		//this.showpoint();
		result = eval(originalRequest.responseText);
		//alert(originalRequest.responseText);
		this.createNewList(result);
	},
	createNewList : function(content){
		//加载频道文档列表
		html = "";
		titleSize = content.length;
		//alert(titleSize);
		var html = "";		
		if(content[1] == undefined){
				html += "<div>没有查找到任何信息！</div>";
		}
		else
		{
			for(var i=1;i<titleSize-1;i++){
				html += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"margin:5px 0 0px 0\">"+
                       "<tr> <td align=\"left\" valign=\"top\">●&nbsp;&nbsp;<a "+content[i].href+" target=\"_blank\">" +content[i].zyname_n+"</a>"+"&nbsp;&nbsp;("+content[i].date+")"+"</td>"+
                       "</tr></table>";	
			}			
		}
		//alert(html);
		var obj = $("newList"+content[0].ot+"");
		obj.innerHTML = html;
	}
}
//创建公报浏览页加载区域
function creatNewListRoom(tagid,strsearch){
	if(tagid.innerHTML.length > 1)
		tagid.innerHTML = "";
	if(strsearch!=null && strsearch!=""){
		for(var i=0;i<strsearch.length;i++){
			if($("newList"+strsearch[i].tableid) == null){
				tagid.innerHTML += "<div id=\"newList"+strsearch[i].tableid+"\" style=\"width:94%;margin:5px 0 0px 0\" align=\"center\"><img src=\"images/loading.gif\" width=\"32\" height=\"32\"></div>";
			}
		}
	}
};
//创建公报浏览页列表对象
function creatNewLists(strsearch,tagid,url){
	creatNewListRoom(tagid,strsearch);
	var listTable = new Array();
	if(strsearch == null)
		strsearch = [];
	//数组中存在内容
	if(strsearch.length > 0){
		listTable[0] = new NewList(strsearch[0].tableid,tagid,strsearch[0].searchurl,"&prepage=3&page="+strsearch[0].page+"&ot="+strsearch[0].tableid+"&searchword="+encodeURIComponent(strsearch[0].searchword));
	}
};
//****************构建首页最新内容列表结束********************/

//连接有效性验证
document.writeln("<div id='divCheckurl' style='display:none'></div>");
function checkUrl(url,kw){
	var str = '<form action="checkurl.jsp" name="fromCheckurl" id="fromCheckurl" method="post" target="_blank">\
				<input name="url" type="hidden" value="">\
				<input name="kw" type="hidden" value="">\
			</form>';
	
	if($("fromCheckurl")==null){
		if($("divCheckurl")!=null)
			$("divCheckurl").innerHTML = str;
		else
			return;
	}
	
	document.fromCheckurl.url.value = url;
	document.fromCheckurl.kw.value = kw;

	document.fromCheckurl.submit();

	//document.writeln(str);
}
