home *** CD-ROM | disk | FTP | other *** search
Wrap
var modified=true; var errPositive = "Enter a number greater than zero"; var errEmail = "Enter a valid email address of the form mailbox@domain.com"; var errEmailList = "Enter a valid email address of the form mailbox@domain.com.\nYou can send to multiple addresses by separating them with semi-colons ';'"; var errMailbox = "Enter a valid mailbox name"; var errDomain = "Enter a valid domain name, e.g. domain.com"; var errPeriod = "Enter a valid period, i.e. a number followed by s, m, h, or d"; var errScript = "Enter a valid script file (.fts), e.g. script.fts "; var errBytes = "Enter a valid size, i.e. a number followed by b, Kb, Mb, or Gb"; var errPort = "Enter a port number, i.e. a number between 0 and 65535"; var errIP = "Enter a valid IP address, e.g. 192.168.0.1"; var errSubnet = "Enter a valid subnet mask, e.g. 255.255.128.0"; var errNumber = "Enter a number"; setModified(false); if (!document.images) {} else { left0 = new Image(); left0.src = dir+"leftup.gif"; left1 = new Image(); left1.src = dir+"leftupon.gif"; } function getParm(string,parm) { // returns value of parm from string var startPos = string.indexOf(parm + "="); if (startPos > -1) { startPos = startPos + parm.length + 1; var endPos = string.indexOf("&",startPos); if (endPos == -1) endPos = string.length; return unescape(string.substring(startPos,endPos)); } return ''; } var passed = location.search.substring(1); function round(val) { var a = val; a = a.toString(); var dot = a.indexOf("."); if (dot!=-1) { if (a.slice(dot+1, dot+2)=="0") a = a.slice(0, dot); else a = a.slice(0, dot+2); } return a; } function niceBytes(bytes) { if (bytes < 1024) document.write(bytes); else if (bytes <1024*1024) document.write(round(bytes/1024)+"Kb"); else if (bytes<1024*1024*1024) document.write(round(bytes/(1024*1024))+"Mb"); else document.write(round(bytes/(1024*1024*1024))+"Gb"); } function sigFigs(number, figs) { return Math.round(Math.round(number*figs)/figs); } function toNiceBytes(bytes) { if (bytes < 1024) return bytes; else if (bytes <1024*1024) return round(bytes/1024,1)+"Kb"; else if (bytes<1024*1024*1024) return round(bytes/(1024*1024),10)+"Mb"; else return round(bytes/(1024*1024*1024),100)+"Gb"; } function niceDate(numDate) { if (numDate==0) document.write(" ") else { d = new Date(); d.setTime(numDate*1000); s = new String(); if (navigator.appName.indexOf("Netscape",0)!=-1) s = d.toLocaleString(); else { s = d.toString(); var i = s.indexOf('U'); if (i!=-1) s = s.slice(0,i-1); } document.write(s); } } function navSet(index) { var loop=1; var color; var bkgnd; var hover; if (document.styleSheets) { if (getCookie("nav")==index) return; for (loop=1; loop<10; loop++) { if (loop==index) { color="white"; bkgnd="black" hover="white"; } else { color="black"; bkgnd="skyblue"; hover="red"; } parent.header.document.styleSheets[0].addRule("A.nv"+loop, "color:"+color); parent.header.document.styleSheets[0].addRule("A.nv"+loop+":visited", "color:"+color); parent.header.document.styleSheets[0].addRule("A.nv"+loop+":hover", "color:"+hover); parent.header.document.styleSheets[0].addRule("TD.nv"+loop, "background:"+bkgnd); } setCookie("nav", index, false); } } function setPage(index, title) { if (parent.header) { if (navigator.appName.indexOf("Netscape",0)==-1) { if (parent.header.heading) { if (parent.header.heading.title) { parent.header.heading.title.value=title; navSet(index); if (!document.images) {} else { if (index==1) parent.header["left"].src = "/images/leftup-s.gif"; else parent.header["left"].src = "/images/leftup.gif"; if (index==9) parent.header["right"].src = "/images/right-s.gif"; else parent.header["right"].src = "/images/right.gif"; } } else setTimeout("setPage("+index+", '"+title+"')", 500); } else setTimeout("setPage("+index+", '"+title+"')", 500); } else { var str = ""; var href=parent.header.location.href; var pos=href.indexOf("title=") if (pos!=-1) str = href.slice(pos+6, href.length); if (str!=title) parent.header.location.href="/header.fts?index="+index+"&title="+title } } } function setModified(flag) { if (modified!=flag) { modified=flag; setCookie("modified", flag, false); } } function getModified() { return modified; } function getModifiedRemote() { return getCookie("modified")=="true"; } function onLog() { var log = window.open("/log/index.fts", "_blank", "toolbar=0,location=0,status=0,menubar=0,resizable=1"); log.focus(); } function checkModified() { if (getModified()) { if (!window.confirm("Discard changes?")) return false; } return true; } function st(text) { if (text) window.status=text; else window.status=window.defaultStatus; return true; } function onHelp() { var index; var s=parent.main.location.href; s = s.slice(s.indexOf("/",7)+1); if ((index=s.indexOf("?"))!=-1) s=s.slice(0, index); var help = window.open("/help/index.fts?href="+s, "WebMailHelp", "toolbar=1,menubar=1,location=0,resizable=1,scrollbars=1"); // var help = window.open("/help.fts?href="+s, "WebMailHelp"); help.focus(); } function isEmail(string) { if (string.search(/^\w+((=\w+)|(\$\w+)|(-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1) return true; else return false; } function isEmailList(string) { var start=0; while (string.charAt(start)==' ') start++; var pos = string.indexOf(";", 0); if (pos==-1 && start>=string.length) return false; if (start>string.length) pos=-1; while(pos!=-1) { if (!isEmail(string.slice(start, pos))) return false; start = pos+1; while (string.charAt(start)==' ') start++; pos = string.indexOf(";", start); } if (start<string.length) { if (!isEmail(string.slice(start, string.length))) return false; } return true; } function isDomain(name) { if (name.search(/^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1) return true; else return false; } function isAddr(addr) { if (addr.search(/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/)!=-1) return true; else return false; } function isDigit(c) { switch (c) { case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": return true; } return false; } function isNumber(number) { var index=0; if (number=="") return true; while (isDigit(number.charAt(index))) index++; return index==number.length; } function isPort(port) { return isNumber(port)&&(port>=0)&&(port<65536); } function isBytes(bytes) { var index=0; if (bytes=="") return true; while (isDigit(bytes.charAt(index))) index++; if (index==bytes.length) return true; if (bytes.charAt(index)==".") { index++; if (index==bytes.length) return true; while (isDigit(bytes.charAt(index))) index++; if (index==bytes.length) return true; } switch (bytes.charAt(index)) { case "b": case "B": index++; break; case "k": case "K": case "m": case "M": case "g": case "G": index++; if (bytes.charAt(index)!="b" && bytes.charAt(index)!="B") return false; index++; break; default: return false; } return (index==bytes.length) } function isScript(script) { if (script.length<5) return false; if (script.slice(script.length-4)!=".fts") return false; return true; } function isPositive(number) { return isNumber(number)&&(number>0); }