var agent = null; var version = parseFloat(navigator.appVersion); if (navigator.userAgent.indexOf(" MSIE ") > -1) agent = "IE"; else if (navigator.userAgent.indexOf(" Firefox/") > -1) agent = "FF"; else if (navigator.userAgent.indexOf(" Safari/") > -1) agent = "SF"; else if (navigator.userAgent.indexOf("Opera/") > -1) agent = "OP"; function getClientBounds() { var a; var b; switch (agent) { case "IE": a = document.documentElement.clientWidth; b = document.documentElement.clientHeight; break; case "SF": a = window.innerWidth; b = window.innerHeight; break; case "OP": a = Math.min(window.innerWidth, document.body.clientWidth); b = Math.min(window.innerHeight, document.body.clientHeight); break; default: a = Math.min(window.innerWidth, document.documentElement.clientWidth); b = Math.min(window.innerHeight, document.documentElement.clientHeight); break } return a + '|' + b } function NewWindow(a, b, c, d, e, f) { var g, fTopPosition; var h; g = (screen.width) ? (screen.width - c) / 2 : 0; fTopPosition = (screen.height) ? (screen.height - d) / 2 : 0; h = 'height=' + d + ',width=' + c + ',top=' + fTopPosition + ',left=' + g + ',scrollbars=' + e + ',resizable=' + f; window.open(a, b, h) } function ShowDiv(a) { var b = document.getElementById(a); if (b != null) b.style.display = 'block' } function getElement(a) { return document.getElementById(a) } function HideDiv(a) { var b = document.getElementById(a); if (b != null) b.style.display = 'none' } function NewWindow(a, b, c, d, e, f) { var g, fTopPosition; var h; g = (screen.width) ? (screen.width - c) / 2 : 0; fTopPosition = (screen.height) ? (screen.height - d) / 2 : 0; h = 'height=' + d + ',width=' + c + ',top=' + fTopPosition + ',left=' + g + ',scrollbars=' + e + ',resizable=' + f; window.open(a, b, h) } function isCurrency(a) { strValue = a.value; regexp = /^(([0-9]{1,3}(\,[0-9]{3})*)|([0-9]{0,3}))(\.[0-9]{2})?$/; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isFloat(a) { strValue = a.value; regexp = /^(\+|\-)?([0-9]+)(((\.|\,)?([0-9]+))?)$/; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isInteger(a) { strValue = getValue(a); regexp = /^(\+|\-)?([0-9]+)$/; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isUserName(a) { strValue = getValue(a); regexp = /^([^$@\\ ]+)$/; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isEmail(a) { strValue = getValue(a); regexp = /^[A-Za-z0-9']+([_\.\-\+]?[a-zA-Z0-9']+)*\@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,5}$/; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isEmptyFCK(a) { var b = a.id + '_ccEditor'; strValue = FCKeditorAPI.GetInstance(b).GetXHTML(); rexp = / /gi; strValue = strValue.replace(rexp, ''); rexp = /

<\/p>/gi; strValue = strValue.replace(rexp, ''); rexp = /

 <\/p>/gi; strValue = strValue.replace(rexp, ''); rexp = /\
/gi; strValue = strValue.replace(rexp, ''); if (isEmpty(strValue)) { return true } return false } function isNotEmptyFCK(a) { var b = document.getElementById(a.controltovalidate); return !isEmptyFCK(b) } function isURL(a) { strValue = getValue(a); regexp = /^http(s?):\/\/([^$@\\ ]+)$/i; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isEmailList(a) { strValue = getValue(a); rexp = /, /gi; strValue = strValue.replace(rexp, ','); rexp = / ,/gi; strValue = strValue.replace(rexp, ','); strArray = strValue.split(","); regexp = /^[A-Za-z0-9']([_\.\-\+]?[a-zA-Z0-9']+)*\@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,5}$/; for (var i = 0; i < strArray.length; i++) { if (isEmpty(strArray[i])) return false; if (!regexp.test(strArray[i])) return false } a.value = strValue; return true } function isZip(a) { strValue = getValue(a); if (isEmpty(strValue)) { return false } if (strValue.indexOf('-') >= 0) { regexp = /^\d{5}-\d{4}$/ } else { regexp = /^\d{5}$/ } return regexp.test(strValue) } function isPhone(a) { strValue = getValue(a); regexp = /^1{0,1} *(-| ){0,1} *[\(]*[0-9]{0,3}[\)]* *(-| ){0,1} *[0-9]{3} *(-| ){0,1} *[0-9]{4}$/; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isFax(a) { strValue = getValue(a); regexp = /^\d{3}-\d{3}-\d{4}$/; if (isEmpty(strValue)) { return false } return regexp.test(strValue) } function isEmpty(s) { if (s == null || trim(s) == '') { return true } else { return false } } function isText(f) { return !isEmptyField(f) } function isNotEmptyDate(a) { return !isEmptyDate(a) } function isNotEmptyTime(a) { return !isEmptyTime(a) } function isEmptyDate(a) { var b = document.getElementById(a.controltovalidate + '_txtDatePicker'); return isEmptyField(b) } function isEmptyTime(a) { var b = document.getElementById(a.controltovalidate + '_H'); var c = document.getElementById(a.controltovalidate + '_M'); var d = document.getElementById(a.controltovalidate + '_AMPM'); if (b.selectedIndex == 0) return true; if (c.selectedIndex == 0) return true; if (d.selectedIndex == 0) return true; return false } function isValidDate(a) { var b = document.getElementById(a.controltovalidate + '_txtDatePicker'); return isDate(b) } function isValidTime(a) { var b = document.getElementById(a.controltovalidate + '_H'); var c = document.getElementById(a.controltovalidate + '_M'); var d = document.getElementById(a.controltovalidate + '_AMPM'); if (b.selectedIndex == 0 && c.selectedIndex == 0 && d.selectedIndex == 0) return true; if (b.selectedIndex == 0) return false; if (c.selectedIndex == 0) return false; if (d.selectedIndex == 0) return false; return true } function isDate(a) { if (isEmptyField(a)) return true; var b = a.value.split('/'); if (b.length != 3) return false; return CheckDate(b[0], b[1], b[2]) } function CheckDate(m, d, y) { Months = "31/!/28/!/31/!/30/!/31/!/30/!/31/!/31/!/30/!/31/!/30/!/31"; MonthArray = Months.split("/!/"); if (isNaN(parseInt(m, 10))) return false; if (isNaN(parseInt(d, 10))) return false; if (isNaN(parseInt(y, 10))) return false; if (d != parseInt(d, 10)) return false; if (m != parseInt(m, 10)) return false; if (y != parseInt(y, 10)) return false; d = parseInt(d, 10); m = parseInt(m, 10); y = parseInt(y, 10); y = convertYear(y); if (y <= 1900) return false; if (y >= 2100) return false; if (m < 1 || m > 12) return false; if (isLeapYear(y)) MonthArray[1] = eval(eval(MonthArray[1]) + 1); if (d < 1 || MonthArray[m - 1] < d) return false; return true } function convertYear(y) { var a = 40; yearvalue = parseInt(y, 10); if (isNaN(yearvalue)) return y; if (yearvalue - a <= 0) { yearvalue = yearvalue + 2000 } else if (yearvalue - 100 < 0) { yearvalue = yearvalue + 1900 } return yearvalue } function isLeapYear(a) { if (Math.round(a / 4) == a / 4) { if (Math.round(a / 100) == a / 100) { if (Math.round(a / 400) == a / 400) return true; else return false } else return true } return false } function getValue(a) { fieldType = a.type; if (fieldType == "text") { return getTextValue(a) } else if (fieldType == "hidden") { return getTextValue(a) } else if (fieldType == "select-one") { return getListValue(a) } else if (fieldType == "textarea") { return getTextValue(a) } else if (fieldType == "file") { return getTextValue(a) } else if (fieldType == "password") { return getTextValue(a) } else if (fieldType == "checkbox") { return getCheckboxValue(a) } else if (isNaN(fieldType)) { return getRadioValue(a) } else { return getTextValue(a) } } function getListValue(a) { return a[a.selectedIndex].value } function getTextValue(a) { return a.value } function getCheckboxValue(a) { if (a.checked) return a.value; return '' } function getRadioValue(a) { found = false; if (isNaN(a.length)) { return a.value } for (var i = 0; i < a.length; i++) { if (a[i].checked) { return a[i].value; break } } return !found } function trim(a) { while (a.substring(0, 1) == " ") { a = a.substring(1, a.length) } while (a.substring(a.length - 1, a.length) == " ") { a = a.substring(0, a.length - 1) } return a } function isEmptyList(a) { return isEmpty(a[a.selectedIndex].value) } function isEmptyText(a) { return isEmpty(a.value) } function isEmptyCheckbox(a) { return !a.checked } function isEmptyField(a) { fieldType = a.type; if (fieldType == "text") { return isEmptyText(a) } else if (fieldType == "hidden") { return isEmptyText(a) } else if (fieldType == "file") { return isEmptyText(a) } else if (fieldType == "select-one") { return isEmptyList(a) } else if (fieldType == "textarea") { return isEmptyText(a) } else if (fieldType == "password") { return isEmptyText(a) } else if (fieldType == "checkbox") { return isEmptyCheckbox(a) } else if (isNaN(fieldType)) { return isEmptyRadio(a) } else { return isEmptyText(a) } } function isDefined(a) { if (typeof (a) == "undefined") { return false } else { return true } } function isEmptyRadio(a) { found = false; if (isNaN(a.length)) { return !a.checked } for (var i = 0; i < a.length; i++) { if (a[i].checked) { found = true; break } } return !found } function isNotEmptyFile(a) { return !isEmptyFile(a) } function isEmptyFile(a) { var b, fid, cid, bDelChecked = false; b = document.getElementById(a.controltovalidate + '_OLD'); fid = document.getElementById(a.controltovalidate + '_FILE'); cid = document.getElementById(a.controltovalidate + '_CHK'); if (cid != null) { bDelChecked = cid.checked } return (isEmptyField(b) && isEmptyField(fid) || isEmptyField(fid) && bDelChecked) } function isNotEmptyCheckBoxList(a) { var b = document.getElementById(a.controltovalidate); var c = b.getElementsByTagName('INPUT'); var d = false; for (var i = 0; i < c.length; i++) { if (c[i].checked) return true } return false } function isValidFile(a) { if (isEmptyFile(a)) return true; var b = document.getElementById(a.controltovalidate + '_FILE'); if (isEmptyField(b)) return true; var c = getValue(b); var d = c.lastIndexOf("."); if (d == -1) return false; var e = c.substring(d + 1, c.length); c = c.substring(0, d); if (c == '') return false; var f = a.extensions.split(","); for (i = 0; i < f.length; i++) { if (f[i] == e.toLowerCase()) return true } return false } function limit(a, b, c, t) { var e, ta2, d; d = document.getElementById(a + 'DIV'); if (!d) return; if (c < 1) { d.innerHTML = ""; return } ctrl = document.getElementById(a + '_ctrl'); x = c - ctrl.value.length; if (x < 0) { ctrl.value = ctrl.value.substring(0, c); x = 0 } e = document.getElementById(a + 'TA1'); e.style.width = Math.floor(b * (c - x) / c) + 'px'; e.alt = c - x + " chars used"; ta2 = document.getElementById(a + 'TA2'); ta2.style.width = Math.floor(b * x / c) + 'px'; ta2.alt = x + " chars available"; d.innerHTML = t.replace("%%COUNT%%", x); window.status = e.width + " : " + ta2.width } var ctrl_to_disable; var msg_to_display; function PleaseWait(a, b) { b ? msg_to_display = b : msg_to_display = 'Please wait...'; ctrl_to_disable = a; window.setTimeout("PleaseWaitTimeout()", 10) } function PleaseWaitImageButton(a) { ctrl_to_disable = a; window.setTimeout("PleaseWaitTimeout()", 10) } function PleaseWaitTimeout(a) { if (ctrl_to_disable.type == 'image') { ctrl_to_disable.src = '/cms/images/spacer.gif'; ctrl_to_disable.onclick = 'return false' } else { ctrl_to_disable.value = msg_to_display; ctrl_to_disable.disabled = true } } function expandit(a) { var b = document.getElementById('SPAN' + a).style; var c = document.getElementById('IMG' + a); var d = document.getElementById('imgtext' + a); if (b.display == "none") { b.display = "block"; c.src = c.src.replace(/down/i, "up"); d.innerText = 'Hide Image' } else { b.display = "none"; c.src = c.src.replace(/up/i, "down"); d.innerText = 'View Image' } } function createCookie(a, b, c) { var d = a + "=" + escape(b); if (c) { var e = new Date(); e.setTime(e.getTime() + (c * 24 * 60 * 60 * 1000)); d += "; expires=" + e.toGMTString() } document.cookie = d + "; path=/" } function readCookie(a) { var b = a + "="; var d = document.cookie.split(';'); for (var i = 0; i < d.length; i++) { var c = d[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(b) == 0) return c.substring(b.length, c.length) } return null } function eraseCookie(a) { createCookie(a, "", -1) } function getCookie(a) { if (document.cookie.length > 0) { begin = document.cookie.indexOf(a + "="); if (begin != -1) { begin += a.length + 1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)) } } return null } var currentContent = null; function slideOpen(a, b, c, d) { var e = document.getElementById(a); if (e != null) { if (e.style.display == "none") { if (currentContent == null) { currentContent = e; var f = (e.style.display == "none"); if (f) e.style.display = "block"; var g = e.offsetHeight; var h = c + (f ? 0 : -g); e.style.height = Math.abs(h) + "px"; setTimeout("togglePannelAnimatingStatus(" + b + "," + c + "," + g + "," + h + ")", b); AddPageSearchVisibleState('AdminSearchFieldVisibility', d) } } } } function slideClose(a, b, c, d) { var e = document.getElementById(a); if (e != null) { if (e.style.display == "block") { if (currentContent == null) { currentContent = e; var f = (e.style.display == "none"); if (f) e.style.display = "block"; var g = e.offsetHeight; var h = c + (f ? 0 : -g); e.style.height = Math.abs(h) + "px"; setTimeout("togglePannelAnimatingStatus(" + b + "," + c + "," + g + "," + h + ")", b); RemovePageSearchVisibleState('AdminSearchFieldVisibility', d) } } } } function togglePannelAnimatingStatus(a, b, c, d) { var e = Math.abs(d); if (e >= b && e <= (c - b)) { d += b; currentContent.style.height = Math.abs(d) + "px"; setTimeout("togglePannelAnimatingStatus(" + a + "," + b + "," + c + "," + d + ")", a) } else { if (e < b) currentContent.style.display = "none"; currentContent.style.height = ""; currentContent = null } } function SetSearchFieldVisibility(a, b) { var c = document.getElementById(a); if (c != null) { if (IsPageSearchVisible('AdminSearchFieldVisibility', b)) { c.style.display = 'block' } else { c.style.display = 'none' } } } function AddPageSearchVisibleState(c, a) { var b = readCookie(c); var d = 90; if (b == null) { eraseCookie(c); createCookie(c, a, 7300) } else { var e = b.split("**"); var f = false; for (i = 0; i < e.length; i++) { if (e[i] == a) { f = true; break } } if (!f) { eraseCookie(c); var g = (e.length >= d) ? (TrimCookieSize(e)) : (b); createCookie(c, g + "**" + a, 7300) } } } function RemovePageSearchVisibleState(c, a) { var b = readCookie(c); if (b != null) { var d = b.split("**"); var e = false; var f = ""; for (i = 0; i < d.length; i++) { if (d[i] != a) { f += (f == "") ? (d[i]) : ("**" + d[i]) } } if (b != f) { eraseCookie(c); createCookie(c, f, 7300) } } } function IsPageSearchVisible(c, a) { var b = readCookie(c); if (b != null) { var d = b.split("**"); for (i = 0; i < d.length; i++) { if (d[i] == a) { return true } } } return false } function TrimCookieSize(a) { var b = a.slice(1); var c = ""; for (i = 0; i < b.length; i++) { c += b[i] } return c } function GetTop() { if (window.pageYOffset) { sHeight = window.pageYOffset + (document.documentElement.clientHeight / 2) + 'px' } else { sHeight = (document.documentElement.clientHeight / 2) + 'px' }; return sHeight } function GetHeight() { var a; if (window.pageYOffset) { a = window.innerHeight - 80 + 'px' } else { a = document.documentElement.clientHeight - 80 + 'px' }; return a } function GetWidth() { var a; if (window.pageYOffset) { a = window.innerWidth - 80 + 'px' } else { a = document.documentElement.clientWidth - 80 + 'px' }; return a } function acePopulated(a, b) { var c = a.get_completionList(); var d = c.childNodes; for (var i = 0; i < d.length; i++) { var e = d[i]; var f = e._value; e.innerHTML = e.innerHTML.replace(/>/g, '>').replace(/</g, '<') } } function centerElement(a) { var b = document.getElementById(a); if (!b) return; var c = getClientBounds(); var d = c.split('|'); var e = d[0]; var f = d[1]; var g = getPageHeight(); var h = f; if (g > h) h = g; else h = h - 10; var x = 0; var y = 0; if (document.documentElement && document.documentElement.scrollTop) { x = document.documentElement.scrollLeft; y = document.documentElement.scrollTop } else { x = document.body.scrollLeft; y = document.body.scrollTop } x = Math.max(0, Math.floor(x + e / 2.0 - b.offsetWidth / 2.0)); y = Math.max(0, Math.floor(y + f / 2.0 - b.offsetHeight / 2.0)); b.style.left = x + 'px'; b.style.top = y + 'px' } function getCoordinates(a) { var b = document.getElementById(a); if (!b) return; return b.style.left.replace('px', '') + ';' + b.style.top.replace('px', '') } function centerElementInElement(a, b) { var c = document.getElementById(a); var d = document.getElementById(b); if (!c || !d) return; var e = d.offsetWidth; var f = d.offsetHeight; var g = c.offsetWidth; var h = c.offsetHeight; var x = 0; var y = 0; if (g < e) x = (e / 2) - (g / 2); if (h < f) y = (f / 2) - (h / 2); c.style.left = x + 'px'; c.style.top = y + 'px' } function getElementsByClassName(oElm, strTagName, strClassName) { var arrElements = (strTagName == "*" && oElm.all) ? oElm.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); strClassName = strClassName.replace(/\-/g, "\\-"); var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)"); var oElement; for (var i = 0; i < arrElements.length; i++) { oElement = arrElements[i]; if (oRegExp.test(oElement.className)) { arrReturnElements.push(oElement) } } return (arrReturnElements) } function ShowChars(e, t, l) { $(e).css('top', (t - $(e).height()) - 16 + 'px'); $(e).css('left', (l - $(e).width()) + 'px'); $(e).toggle('medium'); return false; } function EnterPressed(e) { var code = (e.which ? e.which : e.keyCode); if (code == 13) { return true; } return false; } function gotoNextField(e, orig, id, len) { var code = (e.which ? e.which : e.keyCode); if (code == 9 || code == 16 || code == 8 || code == 18 || code == 20) return; if ($("#" + orig).val().length == len) $("#" + id).focus().select(); } if (!(window.console && console.log)) { console = { log: function () { }, debug: function () { }, info: function () { }, warn: function () { }, error: function () { } }; }