var btnclick=false; //用于查询提交时自动回复到第一页的控制参数

/*
JS分页函数，配合文章显示模块使用
by jmz
build time:2007-10-23
*/
function PageViewLoad(name)
{

	var obj = $(name);
	var rowcount = obj.rowCount,rowmaxcount = obj.rowMaxCount,pi = 0;
	
	if(rowcount == "0")
	{
		$("pageView").style.display = "none";
		return;
	}
	var loc = window.location.toString();


	pi = GetUrlPara("pi",0);
	//修改部分  2007-12-11

	if (btnclick){
	pi=0;
	}else{
if (pi>rowcount/rowmaxcount){
pi=0;
}
}
	///修改结束

	var html = "";
	
	if(pi>0)
	{
		html += '<span style="cursor:hand; "  onclick=\'javascript:ChangeUrl("'+SetUrlPara("pi",0)+'");\' title="首页">【首页】</span> ';
		html += '<span style="cursor:hand; " onclick=\'javascript:ChangeUrl("'+SetUrlPara("pi",(pi-1))+'");\' title="前一页">【前一页】</span>';
	}
	else
	{
		html += '<span style="color:GrayText;" title="已经是第一页了！">【首页】</span> ';
		html += '<span style="color:GrayText;" title="已经是第一页了！">【前一页】</span>';
	}
	var pagecount = rowcount/rowmaxcount;
	if(rowcount%rowmaxcount != 0)
		pagecount = parseInt(pagecount) + 1;
	if(pi == (pagecount-1))
	{
		html += '<span style="color:GrayText;" title="已经是最后一页了！">【后一页】</span> <span style="color:GrayText;" title="已经是最后一页了！">【末页】</span>';
	}
	else
	{
		html += '<span  style="cursor:hand; "  onclick=\'javascript:ChangeUrl("'+SetUrlPara("pi",(pi*1+1))+'");\' title="后一页">【后一页】</span> <span  style="cursor:hand; "  onclick=\'javascript:ChangeUrl("'+SetUrlPara("pi",(pagecount-1))+'");\' title="末页">【末页】</span>';
	}
	var sp = 0,ep = 9;
	if(pi-4>-1)
		sp = pi-4;
	ep = sp+9;
	var pagecount = rowcount/rowmaxcount;
	if(rowcount%rowmaxcount != 0)
		pagecount = parseInt(pagecount) + 1;
	if(ep > pagecount)
		ep = pagecount;
	
	for(;sp<ep;sp++)
	{
		var tmpurl = SetUrlPara("pi",sp);
		if(sp == pi)
		{
			html += '&nbsp;第【' + '<span style="color:Red;cursor:default;" onclick="javascript:void(0);" title="第'+(sp+1)+'页">'+(sp+1)+'</span>' + '】页&nbsp;';
			break;
		}
	}

	html += '<span style="cursor:default;" >共【' + pagecount + '】页</span> <span  style="cursor:default;">共【' + rowcount + '】条记录</span>';
	
	//跳到第n条记录begin
	html += '&nbsp;&nbsp;跳到第&nbsp;';
	html += '<select id="Select1" style="width: 45px" onchange=\'javascript:ChangeUrl(getSelectedVal(this));\'>';
	sp = 0,ep = 9;
	if(pi-4>-1)
		sp = pi-4;
	for(;sp<pagecount;sp++)
	{
		var tmpurl1 = SetUrlPara("pi",sp);
		if(sp == pi)
		{
			html += '<option value="' + tmpurl1 + '" selected="selected">' + (sp+1) + '</option>';
			continue;
		}
		html += '<option value="' + tmpurl1 + '">' + (sp+1) + '</option>';
		}
	html += '</select>';
	html += '&nbsp;页';
	//跳到第n条记录end
	$("pageView").innerHTML = html;
}

//获取下拉框选定的值
function getSelectedVal(obj)
{
	return obj.value;
}

function ChangeUrl(url)
{
	window.location.href = url;
}

function SetUrlPara(paraName,paraValue)//设置URL里面制定参数名字的值
{
	
	var loc = window.location.toString();
	if(loc.indexOf(paraName + "=") == -1)
	{
		if(loc.indexOf("?") == -1)
			loc += "?" + paraName + "=" + paraValue;
		else
			loc += "&" + paraName + "=" + paraValue;
	}
	else
	{
		if(loc.split(paraName + "=")[1].indexOf("&") == -1)
			loc = loc.split(paraName + "=")[0] + paraName + "=" + paraValue;
		else
			loc = loc.split(paraName + "=")[0] + paraName + "=" + paraValue + loc.split(paraName + "=")[1].substr(loc.split(paraName + "=")[1].indexOf("&"))
			
	}
	
     loc=DelUrlPara(loc,"view");
	return loc;
}

function GetUrlPara(paraName,tmpvalue)//获得URL中的对定的GET参数，参数名，无值时默认返回指定值
{
	var paraValue = "",loc = window.location.toString();
	if(loc.indexOf(paraName+"=") > -1)
		if(loc.split(paraName+"=")[1].indexOf("&") == -1)
			paraValue = loc.split(paraName+"=")[1];
		else
			paraValue = loc.split(paraName+"=")[1].substring(0,loc.split(paraName+"=")[1].indexOf("&"));
	if(paraValue == "")
		return tmpvalue;
	return paraValue;
}

function DelUrlPara(url,paraName)//删除URL中对应GET参数部分
{
	var loc = url;
	if(loc.indexOf(paraName+"=") > -1)
		if(loc.split(paraName+"=")[1].indexOf("&") == -1)
			loc = loc.split(paraName+"=")[0].substring(0,loc.split(paraName+"=")[0].length-1);
		else
			loc = loc.split(paraName+"=")[0] + loc.split(paraName+"=")[1].substr(loc.split(paraName+"=")[1].indexOf("&"));
	return loc;
}
/*
JS分页函数，配合文章显示模块使用-----------------------------------------------以上
*/

function TitleImgChange(fid)//模块图片变更
{
	switch(fid)
	{
		case "37":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/tpxw.jpg)";break;//图片新闻  原来：新闻报道 xwbd
		case "38":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/fxkh.jpg)";break; //旧防汛抗旱
		case "39":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/tfzl.jpg)";break; //台风专栏
		case "40":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zcfg.jpg)";break;  //政策法规
		case "41":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slzs.jpg)";break;  //水利知识
		case "42":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/bmfw.jpg)";break;  //便民服务  原来：通知公告 tzgg
		case "43":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/spzx.jpg)";break; //视频在线  原来：水库视频 sksp
		case "56":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zxbs.jpg)";break;  //在线办事
		//case "68":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slzl.jpg)";break; //原水利专栏
		case "70":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/sldt.jpg)";break;  //水利动态
		case "71":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/ksyd.jpg)";break;  //科室园地
		case "74":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gzcy.jpg)";break;  //公众参与
		case "79":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/underUnit.jpg)";break; //直属单位
		case "81":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jldzs.jpg)";break; //局领导之声
		case "84":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/xqsw.jpg)";break;  //县区水务
		case "86":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slzt.jpg)";break;  //水利专题
		case "158":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/bszn.jpg)";break; //办事指南
		
		case "164":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/tpzx.jpg)";break; //图片中心
		case "165":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/sllt.jpg)";break; //水利论坛
		
		case "184":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/ldbz.jpg)";break; //领导班子
		case "157":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/ldfg.jpg)";break; //领导分工
		case "268":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gczb.jpg)";break; //工程招标
		//case "68":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/hygb.jpg)";break; //行业公报
		case "162":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/dzgk.jpg)";break; //党政公开
		case "163":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/ghjh.jpg)";break; //规划计划
		case "166":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/rsrm.jpg)";break; //人事任免
		case "167":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/yjgl.jpg)";break; //应急管理
		case "211":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gzzn.jpg)";break; //工作职能
		case "131":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zjjd.jpg)";break; //资金监督
		case "213":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zfjd.jpg)";break; //执法监督
		
		case "176":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/hqdt.jpg)";break; //旱情动态
		case "177":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/xqkb.jpg)";break; //汛情快报
		case "178":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/fxbx.jpg)";break; //防汛备汛
		case "179":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/kzjz.jpg)";break; //救灾抗灾
		
		case "181":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slfc.jpg)";break; //水利风采
		case "182":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slwh.jpg)";break; //水利文化
		case "183":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slsc.jpg)";break; //水利市场
		case "161":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slbk.jpg)";break; //水利百科
		
		case "122":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zfxxgk.jpg)";break; //政府信息公开
		case "267":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zcps.jpg)";break; //职称评审
		case "278":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/dsj.jpg)";break; //大事记
		case "47":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gtgz.jpg)";break;
		
		case "231":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/fhkt.jpg)";break;  //防洪抗台
		case "233":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/tzgg.jpg)";break;  //通知公告
		case "243":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slzg.jpg)";break; //水利之歌
		case "257":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/bzgk.jpg)";break; //本站概况
		case "283":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/yjcsspdb.jpg)";break; //应急常识视频点播
		case "285":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gzya.jpg)";break; //工作预案
		case "287":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/fxcs.jpg)";break; //防汛常识
		
		case "291":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/qqgz.jpg)";break; //前期工作
		case "378":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gczb.jpg)";break; //工程招标
		case "300":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gcjs.jpg)";break; //工程建设
		case "308":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slsc.jpg)";break; //水利市场
		case "312":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jhgl.jpg)";break; //建后管理
		
		case "316":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/hdglfwncsyghdsp.jpg)";break; //河道管理范围内从事有关活动审批
		case "318":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/hdglfwnshgcfhsc.jpg)";break; //河道管理范围内涉河工程防洪审查
		case "320":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/fhyxpj.jpg)";break; //防洪影响评价
		case "322":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/rhpwksc.jpg)";break; //入河排污口审查
		case "324":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/stbcfasp.jpg)";break; // 水土保持方案审批
		case "326":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zynyggsxyhgpgcsssc.jpg)";break; //占用农业灌溉水源和灌排工程设施审批
		case "328":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/sgcglfwncfsp.jpg)";break; // 水工程管理范围内防护林采伐审批
		case "330":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/kkhpdps.jpg)";break; //开垦荒坡地批准 
		case "332":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/stbcssjgys.jpg)";break; //水土保持设施竣工验收
		case "334":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/hdglfwncsyghdsp.jpg)";break; //河道管理范围内从事有关活动审批
		case "342":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zynyggsxyhgpgcsssc.jpg)";break; //河道管理范围内涉河工程防洪审查
		case "340":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/rhpwksc.jpg)";break; //入河排污口审查
		case "344":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/stbcfasp.jpg)";break; //水土保持方案审批
		case "338":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/fhyxpj.jpg)";break; //防洪影响评价
		//case "312":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jhgl.jpg)";break; //占用农业灌溉水源和灌排工程设施审批
		case "346":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/stbcssjgys.jpg)";break; //水土保持设施竣工验收
		case "348":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/zcfg.jpg)";break; //政策法规
		case "350":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/szylz.jpg)";break; //水资源论证
		case "352":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/qsxk.jpg)";break; //取水许可
		case "354":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jdszyf.jpg)";break; //缴纳水资源费
		
		case "356":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/wyjdsf.jpg)";break; //我要缴纳水费
		case "422":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/qyzt.jpg)";break; //企业展台
		
		case "99":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/bgs.jpg)";break; //办公室
		/*
		case "447":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/bgszz.jpg)";break; //办公室职责
		case "448":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jswm.jpg)";break; //精神文明
		case "449":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/tzgg.jpg)";break; //通知公告
		case "450":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/djgz.jpg)";break; //党建工作
		case "451":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/dflz.jpg)";break; //党风廉政
		case "452":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/gzzd.jpg)";break; //规章制度
		case "453":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/hpgz.jpg)";break; //行评工作
		case "454":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/slxf.jpg)";break; //水利信访
		case "455":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/taya.jpg)";break; //提案议案
		case "456":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/xcxx.jpg)";break; //宣传信息
		case "457":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jypx.jpg)";break; //教育培训
		case "458":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jxkp.jpg)";break; //绩效考评
		case "459":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/jckzz.jpg)";break; //计财科职责
		case "460":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/cwgl.jpg)";break; //财务管理
		case "461":$("index_content_titleimg").style.backgroundImage = "url(Images/titleimg/hqfw.jpg)";break; //后勤服务
		*/
	}
}

function TopLocChange(fid)//导航条部分跳转
{
	var tmp = SetUrlPara("fi",fid);
	var loc = tmp.substring(0,tmp.lastIndexOf("/"));
	if(tmp.indexOf("?") != -1)
		loc += "/MessageList.aspx?"+tmp.split("?")[1];    

	window.location.href = DelUrlPara(loc,"ci");
	
	//window.location.href = SetUrlPara("fi",fid);
}



//修改标识： zzs20090219
//修改描述： 添加获取的url中含有如-->"http://localhost/Strongsoft.Web.putian/MessageList.aspx?fi=233&ci=63&pi=3"
//的pi=3信息时截取为"http://localhost/Strongsoft.Web.putian/MessageList.aspx?fi=233&ci=63"的功能从而使得
//在点击MessageList.aspx页面左侧的栏目信息时的url是正确，而不含有&pi=3参数

function LeftLocChange(cid)
{
var url= SetUrlPara("ci",cid);

if (url.substring(0,url.lastIndexOf("&")).indexOf("ci=") >= 0){
	url=url.substring(0,url.lastIndexOf("&"));
}
	window.location.href =url
}

function changeImg(mypic){ 
    var xw=130; 
    var xl=160; 
 
    var width = mypic.width; 
    var height = mypic.height; 
                     
    if (width > xw ) mypic.width = xw; 
    if (height > xl ) mypic.height = xl; 
} 

/*
辅助方法
by jmz
build time:2007-10-30
*/

function $(name)
{
	return document.getElementById(name);
}