/**
 * 标题：福田信息网TRS WCM模板公用函数
 * 作者：TRS信息技术有限公司(www.trs.com.cn)
 * 部门：广州办事处
 * 撰写：林向荣
 * 创建日期：2002.10.18
 * 最后修改：2002.12.23/2002.12.27/2003.01.05
 * TRS公司版权所有(All Copyright Reserved).
**/

//进行福田信息网的初始化
//例如用来弹出广告式窗口
function initWebSite(){
  //showPopWindow("pop.htm");	
}

//显示弹出窗口
//如宣传性或祝语贺词等
function showPopWindow(sURL){
  window.open(sURL,"福田信息网","height=300,width=400,resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");	
}

//弹出网上咨询弹出式窗口
function openConsultationWindow(sChnlId){  
  var sURL = "/xuser/consultation.jsp?ChnlId="+sChnlId;
  window.open(sURL,"福田信息网","height=450,width=500,resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
}

//-------------------------------------------------------------------
//检索某年、月、日新闻
//福田要闻概览所用
function searchNewsByTime()
{
	var NewsYear,NewsMonth,NewsDate;	//注意Date.getDate()得到当前日期而Date.getDay()得到的是星期几
	var today = new Date();	


	NewsYear = document.all.NewsYear.options[document.all.NewsYear.selectedIndex].value;
	if (NewsYear == null || NewsYear.length==0)
	  NewsYear = today.getYear();
	
	NewsMonth = document.all.NewsMonth.options[document.all.NewsMonth.selectedIndex].value;
	if (NewsMonth == null || NewsMonth.length==0)
	  NewsMonth = today.getMonth();
	
	NewsDate = document.all.NewsDate.options[document.all.NewsDate.selectedIndex].value;
	if (NewsDate == null || NewsDate.length==0)
	  NewsDate = today.getDate();
	
	document.all.SearchNewsByTimeForm.method = "post";
	document.all.SearchNewsByTimeForm.searchword.value = "DOCRELTIME='"+NewsYear+"."+NewsMonth+"."+NewsDate+"'";
	document.all.SearchNewsByTimeForm.action = "/was40/search";
    	document.all.SearchNewsByTimeForm.submit();
		
}
// 改版时改为不使用WAS检索而是直接在WCM数据库中检索 linxr@2003-11-18
function searchDynNewsByTime(){
  	var NewsYear,NewsMonth,NewsDate;	//注意Date.getDate()得到当前日期而Date.getDay()得到的是星期几
	var today = new Date();	


	NewsYear = document.all.NewsYear.options[document.all.NewsYear.selectedIndex].value;
	if (NewsYear == null || NewsYear.length==0)
	  NewsYear = today.getYear();
	
	NewsMonth = document.all.NewsMonth.options[document.all.NewsMonth.selectedIndex].value;
	if (NewsMonth == null || NewsMonth.length==0)
	  NewsMonth = today.getMonth();
	
	NewsDate = document.all.NewsDate.options[document.all.NewsDate.selectedIndex].value;
	if (NewsDate == null || NewsDate.length==0)
	  NewsDate = today.getDate();
		
	var NextDate = new Number(NewsDate) + 1;
	  
	document.all.SearchNewsByTimeForm.method = "post"; 
	document.all.SearchNewsByTimeForm.where.value = "DOCRELTIME>=to_date('"+NewsYear+"/"+NewsMonth+"/"+NewsDate+"','YYYY/MM/DD') AND DOCRELTIME<=to_date('"+NewsYear+"/"+NewsMonth+"/"+NextDate+"','YYYY/MM/DD')";
	//document.all.SearchNewsByTimeForm.where.value = "DOCRELTIME<='2003-11-13'";
	//alert(document.all.SearchNewsByTimeForm.where.value	);
	//document.all.SearchNewsByTimeForm.action = "index.jsp";
    	//document.all.SearchNewsByTimeForm.submit();
}


//按关键字检索新闻
//福田要闻概览所用
function searchNewsByKeyword()
{
	var s = "%"+trim(document.all.SearchNewsByKeywordForm.inputword.value)+"%";
	document.all.SearchNewsByKeywordForm.searchword.value = s;
	document.all.SearchNewsByKeywordForm.method = "post";
	document.all.SearchNewsByKeywordForm.action = "/was40/search";
	document.all.SearchNewsByKeywordForm.submit();	
}
// 改版时改为不使用WAS检索而是直接在WCM数据库中检索 linxr@2003-11-18
function searchDynNewsByKeyword()
{
	  	
	var s = getWhere(trim(document.all.SearchNewsByKeywordForm.hitwords.value),document.all.SearchNewsByKeywordForm.field.value);
	document.all.SearchNewsByKeywordForm.where.value = s;		
	//document.all.SearchNewsByKeywordForm.method = "post";
	//document.all.SearchNewsByKeywordForm.action = "index.jsp";
	document.all.SearchNewsByKeywordForm.submit();	
}


//去掉输入字符串首尾空格
//福田要闻概览所用
/*
function trim(inputString) {
	// Removes leading and trailing spaces from the passed string. Also removes
	// consecutive spaces and replaces it with one space. If something besides
	// a string is passed in (null, custom object, etc.) then return the input.
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") { // Check for spaces at the beginning of the string
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { // Check for spaces at the end of the string
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
	}
	return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function
*/

//判断页面元素值是否为空
function isNullValue(sIDValue){
  var oElement = document.getElementById(sIDValue);
  if (oElement==null){
    alert("isNullValue('"+sIDValue+"')函数错误：找不到该元素！");
    return;
  }
  
  if (trim(oElement.value)==""){
    return true;
  }
  else{
    return false;
  }
}

//打印当前详细日期，包括年月日星期。
//福田要闻概览所用
function printCurDateDetail()
{
	
	
	var nowmonth,nowminutes;
	var today=new Date();

	nowmonth = today.getMonth()
	nowmonth = nowmonth+1
	nowminutes = today.getMinutes()

	var strmin=new String(nowminutes)

	document.write (today.getFullYear()+"年");
	document.write (nowmonth +"月");
	document.write (today.getDate()+"日 ");
	document.write (today.getHours()+":");

	if  (strmin.length == 1) {
		document.write ("0"+ today.getMinutes()+"&nbsp;&nbsp;");
	}else{
	  document.write (today.getMinutes()+"&nbsp;&nbsp;");
        }


        today=today.getDay()
        switch (today){
	case 0:
	document.write ("星期天")
	break;
	case 1:
	document.write ("星期一")
	break;
	case 2:
	document.write ("星期二")
	break;
	case 3:
	document.write ("星期三")
	break;
	case 4:
	document.write ("星期四")
	break;
	case 5:
	document.write ("星期五")
	break;
	case 6:
	document.write ("星期六")
	break;
        }
        
}


//输出年份的文本选择框，并设置默认值为当前年份
//用于福田信息网的要闻概览页面
function putSelectYear()
{
  var thisyear ;
  var today = new Date();
  thisyear = today.getYear();	
  document.write("<SELECT name=NewsYear>");
  
  if (thisyear=="2002")
    document.write("<option value=2002 selected>2002</option>");
  else
    document.write("<option value=2002>2002</option>");
  
  if (thisyear=="2003")
    document.write("<option value=2003 selected>2003</option>");
  else
    document.write("<option value=2003>2003</option>");
  
  if (thisyear=="2004")
    document.write("<option value=2004 selected>2004</option>");
  else
    document.write("<option value=2004>2004</option>");
  
  if (thisyear=="2005")
    document.write("<option value=2005 selected>2005</option>");
  else
    document.write("<option value=2005>2005</option>");  
  
                        
  document.write("</SELECT>");
  
}




//输出月份的文本选择框，并设置默认值为当前月份
//用于福田信息网的要闻概览页面
function putSelectMonth()
{
  var thismonth ;
  var today = new Date();
  thismonth = today.getMonth();		//thismonth值范围在0到11之间
  
  document.write("<SELECT name=NewsMonth>");
  

  if (thismonth=="0")	
    document.write("<option value=1 selected>01</option>");
  else
    document.write("<option value=1>01</option>");
  
  if (thismonth=="1")
    document.write("<option value=2 selected>02</option>");
  else
    document.write("<option value=2>02</option>");
  
  if (thismonth=="2")
    document.write("<option value=3 selected>03</option>");
  else
    document.write("<option value=3>03</option>");
  
  if (thismonth=="3")
    document.write("<option value=4 selected>04</option>");
  else
    document.write("<option value=4>04</option>"); 
    
  if (thismonth=="4")
    document.write("<option value=5 selected>05</option>");
  else
    document.write("<option value=5>05</option>");
  
  if (thismonth=="5")
    document.write("<option value=6 selected>06</option>");
  else
    document.write("<option value=6>06</option>"); 
  
  if (thismonth=="6")
    document.write("<option value=7 selected>07</option>");
  else
    document.write("<option value=7>07</option>"); 
  
  if (thismonth=="7")
    document.write("<option value=8 selected>08</option>");
  else
    document.write("<option value=8>08</option>"); 
  
  if (thismonth=="8")
    document.write("<option value=9 selected>09</option>");
  else
    document.write("<option value=9>09</option>"); 
  
  if (thismonth=="9")
    document.write("<option value=10 selected>10</option>");
  else
    document.write("<option value=10>10</option>"); 
  
  if (thismonth=="10")
    document.write("<option value=11 selected>11</option>");
  else
    document.write("<option value=11>11</option>"); 
  
  if (thismonth=="11")
    document.write("<option value=12 selected>12</option>");
  else
    document.write("<option value=12>12</option>"); 
  
                        
  document.write("</SELECT>");
  
}


//输出日期的文本选择框，并设置默认值为当前日期
//用于福田信息网的要闻概览页面
function putSelectDate()	//注意Date.getDate()得到当前日期而Date.getDay()得到的是星期几
{
  var thisdate ;
  var today = new Date();
  thisdate = today.getDate();	
  document.write("<SELECT name=NewsDate>");
  
  if (thisdate=="1")
    document.write("<option value=1 selected>01</option>");
  else
    document.write("<option value=1>01</option>");
  
  if (thisdate=="2")
    document.write("<option value=1 selected>01</option>");
  else
    document.write("<option value=1>01</option>");
   
  if (thisdate=="3")
    document.write("<option value=2 selected>02</option>");
  else
    document.write("<option value=2>02</option>");
  
  if (thisdate=="4")
    document.write("<option value=3 selected>03</option>");
  else
    document.write("<option value=3>03</option>");
  
  if (thisdate=="5")
    document.write("<option value=4 selected>04</option>");
  else
    document.write("<option value=4>04</option>"); 
    
  if (thisdate=="6")
    document.write("<option value=5 selected>05</option>");
  else
    document.write("<option value=5>05</option>");
  
  if (thisdate=="7")
    document.write("<option value=6 selected>06</option>");
  else
    document.write("<option value=6>06</option>"); 
  
  if (thisdate=="8")
    document.write("<option value=7 selected>07</option>");
  else
    document.write("<option value=7>07</option>"); 
  
  if (thisdate=="9")
    document.write("<option value=8 selected>08</option>");
  else
    document.write("<option value=8>08</option>"); 
  
  if (thisdate=="10")
    document.write("<option value=9 selected>09</option>");
  else
    document.write("<option value=9>09</option>"); 
  
  if (thisdate=="11")
    document.write("<option value=10 selected>10</option>");
  else
    document.write("<option value=10>10</option>"); 
  
  if (thisdate=="12")
    document.write("<option value=11 selected>11</option>");
  else
    document.write("<option value=11>11</option>"); 
  
  if (thisdate=="13")
    document.write("<option value=12 selected>12</option>");
  else
    document.write("<option value=12>12</option>");
    
  if (thisdate=="14")
    document.write("<option value=13 selected>13</option>");
  else
    document.write("<option value=13>13</option>");
   
  if (thisdate=="15")
    document.write("<option value=14 selected>14</option>");
  else
    document.write("<option value=14>14</option>");

  if (thisdate=="16")
    document.write("<option value=15 selected>15</option>");
  else
    document.write("<option value=15>15</option>");
  
  if (thisdate=="17")
    document.write("<option value=16 selected>16</option>");
  else
    document.write("<option value=16>16</option>");
  
    if (thisdate=="18")
    document.write("<option value=17 selected>17</option>");
  else
    document.write("<option value=17>17</option>");

  if (thisdate=="19")
    document.write("<option value=18 selected>18</option>");
  else
    document.write("<option value=18>18</option>");
    
  if (thisdate=="20")
    document.write("<option value=19 selected>19</option>");
  else
    document.write("<option value=19>19</option>");
  
  if (thisdate=="21")
    document.write("<option value=20 selected>20</option>");
  else
    document.write("<option value=20>20</option>");
  
  if (thisdate=="22")
    document.write("<option value=21 selected>21</option>");
  else
    document.write("<option value=21>21</option>");
  
  if (thisdate=="23")
    document.write("<option value=22 selected>22</option>");
  else
    document.write("<option value=22>22</option>");
  
  if (thisdate=="24")
    document.write("<option value=23 selected>23</option>");
  else
    document.write("<option value=23>23</option>");
  
  if (thisdate=="25")
    document.write(
    "<option value=24 selected>24</option>");
  else
    document.write("<option value=24>24</option>");
  
  if (thisdate=="26")
    document.write("<option value=25 selected>25</option>");
  else
    document.write("<option value=25>25</option>");
  
  if (thisdate=="27")
    document.write("<option value=26 selected>26</option>");
  else
    document.write("<option value=26>26</option>");
  
  if (thisdate=="28")
    document.write("<option value=27 selected>27</option>");
  else
    document.write("<option value=27>27</option>");
  
  if (thisdate=="29")
    document.write("<option value=28 selected>28</option>");
  else
    document.write("<option value=28>28</option>");
  
  if (thisdate=="30")
    document.write("<option value=29 selected>29</option>");
  else
    document.write("<option value=29>29</option>");
  
  if (thisdate=="31")
    document.write("<option value=30 selected>30</option>");
  else
    document.write("<option value=30>30</option>");
    
  document.write("<option value=31>31</option>");                        
  document.write("</SELECT>");
  
}

//办事指南所用函数	
function printCatalog(i){
  if (i==1)
    document.write("企业");
  else
    document.write("个人"); 
}
	
//市民办事指南及企业办事指南首页所用检索函数
//1 分类检索
function searchWASinCatalog(strCatalog,iType){
  document.SearchForm_Catalog.searchword.value = "TITLECOLOR='%"+strCatalog+"%'";	//TITLECOLOR是办事所属类别字段
  document.all.SearchForm_Catalog.method = "post";
  document.all.SearchForm_Catalog.action = "/was40/search";
  if (iType==0)
    document.SearchForm_Catalog.channelid.value = "37589";	//市民办事指南WAS频道
  else
    document.SearchForm_Catalog.channelid.value = "47140";	//企业办事指南WAS频道
  
  document.all.SearchForm_Catalog.submit();  
}	
// 改版时改为不使用WAS检索而是直接在WCM数据库中检索 linxr@2003-11-18
function searchWCMinCatalog(strCatalog,iType){
  var where = "";
  var action = ""; 
  where = "TITLECOLOR like '%"+strCatalog+"%'";	//TITLECOLOR是办事所属类别字段
  if (iType==0){    //市民办事
    where = where + " AND docid in (select docid from bszndoc where isperson=1)";
    action = "/smbs/smbs-outline.jsp";
  }  
  else if(iType==1){   //企业办事
    where = where + " AND docid in (select docid from bszndoc where isenterprise=1)"; 
    action = "/qybs/qybs-outline.jsp";
  }
  else if(iType==2){   //投资者
    where = where + " AND docid in (select docid from bszndoc where isinvestor=1)"; 
    action = "/tzz/tzz-outline.jsp";
  }
  else if(iType==3){   //旅游事
    where = where + " AND docid in (select docid from bszndoc where istourist=1)"; 
    action = "/lyz/lyz-outline.jsp";
  }  
  document.SearchForm_Catalog.where.value = where;  
  document.SearchForm_Catalog.action = action;
  document.SearchForm_Catalog.method = "post"; 
  document.SearchForm_Catalog.submit();  
}	

//2 分部门检索
function searchWASinDepartment(strDepartment,iType){
  document.SearchForm_Department.searchword.value = "CHNLNAME='%"+strDepartment+"_办事指南%'";	//CHNLNAME是部门频道名
  document.all.SearchForm_Department.method = "post";
  document.all.SearchForm_Department.action = "/was40/search";
  if (iType==0)
    document.SearchForm_Department.channelid.value = "37589";	//市民办事指南WAS频道
  else
    document.SearchForm_Department.channelid.value = "47140";	//企业办事指南WAS频道
  
  document.all.SearchForm_Department.submit();  
}
// 改版时改为不使用WAS检索而是直接在WCM数据库中检索 linxr@2003-11-18
function searchWCMinDepartment(strDepartment,iType){
  var where = "";
  var action = ""; 
  where = "DOCCHANNEL IN (SELECT CHANNELID FROM WCMCHANNEL WHERE CHNLNAME LIKE '%"+strDepartment+"_办事指南%')";	//CHNLNAME是部门频道名
  if (iType==0){    //市民办事
    where = where + " AND (DOCPRO=2 OR DOCPRO=3)";
    action = "/smbs/smbs-outline.jsp";
  }  
  else{   //企业办事
    where = where + " AND (DOCPRO=1 OR DOCPRO=3)"; 
    action = "/qybs/qybs-outline.jsp";
  }
  document.SearchForm_Department.where.value = where;  
  document.SearchForm_Department.action = action;
  document.SearchForm_Department.method = "post"; 
  document.SearchForm_Department.submit();  
}

//提交关键词到WAS进行检索 
//为便民服务、市民办事、企业办事所用
function searchWASinChannel()
{

	var s = "%"+trim(document.all.SearchForm.inputword.value)+"%";
	document.all.SearchForm.searchword.value = s;
	document.all.SearchForm.method = "post";
	document.all.SearchForm.action = "/was40/search";
	document.all.SearchForm.submit();
}
// 改版时改为不使用WAS检索而是直接在WCM数据库中检索 linxr@2003-11-18
function searchWCMinChannel(iType){  
  var action = "";
  if (iType==0){    //市民办事    
    action = "/smbs/smbs-outline.jsp";
  }  
  else{   //企业办事    
    action = "/qybs/qybs-outline.jsp";
  }
  document.all.SearchForm.method = "post";
  document.all.SearchForm.action = action;
  search();  
}
//------------------------------------------------------------------------------------------------------------
//以下是简繁体转换功能函数

//系统常量
var BIG5_CHARACTER_STRING = ":2002/b5/www.szft.gov.cn";	//看汉繁简通的特征字符串

//取得看汉特征字符串在当前页面的位置
function getBIG5CharacterIndex(strURL){  
  return strURL.indexOf(BIG5_CHARACTER_STRING);
}

/**函数功能：取得站点
 **1 如http://192.168.53.1/zfbm/ftwb/t0234234.htm，返回字符串http://192.168.53.1
 **2 如http://www.szft.gov.cn:2002/b5/zfbm/ftwb/t0234234.htm，返回字符串http://www.szft.gov.cn
**/
function getWebSite(strURL){
  var sUrl = strURL;
  
  var i;
  var iCount;
  var CHAR_SLASH_TIME;
  var iBIG5Index = getBIG5CharacterIndex(sUrl);  
  if (iBIG5Index<0){		//不是看汉翻译过的页面URL
    CHAR_SLASH_TIME = 3;
    i = 0;  
    iCount = 0;
    while (i<sUrl.length){
      if (sUrl.charAt(i)=='/'){
        ++iCount;
        if (iCount==CHAR_SLASH_TIME)//停止点
          break;
      }    
      i++; 
    }
  }  
  else
    i = iBIG5Index;

  if (i>=sUrl.length)		//如URL串为http://www.szft.gov.cn时，可能使i>=strURL.length
    sUrl = "";
  else    
    sUrl = sUrl.substring(0,i);  
  
  return sUrl;
}

/**
  *作用：取得相对路径的URL(包含本站点域名)
  *1 输入普通页面字符串：http://www.szft.gov.cn/zfbm/cl/jgjj/t20021203_1898.htm，将输出/zfbm/cl/jgjj/t20021203_1898.htm
  *2 输入看汉翻译过的页面字符串：http://www.szft.gov.cn:2002/b5/www.szft.gov.cn/zfbm/cl/jgjj/t20021203_1898.htm，将输出/zfbm/cl/jgjj/t20021203_1898.htm
**/ 
function getRelativeURL(strURL){
  var sUrl = strURL;
  
  var CHAR_SLASH_TIME;		//斜杠字符'/'次数
  if (getBIG5CharacterIndex(sUrl)>0)	//当前页面URL是看汉翻译过的页面URL
    CHAR_SLASH_TIME = 5;	//为5.因为http://www.szft.gov.cn:2002/b5/www.szft.gov.cn/zfbm/cl/jgjj/t20021203_1898.htm    
  else
    CHAR_SLASH_TIME = 3;	//为3.因为http://www.szft.gov.cn/zfbm/cl/jgjj/t20021203_1898.htm
   
   
  var i = 0;
  var iCount = 0; 
  while(i<sUrl.length){
    if (sUrl.charAt(i)=='/'){
      ++iCount;
      if (iCount==CHAR_SLASH_TIME)//停止点
        break;
    }
    i++;
  }
       
  if (i>=sUrl.length)		//如URL串为http://www.szft.gov.cn时，可能使i>=strURL.length
    sUrl = "";
  else    
    sUrl = sUrl.substring(i,sUrl.length);  
  
  return sUrl;
}

function toBIG5(){
  var strURL = document.URL;
  
  if (getBIG5CharacterIndex(strURL)>=0)		//如果已经是繁体页面，则不用翻译
    return;
  
  var strWebSite = getWebSite(strURL);
  var strRelativeURL = getRelativeURL(strURL);     
  window.location.href = strWebSite + BIG5_CHARACTER_STRING + strRelativeURL;  
}

function toGB(){
  var strURL = document.URL;
  
  if (getBIG5CharacterIndex(strURL)<0)		//如果已经是简体页面，则不用翻译
    return; 
  
  var strWebSite = getWebSite(strURL);
  var strRelativeURL = getRelativeURL(strURL);
  window.location.href = strWebSite + strRelativeURL;
}


//---------何强 Start----------

function popwin(uu,openWidth,openHeight) {
 	var newwin=window.open(uu,"airWin","top=100,left=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+openWidth+",height="+openHeight);
 	newwin.focus();
	return false;
	}
	
/*function openDlg(_sUrl,_sFeature){
  window.showModelessDialog(_sUrl,"",_sFeature);

}*/

 function openWin(_sUrl,_sTitle,_nWidth,_nHeight){

	var iLeft =(window.screen.availWidth-_nWidth)/2;
	var iTop  = (window.screen.availHeight-_nHeight)/2;
	
    
    var AtWnd = open( _sUrl,"",
     							  "left="+iLeft+",top="+iTop+",width="+_nWidth+",height="+_nHeight+
      							  ",menubar=no,status=no,titlebar=no,resizable=no,scrollbars=yes" );
    
    //AtWnd.moveTo( iLeft, iTop );

     AtWnd.focus();  //show the window
}

/*function openWin(_url){
    var sUrl=_url;
    var height = 550;
    var width = 700;
    showNewHtmlDlg(sUrl,'',"修改频道",height,width,true, 1);
}*/

//显示Html对话框
function showNewHtmlDlg(_sUrl,_sArgs,_sTitle,_sHeight,_sWidth, _bIsRefresh, _noSrcoll, _sPre){
	var sUrl="HtmlDialog.jsp?Width="+_sWidth+"&Height="+_sHeight;
    if(_sPre){
        sUrl = _sPre + sUrl ;
    }
    else
        sUrl = "/include/" + sUrl;

    if(_noSrcoll)
      sUrl += "&NoScroll=1";
    sUrl += "&myUrl="+filterToUrl(_sUrl);


	var sTop=(window.screen.availHeight-_sHeight)/2;
	var sLeft=(window.screen.availWidth-_sWidth)/2;
	var sFeatures="dialogHeight: "+_sHeight+"px; dialogWidth: "+_sWidth+"px; dialogTop: "+sTop+"; dialogLeft: "+sLeft+"; center: Yes; scroll:no;help: No; resizable: No; status: No;";

	var a;
    if(_sArgs==''){
	  a=new Array();
    }
    else a=_sArgs;

    //a[a.length]=_sUrl;

    //记录对话框标题
    a[a.length]=_sTitle;
    //记录关闭对话框需要执行的参数
    a[a.length]="";
    //记录是否刷新
	a[a.length]=_bIsRefresh;
    a[a.length]=false;

    var sValue=window.showModalDialog(sUrl,a,sFeatures);
    if(a[a.length-3].length>1)
        eval(a[a.length-3]);
     var ElBackUrl=document.getElementById("BackUrl");
     if(ElBackUrl){
         sUrl=ElBackUrl.value;
         if(a[a.length-2]&&a[a.length-1]){
          //对于频道树特殊处理
          if(document.Tree)
            refreshHref();
          else
            window.location.href=sUrl;
         }
     }
     //else alert("没有定义自身的链接！")
}

function filterToUrl(str){
	//str = encodeURI(str)
	str=replace(str,"%","%25");
    str=replace(str,"#","%23");
	str=replace(str,"?","%3F");
	str=replace(str,"/","%2F");
	str=replace(str,"=","%3D");
	str=replace(str,",","%2C");
	str=replace(str,";","%3B");
	str=replace(str,"&","%26");
    str=replace(str," ","%20");
	str=replace(str,"<","%3C");
	str=replace(str,">","%3E");
	str=replace(str,"'","%27");
	
	return str;
}

//替换字符串
function replace(str, replace_what, replace_with)
{
  var ndx = str.indexOf(replace_what);
  var delta = replace_with.length - replace_what.length;

  while (ndx >= 0)
  {
    str = str.substring(0,ndx) + replace_with + str.substring(ndx + replace_what.length);
    ndx = str.indexOf(replace_what, ndx + delta + 1);
  }
  return str;
}


	function doPrintSetup()
	{
		//打印设置
		cancelDividePage();
		WB.ExecWB(8,1);
	}
	function doPrintPreview()
	{
		//打印预览
		dividePage();
		WB.ExecWB(7,1);
		cancelDividePage();
	}
	function doPrint()
	{
		//打印当前页
		dividePage();
		WB.ExecWB(6,1);
		cancelDividePage();
	}
  
  //判断分辨率，对打印的页面高度进行设置
  var PAGE_HEIGHT  = 900;
	if ( screen.width==800 )
	{
		PAGE_HEIGHT = 900;
	} else if ( screen.width==1024 )
	{
		PAGE_HEIGHT = 630;
	} else {
		PAGE_HEIGHT = 900;
	}


	function dividePage()
	{
		var iNewHeight=0;
		var dPs = document.body.getElementsByTagName("Tr");

		
		for (i=0;i<dPs.length;i++)
		{
			iNewHeight += dPs[i].scrollHeight;
			
		}
	}

	function cancelDividePage()
	{
		var dPs = document.body.getElementsByTagName("Tr");

		for (i=0;i<dPs.length;i++)
		{
			if ( dPs[i].id == "divideFlagTitle" )
			{
				dPs[i].removeNode(true);
			}
			if ( dPs[i].id == "divideFlagTime" )
			{
				dPs[i].removeNode(true);
			}
			if ( dPs[i].id == "divideFlagCol" )
			{
				dPs[i].removeNode(true);
			}
		}
	}

 function showTongyi(){
	document.all.div1.style.visibility="visible";
	document.all.div2.style.visibility="hidden";
     }
  function NoshowTongyi(){

	document.getElementById("formlist").innerHTML=document.all.sformlist.value;
     }
//----------何强 end-------------


/**
  * 福田动态发布检索函数 linxr 2003.10.31
**/ 

//查询
function search(){		  
  var hitwords = trim(SearchForm.hitwords.value);
  if (hitwords==""){
    alert("请输入检索词！");
    return;
  }  
  SearchForm.hitwords.value = hitwords;    //设置为去掉首尾空格的字符串，为Outline正确反显
  var where;
  if (SearchForm.second.checked==true){
    if (trim(SearchForm.lastwhere.value)!="")
      where = getWhere(hitwords) + " AND "+ SearchForm.lastwhere.value;
    else
      where = getWhere(hitwords);
  }
  else{
     where = getWhere(hitwords);
  }   
   SearchForm.where.value = where;
   //alert(where);
   return true;
   //form1.submit();
}

//过滤字符串首尾半角和全角空格 by linxr 2003.10.16
//用于通用检索
function trim(str){
  if (str==null || str.length<=0)
    return str;
  
  var myRe;  //定义正则表达式变量
   
   //过滤字符串首尾半角和全角空格  
   myRe = /(^[\s　]*)|([\s　]*$)/gi;  
   str = str.replace(myRe,"");
 
 return str;    

}

//由检索输入字符串取得where字符串 by linxr 2003.10.16
//用于通用检索
 function getWhere(str,sFieldName){
   
   if (str==null || str.length<=0)
     return str;
     
   if (sFieldName==null || sFieldName.length<=0)
     sFieldName = "doctitle";  
   
   var myRe;  //定义正则表达式变量
   
   //代换字符串中间的半角和全角空格
   myRe = /[\s　]+/gi;
   if (myRe.test(str)){      //如果有空格，进行代换
     str = str.replace(myRe,"%' and "+sFieldName+" like '%");   
   }
   str = sFieldName + " like '%"+str+"%'";
   
   return str;
 }


  function goPage(){
    gotoPage(document.all.pagecount.value);
  }
//=======================================================  
/**
 *  字体大中小控制函数   陈志坚@2004.01.06
 */  
 
 function doZoom(size){
		
	   var 	arEls = document.all.tags("table");
		for( i=0;i<arEls.length;i++){
			//if(arEls[i].name=='title' )continue;
			arEls[i].style.fontSize=size+"px";
		}		
		arEls = document.all.tags("li");
		for( i=0;i<arEls.length;i++){
			arEls[i].style.fontSize=size+"px";
		}		

		arEls = document.all.tags("span");
		for( i=0;i<arEls.length;i++){
			arEls[i].style.fontSize=size+"px";
		}		

	}
	
function doPrint()
{
	var str="<html>";
	var article;
	var css;
	var strAdBegin="<!--NEWSZW_HZH_BEGIN-->";
	var strAdEnd="<!--NEWSZW_HZH_END-->";
	var strFontSize='【<A href="javascript:doZoom(16)">大</A> <A href="javascript:doZoom(14)">中</A> <A href="javascript:doZoom(12)">小</A>】'
	var strdoPrint="doPrint()";
	var strTmp;
	
	css="<style>"
	+"td,.f12{font-size:12px}"
	+".f24 {font-size:24px;}"
	+".f14 {font-size:14px;}"
	+".title14 {font-size:14px;line-height:130%}"
	+".l17 {line-height:170%;}"
	+"</style>";
	
	str +=	css;
	str +=	'<meta http-equiv="content-type" content="text/html; charset=gb2312">';
	str +=	'<title>'+document.title+'</title>';
	str +=	"<body bgcolor=#ffffff topmargin=5 leftmargin=5 marginheight=5 marginwidth=5 onLoad='window.print()'>";
	str +=	"<center>";
	str +=	"<table width=700 border=0 cellpadding=0 cellspacing=20 bgcolor=#F9FAF9><tr><td>";
	
	article=document.getElementById('article').innerHTML;
	if(article.indexOf(strAdBegin)!=-1){
		str +=article.substr(0,article.indexOf(strAdBegin));
		strTmp=article.substr(article.indexOf(strAdEnd)+strAdEnd.length, article.length);
	}else{
		strTmp=article
	}
	//str +=strTmp.substr(0,strTmp.indexOf(strFontSize));
	//strTmp=strTmp.substr(strTmp.indexOf(strFontSize)+strFontSize.length, strTmp.length);
	str += strTmp;
	//str +=strTmp.substr(0,strTmp.indexOf(strdoPrint));
	//str +="window.print()";
	//str +=strTmp.substr(strTmp.indexOf(strdoPrint)+strdoPrint.length, strTmp.length);
	str +=	"</td></tr></table>";
	str += "<br><TABLE cellSpacing=0 cellPadding=0 width=700 border=0 align=center><TBODY><TR><TD height=10></TD></TR><TR><TD align=middle bgColor=#F9FAF9>2004@版权所有 深圳市福田区人民政府</TD></TR><TR><TD height=10></TD></TR><TR><TD align=middle></TD></TR></TBODY></TABLE></CENTER></TD></TR></TBODY></TABLE>";
	str += "</center>";
	str +=	"</body></html>";
	document.write(str);
	document.close();
}

//=========================
function goDocRegion(nRegionId){
  if (SearchNewsByKeywordForm){
    SearchNewsByKeywordForm.where.value = "docregion="+nRegionId;
    SearchNewsByKeywordForm.submit();    
  }
  else{
    window.location.href = "index.jsp?where='docregion="+nRegionId+"'";    
  }
    
}	