/*
The following errors were found when attempting to minify this file:
- Line 1699: Parse error. syntax error
- Line 1704: Parse error. syntax error
- Line 1705: Parse error. syntax error
- Line 1706: Parse error. 'try' without 'catch' or 'finally'
- Line 1708: Parse error. syntax error
- Line 1710: Parse error. syntax error
- Line 1712: Parse error. syntax error
- Line 1713: Parse error. missing ; before statement
- Line 1716: Parse error. syntax error
- Line 1718: Parse error. syntax error
- Line 1719: Parse error. syntax error
- Line 1720: Parse error. invalid return
- Line 1721: Parse error. syntax error
*/
///
///
///
///
//Callback global variables for Slideshow.
var callbackfnDocumentCenter = null;
var callbackfnSlideshowSave = null;
var $popUp_Slideshow = null;
var parentID_Slideshow = null;
var slideshowFolderDefault = '';
var numbersOnly = new RegExp('^[0-9]*$');
//Global variable for ThemeProperties modal
var $popup_ThemeProperties = null;
//Callback variables for Slideshow.
var SetCursorPosition = null;
// Prevents errors for Internet Explorer (modes prior to 9).
// They will occur unless the developer tools are open.
if (!window.console) {
var noop = function () { };
// Note: MSIE will override this once the dev. tools are open.
window.console = {
log: noop, clear: noop, warn: noop, error: noop, assert: noop,
dir: noop, count: noop, profile: noop, profileEnd: noop,
trace: noop, info: noop, memoryProfile: noop, memoryProfileEnd: noop,
exception: noop, debug: noop, dirxml: noop, group: noop, groupEnd: noop,
markTimeline: noop, time: noop, timeEnd: noop, groupCollapsed: noop
};
}
// User-agent sniffing for functions that rely on the user-agent
// to determine version of Safari. Avoid using this variable and
// check for the presence of features instead (best-practice).
var isWebKit = (navigator.userAgent.toLowerCase().indexOf('webkit') > -1);
// Determines if an array contains an object.
// Uses == equality, case-sensitive. a containsExact() could do === equality.
if (!Array.prototype.contains) {
Array.prototype.contains = function (item) {
for (var i = 0; i < this.length; i++) {
if (this[i] == item)
return true;
}
return false;
}
}
// Gets index of an item if it is present in the array, else returns -1.
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (item) {
for (var i = 0; i < this.length; i++) {
if (this[i] == item)
return i;
}
return -1;
}
}
// Implement ECMAScript 5 String.trim() and friends for browsers that
// don't have it (e.g. Firefox prior to 3.5, Internet Explorer 6, 7, 8).
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s+/g, "").replace(/\s+$/g, "");
}
String.prototype.trimLeft = function () {
return this.replace(/^\s+/g, "");
}
String.prototype.trimRight = function () {
return this.replace(/\s+$/g, "");
}
}
// Implement .NET-style left-padding method.
String.prototype.padLeft = function (desiredLength, paddingChar) {
paddingChar += '';
desiredLength = parseInt(desiredLength);
if (paddingChar.length > 1)
paddingChar = paddingChar.charAt(0);
else if (paddingChar.length < 1)
return this;
if (this.length >= desiredLength)
return this;
else {
var arr = new Array();
var padNum = desiredLength - this.length;
for (var i = 0; i < padNum; i++)
arr.push(paddingChar);
return arr.join('') + this;
}
}
// Implement .NET-style right-padding method.
String.prototype.padRight = function (desiredLength, paddingChar) {
paddingChar += '';
desiredLength = parseInt(desiredLength);
if (paddingChar.length > 1)
paddingChar = paddingChar.charAt(0);
else if (paddingChar.length < 1)
return this;
if (this.length >= desiredLength)
return this;
else {
var arr = new Array();
var padNum = desiredLength - this.length;
for (var i = 0; i < padNum; i++)
arr.push(paddingChar);
return this + arr.join('');
}
}
String.isNullOrEmpty = function (text) {
return (text == null || text == '');
}
// Adds static method to regular expressions that escapes meta-characters.
if (!RegExp.metaEscape) {
RegExp.metaEscape = function (text) {
if (text == null)
return null;
else if (typeof (text) != "string")
text += '';
return text.replace(/(\\|\/|\<|\>|\:|\.|\*|\+|\?|\$|\[|\]|\(|\)|\{|\}|\||\&)/g, '\\$1');
};
}
// Copies text data to clipboard in WebKit browsers (Chrome/Safari).
function toWebkitClipboard(text) {
// Create element in DOM with text to copy.
var tmp = document.createElement('div');
tmp.textContent = text;
document.body.appendChild(tmp);
// Get current user selection, and remove selection current ranges.
var curSelection = window.getSelection();
curSelection.removeAllRanges();
// Create new selection range with DOM element containing text to copy.
var textRange = document.createRange();
textRange.selectNode(tmp);
curSelection.addRange(textRange);
// Execute COPY DHTML command.
document.execCommand("Copy");
// Clean-up.
document.body.removeChild(tmp);
}
// Copies value in stringVal to the clipboard, displaying the successMessage if hideAlert is false.
// NOTE: Replace this with something like toWebkitClipboard() at some point.
function toClipboardEx(stringVal, hideAlert, successMessage) {
if (window.clipboardData) { // Internet Explorer
if (!window.clipboardData.setData("Text", stringVal) && !hideAlert)
hideAlert = true;
}
else if ((window.WebKitPoint || !window.netscape) && !window.opera) {
toWebkitClipboard(stringVal);
}
else if (window.netscape) { // Mozilla Firefox and derivitives (Netscape, Seamonkey)...
try {
// Request full access to the XPCOM (Cross-Platform COM) API.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
}
catch (e) {
// Unable to obtain access, user rejected or setting in about:config not set right.
alert('Please type "about:config" in your browser and press enter. Type "signed.applets.codebase_principal_support" in Filter. Double click to change the value to "true". Then come back and click on the link again.\n\nIf you have already performed this action, make sure when you are asked whether to allow or deny the browser permission, that you are allowing it.');
return;
}
// Create an instance of the clipboard class.
var clipBoard = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
// Create an instance of the Transferable class (used to talk to the clipboard).
var clipTrans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
// Set clipboard format for text only.
clipTrans.addDataFlavor('text/unicode');
// Create XPCOM string, set data to copy of stringVal.
var clipString = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
var copyText = stringVal;
clipString.data = copyText;
// Note: This code may be bugged in some scenarios! 1 char does not always equal 2 bytes in UTF-16!
// Set data to transfer to the clipboard (length * 2, since 1 char is usually 2 bytes in UTF-16).
clipTrans.setTransferData("text/unicode", clipString, copyText.length * 2);
// Transfer data to the global clipboard.
clipBoard.setData(clipTrans, null, clipBoard.kGlobalClipboard);
}
if (!hideAlert)
alert(successMessage);
return true;
}
function toClipboard(stringVal, hideAlert) {
return toClipboardEx(stringVal, hideAlert, "The link has been copied to your clipboard.");
}
function getClipboard() {
if (window.clipboardData) {
return window.clipboardData.getData('Text');
} else if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
}
catch (e) {
alert('Please type "about:config" in your browser and press enter. Type "signed.applets.codebase_principal_support" in Filter. Double click to change the value to "true". Then come back and click on the link again.\n\nIf you have already performed this action, make sure when you are asked whether to allow or deny the browser permission, that you are allowing it.');
return;
}
// Create instances of the Clipboard and Transferable objects.
var clipBoard = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
var clipTrans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
// Get data from global clipboard, place in clipTrans object.
clipTrans.addDataFlavor('text/unicode');
clipBoard.getData(clipTrans, clipBoard.kGlobalClipboard);
// Create objects to pass to getTransferData, which uses XPCOM String
// and Integer classes instead of those normally used by JavaScript.
var objStr = new Object(); var objNumBytes = new Object();
try {
clipTrans.getTransferData('text/unicode', objStr, objNumBytes);
}
catch (error) {
return '';
}
// Query whichever interface is available, opting to use nsISupportsWString.
if (objStr) {
if (Components.interfaces.nsISupportsWString)
objStr = objStr.value.QueryInterface(Components.interfaces.nsISupportsWString);
else if (Components.interfaces.nsISupportsString)
objStr = objStr.value.QueryInterface(Components.interfaces.nsISupportsString);
else
objStr = null;
}
// Note: This code may be bugged in some scenarios! 1 char does not always equal 2 bytes in UTF-16!
// Get data out of the XPCOM string and into a normal JS string.
if (objStr)
return (objStr.data.substring(0, objNumBytes.value / 2));
}
return;
}
// Gets the computed style of an element (browser-independent).
var getCurrentStyle = (document.defaultView ?
function (elem) {
return document.defaultView.getComputedStyle(elem, '');
} :
function (elem) {
return elem.currentStyle;
}
);
// Gets children nodes of an HTML DOM element matching the tag name specified.
function getChildNodesByTag(domElement, tagName) {
var cn = domElement.childNodes;
var nodesPresent = 0, retVal = new Array();
retVal.length = cn.length;
tagName = tagName.toUpperCase();
for (var cv = 0; cv < cn.length; cv++) {
if (cn[cv].nodeType == 1 && cn[cv].nodeName == tagName)
retVal[nodesPresent++] = cn[cv];
}
return retVal.slice(0, nodesPresent);
}
// Returns true on Safari browsers 1.3.4 and older (bad date object behavior in old Safari).
// Check does not work properly if user-agent has been modified by user.
var isSafariVersion13OrOlder = (isWebKit ?
function () {
var navAppVersion = navigator.appVersion;
var phraseToFind = 'AppleWebKit/';
var foundStartAt = navAppVersion.indexOf(phraseToFind) + phraseToFind.length;
var foundEndAt = navAppVersion.indexOf(' ', foundStartAt + 1);
return (parseInt(navAppVersion.substring(foundStartAt, foundEndAt)) < 320);
} :
function () {
return false;
}
);
// Returns true on Safari browsers 2.0.4 and older (textbox/button not stylable before 3.x).
// Check does not work properly if user-agent has been modified by user.
var isSafariVersion20OrOlder = (isWebKit ?
function () {
var navAppVersion = navigator.appVersion;
var phraseToFind = 'AppleWebKit/';
var foundStartAt = navAppVersion.indexOf(phraseToFind) + phraseToFind.length;
var foundEndAt = navAppVersion.indexOf(' ', foundStartAt + 1);
return (parseInt(navAppVersion.substring(foundStartAt, foundEndAt)) < 525);
} :
function () {
return false;
}
);
// Returns true if an event fired too soon after another event.
// Mechanism used on older Safari browsers to prevent
// double-fire problems (especially with key presses).
function safariEventRateLimitBlock() {
if (isWebKit && isSafariVersion13OrOlder()) {
if (safariRateLimited != 0)
return true;
else {
safariRateLimited = setTimeout('safariRateLimited = 0;', 10);
return false;
}
}
}
// Get coordinates relative to document (works out container issues).
// Wrote this so it works in quirks or standards mode.
function getDocumentCoordinates(element) {
var htmlElem = document.body.parentNode;
var bodyElem = document.body;
var pos = { "x": 0, "y": 0 };
pos.toString = function () { return this.x + ', ' + this.y; }
while (element != null) {
pos.x += element.offsetLeft;
pos.y += element.offsetTop;
switch (element.offsetParent) {
case htmlElem:
case bodyElem:
case null:
return pos;
}
element = element.offsetParent;
}
}
// Attach an event handler to an object (browser-independent).
// First clause is W3C DOM method, second is DHTML (IE).
var addEvent = (window.addEventListener ?
function (obj, evType, fn, useCapture) {
try {
obj.addEventListener(evType, fn, useCapture);
} catch (e) { }
return true;
} :
function (obj, evType, fn, useCapture) {
try {
return obj.attachEvent('on' + evType, fn);
} catch (e) { }
}
);
// Release an event handler from an object (browser-independent).
// First clause is W3C DOM method, second is DHTML (IE).
var removeEvent = (window.removeEventListener ?
function (obj, evType, fn, useCapture) {
try {
obj.removeEventListener(evType, fn, useCapture);
} catch (e) { }
return true;
} :
function (obj, evType, fn, useCapture) {
try {
obj.detachEvent('on' + evType, fn);
} catch (e) { }
return true;
}
);
// Stops a DOM event from propagating further than the current handler.
// Note: Returning false from event handlers in IE 6/7/8 does the same thing.
function stopEventPropagation(evObj) {
if (evObj.preventDefault)
evObj.preventDefault();
// Calling cancelButton after stopPropagation
// may negate the stopPropagation so do not do it. -KB
if (evObj.stopPropagation)
evObj.stopPropagation();
else if (evObj.cancelBubble)
evObj.cancelBubble();
}
// These functions assists in obscuring email addresses:
function mailTo(obj) {
//alert('mailto:'+eval(obj.getAttribute('id')));
obj.setAttribute('href', 'mailto:' + eval(obj.getAttribute('id')));
}
function js_mail(obj, Emails) {
var mail_link = Emails[0];
for (var email = 1; email < Emails.length; email++)
if (Emails[email] != null && Emails[email] != '' && Emails[email].substr(1, 4) != 'href') mail_link = mail_link + Emails[email];
obj.setAttribute('href', 'mailto:' + mail_link);
}
// Used to prevent right-click menu from appearing for some clients that wanted this ability.
function antiContextMenuHook() {
// Note: Opera is not hookable.
var showAlert = function () { alert('All images are protected by Copyright. Do not use without permission.'); }
var mdClick = function (e) {
if (!document.all) {
if (e.button == 2 || e.button == 3)
showAlert();
}
else if (event && event.button == 2)
showAlert();
}
var cmClick = function (e) {
if (navigator.userAgent.toLowerCase().indexOf('khtml') > -1) {
// Safari, Konquerer
if (e.preventDefault)
e.preventDefault();
showAlert();
}
if (e.stopPropagation)
e.stopPropagation(); // Mozilla Firefox 2.0
return false; // IE 6.0 and 7.0
}
document.onmousedown = mdClick;
document.oncontextmenu = cmClick;
}
// Form validation functions:
function RegExValidate(expression, value, param) {
var re = new RegExp(expression, param);
if (value != '' && value != undefined) {
if (value.match(re)) return true;
else return false;
}
else return true;
}
// Used for validating emailaddress for special scenarios like continuous periods. - VB
function checkSpecialScenarios(s) {
var bugchars = '!#$^&*()|}{[]?><~%:;/,=`"';
var i;
var lchar = "";
// Search through string's characters one by one.
// If character is not in bag.
for (i = 0; i < s.length; i++) {
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (i > 0) lchar = s.charAt(i - 1)
if (bugchars.indexOf(c) != -1 || (lchar == "." && c == ".")) return false;
}
return true;
}
// JavaScript version of CivicPlus.CMS.Site.Validation.IsValidEmailAddress();
function emailValidate(emailAddress) {
var emailAddressTrimmed = TrimString(emailAddress + "");
if (emailAddressTrimmed != "") {
if (checkSpecialScenarios(emailAddressTrimmed) == false)
return false;
if (emailAddressTrimmed.replace(/[^@]/g, '').length > 1)
return false;
var parts = emailAddressTrimmed.splitRemoveEmpties('@');
if (emailAddressTrimmed.substr(emailAddressTrimmed.length - 1) == '@')
return false;
if (parts.length == 2) {
for (var i = 0; i < parts.length; i++) {
if (((!RegExValidate('^[A-Z0-9]$', parts[i].substr(0, 1), 'i') || !RegExValidate('^[A-Z0-9]$', parts[i].substr(parts[i].length - 1), 'i')) && i == 1) || (!RegExValidate('^[A-Z0-9_%-\\.]+$', parts[i].substr(0, parts[i].length - 1), 'i')))
return false;
}
var lastDotPos = parts[1].lastIndexOf('.');
if (lastDotPos < 0 || parts[1].substr(lastDotPos).length < 3 || (!RegExValidate('^[A-Z]+$', parts[1].substr(lastDotPos + 1), 'i')))
return false;
else
return true;
}
else
return false;
}
else
return false;
}
// Returns: 0 - success, 1 - illegal value, 2 - too large, 3 - too small, 4 - blank.
function intValidateWithRange(value, min, max) {
if (value == '' || value == null) return 4;
if (RegExValidate('^(-|)[0-9]*$', value, 'i')) {
try { var pint = parseInt(value); } catch (ex) { return 1; }
if (pint < min) return 3; else if (pint > max) return 2; return 0;
} else
return 1;
}
// Split function that remotes empty entries.
String.prototype.splitRemoveEmpties = function (separator, howmany) {
var splitArr;
var returnArr = new Array();
if (arguments.length == 2)
splitArr = this.split(separator, howmany);
else
splitArr = this.split(separator);
for (var i = 0; i < splitArr.length; i++) {
if (splitArr[i] != '')
returnArr.push(splitArr[i]);
}
return returnArr;
}
// JavaScript equivalent of a function in GlobalFunctionsDetail.aspx.
// Do not use this function unless you have a good reason (e.g. textarea length on client must match size on server).
// KNOWN: Does not do entities properly, matches server behavior (where's the semi-colon?).
function SQLSafe(strInput) {
return strInput.replace(/\'/g, "'").replace(/\"/g, """);
}
// Returns true if the string is empty. Will blow up on NULLs.
function FieldIsEmpty(strInput) {
if (strInput == undefined)
return true;
return TrimString(strInput).length == 0;
}
// Removes leading and trailing white space from a string. Will blow up on NULLs.
function TrimString(strInput) {
return strInput.replace(/^\s+/g, "").replace(/\s+$/g, "");
}
// Returns true if the value is an integer value.
function isInteger(strInput) {
var leadingZeros = calculateLeadingZeroStrings(strInput);
return leadingZeros == strInput || (strInput == leadingZeros + parseInt(strInput).toString());
}
// Returns true if the value is a real number.
function isRealNumber(strInput) {
var leadingZeros = calculateLeadingZeroStrings(strInput);
return leadingZeros == strInput || (strInput == leadingZeros + parseFloat(strInput));
}
function calculateLeadingZeroStrings(strInput) {
var leadingZeros = "";
if (strInput != null) {
for (var i = 0; i < strInput.length; i++) {
if (strInput[i] == "0") {
leadingZeros += "0";
}
else {
break;
}
}
}
return leadingZeros;
}
// Date validator class.
function dateValidator() {
this.firstValidDate = new Date('01/01/1753');
this.lastValidDate = new Date('01/01/3000');
this.strStartDateID = 'Start/Begin Date';
this.strEndDateID = 'End/Stop/Expiration Date';
this.strStartTimeID = 'Start Time';
this.strEndTimeID = 'End Time';
this.ysnRequireStartDateIfEndSpecified = false;
this.ysnStartDateRequired = false;
this.ysnEndDateRequired = false;
this.ysnStartTimeRequired = false;
this.ysnEndTimeRequired = false;
this.ysnAllowEqualDates = false;
this.ysnAllowTimeOnly = false;
this.ysnCent = false; //Allow only four digit years
var dtiEndDate;
var dtiStartDate;
var dtiStartTime;
var dtiEndTime;
this.timesAlreadyValidated = false;
this.datesAlreadyValidated = false;
this.setStartDate = function (date) {
dtiStartDate = this.cleanDate(date);
}
this.setEndDate = function (date) {
dtiEndDate = this.cleanDate(date);
}
this.setStartDateRequired = function (required) {
this.ysnStartDateRequired = required;
}
this.setEndDateRequired = function (required) {
this.ysnEndDateRequired = required;
}
this.setRequireStartDateIfEndSpecified = function (required) {
this.ysnRequireStartDateIfEndSpecified = required;
}
this.cleanDate = function (date) {
if (date) {
if (typeof isMobileView != 'undefined' && isMobileView) {
date = this.ChangeDateFormatForMobileView(date);
}
else if (RegExValidate('^([0-9\-\\\/]*?)([0-9]{2,4})$', date, 'i')) {
var year = RegExp.$2;
if (year.length == 2) {
if (year >= 50) date = RegExp.$1 + "19" + year;
else date = RegExp.$1 + "20" + year;
}
date = date.replace('\-', '/', 'g');
}
}
return date;
}
this.ChangeDateFormatForMobileView = function (date) {
var rxDatePattern = /^\d{4}\-\d{1,2}\-\d{1,2}$/; //Regex for yyyy-mm-dd format
var match = date.match(rxDatePattern);
if (match != null) {
var dateArray = date.split('-');
var dateFormat = getDateFormat().toLowerCase();
if (dateFormat == "mm/dd/yyyy")
date = dateArray[1] + '/' + dateArray[2] + '/' + dateArray[0];
else if (dateFormat == "dd/mm/yyyy")
date = dateArray[2] + '/' + dateArray[1] + '/' + dateArray[0];
}
return date;
}
this.dateValidate = function (dtiDate, ysnRequired, strID) {
if (!ysnRequired && (dtiDate == null || dtiDate == '')) return true;
else if (ysnRequired && (dtiDate == null || dtiDate == '')) {
if (strID) this.error = strID + ' cannot be blank.';
else this.error = ' cannot be blank';
this.errorNumber = 1;
return false;
}
else if (RegExValidate('^(1[0-2]|0?[1-9])(\/|\-)(0?[1-9]|[1-2][0-9]|3[0-1])\\2([0-9]{4}|[0-9]{2})$', dtiDate, 'i')) {
var month = RegExp.$1;
var day = RegExp.$3;
var year = RegExp.$4;
if (year.length == 2 && this.ysnCent == true) {
if (strID) this.error = strID + ' requires a four digit year';
else this.error = 'Please use a four digit year';
return false;
}
if (year.length == 4 && (year > 3000 || year < 1753)) {
this.error = dtiDate + '\nis outside of the date range.';
this.errorNumber = 2;
return false;
}
if (day == 31 && (month == 4 || month == 6 || month == 9 || month == 11)) {
this.error = 'This month doesn\'t have 31 days';
this.errorNumber = 3;
return false;
}
if (day >= 30 && month == 2) {
this.error = 'February doesn\'t have ' + day + ' days';
this.errorNumber = 4;
return false;
}
if (month == 2 && day == 29 && !(year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) {
this.error = 'This is not a leap year\nFebruary doesn\'t have 29 days.';
this.errorNumber = 5;
return false;
}
return true;
} else {
if (strID) this.error = strID + ' is not a valid date format.\nPlease use ' + getDateFormat().toUpperCase() + '.';
else this.error = dtiDate + '\n is an invalid date format.\nPlease use ' + getDateFormat().toUpperCase() + '.';
this.errorNumber = 6;
return false;
}
return false;
}
this.dateOrderValidate = function () {
if (this.dateValidate(dtiStartDate, this.ysnStartDateRequired, this.strStartDateID) && this.dateValidate(dtiEndDate, this.ysnEndDateRequired, this.strEndDateID)) {
if (this.ysnRequireStartDateIfEndSpecified && !dtiStartDate && dtiEndDate) {
this.error = 'A Start Date must be specified if an End Date was entered.';
this.errorNumber = 9;
return false;
}
if (!dtiStartDate || !dtiEndDate) return true;
else {
var StartDate = new Date(dtiStartDate);
var EndDate = new Date(dtiEndDate);
}
if (StartDate.getTime() < EndDate.getTime()) return true;
else if (StartDate.getTime() == EndDate.getTime() && this.ysnAllowEqualDates == true) {
this.ysnDatesAreEqual = true;
return true;
} else {
this.error = 'The End Date must be after the Start Date.';
this.errorNumber = 7;
return false;
}
}
else return false;
}
this.dateValidateNew = function (dtiDate, ysnRequired, strID) {
var month;
var day;
var year;
if (dtiDate === undefined)
dtiDate = '';
if (!ysnRequired && (dtiDate == '' || !dtiDate)) return true;
if (ysnRequired && dtiDate == '') {
if (strID) this.error = strID + ' is required';
else this.error = ' is required';
this.errorNumber = 1;
return false;
}
var dateFormat = getDateFormat().toLowerCase();
if (typeof isMobileView != 'undefined' && isMobileView) {
dtiDate = this.ChangeDateFormatForMobileView(dtiDate);
}
if ((dateFormat == "mm/dd/yyyy") && (RegExValidate('^(1[0-2]|0?[1-9])(\/|\-)(0?[1-9]|[1-2][0-9]|3[0-1])\\2([0-9]{4}|[0-9]{2})$', dtiDate, 'i'))) {
month = RegExp.$1;
day = RegExp.$3;
year = RegExp.$4;
return this.validDateParts(month, day, year);
}
if ((dateFormat == "dd/mm/yyyy") && (RegExValidate('^(0?[1-9]|[1-2][0-9]|3[0-1])(\/|\-)(1[0-2]|0?[1-9])\\2([0-9]{4}|[0-9]{2})$', dtiDate, 'i'))) {
month = RegExp.$3;
day = RegExp.$1;
year = RegExp.$4;
return this.validDateParts(month, day, year);
}
if (strID) this.error = strID + ' is not a valid date format.\nPlease use ' + dateFormat.toUpperCase() + '.';
else this.error = dtiDate + '\n is an invalid date format.\nPlease use ' + dateFormat.toUpperCase() + '.';
this.errorNumber = 6;
return false;
}
this.validDateParts = function (month, day, year) {
if (year.length == 2 && this.ysnCent == true) {
if (strID) this.error = strID + ' requires a four digit year';
else this.error = 'Please use a four digit year';
return false;
}
if (year.length == 4 && (year > 3000 || year < 1753)) {
this.error = dtiDate + '\nis outside of the date range.';
this.errorNumber = 2;
return false;
}
if (day == 31 && (month == 4 || month == 6 || month == 9 || month == 11)) {
this.error = 'This month doesn\'t have 31 days';
this.errorNumber = 3;
return false;
}
if (day >= 30 && month == 2) {
this.error = 'February doesn\'t have ' + day + ' days';
this.errorNumber = 4;
return false;
}
if (month == 2 && day == 29 && !(year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) {
this.error = 'This is not a leap year\nFebruary doesn\'t have 29 days.';
this.errorNumber = 5;
return false;
}
return true;
}
this.dateOrderValidateNew = function () {
//If sending in US format run dateValidateNew first becuase it expects dates in daybeforemonth format
if (this.datesAlreadyValidated || (this.dateValidateNew(dtiStartDate, this.ysnStartDateRequired, this.strStartDateID) && this.dateValidateNew(dtiEndDate, this.ysnEndDateRequired, this.strEndDateID))) {
if (this.ysnRequireStartDateIfEndSpecified && !dtiStartDate && dtiEndDate) {
this.error = 'A Start Date must be specified if an End Date was entered.'
this.errorNumber = 9; return false;
}
if (!dtiStartDate || !dtiEndDate || dtiEndDate == "NaN/NaN/NaN" || dtiStartDate == "NaN/NaN/NaN") return true;
else {
//Expects dates in US format
var StartDate = new Date(dtiStartDate);
var EndDate = new Date(dtiEndDate);
}
if (StartDate.getTime() < EndDate.getTime()) return true;
else if (StartDate.getTime() == EndDate.getTime() && this.ysnAllowEqualDates == true) {
this.ysnDatesAreEqual = true;
return true;
}
else {
this.error = 'The End Date must be after the Start Date.';
this.errorNumber = 7; return false;
}
}
else return false;
}
this.getStandardDate = function (dateText) {
$.ajax({
url: '/Utility/GetDate?dateText=' + dateText,
async: false,
type: 'GET',
dataType: 'json',
success: function (data) {
dateText = data.date;
},
error: function (jqXHR, textStatus, errorThrown) {
}
});
return dateText;
}
this.smallDateTimeMaxValueValidate = function () {
var StartDate = new Date(dtiStartDate);
var EndDate = new Date(dtiEndDate);
var MaxDate = new Date('05/06/2079 23:59:59');
var result = true;
if (StartDate <= MaxDate && EndDate <= MaxDate) {
result = true;
}
else if (StartDate > MaxDate) {
this.error = "The Start Date must be less than '5/6/2079'.";
this.errorNumber = 2;
result = false;
}
else if (EndDate > MaxDate) {
this.error = "The End Date must be less than '5/6/2079'.";
this.errorNumber = 3;
result = false;
}
return result;
}
this.format = function (format, date) {
if (!date) date = new Date();
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
return format.toLowerCase().replace(/dd/g, day).replace(/mm/g, month).replace(/y{1,4}/g, year)
}
this.timeValidate = function (ditTime, ysnRequired, strID) {
if (!ysnRequired && ditTime == '') return true;
else if (ysnRequired && ditTime == '') {
if (strID) this.error = strID + ' is required';
else this.error = 'Time is required';
this.errorNumber = 1;
return false;
}
else if (RegExValidate('^(1[0-2]|0?[1-9]):([0-5]?[0-9])(:([0-5][0-9]))?$', ditTime, 'i')) return true;
else {
if (strID) this.error = strID + ' is not a valid time format. Please use HH:MM.';
else this.error = ' is not a valid time format. Please use HH:MM.';
this.errorNumber = 8;
return false;
}
}
this.timeValidate24Hour = function (ditTime, ysnRequired, strID) {
if (!ysnRequired && ditTime == '') return true;
else if (ysnRequired && ditTime == '') {
if (strID) this.error = strID + ' is required';
else this.error = 'Time is required';
this.errorNumber = 1;
return false;
}
else if (RegExValidate('^([01]?[0-9]|2[0-3]):([0-5]?[0-9])(:([0-5][0-9]))?$', ditTime, 'i')) return true;
else {
if (strID) this.error = strID + ' is not valid.';
else this.error = ' is not valid.';
this.errorNumber = 8;
return false;
}
}
this.timeOrderValidate = function () {
if (!this.ysnAllowTimeOnly && ((!dtiStartDate && this.dtiStartTime) || (!dtiEndDate && this.dtiEndTime))) {
this.error = 'You only submited a time.\nPlease provide a day as well.';
this.errorNumber = 10;
this.startDateBlank = (!dtiStartDate && this.dtiStartTime);
this.endDateBlank = (!dtiEndDate && this.dtiEndTime);
return false;
}
if (this.timesAlreadyValidated || (this.timeValidate(this.dtiStartTime, this.ysnStartTimeRequired, this.strStartTimeID) && this.timeValidate(this.dtiEndTime, this.ysnEndTimeRequired, this.strEndTimeID))) {
if (!this.ysnDatesAreEqual) return true;
if (!this.dtiStartTime && !this.ysnStartTimeRequired) return true;
if (!this.dtiEndTime && !this.ysnEndTimeRequired) return true;
var dtiStartTime = this.convertTo24Hour(this.dtiStartTime, this.strStartAMPM, dtiStartDate);
var dtiEndTime = this.convertTo24Hour(this.dtiEndTime, this.strEndAMPM, dtiEndDate);
if (dtiStartTime.getTime() < dtiEndTime.getTime()) return true;
else if (dtiStartTime.getTime() == dtiEndTime.getTime() && this.ysnAllowEqualTimes == true) {
this.ysnTimesAreEqual = true;
return true;
}
else {
this.error = 'The End Time must be after the Start Time if the Start and End Dates are the same.'
this.errorNumber = 9;
return false;
}
}
return false;
}
this.convertTo24Hour = function (time, AMPM, date) {
if (!date) date = "1/1/70";
var dtTime = time.indexOf(AMPM) == -1 ? new Date(date + " " + time + " " + AMPM) : new Date(date + " " + time);
if (dtTime == 'Invalid Date') {
var dayBeforeMonthOn = getDateFormat().toLocaleLowerCase() == "dd/mm/yyyy" ? true : false;
if (dayBeforeMonthOn) {
var dateArray = date.split('/');
date = dateArray[1] + '/' + dateArray[0] + '/' + dateArray[2];
dtTime = time.indexOf(AMPM) == -1 ? new Date(date + " " + time + " " + AMPM) : new Date(date + " " + time);
}
}
return dtTime;
}
}
// Helper function for inputAlert().
function inputEmailValidate(obj, required) {
if (required == null || required == false)
return (obj.value == '' || emailValidate(obj.value) == true)
else
return (obj.value != '' && emailValidate(obj.value) == true)
}
// Note: This function does not match standard validation behavior! Users are supposed to see
// a summary of problems with their inputs and not be alerted multiple times!
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Calls another validation routine, and determines success/failure on result of call (true/false).
// Displays error message on validation failure. Returns result of call.
function inputAlert(call, obj, required, errorMessage) {
call = eval('input' + call + 'Validate');
if (call(obj, required) == false) {
if (errorMessage == null)
errorMessage = 'Please enter a single valid email address without any extra body, subject, etc. information (ie user@domain.com).';
obj.setAttribute('autocomplete', 'off');
obj.focus();
obj.setAttribute('autocomplete', 'on');
alert(errorMessage);
return false;
}
else
return true;
}
// Takes array of required fields and checks whether they have a value or not
// If empty fields found, formats a javascript alert to inform the user and returns true
function checkRequiredFieldsEmpty(requiredFieldList) {
var badList = new Array();
for (var i = 0, len = requiredFieldList.length; i < len; i++) {
var $this = requiredFieldList[i];
var $fieldId = $('#' + $this);
if (($fieldId.length > 0) && (FieldIsEmpty($fieldId.val()))) {
var $label = $('label[for=' + $this + ']');
if ($label.length > 0)
badList.push($label.text().trim());
else
badList.push($this);
}
}
if (badList.length > 0) {
var msg = badList.join(" cannot be blank.\r\n");
msg += " cannot be blank.";
msg = msg.replace(/\*/g, '');
alert(msg);
return true;
}
return false;
}
// End Form Validation functions.
// Begin AJAX functions:
// See http://blogs.msdn.com/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx
// If you are curious why the XMLHTTP versions specified are and why others are not.
function makeErrorRequest(url, status) {
var http_error_request = false;
var origin = location.pathname;
if (window.XMLHttpRequest) { // Mozilla, Safari, IE7
http_error_request = new XMLHttpRequest();
if (http_error_request.overrideMimeType)
http_error_request.overrideMimeType("text/html");
} else if (window.ActiveXObject) { // IE6
try {
http_error_request = new ActiveXObject("Msxml2.XMLHTTP.6.0");
} catch (e) {
try {
http_error_request = new ActiveXObject("Msxml2.XMLHTTP"); // Version 3.0
} catch (e) { }
}
}
http_error_request.onreadystatechange = function () { }
http_error_request.open("GET", "/AJAX-error.ashx?url=" + escape(url) + "&status=" + status + "&origin=" + escape(origin), true);
http_error_request.send(null);
//if(status == 403)
//window.location = '/admin/AccessDenied.aspx?fromURL=' + window.location.pathname.substr(7);
}
// Makes AJAX request, additionally supporting POST data (makeHttpRequest doesn't).
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Note: It's YOUR responsibility as a developer to make sure data
// placed in formData is formatted as it should be. Form data should be
// in Query String format with the value portions escape()'d. -KB
function makeHttpRequestEx(URL, formData, callbackFunc, ysnReturnXML) {
URL = window.location.origin + URL;
if (formData != null) {
$.ajax({
type: 'POST',
url: URL,
data: formData,
success: callbackFunc
});
}
else {
$.ajax({
type: 'GET',
url: URL,
success: callbackFunc
});
}
}
// NOTE: Do not use this in new code, use $.ajax() instead.
// Makes AJAX request. Used in n-menu code.
function makeHttpRequest(url, callback_function, return_xml) {
var http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari, IE7
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType && !return_xml)
http_request.overrideMimeType("text/html");
} else if (window.ActiveXObject) { // IE6
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP.6.0");
} catch (e) {
try {
http_request = new ActiveXObject("MSxml2.XMLHTTP"); // Version 3
} catch (e) { }
}
}
if (!http_request) {
alert("Unfortunately, your browser doesn't support this feature.");
return false;
}
http_request.onreadystatechange = function () {
if (http_request.readyState == 4) {
--ajax_call_counter;
//try {
if (http_request.status == 200) {
if (return_xml)
eval(callback_function + ', http_request.responseXML)');
else {
if (http_request.responseText.search(/