//动态设置iframe高度 var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1] //extra height in px to add to iframe in FireFox 1.0+ browsers var FFextraHeight=getFFVersion>=0.1? 16 : 0 function dyniframesize(iframename) { var pTar = null; if (document.getElementById){ pTar = document.getElementById(iframename); } else{ eval('pTar = ' + iframename + ';'); } if (pTar && !window.opera){ //begin resizing iframe pTar.style.display="block" if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){ //ns6 syntax pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; } else if (pTar.Document && pTar.Document.body.scrollHeight){ //ie5+ syntax pTar.height = pTar.Document.body.scrollHeight; } } } //调查申请验证 function isValid(form) { if(form.name.value == "") { alert("请输入您的姓名!"); form.name.focus(); return false; } else if(form.phone.value == "") { alert("请输入您的电话!"); form.phone.focus(); return false; } else if(form.address.value == "") { alert("请输入您的通信地址!"); form.address.focus(); return false; } else if(form.title.value == "") { alert("请输入理由!"); form.title.focus(); return false; } else if(form.content.value == "") { alert("请输入内容!"); form.content.focus(); return false; } else { return true; } } //删除前后空格 function LTrim(s) { for(var i=0;i=0;i--) if(s.charAt(i)!=' ') return s.substring(0,i+1); return ""; } function Trim(s) { return RTrim(LTrim(s)); } //显示导航 function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt) { var nCurrIndex = _nCurrIndex || 0; document.write("当前第" + (nCurrIndex+1) + "页 | 共" + _nPageCount + "页 | "); if(nCurrIndex == 0) { document.write("首页 | "); document.write("上一页 | "); if(_nPageCount > 1) { document.write("下一页 | "); document.write("尾页"); } else { document.write("下一页 | "); document.write("尾页"); } } else if(nCurrIndex == _nPageCount-1) { document.write("首页 | "); if(nCurrIndex > 1) { document.write("上一页 | "); } else { document.write("上一页 | "); } document.write("下一页 | "); document.write("尾页"); } else { document.write("首页 | "); if(nCurrIndex == 1) { document.write("上一页 | "); } else { document.write("上一页 | "); } if(nCurrIndex == _nPageCount-1) { document.write("下一页 | "); } else { document.write("下一页 | "); } document.write("尾页"); } } //===============goto()直接跳转函数============================================= function goto(_nPageCount, _nCurrIndex, _sPageName, _sPageExt) { var page = document.getElementById("CP").value; if(isNaN(page)) { alert("请输入正确的页码!"); } else { var pagenum = parseInt(page, 10); if(pagenum < 1 || pagenum > _nPageCount) { alert("请输入正确的页码!"); } else { if(pagenum == 1) document.location.href = _sPageName+"."+_sPageExt; else document.location.href = _sPageName+"_" + (pagenum-1) +"."+_sPageExt; } } } //设置页码 function setPagenum(_nCurrIndex) { var nCurrIndex = _nCurrIndex || 0; document.getElementById("CP").value = _nCurrIndex + 1; } //设置颜色 function changeChnlFont(_chnlnames) { var aryChnl = _chnlnames.split(";"); for(var i=1; i" + document.getElementById("T"+aryChnl[i]).innerHTML + ""; } else if(document.getElementById(aryChnl[i]) != null) { //alert(document.getElementById(aryChnl[i]).innerHTML); document.getElementById(aryChnl[i]).innerHTML = "" + document.getElementById(aryChnl[i]).innerHTML + ""; } } } //设置颜色 function changeFont(_ChannelID) { document.getElementById(_ChannelID).className = "li"; } //隐藏频道名 function hideChannel(_ChannelID) { document.getElementById(_ChannelID).style.display = "none"; } //输出序号 function writeIndex(_index, _url, _pagesize) { var pagenum = 0; if(_url.indexOf("_") > 0) { pagenum = parseInt(_url.substring(_url.indexOf("_") + 1)); } _index = pagenum * _pagesize + _index; var sIndex = "" + _index; while(sIndex.length <= 4) { sIndex = "0" + sIndex; } document.write(sIndex); } //如果doctitle2不为空,则输出doctitle2,否则输出doctitle function writeTitle(_url, _docpeople, _doctitle, _class, _titlecolor, _orgdocpeople, _orgdoctitle) { document.write(""); //输出标题颜色 if(_titlecolor != null && _titlecolor != "") { document.write(""); } //输出标题 if(_docpeople != null && _docpeople != "") { document.write(_docpeople); } else { document.write(_doctitle); } //输出标题颜色 if(_titlecolor != null && _titlecolor != "") { document.write(""); } document.write(""); } //检索 function setSearchword(form) { //检索词 var keyword = Trim(form.keyword.value); if(keyword == "") { alert("请输入检索词!"); return false; } else if(keyword.indexOf("'") >= 0) { alert("检索词中不能含有单银号“'”!"); return false; } //字段 if(form.searchfield != null) { var field = form.searchfield.value; if(field == "") { keyword = "DOCAUTHOR='%" + keyword + "%' OR DOCTITLE='" + keyword + "' OR DOCCONTENT='" + keyword + "'"; } else if(field == "DOCAUTHOR") { keyword = field + "='%" + keyword + "%'"; } else { keyword = field + "='" + keyword + "'"; } } //数据库 var aryDb = document.getElementsByName("searchdb"); var mydb=""; if(aryDb != null) { for(var i=0; i='" + form.docreltime.value + "'"; } if(form.docreltime2 != null && form.docreltime2.value != "") { if(keyword != "") keyword = keyword + " " + sRel + " "; keyword = keyword + "DOCRELTIME<='" + form.docreltime2.value + "'"; } if(form.docsource != null && form.docsource.value != "") { if(keyword != "") keyword = keyword + " " + sRel + " "; keyword = keyword + "CHNLNAME='%" + form.docsource.value + "%'"; } if(form.dockeywords != null && form.dockeywords.value != "") { if(keyword != "") keyword = keyword + " " + sRel + " "; keyword = keyword + "DOCKEYWORDS='%" + form.dockeywords.value + "%'"; } } //普通检索 if(keyword == "") { alert("请输入检索词!") return false; } if(form.secondsearch != null) { if(form.searchword.value != "" && form.secondsearch.checked) { keyword = keyword + " and " + form.searchword.value; } } if(form.chnlname != null && form.chnlname != "") { if(keyword.indexOf("DOCTITLE")) keyword = "DOCTITLE='" + keyword + "' and (CHNLNAME='" + form.chnlname.value + "')"; } form.searchword.value = keyword; } function sendRecommend(form) { var str0,str1,str2,str3,str4,str; if (!validEmail(form.friendEmail.value)) { alert(' 朋友的Email可能打错了或为空的!'); return false; } var sInfo = "◆◆◆中国社会保障网新闻◆◆◆\n"; sInfo += "您好!\n"; sInfo += "您的朋友向您推荐中国社会保障网新闻:\n"; sInfo += "“" + form.title.value + "”\n"; sInfo += "链接网址是:\n" + this.location; form.Subject.value = "推荐新闻"; form.Context.value = sInfo; form.action="mailto:" + form.friendEmail.value; return true; } function validEmail(_email) { if (_email == "" || (_email.indexOf ('@') == -1) || (_email.indexOf ('.') == -1)) return false; return true; } function setAppendix() { if(document.getElementById("idappendix") != null && document.getElementById("idappendix").innerHTML != "") { document.getElementById("idappendixdesc").style.display = "block"; document.getElementById("idappendixlist").style.display = "block"; } }