function rnd()
{
var rndL = Math.ceil(Math.random()*1000000);
return rndL;
}
function trim(str)
{
return str.replace(/ +/,"").replace(/ +$/,"");
}
function isIE(){
return (isFirefox=navigator.userAgent.indexOf("MSIE") >= 0) ? true : false;
}
function isEmail(strMail)
{
var objReg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
if(strMail.length==0)
return false;
return (objReg.test(strMail));
}
function addSpace(space, bgcolor)
{
document.write("");
}
//var g_xmlHttp;
function processReqChange()
{
return;
}
function sleep(n)
{
var start = new Date().getTime();
while(true) if(new Date().getTime()-start>n) break;
}
var g_tmp_txt;
var g_xmlHttp;
function compressResult(url, params)
{
var style = "";
if (params == null || params == "")
style = "GET";
else
style = "POST";
if (isIE())
{
var len = 0;
if (params != null)
len = params.length;
var result;
var XMLHTTP;
try {
XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
if(!XMLHTTP) XMLHTTP = new ActiveXObject("MSXML2.XMLHTTP");
}
catch(e) {
//alert("XMLHTTPRequest(IE 7)");
return "";
}
XMLHTTP.Open(style, encodeURI(url), false);
XMLHTTP.setRequestHeader("Content-Length", len);
XMLHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
XMLHTTP.Send(params);
if(XMLHTTP.readyState==4) {
if(document.defaultCharset=="utf-8" && navigator.userLanguage=="zh-cn") {
result = unescape(XMLHTTP.responseText);
}
else
{
result = XMLHTTP.responseText;
}
}
else {
result = "";
}
delete XMLHTTP;
return result;
}
else
{
g_tmp_txt = "";
g_xmlHttp = new XMLHttpRequest();
g_xmlHttp.onreadystatechange = processReqChange;
g_xmlHttp.open(style, url, false);
g_xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
g_xmlHttp.send(params);
if(g_xmlHttp.readyState == 4) {
if(g_xmlHttp.status == 200){
g_tmp_txt = g_xmlHttp.responseText;
}
}
delete g_xmlHttp;
return g_tmp_txt;
}
}
function parseServerIP(url)
{
var url2 = url.toLowerCase();
var ik = url2.indexOf("http://");
if (ik > -1)
{
url2 = url2.substring(ik + 7, url2.length);
}
for(var i = 0; i -1)
{
url2 = url2.substring(ik + 7, url2.length);
}
var x = 0;
for(var i = 0; i 0)
return url2.substring(x + 1, i);
else
return "80";
}
if (url2.charAt(i) == ":")
{
x = i;
}
}
if (x > 0)
{
return url2.substring(x + 1, url2.length);
}
return 80;
}
function getRequestUrl(url)
{
var x = 0;
var y = url.length;
for(var i = url.length - 1; i >= 0; i--)
{
if (url.charAt(i) == '?')
y = i;
if (url.charAt(i) == '/')
{
x = i;
for(var j = x + 1; j < y; j++)
{
if (url.charAt(j) == '#')
return url.substring(x + 1, j);
}
return url.substring(x + 1, y);
}
}
return url;
}
function getUrlParam(url, ParamName)//得到URL里面的某个参数
{
var paramPos = url.indexOf(ParamName);
if (paramPos >= 0)
{
var startpos = paramPos + ParamName.length + 1;
var endPos = url.indexOf("&", paramPos);
if (endPos >= 0)
{
return url.substr(startpos, endPos - startpos);
}else
return url.substr(startpos);
}else
return "";
}
//写cookies函数
function setCookie(name, value, days)//两个参数,一个是cookie的名子,一个是值
{
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)//取cookies函数
{
var arr = document.cookie.match(new RegExp("(^| )" + name+"=([^;]*)(;|$)"));
if(arr != null)
return unescape(arr[2]);
return null;
}
function delCookie(name)//删除cookie
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
function getFileKeys(itemName)
{
var ik = 0;
var fileKeys = new Array();
var file_obj = document.getElementsByName(itemName);
for (i=0; i < file_obj.length; i++)
{
if (file_obj[i].checked == true)
{
fileKeys[ik] = file_obj[i].value;
ik++;
}
}
return fileKeys;
}
function getKeyIdTxt(fileKeys)
{
var txt = "";
for (i=0; i < fileKeys.length; i++)
{
txt = txt + fileKeys[i] + "_";
}
return txt;
}
///////////////////////////////////在线编辑/////////////////////////////////////
function getActivexObj()
{
var activeObj = document.getElementById("idoc_ocx1");
try
{
if (activeObj == null)
{
var div = document.createElement("div");
document.body.appendChild(div);
div.id = "_active_div_01";
div.style.display = "none";
div.innerHTML = "";
activeObj = document.getElementById("idoc_ocx1");
}
if (activeObj.GetOcxEdition() < "2.3.1.1")
{
showActivePage(1);
return null;
}
if (activeObj.FileAccessPower <= 1)
{
showActivePage(2);
return null;
}
activeObj.ServerIp = parseServerIP(window.location.href) + "#" + parseServerPort(window.location.href);
var s = compressResult("/batchfilestran?opr=ucode&rnd=" + rnd());
activeObj.SaveUsrInfo2(s);
activeObj.VerUpdate();
return activeObj;
}
catch (e)
{
//showActivePage(1);
return null;
}
}
function showActivePage(mode)
{
var swin = new CreateSubWindow();
if (isIE())
{
var s = "";
if (mode == 2)
{
alert("文档批量传输Activex控件没有读写文件的权限,如果您的操作系统vista/win7/win2008, 请以管理员身份运行IE(系统菜单的'开始'->'程序'->鼠标移动到IE处,单击右键->以管理员身份运行),其他操作系统请参考帮助设置控件!");
}
if (mode == 1)
{
swin.newWinWithUrl("/batchfilestran?opr=page&mode=" + mode + "&rnd=" + rnd(), 660, 400, "文档批量传输控件安装", "", null);
}
if (mode == 3)
{
swin.newWinWithUrl("/batchfilestran?opr=page&mode=" + mode + "&rnd=" + rnd(), 640, 400, "工程文件预览控件安装", "", null);
}
}
else
{
swin.newWinWithUrl("/batchfilestran?opr=page&mode=4&rnd=" + rnd(), 640, 400, "浏览器设置", "", null);
}
}
function Edit(filekey)
{
var activeObj = getActivexObj();
if (activeObj != null)
{
activeObj.EditOnline(filekey, "");
}
}
function ShowMsgClient()
{
var activeObj = getActivexObj();
if (activeObj != null)
{
activeObj.ShowMsgClient();
}
}
function GetObject(id){
return document.getElementById(id);
}
function CreateObject(t){
return document.createElement(t);
}
//解析Ajax弹出页面的函数
function ParseAjaxFun(allTxt)
{
var _htmlTxt = allTxt;
var _jsTxts = new Array();
var _jsCount = 0;
function getScript(index, index2)
{
if (index2 - 8 <= 0) //
return false;
var s = _htmlTxt.substring(index2 - 8, index2 + 1).toLowerCase();
if (s != "")
return false;
index = _htmlTxt.indexOf('>', index) + 1;
//
for(var i = index2 - 9; i > 0; i--)
{
ch = _htmlTxt.charAt(i);
if (ch =='>' || ch =='-' || ch =='/' || ch <= " ")
continue;
index2 = i + 1;
break;
}
_jsTxts[_jsCount] = _htmlTxt.substring(index, index2);
_jsCount++;
return true;
}
function isScript(index)
{
if (index + 8 >=_htmlTxt.length || _htmlTxt.charAt(index + 1).toLowerCase() != 's')
return false;
var s = _htmlTxt.substring(index, index + 8).toLowerCase();
var ik = s.indexOf("