/* * Date Format 1.2.3 * (c) 2007-2009 Steven Levithan * MIT license * * Includes enhancements by Scott Trenda * and Kris Kowal * * Accepts a date, a mask, or a date and a mask. * Returns a formatted version of the given date. * The date defaults to the current date/time. * The mask defaults to dateFormat.masks.default. */ var dateFormat = function () { var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, timezoneClip = /[^-+\dA-Z]/g, pad = function (val, len) { val = String(val); len = len || 2; while (val.length < len) val = "0" + val; return val; }; // Regexes and supporting functions are cached through closure return function (date, mask, utc) { var dF = dateFormat; // You can't provide utc if you skip other args (use the "UTC:" mask prefix) if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) { mask = date; date = undefined; } // Passing date through Date applies Date.parse, if necessary date = date ? new Date(date) : new Date; if (isNaN(date)) throw SyntaxError("invalid date"); mask = String(dF.masks[mask] || mask || dF.masks["default"]); // Allow setting the utc argument via the mask if (mask.slice(0, 4) == "UTC:") { mask = mask.slice(4); utc = true; } var _ = utc ? "getUTC" : "get", d = date[_ + "Date"](), D = date[_ + "Day"](), m = date[_ + "Month"](), y = date[_ + "FullYear"](), H = date[_ + "Hours"](), M = date[_ + "Minutes"](), s = date[_ + "Seconds"](), L = date[_ + "Milliseconds"](), o = utc ? 0 : date.getTimezoneOffset(), flags = { d: d, dd: pad(d), ddd: dF.i18n.dayNames[D], dddd: dF.i18n.dayNames[D + 7], m: m + 1, mm: pad(m + 1), mmm: dF.i18n.monthNames[m], mmmm: dF.i18n.monthNames[m + 12], yy: String(y).slice(2), yyyy: y, h: H % 12 || 12, hh: pad(H % 12 || 12), H: H, HH: pad(H), M: M, MM: pad(M), s: s, ss: pad(s), l: pad(L, 3), L: pad(L > 99 ? Math.round(L / 10) : L), t: H < 12 ? "a" : "p", tt: H < 12 ? "am" : "pm", T: H < 12 ? "A" : "P", TT: H < 12 ? "AM" : "PM", Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10] }; return mask.replace(token, function ($0) { return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); }); }; }(); // Some common format strings dateFormat.masks = { "default": "ddd mmm dd yyyy HH:MM:ss", shortDate: "m/d/yy", mediumDate: "mmm d, yyyy", longDate: "mmmm d, yyyy", fullDate: "dddd, mmmm d, yyyy", shortTime: "h:MM TT", mediumTime: "h:MM:ss TT", longTime: "h:MM:ss TT Z", isoDate: "yyyy-mm-dd", isoTime: "HH:MM:ss", isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" }; // Internationalization strings dateFormat.i18n = { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] }; // For convenience... Date.prototype.format = function (mask, utc) { return dateFormat(this, mask, utc); }; /* This handles menu block visibility. I think that it is quite fragile. * I've not touched this code since it first went into Maxim. * Updated to change menu styles for selected top level items and to let long entries scroll. */ //var dirtyMessage var iCountUp var countDirtyFlag var qwin = "" function togglemenu(i) { //block if (document.getElementById('menu' + i).style.display == 'inline-block') { document.getElementById('menu' + i).style.display = 'none'; document.getElementById('menulink' + i).style.fontWeight = 'normal'; document.getElementById('menulink' + i).style.letterSpacing = "0px"; document.getElementById('menulink' + i).style.backgroundColor = "#0F1123"; document.getElementById('menulink' + i).style.color = "white"; } else { for (j = 1; j <= 100; j = j + 1) { try { document.getElementById('menu' + j).style.display = 'none'; document.getElementById('menulink' + j).style.fontWeight = 'normal'; document.getElementById('menulink' + j).style.letterSpacing = "0px"; document.getElementById('menulink' + j).style.backgroundColor = "#0F1123"; document.getElementById('menulink' + j).style.color = "white"; } catch (err) { } } document.getElementById('menu' + i).style.display = 'inline-block'; document.getElementById('menulink' + i).style.fontWeight = 'bold'; document.getElementById('menulink' + i).style.letterSpacing = "1px"; document.getElementById('menulink' + i).style.backgroundColor = "white"; document.getElementById('menulink' + i).style.color = "#0F1123"; if (document.getElementById('menu' + i).clientHeight < 92) { //Are we small? 23n document.getElementById('menu' + i).style.overflowY = 'hidden'; //We don't need a scrollbar } else { //Otherwise document.getElementById('menu' + i).style.overflowY = 'scroll'; //I AM GIANT!!! FEAR MY SIZE AND SCROLL ME } //Back to sanity. } return false; } //This is called by every page. Only the login page has a clock. function updateClock() { try { var currentTime = new Date(); var currentHours = currentTime.getHours(); var currentMinutes = currentTime.getMinutes(); var currentSeconds = currentTime.getSeconds(); currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes; currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds; var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds; var currentDateString = currentTime.toLocaleDateString(); // Update the time display document.getElementById("clock").firstChild.nodeValue = currentTimeString; document.getElementById("datebox").firstChild.nodeValue = currentDateString; setTimeout('updateClock()', 1000) } catch (err) { } } //Allow number keys and decimal point and minus sign function isNumberKeyDecNeg(evt) { var keynum; var keychar; var numcheck; if (window.event) { //IE keynum = evt.keyCode; } else if (evt.which) { //NN keynum = evt.which; } keychar = String.fromCharCode(keynum); numcheck = /\d|\.|\-/; return numcheck.test(keychar); } //Allow number keys and decimal point function isNumberKeyDec(evt) { var keynum; var keychar; var numcheck; if (window.event) { //IE keynum = evt.keyCode; } else if (evt.which) { //NN keynum = evt.which; } keychar = String.fromCharCode(keynum); numcheck = /\d|\./; return numcheck.test(keychar); } //Allow number keys function isNumberKey(evt) { var keynum; var keychar; var numcheck; if (window.event) { //IE keynum = evt.keyCode; } else if (evt.which) { //NN keynum = evt.which; } keychar = String.fromCharCode(keynum); numcheck = /\d/; return numcheck.test(keychar); } function isAlphaNumKey(evt) { var keynum; var keychar; var numcheck; if (window.event) { //IE keynum = evt.keyCode; } else if (evt.which) { //NN keynum = evt.which; } keychar = String.fromCharCode(keynum); numcheck = /[a-zA-Z\d]/; return numcheck.test(keychar); } function isAlphaNumCharKey(evt) { var keynum; var keychar; var numcheck; if (window.event) { //IE keynum = evt.keyCode; } else if (evt.which) { //NN keynum = evt.which; } keychar = String.fromCharCode(keynum); numcheck = /[a-zA-Z\d,\.\?!£\$\ ]/; return numcheck.test(keychar); } //Row highlighting function ResetOne(i) { if (i != "") { ChangeRow(i, 'ListItem'); } } function ChangeRow(i, style) { var j = 0 try { document.getElementById("ListItem" + i).className = '' + style; } catch (err) { return } } function isNumber(value) { if (value == "") { return false; } return isFinite(value * 1.0); } function isWholeNumber(value) { str = value.toString(); for (var i = 0; i < str.length; i++) { var curValue = str.charAt(i); if (curValue < "0" || curValue > "9") { return false; } } return true; } function SelectAll(chl) { var j = 0 try { while (1 == 1) { document.getElementById(chl + "_" + j).checked = true; j++; } } catch (err) { } } function zeroPad(num, count) { var numZeropad = num + ''; while (numZeropad.length < count) { numZeropad = "0" + numZeropad; } return numZeropad; } function analyseSession(retval) { if (retval.split('|')[0] == "0") { document.location.href = "/logout.aspx"; } else { if (retval.split('|')[1] != "") { //if (dirtyMessage == 0) { document.body.style.backgroundColor = '232428'; //'#474851'; //'black'; //alert(retval.split('|')[1]); if (document.getElementById("StrongMessage")) { if (document.getElementById("StrongMessageText")) { document.getElementById("StrongMessageText").innerHTML = retval.split('|')[1]; } else { document.getElementById("StrongMessage").innerHTML = retval.split('|')[1]; } document.getElementById("StrongMessage").style.display = 'block'; } //dirtyMessage = 1; //} } else { document.body.style.backgroundColor = '#8E90A2'; if (document.getElementById("StrongMessage")) { document.getElementById("StrongMessage").style.display = 'none'; } } if (document.getElementById('imgNotes')) { document.getElementById('imgNotes').src = '/images/icon-notepad.jpg' + '?' + (new Date()).getTime(); } } } function pageLoad() { //dirtyMessage = 0; iCountUp = 0; window.detachEvent("onload", pageLoad); window.attachEvent("onunload", pageUnload); var sPage = location.pathname sPage = sPage.substring(sPage.lastIndexOf('/') + 1).toLowerCase(); //if (sPage != "" && sPage != "default.aspx") { proxies.UsersWS.IsValidSession.func = analyseSession; if (document.getElementById("txtPass")) { //If we have a login box, don't log us off. proxies.UsersWS.IsValidSession(0, 1); } else { proxies.UsersWS.IsValidSession(0, 0); } //} writeCookie(); IsValidSession(); countDirtyFlag = false; } function IsValidSession() { var sPage = location.pathname sPage = sPage.substring(sPage.lastIndexOf('/') + 1).toLowerCase(); var b; b = true; if (sPage == "logout.aspx") { b = false; } if (sPage == "" || sPage == "default.aspx") { if (document.getElementById("txtPass")) { b = false; } else { b = true; } } if (b) { //alert(sPage); iCountUp += 1; if (iCountUp > 14) { //check every 15 seconds if we have a sessoin. Short time when using it, long time when debugging it. Might go to 10. proxies.UsersWS.IsValidSession.func = analyseSession; proxies.UsersWS.IsValidSession(0, 0); iCountUp = 0; } //Do we need either of these techniques any more? I thought not. //document.getElementById("ScriptPane").innerHTML = readCookie() + ' vs 1200'; //window.status = 'Testing automatic redirect, timeout is 1200, current count is ' + readCookie() + ' ' + iCountUp; var iCookie iCookie = readCookie(); if (document.getElementById('sessioncountdown') != null) { //if (document.getElementById('BottomLabel') != null) { var now = new Date(); now.setSeconds(now.getSeconds() + 1200 - iCookie); //document.getElementById('BottomLabel').innerHTML = 'Current session will expire at ' + now; var laterdate = now; var earlierdate = new Date(); var tdiff = timeDifference(laterdate, earlierdate); document.getElementById('sessioncountdown').innerHTML = 'Auto close: ' + tdiff; if (tdiff.indexOf("-") == 0) { document.getElementById('sessioncountdown').innerHTML = 'Attempting close...'; } if (tdiff.indexOf("-1") == 0) { document.getElementById('sessioncountdown').innerHTML = 'Communication error'; countDirtyFlag = true; } document.getElementById('sessioncountdown').onclick = function() { alert('Current session will expire at ' + now.format('dd/mmm/yyyy HH:MM:ss')); return false; } //document.getElementById('BottomLabel').innerHTML = 'Current session will expire at ' + now + ' ' + timeDifference(laterdate, earlierdate); } } if (countDirtyFlag) { document.clear(); document.write('

Your Orion connection has expired

We were not able to return you to the log in screen. This is probably due to a network problem.

Click here to return to the log on screen manually.'); } else { if (iCookie > 1200) { document.location.href = "/logout.aspx"; } setTimeout("IsValidSession()", 1000); } } function timeDifference(laterdate, earlierdate) { var difference = laterdate.getTime() - earlierdate.getTime(); var sign = ''; var minutesDifference = Math.floor(difference / 1000 / 60); difference -= minutesDifference * 1000 * 60 var secondsDifference = Math.floor(difference / 1000); if (minutesDifference < 0) { secondsDifference = 60 - secondsDifference;minutesDifference += 1;sign = "-";} if (secondsDifference < 10) { secondsDifference = '0' + secondsDifference; } return /*'(' +*/sign + Math.abs(minutesDifference) + ':' + secondsDifference/* + ')'*/; } function writeCookie() { var sPage = location.pathname sPage = sPage.substring(sPage.lastIndexOf('/') + 1).toLowerCase(); var b; b = true; if (sPage == "logout.aspx") { b = false; } if (sPage == "" || sPage == "default.aspx") { if (document.getElementById("txtPass")) { b = false; } else { b = true; } } if (b) { var date = new Date(); var value = date.toString(); date.setTime(date.getTime() + (24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); document.cookie = "LastOp=" + value + expires + "; path=/"; } countDirtyFlag = false; } function readCookie() { var date = new Date(); var date2 = new Date(); var name = "LastOp" var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) { date2 = Date.parse(c.substring(nameEQ.length, c.length)); //return date + '\n' + date2; return Math.floor((date.getTime() - date2) / 1000); //.getTime();// - date2.getTime(); } } return null; } String.prototype.endsWith = function(str) { return (this.match(str + "$") == str) } function pageUnload() { window.detachEvent("onunload", pageUnload); try { qwin.close(); } catch (err) { } } window.attachEvent("onload", pageLoad); function OpenNotes(url) { try { qwin.close(); } catch (err) { } qwin = window.open("notes.aspx?r=1ef787dc-c670-4a69-8131-b43b76370695&p=" + url, "NotesWnd", "scrollbars=no,resizable=no,width=800,height=600,top=20,left=20") }